Index: /WAeUP_SRP/trunk/ScratchCards.py
===================================================================
--- /WAeUP_SRP/trunk/ScratchCards.py	(revision 534)
+++ /WAeUP_SRP/trunk/ScratchCards.py	(revision 535)
@@ -55,5 +55,5 @@
         return "Pin Batch %s BatchNo %d" % (doc.prefix, doc.batch_no)
 
-    security.declareProtected(ModifyPortalContent,"makePins")
+    security.declareProtected(ModifyPortalContent,"makePins") ###(
     def makePins(self):
         """generate Pins"""
@@ -77,10 +77,26 @@
                 ri = r.randint(1000000000,9999999999)
                 pin = "%s%d%d" % (prefix,b_no,ri)
-            pins.addRecord(pin=pin,serial=i,student="")
+            pins.addRecord(pin=pin,serial=i,student="",prefix_batch="%s%d" % (prefix, b_no))
             generated.append('"%(i)d","%(prefix)s-%(b_no)d-%(ri)d"' % vars())
         print '\n'.join(generated)
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         open("%s/import/%s-%s-%s" % (i_home,prefix,b_no,current),"w+").write('\n'.join(generated))
+    ###)
 
+    security.declareProtected(ModifyPortalContent,"getUnusedPins")
+    def getUnusedPins(self):
+        """return a list of unused Pins"""
+        max_pins = 30
+        #import pdb;pdb.set_trace()
+        pins_cat = self.portal_pins
+        doc = self.getContent()
+        l = [{'pin': p.pin, 
+              'serial': p.serial,
+              } for p in pins_cat.searchResults(prefix_batch = "%s%d" 
+                                               % (doc.prefix,doc.batch_no), 
+                                               ) if p.student == '']
+        if len (l) <= max_pins:
+            return l
+        return l[:max_pins]
 
 InitializeClass(ScratchCardBatch)
Index: /WAeUP_SRP/trunk/Students.py
===================================================================
--- /WAeUP_SRP/trunk/Students.py	(revision 534)
+++ /WAeUP_SRP/trunk/Students.py	(revision 535)
@@ -193,5 +193,4 @@
             tr_count += 1
         return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-        return self.students.academics_contents()
     ###)
 
