Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py	(revision 6069)
@@ -27,5 +27,5 @@
 from hurry.jquery import jquery
 from hurry.jqueryui import jqueryui
-from zope.component import getUtility, getAllUtilitiesRegisteredFor
+from zope.component import getUtility, getAllUtilitiesRegisteredFor, createObject
 from zope.formlib.widgets import FileWidget, DateWidget
 from zope.securitypolicy.interfaces import IPrincipalRoleManager
@@ -44,4 +44,5 @@
     IApplicant, IApplicantPrincipal, IApplicantPDEEditData,
     IApplicantsRoot, IApplicantsContainer, IApplicantsContainerProvider,
+    IApplicantsContainerAdd
     )
 from waeup.sirp.widgets.passportwidget import (
@@ -84,4 +85,5 @@
     grok.name('index')
     title = 'Applicants'
+    label = 'Application Section'
     pnav = 3
 
@@ -101,101 +103,113 @@
     grok.context(IApplicantsRoot)
     grok.view(ApplicantsRootPage)
-    text = 'Manage applicant containers'
-
-class ApplicantsRootEditPage(WAeUPPage):
+    grok.require('waeup.manageUniversity')
+    text = 'Manage application section'
+
+class ApplicantsRootManageFormPage(WAeUPEditFormPage):
     grok.context(IApplicantsRoot)
     grok.name('manage')
     grok.template('applicantsrooteditpage')
-    title = 'Edit applicants containers'
-    pnav = 3
-
-    def update(self, entries=None, DELETE=None, CANCEL=None):
-        if CANCEL is not None:
-            self.redirect(self.url(self.context))
-            return
-        if DELETE is None:
-            return
-        if entries is None:
-            return
-        if not isinstance(entries, list):
-            entries = [entries]
-        for name in entries:
-            del self.context[name]
-            self.flash('Deleted "%s"' % name)
-        return
-
-    def getApplications(self):
-        """Get a list of all stored applicant containers.
-        """
-        for key, val in self.context.items():
-            url = self.url(val)
-            yield(dict(url=url, name=key))
-
-class AddApplicantsContainerActionButton(AddActionButton):
+    title = 'Applicants'
+    label = 'Manage application section'
+    pnav = 3
+    grok.require('waeup.manageUniversity')
+    taboneactions = ['Add applicants container', 'Remove selected','Cancel']
+    subunits = 'Applicants Containers'
+    
+    def update(self):
+        tabs.need()
+        #warning.need()
+        return super(ApplicantsRootManageFormPage, self).update()
+
+    # ToDo: Show warning message before deletion
+    @grok.action('Remove selected')
+    def delApplicantsContainers(self, **data):
+        form = self.request.form
+        child_id = form['val_id']
+        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')    
+        return       
+
+    @grok.action('Add applicants container', validator=NullValidator)
+    def addApplicantsContainer(self, **data):
+        self.redirect(self.url(self.context, '@@add'))
+        return    
+        
+    @grok.action('Cancel', validator=NullValidator)
+    def cancel(self, **data):
+        self.redirect(self.url(self.context))
+        return    
+    
+class ApplicantsContainerAddFormPage(WAeUPAddFormPage):
     grok.context(IApplicantsRoot)
-    grok.view(ApplicantsRootEditPage)
-    text = 'Add applicants container'
-
-class AddApplicantsContainer(WAeUPPage):
-    grok.context(IApplicantsRoot)
+    grok.require('waeup.manageUniversity')
     grok.name('add')
-    grok.template('addcontainer')
-    title = 'Add applicants container'
-    pnav = 3
-
-    def update(self, providername=None, name=None, title=None,
-               description=None, ADD=None, CANCEL=None):
-        if CANCEL is not None:
-            self.redirect(self.url(self.context))
-            return
-        if ADD is None:
-            return
-        if not name:
-            self.flash('Error: you must give a name')
-            return
-        if name in self.context.keys():
-            self.flash('A container of the given name already exists')
+    grok.template('applicantscontaineraddformpage')
+    title = 'Applicants'
+    label = 'Add applicants container'
+    pnav = 3
+    form_fields = grok.AutoFields(IApplicantsContainerAdd)
+    # hier muessen noch die widgets fuer die Datumsfelder rein
+    
+    @grok.action('Add applicants container')
+    def addApplicantsContainer(self, **data):
+        if data['code'] in self.context.keys():
+            self.status = Invalid('The name chosen already exists '
+                                  'in the database')
             return
         # Add new applicants container...
         provider = getUtility(IApplicantsContainerProvider,
-                              name=providername)
+                              name=getattr(data['provider'], 
+                                   'grokcore.component.directive.name'))
         container = provider.factory()
