Index: WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- WAeUP_SRP/trunk/WAeUPTool.py	(revision 1414)
+++ WAeUP_SRP/trunk/WAeUPTool.py	(revision 1415)
@@ -72,4 +72,15 @@
             sid = "%c%d" % (letter,r.randint(99999,1000000))
         return sid
+
+    def generatePassword(self,s=None): ###(
+        import random
+        r = random
+        ##if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'):
+        if s is None:
+            s = 'abcdefghklmnpqrstuvwxy23456789'
+        pw = ''
+        while len(pw) < 6:
+            pw += r.choice(s)
+        return pw
     ###)
 
@@ -133,4 +144,81 @@
             transaction.commit()
         return sid,jamb_reg_no
+    ###)
+
+    security.declareProtected(ModifyPortalContent,'createStudent') ###(
+    def createStudent(self,dict):
+        students_folder = self.portal_url.getPortalObject().campus.students
+        sid = self.waeup_tool.generateStudentId('?')
+        students_folder.invokeFactory('Student', sid)
+        student_obj = getattr(students_folder,sid)
+        password = self.generatePassword()
+        self.makeStudentMember(sid,password)
+        status,entry_mode = dict.get('entry_mode').split('_')
+        wfaction = 'return'
+        if status == "NEW":
+            wfaction = 'admit'
+        matric_no = dict.get('matric_no')
+        email = dict.get('email')
+        level = dict.get('level')
+        study_course = dict.get('study_course')
+        self.portal_workflow.doActionFor(student_obj,wfaction)
+        student_obj.manage_setLocalRoles(sid, ['Owner',])
+        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['entry_mode'] = entry_mode
+        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
+        da['app_email'] = dp['email'] = email
+        dp['firstname'] = dict.get('firstname')
+        dp['middlename'] = dict.get('middlename')
+        dp['lastname'] = dict.get('lastname')
+        da['jamb_lastname'] = "%(firstname)s %(middlename)s %(lastname)s" % dict
+        sex = dict.get('sex')
+        if sex:
+            da['jamb_sex'] = 'F'
+        else:
+            da['jamb_sex'] = 'M'
+        dp['sex'] = sex
+        application.getContent().edit(mapping=da)
+        self.portal_workflow.doActionFor(application,'close',dest_container=application)
+        personal.getContent().edit(mapping=dp)
+        clearance.getContent().edit(mapping=dc)
+        self.portal_workflow.doActionFor(clearance,'close',dest_container=clearance)
+        catd = {}
+        catd['id'] = sid
+        catd['entry_mode']= entry_mode
+        catd['email'] = email
+        catd['matric_no'] = matric_no
+        catd['name'] = "%(firstname)s %(middlename)s %(lastname)s" % dp
+        catd['sex'] = dp['sex']
+        catd['level'] = level
+        certificate_brain = self.getCertificateBrain(study_course)
+        if certificate_brain:
+            cpath = certificate_brain.getPath().split('/')
+            catd['faculty'] = cpath[-4]
+            catd['department'] = cpath[-3]
+            catd['course'] = study_course
+        self.students_catalog.addRecord(**catd)
+        #
+        # Study Course
+        #
+        student_obj.invokeFactory('StudentStudyCourse','study_course')
+        sc = student_obj.study_course
+        self.portal_workflow.doActionFor(sc,'open',dest_container=sc)
+        dsc = {}
+        dsc['study_course'] = study_course
+        dsc['current_level'] = level
+        sc.getContent().edit(mapping=dsc)
+
+        return sid,password
     ###)
 
@@ -206,26 +294,4 @@
             em = 'Certificate %s org-code %s not found\n' % (certcode, certcode_org)
             logger.info(em)
-##        validlevel = False
-##        try:
-##            il = int(level) + 100
-##            level = "%s" % il
-##            validlevel = True
-##        except:
-##            em = '"%(matric_no)s","invalid Level","%(Level)s"' % student
-##            logger.info(em)
-##        if not validlevel:
-##            erg = self.results_import(matric_no = student.matric_no)
-##            level = 'xxx'
-##            if erg:
-##                level = erg[0].Level
-##            try:
-##                il = int(level) + 100
-##                level = "%s" % il
-##                em = '"%s","fixed Level from results_import","%s"' % (student.matric_no,erg[0].Level)
-##                logger.info(em)
-##                validlevel = True
-##            except:
-##                em = '"%s","invalid Level in results_import","%s"' % (student.matric_no,erg[0].Level)
-##                logger.info(em)
         matric_no = student.matric_no
         sid = student_id