Index: /WAeUP_SRP/trunk/WAeUPPermissions.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPPermissions.py	(revision 534)
+++ /WAeUP_SRP/trunk/WAeUPPermissions.py	(revision 535)
@@ -23,13 +23,6 @@
 """
 
-#from AccessControl import ModuleSecurityInfo
 from Products.CMFCore.permissions import setDefaultRoles
-#security = ModuleSecurityInfo('Products.WAeUP.WAeUPPermissions')
 
-#  - 'Certificat Course delete' : Permission you need to ..
-#
-CertificateCourseDelete = "Certificate Course Delete"
-setDefaultRoles(CertificateCourseDelete, ('Manager', 
-                               'CourseAdvisor', 
-                               ))
-
+WAeUPModifyOwnContent = "WAeUPModify own content"
+setDefaultRoles(WAeUPModifyOwnContent, ('Owner',))
Index: /WAeUP_SRP/trunk/Widgets.py
===================================================================
--- /WAeUP_SRP/trunk/Widgets.py	(revision 534)
+++ /WAeUP_SRP/trunk/Widgets.py	(revision 535)
@@ -327,8 +327,4 @@
                 if ok == 2:
                     break
-##                if self.portal_workflow.getInfoFor(student,
-##                                                   'review_state',
-##                                                   None) == "created":
-##                    student.content_status_modify(workflow_action="enter_application_pin")
                 student.getContent().makeStudentMember(s_id,password=pin[4:])
             break
Index: /WAeUP_SRP/trunk/profiles/default/pins.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/pins.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/pins.xml	(revision 535)
@@ -4,6 +4,10 @@
  <column value="student"/>
  <column value="serial"/>
+ <column value="prefix_batch"/>
  <index name="pin" meta_type="FieldIndex">
   <indexed_attr value="pin"/>
+ </index>
+ <index name="prefix_batch" meta_type="FieldIndex">
+  <indexed_attr value="prefix_batch" />
  </index>
  <index name="student" meta_type="FieldIndex">
Index: /WAeUP_SRP/trunk/profiles/default/rolemap.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/rolemap.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/rolemap.xml	(revision 535)
@@ -8,6 +8,9 @@
   </roles>
   <permissions>
+    <permission name="WAeUPModify own content" acquire="True">
+      <role name="Owner"/>
+      <role name="SectionManager"/>
+    </permission>
     <permission name="List folder contents" acquire="True">
-      <role name="Owner"/>
       <role name="SectionManager"/>
       <role name="SectionReader"/>
Index: /WAeUP_SRP/trunk/profiles/default/roots.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/roots.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/roots.xml	(revision 535)
@@ -2,3 +2,7 @@
 <roots>
  <object name="campus" portal_type="University"/>
+ <script script_id=".cpsskins_theme"
+         type="Script (Python)" 
+         filename="roots/.cpsskins_theme.py"
+         />
 </roots>
Index: /WAeUP_SRP/trunk/profiles/default/roots/campus.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/roots/campus.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/roots/campus.xml	(revision 535)
@@ -2,5 +2,4 @@
 <object name="campus">
   <property name="Title">University Portal</property>
-  <property name=".cpsskins_theme">waeup_plain_theme</property>
   <object name="academics" portal_type="AcademicsFolder" />
   <object name="accommodation" portal_type="AccoFolder" />
Index: /WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml	(revision 535)
@@ -4,10 +4,7 @@
  <field name="category" meta_type="CPS String Field"/>
  <field name="code" meta_type="CPS String Field">
-  <property name="is_searchabletext">True</property>
+  <property name="is_searchabletext">False</property>
  </field>
- <field name="department" meta_type="CPS String Field"/>
  <field name="end_level" meta_type="CPS String Field"/>
- <field name="faculty" meta_type="CPS String Field"/>
- <field name="heading" meta_type="CPS String Field"/>
  <field name="m_prefix" meta_type="CPS String Field"/>
  <field name="max_elect" meta_type="CPS String Field"/>
Index: /WAeUP_SRP/trunk/profiles/default/schemas/course.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/course.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/course.xml	(revision 535)
@@ -4,10 +4,10 @@
  <field name="category" meta_type="CPS String Field"/>
  <field name="code" meta_type="CPS String Field">
-  <property name="is_searchabletext">True</property>
+  <property name="is_searchabletext">False</property>
  </field>
  <field name="credits" meta_type="CPS Int Field"/>
  <field name="former_code" meta_type="CPS String Field"/>
  <field name="org_code" meta_type="CPS String Field">
-  <property name="is_searchabletext">True</property>
+  <property name="is_searchabletext">False</property>
  </field>
  <field name="passmark" meta_type="CPS Int Field">
Index: /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml	(revision 535)
@@ -26,10 +26,10 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="academics_contents"/>
+ <alias from="(Default)" to="batch_index_html"/>
  <alias from="create_do" to="scratch_card_batch_create_do"/>
  <alias from="created" to="scratch_card_batch_created"/>
- <alias from="view" to="academics_contents"/>
+ <alias from="view" to="batch_index_html"/>
  <action title="Standard View" action_id="view" category="object"
-    condition_expr="" url_expr="string:${object_url}/academics_contents"
+    condition_expr="" url_expr="string:${object_url}/batch_index_html"
     visible="True">
   <permission value="Modify portal content"/>
Index: /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml	(revision 535)
@@ -25,10 +25,10 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="academics_contents"/>
+ <alias from="(Default)" to="pins_index_html"/>
  <alias from="create_do" to=""/>
  <alias from="created" to=""/>
- <alias from="view" to="academics_contents"/>
+ <alias from="view" to="pins_index_html"/>
  <action title="Standard View" action_id="view" category="object"
-    condition_expr="" url_expr="string:${object_url}/academics_contents"
+    condition_expr="" url_expr="string:${object_url}/pins_index_html"
     visible="True">
   <permission value="View"/>
Index: /WAeUP_SRP/trunk/profiles/default/types/Student.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/Student.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/types/Student.xml	(revision 535)
@@ -8,5 +8,5 @@
  <property name="product">WAeUP_SRP</property>
  <property name="factory">addStudent</property>
- <property name="immediate_view">folder_view</property>
+ <property name="immediate_view">student_index</property>
  <property name="global_allow">True</property>
  <property name="filter_content_types">True</property>
@@ -32,9 +32,9 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="academics_contents"/>
- <alias from="view" to="academics_contents"/>
+ <alias from="(Default)" to="student_index"/>
+ <alias from="view" to="student_index"/>
  <action title="Standard View" action_id="view" category="object"
     condition_expr=""
-    url_expr="string:${object_url}/academics_contents" visible="True">
+    url_expr="string:${object_url}/student_index" visible="True">
   <permission value="View"/>
  </action>
Index: /WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml	(revision 535)
@@ -8,5 +8,5 @@
  <property name="product">WAeUP_SRP</property>
  <property name="factory">addStudentsFolder</property>
- <property name="immediate_view">home_student</property>
+ <property name="immediate_view">student_index</property>
  <property name="global_allow">True</property>
  <property name="filter_content_types">True</property>
@@ -30,8 +30,8 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="home_student"/>
- <alias from="view" to="home_student"/>
+ <alias from="(Default)" to="student_index"/>
+ <alias from="view" to="student_index"/>
  <action title="View" action_id="view" category="object" condition_expr=""
-    url_expr="string:${object_url}/home_student" visible="True">
+    url_expr="string:${object_url}/student_index" visible="True">
   <permission value="View"/>
  </action>
Index: /WAeUP_SRP/trunk/profiles/default/types/University.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/University.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/types/University.xml	(revision 535)
@@ -8,5 +8,5 @@
  <property name="product">WAeUP_SRP</property>
  <property name="factory">addUniversity</property>
- <property name="immediate_view">home_student</property>
+ <property name="immediate_view">home_index</property>
  <property name="global_allow">True</property>
  <property name="filter_content_types">True</property>
@@ -34,8 +34,8 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="home_student"/>
- <alias from="view" to="home_student"/>
+ <alias from="(Default)" to="home_index"/>
+ <alias from="view" to="home_index"/>
  <action title="View" action_id="view" category="object" condition_expr=""
-    url_expr="string:${object_url}/home_student" visible="True">
+    url_expr="string:${object_url}/home_index" visible="True">
   <permission value="Modify portal content"/>
  </action>
Index: /WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml	(revision 534)
+++ /WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml	(revision 535)
@@ -5,4 +5,5 @@
               meta_type="CPS Workflow">
  <permission>Modify portal content</permission>
+ <permission>WAeUPModify own content</permission>
  <permission>View</permission>
  <state state_id="closed" title="">
@@ -15,9 +16,13 @@
   <permission-map name="Modify portal content"
                   acquired="False">
+   <permission-role>Owner</permission-role>
    <permission-role>Manager</permission-role>
-   <permission-role>Owner</permission-role>
    <permission-role>SectionManager</permission-role>
   </permission-map>
-  <permission-map name="View" acquired="True">
+  <permission-map name="WAeUPModify own content"
+                  acquired="False">
+   <permission-role>Owner</permission-role>
+  </permission-map>
+  <permission-map name="View" acquired="False">
   </permission-map>
  </state>
@@ -26,6 +31,9 @@
   <permission-map name="Modify portal content"
                   acquired="True">
+   <permission-role>SectionManager</permission-role>
+  </permission-map>
+  <permission-map name="WAeUPModify own content"
+                  acquired="False">
    <permission-role>Owner</permission-role>
-   <permission-role>SectionManager</permission-role>
   </permission-map>
   <permission-map name="View" acquired="True">
@@ -37,6 +45,5 @@
   
   <guard>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
+    <guard-permission>WAeUPModify own content</guard-permission>
   </guard>
  </transition>
@@ -55,6 +62,5 @@
   
   <guard>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
+    <guard-permission>WAeUPModify own content</guard-permission>
   </guard>
  </transition>
Index: /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 535)
@@ -13,4 +13,6 @@
 $Id: logged_in.py 34693 2006-03-23 17:44:22Z ogrisel $
 """
