Index: WAeUP_SRP/trunk/Students.py
===================================================================
--- WAeUP_SRP/trunk/Students.py	(revision 765)
+++ WAeUP_SRP/trunk/Students.py	(revision 766)
@@ -310,4 +310,8 @@
             student = getattr(self,sid)
             student.manage_setLocalRoles(sid, ['Owner',])
+            student.invokeFactory('StudentClearance','clearance')
+            wftool.doActionFor(student.clearance,'open')
+            dp = {'Title': 'Clearance Data'}
+            student.clearance.manage_setLocalRoles(sid, ['Owner',])
             student.invokeFactory('StudentPume','pume')
             dp = {'Title': 'Pume Data'}
@@ -329,5 +333,4 @@
             app = student.application
             app.getContent().edit(mapping=da)
-            #wftool.doActionFor(app,'open',dest_container=app)
             app.manage_setLocalRoles(sid, ['Owner',])
             dp_fields = (
@@ -343,4 +346,5 @@
             pume.manage_setLocalRoles(sid, ['Owner',])
             student.getContent().createSubObjects()
+            wftool.doActionFor(student,'admit',dest_container=student)
             if len(no_import) > 1:
                 open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write(
Index: WAeUP_SRP/trunk/profiles/default/actionicons.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/actionicons.xml	(revision 765)
+++ WAeUP_SRP/trunk/profiles/default/actionicons.xml	(revision 766)
@@ -241,4 +241,7 @@
               title="Apply for PUME" priority="2"
               icon_expr="bell.png"/>
+ <action-icon category="student" action_id="request_clearance"
+              title="Apply for PUME" priority="3"
+              icon_expr="bell.png"/>
  <action-icon category="student" action_id="reserve_accommodation"
               title="Book Hostel" priority="3"
Index: WAeUP_SRP/trunk/profiles/default/actions.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/actions.xml	(revision 765)
+++ WAeUP_SRP/trunk/profiles/default/actions.xml	(revision 766)
@@ -138,4 +138,10 @@
    <permission>View</permission>
   </action>
+  <action title="Request Clearance" action_id="request_clearance"
+     category="student" condition_expr="not:member"
+     url_expr="string:${portal_url}/request_clearance"
+     visible="True">
+   <permission>View</permission>
+  </action>
   <action title="Book Hostel" action_id="reserve_accommodation"
      category="student" condition_expr="member"
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_application_fe.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_application_fe.xml	(revision 765)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_application_fe.xml	(revision 766)
@@ -36,5 +36,5 @@
   <property name="hidden_layout_modes"/>
   <property name="hidden_readonly_layout_modes"/>
-  <property name="prefix">APP</property>
+  <property name="prefix">CLR</property>
   <property name="reference">jamb_reg_no</property>
   </widget>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml	(revision 765)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml	(revision 766)
@@ -655,8 +655,32 @@
  <table>
   <row>
+   <cell name="clr_ac_pin"/>
+  </row>
+  <row>
+   <cell name="entry_date"/>
+  </row>
+  <row>
+   <cell name="entry_session"/>
+  </row>
+  <row>
+   <cell name="email"/>
+  </row>
+  <row>
+   <cell name="passport"/>
+  </row>
+  <row>
    <cell name="lga"/>
   </row>
   <row>
    <cell name="nationality"/>
+  </row>
+  <row>
+   <cell name="matric_no"/>
+  </row>
+  <row>
+   <cell name="birthday"/>
+  </row>
+  <row>
+   <cell name="birth_certificate"/>
   </row>
  </table>
Index: WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml	(revision 765)
+++ WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml	(revision 766)
@@ -28,12 +28,18 @@
  </state>
  <state state_id="clearance_pin_entered" title="">
-  <exit-transition transition_id="request_clearence"/>
+  <exit-transition transition_id="request_clearance"/>
+  <permission-map name="Modify portal content"
+                  acquired="True">
+  </permission-map>
  </state>
  <state state_id="cleared_and_validated" title="">
   <exit-transition transition_id="create_content"/>
  </state>
- <state state_id="clearence_requested" title="">
+ <state state_id="clearance_requested" title="">
   <exit-transition transition_id="clear_and_validate"/>
   <exit-transition transition_id="reject_clearance"/>
+  <permission-map name="Modify portal content"
+                  acquired="True">
+  </permission-map>
  </state>
  <state state_id="deferred" title="">
@@ -50,4 +56,5 @@
  </state>
  <state state_id="student_created" title="">
+  <exit-transition transition_id="admit"/>
   <exit-transition transition_id="clear_and_validate"/>
   <exit-transition transition_id="create_content"/>
@@ -184,6 +191,6 @@
   </guard>
  </transition>
- <transition transition_id="request_clearence" title=""
-             new_state="clearence_requested" trigger="USER"
+ <transition transition_id="request_clearance" title=""
+             new_state="clearance_requested" trigger="USER"
              before_script="" after_script="">
   
Index: WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 765)
+++ WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 766)
@@ -51,12 +51,19 @@
             info = context.getStudentInfo()
             student = info['student']
