Index: WAeUP_SRP/trunk/Widgets.py
===================================================================
--- WAeUP_SRP/trunk/Widgets.py	(revision 1015)
+++ WAeUP_SRP/trunk/Widgets.py	(revision 1016)
@@ -458,5 +458,5 @@
     def validate(self, datastructure, **kw):
         """Validate datastructure and update datamodel."""
-        s_logger = logging.getLogger('students_pin_usage')
+        s_logger = logging.getLogger('Student.Pin')
         widget_id = self.getWidgetId()
         v = datastructure[widget_id]
@@ -498,11 +498,11 @@
                     if self.reference == "jamb_reg_no":
                         err = "You are already logged in."
-                        s_logger.info("Student %s logged in used Pin %s" % (ref,pin))
+                        s_logger.info('"%s", "logged in", "%s"' % (ref,pin))
                         break
-                    s_logger.info("Student %s used Pin %s" % (s_id,pin))
+                    s_logger.info('"%s", "used", "%s"' % (ref,pin))
                     break
                 else:
                     student = getStudentByRegNo(self,ref)
-                    s_logger.info("Student RegNo %s used Pin %s" % (ref,pin))
+                    s_logger.info('"jamb_reg_no:%s","used","%s"' % (ref,pin))
                 if student is None:
                     err = "Student not found."
@@ -513,11 +513,11 @@
                         if hasattr(self.portal_directories.students,s_id):
                             err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                            s_logger.info("Student %s double used Pin %s" % (s_id,pin))
+                            s_logger.info('"%s", "double used", "%s"' % (s_id,pin))
                             break
                         else:
-                            s_logger.info("Student not Member %s double used Pin %s" % (s_id,pin))
+                            s_logger.info('"%s","notmember double used",  "%s"' % (s_id,pin))
                     else:
                         err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                        s_logger.info("Student %s double used Pin %s" % (s_id,pin))
+                        s_logger.info('"%s", "double used", "%s"' % (s_id,pin))
                         break
 ##                if self.reference == "jamb_reg_no":
@@ -529,8 +529,8 @@
                 try:
                     student.getContent().makeStudentMember(s_id,password=pin[4:])
-                    s_logger.info("Student %s created using Pin %s" % (s_id,pin))
+                    s_logger.info('"%s", "created using", "%s"' % (s_id,pin))
                 except:
                     err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                    s_logger.info("Student %s double creation with Pin %s" % (s_id,ref))
+                    s_logger.info('"%s", "double creation", "%s"' % (s_id,ref))
                     break
             break
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_clearance.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_clearance.xml	(revision 1015)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_clearance.xml	(revision 1016)
@@ -70,4 +70,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="alr_fname" meta_type="String Widget">
@@ -159,4 +160,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="cert" meta_type="Image Widget">
@@ -232,9 +234,43 @@
   <property name="label_edit">Entry Date</property>
   <property name="readonly_layout_modes">
-  </property>
-  <property name="hidden_layout_modes">
-   <element value="create"/>
-  </property>
-  <property name="hidden_readonly_layout_modes"/>
+   <element value="edit"/>
+  </property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
+  </widget>
+ <widget name="request_date" meta_type="Date Widget">
+  <property name="title">Request Date</property>
+  <property name="fields">
+   <element value="request_date"/>
+  </property>
+  <property name="label">Request Date</property>
+  <property name="label_edit">Request Date</property>
+  <property name="readonly_layout_modes">
+   <element value="edit"/>
+  </property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
+ </widget>
+ <widget name="cleared_date" meta_type="Date Widget">
+  <property name="title">cleared Date</property>
+  <property name="fields">
+   <element value="cleared_date"/>
+  </property>
+  <property name="label">Cleared Date</property>
+  <property name="label_edit">Cleared Date</property>
+  <property name="readonly_layout_modes">
+   <element value="edit"/>
+  </property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="entry_session" meta_type="String Widget">
@@ -294,4 +330,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="fst_sit_fname" meta_type="String Widget">
@@ -607,4 +644,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="scd_sit_fname" meta_type="String Widget">
@@ -726,4 +764,10 @@
   </row>
   <row>
+   <cell name="request_date"/>
+  </row>
+  <row>
+   <cell name="cleared_date"/>
+  </row>
+  <row>
    <cell name="birthday"/>
   </row>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml	(revision 1015)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml	(revision 1016)
