Index: WAeUP_SRP/trunk/Students.py
===================================================================
--- WAeUP_SRP/trunk/Students.py	(revision 726)
+++ WAeUP_SRP/trunk/Students.py	(revision 727)
@@ -84,5 +84,7 @@
         certs = {}
         for c in l:
-            certs[c.id] = c.getObject()
+            ca,ac,fa,dep_id,co,certcode = c.relative_path.split('/')
+            cid = "%(dep_id)s_%(certcode)s" % vars()
+            certs[cid] = c.getObject()
         for student in students:
             logger.info('processing "%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
@@ -95,5 +97,8 @@
                 continue
             certcode = makeCertificateCode(student.get('CourseMajor'))
-            if certcode not in certs.keys():
+            dep_id = student.get('Dept')
+            fac_id = student.get('Faculty')
+            cid = "%(dep_id)s_%(certcode)s" % vars()
+            if cid not in certs.keys():
                 em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor'))
                 logger.info(em)
@@ -101,4 +106,5 @@
                 no_import.write('"%(MatricNo)s","%(EntryRegNo)s","%(CurrentSession)s","%(StudentLevel)s","%(fullname)s","%(FirstName)s","%(MiddleName)s","%(Lastname)s","%(FormerSurname)s","%(Sex)s","%(Nationality)s","%(State)s","%(LGA)s","%(PermanentAddress)s","%(PermanentAddressCity)s","%(CampusAddress)s","%(PhoneNumber)s","%(Emailaddress)s","%(Mode)s","%(CourseMajor)s","%(Faculty)s","%(Dept)s"\n' % student)
                 continue
+            certificate_doc = certs[cid].getContent()
             level = student.get('StudentLevel')
             try:
@@ -162,7 +168,18 @@
                 studycourse = student_obj.study_course
                 dsc = {}
+                from_certificate = ['title',
+                                   'max_elect',
+                                   'max_pass',
+                                   'n_core',
+                                   'nr_years',
+                                   'probation_credits',
+                                   'promotion_credits',
+                                   'start_level',
+                                  ]
+                for f in from_certificate:
+                    dsc[f] = getattr(certificate_doc,f)
+                dsc['faculty'] = fac_id
+                dsc['department'] = dep_id
                 dsc['study_course'] = certcode
-                dsc['department'] = student.get('Dept')
-                dsc['faculty'] = student.get('Faculty')
                 css = student.get('CurrentSession') or '2004-2005'
                 cs = int(css.split('-')[0]) - 2000
@@ -206,4 +223,5 @@
             wftool.doActionFor(clearance,'close')
             wftool.doActionFor(personal,'close')
+            wftool.doActionFor(studycourse,'close_for_edit')
         open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
         return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
@@ -217,6 +235,6 @@
         level_wf_actions["SUCCESSFUL STUDENT"] = "pass_A"
         level_wf_actions["STUDENT WITH CARRYOVER COURSES"] = "pass_B"
-        level_wf_actions["STUDENT FOR PROBATION"] = "pass_C"
-        level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "pass_D"
+        level_wf_actions["STUDENT FOR PROBATION"] = "probate_C"
+        level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "reject_D"
         import transaction
         wftool = self.portal_workflow
@@ -274,4 +292,5 @@
                 no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
                 continue
+            course_doc = courses[course].getContent()
             temp_level = result.get('Level')
             result['StudentId'] = sf.getId()
@@ -285,7 +304,7 @@
                     no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
                     continue
-                if level_changed:
+                level_changed = True
+                if 'dlev' in vars().keys():
                     wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
-                level_changed = True
                 level = temp_level
                 l = getattr(sc,level,None)
@@ -302,4 +321,10 @@
             cr = getattr(l,course)
             dcr = {}
+            from_course = ['title',
+                           'credits',
+                           'passmark',
+                           ]
+            for f in from_course:
+                dcr[f] = getattr(course_doc,f)
             dlev = {}
             dcr['ansbook'] = result.get('Ansbook')
Index: WAeUP_SRP/trunk/profiles/default/layouts.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 727)
@@ -19,5 +19,5 @@
  <object name="student_clearance" meta_type="CPS Layout"/>
  <object name="student_clearance_fe" meta_type="CPS Layout"/>