+import DateTime
+current = DateTime.DateTime()
 
 from urllib import unquote
@@ -26,4 +28,6 @@
     return to_member_home, to_workspaces
 
+request = context.REQUEST
+response = request.RESPONSE
 utool = context.portal_url
 mtool = context.portal_membership
@@ -43,9 +47,13 @@
     if not is_anon:
         if "Student" in member.getRoles():
-            member_id = str(member)
-            student = getattr(context.campus.students,member_id,)
-            if context.portal_workflow.getInfoFor(student,
-                                               'review_state',
-                                               None) == "created":
+            to_waeup_student_home = True
+            info = context.getStudentInfo()
+            student = info['student']
+##            member_id = str(member)
+##            student = getattr(context.campus.students,member_id,)
+##            if context.portal_workflow.getInfoFor(student,
+##                                               'review_state',
+##                                               None) == "created":
+            if info['review_state'] == "created":
                 student.content_status_modify(workflow_action="enter_application_pin")
                 da = {}
@@ -53,6 +61,5 @@
                 da['app_ac_pin'] = pin
                 da['app_ac_date'] = current
-                application.getContent().edit(mapping = da)
-                to_waeup_student_home = True
+                info['app_doc'].edit(mapping = da)
         elif "Manager" in member.getRoles():
             pass
