Index: WAeUP_SRP/trunk/Academics.py
===================================================================
--- WAeUP_SRP/trunk/Academics.py	(revision 562)
+++ WAeUP_SRP/trunk/Academics.py	(revision 563)
@@ -49,4 +49,344 @@
     security.declareProtected(ModifyPortalContent,"loadFacultiesFromCSV")###(
     def loadFacultiesFromCSV(self):
+        """install Universityspecific Faculies from CSV values"""
+        #return
+        name = 'Faculties'
+        no_import = False
+        logger = logging.getLogger('%s_csv_import' % name)
+        logger.info('Start loading from %s.csv' % name)
+        academics = self.portal_catalog({'meta_type': 'AcademicsFolder'})[-1].getObject()
+        try:
+            faculties = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        l = self.portal_catalog({'meta_type': "Faculty"})
+        facs = {}
+        for f in l:
+            facs[f.id] = f.getObject()
+        fields = ("code",
+                  "review_state",
+                  "title",
+                  "title_prefix",
+                  "college_code",
+                  "degree_grade",
+                  "bank_code",
+                  )
+        format = ' '.join(['%%(%s)s ' % fn for fn in fields])
+        for faculty in faculties:
+            processing = "processing %s" % format
+            logger.info(processing % faculty)
+            fid = faculty.get('code')
+            f = facs.get(fid,None)
+            if f is None:
+                #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
+                logger.info('Creating Faculty with ID %(code)s %(title)s' % faculty)
+                academics.invokeFactory('Faculty', fid)
+                f = getattr(self,fid)
+                d = {'Title': faculty.get('title')}
+            else:
+                d = {}
+            f.getContent().edit(mapping=faculty)
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+
+    security.declareProtected(ModifyPortalContent,"loadDepartmentsFromCSV")###(
+    def loadDepartmentsFromCSV(self):
+        """install Universityspecific Faculies from CSV values"""
+        #return
+        name = 'Departments'
+        no_import = False
+        logger = logging.getLogger('loaddepartments')
+        fields = ("code",
+                  "review_state",
+                  "title",
+                  "title_prefix",
+                  "faculty_code",
+                  )
+        format = ' '.join(['%%(%s)s ' % fn for fn in fields])
+        try:
+            deps = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+        heading = ' '.join(['"%s"' % fn for fn in fields])
+        no_import.write('%s\n' % heading)
+        l = self.portal_catalog({'meta_type': "Faculty"})
+        facs = {}
+        for f in l:
+            facs[f.id] = f.getObject()
+        for dep in deps:
+            processing = "processing %s" % format
+            logger.info(processing % dep)
+            fid = dep['faculty_code']
+            f = facs.get(fid,None)
+            if f is None:
+                logger.info( "No Faculty with ID: %s" % fid)
+                no_import.write( "No Faculty with ID: %s\n" % fid)
+                no_import.write(format % dep + "\n")
+            else:
+                did = dep.get('code')
+                d = getattr(f,did,None)
+                if d is None or d.portal_type == "Faculty":
+                    logger.info('Creating Department %(code)s = %(title)s' % dep)
+                    f.invokeFactory('Department', did)
+                    d = getattr(f,did)
+                    d.invokeFactory('CoursesFolder','courses')
+                    courses = getattr(d,'courses')
+                    dict = {'Title': 'Courses'}
+                    courses.getContent().edit(mapping=dict)
+                    d.invokeFactory('CertificatesFolder','certificates')
+                    certificates = getattr(d,'certificates')
+                    dict = {'Title': 'Certificates'}
+                    certificates.getContent().edit(mapping=dict)
+                d.getContent().edit(mapping=dep)
+                    
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadCoursesFromCSV")###(
+    def loadCoursesFromCSV(self):
+        """install Universityspecific Courses from CSV values"""
+        #return
+        wf = self.portal_workflow
+        name = 'Courses'
+        no_import = False
+        logger = logging.getLogger('loadcourses')
+        fields = ("code",
+                  "review_state",
+                  "title",
+                  "faculty_code",
+                  "department_code",
+                  "credits",
+                  "org_code",
+                  "passmark",
+                  "semester",
+                  "session",
+                  )
+        format = ' '.join(['%%(%s)s ' % fn for fn in fields])
+        try:
+            courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+        heading = ' '.join(['"%s"' % fn for fn in fields])
+        no_import.write('%s\n' % heading)
+        l = self.portal_catalog({'meta_type': "Faculty"})
+        facs = {}
+        for f in l:
+            facs[f.id] = f.getObject()
+        dl = self.portal_catalog({'meta_type': "Department"})
+        deps = {}
+        for d in dl:
+            deps[d.id] = d.getObject()
+        cl = self.portal_catalog({'meta_type': "Course"})
+        course_list = [ c.id for c in cl]
+        for course in courses:
+            processing = "processing %s" % format
+            logger.info(processing % course)
+            depid = course.get('department_code').upper()
+            if depid in deps.keys():
+                dept= deps.get(depid)
+            else:
+                msg = "Department %(department_code)s for Course %(code)s not found" % course
+                logger.info(msg)
+                no_import.write(msg)
+                no_import.write(format % course + "\n")
+                continue
+            course_id = course.get('code')
+            cf = dept.courses
+            c = getattr(cf,course_id,None)
+            if c is None:
+                logger.info('Creating Course %(code)s  %(title)s in Department %(department_code)s' % course)
+                cf.invokeFactory('Course', course_id)
+                c = getattr(cf,course_id)
+            c.getContent().edit(mapping=course)
+            review_state = course.get('review_state')
+            if review_state == "checked" and wf.getInfoFor(c,'review_state',None) != 'checked':
+                self.portal_workflow.doActionFor(c,'approve')
+
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadCertificatesFromCSV")###(
+
+    def loadCertificatesFromCSV(self):
+        """install Universityspecific Certificates from CSV values"""
+        #return
+        name = 'Certificates'
+        wf = self.portal_workflow
+        no_import_list = []
+        logger = logging.getLogger('loadcertificates')
+        fields = ("code",
+                  "review_state",
+                  "title",
+                  "faculty_code",
+                  "department_code",
+                  "category",
+                  "end_level",
+                  "m_prefix",
+                  "max_elect",
+                  "max_pass",
+                  "n_core",
+                  "nr_years",
+                  "original_code",
+                  "probation_credits",
+                  "promotion_credits",
+                  "start_level",
+                  "admin_status",
+                  )
+        format = ' '.join(['%%(%s)s ' % fn for fn in fields])
+        try:
+            courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        try:
+            certificates = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        f_ids = [f.id for f in self.portal_catalog({'meta_type': "Faculty"})]
+        dl = self.portal_catalog({'meta_type': "Department"})
+        deps = {}
+        for d in dl:
+            deps[d.id] = d.getObject()
+        for certificate in certificates:
+            processing = "processing %s" % format
+            logger.info(processing % certificate)
+            depid = certificate.get('department_code')
+            facid = certificate.get('faculty_code')
+            if facid not in f_ids:
+                msg = 'Faculty %(faculty_code)s for %(code)s %(title)s not found' % certificate
+                logger.info(msg)
+                no_import_list.append(msg)
+                no_import_list.append(format % certificate + "\n")
+                continue
+            if not deps.has_key(depid):
+                msg = 'Department %(department_code)s for %(code)s %(title)s not found' % certificate
+                logger.info(msg)
+                no_import_list.append(msg)
+                no_import_list.append(format % certificate + "\n")
+                continue
+            dep = deps[depid]
+            cf= dep.certificates
+            code = certificate.get('code')
+            certificate_id = code
+            c = getattr(cf,certificate_id,None)
+            if c is None:
+                logger.info('Creating certificate %(code)s  %(title)s in Department %(department_code)s' % certificate)
+                cf.invokeFactory('Certificate', certificate_id)
+                c = getattr(cf,certificate_id)
+            c.getContent().edit(mapping=certificate)
+            review_state = c.get('review_state')
+            if review_state == "checked" and wf.getInfoFor(c,'review_state',None) != 'checked':
+                self.portal_workflow.doActionFor(c,'approve')
+        if no_import_list:
+            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+            heading = ' '.join(['"%s"' % fn for fn in fields])
+            no_import.write('%s\n' % heading)
+            for line in no_import_list:
+                no_import.write(line)
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadCertificateCoursesFromCSV")###(
+    def loadCertificateCoursesFromCSV(self):
+        """install Certificate Courses from CSV values"""
+        #return
+        logger = logging.getLogger('loadcertificatecourses')
+        name = 'CertificateCourses'
+        wf = self.portal_workflow
+        no_import_list = []
+        logger = logging.getLogger('loadcertificates')
+        fields = ("code",
+                  "review_state",
+                  "faculty_code",
+                  "department_code",
+                  "certificate_code",
+                  "level",
+                  "semester",
+                  "core_or_elective",
+                  )
+        format = ' '.join(['%%(%s)s ' % fn for fn in fields])
+        try:
+            cert_courses = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        d_ids = [d.id for d in self.portal_catalog({'meta_type': "Department"})]
+        c_ids = [c.id for c in self.portal_catalog({'meta_type': "Course"})]
+        l = self.portal_catalog({'meta_type': "Certificate"})
+        certs = {}
+        for f in l:
+            certs[f.id] = f.getObject()
+        for cert_course in cert_courses:
+            processing = "processing %s" % format
+            logger.info(processing % cert_course)
+            depid = cert_course.get('department_code')
+            course_code = cert_course.get('code')
+            code = cert_course.get('certificate_code')
+            if not code in certs.keys():
+                em = 'CertCode %(certificate_code)s for %(code)s not found\n' % cert_course
+                logger.info(em)
+                no_import_list.append(em)
+                no_import_list.append(format % cert_course + "\n")
+                continue
+            certificate = certs[code]
+            certificate_code = certificate.getId()
+            if course_code not in c_ids:
+                em = 'Course %(code)s for %(certificate_code)s Level %(level)s not found in Courses\n' % cert_course
+                logger.info(em)
+                no_import_list.append(em)
+                no_import_list.append(format % cert_course + "\n")
+                continue
+            if depid not in d_ids:
+                em = 'Department %(department_code)s for %(certificate_code)s not found\n' % cert_course
+                logger.info(em)
+                no_import_list.append(em)
+                no_import_list.append(format % cert_course + "\n")
+                continue
+            level = cert_course.get('level')
+            l = getattr(certificate,level,None)
+            if l is None:
+                logger.info('Creating Level %(level)s in certificate %(certificate_code)s' % cert_course)
+                certificate.invokeFactory('StudyLevel', level)
+                l = getattr(certificate, level)
+                l.getContent().edit(mapping={'Title': "Level %s" % level})
+            certificate.orderObjects('id')
+            if hasattr(l,course_code):
+                msg = 'Duplicate %(code)s in Level %(level)s' % cert_course
+                logger.info(msg)
+                no_import_list.append(msg + "\n")
+                no_import_list.append(format % cert_course + "\n")
+                continue
+            l.invokeFactory('CertificateCourse',course_code)
+            logger.info('Creating CertificateCourse %(code)s in certificate %(certificate_code)s Level %(level)s' % cert_course)
+            cc = getattr(l,course_code)
+            semester = 'first'
+            try:
+                sem = int(cert_course.get('semester'))
+                cert_course['semester'] = ('first','second')[sem - 1]
+            except:
+                pass
+            cert_course['core_or_elective'] = eval(cert_course['core_or_elective']) 
+            cc.getContent().edit(mapping=cert_course)
+            review_state = cc.get('review_state')
+            if review_state == "checked" and wf.getInfoFor(cc,'review_state',None) != 'checked':
+                self.portal_workflow.doActionFor(cc,'approve')
+        if no_import_list:
+            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+            heading = ' '.join(['"%s"' % fn for fn in fields])
+            no_import.write('%s\n' % heading)
+            for line in no_import_list:
+                no_import.write(line)
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadFacultiesFromOrgCSV")###(
+    def loadFacultiesFromOrgCSV(self):
         """install Universityspecific Faculies from CSV values"""
         #return