Index: WAeUP_SRP/trunk/doc/srp_documentation.mm
===================================================================
--- WAeUP_SRP/trunk/doc/srp_documentation.mm	(revision 1414)
+++ WAeUP_SRP/trunk/doc/srp_documentation.mm	(revision 1415)
@@ -2,8 +2,7 @@
 <!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
 <node CREATED="1170079518946" ID="Freemind_Link_650524897" MODIFIED="1170079543007" TEXT="WAeUP Documentation">
-<node CREATED="1170079578051" ID="_" MODIFIED="1170079619012" POSITION="right" TEXT="Student Registration Portal">
-<node CREATED="1170079621592" ID="Freemind_Link_1297017754" MODIFIED="1170079640872" TEXT="Campus">
-<node CREATED="1170079643589" ID="Freemind_Link_1231068129" MODIFIED="1170080364243" TEXT="Academics">
-<node CREATED="1170080366716" ID="Freemind_Link_415048819" MODIFIED="1170082092260" TEXT="n * Faculty">
+<node CREATED="1170079621592" ID="Freemind_Link_1297017754" MODIFIED="1170079640872" POSITION="right" TEXT="Campus">
+<node CREATED="1170079643589" FOLDED="true" ID="Freemind_Link_1231068129" MODIFIED="1170080364243" TEXT="Academics">
+<node CREATED="1170080366716" FOLDED="true" ID="Freemind_Link_415048819" MODIFIED="1170082092260" TEXT="n * Faculty">
 <node CREATED="1171114205479" ID="Freemind_Link_777914383" LINK="../profiles/default/types/Faculty.xml" MODIFIED="1171114273018" TEXT="Type: Faculty"/>
 <node CREATED="1171124926993" ID="Freemind_Link_1995598127" LINK="../profiles/default/schemas/faculty.xml" MODIFIED="1171124974083" TEXT="Schema: faculty"/>
@@ -35,5 +34,5 @@
 </node>
 <node CREATED="1170082138244" FOLDED="true" ID="Freemind_Link_1354366927" MODIFIED="1170082146391" TEXT="Students">
-<node CREATED="1170082147831" ID="Freemind_Link_115332414" MODIFIED="1170082160733" TEXT="n * Student">
+<node CREATED="1170082147831" FOLDED="true" ID="Freemind_Link_115332414" MODIFIED="1170082160733" TEXT="n * Student">
 <node CREATED="1171114205479" ID="Freemind_Link_1051911128" LINK="../profiles/default/types/Student.xml" MODIFIED="1171353141707" TEXT="Type: Student"/>
 <node CREATED="1171124926993" ID="Freemind_Link_1838352082" LINK="../profiles/default/schemas/student.xml" MODIFIED="1171353152905" TEXT="Schema: student"/>
@@ -73,8 +72,18 @@
 </node>
 <node CREATED="1171014603296" ID="Freemind_Link_592162547" MODIFIED="1171014611096" TEXT="Imports"/>
+<node CREATED="1171379675232" FOLDED="true" ID="Freemind_Link_41196870" MODIFIED="1171379685192" TEXT="Userinterface">
+<node CREATED="1171379691280" FOLDED="true" ID="Freemind_Link_24219" MODIFIED="1171379703554" TEXT="Officers">
+<node CREATED="1171379710053" FOLDED="true" ID="Freemind_Link_1668598079" MODIFIED="1171379734695" TEXT="add_student">
+<node CREATED="1171379737777" ID="Freemind_Link_490783588" MODIFIED="1171379757546" TEXT="Script: add_student"/>
+<node CREATED="1171362924343" ID="Freemind_Link_1507034557" LINK="../skins/waeup_accommodation/student_create_form.pt" MODIFIED="1171382378983" TEXT="PT: student_create_form"/>
+<node CREATED="1171379759850" ID="Freemind_Link_435667013" LINK="../profiles/default/schemas/student_create.xml" MODIFIED="1171380077013" TEXT="Schema: student_create"/>
+<node CREATED="1171015856280" ID="Freemind_Link_976681849" LINK="../profiles/default/layouts/student_create.xml" MODIFIED="1171382310446" TEXT="Layout: student_create"/>
 </node>
-<node CREATED="1170082502675" ID="Freemind_Link_1051871348" MODIFIED="1170082511430" TEXT="Accommodation">
+</node>
+</node>
+</node>
+<node CREATED="1170082502675" FOLDED="true" ID="Freemind_Link_1051871348" MODIFIED="1170082511430" TEXT="Accommodation">
 <node CREATED="1171114205479" ID="Freemind_Link_685193459" LINK="../profiles/default/types/AccoFolder.xml" MODIFIED="1171360542032" TEXT="Type: AccoFolder"/>