Index: /WAeUP_SRP/trunk/skins/waeup_custom/standard_error_message.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/standard_error_message.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/standard_error_message.pt	(revision 535)
@@ -15,12 +15,12 @@
 <tal:haserror condition="error_type">
   <tal:NotFound condition="python:error_type == 'NotFound'">
-    <metal:block use-macro="here/not_found/macros/not_found" />
+    <metal:block use-macro="here/error_not_found/macros/not_found" />
   </tal:NotFound>
 
-  <tal:default condition="python:0 and error_type != 'NotFound'">
-    <metal:block use-macro="here/error_lib_other/macros/other" />
+  <tal:default condition="python:error_type != 'NotFound'">
+    <metal:block use-macro="here/error_other/macros/other" />
   </tal:default>
 
-  <tal:debugging condition="python:0 and checkPerm('Manage portal', here)">
+  <tal:debugging condition="python:checkPerm('Manage portal', here)">
     <table width="100%" cellpadding="2" cellspacing="2">
       <tr>
Index: /WAeUP_SRP/trunk/skins/waeup_default/campus_anonymous_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/campus_anonymous_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_default/campus_anonymous_view.pt	(revision 535)
@@ -0,0 +1,18 @@
+<metal:html tal:define="info context/getStudentInfo">
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+        <h2>Welcome to the     
+          <br />Student Registration Portal of the University of Benin, Nigeria</h2>
+        <br />
+        <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project. 
+          For further information see 
+          <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
+        <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application 
+          entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
+        proceed with the admission and clearance process.</p>
+        <p><strong>Returning Students</strong> can login to check the course results of the previous session, 
+        to register courses for the current session, to pay their school fees and to book accommodation.</p>
+        <p>This site is best seen in Firefox browser.</p>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_default/campus_manager_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/campus_manager_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_default/campus_manager_view.pt	(revision 535)
@@ -0,0 +1,18 @@
+<metal:html tal:define="info context/getStudentInfo">
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+        <h2>Welcome to the     
+          <br />Student Registration Portal of the University of Benin, Nigeria</h2>
+        <br />
+        <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project. 
+          For further information see 
+          <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
+        <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application 
+          entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
+        proceed with the admission and clearance process.</p>
+        <p><strong>Returning Students</strong> can login to check the course results of the previous session, 
+        to register courses for the current session, to pay their school fees and to book accommodation.</p>
+        <p>This site is best seen in Firefox browser.</p>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_default/home_index.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/home_index.py	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_default/home_index.py	(revision 535)
@@ -0,0 +1,30 @@
+## Script (Python) "cpsdocument_edit"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=batch=None
+##title=
+##
+# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
+"""
+return the correct campus_index_html 
+"""
+
+request = context.REQUEST
+redirect = request.RESPONSE.redirect
+pm = context.portal_membership
+if pm.isAnonymousUser():
+    return redirect("%s/campus_anonymous_view" % request.get('URL1'))
+campus = context.portal_catalog(meta_type = "University")[-1].getObject()
+member = pm.getAuthenticatedMember()
+roles = member.getRoles()
+if "Manager" in roles or "SectionManager" in roles:
+    return redirect("%s/campus_manager_view" % campus.absolute_url())
+    
+info = context.getStudentInfo()
+if info is not None:
+    return redirect("%s/student_index" % campus.students.absolute_url())
+    
+
Index: /WAeUP_SRP/trunk/skins/waeup_default/portlet_session_info.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/portlet_session_info.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_default/portlet_session_info.pt	(revision 535)
@@ -4,8 +4,10 @@
            roles member/getRoles;
            backend python:'Manager' in roles or 'SectionManager' in roles;
-           frontend python:'Student' in roles or isAnon;"
+           frontend python:'Student' in roles or isAnon;
+           info context/getStudentInfo;"
            >
   <tal:block condition="not:isAnon">
-       <strong> <span tal:content="python:member.getProperty('fullname',None)" /> 
+       <strong> <span tal:condition="info" tal:content="python:info['per_doc'].lastname" /> 
+       <span tal:condition="not: info" tal:content="python:member.getProperty('fullname',None)" /> 
        </strong>
   </tal:block>