- <object name="student_course_results" meta_type="CPS Layout"/>
+ <object name="student_course_result" meta_type="CPS Layout"/>
  <object name="student_personal" meta_type="CPS Layout"/>
  <object name="student_personal_fe" meta_type="CPS Layout"/>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_course_result.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_course_result.xml	(revision 727)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_course_result.xml	(revision 727)
@@ -0,0 +1,192 @@
+<?xml version="1.0"?>
+<object name="course_results" 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="credits" meta_type="Int Widget">
+  <property name="title">Credits</property>
+  <property name="fields">
+   <element value="credits"/>
+  </property>
+  <property name="label">Credits</property>
+  <property name="label_edit">Credits</property>
+  <property name="readonly_layout_modes"/>
+    <property name="readonly_layout_modes">
+      <element value="edit"/>
+    </property>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="passmark" meta_type="Int Widget">
+  <property name="title">Passmark</property>
+  <property name="fields">
+   <element value="passmark"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Passmark</property>
+  <property name="label_edit">Passmark</property>
+    <property name="readonly_layout_modes">
+      <element value="edit"/>
+    </property>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="title" meta_type="String Widget">
+  <property name="title">Course Title</property>
+  <property name="fields">
+   <element value="title"/>
+  </property>
+  <property name="label">Course Title</property>
+  <property name="label_edit">Course Title</property>
+    <property name="readonly_layout_modes">
+      <element value="edit"/>
+    </property>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="display_width">60</property>
+ </widget>
+ <widget name="ansbook" meta_type="String Widget">
+  <property name="title">Ansbook</property>
+  <property name="fields">
+   <element value="ansbook"/>
+  </property>
+  <property name="label">Ansbook</property>
+  <property name="label_edit">Ansbook</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="semester" meta_type="Int Widget">
+  <property name="title">Semester</property>
+  <property name="fields">
+   <element value="semester"/>
+  </property>
+  <property name="label">Semester</property>
+  <property name="label_edit">Semester</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="carry_level" meta_type="String Widget">
+  <property name="title">Carry Level</property>
+  <property name="fields">
+   <element value="carry_level"/>
+  </property>
+  <property name="label">Carry Level</property>
+  <property name="label_edit">Carry Level</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="grade" meta_type="String Widget">
+  <property name="title">Grade</property>
+  <property name="fields">
+   <element value="grade"/>
+  </property>
+  <property name="label">Grade</property>
+  <property name="label_edit">Grade</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="import_id" meta_type="String Widget">
+  <property name="title">ID</property>
+  <property name="fields">
+   <element value="import_id"/>
+  </property>
+  <property name="label">ID</property>
+  <property name="label_edit">ID</property>
+    <property name="readonly_layout_modes">
+      <element value="edit"/>
+    </property>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="score" meta_type="Int Widget">
+  <property name="title">Score</property>
+  <property name="fields">
+   <element value="score"/>
+  </property>
+  <property name="label">Score</property>
+  <property name="label_edit">Score</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="status" meta_type="String Widget">
+  <property name="title">Status</property>
+  <property name="fields">
+   <element value="status"/>
+  </property>
+  <property name="label">Status</property>
+  <property name="label_edit">Status</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="verdict" meta_type="String Widget">
+  <property name="title">Verdict</property>
+  <property name="fields">
+   <element value="verdict"/>
+  </property>
+  <property name="label">Verdict</property>
+  <property name="label_edit">Verdict</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="weight" meta_type="String Widget">
+  <property name="title">Weight</property>
+  <property name="fields">
+   <element value="weight"/>
+  </property>
+  <property name="label">Weight</property>
+  <property name="label_edit">Weight</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <table>
+  <row>
+   <cell name="title"/>
+  </row>
+  <row>
+   <cell name="semester"/>
+  </row>
+  <row>
+   <cell name="credits"/>
+  </row>
+  <row>
+   <cell name="passmark"/>
+  </row>
+  <row>
+   <cell name="grade"/>
+  </row>
+  <row>
+   <cell name="ansbook"/>
+  </row>
+  <row>
+   <cell name="status"/>
+  </row>
+  <row>
+   <cell name="score"/>
+  </row>
+  <row>
+   <cell name="verdict"/>
+  </row>
+  <row>
+   <cell name="weight"/>
+  </row>
+  <row>
+   <cell name="gpa"/>
+  </row>
+  <row>
+   <cell name="carry_level"/>
+  </row>
+  <row>
+   <cell name="import_id"/>
+  </row>
+ </table>
+</object>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_course_results.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_course_results.xml	(revision 726)
+++ 	(revision )
@@ -1,140 +1,0 @@
-<?xml version="1.0"?>
-<object name="course_results" 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="ansbook" meta_type="String Widget">
-  <property name="title">Ansbook</property>
-  <property name="fields">
-   <element value="ansbook"/>
-  </property>
-  <property name="label">Ansbook</property>
-  <property name="label_edit">Ansbook</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="semester" meta_type="Int Widget">
-  <property name="title">Semester</property>
-  <property name="fields">
-   <element value="semester"/>
-  </property>
-  <property name="label">Semester</property>
-  <property name="label_edit">Semester</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="carry_level" meta_type="String Widget">
-  <property name="title">Carry Level</property>
-  <property name="fields">
-   <element value="carry_level"/>
-  </property>
-  <property name="label">Carry Level</property>
-  <property name="label_edit">Carry Level</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="grade" meta_type="String Widget">
-  <property name="title">Grade</property>
-  <property name="fields">
-   <element value="grade"/>
-  </property>
-  <property name="label">Grade</property>
-  <property name="label_edit">Grade</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="import_id" meta_type="String Widget">
-  <property name="title">ID</property>
-  <property name="fields">
-   <element value="import_id"/>
-  </property>
-  <property name="label">ID</property>
-  <property name="label_edit">ID</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="score" meta_type="Int Widget">
-  <property name="title">Score</property>
-  <property name="fields">
-   <element value="score"/>
-  </property>
-  <property name="label">Score</property>
-  <property name="label_edit">Score</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="status" meta_type="String Widget">
-  <property name="title">Status</property>
-  <property name="fields">
-   <element value="status"/>
-  </property>
-  <property name="label">Status</property>
-  <property name="label_edit">Status</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="verdict" meta_type="String Widget">
-  <property name="title">Verdict</property>
-  <property name="fields">
-   <element value="verdict"/>
-  </property>
-  <property name="label">Verdict</property>
-  <property name="label_edit">Verdict</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <widget name="weight" meta_type="String Widget">
-  <property name="title">Weight</property>
-  <property name="fields">
-   <element value="weight"/>
-  </property>
-  <property name="label">Weight</property>
-  <property name="label_edit">Weight</property>
-  <property name="readonly_layout_modes"/>
-  <property name="hidden_layout_modes"/>
-  <property name="hidden_readonly_layout_modes"/>
- </widget>
- <table>
-  <row>
-   <cell name="semester"/>
-  </row>
-  <row>
-   <cell name="grade"/>
-  </row>
-  <row>
-   <cell name="ansbook"/>
-  </row>
-  <row>
-   <cell name="status"/>
-  </row>
-  <row>
-   <cell name="score"/>
-  </row>
-  <row>
-   <cell name="verdict"/>
-  </row>
-  <row>
-   <cell name="weight"/>
-  </row>
-  <row>
-   <cell name="gpa"/>
-  </row>
-  <row>
-   <cell name="carry_level"/>
-  </row>
-  <row>
-   <cell name="import_id"/>
-  </row>
- </table>
-</object>
Index: WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/layouts/student_study_course.xml	(revision 727)
@@ -18,4 +18,119 @@
   <property name="hidden_layout_modes"/>
   <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="end_level" meta_type="Select Widget">
