Index: waeup/branches/ulif-layout/src/waeup/university/facultycontainer.py
===================================================================
--- waeup/branches/ulif-layout/src/waeup/university/facultycontainer.py	(revision 4688)
+++ waeup/branches/ulif-layout/src/waeup/university/facultycontainer.py	(revision 4689)
@@ -1,14 +1,6 @@
-import sys
 import grok
-from zope.component import getUtility
-from zope.component.factory import Factory
-from zope.component.interfaces import Invalid, IFactory
-from zope.component import createObject
-from zope.exceptions import DuplicationError
+from zope.component.interfaces import IFactory
 from zope.interface import implementedBy
-from waeup.interfaces import IFacultyContainer, IFaculty, IWAeUPCSVImporter
-from waeup.viewlets import (MainArea, LeftSidebar, Index, Add, Manage,
-                            FormWrapMixin)
-from waeup.widgets.interfaces import ITableProvider
+from waeup.interfaces import IFacultyContainer, IFaculty
 
 class FacultyContainer(grok.Container):
@@ -49,112 +41,2 @@
     def getInterfaces(self):
         return implementedBy(FacultyContainer)
-
-
-#
-# Viewing / Layout stuff...
-#
-class Content(grok.Viewlet):
-    grok.viewletmanager(MainArea)
-    grok.context(IFacultyContainer)
-    grok.view(Index)
-
-    def update(self):
-        self.table = ITableProvider(self.context).getTables(self.view)[0]
-        self.table.need()
-    
-    def getFaculties(self):
-        """Convinience method to create a sorted list of faculties.
-
-        It provides a list of dicts with entries for all data needed by
-        usual list templates.
-        """
-        result = []
-        for key, val in self.context.items():
-            result.append(dict(id=key, name=val.title))
-        return result
-
-class ManageFacultyContainer(grok.Viewlet):
-    grok.viewletmanager(MainArea)
-    grok.context(IFacultyContainer)
-    grok.view(Manage)
-    grok.template('manage')    
-
-    def update(self):
-        form = self.request.form
-        if 'CANCEL' in form.keys():
-            self.view.redirect(self.view.url(self.context))
-        if not 'DELETE' in form.keys():
-            return
-        fac_id = form['fac_id']
-        if not isinstance(fac_id, list):
-            fac_id = [fac_id]
-        deleted = []
-        for id in fac_id:
-            try:
-                del self.context[id]
-                deleted.append(id)
-            except:
-                self.view.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.view.flash('Successfully deleted: %s' % ', '.join(deleted))
-        # We have to redirect to let flash messages appear immediately...
-        self.view.redirect(self.view.url())
-        return
-        
-class AddFacultyForm(grok.AddForm):
-    grok.context(IFacultyContainer)
-    form_fields = grok.AutoFields(IFaculty)
-    label = 'Add a faculty'
-
-    @grok.action('Add faculty')
-    def addFaculty(self, **data):
-        faculty = createObject(u'waeup.Faculty')
-        self.applyData(faculty, **data)
-        try:
-            self.context.addFaculty(faculty)
-        except DuplicationError:
-            self.status = Invalid('The name chosen already exists '
-                                  'in the database')
-            return
-        self.redirect(self.url(self.context))
-
-        
-class AddFaculty(FormWrapMixin, grok.Viewlet):
-    """A viewlet that wraps the `AddFacultyForm`.
-    """
-    grok.viewletmanager(MainArea)
-    grok.context(IFacultyContainer)
-    grok.view(Add)
-    grok.require('waeup.manageUniversity')
-
-    formview_name = 'addfacultyform' # The name of the formview we
-                                     # want to be rendered in this
-                                     # viewlet.
-
-
-class AddFacultyLink(grok.Viewlet):
-    """A link in the left sidebar displaying 'Add faculty'
-    """
-    grok.viewletmanager(LeftSidebar)
-    grok.context(IFacultyContainer)
-    grok.view(Index)
-    grok.order(5)
-    # This is so cool! This link is only displayed, when the user is
-    # allowed to use it!
-    grok.require('waeup.manageUniversity')
-    
-    def render(self):
-        return u'<div class="portlet"><a href="add">Add faculty</a></div>'
-
-class ManageFacultyLink(grok.Viewlet):
-    """A link in the left sidebar displaying 'Manage faculty'
-    """
-    grok.viewletmanager(LeftSidebar)
-    grok.context(IFacultyContainer)
-    grok.view(Index)
-    grok.order(5)
-    grok.require('waeup.manageUniversity')
-    
-    def render(self):
-        return u'<div class="portlet"><a href="manage">Manage faculties</a></div>'