Index: /WAeUP_SRP/trunk/skins/waeup_pins/batch_index_html.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/batch_index_html.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/batch_index_html.pt	(revision 535)
@@ -0,0 +1,24 @@
+<metal:html tal:define="info context/getBatchInfo">
+
+  <metal:body use-macro="here/main_template/macros/master">
+
+    <metal:main fill-slot="main">
+      <span tal:condition="isAnon">
+      </span>
+      <span tal:condition="python:not isAnon and info">
+        <h3 tal:content="info/review_state|nothing"></h3>
+        <span tal:omit-tag="" 
+              tal:content="structure python: info['batch_doc'].render(proxy=info['batch_doc'],
+              layout_mode='view', 
+              )" 
+              />
+      </span>
+      <table>
+        <tr tal:repeat="pin info/unused">
+          <td tal:content="pin/serial" />
+          <td tal:content="pin/pin" />
+        </tr>
+      </table>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py	(revision 535)
@@ -0,0 +1,25 @@
+## Script (Python) "cpsdocument_edit"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=batch=None
+##title=
+##
+# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
+"""
+return Info about the current Student
+"""
+
+info = {}
+if batch is None:
+    if context.portal_type == 'ScratchCardBatch':
+        batch = context
+    else:
+        return None
+info['batch_doc'] = batch.getContent()
+info['id'] = batch.getId()
+info['title'] = batch.Title or 'empty Title'
+info['unused'] = batch.getContent().getUnusedPins()
+return info
Index: /WAeUP_SRP/trunk/skins/waeup_pins/pins_index_html.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_pins/pins_index_html.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_pins/pins_index_html.pt	(revision 535)
@@ -0,0 +1,19 @@
+<metal:html>
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+      <span tal:condition="isAnon">
+      </span>  
+      <span tal:condition="not:isAnon">
+        <table tal:define="batches python: context.objectValues()">
+          <tr tal:repeat="batch batches">
+            <span tal:omit-tag="" tal:define="info python: context.getBatchInfo(batch)">
+            <td><a href="batch" 
+                   tal:attributes="href string:${batch/absolute_url}/${info/id}"
+                   tal:content="info/title"></a></td>    
+            </span>
+          </tr>
+        </table>
+      </span>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_student/application_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/application_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/application_view.pt	(revision 535)
@@ -0,0 +1,18 @@
+<metal:html tal:define="info context/getStudentInfo">
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+      <span tal:condition="not: info">
+        <metal:block use-macro="here/error_not_found/macros/not_found" />
+      </span>
+      <span tal:condition="info"
+            tal:define="review_state info/review_state">
+        <h3 tal:content="info/review_state|nothing"></h3>
+        <span tal:omit-tag=""
+              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
+              layout_mode='view', 
+              layout_id='student_application_fe')" 
+              />
+      </span>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 535)
@@ -0,0 +1,39 @@
+## Script (Python) "cpsdocument_edit"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=student=None
+##title=
+##
+# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
+"""
+return Info about the current Student
+"""
+request = context.REQUEST
+
+wf = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+path_info = request.get('PATH_INFO').split('/')
+
+info = {}
+member_id = str(member)
+##if member_id not in path_info:
+##    return None
+if student is None:
+    students = getattr(context,'students',None)
+    if students is None:
+        students = getattr(context.campus,'students',None)
+    student = getattr(students,member_id,None)
+    if student is None:
+        return None
+info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
+#info['wf_state'] = 'keiner'
+info['student'] = student
+info['app'] = student.application
+info['app_doc'] = student.application.getContent()
+info['per'] = student.personal
+info['per_doc'] = student.personal.getContent()
+return info
Index: eUP_SRP/trunk/skins/waeup_student/get_student_info.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/get_student_info.py	(revision 534)
+++ 	(revision )
@@ -1,32 +1,0 @@
-## Script (Python) "cpsdocument_edit"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
-"""
-return Info about the current Student
-"""
-wf = context.portal_workflow
-mtool = context.portal_membership
-member = mtool.getAuthenticatedMember()
-
-info = {}
-students = getattr(context,'students',None)
-if students is None:
-    students = getattr(context.campus,'students',None)
-student = getattr(students,str(member),None)
-if student is None:
-    return
-
-info['review_state'] = wf.getInfoFor(student,'review_state','keiner')
-#info['wf_state'] = 'keiner'
-info['app'] = student.application
-info['app_doc'] = student.application.getContent()
-info['per'] = student.personal
-info['per_doc'] = student.personal.getContent()
-return info
Index: /WAeUP_SRP/trunk/skins/waeup_student/home_student.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/home_student.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_student/home_student.pt	(revision 535)
@@ -1,37 +1,47 @@
-<metal:html tal:define="info context/get_student_info">
+<metal:html tal:define="info context/getStudentInfo">
 
-<metal:body use-macro="here/main_template/macros/master">
+  <metal:body use-macro="here/main_template/macros/master">
 
