Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt	(revision 6916)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt	(revision 6917)
@@ -352,5 +352,5 @@
   >>> browser.open('http://localhost/myuniversity/faculties/manage')
   >>> browser.getControl("Remove selected", index=0).click()
-  >>> 'No faculty selected' in browser.contents
+  >>> 'No item selected' in browser.contents
   True
   >>> browser.open('http://localhost/myuniversity/faculties/manage')
@@ -500,5 +500,5 @@
   >>> browser.open('http://localhost/myuniversity/faculties/TF/manage')
   >>> browser.getControl("Remove selected", index=0).click()
-  >>> 'No department selected' in browser.contents
+  >>> 'No item selected' in browser.contents
   True
   >>> browser.open('http://localhost/myuniversity/faculties/TF/manage')
@@ -670,5 +670,5 @@
   >>> browser.getLink('Manage department').click()
   >>> browser.getControl('Remove selected courses').click()
-  >>> 'No course selected' in browser.contents
+  >>> 'No item selected' in browser.contents
   True
 
@@ -820,5 +820,5 @@
 
   >>> browser.getControl('Remove selected certificates').click()
-  >>> 'No certificate selected' in browser.contents
+  >>> 'No item selected' in browser.contents
   True
 
@@ -992,5 +992,5 @@
   True
   >>> browser.getControl('Remove selected course referrers').click()
-  >>> 'No course referrer selected' in browser.contents
+  >>> 'No item selected' in browser.contents
   True
   >>> browser.getControl(name='val_id').getControl(value='COURSE1_200').selected = True
Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 6916)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 6917)
@@ -43,5 +43,4 @@
 from waeup.sirp.authentication import get_principal_role_manager
 
-
 grok.context(IWAeUPObject)
 grok.templatedir('templates')
@@ -90,4 +89,37 @@
     return
 
+def delSubobjects(view, redirect, tab=None, subcontainer=None):
+    form = view.request.form
+    if form.has_key('val_id'):
+        child_id = form['val_id']
+    else:
+        view.flash('No item selected.')
+        if tab:
+            view.redirect(view.url(view.context, redirect)+'#tab-%s' % tab)
+        else:
+            view.redirect(view.url(view.context, redirect))
+        return
+    if not isinstance(child_id, list):
+        child_id = [child_id]
+    deleted = []
+    for id in child_id:
+        try:
+            if subcontainer:
+                container = getattr(view.context, subcontainer, None)
+                del container[id]
+            else:
+                del view.context[id]
+            deleted.append(id)
+        except:
+            view.flash('Could not delete %s: %s: %s' % (
+                    id, sys.exc_info()[0], sys.exc_info()[1]))
+    if len(deleted):
+        view.flash('Successfully removed: %s' % ', '.join(deleted))
+    if tab:
+        view.redirect(view.url(view.context, redirect)+'#tab-%s' % tab)
+    else:
+        view.redirect(view.url(view.context, redirect))
+    return
+
 #
 # Login/logout pages...
@@ -432,5 +464,5 @@
     tabtwoactions = [
         'Add session configuration',
-        'Remove selected sesson configurations']
+        'Remove selected']
 
     form_fields = grok.AutoFields(IConfigurationContainer)
@@ -462,26 +494,7 @@
 
     # ToDo: Show warning message before deletion
-    @grok.action('Remove selected sesson configurations')
-    def delSubobjects(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No item selected.')
-            self.redirect(self.url(self.context, '@@index')+'#tab-2')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, '@@index')+'#tab-2')
+    @grok.action('Remove selected')
+    def delSessonConfigurations(self, **data):
+        delSubobjects(self, redirect='@@index', tab='2')
         return
 
@@ -1042,24 +1055,5 @@
     @grok.action('Remove selected')
     def delFaculties(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No faculty selected.')
-            self.redirect(self.url(self.context, '@@manage')+'#tab-1')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, '@@manage')+'#tab-1')
+        delSubobjects(self, redirect='@@manage', tab='1')
         return
 
@@ -1165,25 +1159,6 @@
     # ToDo: Show warning message before deletion
     @grok.action('Remove selected')
-    def delSubobjects(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No department selected.')
-            self.redirect(self.url(self.context, '@@manage')+'#tab-2')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, '@@manage')+'#tab-2')
+    def delDepartments(self, **data):
+        delSubobjects(self, redirect='@@manage', tab='2')
         return
 
@@ -1344,48 +1319,12 @@
     @grok.action('Remove selected courses')
     def delCourses(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No course selected.')
-            self.redirect(self.url(self.context, '@@manage')+'#tab-2')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context.courses[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, u'@@manage')+'#tab-2')
+        delSubobjects(
+            self, redirect='@@manage', tab='2', subcontainer='courses')
         return
 
     @grok.action('Remove selected certificates')
     def delCertificates(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No certificate selected.')
-            self.redirect(self.url(self.context, '@@manage')+'#tab-3')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context.certificates[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, u'@@manage')+'#tab-3')
+        delSubobjects(
+            self, redirect='@@manage', tab='3', subcontainer='certificates')
         return
 
@@ -1607,26 +1546,6 @@
     @grok.action('Remove selected course referrers')
     def delCertificateCourses(self, **data):
-        form = self.request.form
-        if form.has_key('val_id'):
-            child_id = form['val_id']
-        else:
-            self.flash('No course referrer selected.')
-            self.redirect(self.url(self.context, '@@manage')+'#tab-2')
-            return
-        if not isinstance(child_id, list):
-            child_id = [child_id]
-        deleted = []
-        for id in child_id:
-            try:
-                del self.context[id]
-                deleted.append(id)
-            except:
-                self.flash('Could not delete %s: %s: %s' % (
-                        id, sys.exc_info()[0], sys.exc_info()[1]))
-        if len(deleted):
-            self.flash('Successfully removed: %s' % ', '.join(deleted))
-        self.redirect(self.url(self.context, u'@@manage')+'#tab-2')
-        return
-
+        delSubobjects(self, redirect='@@manage', tab='2')
+        return
 
     @grok.action('Add course referrer', validator=NullValidator)