-            if info['review_state'] == "student_created":
-                student.content_status_modify(workflow_action="enter_application_pin")
+            if info['review_state'] in ("student_created","admitted"):
+                student.content_status_modify(workflow_action="enter_clearance_pin")
                 wftool.doActionFor(info['app'],'open',dest_container=info['app'])
                 da = {}
                 pin = request.get('pin')
+                app_doc = info['app_doc']
                 da['app_ac_pin'] = pin
                 da['app_ac_date'] = current
-                info['app_doc'].edit(mapping = da)
+                app_doc.edit(mapping = da)
+                dc = {}
+                dc['clr_ac_pin'] = pin
+                dc['entry_date'] = current
+                dc['session'] = "%s" % current.year()
+                dc['lga'] = app_doc.jamb_lga
+                info['clear_doc'].edit(mapping = dc)
         elif "Manager" in member.getRoles():
             pass
Index: WAeUP_SRP/trunk/skins/waeup_student/clearance_pin_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/clearance_pin_form.pt	(revision 766)
+++ WAeUP_SRP/trunk/skins/waeup_student/clearance_pin_form.pt	(revision 766)
@@ -0,0 +1,31 @@
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;
+                   data_storage options/ds;
+                   jamb options/jamb/getContent|nothing;
+                   edition python:1;"
+                   >
+<metal:block define-macro="edit_form">
+  <metal:block use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="header"
+    tal:define="creation creation|nothing;
+                edition edition|nothing;
+                metadata metadata|nothing"
+                >
+    </metal:block>
+      <metal:block fill-slot="main">
+        <h3>Request Clearance! </h3>
+        <br />
+        <div tal:replace="structure rendered_main" />
+          <p>Instructions :</p>
+          <ul>
+            <li>Buy a Clearance Scratch Card.</li> 
+            <li>Enter your JAMB registration number and the Clearance PIN above.</li> 
+            <li>Upload your passport picture.</li> 
+            <li>Apply</li>
+          </ul>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: WAeUP_SRP/trunk/skins/waeup_student/clearance_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/clearance_view.pt	(revision 766)
+++ WAeUP_SRP/trunk/skins/waeup_student/clearance_view.pt	(revision 766)
@@ -0,0 +1,30 @@
+<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">
+            
+        <div style="text-align: right"
+             tal:condition="python:review_state=='admission_applied'">
+        <a href="" target="slip" tal:attributes="href string:application_slip"
+            onclick="javascript:window.open('','slip','width=600, height=700, directories=no, toolbar=no, location=no, menubar=yes, scrollbars=yes, status=no, resizable=no, dependent=no')">
+            <img tal:attributes="src string:${here/portal_url}/actionicon_print.png" />
+            Application Slip
+        </a>
+        
+        </div>
+
+        <h3>My Clearance Record</h3>
+        <br />
+        <span tal:omit-tag=""
+              tal:content="structure python: info['clear_doc'].render(proxy=info['clear_doc'],
+              layout_mode='view', 
+              layout_id='student_clearance_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 765)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 766)
@@ -59,12 +59,23 @@
 else:
     info['acco'] = None
+res = context.portal_catalog(container_path=student_path,
+                             portal_type='StudentClearance')
+if res:
+    clear = res[0].getObject()
+    info['clear'] = clear
+    info['clear_doc'] = clear.getContent()
+    info['clear_review_state'] = wf.getInfoFor(clear,'review_state',None)
+else:
+    info['clear'] = None
 
 items = []
 s_edit_links = {'StudentApplication': 'student_edit',
               'StudentAccommodation': '',
+              'StudentClearance': '',
               'StudentPersonal': '',
               }
 s_view_links = {'StudentApplication': None,
               'StudentAccommodation': 'accommodation_view',
+              'StudentClearance': None,
               'StudentPersonal': None,
               'StudentApplication': 'application_view',
Index: WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 765)
+++ WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 766)
@@ -18,5 +18,5 @@
       <span tal:condition="info"
             tal:define="review_state info/review_state">
-        <h3>Upload your Passport Picture!</h3>
+        <h3>Upload or Change your Passport Picture!</h3>
         <br />
         <span tal:omit-tag="" tal:replace="structure rendered_main"/>
