Index: waeup/branches/ulif-layout/src/waeup/browser/pages.py
===================================================================
--- waeup/branches/ulif-layout/src/waeup/browser/pages.py	(revision 4719)
+++ waeup/branches/ulif-layout/src/waeup/browser/pages.py	(revision 4720)
@@ -2,4 +2,5 @@
 """ Viewing components for WAeUP objects.
 """
+import copy
 import grok
 import os
@@ -13,5 +14,5 @@
 from waeup.interfaces import (IUniversity, IWAeUPObject, IUserContainer,
                               IUserAccount, IFacultyContainer, IDataCenter,
-                              IFaculty, IDepartment)
+                              IFaculty, IDepartment, ICourse, ICertificate)
 from waeup.widgets.interfaces import ITableProvider
 from waeup.utils.helpers import getName
@@ -491,4 +492,6 @@
 #
 class DepartmentPage(WAeUPPage):
+    """Department index page.
+    """
     grok.context(IDepartment)
     grok.require('waeup.View')
@@ -513,2 +516,91 @@
         self.certificatetable = self.tables[1]
         self.coursetable.need()
+
+class DepartmentManageFormPage(WAeUPEditFormPage):
+    """Manage the basic properties of a `Department` instance.
+    """
+    grok.context(IDepartment)
+    grok.name('manage')
+    grok.require('waeup.manageUniversity')
+    title = u'Edit department settings'
+    pnav = 1
+
+    form_fields = grok.AutoFields(IDepartment)
+
+    @grok.action('Save')
+    def save(self, **data):
+        self.applyData(self.context, **data)
+        return
+    
+    @grok.action('Save and return')
+    def saveAndReturn(self, **data):
+        self.applyData(self.context, **data)
+        self.redirect(self.url(self.context))
+        return
+
+    @grok.action('Cancel')
+    def cancel(self, **data):
+        self.redirect(self.url(self.context))
+        return
+
+class DepartmentAddCourseFormPage(WAeUPAddFormPage):
+    """Add-form to add course to a department.
+    """
+    grok.context(IDepartment)
+    grok.name('addcourse')
+    grok.require('waeup.manageUniversity')
+    title = u'Add course'
+    pnav = 1
+    
+    # We need a deepcopy here, because otherwise also all other
+    # ICourse forms would be affected.
+    form_fields = copy.deepcopy(grok.AutoFields(ICourse))
+    form_fields.get('code').field.readonly = False
+
+    @grok.action('Add course')
+    def addCourse(self, **data):
+        course = createObject(u'waeup.Course')
+        self.applyData(course, **data)
+        try:
+            self.context.courses.addCourse(course)
+        except DuplicationError:
+            self.status = Invalid('The code chosen already exists '
+                                  'in the database')
+            return
+        self.redirect(self.url(self.context))
+
+    @grok.action('Cancel')
+    def cancel(self, **data):
+        self.redirect(self.url(self.context))
+        return
+
+class DepartmentAddCertificateFormPage(WAeUPAddFormPage):
+    """Add-form to add certificate to a department.
+    """
+    grok.context(IDepartment)
+    grok.name('addcertificate')
+    grok.require('waeup.manageUniversity')
+    title = u'Add certificate'
+    pnav = 1
+    
+    # We need a deepcopy here, because otherwise also all other
+    # ICertificate forms would be affected.
+    form_fields = copy.deepcopy(grok.AutoFields(ICertificate))
+    form_fields.get('code').field.readonly = False
+
+    @grok.action('Add certificate')
+    def addCertificate(self, **data):
+        certificate = createObject(u'waeup.Certificate')
+        self.applyData(certificate, **data)
+        try:
+            self.context.certificates.addCertificate(certificate)
+        except DuplicationError:
+            self.status = Invalid('The name chosen already exists '
+                                  'in the database')
+            return
+        self.redirect(self.url(self.context))
+
+    @grok.action('Cancel')
+    def cancel(self, **data):
+        self.redirect(self.url(self.context))
+        return