-<node CREATED="1170082513362" ID="Freemind_Link_579142716" MODIFIED="1170082530016" TEXT="n * Hall">
+<node CREATED="1170082513362" FOLDED="true" ID="Freemind_Link_579142716" MODIFIED="1170082530016" TEXT="n * Hall">
 <node CREATED="1171114205479" ID="Freemind_Link_913388948" LINK="../profiles/default/types/AccoHall.xml" MODIFIED="1171360892599" TEXT="Type: AccoHall"/>
 <node CREATED="1171124926993" ID="Freemind_Link_108322260" LINK="../profiles/default/schemas/acco_hall.xml" MODIFIED="1171361085015" TEXT="Schema: acco_hall"/>
@@ -89,9 +98,20 @@
 </node>
 </node>
+<node CREATED="1171381167605" FOLDED="true" ID="Freemind_Link_370176221" MODIFIED="1171381186185" TEXT="User Interface">
+<node CREATED="1171381191363" ID="Freemind_Link_1384539281" MODIFIED="1171381247729" TEXT="Student">
+<node CREATED="1171362489012" FOLDED="true" ID="Freemind_Link_875925244" MODIFIED="1171376833636" TEXT="reserve_accommodation">
+<node CREATED="1171362515581" ID="Freemind_Link_1380319587" LINK="../skins/waeup_accommodation/reserve_accommodation.py" MODIFIED="1171376963675" TEXT="Script: reserve_accommodation"/>
+<node CREATED="1171362924343" ID="Freemind_Link_1031270994" LINK="../skins/waeup_accommodation/accommodation_pin_edit_form.pt" MODIFIED="1171377530623" TEXT="PT: accommodation_pin_edit_form"/>
+<node CREATED="1171124926993" ID="Freemind_Link_59643823" LINK="../profiles/default/schemas/student_accommodation.xml" MODIFIED="1171377094450" TEXT="Schema: student_accommodation"/>
+<node CREATED="1171124982312" ID="Freemind_Link_1633331359" LINK="../profiles/default/layouts/student_accommodation_fe.xml" MODIFIED="1171377120846" TEXT="Layout: student_accommodation_fe"/>
 </node>
-<node CREATED="1170082542534" ID="Freemind_Link_243354429" MODIFIED="1170082550976" TEXT="Pins">
+</node>
+<node CREATED="1171381259796" ID="Freemind_Link_43065296" MODIFIED="1171381265497" TEXT="Officer"/>
+</node>
+</node>
+<node CREATED="1170082542534" FOLDED="true" ID="Freemind_Link_243354429" MODIFIED="1170082550976" TEXT="Pins">
 <node CREATED="1170082553111" ID="Freemind_Link_1225342224" MODIFIED="1170082566118" TEXT="n * Batch"/>
 </node>
-<node CREATED="1170931308473" ID="Freemind_Link_249696543" MODIFIED="1170931315740" TEXT="Catalogs">
+<node CREATED="1170931308473" FOLDED="true" ID="Freemind_Link_249696543" MODIFIED="1170931315740" TEXT="Catalogs">
 <node CREATED="1170931319920" ID="Freemind_Link_1633117071" MODIFIED="1170931337246" TEXT="portal_catalog"/>
 <node CREATED="1170931338501" ID="Freemind_Link_80471593" LINK="../profiles/default/students_catalog.xml" MODIFIED="1170959145493" TEXT="students_catalog"/>
@@ -99,4 +119,3 @@
 </node>
 </node>
-</node>
 </map>
Index: WAeUP_SRP/trunk/profiles/default/layouts.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 1414)
+++ WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 1415)
@@ -16,5 +16,4 @@
  <object name="scratch_card_batch" meta_type="CPS Layout"/>
  <object name="scratch_card_search" meta_type="CPS Layout"/>
- <object name="student_study_course" meta_type="CPS Layout"/>
  <object name="student_accommodation" meta_type="CPS Layout"/>
  <object name="student_accommodation_fe" meta_type="CPS Layout"/>
@@ -26,4 +25,5 @@
  <object name="student_clearance_fe" meta_type="CPS Layout"/>
  <object name="student_course_result" meta_type="CPS Layout"/>
+ <object name="student_create" meta_type="CPS Layout"/>
  <object name="student_personal" meta_type="CPS Layout"/>
  <object name="student_personal_fe" meta_type="CPS Layout"/>