Index: WAeUP_SRP/trunk/skins/waeup_student/request_clearance.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/request_clearance.py	(revision 766)
+++ WAeUP_SRP/trunk/skins/waeup_student/request_clearance.py	(revision 766)
@@ -0,0 +1,51 @@
+##parameters=REQUEST
+# $Id: apply_admission.py 649 2006-10-11 06:24:39Z joachim $
+"""
+request Clearance
+"""
+import DateTime
+current = DateTime.DateTime()
+pr = context.portal_registration
+
+
+type_name = 'StudentApplication'
+ti = context.portal_types[type_name]
+REQUEST.set('type_name',type_name)
+
+validate = REQUEST.has_key("cpsdocument_create_button")
+
+lt = context.portal_layouts
+pr = context.portal_registration
+
+res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe',
+                      schema_id= 'student_application',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      formaction = "request_clearance",
+                      button = "Request Clearance",
+                      )
+if psm == 'invalid':
+    return context.clearance_pin_form(rendered = res,
+                                 psm = "Please correct your input.",
+                                 #psm = "%s, %s" % (psm,ds),
+                                 firstlayout = True,
+                                 lastlayout = True,
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.clearance_pin_form(rendered = res,
+                                 psm = None,
+                                 firstlayout = True,
+                                 lastlayout = True,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    s_id = ds.get('s_id')
+    pin = str(ds.get('app_ac_pin'))
+    return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s"
+          % (context.absolute_url(),s_id,pin.split('-')[2],pin))
+return
+
+
Index: WAeUP_SRP/trunk/skins/waeup_student/student_edit.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/student_edit.py	(revision 765)
+++ WAeUP_SRP/trunk/skins/waeup_student/student_edit.py	(revision 766)
@@ -9,18 +9,10 @@
 # $Id$
 """
-Called when a document form is posted.
-
-Validates data, then:
-
- - if there's no error, updates the object and redirects to it,
-
- - if there's an error, puts data in session and redirects to edit form.
-
-A form uid is propagated during the redirect to uniquely identify the
-form in the session.
 """
 wftool = context.portal_workflow
 from urllib import urlencode
 from Products.CPSDocument.utils import getFormUidUrlArg
+import DateTime
+current = DateTime.DateTime()
 
 # Until ajax posts directly to its own script...
@@ -38,4 +30,6 @@
 app = info['app']
 app_doc = info['app_doc']
+clear = info['clear']
+clear_doc = info['clear_doc']
 state = context.getStudentInfo()['review_state']
 
@@ -77,8 +71,30 @@
     else:
         args = {}
-        student.content_status_modify(workflow_action="apply_for_admission")
-        wftool.doActionFor(app,'close',dest_container= app)
-        psm = 'You applied for admission.'
-        action = "/application_view"
+        if info['review_state'] == "student_created":
+            student.content_status_modify(workflow_action="apply_for_admission")
+            wftool.doActionFor(app,'close',dest_container= app)
+            psm = 'You applied for admission.'
+            action = "/application_view"
+        elif info['review_state'] == "clearance_pin_entered":
+            student.content_status_modify(workflow_action="request_clearance")
+            #wftool.doActionFor(info['clear'],'open',dest_container=info['clear'])
+            da = {}
+            pin = REQUEST.get('pin')
+            da['app_ac_pin'] = pin
+            da['app_ac_date'] = current
+            app_doc = info['app_doc']
+            app_doc.edit(mapping = da)
+            dc = {}
+            dc['email'] = app_doc.appl_email
+            dc['mobil'] = app_doc.appl_mobile
+            dc['passport'] = app_doc.passport
+            info['clear_doc'].edit(mapping = dc)
+            wftool.doActionFor(app,'close',dest_container= app)
+            psm = 'You requested clearance.'
+            action = "/clearance_view"
+        else:
+            psm = ''
+            action = "/clearance_view"
+            
 else:
     is_valid, ds = app_doc.validate(request=REQUEST, proxy=context, cluster=cluster,
Index: WAeUP_SRP/trunk/skins/waeup_student/student_index.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 765)
+++ WAeUP_SRP/trunk/skins/waeup_student/student_index.py	(revision 766)
@@ -32,9 +32,9 @@
     if state == 'admission_applied':
         return redirect("%s/application_view" % student.absolute_url())
-    elif state == 'application_pin_entered':
+    elif state in ('application_pin_entered','clearance_pin_entered'):
         return redirect("%s/passport_entry_view" % student.absolute_url())
+    elif state == 'request_clearance':
+        return redirect("%s/student_view" % info['clear'].absolute_url())
     elif context.portal_type == 'StudentStudyLevel':
         return context.study_level_student_view()
     return redirect("%s/student_view" % student.absolute_url())
-
-