@@ -70,4 +70,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="alr_fname" meta_type="String Widget">
@@ -159,4 +160,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="cert" meta_type="Image Widget">
@@ -238,4 +240,37 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
+ </widget>
+ <widget name="request_date" meta_type="Date Widget">
+  <property name="title">Request Date</property>
+  <property name="fields">
+   <element value="request_date"/>
+  </property>
+  <property name="label">Request Date</property>
+  <property name="label_edit">Request Date</property>
+  <property name="readonly_layout_modes">
+   <element value="edit"/>
+  </property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
+ </widget>
+ <widget name="cleared_date" meta_type="Date Widget">
+  <property name="title">Cleared Date</property>
+  <property name="fields">
+   <element value="cleared_date"/>
+  </property>
+  <property name="label">Cleared Date</property>
+  <property name="label_edit">Cleared Date</property>
+  <property name="readonly_layout_modes">
+   <element value="edit"/>
+  </property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="entry_session" meta_type="String Widget">
@@ -296,4 +331,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="fst_sit_fname" meta_type="String Widget">
@@ -509,5 +545,6 @@
   <property name="label">Local Government Area</property>
   <property name="label_edit">Local Government Area</property>
-  <property name="readonly_layout_modes"/>
+  <property name="readonly_layout_modes">
+  </property>
   <property name="hidden_layout_modes">
    <element value="create"/>
@@ -557,5 +594,6 @@
   <property name="label">Nationality</property>
   <property name="label_edit">Nationality</property>
-  <property name="readonly_layout_modes"/>
+  <property name="readonly_layout_modes">
+  </property>
   <property name="hidden_layout_modes">
    <element value="create"/>
@@ -610,4 +648,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
+  <property name="view_format">iso8601_medium_easy</property> 
  </widget>
  <widget name="scd_sit_fname" meta_type="String Widget">
@@ -729,4 +768,10 @@
   </row>
   <row>
+   <cell name="request_date"/>
+  </row>
+  <row>
+   <cell name="cleared_date"/>
+  </row>
+  <row>
    <cell name="birthday"/>
   </row>
Index: WAeUP_SRP/trunk/profiles/default/schemas/student_clearance.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/student_clearance.xml	(revision 1015)
+++ WAeUP_SRP/trunk/profiles/default/schemas/student_clearance.xml	(revision 1016)
@@ -11,4 +11,6 @@
 
  <field name="entry_date" meta_type="CPS DateTime Field"/>
+ <field name="request_date" meta_type="CPS DateTime Field"/>
+ <field name="cleared_date" meta_type="CPS DateTime Field"/>
  <field name="entry_session" meta_type="CPS String Field"/>
 
Index: WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1015)
+++ WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1016)
@@ -16,5 +16,5 @@
 current = DateTime.DateTime()
 import logging
-logger = logging.getLogger('student_login')
+logger = logging.getLogger('Student.Login')
 
 
@@ -60,5 +60,5 @@
             s_review_state = wftool.getInfoFor(student,'review_state',None)
             a_review_state = wftool.getInfoFor(student_app,'review_state',None)
-            logger.info('%s review_state %s' % (member,s_review_state))
+            logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state))
             app_doc = student_app.getContent()
             #from Products.zdb import set_trace
Index: WAeUP_SRP/trunk/skins/waeup_student/application_edit.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/application_edit.py	(revision 1015)
+++ WAeUP_SRP/trunk/skins/waeup_student/application_edit.py	(revision 1016)
@@ -15,4 +15,6 @@
 import DateTime
 current = DateTime.DateTime()
+import logging
+logger = logging.getLogger('Student.Application.Edit')
 
 # Until ajax posts directly to its own script...
@@ -27,4 +29,8 @@
 info = context.getStudentInfo()
 
+if info is None:
+    logger.info('"anonymous access","%s"' % request.get('URL0'))
+    REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
+    
 student = info['student']
 app = info['app']
@@ -50,4 +56,5 @@
     elif cpsdocument_edit_and_view_button:
         if app_doc.passport is not None:
+            logger.info('"%s", "continue' % (info['id']))
             action = "/start_clearance"
             base_url = student.absolute_url()
Index: WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py	(revision 1015)
+++ WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py	(revision 1016)
@@ -15,4 +15,6 @@
 import DateTime
 current = DateTime.DateTime()
+import logging
+logger = logging.getLogger('Student.Clearance')
 
 cpsdocument_edit_button = REQUEST.has_key('cpsdocument_edit_button')
@@ -35,4 +37,6 @@
 clear = info['clear']
 clear_doc = info['clear_doc']