@@ -106,6 +446,6 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"loadDepartmentsFromCSV")###(
-    def loadDepartmentsFromCSV(self):
+    security.declareProtected(ModifyPortalContent,"loadDepartmentsFromOrgCSV")###(
+    def loadDepartmentsFromOrgCSV(self):
         """install Universityspecific Faculies from CSV values"""
         #return
@@ -153,6 +493,6 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"loadCoursesFromCSV")###(
-    def loadCoursesFromCSV(self):
+    security.declareProtected(ModifyPortalContent,"loadCoursesFromOrgCSV")###(
+    def loadCoursesFromOrgCSV(self):
         """install Universityspecific Courses from CSV values"""
         #return
@@ -231,7 +571,7 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"loadCertificatesFromCSV")###(
-
-    def loadCertificatesFromCSV(self):
+    security.declareProtected(ModifyPortalContent,"loadCertificatesFromOrgCSV")###(
+
+    def loadCertificatesFromOrgCSV(self):
         """install Universityspecific Certificates from CSV values"""
         #return
@@ -308,6 +648,6 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"loadCertificateCoursesFromCSV")###(
-    def loadCertificateCoursesFromCSV(self):
+    security.declareProtected(ModifyPortalContent,"loadCertificateCoursesFromOrgCSV")###(
+    def loadCertificateCoursesFromOrgCSV(self):
         """install Certificate Courses from CSV values"""
         #return