@@ -34,4 +34,5 @@
  <object name="student_search" meta_type="CPS Layout"/>
  <object name="student_study_level" meta_type="CPS Layout"/>
+ <object name="student_study_course" meta_type="CPS Layout"/>
  <object name="student_transfer" meta_type="CPS Layout"/>
  <object name="study_level" meta_type="CPS Layout"/>
Index: WAeUP_SRP/trunk/profiles/default/layouts/certificate.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/certificate.xml	(revision 1414)
+++ WAeUP_SRP/trunk/profiles/default/layouts/certificate.xml	(revision 1415)
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="types.xsl"?>
+<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
 <object name="certificate" meta_type="CPS Layout">
  <property name="layout_create_method"></property>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_application.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_application.xml	(revision 1414)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_application.xml	(revision 1415)
@@ -1,3 +1,4 @@
 <?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
 <object name="student_application" meta_type="CPS Layout">
  <property name="layout_create_method"></property>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_create.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_create.xml	(revision 1415)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_create.xml	(revision 1415)
@@ -0,0 +1,147 @@
+<?xml version="1.0"?>
+<object name="student_create" meta_type="CPS Layout">
+ <property name="layout_create_method"></property>
+ <property name="layout_edit_method"></property>
+ <property name="layout_view_method"></property>
+ <property name="style_prefix">layout_waeup_</property>
+ <property name="flexible_widgets"/>
+ <property name="validate_values_expr"></property>
+ <widget name="email" meta_type="Email Widget">
+  <property name="title">Email</property>
+  <property name="fields">
+   <element value="email"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Email</property>
+  <property name="label_edit">Email</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="firstname" meta_type="String Widget">
+  <property name="title">Firstname</property>
+  <property name="fields">
+   <element value="firstname"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Firstname</property>
+  <property name="label_edit">Firstname</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="lastname" meta_type="String Widget">
+  <property name="title">Lastname</property>
+  <property name="fields">
+   <element value="lastname"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Lastname</property>
+  <property name="label_edit">Lastname</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="entry_mode" meta_type="Select Widget">
+  <property name="title">Entry Mode</property>
+  <property name="fields">
+   <element value="entry_mode"/>
+  </property>
+  <property name="label">Entry Mode</property>
+  <property name="label_edit">Entry Mode</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="vocabulary">entry_modes</property>
+ </widget>
+ <widget name="level" meta_type="Select Widget">
+  <property name="title">Level</property>
+  <property name="fields">
+   <element value="level"/>
+  </property>
+  <property name="label">Level</property>
+  <property name="label_edit">Level</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="vocabulary">courselevel</property>
+ </widget>
+ <widget name="matric_no" meta_type="String Widget">
+  <property name="title">Matric No</property>
+  <property name="fields">
+   <element value="matric_no"/>
+  </property>
+  <property name="label">Matric No</property>
+  <property name="label_edit">Matric No</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="display_width">10</property>
+ </widget>
+ <widget name="middlename" meta_type="String Widget">
+  <property name="title">Middlename</property>
+  <property name="fields">
+   <element value="middlename"/>
+  </property>
+  <property name="label">Middlename</property>
+  <property name="label_edit">Middlename</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="sex" meta_type="Boolean Widget">
+  <property name="title">Sex</property>
+  <property name="fields">
+   <element value="sex"/>
+  </property>
+  <property name="label">Sex</property>
+  <property name="label_edit">Sex</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="label_false">male</property>
+  <property name="label_true">female</property>
+  <property name="render_format">select</property>
+ </widget>
+ <widget name="study_course" meta_type="StudyCourse Widget">
+  <property name="title">Study Course</property>
+  <property name="fields">
+   <element value="study_course"/>
+  </property>
+  <property name="label">Study Course</property>
+  <property name="label_edit">Study Course</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="display_width">10</property>
+ </widget>
+ <table>
+  <row>
+   <cell name="firstname"/>
+  </row>
+  <row>
+   <cell name="middlename"/>
+  </row>
+  <row>
+   <cell name="lastname"/>
+  </row>
+  <row>
+   <cell name="email"/>
+  </row>
+  <row>
+   <cell name="sex"/>
+  </row>
+  <row>
+   <cell name="entry_mode"/>
+  </row>
+  <row>
+   <cell name="matric_no"/>
+  </row>
+  <row>
+   <cell name="study_course"/>
+  </row>
+  <row>
+   <cell name="level"/>
+  </row>
+ </table>
+</object>
Index: WAeUP_SRP/trunk/profiles/default/schemas.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1414)
+++ WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1415)
@@ -15,8 +15,9 @@
  <object name="student" meta_type="CPS Schema"/>
  <object name="scratch_card_batch" meta_type="CPS Schema"/>