-<metal:main fill-slot="main">
-<span tal:condition="isAnon">
-  <h2>Welcome to the     
-   
-  <br />Student Registration Portal of the University of Benin, Nigeria</h2>
-  
-  <br />
-  
-  <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project. 
-  For further information see 
-  <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
-  
-  <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application 
-  entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
-  proceed with the admission and clearance process.</p>
- 
-  <p><strong>Returning Students</strong> can login to check the course results of the previous session, 
-  to register courses for the current session, to pay their school fees and to book accommodation.</p>
-  
-  <p>This site is best seen in Firefox browser.</p>
-</span>
-<span tal:condition="python:not isAnon and info">
-    <h3 tal:content="info/review_state|nothing"></h3>
-   <span tal:omit-tag="" tal:condition="python:info['review_state'] == 'admission_applied'"
-          tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
-                                                               layout_mode='view', 
-                                                               layout_id='student_application_fe')" />
-      
-
-</span>  
-</metal:main>
-</metal:body>
+    <metal:main fill-slot="main">
+      <span tal:condition="isAnon">
+        <h2>Welcome to the     
+          <br />Student Registration Portal of the University of Benin, Nigeria</h2>
+        <br />
+        <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project. 
+          For further information see 
+          <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
+        <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application 
+          entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
+        proceed with the admission and clearance process.</p>
+        <p><strong>Returning Students</strong> can login to check the course results of the previous session, 
+        to register courses for the current session, to pay their school fees and to book accommodation.</p>
+        <p>This site is best seen in Firefox browser.</p>
+      </span>
+      <span tal:condition="python:not isAnon and info"
+            tal:define="review_state info/review_state">
+        <h3 tal:content="info/review_state|nothing"></h3>
+        <span tal:omit-tag="" tal:condition="python:review_state == 'admission_applied'"
+              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
+              layout_mode='view', 
+              layout_id='student_application_fe')" 
+              />
+        <span tal:omit-tag="" tal:condition="python: review_state == 'application_pin_entered'"
+              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
+              layout_mode='edit', 
+              layout_id='student_application_fe')" 
+              />
+      </span>  
+      <span tal:condition="python:not isAnon and not info">
+        <table tal:define="students python: context.objectValues()">
+          <tr tal:repeat="student students">
+            <span tal:omit-tag="" tal:define="info python: context.getStudentInfo(student)">
+            <td><span tal:replace="python: info['per_doc'].lastname" /></td>    
+            <td><span tal:replace="python: info['app_doc'].jamb_reg_no" /></td>    
+            <td><span tal:replace="info/review_state" /></td>    
+            </span>
+          </tr>
+        </table>
+      </span>
+    </metal:main>
+  </metal:body>
 </metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt	(revision 535)
@@ -12,4 +12,5 @@
   ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
   cpsmcat nocall:here/translation_service;
+  apply request/apply_button|nothing;
   ">
 
@@ -72,10 +73,12 @@
   <br />
   <input type="submit" class="standalone" name="cpsdocument_edit_button"
-    value="button_change" i18n:attributes="value" id="cpsdocument_edit_button"
-    tal:condition="not:creation" />
-  <input type="submit" class="standalone" name="cpsdocument_edit_and_view_button"
-    value="button_change_and_view" i18n:attributes="value"
-    id="cpsdocument_edit_and_view_button"
-    tal:condition="python:0 and not creation" />
+         value="button_change" 
+         id="cpsdocument_edit_button"
+         tal:condition="not:creation" />
+  <input type="submit" class="standalone" name="apply_admission"
+         value="apply for admission"
+         id="cpsdocument_edit_and_view_button"
+         tal:condition="apply" 
+         tal:attributes="value apply"/>
   <input type="submit" 
          class="standalone" 
@@ -87,4 +90,2 @@
 </form>
 </metal:block>
-
-
Index: /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt	(revision 535)
@@ -1,29 +1,48 @@
 <!-- a layout_lib macro -->
 <!-- $Id: layout_lib_default_view.pt 34052 2006-03-06 14:59:24Z atchertchian $ -->
-
 <metal:block define-macro="default_view"
   tal:define="layout options/layout;
               dm options/datastructure/getDataModel;
               widgets python:context.getRenderedWidgets(layout);