+  <property name="title">End Level</property>
+  <property name="fields">
+   <element value="end_level"/>
+  </property>
+  <property name="label">End Level</property>
+  <property name="label_edit">End 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="max_elect" meta_type="String Widget">
+  <property name="title">Max Elect</property>
+  <property name="fields">
+   <element value="max_elect"/>
+  </property>
+  <property name="label">Max Elect</property>
+  <property name="label_edit">Max Elect</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="max_load" meta_type="Int Widget">
+  <property name="title">Maximum Load</property>
+  <property name="fields">
+   <element value="max_load"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Maximum Load</property>
+  <property name="label_edit">Maximum Load</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="max_pass" meta_type="Int Widget">
+  <property name="title">Maximum Pass</property>
+  <property name="fields">
+   <element value="max_pass"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Maximum Pass</property>
+  <property name="label_edit">Maximum Pass</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="n_core" meta_type="Int Widget">
+  <property name="title">NCore</property>
+  <property name="fields">
+   <element value="n_core"/>
+  </property>
+  <property name="label">NCore</property>
+  <property name="label_edit">NCore</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="nr_years" meta_type="Int Widget">
+  <property name="title">Nr of Years</property>
+  <property name="fields">
+   <element value="nr_years"/>
+  </property>
+  <property name="label">Nr of Years</property>
+  <property name="label_edit">Nr of Years</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="probation_credits" meta_type="Int Widget">
+  <property name="title">Probation  Credits</property>
+  <property name="fields">
+   <element value="probation_credits"/>
+  </property>
+  <property name="label">Probation  Credits</property>
+  <property name="label_edit">Probation  Credits</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="promotion_credits" meta_type="Int Widget">
+  <property name="title">Promotion  Credits</property>
+  <property name="fields">
+   <element value="promotion_credits"/>
+  </property>
+  <property name="label">Promotion  Credits</property>
+  <property name="label_edit">Promotion  Credits</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+ </widget>
+ <widget name="start_level" meta_type="Select Widget">
+  <property name="title">Start Level</property>
+  <property name="fields">
+   <element value="start_level"/>
+  </property>
+  <property name="label">Start Level</property>
+  <property name="label_edit">Start 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="end_level" meta_type="Select Widget">
+  <property name="title">End Level</property>
+  <property name="fields">
+   <element value="end_level"/>
+  </property>
+  <property name="label">End Level</property>
+  <property name="label_edit">End 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="department" meta_type="String Widget">
@@ -53,4 +168,31 @@
    <cell name="department"/>
   </row>