- <object name="student_course_result" meta_type="CPS Schema"/>
  <object name="student_accommodation" meta_type="CPS Schema"/>
  <object name="student_application" meta_type="CPS Schema"/>
  <object name="student_clearance" meta_type="CPS Schema"/>
+ <object name="student_course_result" meta_type="CPS Schema"/>
+ <object name="student_create" meta_type="CPS Schema"/>
  <object name="student_personal" meta_type="CPS Schema"/>
  <object name="student_pume" meta_type="CPS Schema"/> 
Index: WAeUP_SRP/trunk/profiles/default/schemas/student_create.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/student_create.xml	(revision 1415)
+++ WAeUP_SRP/trunk/profiles/default/schemas/student_create.xml	(revision 1415)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="schema.xsl"?>
+<object name="student_create" meta_type="CPS Schema">
+ <field name="email" meta_type="CPS String Field"/>
+ <field name="entry_mode" meta_type="CPS String Field"/>
+ <field name="firstname" meta_type="CPS String Field"/>
+ <field name="lastname" meta_type="CPS String Field"/>
+ <field name="level" meta_type="CPS String Field"/>
+ <field name="matric_no" meta_type="CPS String Field"/>
+ <field name="middlename" meta_type="CPS String Field"/>
+ <field name="sex" meta_type="CPS Boolean Field"/>
+ <field name="study_course" meta_type="CPS String Field"/>
+</object>
Index: WAeUP_SRP/trunk/profiles/default/vocabularies.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/vocabularies.xml	(revision 1414)
+++ WAeUP_SRP/trunk/profiles/default/vocabularies.xml	(revision 1415)
@@ -5,4 +5,5 @@
  <object name="acco_hall_reserved_rooms" meta_type="CPS Method Vocabulary"/>
  <object name="courselevel" meta_type="CPS Vocabulary"/>
+ <object name="entry_modes" meta_type="CPS Vocabulary"/>
  <object name="exam_subjects" meta_type="CPS Vocabulary"/>
  <object name="exam_types" meta_type="CPS Vocabulary"/>