-             ">
-             <span tal:condition="nothing" tal:replace="structure widgets" />
-<table width="100%" cellpadding="2" cellspacing="2" summary="layout">
-  <tr tal:repeat="row layout/rows">
-    <td tal:repeat="cell row" tal:attributes="colspan cell/ncols">
-      <tal:block define="widget cell/widget">
-      <div tal:attributes="class cell/widget_css_class|nothing;
-                           id python:widget.getHtmlWidgetId()+'_widget';
-                          ">
-        <tal:block condition="widget/label">
-          <span class="dlabel" i18n:translate="" tal:condition="widget/is_i18n"
-                tal:content="widget/label">label</span>
-          <span class="dlabel" tal:condition="not:widget/is_i18n"
-                tal:content="widget/label">label</span>
+              fields python:('jamb_reg_no',
+                                 'app_ac_pin',
+                                 'app_ac_date',
+                                 'jamb_lastname',
+                                 'jamb_sex',
+                                 'jamb_first_cos',
+                                 'jamb_second_cos',)"
+                                 >
+  <span tal:condition="nothing" tal:replace="structure widgets" />
+  <table width="100%" cellpadding="2" cellspacing="2" summary="layout">
+    <tr tal:repeat="field fields">
+      <td tal:define="cell python: widgets[field]">
+        <tal:block define="widget cell/widget">
+          <div tal:attributes="class cell/widget_css_class|nothing;
+          id python:widget.getHtmlWidgetId()+'_widget';"
+          >
+            <tal:block condition="widget/label">
+              <span class="dlabel"
+                    tal:content="widget/label">label</span>
+            </tal:block>
+            <tal:block replace="structure cell/widget_rendered" />
+          </div>
         </tal:block>
-        <tal:block replace="structure cell/widget_rendered" />
-      </div>
-      </tal:block>
-    </td>
-  </tr>
-</table>
+      </td>
+    </tr>
+    <tr>
+      <td tal:define="cell widgets/passport">
+        <tal:block define="widget cell/widget">
+          <div tal:attributes="class cell/widget_css_class|nothing;
+          id python:widget.getHtmlWidgetId()+'_widget';"
+          >
+            <tal:block condition="widget/label">
+              <span class="dlabel"
+                    tal:content="widget/label">label</span>
+            </tal:block>
+            <img src="img" tal:attributes="src string:${context/aq_parent/absolute_url}/passport" />
+          </div>
+        </tal:block>
+      </td>
+    </tr>    
+  </table>
 </metal:block>
Index: /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 535)
@@ -0,0 +1,18 @@
+<metal:html tal:define="info context/getStudentInfo">
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+      <span tal:condition="not: info">
+        <metal:block use-macro="here/error_not_found/macros/not_found" />
+      </span>
+      <span tal:condition="info"
+            tal:define="review_state info/review_state">
+        <h3 tal:content="info/review_state|nothing"></h3>
+        <span tal:omit-tag=""
+              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
+              layout_mode='edit', 
+              layout_id='student_application_fe')" 
+              />
+      </span>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_student/portlet_student_workflow_display.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/portlet_student_workflow_display.pt	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_student/portlet_student_workflow_display.pt	(revision 535)
@@ -5,5 +5,5 @@
                    roles member/getRoles;
                    item nocall:options/context_obj;
-                   info item/get_student_info;"
+                   info item/getStudentInfo;"
            condition="python:'Student' in roles
            ">
Index: /WAeUP_SRP/trunk/skins/waeup_student/student_edit.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/student_edit.py	(revision 534)
+++ /WAeUP_SRP/trunk/skins/waeup_student/student_edit.py	(revision 535)
@@ -33,40 +33,56 @@
 # Validate the document and write it if it's valid
 # (We don't call getEditableContent here, validate does it when needed.)
-doc = context.getContent()
+info = context.getStudentInfo()
 
-if context.portal_type == "StudentApplication":
-    student = context.aq_parent
-    state = context.portal_workflow.getInfoFor(student,'review_state',None) 
+student = info['student']
+app = info['app']
+app_doc = info['app_doc']
+state = context.getStudentInfo()['review_state']
+
+if context.portal_type == "Student":
     if state == "application_pin_entered":
         student.content_status_modify(workflow_action="apply_for_admission")