+  <row>
+   <cell name="start_level"/>
+  </row>
+  <row>
+   <cell name="end_level"/>
+  </row>
+  <row>
+   <cell name="max_pass"/>
+  </row>
+  <row>
+   <cell name="max_load"/>
+  </row>
+  <row>
+   <cell name="promotion_credits"/>
+  </row>
+  <row>
+   <cell name="probation_credits"/>
+  </row>
+  <row>
+   <cell name="nr_years"/>
+  </row>
+  <row>
+   <cell name="n_core"/>
+  </row>
+  <row>
+   <cell name="max_elect"/>
+  </row>
  </table>
 </object>
Index: WAeUP_SRP/trunk/profiles/default/schemas.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 727)
@@ -9,11 +9,10 @@
  <object name="course" meta_type="CPS Schema"/>
  <object name="course_results" meta_type="CPS Schema"/>
- <object name="student_course_results" meta_type="CPS Schema"/>
  <object name="department" meta_type="CPS Schema"/>
  <object name="faculty" meta_type="CPS Schema"/>
  <object name="semester" meta_type="CPS Schema"/>
  <object name="student" meta_type="CPS Schema"/>
- <object name="student_study_course" 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_accommodation_fe" meta_type="CPS Schema"/>
@@ -22,4 +21,5 @@
  <object name="student_personal" meta_type="CPS Schema"/>
  <object name="student_search" meta_type="CPS Schema"/>