+student_id = info['id']
+member_id = str(context.portal_membership.getAuthenticatedMember())
 
 is_valid, ds = clear_doc.validate(request=REQUEST,
@@ -51,5 +55,7 @@
            action = "/clearance_edit_form"        
     elif cpsdocument_edit_and_view_button:
-        if acknowledge:
+        if acknowledge and info['review_state'] == "clearance_pin_entered":
+            logger.info('"%s","requested clearance"' % (student_id))
+            info['clear_doc'].edit(mapping = {'request_date': current,})
             wftool.doActionFor(info['clear'],'close')
             wftool.doActionFor(info['student'],'request_clearance',dest_container=1)
@@ -57,12 +63,22 @@
             if context.isStudent():
                action = "/clearance_view"
+        elif acknowledge and info['review_state'] != "clearance_pin_entered":
+            logger.info('"%s","double requested clearance"' % (student_id))
+            psm = "You have already requested clearance"
+            if context.isStudent():
+               action = "/clearance_edit_form"
         else:
             psm = "You must tick the acknowledgement check box before submission!"
             if context.isStudent():
                action = "/clearance_edit_form"
-    elif clear_and_validate_button:
+    elif clear_and_validate_button and info['review_state'] == "clearance_requested":
+        logger.info('"%s","cleared","%s"' % (member_id,student_id ))
         wftool.doActionFor(info['student'],'clear_and_validate')
+        info['clear_doc'].edit(mapping = {'cleared_date': current,})
         psm = "Clearance and eligibility record is validated and and student is cleared!"
+    elif clear_and_validate_button and info['review_state'] == "cleared_and_validated":
+        psm = "This student is already cleared!"
     elif reject_clearance_button:
+        logger.info('"%s","rejected clearance for","%s"' % (member_id,student_id ))
         wftool.doActionFor(info['clear'],'open')
         wftool.doActionFor(info['student'],'reject_clearance')
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 1015)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 1016)
@@ -34,8 +34,5 @@
         try:
             requested_id = path_info[path_info.index('students')+1]
-        except ValueError:
-            student_id = member_id
-            break
-        except IndexError:
+        except (ValueError,IndexError):
             student_id = member_id
             break
Index: WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py	(revision 1015)
+++ WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py	(revision 1016)
@@ -7,4 +7,6 @@
 current = DateTime.DateTime()
 pr = context.portal_registration
+import logging
+logger = logging.getLogger('Student.Clearance.Start')
 
 type_name = 'Student'
@@ -18,4 +20,8 @@
 pr = context.portal_registration
 
+info = context.getStudentInfo()
+app_doc = info['app_doc']
+review_state = info['review_state']
+
 res,psm,ds = lt.renderLayout(layout_id='student_clearance',
                       schema_id= 'student_clearance',
@@ -27,25 +33,5 @@
                       button = "Start",
                       )
-
-info = context.getStudentInfo()
-app_doc = info['app_doc']
-if app_doc.passport is None:
-    return context.clearance_pin_form(rendered = res,
-                                 psm = "You must upload your passport picture before you can start the registration process!",
-                                 #psm = "%s, %s" % (psm,ds),
-                                 firstlayout = True,
-                                 lastlayout = True,
-                                 ds = ds,
-                                 )
-
-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 == '':
+if psm == '':
     return context.clearance_pin_form(rendered = res,
                                  psm = None,
@@ -54,16 +40,33 @@
                                  ds = ds,
                                  )
-elif psm == 'valid':
-    info = context.getStudentInfo()
-    review_state = info['review_state']
-    wf.doActionFor(info['student'],'enter_clearance_pin')
-    wf.doActionFor(info['app'],'close')
-    wf.doActionFor(info['clear'],'open')
-    pin = str(ds.get('clr_ac_pin'))
-    dc = {}
-    dc['clr_ac_pin'] = pin
-    dc['clr_ac_date'] = current
-    dc['entry_date'] = current
-    dc['entry_session'] = "2006/2007"
-    info['clear_doc'].edit(mapping = dc)
+error = False
+if app_doc.passport is None:
+    psm = "You must upload your passport picture before you can start the registration process!"
+    error = True
+elif review_state == "clearance_pin_entered":
+    psm = "You have already entered a clearance pin"
+    error = True
+elif psm == 'invalid':
+    psm = "Please correct your input!",
+    error = True
+if error:
+    return context.clearance_pin_form(rendered = res,
+                                 psm = psm,
+                                 firstlayout = True,
+                                 lastlayout = True,
+                                 ds = ds,
+                                 )
+pin = str(ds.get('clr_ac_pin'))
+logger.info('"%s", "%s"' % (info['id'],pin))
+wf.doActionFor(info['student'],'enter_clearance_pin')
+wf.doActionFor(info['clear'],'open')
+dc = {}
+app_doc = info['app_doc']
+dc['lga_ident'] = app_doc.get('jamb_lga')
+dc['lga'] = app_doc.get('jamb_state','no state') + ' / ' + app_doc.get('jamb_lga','no lga') 
+dc['clr_ac_date'] = current
+dc['entry_date'] = current
+dc['entry_session'] = "2006/2007"
+wf.doActionFor(info['app'],'close')
+info['clear_doc'].edit(mapping = dc)
 return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