-    if doc.passport is None:
-        is_valid, ds = doc.validate(request=REQUEST,
-                                    proxy=context,
+    if app_doc.passport is None:
+        is_valid, ds = app_doc.validate(request=REQUEST,
+                                    proxy=app_doc,
                                     layout_id = "student_application_fe",
                                     layout_mode = 'edit',
                                     use_session=True)
     
-        action = '/application_form'
+        action = "/student_edit"
         if is_valid:
-            comments = REQUEST.get('comments')
-            context.cpsdocument_notify_modification(comments=comments)
-            if cpsdocument_edit_and_view_button is not None:
-                action = ''
             psm = 'You successfully uploaded your passport image.'
             args = {}
-            action = "/view"
         else:
             psm = 'psm_content_error'
             args = getFormUidUrlArg(REQUEST)
+    elif 'apply_admission' not in REQUEST.form:
+        is_valid, ds = app_doc.validate(request=REQUEST,
+                                    proxy=app_doc,
+                                    layout_id = "student_application_fe",
+                                    layout_mode = 'edit',
+                                    use_session=True)
+        action = "/passport_entry_view"
+        if is_valid:
+            args = {}
+            if 'apply_admission' not in REQUEST.form:
+                args = {'apply_button': 'Save and Apply',}
+                psm = 'You successfully uploaded your passport image.'
+            else:
+                psm = 'You applied for admission.'
+        else:
+            args = getFormUidUrlArg(REQUEST)
+            #psm = 'psm_content_error'
+            psm = '%s' % ds
     else:
         args = {}
-        psm = "You successfully applied for admission."
-        action = "/view"
+        psm = 'You applied for admission.'
+        action = "/application_view"
 else:
-    is_valid, ds = doc.validate(request=REQUEST, proxy=context, cluster=cluster,
+    is_valid, ds = app_doc.validate(request=REQUEST, proxy=context, cluster=cluster,
                                 use_session=True)
 
     if action is None:
-        ti = doc.getTypeInfo()
+        ti = app.getTypeInfo()
         action = ti.queryMethodID('edit', 'cpsdocument_edit_form')
         action = '/' + action
Index: /WAeUP_SRP/trunk/skins/waeup_student/student_index.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 535)
@@ -0,0 +1,35 @@
+## Script (Python) "cpsdocument_edit"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=batch=None
+##title=
+##
+# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
+"""
+return the current student_index_html 
+"""
+
+request = context.REQUEST
+redirect = request.RESPONSE.redirect
+campus = context.portal_catalog(meta_type = "University")[-1].getObject()
+pm = context.portal_membership
+if pm.isAnonymousUser():
+    return redirect("%s/students_anonymous_view" % campus.students.absolute_url())
+member = pm.getAuthenticatedMember()
+roles = member.getRoles()
+if "Manager" in roles or "SectionManager" in roles:
+    return redirect("%s/students_manager_view" % campus.students.absolute_url())
+    
+info = context.getStudentInfo()
+student = info['student']
+doc = info['app_doc']
+state = context.getStudentInfo()['review_state']
+if state == 'admission_applied':
+    return redirect("%s/application_view" % student.absolute_url())
+elif state == 'application_pin_entered':
+    return redirect("%s/passport_entry_view" % student.absolute_url())
+    
+
Index: /WAeUP_SRP/trunk/skins/waeup_student/students_anonymous_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/students_anonymous_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/students_anonymous_view.pt	(revision 535)
@@ -0,0 +1,19 @@
+<metal:html tal:define="info context/getStudentInfo">
+  <metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main">
+      <h2>Welcome to the     
+        <br />Student Registration Portal of the University of Benin, Nigeria</h2>
+      <br />
+      <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project. 
+        For further information see 
+        <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
+      <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application 
+        entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
+      proceed with the admission and clearance process.</p>
+      <p><strong>Returning Students</strong> can login to check the course results of the previous session, 
+      to register courses for the current session, to pay their school fees and to book accommodation.</p>
+      <p>This site is best seen in Firefox browser.</p>
+    </span>
+    </metal:main>
+  </metal:body>
+</metal:html>
Index: /WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 535)
+++ /WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 535)
@@ -0,0 +1,25 @@
+<metal:html tal:define="info context/getStudentInfo">
+
+  <metal:body use-macro="here/main_template/macros/master">
+
+    <metal:main fill-slot="main"
+                tal:define="isManager python:'Manager' in member.getRoles() or 'SectionManager' in member.getRoles()">
+      <span tal:condition="not: isManager">
+        <metal:block use-macro="here/error_not_found/macros/not_found" />
+      </span>
+      <span tal:condition="isManager">
+        <table tal:define="students python: context.objectValues()">
+          <tr tal:repeat="student students">
+            <td><a href="id" tal:attributes="href string:${student/absolute_url}"
+                   tal:content="student/getId"></a></td>    
+            <span tal:omit-tag="" tal:define="info python: context.getStudentInfo(student)">
+            <td><span tal:replace="python: info['per_doc'].lastname" /></td>    
+            <td><span tal:replace="python: info['app_doc'].jamb_reg_no" /></td>    
+            <td><span tal:replace="info/review_state" /></td>    
+            </span>
+          </tr>
+        </table>
+      </span>
+    </metal:main>
+  </metal:body>
+</metal:html>