+ <object name="student_study_course" meta_type="CPS Schema"/>
  <object name="students" meta_type="CPS Schema"/>
  <object name="student_study_level" meta_type="CPS Schema"/>
Index: WAeUP_SRP/trunk/profiles/default/schemas/student_course_result.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/student_course_result.xml	(revision 727)
+++ WAeUP_SRP/trunk/profiles/default/schemas/student_course_result.xml	(revision 727)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<object name="course_results" meta_type="CPS Schema">
+ <field name="title" meta_type="CPS String Field"/>
+ <field name="faculty_code" meta_type="CPS String Field"/>
+ <field name="department_code" meta_type="CPS String Field"/>
+ <field name="credits" meta_type="CPS Int Field"/>
+ <field name="passmark" meta_type="CPS Int Field"/>
+ <field name="ansbook" meta_type="CPS String Field"/>
+ <field name="carry_level" meta_type="CPS String Field"/>
+ <field name="grade" meta_type="CPS String Field"/>
+ <field name="import_id" meta_type="CPS String Field"/>
+ <field name="score" meta_type="CPS Int Field"/>
+ <field name="status" meta_type="CPS String Field"/>
+<field name="semester" meta_type="CPS Int Field">
+ <property name="default_expr">python:1</property>
+</field> <field name="verdict" meta_type="CPS String Field"/>
+ <field name="weight" meta_type="CPS String Field"/>
+</object>
Index: WAeUP_SRP/trunk/profiles/default/schemas/student_course_results.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/student_course_results.xml	(revision 726)
+++ 	(revision )
@@ -1,13 +1,0 @@
-<?xml version="1.0"?>
-<object name="course_results" meta_type="CPS Schema">
- <field name="ansbook" meta_type="CPS String Field"/>
- <field name="carry_level" meta_type="CPS String Field"/>
- <field name="grade" meta_type="CPS String Field"/>
- <field name="import_id" meta_type="CPS String Field"/>
- <field name="score" meta_type="CPS Int Field"/>
- <field name="status" meta_type="CPS String Field"/>
-<field name="semester" meta_type="CPS Int Field">
- <property name="default_expr">python:1</property>
-</field> <field name="verdict" meta_type="CPS String Field"/>
- <field name="weight" meta_type="CPS String Field"/>
-</object>
Index: WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/schemas/student_study_course.xml	(revision 727)
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <object name="student_study_course" meta_type="CPS Schema">
+<field name="title" meta_type="CPS String Field"/>
 <field name="study_course" meta_type="CPS String Field">
 <property name="is_searchabletext">True</property>
@@ -10,3 +11,12 @@
     <property name="is_searchabletext">True</property>
 </field>
+ <field name="max_elect" meta_type="CPS String Field"/>
+ <field name="max_load" meta_type="CPS Int Field"/>
+ <field name="max_pass" meta_type="CPS Int Field"/>
+ <field name="n_core" meta_type="CPS Int Field"/>
+ <field name="nr_years" meta_type="CPS Int Field"/>
+ <field name="probation_credits" meta_type="CPS Int Field"/>
+ <field name="promotion_credits" meta_type="CPS Int Field"/>
+ <field name="start_level" meta_type="CPS String Field"/>
+ <field name="end_level" meta_type="CPS String Field"/>
 </object>
Index: WAeUP_SRP/trunk/profiles/default/types/StudentCourseResult.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/types/StudentCourseResult.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/types/StudentCourseResult.xml	(revision 727)
@@ -17,8 +17,8 @@
  <property name="cps_display_as_document_in_listing">True</property>
  <property name="schemas">
-  <element value="student_course_results"/>
+  <element value="student_course_result"/>
  </property>
  <property name="layouts">
-  <element value="student_course_results"/>
+  <element value="student_course_result"/>
  </property>
  <property name="layout_clusters"/>