Index: WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml	(revision 562)
+++ WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml	(revision 563)
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
 <object name="certificate" meta_type="CPS Schema">
+ <field name="title" meta_type="CPS String Field"/>
  <field name="admin_status" meta_type="CPS String Field"/>
  <field name="category" meta_type="CPS String Field"/>
Index: WAeUP_SRP/trunk/profiles/default/schemas/course.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/course.xml	(revision 562)
+++ WAeUP_SRP/trunk/profiles/default/schemas/course.xml	(revision 563)
@@ -3,4 +3,5 @@
  <field name="adm_status" meta_type="CPS String Field"/>
  <field name="category" meta_type="CPS String Field"/>
+ <field name="title" meta_type="CPS String Field"/>
  <field name="code" meta_type="CPS String Field">
   <property name="is_searchabletext">False</property>
Index: WAeUP_SRP/trunk/profiles/default/schemas/department.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/department.xml	(revision 562)
+++ WAeUP_SRP/trunk/profiles/default/schemas/department.xml	(revision 563)
@@ -2,4 +2,5 @@
 <object name="department" meta_type="CPS Schema">
  <field name="code" meta_type="CPS String Field"/>
+ <field name="title" meta_type="CPS String Field"/>
  <field name="title_prefix" meta_type="CPS String Field"/>
 </object>