-        if title:
-            container.title = title
-        if description:
-            container.description = description
-        self.context[name] = container
-        self.flash('Added "%s".' % name)
-        self.redirect(self.url(self.context))
+        self.applyData(container, **data)
+        self.context[data['code']] = container
+        self.flash('Added "%s".' % data['code'])
+        self.redirect(self.url(self.context, u'@@manage')+'#tab-1')
         return
         
-    def getContainerProviders(self):
-        """Get a list of applicants container providers.
-
-        Applicants container providers are named utilities that help
-        to create applicants containers of different types
-        (JAMB-based, non-JAMB-based, etc.).
-
-        The list returned contains dicts::
-
-          {'name': <utility_name>,
-           'provider': <provider instance>}
-
-        where `utility_name` is the name under which the respective
-        provider utility is registered and `provider` is the real
-        provider instance.
-
-        The `utility_name` can be used to lookup the utility anew (for
-        instance after submitting a form) and the `provider` instance
-        can be used to create new instances of the respective
-        applicants container type.
-        """
-        providers = getAllUtilitiesRegisteredFor(IApplicantsContainerProvider)
-        result = [
-            {'name': getattr(x, 'grokcore.component.directive.name'),
-             'provider': x}
-             for x in providers
-            ]
-        return result
+    @grok.action('Cancel')
+    def cancel(self, **data):
+        self.redirect(self.url(self.context))       
+      
+    #def getContainerProviders(self):
+    #    """Get a list of applicants container providers.
+    #
+    #    Applicants container providers are named utilities that help
+    #    to create applicants containers of different types
+    #    (JAMB-based, non-JAMB-based, etc.).
+    #
+    #    The list returned contains dicts::
+    #
+    #      {'name': <utility_name>,
+    #       'provider': <provider instance>}
+    #
+    #    where `utility_name` is the name under which the respective
+    #    provider utility is registered and `provider` is the real
+    #    provider instance.
+    #
+    #    The `utility_name` can be used to lookup the utility anew (for
+    #    instance after submitting a form) and the `provider` instance
+    #    can be used to create new instances of the respective
+    #    applicants container type.
+    #    """
+    #    providers = getAllUtilitiesRegisteredFor(IApplicantsContainerProvider)
+    #    result = [
+    #        {'name': getattr(x, 'grokcore.component.directive.name'),
+    #         'provider': x}
+    #         for x in providers
+    #        ]
+    #    return result
 
 class ApplicantsRootBreadcrumb(Breadcrumb):
@@ -213,7 +227,8 @@
     """Faculties-tab in primary navigation.
     """
+    
     grok.context(IWAeUPObject)
     grok.order(3)
-    grok.require('waeup.View')
+    grok.require('waeup.manageUniversity')
     grok.template('primarynavtab')
 
@@ -253,4 +268,6 @@
     #    else:
     #        return
+
+
 
 class ManageApplicantsContainerActionButton(ManageActionButton):