Index: WAeUP_SRP/trunk/profiles/default/vocabularies/searchable_student_states.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/vocabularies/searchable_student_states.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/vocabularies/searchable_student_states.xml	(revision 727)
@@ -17,3 +17,10 @@
  <item key="clearance_requested" msgid="">clearance requested</item>
  <item key="cleared_and_validated" msgid="">cleared and validated</item>
+ <item key="content_addable" msgid="">content addable</item>
+ <item key="category_A" msgid="">category A</item>
+ <item key="category_B" msgid="">category B</item>
+ <item key="category_C" msgid="">category C</item>
+ <item key="category_D" msgid="">category D</item>
+ <item key="category_E" msgid="">category E</item>
+ <item key="category_F" msgid="">category F</item>
 </object>
Index: WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml	(revision 726)
+++ WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml	(revision 727)
@@ -10,6 +10,12 @@
   <exit-transition transition_id="open"/>
  </state>
+ <state state_id="content_addable" title="">
+  <exit-transition transition_id="close"/>
+  <exit-transition transition_id="create_content"/>
+  <exit-transition transition_id="open"/>
+ </state>
  <state state_id="created" title="">
   <exit-transition transition_id="close"/>
+  <exit-transition transition_id="close_for_edit"/>
   <exit-transition transition_id="create_content"/>
   <exit-transition transition_id="open"/>
@@ -25,4 +31,5 @@
  <state state_id="opened" title="">
   <exit-transition transition_id="close"/>
+  <exit-transition transition_id="close_for_edit"/>
   <exit-transition transition_id="create_content"/>
   <permission-map name="Modify portal content"
@@ -46,4 +53,11 @@
    <guard-role>SectionManager</guard-role>
    <guard-role>Owner</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="close_for_edit" title=""
+             new_state="content_addable" trigger="USER"
+             before_script="" after_script="">
+  
+  <guard>
   </guard>
  </transition>
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py	(revision 726)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudyLevelInfo.py	(revision 727)
@@ -1,3 +1,3 @@
-## Script (Python) "cpsdocument_edit"
+# Script (Python) "cpsdocument_edit"
 ##bind container=container
 ##bind context=context
@@ -12,13 +12,4 @@
 return Info about the Studylevel
 """
-def findCourse(cid):
-    ''' find the course'''
-    res = context.portal_catalog({'meta_type': 'Course',
-                                  'id': cid})
-    if len(res) < 1:
-        return None
-    course = res[0].getObject().getContent()
-    return course
-
 def calculateGPA():
     """calculate the gpa"""
@@ -76,15 +67,12 @@
     rd = ro.getContent()
     row['id'] = ro.getId()
-    course = findCourse(ro.getId())
-    row['credits'] = 0
-    if course:
-        row['credits'] = course.credits
+    row['credits'] = rd.credits
     if row['credits'] and rd.grade:
-        credits = int(course.credits)
+        credits = int(rd.credits)
         sum += credits * ['F','E','D','C','B','A'].index(rd.grade)
         course_count += credits
     row['sum'] = sum
     row['count'] = course_count
-    row['title'] = rd.Title()
+    row['title'] = rd.title
     #row['core'] = rd.core_or_elective
     row['semester'] = rd.semester
Index: WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py	(revision 726)
+++ WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py	(revision 727)
@@ -12,5 +12,10 @@
 return Info about the current Student
 """
-#from Products.ZCTextIndex.QueryParser import ParseError,QueryError
+try:
+    from Products.AdvancedQuery import Eq, Between, Le
+    evalAdvancedQuery = context.portal_catalog.evalAdvancedQuery
+except:
+    evalAdvancedQuery = None
+    
 request = context.REQUEST
 form = request.form
@@ -53,4 +58,7 @@
 err = False
 with_review = state != "all"
