Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt	(revision 6006)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt	(revision 6007)
@@ -535,5 +535,5 @@
 
   >>> browser.getControl(name='form.title').value = "Blah"
-  >>> browser.getControl('Cancel').click()
+  >>> browser.getControl('Cancel',index=0).click()
 
 Our certificate was indeed renamed to ``My renamed cert`` and not to
@@ -700,17 +700,18 @@
 ---------------------------
 
-We can delete certcourses by browsing the containing certificate and
-clicking on the appropriate 'Delete' button. As we have only one
-certcourse, there is only one 'Delete' button yet:
-
-  >>> browser.open(cert_url)
-  >>> 'COURSE1_200' in browser.contents
+We can delete certcourses by browsing the containing certificate manage page:
+
+  >>> browser.open(cert_url + '/manage#tab-2')
+  >>> 'COURSE1_200</a>' in browser.contents
   True
 
-  >>> browser.getControl('delete').click()
-
-  >>> browser.open(cert_url)
-  >>> 'COURSE1_200' in browser.contents
+  >>> browser.getControl(name='val_id').getControl(value='COURSE1_200').selected = True
+  >>> browser.getControl('Remove selected course referrers').click()
+  >>> 'Successfully removed: COURSE1_200' in browser.contents
+  True
+  
+  >>> 'COURSE1_200</a>' in browser.contents
   False
+
 
 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 6006)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 6007)
@@ -1344,10 +1344,10 @@
         return "Certificate: %s (%s)" % (self.context.title, self.context.code)
         
-    def update(self):
-        if 'delcourse' in self.request.form:
-            code = self.request.form['code']
-            level = self.request.form['level']
-            self.context.delCourseRef(code, level=level)
-        return
+    #def update(self):
+    #    if 'delcourse' in self.request.form:
+    #        code = self.request.form['code']
+    #        level = self.request.form['level']
+    #        self.context.delCourseRef(code, level=level)
+    #    return
         
     def getCourseList(self):
@@ -1398,5 +1398,5 @@
 
 class CertificateManageFormPage(WAeUPEditFormPage):
-    """Manage the basic properties of a `Certificate` instance.
+    """Manage the properties of a `Certificate` instance.
     """
     grok.context(ICertificate)
@@ -1408,45 +1408,61 @@
     form_fields = grok.AutoFields(ICertificate)
     
+    pnav = 1
+    grok.template('certificatemanagepage')
+    taboneactions = ['Save','Cancel']
+    tabtwoactions = ['Add course referrer', 'Remove selected course referrers','Cancel']
+
+    @property
+    def label(self):
+        return 'Manage certificate'
+        
     @property
     def title(self):
-        return "Certificate: %s (%s)" % (self.context.title, self.context.code)    
-
-    #@property
-    #def title(self):
-    #    # Set certificate name as form label
-    #    return self.form_fields['title'].field.get(self.context)
-    
+        return "Certificate: %s (%s)" % (self.context.title, self.context.code) 
+
+    def update(self):
+        tabs.need()
+        #warning.need()
+        return super(CertificateManageFormPage, self).update()
+        
+    form_fields = grok.AutoFields(ICertificate)
+
     @grok.action('Save')
     def save(self, **data):
         self.applyData(self.context, **data)
-        
-        #try:
-        #    self.applyData(self.context, **data)
-        #except NoTransitionAvailableError:
-        #    self.status = Invalid('Review state cannot be changed to '
-        #                          'requested state: no such transition '
-        #                          'available in workflow.')
-        #return
-    
-    @grok.action('Save and return')
-    def saveAndReturn(self, **data):
-        self.applyData(self.context, **data)
-        
-        #try:
-        #    self.applyData(self.context, **data)
-        #except NoTransitionAvailableError:
-        #    self.status = Invalid('Review state cannot be changed to '
-        #                          'requested state: no such transition '
-        #                          'available in workflow.')
-        #    return
-        
-        self.redirect(self.url(self.context))
-        return
-
+        return
+        
+    # ToDo: Show warning message before deletion
+    @grok.action('Remove selected course referrers')
+    def delCertificateCourses(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, u'@@manage')+'#tab-2')    
+        return       
+     
+
+    @grok.action('Add course referrer', validator=NullValidator)
+    def addCertificateCourse(self, **data):
+        self.redirect(self.url(self.context, 'addcertificatecourse'))
+        return   
+        
     @grok.action('Cancel', validator=NullValidator)
     def cancel(self, **data):
         self.redirect(self.url(self.context))
         return
-
+    
+    
 class CertificateCourseAddFormPage(WAeUPAddFormPage):
     """Add-page to add a course ref to a certificate
@@ -1475,5 +1491,5 @@
                                   'this certificate')
             return
-        self.redirect(self.url(self.context))
+        self.redirect(self.url(self.context, u'@@manage')+'#tab-2')
 
     @grok.action('Cancel', validator=NullValidator)
Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatemanagepage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatemanagepage.pt	(revision 6007)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatemanagepage.pt	(revision 6007)
@@ -0,0 +1,133 @@
+<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>Settings</span></a></li>
+  <li><a href="#tab-2"><span>Course Referrers</span></a></li>
+</ul>
+   
+<div id="tab-1">        
+      <table class="form-fields">
+      <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">
+            <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 id="tab-2">
+  <h3>Course Referrers</h3>
+  <table class="zebra">
+    <thead>
+      <tr>
+        <th>&nbsp;</th><th>Code</th><th>Course</th><th>Level</th>
+        <th>Mandatory</th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr tal:repeat="cc context/values">
+        <td>
+          <input type="checkbox"
+    		 name="val_id"
+    		 tal:attributes="value cc/__name__" />
+        </td>
+        <td>
+          <a tal:attributes="href python: view.url(cc)"
+    	     tal:content="cc/__name__">
+        	CODE
+          </a>
+        </td>
+        <td>
+          <span tal:content="cc/course/title">
+    	   COURSE TITLE
+          </span>
+          (<span tal:content="cc/course/code">
+    	   COURSE CODE
+          </span>)          
+        </td>
+        <td>
+          <span tal:content="cc/level">
+    	   LEVEL
+          </span>
+        </td>
+                <td>
+          <span tal:content="cc/core_or_elective">
+    	   MANDATORY
+          </span>
+        </td>                
+      </tr>
+    </tbody>
+  </table>
+  
+    <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.tabtwoactions"
+                     tal:replace="structure action/render"/>
+            </span>
+        </span>
+    </div>      
+  
+</div>
+</div>
+</form>  
+
+
+
Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatepage.pt
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatepage.pt	(revision 6006)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/templates/certificatepage.pt	(revision 6007)
@@ -43,5 +43,4 @@
       <th>Semester</th>
       <th>Mandatory</th>
-      <th>&nbsp;</th>
     </tr>      
   </thead>    
@@ -60,13 +59,4 @@
     <td tal:content="python:semester[0]">semester</td>
     <td tal:content="courseref/mandatory">mandatory</td>
-    <td>
-        <form method="POST">
-          <input type="hidden" name="code" 
-        	 value="" tal:attributes="value courseref/course/code" />
-          <input type="hidden" name="level" 
-        	 value="" tal:attributes="value python:level[0]" />
-          <input type="submit" name="delcourse" value="delete" />
-         </form>        
-    </td>
   </tr>
   </span>