Index: in/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/addcontainer.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/addcontainer.pt	(revision 6068)
+++ 	(revision )
@@ -1,38 +1,0 @@
-<form method="POST">
-  Container to add:
-  <table>
-    <tr>
-      <td><label for="provider">Type: </label></td>
-      <td><select 
-	      id="provider"
-	      name="providername"
-	      tal:repeat="provider view/getContainerProviders">
-	<option 
-	    tal:attributes="value provider/name">
-	  <span tal:replace="provider/provider/factory/title">Title</span>
-	  --
-	  <span tal:replace="provider/provider/factory/description">Description</span>
-	</option>
-      </select>
-      </td>
-    </tr>
-    <tr>
-      <td><label for="name">Name: </label></td>
-      <td><input id="name" type="text" name="name" />
-      Some name like 'pude11', 'cest10', or similar.</td>
-    </tr>
-    <tr>
-      <td><label for="title">Title: </label></td>
-      <td><input id="title" type="text" name="title" /></td>
-    </tr>
-    <tr>
-      <td><label for="description">Description: </label></td>
-      <td><textarea id="description" name="description"></textarea></td>
-    </tr>
-  </table>
-  <div>
-    <input type="submit" name="ADD" value="Add" />
-    <input type="reset" name="RESET" value="Reset" />
-    <input type="submit" name="CANCEL" value="Cancel" />
-  </div>
-</form>
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontaineraddformpage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontaineraddformpage.pt	(revision 6069)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontaineraddformpage.pt	(revision 6069)
@@ -0,0 +1,61 @@
+<form action="." tal:attributes="action request/URL" method="post"
+      class="edit-form" enctype="multipart/form-data">
+
+  <h2 i18n:translate=""
+    tal:condition="view/label"
+    tal:content="view/label">Label</h2>
+
+  <div class="form-status"
+    tal:define="status view/status"
+    tal:condition="status">
+
+    <div i18n:translate="" tal:content="view/status">
+      Form status summary
+    </div>
+
+    <ul class="errors" tal:condition="view/errors">
+      <li tal:repeat="error view/error_views">
+         <span tal:replace="structure error">Error Type</span>
+      </li>
+    </ul>
+  </div>
+
+  <table class="zebra">
+    <tbody>
+        <tal:block repeat="widget view/widgets">
+        <tr>
+          <td class="label" tal:define="hint widget/hint">
+            <label tal:condition="python:hint"
+                   tal:attributes="for widget/name">
+              <span class="required" tal:condition="widget/required"
+              >*</span><span i18n:translate=""
+                             tal:content="widget/label">label</span>
+            </label>
+            <label tal:condition="python:not hint"
+                   tal:attributes="for widget/name">
+              <span class="required" tal:condition="widget/required"
+              >*</span><span i18n:translate=""
+                             tal:content="widget/label">label</span>
+            </label>:
+          </td>
+          <td class="field">
+            <div class="widget" tal:content="structure widget">
+              <input type="text" />
+            </div>
+            <div class="error" tal:condition="widget/error">
+              <span tal:replace="structure widget/error">error</span>
+            </div>
+          </td>
+        </tr>
+        </tal:block>
+    </tbody>
+  </table>
+
+  <div id="actionsView">
+    <span class="actionButtons" tal:condition="view/availableActions">
+      <input tal:repeat="action view/actions"
+             tal:replace="structure action/render"
+             />
+    </span>
+  </div>
+</form>
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainerpage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainerpage.pt	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantscontainerpage.pt	(revision 6069)
@@ -7,12 +7,4 @@
 <table class="zebra">
   <tbody>
-      <tr>
-        <td class="fieldname">
-          Type (Code):
-        </td>
-        <td class="field">
-          <input tal:replace="context/__name__" />
-        </td>
-      </tr>  
     <tal:block repeat="widget view/widgets">
       <tal:condition condition="python:widget.name not in ['form.description','form.title']">
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrooteditpage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrooteditpage.pt	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrooteditpage.pt	(revision 6069)
@@ -1,32 +1,71 @@
-<form method="POST">
-  <table>
+<h2 i18n:translate=""
+tal:condition="view/label"
+tal:content="view/label">Label</h2>
+
+<div class="form-status"
+tal:define="status view/status"
+tal:condition="status">
+
+<div i18n:translate="" tal:content="view/status">
+  Form status summary
+</div>
+
+<ul class="errors" tal:condition="view/errors">
+  <li tal:repeat="error view/error_views">
+     <span tal:replace="structure error">Error Type</span>
+  </li>
+</ul>
+</div>
+
+
+<form action="." tal:attributes="action request/URL" method="POST"
+      class="edit-form" enctype="multipart/form-data"> 
+
+<div id="tabs">
+<ul>
+  <li><a href="#tab-1"><span tal:content="view/subunits">Contents</span></a></li>
+</ul>
+   
+<div id="tab-1">
+  <h3 tal:content="view/subunits">Applicants Containers</h3>
+  <table class="zebra">
     <thead>
       <tr>
-	<th>&nbsp;</th><th>Name</th><th>Title</th>
+        <th>&nbsp;</th><th>Code</th><th>Title</th>
       </tr>
     </thead>
     <tbody>
-      <tr tal:repeat="entry view/getApplications"
-	  tal:attributes="class python: repeat['entry'].odd() and 'odd' or 'even'">
-	<td>
-	  <input type="checkbox" name="entries"
-		 tal:attributes="value entry/name" />
-	</td>
-	<td>
-	  <a href=""
-	     tal:attributes="href entry/url"
-	     tal:content="entry/name"
-	     >Some Entry</a>
-	</td>
-	<td>
-	  <span tal:define="name entry/name">
-	    <span tal:content="python: context[name].title">Title</span>
-	  </span>
-	</td>
+      <tr tal:repeat="ac context/values">
+        <td>
+          <input type="checkbox"
+    		 name="val_id"
+    		 tal:attributes="value ac/__name__" />
+        </td>
+        <td>
+          <a tal:attributes="href python: view.url(ac)"
+    	     tal:content="ac/__name__">
+        	ID
+          </a>
+        </td>
+        <td>
+          <span tal:content="ac/title">
+    	   ID
+          </span>
+        </td>
       </tr>
     </tbody>
   </table>