+onlyreview = with_review and not term
+with_level_results = state.startswith("category") and evalAdvancedQuery is not None
+bools = "with_review = %s<br\> onlyreview = %s<br\> with_level_results = %s" % (with_review,onlyreview,with_level_results)
 if not term and not with_review:
     psm = "You must specify a search string when searching 'all states'."
@@ -66,29 +74,40 @@
                              is_manager = is_manager,
                              )
-with_review = state != "all"
 items = []
 res = []
 portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']}
 st_queries = ('jamb_reg_no','matric_no','name')
-onlyreview = with_review and not term
-if onlyreview:
-    res = catalog(portal_type='Student',
-                  review_state=state)
+query_step = 0
+if onlyreview and not with_level_results:
+    query_step = 1
+    query =  Eq('portal_type','Student') & Eq('review_state',state) 
+    res = evalAdvancedQuery(query)
+##    res = catalog(portal_type='Student',
+##                  review_state=state)
+elif onlyreview and with_level_results:
+    query_step = 2
+    query =  Eq('portal_type','StudentStudyLevel') & Eq('review_state',state) 
+    res = evalAdvancedQuery(query)
 elif what == "student_id":
     if with_review:
+        query_step = 3
         res = catalog(portal_type='Student',
                       id = term.strip(),
                       review_state=state)
     else:
+        query_step = 4
         res = catalog(portal_type='Student',
                       id = term.strip())
-elif what in st_queries:
+elif what in st_queries and not with_level_results:
     if what == "jamb_reg_no":
+        query_step = 5
         pt = 'StudentApplication'
         st = "%s*" % term.strip().lower()
     elif what == "matric_no":
+        query_step = 6
         pt = 'StudentClearance'
         st = "%s*" % term.strip().lower()
     elif what == "name":
+        query_step = 7
         pt = portal_type_query
         st = "%s*" % term.strip()
@@ -102,9 +121,36 @@
                              is_manager = is_manager,
                              )
+elif what in st_queries and with_level_results and evalAdvancedQuery:
+    if what == "jamb_reg_no":
+        query_step = 8
+        pt = 'StudentApplication'
+        st = "%s*" % term.strip().lower()
+    elif what == "matric_no":
+        query_step = 9
+        pt = 'StudentClearance'
+        st = "%s*" % term.strip().lower()
+    elif what == "name":
+        query_step = 10
+        pt = portal_type_query
+        st = "%s*" % term.strip()
+    query = Eq('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip().lower())\
+                | Eq('portal_type','StudentStudyLevel') & Eq('review_state',state) 
+    try:
+        res = evalAdvancedQuery(query)
+    except:
+        return context.students_manager_view(rendered = rend,
+                             psm = 'Advanced Query failed' % term,
+                             #psm = "%s, %s" % (psm,ds),
+                             students = items,
+                             is_manager = is_manager,
+                             )
 students = []
+raw_res = len(res)
 if res:
     for r in res:
-        if r.portal_type in ("StudentApplication","StudentPersonal"):
+        if r.portal_type in ("StudentApplication","StudentPersonal",):
             student = r.getObject().aq_parent
+        elif r.portal_type in ("StudentStudyLevel",):
+            student = r.getObject().aq_parent.aq_parent
 ##            pp = '/'.join(r.getPath().split('/')[:-1])
 ##            student_cat = catalog(pathindex=pp,portal_type='Student')[0]
@@ -114,5 +160,5 @@
             student = r.getObject()
         student_rs = wf.getInfoFor(student,'review_state','keiner')
-        if (with_review and student_rs != state) or student in items:
+        if (with_review and student_rs != state and not with_level_results) or student in items:
             continue
         items.append(student)
@@ -126,5 +172,5 @@
                              )
 return context.students_manager_view(rendered = rend,
-                             psm = """Your search for "%s" in %s with state %s failed.""" % (st,what,state),
+                             psm = """Step: %s found: %s Your search for "%s" in %s with state %s failed.<br\>%s""" % (query_step,raw_res,st,what,state,bools),
                              students = students,
                              is_manager = is_manager,