Index: WAeUP_SRP/trunk/profiles/default/schemas/faculty.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/schemas/faculty.xml	(revision 562)
+++ WAeUP_SRP/trunk/profiles/default/schemas/faculty.xml	(revision 563)
@@ -5,4 +5,5 @@
  <field name="college_code" meta_type="CPS String Field"/>
  <field name="degree_grade" meta_type="CPS String Field"/>
+ <field name="title" meta_type="CPS String Field"/>
  <field name="title_prefix" meta_type="CPS String Field"/>
 </object>
Index: WAeUP_SRP/trunk/profiles/default/types/StudyLevel.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/types/StudyLevel.xml	(revision 562)
+++ WAeUP_SRP/trunk/profiles/default/types/StudyLevel.xml	(revision 563)
@@ -12,5 +12,5 @@
  <property name="filter_content_types">True</property>
  <property name="allowed_content_types">
-  <element value="Semester"/>
+  <element value="CertificateCourse"/>
  </property>
  <property name="allow_discussion">False</property>
Index: WAeUP_SRP/trunk/skins/waeup_academics/courses_index_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_academics/courses_index_view.pt	(revision 562)
+++ WAeUP_SRP/trunk/skins/waeup_academics/courses_index_view.pt	(revision 563)
@@ -65,4 +65,5 @@
                     <strong tal:content="row/title" /></a> </td>
                 <td tal:content="row/id"> </td>
+                <td tal:content="row/review_state"> </td>
                 <td><a href="edit" tal:attributes="href string:${row/url}/cpsdocument_edit_form">[edit]</a></td>
               </tr>
Index: WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py	(revision 562)
+++ WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py	(revision 563)
@@ -42,4 +42,5 @@
     row['title'] = rd.Title()
     row['url'] = ro.absolute_url()
+    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
     items.append(row)
 info['courses'] = items
Index: WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 562)
+++ WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 563)
@@ -13,14 +13,14 @@
 """
 request = context.REQUEST
-
+form = request.form
+fget = form.get
 wf = context.portal_workflow
 mtool = context.portal_membership
 member = mtool.getAuthenticatedMember()
 path_info = request.get('PATH_INFO').split('/')
-
+roles = member.getRoles()
 info = {}
+info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles
 member_id = str(member)
-##if member_id not in path_info:
-##    return None
 if student is None:
     students = getattr(context,'students',None)
Index: WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 562)
+++ WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt	(revision 563)
@@ -1,3 +1,5 @@
-<metal:html tal:define="info context/getStudentInfo">
+<metal:html tal:define="info context/searchStudents;
+                        students info/students;
+                        is_manager info/is_manager;">
 
   <metal:body use-macro="here/main_template/macros/master">
@@ -9,7 +11,19 @@
       </span>
       <span tal:condition="isManager">
-      <h3>All Students</h3>
+      <h3>Search Students by</h3>
         <br />
-        <table tal:define="students python: context.objectValues()">
+        <form  action="." method="post" tal:attributes="action context/absolute_url">
+          <table>           
+            <tr>            
+              <td>StudentId</td><td><input type="text" name="student_id" /></td>
+              <td>JAMB Id</td><td><input type="text" name="jamb_id" /></td>
+            </tr>
+            <tr>
+              <td>Matric No</td><td><input type="text" name="matric_no" /></td>
+              <td>Student Name</td><td><input type="text" name="name" /></td>
+            </tr>
+            </table>
+      </form>
+        <table tal:condition="students">
           <tr tal:repeat="student students">
             <td><a href="id" tal:attributes="href string:${student/absolute_url}"