-  <input type="submit" name="DELETE" value="Delete selected" />
-  <input type="reset" name="RESET" value="Reset" />
-  <input type="submit" name="CANCEL" value="Cancel" />
-</form>
+  
+    <div id="actionsView">
+        <span class="actionButtons" tal:condition="view/availableActions">
+            <span tal:repeat="action view/actions"
+                  tal:omit-tag="">
+              <input tal:condition="python:action.label in view.taboneactions"
+                     tal:replace="structure action/render"/>
+            </span>
+        </span>
+    </div>      
+  
+</div>
+</div>
+</form> 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrootpage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrootpage.pt	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/applicantsrootpage.pt	(revision 6069)
@@ -1,6 +1,10 @@
+<h2 i18n:translate=""
+tal:condition="view/label"
+tal:content="view/label">Label</h2>
+
 <table class="display dataTable">
   <thead>
     <tr>
-      <th>Name</th><th>Title</th>
+      <th>Code</th><th>Title</th>
     </tr>
   </thead>
@@ -11,5 +15,5 @@
 	<a href=""
 	   tal:attributes="href python:view.url(entry)"
-	   tal:content="entry/name"
+	   tal:content="entry/__name__"
 	   >Name</a>
       </td>
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/container.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/container.py	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/container.py	(revision 6069)
@@ -25,11 +25,14 @@
 import grok
 from waeup.sirp.applicants.interfaces import (
-    IApplicantsContainer, IApplicantsContainerProvider,
+    IApplicantsContainer, IApplicantsContainerAdd,
+    IApplicantsContainerProvider,
     )
+from zope.schema.fieldproperty import FieldProperty    
 
 class ApplicantsContainer(grok.Container):
     """An applicants container contains university applicants.
     """
-    grok.implements(IApplicantsContainer)
+    grok.implements(IApplicantsContainer,IApplicantsContainerAdd)
+    #grok.provides(IApplicantsContainer)
 
     title = u'Simple applicant container'
@@ -38,8 +41,6 @@
     enddate = None
     strict_deadline = True
-
-    @property
-    def name(self):
-        return getattr(self, '__name__', None)
+    provider = None
+    code = None
     
     def archive(self, app_ids=None):
@@ -74,5 +75,5 @@
         """
         raise NotImplemented()
-
+        
 class ApplicantsContainerProvider(grok.GlobalUtility):
     """A utility that provides basic applicants containers.
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py	(revision 6069)
@@ -33,4 +33,5 @@
 from waeup.sirp.image.image import WAeUPImageFile
 from waeup.sirp.interfaces import IWAeUPObject, SimpleWAeUPVocabulary
+from zope.component import getAllUtilitiesRegisteredFor
 
 IMAGE_PATH = os.path.join(
@@ -80,4 +81,17 @@
         if value == 'f':
             return 'female'
+            
+class ApplicantContainerProviderSource(BasicSourceFactory):
+    """
+    """
+    def getValues(self):
+        providers = getAllUtilitiesRegisteredFor(IApplicantsContainerProvider)
+        return providers                 
+
+    def getToken(self, value):
+        return getattr(value, 'grokcore.component.directive.name')
+        
+    def getTitle(self, value):
+        return "%s - %s" % (value.factory.title, value.factory.description)            
 
 class IResultEntry(IWAeUPObject):
@@ -97,4 +111,5 @@
     """
     pass
+    
 
 class IApplicantsContainer(IWAeUPObject):
@@ -102,4 +117,20 @@
 
     """
+
+    code = schema.TextLine(
+        title = u'Code',
+        description = u'Abbreviated code of applicants container',
+        default = u'NA',
+        required = True,
+        readonly = True,
+        )   
+    
+    provider = schema.Choice(
+        title = u'Type of applicants stored here.',
+        required = True,
+        default = None,
+        source = ApplicantContainerProviderSource(),
+        )        
+    
     title = schema.TextLine(
         title = u'Title of the type of applicants stored here.',
@@ -161,4 +192,18 @@
         database.
         """
+        
+class IApplicantsContainerAdd(IApplicantsContainer):
+    """An applicants container contains university applicants.
+    """
+    code = schema.TextLine(
+        title = u'Code',
+        description = u'Abbreviated code of applicants container',
+        default = u'NA',
+        required = True,
+        readonly = False,
+        )    
+        
+IApplicantsContainerAdd['code'].order =  IApplicantsContainer['code'].order          
+            
 class IApplicantBaseData(IWAeUPObject):
     """The data for an applicant.
Index: /main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py	(revision 6068)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/applicants/root.py	(revision 6069)
@@ -29,5 +29,5 @@
 
 class ApplicantsRoot(grok.Container):
-    """The root of applicants-related components. It contains primarily 
+    """The root of applicants-related components. It contains only 
     containers for applicants.
     """
