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())
-
-
