Index: /WAeUP_SRP/trunk/Students.py
===================================================================
--- /WAeUP_SRP/trunk/Students.py	(revision 1150)
+++ /WAeUP_SRP/trunk/Students.py	(revision 1151)
@@ -809,7 +809,7 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"importRegisteredStudents")###(
-    def importRegisteredStudents(self):
-        """load Registered Studentdata from CSV values"""
+    security.declareProtected(ModifyPortalContent,"importReturningStudents")###(
+    def importReturningStudents(self):
+        """load Returning Studentdata from CSV values"""
         import transaction
         import random
@@ -821,11 +821,11 @@
         total = 0
         #name = 'pume_results'
-        name = 'Registered'
-        table = self.registered_import
+        name = 'Returning'
+        table = self.returning_import
         no_import = []
         imported = []
         logger = logging.getLogger('Import.%s' % name)
         try:
-            registered = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+            returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
         except:
             logger.error('Error reading %s.csv' % name)
@@ -841,5 +841,5 @@
         if len(res) > 0:
             regs = [s.matric_no for s in res]
-        for student in registered:
+        for student in returning:
             if start:
                 start = False
@@ -877,9 +877,9 @@
                 if len(no_import) > 0:
                     open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write(
-                             '\n'.join(no_import))
+                             '\n'.join(no_import) + '\n')
                     no_import = []
-                    imported = []
                 open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write(
-                                            '\n'.join(no_import))
+                                            '\n'.join(no_import) + "\n")
+                imported = []
                 em = '%d transactions commited total %s\n' % (tr_count,total)
                 transaction.commit()
@@ -896,5 +896,5 @@
     security.declareProtected(ModifyPortalContent,"importResults")###(
     def importResults(self):
-        """load Registered Studentdata from CSV values"""
+        """load Returning Students Results from CSV"""
         import transaction
         import random
@@ -967,12 +967,12 @@
                 if len(no_import) > 0:
                     open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write(
-                             '\n'.join(no_import))
+                             '\n'.join(no_import)+'\n')
                     no_import = []
                 open("%s/import/%simported%s.csv" % (i_home,name,current),"a").write(
-                                            '\n'.join(imported))
+                                            '\n'.join(imported) + '\n')
                 imported = []
                 if no_course_list:
                     open("%s/import/%sno_courses%s.csv" % (i_home,name,current),"a").write(
-                                            '\n'.join(no_course_list))
+                                            '\n'.join(no_course_list) + '\n')
                     no_course_list = []
                 em = '%d transactions commited total %s\n courses not found %s' % (tr_count,total,course_count)
@@ -1720,5 +1720,4 @@
 ###)
 