Index: WAeUP_SRP/trunk/profiles/default/vocabularies/entry_modes.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/vocabularies/entry_modes.xml	(revision 1415)
+++ WAeUP_SRP/trunk/profiles/default/vocabularies/entry_modes.xml	(revision 1415)
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<object name="entry_modes" meta_type="CPS Vocabulary">
+ <property name="title"></property>
+ <property name="title_msgid"></property>
+ <property name="description"></property>
+ <property name="acl_write_roles">Manager</property>
+ <item key="NEW_UME" msgid="">New UME</item>
+ <item key="NEW_DE" msgid="">New Direct Entry</item>
+ <item key="RET_UME" msgid="">Returning UME</item>
+ <item key="RET_DE" msgid="">Returning Direct Entry</item>
+</object>
Index: WAeUP_SRP/trunk/profiles/default/workflows/definition.xsl
===================================================================
--- WAeUP_SRP/trunk/profiles/default/workflows/definition.xsl	(revision 1415)
+++ WAeUP_SRP/trunk/profiles/default/workflows/definition.xsl	(revision 1415)
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="html"/>
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>
+          <xsl:for-each select="object">
+            <xsl:value-of select="@name"/>
+          </xsl:for-each>
+        </title>
+        <link rel="stylesheet" type="text/css" media="all"
+              href="../../xsl.css" />      
+      </head>
+      <body>
+        <table>
+          <xsl:for-each select="cps-workflow">
+            <tr>
+              <th>Title</th>
+              <td>
+                <xsl:value-of select="@title"/>
+              </td>
+            </tr>
+            <tr>
+              <th>Workflow Id</th>
+              <td>
+                <xsl:value-of select="@workflow_id"/>
+              </td>
+            </tr>
+            <tr>
+              <th>State Variable</th>
+              <td>
+                <xsl:value-of select="@state_variable"/>
+              </td>
+            </tr>
+            <tr>
+              <th>Meta Type</th>
+              <td>
+                <xsl:value-of select="@meta_type"/>
+              </td>
+            </tr>
+          </xsl:for-each>
+        </table>            
+        <h2>Managed Permissions</h2>
+        <table>
+          <xsl:for-each select="cps-workflow/permission">
+            <xsl:variable name="color">
+              <xsl:choose>
+                <xsl:when test="position() mod 2 = 0">
+                  <xsl:text>#ffffff</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:text>#eeeeee</xsl:text>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+            <tr style="background-color:{$color}">
+              <td colspan="">
+                <xsl:value-of select="text()"/>
+              </td>
+            </tr>
+          </xsl:for-each>
+        </table>
+        <h2>States</h2>
+          <xsl:for-each select="cps-workflow/state">
+            <xsl:variable name="color">
+              <xsl:choose>
+                <xsl:when test="position() mod 2 = 0">
+                  <xsl:text>#ffffff</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:text>#eeeeee</xsl:text>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+          <h3><xsl:value-of select="@state_id"/>  <xsl:value-of select="@title"/></h3>
+          <table>
+            <tr style="background-color:{$color}">
+              <th>
+                Exit Transitions
+              </th>
+              <td colspan="2">
+                <xsl:for-each select="exit-transition">
+                  <xsl:value-of select="@transition_id"/><br />
+                </xsl:for-each>
+              </td>
+            </tr>
+            <tr style="background-color:{$color}">
+              <th>
+                Permission Map
+              </th>
+              <th>
+                Acquired
+              </th>
+              <th>
+                Permission Roles
+              </th>
+            </tr>
+            <xsl:for-each select="permission-map">
+              <tr style="background-color:{$color}">
+                <td>
+                  <xsl:value-of select="@name"/>
+                </td>
+                <td>
+                  <xsl:value-of select="@acquired"/>
+                </td>
+                <td>
+                  <xsl:for-each select="permission-role">
+                    <xsl:value-of select="text()"/><br />
+                  </xsl:for-each>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
+        </xsl:for-each>
+        <h2>Transitions</h2>
+          <xsl:for-each select="cps-workflow/transition">
+            <xsl:variable name="color">
+              <xsl:choose>
+                <xsl:when test="position() mod 2 = 0">
+                  <xsl:text>#ffffff</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                  <xsl:text>#eeeeee</xsl:text>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+          <h3>Id: <xsl:value-of select="@transition_id"/> Title: <xsl:value-of select="@title"/></h3> 
+          <h3>New State: <xsl:value-of select="@new_state"/> Trigger: <xsl:value-of select="@trigger"/> </h3>
+          <table>
+            <xsl:for-each select="action">
+              <tr style="background-color:{$color}">
+                <td colspan="2">
+                  <strong>Action URL:</strong> <xsl:value-of select="@url"/>
+                </td>
+                <td colspan="1">
+                  <strong>Category:</strong> <xsl:value-of select="@category"/>
+                </td>
+                <td colspan="1">
+                  <strong>Box:</strong> <xsl:value-of select="text()"/>
+                </td>
+              </tr>
+            </xsl:for-each>
+            <tr style="background-color:{$color}">
+              <td colspan="2">
+                <strong>B Script:</strong> <xsl:value-of select="@before_script"/>
+              </td>
+              <td colspan="2">
+                <strong>A Script:</strong> <xsl:value-of select="@after_script"/>
+              </td>
+            </tr>
+            <tr style="background-color:{$color}">
+              <th colspan="2">
+                Transition Flags
+              </th>
+              <td colspan="2">
+                <xsl:for-each select="transition-behavior">
+                  <xsl:value-of select="@behavior_id"/><br />
+                </xsl:for-each>
+              </td>
+            </tr>
+            <tr style="background-color:{$color}">
+              <th>
+               Guard: Roles
+              </th>
+              <th>
+                Groups
+              </th>
+              <th>
+                Permissions
+              </th>
+              <th>
+                Expression
+              </th>
+            </tr>
+            <tr style="background-color:{$color}">
+              <td>
+                <xsl:for-each select="guard/guard-role">
+                  <xsl:value-of select="text()"/><br />
+                </xsl:for-each>
+              </td>
+              <td>
+                <xsl:for-each select="guard/guard-group">
+                  <xsl:value-of select="text()"/><br />
+                </xsl:for-each>
+              </td>
+              <td>
+                <xsl:for-each select="guard/guard-permission">
+                  <xsl:value-of select="text()"/><br />
+                </xsl:for-each>
+              </td>
+              <td>
+                <xsl:for-each select="guard/guard-expression">
+                  <xsl:value-of select="text()"/><br />
+                </xsl:for-each>
+              </td>
+            </tr>
+          </table>
+        </xsl:for-each>
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>
Index: WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_pin_edit_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_pin_edit_form.pt	(revision 1415)
+++ WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_pin_edit_form.pt	(revision 1415)
@@ -0,0 +1,48 @@
+<tal:block define="rendered_main options/rendered;
+                   portal_status_message options/psm;
+                   data_storage options/ds;
+                   mode options/mode;
+                   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">
+      
+        <div style="text-align: right" tal:condition="python: mode == 'edit'">
+        <a href="" target="slip" tal:attributes="href string:accommodation_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" />
+            Accommodation Slip
+        </a>
+        </div>      
+      
+        <h3 tal:condition="python: mode == 'create'">Book Your Accommodation! </h3>
+        <h3 tal:condition="python: mode == 'edit'">Pay Your Accommodation Maintenance Fee! </h3>
+        <br />
+        <div tal:replace="structure rendered_main" />
+          <p>Instructions :</p>
+          <ul tal:condition="python: mode == 'create'">
+            <li>Buy a Hostel Application Scratch Card.</li> 
+            <li>Enter the PIN above and press 'Book'.</li>
+            <li>Print your Hostel Allocation Slip.</li>
+          </ul>
+          <ul tal:condition="python: mode == 'edit'" 
+              tal:define="info python: context.getAccommodationInfo()">
+            <li>Buy a Hostel Maintainance Scratch Card 
+            (Code: <span tal:replace="python: info['acco_doc'].acco_maint_code" />) for 
+            <span tal:replace="python: info['acco_doc'].acco_maint_fee" /> Nairas</li> 
+            <li>Enter the PIN above and press 'Save'.</li>
+            <li>Print your Hostel Maintenance Receipt.</li>
+          </ul>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: WAeUP_SRP/trunk/skins/waeup_student/accommodation_pin_edit_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/accommodation_pin_edit_form.pt	(revision 1414)
+++ 	(revision )
@@ -1,48 +1,0 @@
-<tal:block define="rendered_main options/rendered;
-                   portal_status_message options/psm;
-                   data_storage options/ds;
-                   mode options/mode;
-                   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">
-      
-        <div style="text-align: right" tal:condition="python: mode == 'edit'">
-        <a href="" target="slip" tal:attributes="href string:accommodation_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" />
-            Accommodation Slip
-        </a>
-        </div>      
-      
-        <h3 tal:condition="python: mode == 'create'">Book Your Accommodation! </h3>
-        <h3 tal:condition="python: mode == 'edit'">Pay Your Accommodation Maintenance Fee! </h3>
-        <br />
-        <div tal:replace="structure rendered_main" />
-          <p>Instructions :</p>
-          <ul tal:condition="python: mode == 'create'">
-            <li>Buy a Hostel Application Scratch Card.</li> 
-            <li>Enter the PIN above and press 'Book'.</li>
-            <li>Print your Hostel Allocation Slip.</li>
-          </ul>
-          <ul tal:condition="python: mode == 'edit'" 
-              tal:define="info python: context.getAccommodationInfo()">
-            <li>Buy a Hostel Maintainance Scratch Card 
-            (Code: <span tal:replace="python: info['acco_doc'].acco_maint_code" />) for 
-            <span tal:replace="python: info['acco_doc'].acco_maint_fee" /> Nairas</li> 
-            <li>Enter the PIN above and press 'Save'.</li>
-            <li>Print your Hostel Maintenance Receipt.</li>
-          </ul>
-      </metal:block>
-      <metal:block fill-slot="sub">
-      </metal:block>
-    </metal:block>
-  </metal:block>
-</tal:block>
Index: WAeUP_SRP/trunk/skins/waeup_student/add_student.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/add_student.py	(revision 1415)
+++ WAeUP_SRP/trunk/skins/waeup_student/add_student.py	(revision 1415)
@@ -0,0 +1,72 @@
+##parameters=REQUEST
+# $Id$
+"""
+process the the accommodation reservation
+"""
+import DateTime
+current = DateTime.DateTime()
+pr = context.portal_registration
+wftool = context.portal_workflow
+lt = context.portal_layouts
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+acco_cat = context.portal_accommodation
+import logging
+logger = logging.getLogger('Student')
+
+validate = REQUEST.has_key("cpsdocument_edit_button") and\
+           REQUEST.get("cpsdocument_edit_button").startswith('add')
+d = {}
+mode = 'edit'
+rendered,psm,ds = lt.renderLayout(layout_id= 'student_create',
+                      schema_id= 'student_create',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob=d,
+                      layout_mode=mode,
+                      commit = False
+                      )
+if psm == 'invalid':
+    psm = "Please correct your input."
+    return context.add_student_form(rendered = rendered,
+                                 psm = psm,
+                                 #psm = "%s, %s" % (psm,ds),
+                                 mode = mode,
+                                 formaction = "add_student",
+                                 button = "add",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.add_student_form(rendered = rendered,
+                                 psm = psm,
+                                 mode = mode,
+                                 formaction = "add_student",
+                                 button = "add",
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+##firstname = ds.get('firstname')
+##middlename = ds.get('middlename')
+##lastname = ds.get('lastname')
+##email = ds.get('email')
+##matric_no = ds.get('matric_no')
+##study_course = ds.get('study_course')
+##level = ds.get('level')
+dict = {}
+dict.update(ds)
+sid,password = context.waeup_tool.createStudent(dict)
+dict['sid'] = sid
+dict['password'] = password
+student_rec = context.getFormattedStudentEntry(context.students_catalog(id = sid)[0])
+psm = "Student created with Id: %s and password: %s" % (sid,password)
+logger.info('"%s","created student","%s"' % (member,sid))
+return context.add_student_form(rendered = rendered,
+                                 #psm = "%s, %s" % (psm,ds),
+                                 mode = 'view',
+                                 psm = psm,
+                                 ds = dict,
+                                 student = student_rec,
+                                 )
+
+
Index: WAeUP_SRP/trunk/skins/waeup_student/add_student_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/add_student_form.pt	(revision 1415)
+++ WAeUP_SRP/trunk/skins/waeup_student/add_student_form.pt	(revision 1415)
@@ -0,0 +1,78 @@
+<tal:block define="rendered_main options/rendered;
+           portal_status_message options/psm;
+           info options/ds;
+           mode options/mode;
+           student options/student|nothing;
+           formaction options/formaction|nothing;
+           matric_no options/matric_no|nothing;
+           name options/name|nothing;
+           creation creation|nothing;"
+           >
+  <metal:block define-macro="edit_form">
+    <metal:block use-macro="here/content_lib_master/macros/master">
+      <metal:block fill-slot="header">
+      </metal:block>
+      <metal:block fill-slot="main">
+        <span tal:condition="python: mode == 'view'" tal:omit-tag="">
+          <table>
+            <tr>
+              <td>Student Id:</td>
+              <td tal:content="info/sid" />
+            </tr>                
+            <tr>
+              <td>Password:</td>
+              <td tal:content="info/password" />
+            </tr>                
+            <tr>
+              <td>Name</td>
+              <td tal:content="student/name" />
+            </tr>                
+            <tr>
+              <td>Sex:</td>
+              <td tal:content="student/sex" />
+            </tr>                
+            <tr>
+              <td>Email:</td>
+              <td tal:content="student/email" />
+            </tr>                
+            <tr>
+              <td>Entry Mode:</td>
+              <td tal:content="student/entry_mode" />
+            </tr>        
+            <tr>
+              <td>Matric No</td>
+              <td tal:content="student/matric_no" />
+            </tr>                
+            <tr>
+              <td>Study Course</td>
+              <td tal:content="student/course" />
+            </tr>                
+          </table>
+        </span>
+        <span tal:condition="python: mode != 'view'" tal:omit-tag="">
+          <form action="" id="editForm" method="post" 
+              enctype="multipart/form-data" class="workflow"
+              tal:attributes="action options/formaction"
+              >
+          <div tal:replace="structure rendered_main" />
+          <br />
+          <input type="submit" class="standalone" name="cpsdocument_edit_button"
+                 value="Save" 
+                 id="cpsdocument_edit_button"
+                 tal:attributes="value options/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>
+        </span>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: WAeUP_SRP/trunk/skins/waeup_student/getFormattedStudentEntry.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getFormattedStudentEntry.py	(revision 1414)
+++ WAeUP_SRP/trunk/skins/waeup_student/getFormattedStudentEntry.py	(revision 1415)
@@ -16,5 +16,5 @@
 d = {}
 for f in fields:
-    d[f] = getattr(brain,f,'--')
+    d[f] = getattr(brain,f,'')
     if f == "sex":
         if d[f]:
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudentReviewState.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudentReviewState.py	(revision 1414)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudentReviewState.py	(revision 1415)
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=student=None, with_items=None
+##parameters=
 ##title=
 ##
@@ -12,6 +12,13 @@
 return Info about the current Student
 """
+try:
+    from Products.AdvancedQuery import Eq, Between, Le,In
+    evalAQ = context.portal_catalog.evalAdvancedQuery
+except:
+    evalAdvancedQuery = None
 student_id = context.getStudentId()
-res = context.portal_catalog(id = student_id,portal_type='Student')
+#res = context.portal_catalog(id = student_id,portal_type='Student')
+query = Eq('id',student_id)
+res = evalAQ(query)
 if not res:# or len(res) > 1:
     return None