-
 class StudentPume(CPSDocument): ###(
     """
Index: /WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTables.py	(revision 1150)
+++ /WAeUP_SRP/trunk/WAeUPTables.py	(revision 1151)
@@ -232,15 +232,17 @@
 
 InitializeClass(CoursesCatalog)
-
-class RegisteredImport(WAeUPTable): ###(
-
-    meta_type = 'Registered Import Table'
-    name = "registered_import"
+###)
+
+class ReturningImport(WAeUPTable): ###(
+
+    meta_type = 'Returning Import Table'
+    name = "returning_import"
     key = "matric_no"
     def __init__(self):
-        WAeUPTable.__init__(self, 'registered_import')
-
-
-InitializeClass(RegisteredImport)
+        WAeUPTable.__init__(self, 'returning_import')
+
+
+InitializeClass(ReturningImport)
+###)
 
 class ResultsImport(WAeUPTable): ###(
Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1150)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1151)
@@ -35,4 +35,7 @@
 from Products.CMFCore.permissions import ModifyPortalContent
 from Products.CMFCore.utils import UniqueObject
+from Students import makeCertificateCode
+import logging
+
 
 class WAeUPTool(UniqueObject, SimpleItem, ActionProviderBase):
@@ -50,13 +53,134 @@
                      )
 
-##    security.declarePublic('getHallTitle')
-##    def getHallTitle(self,hall):
-##        """get the Hall Title"""
-##        res = ZCatalog.searchResults(self.portal_catalog,portal_type="AccoHall",id=hall)
-##        if res and len(res) == 1:
-##            return res[0].Title
-##        return hall
-
-    security.declarePublic('getAccommodationInfo')
+    def generateStudentId(self,letter): ###(
+        import random
+        r = random
+        if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'):
+            letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY')
+        students = self.portal_url.getPortalObject().campus.students
+        sid = "%c%d" % (letter,r.randint(99999,1000000))
+        while hasattr(students, sid):
+            sid = "%c%d" % (letter,r.randint(99999,1000000))
+        return sid
+    ###)
+
+    security.declarePublic('getCertificateBrain') ###(
+    def getCertificateBrain(self,cert_id):
+        "do it"
+        res = ZCatalog.searchResults(self.portal_catalog,
+                                {'portal_type':"Certificate",
+                                      'id': cert_id})
+        if res:
+            return res[0]
+        return None
+    ###)
+    
+    security.declarePublic('findStudentByMatricelNo') ###(
+    def findStudentByMatricelNo(self,matric_no):
+        "do it"
+        res = ZCatalog.searchResults(self.portal_catalog,
+                                {'portal_type':"StudentClearance",
+                                 'SearchableText': matric_no})
+        if res:
+            return res[0]
+        return None
+    ###)
+
+    security.declarePublic('makeStudentMember') ###(
+    def makeStudentMember(self,sid,password='uNsEt'):
+        """make the student a member"""
+        membership = self.portal_membership
+        membership.addMember(sid,
+                             password ,
+                             roles=('Member',
+                                     'Student',
+                                     ),
+                             domains='',
+                             properties = {'memberareaCreationFlag': False,
+                                           'homeless': True},)
+        member = membership.getMemberById(sid)
+        self.portal_registration.afterAdd(member, sid, password, None)
+        self.manage_setLocalRoles(sid, ['Owner',])
+    ###)
+        
+    security.declarePublic('makeStudentData') ###(
+    def makeStudentData(self,student_id,email=None):
+        "create Datastructure for a returning Student"
+        #import pdb;pdb.set_trace()
+        logger = logging.getLogger('Student.CreateData')
+        students_folder = self.portal_url.getPortalObject().campus.students
+        res = self.students_catalog(id=student_id)
+        if res:
+            st = res[0]
+        res = self.returning_import(matric_no = st.matric_no)
+        if res:
+            student = res[0] 
+        logger.info('"%s", "creating Datastructure"')
+        certcode_org = student.Coursemajorcode
+        certcode = makeCertificateCode(certcode_org)
+        certificate_brain = self.getCertificateBrain(certcode)
+        if not certificate_brain:
+            em = 'Certificate %s org-code %s not found\n' % (certcode, certcode_org)
+            logger.info(em)
+        level = student.Level
+        try:
+            int(level)
+        except:
+            em = '"%(matric_no)s","invalid Level","%(Level)s"' % student
+            logger.info(em)
+        matric_no = student.matric_no
+        sid = student_id
+        student_obj = getattr(students_folder,sid)
+        student_obj.invokeFactory('StudentApplication','application')
+        application = student_obj.application
+        self.portal_workflow.doActionFor(application,'open',dest_container=application)
+        da = {'Title': 'Application Data'}
+        student_obj.invokeFactory('StudentPersonal','personal')
+        da['jamb_reg_no'] = student.Entryregno
+        da['entry_mode'] = student.Mode_of_Entry
+        personal = student_obj.personal
+        self.portal_workflow.doActionFor(personal,'open',dest_container=personal)
+        dp = {'Title': 'Personal Data'}
+        student_obj.invokeFactory('StudentClearance','clearance')
+        clearance = student_obj.clearance
+        self.portal_workflow.doActionFor(clearance,'open',dest_container=clearance)
+        dc = {'Title': 'Clearance/Eligibility Record'}
+        dc['matric_no'] = matric_no
+        state = student.State
+        lga = student.LGA
+        if state and lga:
+            lga =  state + ' / ' + lga
+        else:
+            lga = "None"
+        dc['lga'] = lga
+        dc['email'] = email
+        dp['firstname'] = student.Firstname
+        dp['middlename'] = student.Middlename
+        dp['lastname'] = student.Lastname
+        dp['sex'] = student.Sex == 'F'
+        dp['perm_address'] = student.Permanent_Address
+        application.getContent().edit(mapping=da)
+        personal.getContent().edit(mapping=dp)
+        clearance.getContent().edit(mapping=dc)
+        #
+        # Study Course
+        #
+        student_obj.invokeFactory('StudentStudyCourse','study_course')
+        studycourse = student_obj.study_course
+        self.portal_workflow.doActionFor(studycourse,'open',dest_container=studycourse)
+        dsc = {}
+        dsc['study_course'] = certcode
+        studycourse.getContent().edit(mapping=dsc)
+        #
+        # Level
+        #
+##        l = getattr(studycourse,level,None)
+##        if l is None:
+##            studycourse.invokeFactory('StudentStudyLevel', level)
+##            l = getattr(studycourse, level)
+##            self.portal_workflow.doActionFor(l,'open',dest_container=l)
+##            l.getContent().edit(mapping={'Title': "Level %s" % level})
+        
+    security.declarePublic('getAccommodationInfo') ###(
     def getAccommodationInfo(self,bed):
         """return Accommodation Info"""
@@ -82,4 +206,28 @@
             info['maintenance_fee'] = batch_doc.cost
         return info
+    ###)
+
+    security.declareProtected(ModifyPortalContent,'deleteAllCourses') ###(
+    def deleteAllCourses(self,department="All"):
+        ''' delete the courses'''
+        pm = self.portal_membership
+        member = pm.getAuthenticatedMember()
+        
+        if str(member) not in ("henrik","joachim"):
+            return "not possible"
+        if department == "All":
+            res = self.portal_catalog({'meta_type': 'Department'})
+        if len(res) < 1:
+            return "No Departments found"
+        
+        deleted = []
+        for dep in res:
+            cf = dep.getObject().courses
+            if cf:
+                cf.manage_delObjects(ids=cf.objectIds())
+                deleted.append("deleted Courses in %s" % dep.getId)
+        return "\r".join(deleted)
+    ###)    
+    
 
 InitializeClass(WAeUPTool)
Index: /WAeUP_SRP/trunk/Widgets.py
===================================================================
--- /WAeUP_SRP/trunk/Widgets.py	(revision 1150)
+++ /WAeUP_SRP/trunk/Widgets.py	(revision 1151)
@@ -326,5 +326,5 @@
         valid = CPSStringWidget.validate(self, datastructure, **kw)
         #import pdb;pdb.set_trace()
-        pumeresults = self.portal_pumeresults
+        pumeresults = self.pumeresults
         if not valid:
             return 0
@@ -361,5 +361,5 @@
         valid = CPSStringWidget.validate(self, datastructure, **kw)
         #import pdb;pdb.set_trace()
-        registered = self.registered_import
+        returning = self.returning_import
         results = self.results_import
         err = 0
@@ -371,5 +371,5 @@
             #s = getStudentByRegNo(self,value)
             while not err:
-                res = registered(matric_no = value)
+                res = returning(matric_no = value)
                 if len(res) < 1:
                     err = 'No Student with MatricNo %s.' % (value)
Index: /WAeUP_SRP/trunk/exportimport.py
===================================================================
--- /WAeUP_SRP/trunk/exportimport.py	(revision 1150)
+++ /WAeUP_SRP/trunk/exportimport.py	(revision 1151)
@@ -102,5 +102,5 @@
     importWAeUPTable(site.portal_pins, '', context,'pins')
     importWAeUPTable(site.portal_pumeresults, '', context,'pumeresults')
-    importWAeUPTable(site.registered_import, '', context,'registered_import')
+    importWAeUPTable(site.returning_import, '', context,'returning_import')
     importWAeUPTable(site.results_import, '', context,'results_import')
     importWAeUPTable(site.students_catalog, '', context,'students_catalog')
Index: /WAeUP_SRP/trunk/profiles/default/layouts/student_session_results_search.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/student_session_results_search.xml	(revision 1150)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/student_session_results_search.xml	(revision 1151)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<object name="student_session_result_search" meta_type="CPS Layout">
+<object name="student_session_results_search" meta_type="CPS Layout">
  <property name="layout_create_method"></property>
  <property name="layout_edit_method"></property>
@@ -7,4 +7,36 @@
  <property name="flexible_widgets"/>
  <property name="validate_values_expr"></property>
+ <property name="label"></property>
+ <property name="label_edit"></property>
+ <property name="is_i18n">False</property>
+ <widget name="email" meta_type="Email Widget">
+  <property name="title">Email</property>
+  <property name="fields">
+   <element value="email"/>
+  </property>
+  <property name="label">Email</property>
+  <property name="label_edit">Email</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="jamb_reg_no" meta_type="String Widget">
+  <property name="title">JAMP Registration Nr</property>
+  <property name="fields">
+   <element value="jamb_reg_no"/>
+  </property>
+  <property name="label">JAMP Registration Nr</property>
+  <property name="label_edit">JAMP Registration Nr</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+   <element value="edit"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="display_width">10</property>
+  <property name="size_max">10</property>
+ </widget>
  <widget name="matric_no" meta_type="MatricNo Widget">
   <property name="title">Matriculation Number</property>
@@ -22,7 +54,48 @@
   <property name="size_max">10</property>
  </widget>
+ <widget name="password" meta_type="Password Widget">
+  <property name="title">Password</property>
+  <property name="fields">
+   <element value="password"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Choose a Password</property>
+  <property name="label_edit">Choose a Password</property>
+  <property name="check_digit">True</property>
+  <property name="password_widget"></property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="repeat_password" meta_type="Password Widget">
+  <property name="title">Password</property>
+  <property name="fields">
+   <element value="repeat_password"/>
+  </property>
+  <property name="is_required">False</property>
+  <property name="label">Choose a Password</property>
+  <property name="label_edit">Repeat Password</property>
+  <property name="readonly_layout_modes"/>
+  <property name="password_widget">password</property>
+  <property name="hidden_layout_modes">
+   <element value="create"/>
+  </property>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="size_min">0</property>
+ </widget>
  <table>
   <row>
-   <cell name="matric_no" ncols="3"/>
+   <cell name="matric_no" />
+  </row>
+  <row>
+   <cell name="email" />
+  </row>
+  <row>
+   <cell name="password" />
+  </row>
+  <row>
+   <cell name="repeat_password" />
   </row>
  </table>
Index: /WAeUP_SRP/trunk/profiles/default/returning_import.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/returning_import.xml	(revision 1151)
+++ /WAeUP_SRP/trunk/profiles/default/returning_import.xml	(revision 1151)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<object name="portal_catalog" meta_type="CMF Catalog">
+ <column value="matric_no"/>
+ <column value="Entryregno"/>
+ <column value="Faculty"/>
+ <column value="Department"/>
+ <column value="Coursemajor"/>
+ <column value="Coursemajorcode"/>
+ <column value="Fullname"/>
+ <column value="Firstname"/>
+ <column value="Middlename"/>
+ <column value="Lastname"/>
+ <column value="Mode_of_Entry"/>
+ <column value="Sex"/>
+ <column value="State"/>
+ <column value="LGA"/>
+ <column value="Level"/>
+ <column value="Permanent_Address"/>
+ <column value="f1"/>
+ <column value="f2"/>
+ <column value="f3"/>
+ <column value="f4"/>
+ <index name="matric_no" meta_type="FieldIndex">
+  <indexed_attr value="matric_no"/>
+ </index>
+</object>
Index: /WAeUP_SRP/trunk/profiles/default/schemas.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1150)
+++ /WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1151)
@@ -20,4 +20,5 @@
  <object name="student_personal" meta_type="CPS Schema"/>
  <object name="student_pume" meta_type="CPS Schema"/> 
+ <object name="student_returning" meta_type="CPS Schema"/> 
  <object name="student_search" meta_type="CPS Schema"/>
  <object name="student_study_course" meta_type="CPS Schema"/>
Index: /WAeUP_SRP/trunk/profiles/default/schemas/student_returning.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/student_returning.xml	(revision 1151)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/student_returning.xml	(revision 1151)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<object name="student_returning" meta_type="CPS Schema">
+ <field name="email" meta_type="CPS String Field"/>
+ <field name="jamb_reg_no" meta_type="CPS String Field"/>
+ <field name="matric_no" meta_type="CPS String Field"/>
+ <field name="password" meta_type="CPS Password Field"/>
+ <field name="repeat_password" meta_type="CPS Password Field"/>
+</object>
Index: /WAeUP_SRP/trunk/profiles/default/students_catalog.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1150)
+++ /WAeUP_SRP/trunk/profiles/default/students_catalog.xml	(revision 1151)
@@ -2,4 +2,5 @@
 <object name="portal_catalog" meta_type="WAeUP Table">
  <column value="id"/>
+ <column value="matric_no"/>
  <column value="jamb_reg_no"/>
  <column value="name"/>
@@ -17,4 +18,7 @@
   <indexed_attr value="jamb_reg_no"/>
  </index>
+ <index name="matric_no" meta_type="FieldIndex">
+  <indexed_attr value="matric_no"/>
+ </index>
  <index name="faculty" meta_type="KeywordIndex">
   <indexed_attr value="faculty"/>
Index: /WAeUP_SRP/trunk/profiles/default/toolset.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/toolset.xml	(revision 1150)
+++ /WAeUP_SRP/trunk/profiles/default/toolset.xml	(revision 1151)
@@ -11,6 +11,6 @@
  <required tool_id="portal_pumeresults"
            class="Products.WAeUP_SRP.WAeUPTables.PumeResultsTable"/>
- <required tool_id="registered_import"
-           class="Products.WAeUP_SRP.WAeUPTables.RegisteredImport"/>
+ <required tool_id="returning_import"
+           class="Products.WAeUP_SRP.WAeUPTables.ReturningImport"/>
  <required tool_id="results_import"
            class="Products.WAeUP_SRP.WAeUPTables.ResultsImport"/>
Index: /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1150)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1151)
@@ -37,5 +37,10 @@
         students = context.portal_url.getPortalObject().campus.students
         student = getattr(students,str(member))
-        student_app = getattr(student,'application')
+        if request.has_key('email'):
+            context.waeup_tool.makeStudentData(str(member),email=request.get("email"))
+        student_app = getattr(student,'application',None)
+        if student_app is None:
+            context.waeup_tool.makeStudentData(str(member))
+        student_app = getattr(student,'application',None)
         student_pume = getattr(student,'pume',None)
         s_review_state = wftool.getInfoFor(student,'review_state',None)
Index: /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1150)
+++ /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1151)
@@ -71,4 +71,6 @@
                                               sex = ds.get('sex'),
                                              )
+    elif context.portal_type == "Course":
+        context.courses_catalog.modifyRecord(**ds)
     if cpsdocument_edit_and_view_button is not None:
         action = ''
Index: /WAeUP_SRP/trunk/skins/waeup_student/createStudentFT.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/createStudentFT.py	(revision 1151)
+++ /WAeUP_SRP/trunk/skins/waeup_student/createStudentFT.py	(revision 1151)
@@ -0,0 +1,47 @@
+## Script (Python) "deleteAllCourses"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=matric_no=None
+##title=
+##
+# $Id$
+''' create the Studenbase folder'''
+
+
+pm = context.portal_membership
+member = pm.getAuthenticatedMember()
+wftool = context.portal_workflow
+students_folder = context.portal_url.getPortalObject().campus.students
+import logging
+logger = logging.getLogger('createStudentFT')
+
+if str(member) not in ("henrik","joachim"):
+    return "not possible"
+if not matric_no:
+    return "No matric_no"
+
+if context.students_catalog(matric_no=matric_no):
+    return "Student with %s already exists" % matric_no
+res = context.returning_import(matric_no = matric_no)
+if len(res) != 1:
+    return "Matricel No %s not found in Returning Table" % matric_no
+student_brain = res[0]
+sid = context.waeup_tool.generateStudentId(student_brain.Lastname[0])
+students_folder.invokeFactory('Student', sid)
+logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no))
+student = getattr(students_folder,sid)
+wftool.doActionFor(student,'clear_and_validate')
+student.manage_setLocalRoles(sid, ['Owner',])
+context.students_catalog.addRecord(id = sid,
+                                   matric_no = matric_no,
+                                   jamb_reg_no = student_brain.Entryregno,
+                                   sex = student_brain.Sex == "F",
+                                   name = "%s %s %s" % (student_brain.Firstname,
+                                                        student_brain.Middlename,
+                                                        student_brain.Lastname)
+                                )
+return "Student MatricelNo %s and %s created" % (matric_no,sid)
+    
Index: /WAeUP_SRP/trunk/skins/waeup_student/display_session_results.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/display_session_results.py	(revision 1150)
+++ /WAeUP_SRP/trunk/skins/waeup_student/display_session_results.py	(revision 1151)
@@ -15,5 +15,5 @@
 
 res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
-                      schema_id= 'student_clearance',
+                      schema_id= 'student_returning',
                       context=context,
                       mapping=validate and REQUEST,
@@ -40,4 +40,6 @@
                                  )
 elif psm == 'valid':
+##    context.waeup_tool.makeStudent(ds.get('student'),
+##                                   results=ds.get('results'))
     return context.session_results_anon_view(student=ds.get('student'),
                                            results=ds.get('results'))
Index: /WAeUP_SRP/trunk/skins/waeup_student/display_session_results_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/display_session_results_form.pt	(revision 1150)
+++ /WAeUP_SRP/trunk/skins/waeup_student/display_session_results_form.pt	(revision 1151)
@@ -1,15 +1,15 @@
 <tal:block define="rendered_main options/rendered;
-                   portal_status_message options/psm;
-                   data_storage options/ds;
-                   edition python:1;"
+           portal_status_message options/psm;
+           data_storage options/ds;
+           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 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>
       <metal:block fill-slot="main">
         <h3>Display Your 2005/2006 Session Results! </h3>
Index: /WAeUP_SRP/trunk/skins/waeup_student/layout_search_session_edit.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/layout_search_session_edit.pt	(revision 1151)
+++ /WAeUP_SRP/trunk/skins/waeup_student/layout_search_session_edit.pt	(revision 1151)
@@ -0,0 +1,84 @@
+<tal:block define="global creation python:0;
+                   global formaction string:set_access_data" />
+<!-- a layout_lib macro -->
+<!-- $Id$ -->
+
+<metal:block define-macro="default_edit"
+  tal:define="layout options/layout;
+  ds options/datastructure;
+  dm ds/getDataModel;
+  formaction options/formaction;
+  matric_no options/matric_no|nothing;
+  creation creation|nothing;
+  cpsmcat nocall:here/translation_service;
+  ">
+  <form action="" id="editForm" method="post" 
+        enctype="multipart/form-data" class="workflow"
+        tal:attributes="action formaction"
+        >
+<input type="hidden" name="matric_no" tal:attributes="value matric_no"/>
+  <table class="layoutDefault" summary="Form layout"
+         tal:condition="layout/rows">
+    <span tal:repeat="row python: layout['rows']" valign="top" >
+      <span tal:repeat="cell row">
+        <tr tal:define="widget cell/widget;
+              wid widget/getWidgetId;
+              err python:ds.getError(wid);
+              err_mapping python:ds.getErrorMapping(wid);
+              is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
+              tooltip_id python:wid + '_help';
+              widget_css_class cell/widget_css_class|nothing;
+              css_class python:test(err, 'row error','row')"
+              tal:condition="python: wid != 'passport'"
+              >
+          <div tal:attributes="class widget_css_class;
+          id python:widget.getHtmlWidgetId()+'_widget';"
+          >
+            <td>
+            <div class="label" tal:condition="widget/label_edit"
+                 tal:attributes="class python:test(is_required, 'label required','label')">
+              <label tal:content="widget/label_edit"
+                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
+            </div>
+            <button type="button" class="tooltipControl"
+                    tal:condition="widget/help"
+                    tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
+            </td>
+            <td>
+            <span class="field">
+              <div tal:replace="structure cell/widget_rendered"/>
+            </span>
+            <div class="tooltipArea" style="visibility: hidden;"
+                 tal:condition="widget/help"
+                 tal:attributes="id tooltip_id;
+                 onclick python:'showElement(false, \'%s\')' % tooltip_id;"
+                 >
+              <tal:block tal:content="widget/help">This is the help for this field
+              </tal:block>
+            </div>
+            <tal:block condition="err">
+              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
+                <br /><em style="color: red"
+                          tal:content="msg">err</em>
+              </tal:block>
+            </tal:block>
+            </td>
+          </div>
+        </tr>
+      </span>
+    </span>
+  </table>
+  <br />
+  <input type="submit" class="standalone" name="cpsdocument_edit_button"
+         value="Save" 
+         id="cpsdocument_edit_button"
+         tal:condition="not:creation" />
+  <input type="submit" 
+         class="standalone" 
+         name="cpsdocument_create_button"
+         value="apply"
+         tal:attributes="value options/button"
+         tal:condition="creation" />
+
+</form>
+</metal:block>
Index: /WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt	(revision 1150)
+++ /WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt	(revision 1151)
@@ -52,4 +52,5 @@
         </span>
       </table>
+      <a href="" tal:attributes="href string:${context/absolute_url}/set_access_data?matric_no=${student/matric_no}">Continue to Email-entry</a>
     </metal:main>
   </metal:body>
Index: /WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py	(revision 1151)
+++ /WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py	(revision 1151)
@@ -0,0 +1,68 @@
+##parameters=REQUEST,matric_no
+# $Id$
+"""
+process the Application Form
+return html renderer + psm
+"""
+import DateTime
+current = DateTime.DateTime()
+pr = context.portal_registration
+
+validate = REQUEST.has_key("cpsdocument_edit_button")
+
+lt = context.portal_layouts
+#pr = context.portal_registration
+default = {'matric_no':matric_no}
+res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
+                      schema_id= 'student_returning',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob=default,
+                      layout_mode='edit',
+                      formaction = "set_access_data",
+                      button = "Search",
+                      matric_no = matric_no,
+                      commit = False,
+                      )
+if psm == 'invalid':
+    return context.set_access_data_form(rendered = res,
+                                 psm = "Please correct your input!",
+                                 #psm = "%s, %s" % (psm,ds),
+                                 firstlayout = True,
+                                 lastlayout = True,
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.set_access_data_form(rendered = res,
+                                 psm = None,
+                                 firstlayout = True,
+                                 lastlayout = True,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+    #jamb_reg_no = ds.get('jamb_reg_no')
+    #r = context.returning_import(matric_no = matric_no)
+    #if 0 and r and r[0].Entryregno != jamb_reg_no or not r:
+    #    psm = "Your Jamb Registration Nr is wrong"
+    #    return context.set_access_data_form(rendered = res,
+    #                             psm = psm,
+    #                             firstlayout = True,
+    #                             lastlayout = True,
+    #                             ds = ds,
+    #                             )
+from Products.zdb import set_trace;set_trace()
+password = REQUEST.get('widget__password')
+email = ds.get('email')
+st_res = context.students_catalog(matric_no = matric_no)
+if st_res:
+    sid = st_res[0].id
+context.waeup_tool.makeStudentMember(sid,password=password)
+args = {}
+args['__ac_name'] = sid
+args['__ac_password'] = password
+args['returning'] = '1'
+args['email'] = email
+from urllib import urlencode
+url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
+return REQUEST.RESPONSE.redirect(url)
Index: /WAeUP_SRP/trunk/skins/waeup_student/set_access_data_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/set_access_data_form.pt	(revision 1151)
+++ /WAeUP_SRP/trunk/skins/waeup_student/set_access_data_form.pt	(revision 1151)
@@ -0,0 +1,23 @@
+<tal:block define="rendered_main options/rendered;
+           portal_status_message options/psm;
+           data_storage options/ds;
+           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>Enter Your Email and choose a Password</h3>
+        <br />
+        <div tal:replace="structure rendered_main" />
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
