Index: WAeUP_SRP/branches/uli/Academics.py
===================================================================
--- WAeUP_SRP/branches/uli/Academics.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/Academics.py	(revision 1593)
@@ -51,5 +51,5 @@
     def importLocalRoles(self,portal_type): ###(
         name = '%sLocalRoles' % portal_type
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.importLocalRoles')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start importing %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -74,5 +74,5 @@
                         member_id = r.split(':')[1]
                         odict[obj_id].manage_setLocalRoles(member_id, roles_dict[r])
-                        logger.info('importing role for %s %s %s' % (obj_id, member_id,roles_dict[r]))
+                        logger.info('Importing role for %s %s %s' % (obj_id, member_id,roles_dict[r]))
 
 ###)
@@ -87,5 +87,5 @@
         name = 'Faculties'
         no_import = False
-        logger = logging.getLogger('Import.%s_csv' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.loadFacultiesFromCSV')
         logger.info('Start loading from %s.csv' % name)
         academics = self.portal_catalog({'meta_type': 'AcademicsFolder'})[-1].getObject()
@@ -134,5 +134,5 @@
         name = 'Departments'
         no_import = False
-        logger = logging.getLogger('Import.Departments')
+        logger = logging.getLogger('Academics.AcademicsFolder.loadDepartmentsFromCSV')
         fields = ("code",
                   "review_state",
@@ -191,5 +191,5 @@
         name = 'Courses'
         no_import = False
-        logger = logging.getLogger('Import.Courses')
+        logger = logging.getLogger('Academics.AcademicsFolder.loadCoursesFromCSV')
         fields = ("code",
                   "review_state",
@@ -296,5 +296,5 @@
         wf = self.portal_workflow
         no_import_list = []
-        logger = logging.getLogger('Import.Certificates')
+        logger = logging.getLogger('Academics.AcademicsFolder.loadCertificatesFromCSV')
         fields = ("code",
                   "review_state",
@@ -374,9 +374,8 @@
         """install Certificate Courses from CSV values"""
         #return
-        logger = logging.getLogger('Import.CertificateCourses')
+        logger = logging.getLogger('Academics.AcademicsFolder.loadCertificateCoursesFromCSV')
         name = 'CertificateCourses'
         wf = self.portal_workflow
         no_import_list = []
-        logger = logging.getLogger('Import.CertificateCourses')
         fields = ("code",
                   "review_state",
@@ -446,5 +445,5 @@
                 continue
             l.invokeFactory('CertificateCourse',course_code)
-            logger.info('Creating CertificateCourse %(code)s in certificate %(certificate_code)s Level %(level)s' % cert_course)
+            logger.info('Creating CertificateCourse %(code)s in Certificate %(certificate_code)s StudyLevel %(level)s' % cert_course)
             cc = getattr(l,course_code)
             semester = 'first'
@@ -492,5 +491,5 @@
     def exportLocalRoles(self,portal_type): ###(
         name = '%sLocalRoles' % portal_type
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportLocalRoles')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -505,5 +504,5 @@
             for (groupname, roles) in obj.get_local_group_roles():
                 lr[ 'group:' + group ] = [x for x in roles]
-            logger.info('exporting %s %s ' % (obj.id, lr))
+            logger.info('Exporting %s %s ' % (obj.id, lr))
             export.append('"%s","%s"' % (obj.getId(),lr))
         open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export))
@@ -519,5 +518,5 @@
         name = 'Faculties'
         no_import = False
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportFacultiesToCSV')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -526,5 +525,5 @@
         export.append('"code","review_state","title","title_prefix","college_code","degree_grade","bank_code"')
         for obj in objects:
-            logger.info('exporting %s %s ' % (obj.id, obj.title))
+            logger.info('Exporting %s %s ' % (obj.id, obj.title))
             obj_d = obj.getContent()
             di = {}
@@ -552,5 +551,5 @@
         name = 'Departments'
         no_import = False
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportDepartmentsToCSV')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -570,5 +569,5 @@
                     di['review_state'] = self.portal_workflow.getInfoFor(department,'review_state','no_state')
                     export.append('"%(code)s","%(review_state)s","%(title)s","%(title_prefix)s","%(faculty_code)s"' % di)
-                    logger.info('exporting %s %s ' % (department.id, department.title))
+                    logger.info('Exporting %s %s ' % (department.id, department.title))
                 except:
                     logger.info('could not export %s %s ' % (department.id, department.title))
@@ -584,5 +583,5 @@
         name = 'Courses'
         no_import = False
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportCoursesToCSV')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -614,5 +613,5 @@
                     di['review_state'] = self.portal_workflow.getInfoFor(course,'review_state','no_state')
                     export.append(dataline % di)
-                    logger.info('exporting %s %s ' % (course.id, course.title))
+                    logger.info('Exporting %s %s ' % (course.id, course.title))
                     continue
         open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export))
@@ -626,5 +625,5 @@
         name = 'Certificates'
         no_import = False
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportCertificatesToCSV')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -668,5 +667,5 @@
                     try:
                         export.append(dataline % di)
-                        logger.info('exporting %s %s ' % (certificate.id, certificate.title))
+                        logger.info('Exporting %s %s ' % (certificate.id, certificate.title))
                     except:
                         logger.info('could not export %s %s ' % (certificate.id, certificate.title))
@@ -682,5 +681,5 @@
         name = 'CertificateCourses'
         no_import = False
-        logger = logging.getLogger('Export.%s' % name)
+        logger = logging.getLogger('Academics.AcademicsFolder.exportCertificateCoursesToCSV')
         current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
         logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars())
@@ -714,7 +713,7 @@
                                     try:
                                         export.append(dataline % di)
-                                        logger.info('exporting %s %s ' % (certificate.id, certificate.title))
+                                        logger.info('Exporting %s %s ' % (certificate.id, certificate.title))
                                     except:
-                                        logger.info('could not export %s %s ' % (certificate.id, certificate.title))
+                                        logger.info('Could not export %s %s ' % (certificate.id, certificate.title))
                                         continue
         open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export))
Index: WAeUP_SRP/branches/uli/Accommodation.py
===================================================================
--- WAeUP_SRP/branches/uli/Accommodation.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/Accommodation.py	(revision 1593)
@@ -107,5 +107,5 @@
         no_import = []
         imported = []
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Accommodation.AccoFolder.importReservedBeds')
         try:
             beds = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -169,5 +169,5 @@
                     no_import.append( format_error % bed)
                     continue
-                halls[hall] = hall_doc = hall_object.getContent() 
+                halls[hall] = hall_doc = hall_object.getContent()
             bid = "%(hall)s_%(block)s_%(room)s_%(bed)s" % bed
             res = accommodation(bed = bid)
@@ -201,5 +201,5 @@
                     acco_doc.edit(mapping={'bed': bid})
                     member = self.portal_membership.getAuthenticatedMember()
-                    logger.info('"%s","changed reserved bed %s for","%s"' % (member,bid,sid))
+                    logger.info('%s changed reserved bed %s for %s' % (member,bid,sid))
             accommodation.modifyRecord(bed = bid, student = sid)
             imported.append( format % bed)
@@ -227,5 +227,5 @@
         return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
 
-        
+
 InitializeClass(AccoFolder)
 
@@ -256,5 +256,5 @@
 InitializeClass(AccoHall)
 
-    
+
 def addAccoHall(container, id, REQUEST=None, **kw):
     """Add a AccoHall."""
Index: WAeUP_SRP/branches/uli/PatchCPSUserFolderUserFolder.py
===================================================================
--- WAeUP_SRP/branches/uli/PatchCPSUserFolderUserFolder.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/PatchCPSUserFolderUserFolder.py	(revision 1593)
@@ -71,23 +71,39 @@
     ## patch to assign dynamic roles for WAeUP
     while 1:
+        if self.isStudent():
+            break
+        groups = self.portal_membership.getAuthenticatedMember().getGroups()
+        if not ("ClearanceOfficers" in groups or "CourseAdvisers" in groups):
+            break
         if callable(real_object) and hasattr(real_object,'im_self'):
             real_object = real_object.im_self
+
+        if real_object is None:
+            break
         if hasattr(real_object,'portal_type') and\
-                   real_object.portal_type not in ("Student","StudentClearance","StudentStudyLevel"):
+                   real_object.portal_type not in ("Student",
+                                                   "StudentClearance",
+                                                   "StudentStudyLevel"):
             break
+        # don't test if it is not a proxy 
+        if real_object.portal_type == real_object.meta_type:
+            break
+        # can be later simplified by replacing by students_catalog values - Henrik
+        # getattr works always because of acquisition ?! Henrik
         sc = getattr(real_object,'study_course',None)
         if sc is None:
             break
+        #from pdb import set_trace;set_trace()
         sc_obj = sc.getContent()
-        res_sc = self.portal_catalog(portal_type="Certificate",
-                                     id = sc_obj.study_course)
-        if len(res_sc) != 1:
+        cert_id = sc_obj.study_course
+        res_cert = self.portal_catalog(id = cert_id)
+        if len(res_cert) != 1:
             break
-        cert_path = res_sc[0].getPath().split('/')
+        certificate_brain = res_cert[0]
+        certificate_obj = certificate_brain.getObject()
+        cert_path = certificate_brain.getPath().split('/')
         fac_id = cert_path[-4]
         dep_id = cert_path[-3]
-
-
-        # temporary sel-healing function
+        # temporary self-healing function
         # deprecated after reindexing the students_catalog
         student_id = self.getStudentId()
@@ -95,17 +111,38 @@
         if len(res) != 1:
             break
-        self.students_catalog.modifyRecord(id = student_id,
+        st_entry = res[0]
+        if st_entry.faculty != fac_id or\
+           st_entry.department != dep_id or\
+           st_entry.course != cert_id:
+               self.students_catalog.modifyRecord(id = student_id,
                                                 faculty = fac_id,
                                                 department = dep_id,
+                                                course = cert_id
                                                 )
-
-
-        res = self.portal_catalog(portal_type="Department",id=dep_id)
-        if len(res) != 1:
+        if real_object.portal_type == "StudentStudyLevel":
+            context_obj = getattr(certificate_obj,real_object.getId(),None)
+            if context_obj is None:
+                break
+            allowed = set(('CourseAdviser', 'SectionManager'))
+        elif real_object.portal_type == "Student" and "CourseAdvisers" in groups:
+            #we need some special processing since CourseAdvisers are only 
+            #specified per StudyLevel
+            allowed = set(('CourseAdviser', 'SectionManager'))
+            for context_obj in certificate_obj.objectValues():
+                dynamic_roles = set(self.getRolesInContext(context_obj))
+                intersect = dynamic_roles & allowed
+                if intersect:
+                    roles.extend(list(intersect))
             break
-        dynamic_roles = self.getRolesInContext(res[0].getObject())
-        for dr in ('ClearanceOfficer','CourseAdviser', 'SectionManager'):
-            if dr in dynamic_roles:
-                roles.append(dr)
+        else:
+            res = self.portal_catalog(portal_type="Department",id=dep_id)
+            allowed = set(('ClearanceOfficer', 'SectionManager'))
+            if len(res) != 1:
+                break
+            context_obj = res[0].getObject()
+        dynamic_roles = set(self.getRolesInContext(context_obj))
+        intersect = dynamic_roles & allowed
+        if intersect:
+            roles.extend(list(intersect))
         break
     return roles
Index: WAeUP_SRP/branches/uli/ScratchCards.py
===================================================================
--- WAeUP_SRP/branches/uli/ScratchCards.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/ScratchCards.py	(revision 1593)
@@ -37,5 +37,5 @@
         """import PinBatch"""
         name = "PINS"
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Students.ScratchCardBatchesFolder.importPinBatch')
         logger.info('Start loading from %s.csv' % name)
         pins_section = self.portal_url.getPortalObject().campus.pins
@@ -66,5 +66,5 @@
             dict['no_of_pins'] = n - 1
             batch.getContent().edit(mapping=dict)
-            logger.info('Added %s with %d Pins' % (bid,n-1))
+            logger.info('%s with %d PINs added' % (bid,n-1))
         return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
     ###)
@@ -140,5 +140,5 @@
             return unused[-max_pins:]
         return unused
-    
+
     security.declareProtected(View,"getUsedPins")
     def getUsedPins(self):
Index: WAeUP_SRP/branches/uli/Students.py
===================================================================
--- WAeUP_SRP/branches/uli/Students.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/Students.py	(revision 1593)
@@ -82,290 +82,5 @@
     security = ClassSecurityInfo()
 
-    security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsFromCSV")###(
-    def loadFullTimeStudentsFromCSV(self):
-        """load Fulltime Studentdata from CSV values"""
-        import transaction
-        import random
-        tr_count = 0
-        name = 'short_full_time'
-        no_import = False
-        if not no_import:
-            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
-            no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n')
-        logger = logging.getLogger('Import.%s' % name)
-        logger.info('Start loading from %s.csv' % name)
-        pwlist  = []
-        pwlist.append('"student_id","firstname","middlename","lastname","matric_no","jamb_reg_no","access_code"')
-        pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$matric_no","$jamb_reg_no","$access_code"')
-        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
-        try:
-            students = 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': "StudentClearance",})
-        matrics = []
-        for s in l:
-            matrics.append(s.getObject().getContent().matric_no)
-        print matrics
-        l = self.portal_catalog({'meta_type': "Certificate"})
-        certs = {}
-        for c in l:
-            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)
-            sid = student.get('MatricNo')
-            if sid == "":
-                em = 'Empty MatricNo\n'
-                logger.info(em)
-                no_import.write(em)
-                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
-            certcode = makeCertificateCode(student.get('CourseMajor'))
-            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)
-                no_import.write(em)
-                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:
-                int(level)
-            except:
-                em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student
-                logger.info(em)
-                no_import.write(em)
-                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
-            matric_no = student.get('MatricNo')
-            if matric_no not in matrics:
-                matrics.append(matric_no)
-                sid = self.generateStudentId(student.get('Lastname')[0])
-                #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
-                students_folder.invokeFactory('Student', sid)
-                logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars())
-                student_obj = getattr(self,sid)
-                access_code = "%d" % random.randint(1000000000,9999999999)
-                student_obj.getContent().makeStudentMember(sid,access_code,)
-                pwl_dict = {'student_id': sid,'access_code':access_code}
-                student_obj.invokeFactory('StudentApplication','application')
-                application = student_obj.application
-                da = {'Title': 'Application Data'}
-                student_obj.invokeFactory('StudentPersonal','personal')
-                da['jamb_reg_no'] = student.get('EntryRegNo')
-                personal = student_obj.personal
-                dp = {'Title': 'Personal Data'}
-                student_obj.invokeFactory('StudentClearance','clearance')
-                clearance = student_obj.clearance
-                dc = {'Title': 'Clearance/Eligibility Record'}
-                dc['matric_no'] = matric_no
-                state = student.get('State')
-                lga = student.get('LGA')
-                if state and lga:
-                    lga =  state + ' / ' + lga
-                else:
-                    lga = "None"
-                dc['lga'] = lga
-                dc['nationality'] = student.get('Nationality')
-                dc['email'] = student.get('Emailaddress')
-                dp['firstname'] = student.get('FirstName')
-                dp['middlename'] = student.get('MiddleName')
-                dp['lastname'] = student.get('Lastname')
-                dp['former_surname'] = student.get('FormerSurname')
-                dp['sex'] = student.get('Sex') == 'F'
-                dp['perm_address'] = student.get('PermanentAddress')
-                dp['perm_city'] = student.get('PermanentAddressCity')
-                dp['campus_address'] = student.get('CampusAddress')
-                dp['phone'] = student.get('PhoneNumber')
-                application.getContent().edit(mapping=da)
-                personal.getContent().edit(mapping=dp)
-                clearance.getContent().edit(mapping=dc)
-                #
-                # Study Course
-                #
-                student_obj.invokeFactory('StudentStudyCourse','study_course')
-                studycourse = student_obj.study_course
-                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
-                css = student.get('CurrentSession') or '2004-2005'
-                cs = int(css.split('-')[0]) - 2000
-                cl = int(student.get('StudentLevel') or '100')/100
-                dsc['entry_session'] = "200%s" % (cs - cl)
-                dsc['clr_ac_pin'] = access_code
-                studycourse.getContent().edit(mapping=dsc)
-                #
-                # Level
-                #
-##                l = getattr(studycourse,level,None)
-##                if 0 and l is None:
-##                    #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
-##                    logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student)
-##                    studycourse.invokeFactory('StudentStudyLevel', level)
-##                    l = getattr(studycourse, level)
-##                    certificate = certs[certcode]
-##                    cert_level = getattr(certificate,level,None)
-##                    if cert_level is None:
-##                        logger.info('Level %(level)s not in %(certcode)s' % vars())
-##                    l.getContent().edit(mapping={'Title': "Level %s" % level})
-            else:
-                em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student
-                logger.info(em)
-                no_import.write(em)
-                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
-            if tr_count > MAX_TRANS:
-                transaction.commit()
-                em = 'Transaction commited\n' % student
-                logger.info(em)
-                tr_count = 0
-            tr_count += 1
-            pwl_dict.update(dc)
-            pwl_dict.update(da)
-            pwl_dict.update(dp)
-            wftool = self.portal_workflow
-            pwlist.append(pwl_template.substitute(pwl_dict))
-            wftool.doActionFor(student_obj,'clear_and_validate')
-            student_obj.manage_setLocalRoles(sid, ['Owner',])
-            wftool.doActionFor(application,'close')
-            application.manage_setLocalRoles(sid, ['Owner',])
-            wftool.doActionFor(clearance,'close')
-            clearance.manage_setLocalRoles(sid, ['Owner',])
-            wftool.doActionFor(personal,'close')
-            personal.manage_setLocalRoles(sid, ['Owner',])
-            wftool.doActionFor(studycourse,'close_for_edit')
-            studycourse.manage_setLocalRoles(sid, ['Owner',])
-        open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-    ###)
-
-    security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###(
-    def loadPumeResultsFromCSV(self):
-        """load Fulltime Studentdata from CSV values into pumeresults catalog"""
-        import transaction
-        import random
-##        csv_d = {'jamb_reg_no': "RegNumber", ###(
-##                 'status': "Admission Status",
-##                 'name': "Name",
-##                 'score': "Score",
-##                 'sex': "Sex",
-##                 'faculty': "Faculty",
-##                 'department': "Dept",
-##                 'course': "Course",
-##                 'course_code_org': "Course Code",
-##                 }
-###)
-        csv_d = {'jamb_reg_no': "JAMBRegno",
-                 'name': "Name",
-                 'score': "Score",
-                 'sex': "Sex",
-                 'course': "Course",
-                 'faculty': "Faculty",
-                 'department': "Dept",
-                 'course_code_org': "Course Code",
-                 'status': "Admission Status",
-                 'result_type': None,
-                 }
-        csv_fields = [f[1] for f in csv_d.items() if f[1]]
-        tr_count = 0
-        total = 0
-        #name = 'pup_new'
-        name = 'pup_update'
-        update = name.endswith('update')
-        no_import = []
-        ok_import = []
-        ok_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_d.keys()]))
-        no_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_fields]))
-        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
-        ok_import_name = "%s/import/%s_imported_%s.csv" % (i_home,name,current)
-        #open(ok_import_name,"w").write('\n'.join(no_import))
-        no_import_name = "%s/import/%s_not_imported_%s.csv" % (i_home,name,current)
-        #open(no_import_name,"w").write('\n'.join(no_import))
-        logger = logging.getLogger('Import.%s' % name)
-        starttime = DateTime.now()
-        logger.info('Start loading from %s.csv' % name)
-        try:
-            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
-        except:
-            logger.error('Error reading %s.csv' % name)
-            return
-        pume = self.portal_pumeresults
-        format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields])
-        import_format = ','.join(['"%%(%s)s"' % fn for fn in csv_d.keys()])
-        eduplicate = '%s,"duplicate"' % format
-        einvalidjamb = '%s,"invalid JambRegNo"' % format
-        added = 'added ,%s' % format
-        #from pdb import set_trace;set_trace()
-        for jamb in result:
-            dict = {}
-            for f,fn in csv_d.items():
-                dict[f] = jamb.get(csv_d[f])
-            dict['result_type'] = 'DE'
-            jnr = jamb.get(csv_d['jamb_reg_no'])
-            if not checkJambNo(jnr):
-                logger.info(einvalidjamb % jamb)
-                dd = {}
-                for f,fn in csv_d.items():
-                    dd[fn] = getattr(data,f)
-                    no_import.append(eduplicate % dd)
-                    no_import.append(eduplicate % jamb)
-                continue
-            res = pume(jamb_reg_no=jnr)
-            if len(res) > 0:
-                if update:
-                    try:
-                        pume.modifyRecord(**dict)
-                    except ValueError:
-                        logger.info(eduplicate % jamb)
-                        continue
-                    except KeyError:
-                        pume.addRecord(**dict)
-                        logger.info(added % jamb)
-                        continue
-                else:
-                    data = res[0]
-                    if data.name != jamb.get(csv_d['name']):
-                        #set_trace()
-                        logger.info(eduplicate % jamb)
-                        #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict
-                        #logger.info(em)
-                        dd = {}
-                        for f,fn in csv_d.items():
-                            dd[fn] = getattr(data,f)
-                        no_import.append(eduplicate % dd)
-                        no_import.append(eduplicate % jamb)
-                    continue
-            try:
-                pume.addRecord(**dict)
-                ok_import.append(import_format % dict)
-            except ValueError:
-                logger.info(eduplicate % jamb)
-                #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict
-                #logger.info(em)
-                no_import.append(eduplicate % jamb)
-        logger.info('End loading from %s.csv' % name)
-        if len(no_import) > 1:
-            open(no_import_name,"w+").write('\n'.join(no_import))
-        open(ok_import_name,"w+").write('\n'.join(ok_import))
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-    ###)
+
 
     security.declareProtected(ModifyPortalContent,"createDEStudents")###(
@@ -405,6 +120,6 @@
         no_certificate = "no certificate %s" % format
         open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write('\n'.join(no_import))
-        logger = logging.getLogger('Import.%s' % name)
-        logger.info('start loading from %s.csv' % name)
+        logger = logging.getLogger('Students.StudentsFolder.createDEStudents')
+        logger.info('Start loading from %s.csv' % name)
         l = self.portal_catalog({'meta_type': "Certificate"})
         certs = {}
@@ -418,5 +133,5 @@
             return
         for jamb in result:
-            jamb['Error'] = "Processing "
+            jamb['Error'] = "Processing"
             logger.info(format % jamb)
             jamb_reg_no = jamb.get(csv_d['jamb_reg_no'])
@@ -624,6 +339,6 @@
         no_certificate = "no certificate %s" % format
         open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write('\n'.join(no_import))
-        logger = logging.getLogger('Import.%s' % name)
-        logger.info('start loading from %s.csv' % name)
+        logger = logging.getLogger('Students.StudentsFolder.createNewStudents')
+        logger.info('Start loading from %s.csv' % name)
         l = self.portal_catalog({'meta_type': "Certificate"})
         certs = {}
@@ -829,5 +544,5 @@
         no_import = []
         imported = []
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Students.StudentsFolder.importReturningStudents')
         try:
             returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -849,5 +564,5 @@
             if start:
                 start = False
-                logger.info('start loading from %s.csv' % name)
+                logger.info('Start loading from %s.csv' % name)
                 s = ','.join(['"%s"' % fn for fn in student.keys()])
                 imported.append(s)
@@ -922,5 +637,6 @@
         for k,v in verdicts_voc.items():
             rverdicts[v.upper()] = k
-        logger = logging.getLogger('fixVerdicts')
+        rverdicts['STUDENT ON PROBATION'] = 'C'
+        logger = logging.getLogger('Students.StudentsFolder.fixVerdicts')
         try:
             verdicts = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -933,5 +649,5 @@
             if start:
                 start = False
-                logger.info('start loading from %s.csv' % name)
+                logger.info('Start loading from %s.csv' % name)
                 s = ','.join(['"%s"' % fn for fn in verdict.keys()])
                 no_import.append('%s,"Error"' % s)
@@ -957,14 +673,14 @@
                         no_import.append( format_error % verdict)
                         continue
-                try:
-                    st_cat.modifyRecord(id = student_id,
+                st_cat.modifyRecord(id = student_id,
                                     verdict=verdict_code)
-                except KeyError:
-                    student['Error'] = "Not found in students_catalog"
-                    no_import.append( format_error % student)
-                    continue
+
                 dsc = {}
                 dsc['current_verdict'] = verdict_code
                 study_course.getContent().edit(mapping=dsc)
+            else:
+                verdict['Error'] = "Not found in students_catalog"
+                no_import.append( format_error % verdict)
+                continue
             tr_count += 1
             if tr_count > 1000:
@@ -1017,5 +733,5 @@
         st_cat = self.students_catalog
         no_import = []
-        logger = logging.getLogger('getEntryMode.%s' % name)
+        logger = logging.getLogger('Students.StudentsFolder.fixEntryModeForReturning')
         try:
             returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -1027,5 +743,5 @@
             if start:
                 start = False
-                logger.info('start loading from %s.csv' % name)
+                logger.info('Start loading from %s.csv' % name)
                 s = ','.join(['"%s"' % fn for fn in student.keys()])
                 no_import.append('%s,"Error"' % s)
@@ -1120,5 +836,5 @@
         no_import = []
         imported = []
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Students.StudentsFolder.updateReturningStudents')
         try:
             returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -1139,5 +855,5 @@
             if start:
                 start = False
-                logger.info('start loading from %s.csv' % name)
+                logger.info('Start loading from %s.csv' % name)
                 s = ','.join(['"%s"' % fn for fn in student.keys()])
                 imported.append(s)
@@ -1214,5 +930,5 @@
         no_import = []
         imported = []
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Students.StudentsFolder.importResults')
         try:
             results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
@@ -1233,5 +949,5 @@
             if start:
                 start = False
-                logger.info('start loading from %s.csv' % name)
+                logger.info('Start loading from %s.csv' % name)
                 s = ','.join(['"%s"' % fn for fn in result.keys()])
                 imported.append(s)
@@ -1339,5 +1055,5 @@
         open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write(
                     '\n'.join(no_import))
-        logger = logging.getLogger('Import.%s' % name)
+        logger = logging.getLogger('Students.StudentsFolder.updateStudyCourse')
         logger.info('Start loading from %s.csv' % name)
         l = self.portal_catalog({'meta_type': "Certificate"})
@@ -1354,7 +1070,7 @@
                                      'SearchableText': jamb_reg_no })
             if not res:
-                em = 'Student with RegNo %s does not exists\n' % jamb_reg_no
+                em = 'Student with jamb_reg_no %s does not exists\n' % jamb_reg_no
                 logger.info(em)
-                jamb['Error'] = "Student not exists"
+                jamb['Error'] = "Student does not exist"
                 no_import.append(format % jamb)
                 continue
@@ -1398,363 +1114,6 @@
     ###)
 
-    security.declareProtected(ModifyPortalContent,"OLDloadPumeResultsFromCSV")###(
-    def OLDloadPumeResultsFromCSV(self):
-        """load Fulltime Studentdata from CSV values"""
-        import transaction
-        import random
-        wftool = self.portal_workflow
-        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
-        csv_d = {'jamb_reg_no': "JAMBRegno",
-                 'jamb_lastname': "Name",
-                 'pume_options': "Options",
-                 'session': "Session",
-                 'days': "Days",
-                 'response': "Responce",
-                 'wrong': "Wrong",
-                 'pume_eng_score': "EngScore",
-                 'pume_gen_score': "GenScore",
-                 'pume_tot_score': "Score",
-                 'batch': "Batch",
-                 'serial': "SerialNo",
-                 'jamb_score': "JambScore",
-                 'omitted':"Omitted",
-                 'search_key': "SearchKey",
-                 'jamb_sex': "Sex",
-                 'fac1': "Fac1",
-                 'fac2': "Fac2",
-                 'jamb_first_cos': "CourseofStudy",
-                 'stud_status':"StudStatus",
-                 'registered': "Registered",
-                 'jamb_state': "State",
-                 'eng_fail': "EngFail",
-                 'gen_fail': "GenFail",
-                 'un_ans_eng': "UnAnsEng",
-                 'un_ans_eng': "UnAnsGen",
-                 'total_ans': "TotalUnAns",
-                 'dept': "Dept",
-                 'jamb_second_cos': "Course2",
-                 'jamb_third_cos': "course3",
-                 }
-        csv_fields = [f[1] for f in csv_d.items()]
-        tr_count = 0
-        name = 'pume_results'
-        no_import = []
-        s = ','.join(['"%s"' % fn for fn in csv_fields])
-        no_import.append('%s\n' % s)
-        logger = logging.getLogger('Import.%s' % name)
-        logger.info('Start loading from %s.csv' % name)
-        try:
-            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
-        except:
-            logger.error('Error reading %s.csv' % name)
-            return
-        for jamb in result:
-            format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields])
-            processing = "processing %s" % format
-            logger.info(processing % jamb)
-            jamb_reg_no = jamb.get(csv_d['jamb_reg_no'])
-            #import pdb;pdb.set_trace()
-            res = self.portal_catalog({'portal_type': "StudentApplication",
-                                     'jamb_reg_no': jamb_reg_no })
-            if res:
-                em = 'Student with REG-NO %s already exists\n' % jamb_reg_no
-                logger.info(em)
-                no_import.append(em)
-                no_import.append(format % jamb)
-                continue
-            cert_id = jamb.get(csv_d['jamb_first_cos']).upper()
-            res = self.portal_catalog({'portal_type': "Certificate",
-                                     'id': cert_id })
-            if len(res) < 1:
-                em = 'No Certificate with ID %s \n' % cert_id
-                logger.info(em)
-                no_import.append(em)
-                no_import.append(format % jamb)
-                continue
-            cert = res[0].getObject()
-            cert_path = res[0].getPath()
-            cert_doc = cert.getContent()
-            jamb_name = jamb.get(csv_d['jamb_lastname'])
-            jamb_name.replace('>','')
-            names = jamb_name.split()
-            letter = names[-1][0].upper()
-            sid = self.generateStudentId(letter)
-            not_created = True
-            while not_created:
-                try:
-                    students_folder.invokeFactory('Student', sid)
-                    not_created = False
-                except BadRequest:
-                    sid = self.generateStudentId(letter)
-            logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars())
-            student = getattr(self,sid)
-            student.manage_setLocalRoles(sid, ['Owner',])
-            student.invokeFactory('StudentClearance','clearance')
-            #wftool.doActionFor(student.clearance,'open')
-            dp = {'Title': 'Clearance/Eligibility Record'}
-            student.clearance.manage_setLocalRoles(sid, ['Owner',])
-            student.invokeFactory('StudentPume','pume')
-            dp = {'Title': 'Pume Data'}
-            student.invokeFactory('StudentApplication','application')
-            da = {'Title': 'Application Data'}
-            da["jamb_lastname"] = jamb_name
-            da_fields = ('jamb_reg_no',
-                         'jamb_sex',
-                         'jamb_state',
-                         'jamb_score',
-                         'jamb_first_cos',
-                         'jamb_sex',
-                         'jamb_state',
-                         'jamb_first_cos',
-                         'jamb_second_cos',
-                         )
-            for f in da_fields:
-                da[f] = jamb.get(csv_d[f])
-            app = student.application
-            app.getContent().edit(mapping=da)
-            app.manage_setLocalRoles(sid, ['Owner',])
-            #wftool.doActionFor(app,'close')
-            dp_fields = (
-                         'pume_eng_score',
-                         'pume_gen_score',
-                         'pume_tot_score',
-                         )
-            for f in dp_fields:
-                dp[f] = float(jamb.get(csv_d[f]))
-            pume = student.pume
-            pume.getContent().edit(mapping=dp)
-            #wftool.doActionFor(pume,'close')
-            pume.manage_setLocalRoles(sid, ['Owner',])
-            #
-            # Study Course
-            #
-            student.invokeFactory('StudentStudyCourse','study_course')
-            study_course = student.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(cert_doc,f)
-            cpl = cert_path.split('/')
-            dsc['faculty'] = cpl[-4]
-            dsc['department'] = cpl[-3]
-            dsc['study_course'] = cert_id
-            dsc['entry_session'] = jamb.get(csv_d['session'])
-            study_course.getContent().edit(mapping=dsc)
-            student.getContent().createSubObjects()
-            if dp['pume_tot_score']>49:
-                wftool.doActionFor(student,'pume_pass')
-                wftool.doActionFor(student,'admit')
-            else:
-                wftool.doActionFor(student,'pume_fail')
-                wftool.doActionFor(student,'reject_admission')
-            if len(no_import) > 1:
-                open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write(
-                     '\n'.join(no_import))
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-    ###)
-
-    security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") ###(
-    def loadFullTimeStudentsResultsFromCSV(self):
-        """load Fulltime Studentdata from CSV values"""
-        #return
-        level_wf_actions = {}
-        level_wf_actions["SUCCESSFUL STUDENT"] = "pass_A"
-        level_wf_actions["STUDENT WITH CARRYOVER COURSES"] = "pass_B"
-        level_wf_actions["STUDENT FOR PROBATION"] = "probate_C"
-        level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "reject_D"
-        import transaction
-        wftool = self.portal_workflow
-        tr_count = 0
-        name = 'short_full_time_results_2004_2005'
-        no_import = False
-        if not no_import:
-            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
-            no_import.write('"Matnumber","CosCode","Ansbook","CosStuatus","Session","Mat_Cos","Score","CarryLevel","Grade","Weight","Semster","Verdict","Level","id","GPA"\n')
-        logger = logging.getLogger('import.%s' % name)
-        logger.info('Start loading from %s.csv' % name)
-        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
-        try:
-            results = 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': "Course"})
-        courses = {}
-        for c in l:
-            courses[c.id] = c.getObject()
-        level_changed = False
-        student_changed = False
-        sid = ''
-        #import pdb;pdb.set_trace()
-        for result in results:
-            temp_sid = result.get('Matnumber')
-            if temp_sid != sid:
-                student_changed = True
-                res = self.portal_catalog({'meta_type': "StudentClearance",
-                                         'SearchableText': temp_sid })
-                if not res:
-                    em = 'Student with ID %(Matnumber)s not found\n' % result
-                    logger.info(em)
-                    no_import.write(em)
-                    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
-                elif len(res) > 1:
-                    em = 'More than one Student with ID %(Matnumber)s found\n' % result
-                    logger.info(em)
-                    no_import.write(em)
-                    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
-                sid = temp_sid
-                sf = res[0].getObject().aq_parent
-                sc = getattr(sf,'study_course')
-                level = ''
-            else:
-                student_changed = False
-            course = result.get('CosCode')
-            if course not in courses.keys():
-                em = 'Course with ID %(CosCode)s not found\n' % result
-                logger.info(em)
-                no_import.write(em)
-                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')
-            student_id = sf.getId()
-            result['StudentId'] = student_id
-            if temp_level != level:
-                try:
-                    int(temp_level)
-                except:
-                    em = 'Result with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % result
-                    logger.info(em)
-                    no_import.write(em)
-                    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
-                level_changed = True
-                if 'dlev' in vars().keys():
-                    wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
-                level = temp_level
-                l = getattr(sc,level,None)
-                if l is None:
-                    logger.info('Creating Level %(Level)s for %(StudentId)s %(Matnumber)s' % result)
-                    sc.invokeFactory('StudentStudyLevel', level)
-                    l = getattr(sc, level)
-                    l.manage_setLocalRoles(student_id, ['Owner',])
-            else:
-                level_changed = False
-            cr = getattr(l,course,None)
-            if cr is None:
-                logger.info('Creating Course %(CosCode)s for %(StudentId)s %(Matnumber)s in Level %(Level)s' % result)
-                l.invokeFactory('StudentCourseResult',course)
-            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')
-            dcr['semester'] = getInt(result.get('Semster'))
-            dcr['status'] = result.get('CosStuatus')
-            dcr['score'] = getInt(result.get('Score'))
-            dlev['session'] = result.get('Session')
-            dcr['carry_level'] = result.get('CarryLevel')
-            dcr['grade'] = result.get('Grade')
-            dcr['weight'] = result.get('Weight')
-            dlev['verdict'] = result.get('Verdict')
-            dcr['import_id'] = result.get('id')
-            gpa = result.get('GPA').replace(',','.')
-            dlev['imported_gpa'] = getFloat(gpa)
-            cr.getContent().edit(mapping = dcr)
-            cr.manage_setLocalRoles(student_id, ['Owner',])
-            l.getContent().edit(mapping = dlev)
-            if tr_count > MAX_TRANS:
-                transaction.commit()
-                tr_count = 0
-            tr_count += 1
-            wftool.doActionFor(cr,'close')
-        wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-
-###)
-
-    security.declareProtected(ModifyPortalContent,"loadJAMBFromCSV")###(
-    def loadJAMBFromCSV(self):
-        """load JAMB data from CSV values"""
-        #return
-        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
-        import transaction
-        tr_count = 0
-        name = 'SampleJAMBDataII'
-        wftool = self.portal_workflow
-        no_import = False
-        if not no_import:
-            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
-            no_import.write('REG-NO,NAME,SEX,STATE,LGA,ENG-SCORE,SUBJ1,SUBJ1-SCORE,SUBJ2,SUBJ2-SCORE,SUBJ3,SUBJ3-SCORE,AGGREGATE,UNIV1,FACULTY1,COURSE1,UNIV2,FACULTY2,COURSE2')
-        logger = logging.getLogger('Import.%s' % name)
-        logger.info('Start loading from %s.csv' % name)
-        try:
-            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
-        except:
-            logger.error('Error reading %s.csv' % name)
-            return
-        for jamb in result:
-            logger.info('processing %(REG-NO)s,%(NAME)s,%(SEX)s,%(STATE)s,%(LGA)s,%(ENG-SCORE)s,%(SUBJ1)s,%(SUBJ1-SCORE)s,%(SUBJ2)s,%(SUBJ2-SCORE)s,%(SUBJ3)s,%(SUBJ3-SCORE)s,%(AGGREGATE)s,%(UNIV1)s,%(FACULTY1)s,%(COURSE1)s,%(UNIV2)s,%(FACULTY2)s,%(COURSE2)s\n' % jamb)
-            jamb_reg_no = jamb.get('REG-NO')
-            res = self.portal_catalog({'meta_type': "StudentApplication",
-                                     'jamb_reg_no': jamb_reg_no })
-            if res:
-                em = 'Student with REG-NO %(REG-NO)s already exists\n' % jamb
-                logger.info(em)
-                no_import.write(em)
-                no_import.write('%(REG-NO)s,%(NAME)s,%(SEX)s,%(STATE)s,%(LGA)s,%(ENG-SCORE)s,%(SUBJ1)s,%(SUBJ1-SCORE)s,%(SUBJ2)s,%(SUBJ2-SCORE)s,%(SUBJ3)s,%(SUBJ3-SCORE)s,%(AGGREGATE)s,%(UNIV1)s,%(FACULTY1)s,%(COURSE1)s,%(UNIV2)s,%(FACULTY2)s,%(COURSE2)s\n' % jamb)
-                continue
-            jamb_name = jamb.get("NAME")
-            jamb_name.replace('>','')
-            names = jamb_name.split()
-            letter = names[-1][0].upper()
-            sid = self.generateStudentId(letter)
-            not_created = True
-            while not_created:
-                try:
-                    students_folder.invokeFactory('Student', sid)
-                    not_created = False
-                except BadRequest:
-                    sid = self.generateStudentId(letter)
-            logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars())
-            student = getattr(self,sid)
-            student.manage_setLocalRoles(sid, ['Owner',])
-            student.invokeFactory('StudentApplication','application')
-            da = {'Title': 'Application Data'}
-            da["jamb_reg_no"] = jamb.get("REG-NO")
-            da["jamb_lastname"] = jamb_name
-            da["jamb_sex"] = jamb.get("SEX")
-            da["jamb_state"] = jamb.get("STATE")
-            da["jamb_lga"] = jamb.get("LGA")
-            da["jamb_score"] = jamb.get("AGGREGATE")
-            da["jamb_first_cos"] = jamb.get("COURSE1")
-            da["jamb_second_cos"] = jamb.get("COURSE2")
-            da["jamb_first_uni"] = jamb.get("UNIV1")
-            da["jamb_second_uni"] = jamb.get("UNIV2")
-            app = student.application
-            app_doc = app.getContent()
-            app_doc.edit(mapping=da)
-            #wftool.doActionFor(app,'open',dest_container=app)
-            app.manage_setLocalRoles(sid, ['Owner',])
-            student.getContent().createSubObjects()
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
-    ###)
-
- 
+
+
     security.declareProtected(View,"fixOwnership")
     def fixOwnership(self):
Index: WAeUP_SRP/branches/uli/Students.unused_methods.txt
===================================================================
--- WAeUP_SRP/branches/uli/Students.unused_methods.txt	(revision 1593)
+++ WAeUP_SRP/branches/uli/Students.unused_methods.txt	(revision 1593)
@@ -0,0 +1,645 @@
+    security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsFromCSV")###(
+    def loadFullTimeStudentsFromCSV(self):
+        """load Fulltime Studentdata from CSV values"""
+        import transaction
+        import random
+        tr_count = 0
+        name = 'short_full_time'
+        no_import = False
+        if not no_import:
+            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+            no_import.write('"MatricNo","EntryRegNo","CurrentSession","StudentLevel","fullname","FirstName","MiddleName","Lastname","FormerSurname","Sex","Nationality","State","LGA","PermanentAddress","PermanentAddressCity","CampusAddress","PhoneNumber","Emailaddress","Mode","CourseMajor","Faculty","Dept"\n')
+        logger = logging.getLogger('Import.%s' % name)
+        logger.info('Start loading from %s.csv' % name)
+        pwlist  = []
+        pwlist.append('"student_id","firstname","middlename","lastname","matric_no","jamb_reg_no","access_code"')
+        pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$matric_no","$jamb_reg_no","$access_code"')
+        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
+        try:
+            students = 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': "StudentClearance",})
+        matrics = []
+        for s in l:
+            matrics.append(s.getObject().getContent().matric_no)
+        print matrics
+        l = self.portal_catalog({'meta_type': "Certificate"})
+        certs = {}
+        for c in l:
+            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)
+            sid = student.get('MatricNo')
+            if sid == "":
+                em = 'Empty MatricNo\n'
+                logger.info(em)
+                no_import.write(em)
+                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
+            certcode = makeCertificateCode(student.get('CourseMajor'))
+            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)
+                no_import.write(em)
+                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:
+                int(level)
+            except:
+                em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student
+                logger.info(em)
+                no_import.write(em)
+                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
+            matric_no = student.get('MatricNo')
+            if matric_no not in matrics:
+                matrics.append(matric_no)
+                sid = self.generateStudentId(student.get('Lastname')[0])
+                #self.log('Creating Faculty %(id)s = %(Title)s' % faculty)
+                students_folder.invokeFactory('Student', sid)
+                logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars())
+                student_obj = getattr(self,sid)
+                access_code = "%d" % random.randint(1000000000,9999999999)
+                student_obj.getContent().makeStudentMember(sid,access_code,)
+                pwl_dict = {'student_id': sid,'access_code':access_code}
+                student_obj.invokeFactory('StudentApplication','application')
+                application = student_obj.application
+                da = {'Title': 'Application Data'}
+                student_obj.invokeFactory('StudentPersonal','personal')
+                da['jamb_reg_no'] = student.get('EntryRegNo')
+                personal = student_obj.personal
+                dp = {'Title': 'Personal Data'}
+                student_obj.invokeFactory('StudentClearance','clearance')
+                clearance = student_obj.clearance
+                dc = {'Title': 'Clearance/Eligibility Record'}
+                dc['matric_no'] = matric_no
+                state = student.get('State')
+                lga = student.get('LGA')
+                if state and lga:
+                    lga =  state + ' / ' + lga
+                else:
+                    lga = "None"
+                dc['lga'] = lga
+                dc['nationality'] = student.get('Nationality')
+                dc['email'] = student.get('Emailaddress')
+                dp['firstname'] = student.get('FirstName')
+                dp['middlename'] = student.get('MiddleName')
+                dp['lastname'] = student.get('Lastname')
+                dp['former_surname'] = student.get('FormerSurname')
+                dp['sex'] = student.get('Sex') == 'F'
+                dp['perm_address'] = student.get('PermanentAddress')
+                dp['perm_city'] = student.get('PermanentAddressCity')
+                dp['campus_address'] = student.get('CampusAddress')
+                dp['phone'] = student.get('PhoneNumber')
+                application.getContent().edit(mapping=da)
+                personal.getContent().edit(mapping=dp)
+                clearance.getContent().edit(mapping=dc)
+                #
+                # Study Course
+                #
+                student_obj.invokeFactory('StudentStudyCourse','study_course')
+                studycourse = student_obj.study_course
+                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
+                css = student.get('CurrentSession') or '2004-2005'
+                cs = int(css.split('-')[0]) - 2000
+                cl = int(student.get('StudentLevel') or '100')/100
+                dsc['entry_session'] = "200%s" % (cs - cl)
+                dsc['clr_ac_pin'] = access_code
+                studycourse.getContent().edit(mapping=dsc)
+                #
+                # Level
+                #
+##                l = getattr(studycourse,level,None)
+##                if 0 and l is None:
+##                    #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep)
+##                    logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student)
+##                    studycourse.invokeFactory('StudentStudyLevel', level)
+##                    l = getattr(studycourse, level)
+##                    certificate = certs[certcode]
+##                    cert_level = getattr(certificate,level,None)
+##                    if cert_level is None:
+##                        logger.info('Level %(level)s not in %(certcode)s' % vars())
+##                    l.getContent().edit(mapping={'Title': "Level %s" % level})
+            else:
+                em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student
+                logger.info(em)
+                no_import.write(em)
+                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
+            if tr_count > MAX_TRANS:
+                transaction.commit()
+                em = 'Transaction commited\n' % student
+                logger.info(em)
+                tr_count = 0
+            tr_count += 1
+            pwl_dict.update(dc)
+            pwl_dict.update(da)
+            pwl_dict.update(dp)
+            wftool = self.portal_workflow
+            pwlist.append(pwl_template.substitute(pwl_dict))
+            wftool.doActionFor(student_obj,'clear_and_validate')
+            student_obj.manage_setLocalRoles(sid, ['Owner',])
+            wftool.doActionFor(application,'close')
+            application.manage_setLocalRoles(sid, ['Owner',])
+            wftool.doActionFor(clearance,'close')
+            clearance.manage_setLocalRoles(sid, ['Owner',])
+            wftool.doActionFor(personal,'close')
+            personal.manage_setLocalRoles(sid, ['Owner',])
+            wftool.doActionFor(studycourse,'close_for_edit')
+            studycourse.manage_setLocalRoles(sid, ['Owner',])
+        open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist))
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###(
+    def loadPumeResultsFromCSV(self):
+        """load Fulltime Studentdata from CSV values into pumeresults catalog"""
+        import transaction
+        import random
+##        csv_d = {'jamb_reg_no': "RegNumber", ###(
+##                 'status': "Admission Status",
+##                 'name': "Name",
+##                 'score': "Score",
+##                 'sex': "Sex",
+##                 'faculty': "Faculty",
+##                 'department': "Dept",
+##                 'course': "Course",
+##                 'course_code_org': "Course Code",
+##                 }
+###)
+        csv_d = {'jamb_reg_no': "JAMBRegno",
+                 'name': "Name",
+                 'score': "Score",
+                 'sex': "Sex",
+                 'course': "Course",
+                 'faculty': "Faculty",
+                 'department': "Dept",
+                 'course_code_org': "Course Code",
+                 'status': "Admission Status",
+                 'result_type': None,
+                 }
+        csv_fields = [f[1] for f in csv_d.items() if f[1]]
+        tr_count = 0
+        total = 0
+        #name = 'pup_new'
+        name = 'pup_update'
+        update = name.endswith('update')
+        no_import = []
+        ok_import = []
+        ok_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_d.keys()]))
+        no_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_fields]))
+        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
+        ok_import_name = "%s/import/%s_imported_%s.csv" % (i_home,name,current)
+        #open(ok_import_name,"w").write('\n'.join(no_import))
+        no_import_name = "%s/import/%s_not_imported_%s.csv" % (i_home,name,current)
+        #open(no_import_name,"w").write('\n'.join(no_import))
+        logger = logging.getLogger('Import.%s' % name)
+        starttime = DateTime.now()
+        logger.info('Start loading from %s.csv' % name)
+        try:
+            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        pume = self.portal_pumeresults
+        format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields])
+        import_format = ','.join(['"%%(%s)s"' % fn for fn in csv_d.keys()])
+        eduplicate = '%s,"duplicate"' % format
+        einvalidjamb = '%s,"invalid JambRegNo"' % format
+        added = 'added ,%s' % format
+        #from pdb import set_trace;set_trace()
+        for jamb in result:
+            dict = {}
+            for f,fn in csv_d.items():
+                dict[f] = jamb.get(csv_d[f])
+            dict['result_type'] = 'DE'
+            jnr = jamb.get(csv_d['jamb_reg_no'])
+            if not checkJambNo(jnr):
+                logger.info(einvalidjamb % jamb)
+                dd = {}
+                for f,fn in csv_d.items():
+                    dd[fn] = getattr(data,f)
+                    no_import.append(eduplicate % dd)
+                    no_import.append(eduplicate % jamb)
+                continue
+            res = pume(jamb_reg_no=jnr)
+            if len(res) > 0:
+                if update:
+                    try:
+                        pume.modifyRecord(**dict)
+                    except ValueError:
+                        logger.info(eduplicate % jamb)
+                        continue
+                    except KeyError:
+                        pume.addRecord(**dict)
+                        logger.info(added % jamb)
+                        continue
+                else:
+                    data = res[0]
+                    if data.name != jamb.get(csv_d['name']):
+                        #set_trace()
+                        logger.info(eduplicate % jamb)
+                        #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict
+                        #logger.info(em)
+                        dd = {}
+                        for f,fn in csv_d.items():
+                            dd[fn] = getattr(data,f)
+                        no_import.append(eduplicate % dd)
+                        no_import.append(eduplicate % jamb)
+                    continue
+            try:
+                pume.addRecord(**dict)
+                ok_import.append(import_format % dict)
+            except ValueError:
+                logger.info(eduplicate % jamb)
+                #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict
+                #logger.info(em)
+                no_import.append(eduplicate % jamb)
+        logger.info('End loading from %s.csv' % name)
+        if len(no_import) > 1:
+            open(no_import_name,"w+").write('\n'.join(no_import))
+        open(ok_import_name,"w+").write('\n'.join(ok_import))
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+
+    security.declareProtected(ModifyPortalContent,"OLDloadPumeResultsFromCSV")###(
+    def OLDloadPumeResultsFromCSV(self):
+        """load Fulltime Studentdata from CSV values"""
+        import transaction
+        import random
+        wftool = self.portal_workflow
+        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
+        csv_d = {'jamb_reg_no': "JAMBRegno",
+                 'jamb_lastname': "Name",
+                 'pume_options': "Options",
+                 'session': "Session",
+                 'days': "Days",
+                 'response': "Responce",
+                 'wrong': "Wrong",
+                 'pume_eng_score': "EngScore",
+                 'pume_gen_score': "GenScore",
+                 'pume_tot_score': "Score",
+                 'batch': "Batch",
+                 'serial': "SerialNo",
+                 'jamb_score': "JambScore",
+                 'omitted':"Omitted",
+                 'search_key': "SearchKey",
+                 'jamb_sex': "Sex",
+                 'fac1': "Fac1",
+                 'fac2': "Fac2",
+                 'jamb_first_cos': "CourseofStudy",
+                 'stud_status':"StudStatus",
+                 'registered': "Registered",
+                 'jamb_state': "State",
+                 'eng_fail': "EngFail",
+                 'gen_fail': "GenFail",
+                 'un_ans_eng': "UnAnsEng",
+                 'un_ans_eng': "UnAnsGen",
+                 'total_ans': "TotalUnAns",
+                 'dept': "Dept",
+                 'jamb_second_cos': "Course2",
+                 'jamb_third_cos': "course3",
+                 }
+        csv_fields = [f[1] for f in csv_d.items()]
+        tr_count = 0
+        name = 'pume_results'
+        no_import = []
+        s = ','.join(['"%s"' % fn for fn in csv_fields])
+        no_import.append('%s\n' % s)
+        logger = logging.getLogger('Import.%s' % name)
+        logger.info('Start loading from %s.csv' % name)
+        try:
+            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        for jamb in result:
+            format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields])
+            processing = "processing %s" % format
+            logger.info(processing % jamb)
+            jamb_reg_no = jamb.get(csv_d['jamb_reg_no'])
+            #import pdb;pdb.set_trace()
+            res = self.portal_catalog({'portal_type': "StudentApplication",
+                                     'jamb_reg_no': jamb_reg_no })
+            if res:
+                em = 'Student with REG-NO %s already exists\n' % jamb_reg_no
+                logger.info(em)
+                no_import.append(em)
+                no_import.append(format % jamb)
+                continue
+            cert_id = jamb.get(csv_d['jamb_first_cos']).upper()
+            res = self.portal_catalog({'portal_type': "Certificate",
+                                     'id': cert_id })
+            if len(res) < 1:
+                em = 'No Certificate with ID %s \n' % cert_id
+                logger.info(em)
+                no_import.append(em)
+                no_import.append(format % jamb)
+                continue
+            cert = res[0].getObject()
+            cert_path = res[0].getPath()
+            cert_doc = cert.getContent()
+            jamb_name = jamb.get(csv_d['jamb_lastname'])
+            jamb_name.replace('>','')
+            names = jamb_name.split()
+            letter = names[-1][0].upper()
+            sid = self.generateStudentId(letter)
+            not_created = True
+            while not_created:
+                try:
+                    students_folder.invokeFactory('Student', sid)
+                    not_created = False
+                except BadRequest:
+                    sid = self.generateStudentId(letter)
+            logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars())
+            student = getattr(self,sid)
+            student.manage_setLocalRoles(sid, ['Owner',])
+            student.invokeFactory('StudentClearance','clearance')
+            #wftool.doActionFor(student.clearance,'open')
+            dp = {'Title': 'Clearance/Eligibility Record'}
+            student.clearance.manage_setLocalRoles(sid, ['Owner',])
+            student.invokeFactory('StudentPume','pume')
+            dp = {'Title': 'Pume Data'}
+            student.invokeFactory('StudentApplication','application')
+            da = {'Title': 'Application Data'}
+            da["jamb_lastname"] = jamb_name
+            da_fields = ('jamb_reg_no',
+                         'jamb_sex',
+                         'jamb_state',
+                         'jamb_score',
+                         'jamb_first_cos',
+                         'jamb_sex',
+                         'jamb_state',
+                         'jamb_first_cos',
+                         'jamb_second_cos',
+                         )
+            for f in da_fields:
+                da[f] = jamb.get(csv_d[f])
+            app = student.application
+            app.getContent().edit(mapping=da)
+            app.manage_setLocalRoles(sid, ['Owner',])
+            #wftool.doActionFor(app,'close')
+            dp_fields = (
+                         'pume_eng_score',
+                         'pume_gen_score',
+                         'pume_tot_score',
+                         )
+            for f in dp_fields:
+                dp[f] = float(jamb.get(csv_d[f]))
+            pume = student.pume
+            pume.getContent().edit(mapping=dp)
+            #wftool.doActionFor(pume,'close')
+            pume.manage_setLocalRoles(sid, ['Owner',])
+            #
+            # Study Course
+            #
+            student.invokeFactory('StudentStudyCourse','study_course')
+            study_course = student.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(cert_doc,f)
+            cpl = cert_path.split('/')
+            dsc['faculty'] = cpl[-4]
+            dsc['department'] = cpl[-3]
+            dsc['study_course'] = cert_id
+            dsc['entry_session'] = jamb.get(csv_d['session'])
+            study_course.getContent().edit(mapping=dsc)
+            student.getContent().createSubObjects()
+            if dp['pume_tot_score']>49:
+                wftool.doActionFor(student,'pume_pass')
+                wftool.doActionFor(student,'admit')
+            else:
+                wftool.doActionFor(student,'pume_fail')
+                wftool.doActionFor(student,'reject_admission')
+            if len(no_import) > 1:
+                open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write(
+                     '\n'.join(no_import))
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
+
+    security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") ###(
+    def loadFullTimeStudentsResultsFromCSV(self):
+        """load Fulltime Studentdata from CSV values"""
+        #return
+        level_wf_actions = {}
+        level_wf_actions["SUCCESSFUL STUDENT"] = "pass_A"
+        level_wf_actions["STUDENT WITH CARRYOVER COURSES"] = "pass_B"
+        level_wf_actions["STUDENT FOR PROBATION"] = "probate_C"
+        level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "reject_D"
+        import transaction
+        wftool = self.portal_workflow
+        tr_count = 0
+        name = 'short_full_time_results_2004_2005'
+        no_import = False
+        if not no_import:
+            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+            no_import.write('"Matnumber","CosCode","Ansbook","CosStuatus","Session","Mat_Cos","Score","CarryLevel","Grade","Weight","Semster","Verdict","Level","id","GPA"\n')
+        logger = logging.getLogger('import.%s' % name)
+        logger.info('Start loading from %s.csv' % name)
+        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
+        try:
+            results = 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': "Course"})
+        courses = {}
+        for c in l:
+            courses[c.id] = c.getObject()
+        level_changed = False
+        student_changed = False
+        sid = ''
+        #import pdb;pdb.set_trace()
+        for result in results:
+            temp_sid = result.get('Matnumber')
+            if temp_sid != sid:
+                student_changed = True
+                res = self.portal_catalog({'meta_type': "StudentClearance",
+                                         'SearchableText': temp_sid })
+                if not res:
+                    em = 'Student with ID %(Matnumber)s not found\n' % result
+                    logger.info(em)
+                    no_import.write(em)
+                    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
+                elif len(res) > 1:
+                    em = 'More than one Student with ID %(Matnumber)s found\n' % result
+                    logger.info(em)
+                    no_import.write(em)
+                    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
+                sid = temp_sid
+                sf = res[0].getObject().aq_parent
+                sc = getattr(sf,'study_course')
+                level = ''
+            else:
+                student_changed = False
+            course = result.get('CosCode')
+            if course not in courses.keys():
+                em = 'Course with ID %(CosCode)s not found\n' % result
+                logger.info(em)
+                no_import.write(em)
+                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')
+            student_id = sf.getId()
+            result['StudentId'] = student_id
+            if temp_level != level:
+                try:
+                    int(temp_level)
+                except:
+                    em = 'Result with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % result
+                    logger.info(em)
+                    no_import.write(em)
+                    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
+                level_changed = True
+                if 'dlev' in vars().keys():
+                    wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
+                level = temp_level
+                l = getattr(sc,level,None)
+                if l is None:
+                    logger.info('Creating Level %(Level)s for %(StudentId)s %(Matnumber)s' % result)
+                    sc.invokeFactory('StudentStudyLevel', level)
+                    l = getattr(sc, level)
+                    l.manage_setLocalRoles(student_id, ['Owner',])
+            else:
+                level_changed = False
+            cr = getattr(l,course,None)
+            if cr is None:
+                logger.info('Creating Course %(CosCode)s for %(StudentId)s %(Matnumber)s in Level %(Level)s' % result)
+                l.invokeFactory('StudentCourseResult',course)
+            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')
+            dcr['semester'] = getInt(result.get('Semster'))
+            dcr['status'] = result.get('CosStuatus')
+            dcr['score'] = getInt(result.get('Score'))
+            dlev['session'] = result.get('Session')
+            dcr['carry_level'] = result.get('CarryLevel')
+            dcr['grade'] = result.get('Grade')
+            dcr['weight'] = result.get('Weight')
+            dlev['verdict'] = result.get('Verdict')
+            dcr['import_id'] = result.get('id')
+            gpa = result.get('GPA').replace(',','.')
+            dlev['imported_gpa'] = getFloat(gpa)
+            cr.getContent().edit(mapping = dcr)
+            cr.manage_setLocalRoles(student_id, ['Owner',])
+            l.getContent().edit(mapping = dlev)
+            if tr_count > MAX_TRANS:
+                transaction.commit()
+                tr_count = 0
+            tr_count += 1
+            wftool.doActionFor(cr,'close')
+        wftool.doActionFor(l,level_wf_actions[dlev['verdict']])
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+
+###)
+
+    security.declareProtected(ModifyPortalContent,"loadJAMBFromCSV")###(
+    def loadJAMBFromCSV(self):
+        """load JAMB data from CSV values"""
+        #return
+        students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject()
+        import transaction
+        tr_count = 0
+        name = 'SampleJAMBDataII'
+        wftool = self.portal_workflow
+        no_import = False
+        if not no_import:
+            no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
+            no_import.write('REG-NO,NAME,SEX,STATE,LGA,ENG-SCORE,SUBJ1,SUBJ1-SCORE,SUBJ2,SUBJ2-SCORE,SUBJ3,SUBJ3-SCORE,AGGREGATE,UNIV1,FACULTY1,COURSE1,UNIV2,FACULTY2,COURSE2')
+        logger = logging.getLogger('Import.%s' % name)
+        logger.info('Start loading from %s.csv' % name)
+        try:
+            result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb"))
+        except:
+            logger.error('Error reading %s.csv' % name)
+            return
+        for jamb in result:
+            logger.info('processing %(REG-NO)s,%(NAME)s,%(SEX)s,%(STATE)s,%(LGA)s,%(ENG-SCORE)s,%(SUBJ1)s,%(SUBJ1-SCORE)s,%(SUBJ2)s,%(SUBJ2-SCORE)s,%(SUBJ3)s,%(SUBJ3-SCORE)s,%(AGGREGATE)s,%(UNIV1)s,%(FACULTY1)s,%(COURSE1)s,%(UNIV2)s,%(FACULTY2)s,%(COURSE2)s\n' % jamb)
+            jamb_reg_no = jamb.get('REG-NO')
+            res = self.portal_catalog({'meta_type': "StudentApplication",
+                                     'jamb_reg_no': jamb_reg_no })
+            if res:
+                em = 'Student with REG-NO %(REG-NO)s already exists\n' % jamb
+                logger.info(em)
+                no_import.write(em)
+                no_import.write('%(REG-NO)s,%(NAME)s,%(SEX)s,%(STATE)s,%(LGA)s,%(ENG-SCORE)s,%(SUBJ1)s,%(SUBJ1-SCORE)s,%(SUBJ2)s,%(SUBJ2-SCORE)s,%(SUBJ3)s,%(SUBJ3-SCORE)s,%(AGGREGATE)s,%(UNIV1)s,%(FACULTY1)s,%(COURSE1)s,%(UNIV2)s,%(FACULTY2)s,%(COURSE2)s\n' % jamb)
+                continue
+            jamb_name = jamb.get("NAME")
+            jamb_name.replace('>','')
+            names = jamb_name.split()
+            letter = names[-1][0].upper()
+            sid = self.generateStudentId(letter)
+            not_created = True
+            while not_created:
+                try:
+                    students_folder.invokeFactory('Student', sid)
+                    not_created = False
+                except BadRequest:
+                    sid = self.generateStudentId(letter)
+            logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars())
+            student = getattr(self,sid)
+            student.manage_setLocalRoles(sid, ['Owner',])
+            student.invokeFactory('StudentApplication','application')
+            da = {'Title': 'Application Data'}
+            da["jamb_reg_no"] = jamb.get("REG-NO")
+            da["jamb_lastname"] = jamb_name
+            da["jamb_sex"] = jamb.get("SEX")
+            da["jamb_state"] = jamb.get("STATE")
+            da["jamb_lga"] = jamb.get("LGA")
+            da["jamb_score"] = jamb.get("AGGREGATE")
+            da["jamb_first_cos"] = jamb.get("COURSE1")
+            da["jamb_second_cos"] = jamb.get("COURSE2")
+            da["jamb_first_uni"] = jamb.get("UNIV1")
+            da["jamb_second_uni"] = jamb.get("UNIV2")
+            app = student.application
+            app_doc = app.getContent()
+            app_doc.edit(mapping=da)
+            #wftool.doActionFor(app,'open',dest_container=app)
+            app.manage_setLocalRoles(sid, ['Owner',])
+            student.getContent().createSubObjects()
+        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+    ###)
Index: WAeUP_SRP/branches/uli/WAeUPTables.py
===================================================================
--- WAeUP_SRP/branches/uli/WAeUPTables.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/WAeUPTables.py	(revision 1593)
@@ -142,6 +142,6 @@
         rec = records[0]
         self.modifyRecord(bed=rec.bed,student=student_id)
-        s_logger = logging.getLogger('Accommodation.SearchAndReserveBed')
-        s_logger.info("%s reserved bed %s" % (student_id,rec.bed))
+        s_logger = logging.getLogger('WAeUPTables.AccommodationTable.searchAndReserveBed')
+        s_logger.info('%s reserved bed %s' % (student_id,rec.bed))
         return 1,rec.bed
 
Index: WAeUP_SRP/branches/uli/WAeUPTool.py
===================================================================
--- WAeUP_SRP/branches/uli/WAeUPTool.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/WAeUPTool.py	(revision 1593)
@@ -109,5 +109,5 @@
         student_entry = getattr(self.portal_directories.students,student_id,None)
         if student_entry is None:
-            return 
+            return
         setattr(student_entry,'password',password)
     ###)
@@ -288,5 +288,5 @@
         "create Datastructure for a returning Student"
         #import pdb;pdb.set_trace()
-        logger = logging.getLogger('Student.CreateData')
+        logger = logging.getLogger('WAeUPTool.makeStudentData')
         students_folder = self.portal_url.getPortalObject().campus.students
         res = self.students_catalog(id=student_id)
@@ -296,5 +296,5 @@
         if res:
             student = res[0]
-        logger.info('"%s", "creating Datastructure"' % student_id)
+        logger.info('%s creates data structure' % student_id)
         s_results = self.results_import(matric_no = st.matric_no)
         lnr = self.getLevelFromResultsCosCode(s_results)
@@ -404,5 +404,5 @@
         "create the StudyLevel for a returning Student"
         #import pdb;pdb.set_trace()
-        logger = logging.getLogger('Student.CreateLevel')
+        logger = logging.getLogger('WAeUPTool.makeStudentLevel')
         students_folder = self.portal_url.getPortalObject().campus.students
         res = self.students_catalog(id=student_id)
@@ -415,5 +415,5 @@
         if res:
             results = res
-        logger.info('"%s", "creating Level", "%s"' % (student_id,level))
+        logger.info('%s creating Level %s' % (student_id,level))
         #
         # Level
@@ -481,5 +481,5 @@
     def getLogfileLines(self,filename="event.log",numlines=20):
         """Get last NUMLINES lines of logfile FILENAME.
-    
+
         Return last lines' of a file in the instances logfile directory as
         a list. The number of returned lines equals `numlines' or less. If
@@ -497,5 +497,5 @@
             # Attempt to access file outside log-dir...
             return []
-        
+
         try:
             fd = file( filename, "rb" )
@@ -504,10 +504,10 @@
         if not fd:
             return []
-    
+
         if os.linesep == None:
             linesep = '\n'
         else:
             linesep = os.linesep
-    
+
         # Try to find 'numlines' times a lineseparator, searching from end
         # and moving to the beginning of file...
@@ -528,8 +528,7 @@
         # Remove line endings...
         result = [x.strip() for x in result]
-        fd.close()    
+        fd.close()
         return result
     ###)
 
-
 InitializeClass(WAeUPTool)
Index: WAeUP_SRP/branches/uli/Widgets.py
===================================================================
--- WAeUP_SRP/branches/uli/Widgets.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/Widgets.py	(revision 1593)
@@ -343,5 +343,5 @@
     def validate(self, datastructure, **kw):
         """Validate datastructure and update datamodel."""
-        logger = logging.getLogger('Secret.Validate')
+        logger = logging.getLogger('Widgets.SecretWidget.validate')
         valid = CPSStringWidget.validate(self, datastructure, **kw)
         #import pdb;pdb.set_trace()
@@ -370,8 +370,8 @@
             name = " ".join(cvs)
             if not found:
-                logger.info('"%(matric_no)s","mismatch", "%(value)s", "not in","%(name)s"' % vars())
-                err = 'No Name does match.'
-            else:
-                logger.info('"%(matric_no)s","found", "%(value)s", "in","%(name)s"' % vars())
+                logger.info('%(matric_no)s did not find %(value)s in %(name)s' % vars())
+                err = 'No name does match.'
+            else:
+                logger.info('%(matric_no)s found %(value)s in %(name)s' % vars())
         if err:
             datastructure.setError(widget_id, err)
@@ -392,5 +392,5 @@
         """Validate datastructure and update datamodel."""
         valid = CPSStringWidget.validate(self, datastructure, **kw)
-        logger = logging.getLogger('MatricNo.Validate')
+        logger = logging.getLogger('Widgets.MatricNoWidget.validate')
         #import pdb;pdb.set_trace()
         returning = self.returning_import
@@ -400,6 +400,6 @@
         value = datastructure[widget_id]
         if not valid or not value:
-            err = 'Invalid MatricNo String %s.' % value
-            logger.info('"%s","invalid MatricNo String"' % value)
+            err = 'Invalid matric_no string %s.' % value
+            logger.info('Invalid matric_no string %s' % value)
         else:
             value = value.upper()
@@ -408,11 +408,11 @@
                 res = returning(matric_no = value)
                 if len(res) < 1:
-                    logger.info('"%s","MatricNo not found."' % value)
-                    err = 'No Student with MatricNo %s.' % (value)
+                    logger.info('matric_no %s not found' % value)
+                    err = 'No student with matric_no %s.' % (value)
                     continue
                 datastructure['student'] = res[0]
                 res = results(matric_no = value)
                 if len(res) < 1:
-                    err = 'No Results with MatricNo %s.' % (value)
+                    err = 'No results with matric_no %s.' % (value)
                     continue
                 datastructure['results'] = res
@@ -436,5 +436,5 @@
         """Validate datastructure and update datamodel."""
         valid = CPSStringWidget.validate(self, datastructure, **kw)
-        logger = logging.getLogger('StudentId.Validate')
+        logger = logging.getLogger('Widgets.StudentIdWidget.validate')
         #import pdb;pdb.set_trace()
         s_cat = self.students_catalog
@@ -443,6 +443,6 @@
         value = datastructure[widget_id]
         if not valid or not value:
-            err = 'Invalid StudentId String %s.' % value
-            logger.info('"%s","invalid StudentId String"' % value)
+            err = 'Invalid id string %s.' % value
+            logger.info('Invalid id string %s' % value)
             datastructure['student'] = None
         else:
@@ -450,6 +450,6 @@
             res = s_cat(id = value)
             if not res:
-                logger.info('"%s","StudentId not found."' % value)
-                err = 'No Student with StudentId %s.' % (value)
+                logger.info('Student id %s not found' % value)
+                err = 'No student with id %s.' % (value)
                 datastructure['student'] = None
             else:
@@ -699,5 +699,5 @@
     def validate(self, datastructure, **kw): ###(
         """Validate datastructure and update datamodel."""
-        s_logger = logging.getLogger('Pin.Validate')
+        s_logger = logging.getLogger('Widgets.ScratchcardPinWidget.validate')
         widget_id = self.getWidgetId()
         v = datastructure[widget_id]
@@ -718,9 +718,17 @@
             do = 0
             err ='You are not a Student. PIN neither checked nor used.'
-            s_logger.info('"%s","tried to use Scratchcard", "%s"' % (s_id,pin_str))
+            s_logger.info('%s tried to use scratch card %s' % (s_id,pin_str))
+        elif len(b) > 1 and b.find('-') > -1:
+            do = 0
+            err = 'PIN must not contain "-"'
+            s_logger.info('%s entered invalid PIN  containing "-"' % (s_id))
+        elif n.find('-') > -1:
+            do = 0
+            err = 'PIN must not contain "-"'
+            s_logger.info('%s entered invalid PIN  containing "-"' % (s_id))
         elif len(n) != 10:
             do = 0
-            err = 'Invalid PIN-Number length %d' % len(n)
-            s_logger.info('"%s","Invalid PIN-Number length", "%d"' % (s_id,len(n)))
+            err = 'Invalid PIN length %d' % len(n)
+            s_logger.info('%s entered invalid PIN with length %d' % (s_id,len(n)))
         elif self.reference == "":
             ref = s_id
@@ -729,23 +737,23 @@
             if datastructure.errors:
                 do = 0
-                datastructure.setError(widget_id, 'Errors in other data, PIN neither checked nor used.')
-                s_logger.info('"%s", "%s","entered wrong data together with pin", "%s"' % (s_id,ref,pin_str))
+                datastructure.setError(widget_id, 'errors in other data, PIN neither checked nor used')
+                s_logger.info('%s/%s entered wrong data together with PIN %s' % (s_id,ref,pin_str))
         while do:
             ok = pins.searchAndSetRecord(pin,ref,prefix)
             if ok < -2 or ok > 2:
                 err = 'Unknown error, please report!'
-                s_logger.info('"%s","%s", "caused unknown error with pin", "%s"' % (s_id,ref,pin_str))
+                s_logger.info('%s/%s caused unknown error with PIN %s' % (s_id,ref,pin_str))
                 break
             elif ok == -2:
                 err = 'Service already activated but with a different PIN.'
-                s_logger.info('"%s","%s", "repeatedly activated service but with different pin", "%s"' % (s_id,ref,pin_str))
+                s_logger.info('%s/%s repeatedly activated service but with different PIN %s' % (s_id,ref,pin_str))
                 break
             elif ok == -1:
                 err = 'Invalid PIN'
-                s_logger.info('"%s","%s", "entered invalid pin", "%s"' % (s_id,ref,pin_str))
+                s_logger.info('%s/%s entered invalid PIN %s' % (s_id,ref,pin_str))
                 break
             if ok == 0:
-                err = 'PIN already used.'
-                s_logger.info('"%s","%s", "entered used pin", "%s"' % (s_id,ref,pin_str))
+                err = 'PIN already used'
+                s_logger.info('%s/%s entered used PIN %s' % (s_id,ref,pin_str))
                 break
             if ok >= 1:
@@ -754,17 +762,17 @@
                     if self.reference == "jamb_reg_no":
                         err = "You are already logged in."
-                        s_logger.info('"%s","%s", "checked admission though logged in", "%s"' % (s_id,ref,pin_str))
+                        s_logger.info('%s/%s checked admission with PIN %s though logged in' % (s_id,ref,pin_str))
                         break
                     if ok == 1:
-                        s_logger.info('"%s","%s", "successfully used pin", "%s"' % (s_id,ref,pin_str))
+                        s_logger.info('%s/%s successfully used PIN %s' % (s_id,ref,pin_str))
                     else:
-                        s_logger.info('"%s","%s", "repeatedly used pin", "%s"' % (s_id,ref,pin_str))
+                        s_logger.info('%s/%s repeatedly used PIN %s' % (s_id,ref,pin_str))
                     break
                 else:
                     student = getStudentByRegNo(self,ref)
-                    s_logger.info('"%s","%s","successfully used pin","%s"' % (s_id,ref,pin_str))
+                    s_logger.info('%s/%s successfully used PIN %s' % (s_id,ref,pin_str))
                 if student is None:
                     err = "Student not found."
-                    s_logger.info('"%s","not found in admission list"' % (ref))
+                    s_logger.info('%s not found in admission list' % (ref))
                     break
                 s_id = student.getId()
@@ -773,18 +781,18 @@
                         if hasattr(self.portal_directories.students,s_id):
                             err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                            s_logger.info('"%s","%s", "repeatedly checked admission with pin", "%s"' % (s_id,ref,pin_str))
+                            s_logger.info('%s/%s repeatedly checked admission with PIN %s' % (s_id,ref,pin_str))
                             break
                         else:
-                            s_logger.info('"%s","%s","(non-member) repeatedly checked admission with pin", "%s"' % (s_id,ref,pin_str))
+                            s_logger.info('%s/%s (non-member) repeatedly checked admission with PIN %s' % (s_id,ref,pin_str))
                     else:
                         err = "Unknown error" % s_id
-                        s_logger.info('"%s","%s", "repeatedly activated service with pin", "%s"' % (s_id,ref,pin_str))
+                        s_logger.info('%s/%s repeatedly activated service with PIN %s' % (s_id,ref,pin_str))
                         break
                 try:
                     student.getContent().makeStudentMember(s_id,password=pin[4:])
-                    s_logger.info('"%s","%s", "has been created using pin", "%s"' % (s_id,ref,pin_str))
+                    s_logger.info('%s/%s has been created using PIN %s' % (s_id,ref,pin_str))
                 except:
                     err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                    s_logger.info('"%s","%s", "could not be made a member with pin", "%s"' % (s_id,ref,pin_str))
+                    s_logger.info('%s/%s could not be made a member with PIN %s' % (s_id,ref,pin_str))
                     break
             break
Index: WAeUP_SRP/branches/uli/profiles/default/actionicons.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/actionicons.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/actionicons.xml	(revision 1593)
@@ -57,5 +57,9 @@
               action_id="allocate_reserved_bed"
               title="Allocate Reserved Bed" priority="100"
-              icon_expr="bed_list_refresh.gif"/>              
+              icon_expr="bed_list_refresh.gif"/>
+ <action-icon category="object"
+              action_id="release_bed"
+              title="Relase Bed" priority="110"
+              icon_expr="door_out.png"/>   
  <action-icon category="folder" action_id="portlets"
               title="Manage portlets" priority="270"
Index: WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation.xml	(revision 1593)
@@ -110,5 +110,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
-  <property name="render_method">formatBed</property>
+  <property name="render_method">getFormattedBed</property>
  </widget>
  <widget name="session" meta_type="String Widget">
Index: WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation_fe.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation_fe.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation_fe.xml	(revision 1593)
@@ -79,5 +79,5 @@
   </property>
   <property name="hidden_readonly_layout_modes"/>
-  <property name="render_method">formatBed</property>
+  <property name="render_method">getFormattedBed</property>
  </widget>
  <widget name="session" meta_type="String Widget">
Index: WAeUP_SRP/branches/uli/profiles/default/payments_catalog.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/payments_catalog.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/payments_catalog.xml	(revision 1593)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
-<object name="payments_catalog" meta_type="CMF Catalog">
+<object name="payments_catalog" meta_type="WAeUP Table">
  <column value="id"/>
  <column value="student_id"/>
Index: WAeUP_SRP/branches/uli/profiles/default/pumeresults.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/pumeresults.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/pumeresults.xml	(revision 1593)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
-<object name="portal_catalog" meta_type="WAeUP Table">
+<object name="portal_pumeresults" meta_type="WAeUP Table">
  <column value="jamb_reg_no"/>
  <column value="name"/>
Index: WAeUP_SRP/branches/uli/profiles/default/results_import.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/results_import.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/results_import.xml	(revision 1593)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
-<object name="portal_catalog" meta_type="CMF Catalog">
+<object name="results_import" meta_type="WAeUP Table">
  <column value="key"/>
  <column value="matric_no"/>
Index: WAeUP_SRP/branches/uli/profiles/default/returning_import.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/returning_import.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/returning_import.xml	(revision 1593)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
-<object name="portal_catalog" meta_type="CMF Catalog">
+<object name="returning_import" meta_type="WAeUP Table">
  <column value="matric_no"/>
  <column value="Entryregno"/>
Index: WAeUP_SRP/branches/uli/profiles/default/schemas/import_student_course_results.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/schemas/import_student_course_results.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/schemas/import_student_course_results.xml	(revision 1593)
@@ -6,3 +6,2 @@
  <field name="score" meta_type="CPS String Field"/>
 </object>
-
Index: WAeUP_SRP/branches/uli/profiles/default/themes.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/themes.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/themes.xml	(revision 1593)
@@ -25,4 +25,6 @@
   <element key="payment_receipt" value="WAeUP_Student+Slippage"/>
   <element key="course_registration_slip" value="WAeUP_Student+Slippage"/>
+  <element key="external_study_level_view" value="WAeUP_Student+Slippage"/>
+  <element key="external_contact_student_form" value="WAeUP_Student+Slippage"/>
  </property>
  <object name="default" meta_type="Portal Theme"/>
Index: WAeUP_SRP/branches/uli/profiles/default/types/StudyLevel.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/types/StudyLevel.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/types/StudyLevel.xml	(revision 1593)
@@ -37,9 +37,15 @@
   <permission value="View"/>
  </action>
-   <action title="Add Course" action_id="new_entry" category="object"
-    condition_expr=""
-    url_expr="string:${object_url}/content_create?type_name=CertificateCourse"
-    visible="True">
-  <permission value="Modify portal content"/>
+  <action title="Add Course" action_id="new_entry" category="object"
+          condition_expr=""
+          url_expr="string:${object_url}/content_create?type_name=CertificateCourse"
+          visible="True">
+    <permission value="Modify portal content"/>
+  </action>
+  <action title="Delegate" action_id="localroles" category="object"
+          condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
+          visible="True">
+    <permission value="Modify portal content"/>
  </action>
+
 </object>
Index: WAeUP_SRP/branches/uli/profiles/default/vocabularies/searchable_student_states.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/vocabularies/searchable_student_states.xml	(revision 1592)
+++ WAeUP_SRP/branches/uli/profiles/default/vocabularies/searchable_student_states.xml	(revision 1593)
@@ -19,4 +19,5 @@
  <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="courses_registered" msgid="">courses registered</item>
+ <item key="courses_validated" msgid="">courses validated</item>
 </object>
Index: WAeUP_SRP/branches/uli/profiles/default/vocabularies/student_import_mode.xml
===================================================================
--- WAeUP_SRP/branches/uli/profiles/default/vocabularies/student_import_mode.xml	(revision 1593)
+++ WAeUP_SRP/branches/uli/profiles/default/vocabularies/student_import_mode.xml	(revision 1593)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="vocabulary.xsl"?>
+<object name="verdicts" 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="" msgid=""></item>
+ <item key="adm_pt" msgid="">Admitted Parttime</item>
+ <item key="adm_ft" msgid="">Admitted Fulltime</item>
+ <item key="adm_dp" msgid="">Admitted Diploma</item>
+ <item key="adm_pg" msgid="">Admitted Postgraduate</item>
+ <item key="ret_pt" msgid="">Returning Parttime</item>
+ <item key="ret_ft" msgid="">Returning Fulltime</item>
+ <item key="ret_dp" msgid="">Returning Diploma</item>
+ <item key="defered" msgid=""></item>
+</object>
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/allocate_reserved_bed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/allocate_reserved_bed.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/allocate_reserved_bed.py	(revision 1593)
@@ -13,5 +13,5 @@
 acco_cat = context.portal_accommodation
 import logging
-logger = logging.getLogger('Accommodation.AllocateReservedBed')
+logger = logging.getLogger('Skins.allocate_reserved_bed')
 
 #change = REQUEST.has_key("allocate_and_change")
@@ -73,8 +73,8 @@
     if allocate or change:
         if already and not change:
-            psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
+            psm = "Student %s has already reserved bed %s" % (sid, already[0].bed)
             break
         if not bed_brain.bed_type.endswith("reserved"):
-            psm = "Not a reserved bed: %s" % bid
+            psm = "%s is not a reserved bed" % bid
             break
         if bed_brain.student and not change:
@@ -88,5 +88,5 @@
             acco_doc = getattr(student_obj, acco_id).getContent()
             if acco_doc.bed == bid:
-                psm = "Student %s has already booked (paid) bed %s" % (sid, bid)
+                psm = "Student %s has already booked (and paid) bed %s" % (sid, bid)
                 break
         if not already:
@@ -94,5 +94,5 @@
             break
         if not bed_brain.bed_type.endswith("reserved"):
-            psm = "Not a reserved bed: %s" % bid
+            psm = "%s is not a reserved bed" % bid
             break
         if not bed_brain.student:
@@ -118,5 +118,5 @@
         acco_doc = getattr(student_obj, acco_id).getContent()
         acco_doc.edit(mapping={'bed': bid})
-    logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
+    logger.info('%s booked reserved bed %s for %s' % (member,bid,sid))
     psm = "Bed %s reserved for %s %s" % (bid,sid,student.name)
 elif release:
@@ -130,8 +130,8 @@
     if modify:
         acco_cat.modifyRecord(bed=bid,student='')
-        logger.info('"%s","cancelled reservation %s by","%s"' % (member,bid,sid))
+        logger.info('%s released bed %s booked by %s' % (member,bid,sid))
         psm = "%s removed from %s" % (student.name,bid)
     else:
-        psm = "%s removing failed from %s" % (student.name,bid)
+        psm = "Removing of %s from bed %s failed" % (student.name,bid)
 
 mode = 'view'
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Accommodation.change_bed')
+logger = logging.getLogger('Skins.change_bed')
 
 request = context.REQUEST
@@ -31,18 +31,19 @@
 
 if student_id is not None:
-    logger.info('"%s", "requests bed_change for", "%s"' % (member_id,student_id))
+    logger.info('%s requests bed change for %s' % (member_id,student_id))
     info = context.getAccommodationInfo(student_id)
     res = beds(student=student_id)
     if len(res) == 0:
-        logger.info('"%s", "no bed found"' % (student_id))
-        redirect("%s/%s" % (students.absolute_url(),student_id))
+        logger.info('No bed found for %s' % (student_id))
+        return redirect("%s/%s" % (students.absolute_url(),student_id))
     allocated_bed = res[0]
     status = info['student_status']
     student = student_id
     if allocated_bed.bed_type == status:
-        logger.info('"%s", "correct bed allocated","%s"' % (student_id,status))
-        redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
-    logger.info('"%s", "change bed", "%s/%s"' % (student_id,allocated_bed.bed_type,status))
+        logger.info('Status %s of %s has not changed' % (status,student_id))
+        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
+    logger.info('Bed status %s of %s has changed to %s' % (allocated_bed.bed_type,student_id,status))
     beds.modifyRecord(bed=allocated_bed.bed,student='')
+    logger.info('Bed %s released' % (allocated_bed.bed))
     code,bed = beds.searchAndReserveBed(student_id,status)
     if code > 0:
@@ -56,4 +57,5 @@
         acco_doc = info['acco_doc']
         acco_doc.edit(mapping=d)
+        logger.info('Bed %s allocated to %s' % (bed,student_id))
         return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
     student_obj = getattr(students,student_id)
@@ -62,7 +64,7 @@
         acco_doc = getattr(student_obj, acco_id).getContent()
         if acco_doc.bed == bed:
-            acco_doc.edit(mapping={'bed':"-- cancelled by %s --" % member})
-    logger.info('"%s", "new bed allocation failed","%s"' % (student_id,code))
-    logger.info('"%s","cancelled booking of bed %s by %s"' % (member,bed,sid))
+            acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"})
+    logger.info('New bed allocation for %s failed, code = %s' % (student_id,code))
+    logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id))
     redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
 
@@ -95,6 +97,6 @@
         d['acco_maint_fee'] = acco_info.get('maintenance_fee')
         acco_doc.edit(mapping=d)
-        list.append("Student %s new bed %s assigned code = %s" % (student,
-                                                              bed,
+        list.append("New bed %s allocated to %s, code = %s" % (bed,
+                                                              student,
                                                               code))
 return "\r".join(list)
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/fixReservedBeds.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/fixReservedBeds.py	(revision 1592)
+++ 	(revision )
@@ -1,45 +1,0 @@
-##parameters=REQUEST
-# $Id$
-"""
-process the the accommodation reservation
-"""
-import DateTime
-current = DateTime.DateTime()
-request = context.REQUEST
-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('Accommodation.FixReservedBed')
-students = context.portal_url.getPortalObject().campus.students
-hostels = context.portal_url.getPortalObject().campus.accommodation.objectItems()
-acco_id = "accommodation_%s" % context.getSessionId()
-logger.info('"%s","start"' % (member))
-#from Products.zdb import set_trace;set_trace()
-for h_id,h in hostels:
-    h_doc = h.getContent()
-    reserved = context.reservedRoomsVoc(doc=h_doc)
-    for hr,hrv in reserved:
-        for k,v in context.getAccoHallBeds(doc=h_doc):
-            bid = "%s_%s_%s" % (h_id,hr,k)
-            res = acco_cat(bed = bid)
-            if not res:
-                continue
-            bed = res[0]
-            if not bed.student:
-                continue
-            student_obj = getattr(students,bed.student)
-            if acco_id in student_obj.objectIds():
-                acco_doc = getattr(student_obj, acco_id).getContent()
-                if acco_doc.bed != bid:
-                    acco_cat.modifyRecord(bed=bid,student = '')
-                    logger.info('"%s","removed allocation of %s for","%s"' % (member,bid,bed.student))
-logger.info('"%s","finished"' % (member))
-return request.RESPONSE.redirect("%s" % context.absolute_url())
-
-                
-    
-
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/formatBed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/formatBed.py	(revision 1592)
+++ 	(revision )
@@ -1,27 +1,0 @@
-## Script (Python) "students_indext"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=bed=None,mode=None,datastructure=None
-##title=
-# $Id$
-"""
-format the bed for readability
-"""
-
-if datastructure is not None:
-    bed = datastructure.get('bed')
-if not bed:
-    return ''
-if len(bed.split('_')) != 4:
-    return bed
-hall,block,room,letter = bed.split('_')
-info = context.waeup_tool.getAccommodationInfo(bed)
-if info:
-    hall_title = info['hall_title']
-else:
-    hall_title = ""
-return " %s / Block %s / Room %s / Bed %s" % (hall_title,block,room,letter)
-
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/getAccoHallInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/getAccoHallInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/getAccoHallInfo.py	(revision 1593)
@@ -59,5 +59,5 @@
     d['student'] = st
     d['student_url'] ='%s/%s' % (students_url,st)
-    bed = context.formatBed(sbrain.bed).split('/')
+    bed = context.getFormattedBed(sbrain.bed).split('/')
     d['bed'] = " / ".join(bed[1:])
     erg = context.students_catalog(id = st)
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/getFormattedBed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/getFormattedBed.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/getFormattedBed.py	(revision 1593)
@@ -0,0 +1,27 @@
+## Script (Python) "getFormattedBed"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=bed=None,mode=None,datastructure=None
+##title=
+# $Id: getFormattedBed.py 1453 2007-02-20 22:24:30Z henrik $
+"""
+format the bed for readability
+"""
+
+if datastructure is not None:
+    bed = datastructure.get('bed')
+if not bed:
+    return ''
+if len(bed.split('_')) != 4:
+    return bed
+hall,block,room,letter = bed.split('_')
+info = context.waeup_tool.getAccommodationInfo(bed)
+if info:
+    hall_title = info['hall_title']
+else:
+    hall_title = ""
+return " %s / Block %s / Room %s / Bed %s" % (hall_title,block,room,letter)
+
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/hall_delete.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/hall_delete.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/hall_delete.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "folder_delete"
+## Script (Python) "hall_delete"
 ##bind container=container
 ##bind context=context
@@ -12,4 +12,8 @@
 FIXME: add docstring.
 """
+
+import logging
+logger = logging.getLogger('Skins.hall_delete')
+member_id = str(context.portal_membership.getAuthenticatedMember())
 
 from Products.CMFCore.utils import getToolByName
@@ -41,4 +45,5 @@
     here.manage_delObjects(ids)
     message = 'portal_status_message=hall(s) %s with %s beds deleted' % (" ".join(halls),len(urls))
+    logger.info('%s deletes hall(s) %s with %s beds' % (member_id," ".join(halls),len(urls)))
 else:
     message = 'portal_status_message=psm_select_at_least_one_document'
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/reallocateBed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/reallocateBed.py	(revision 1592)
+++ 	(revision )
@@ -1,107 +1,0 @@
-## Script (Python) "change_bed"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id: reallocateBed.py 1206 2007-01-05 18:24:56Z joachim $
-"""
-reallocate beds
-"""
-import logging
-logger = logging.getLogger('Student.Accommodation.reallocate_bed')
-
-request = context.REQUEST
-redirect = request.RESPONSE.redirect
-mtool = context.portal_membership
-wf = context.portal_workflow
-member = mtool.getAuthenticatedMember()
-member_id = str(member)
-path_info = request.get('PATH_INFO').split('/')
-
-if mtool.isAnonymousUser():
-    return None
-students = context.portal_url.getPortalObject().campus.students
-beds = context.portal_accommodation
-studs = context.students_catalog
-student_id = context.getStudentId()
-
-if student_id is not None:
-    logger.info('"%s", "requests bed_change for", "%s"' % (member_id,student_id))
-    info = context.getAccommodationInfo(student_id)
-    res = beds(student=student_id)
-    if len(res) == 0:
-        logger.info('"%s", "no bed found"' % (student_id))
-        redirect("%s/%s" % (students.absolute_url(),student_id))
-    allocated_bed = res[0]
-    status = info['student_status']
-    student = student_id
-    bedtype = context.getBedStatusFromHall(allocated_bed.bed)
-    if not bedtype.endswith("reserved"):
-        logger.info('"%s", "allocated bed is NOT reserved","%s"' % (student_id,bedtype))
-        redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
-    logger.info('"%s", "reallocate reserved bed", "%s/%s"' % (student_id,bedtype,status))
-    beds.modifyRecord(bed=allocated_bed.bed,
-                      student='',
-                      bed_type=bedtype)
-    code,bed = beds.searchAndReserveBed(student_id,status)
-    if code > 0:
-        #from Products.zdb import set_trace; set_trace()
-        d = {}
-        d['bed'] = bed
-        d['student_status'] = status
-        acco_info = context.waeup_tool.getAccommodationInfo(bed)
-        d['acco_maint_code'] = acco_info.get('maintenance_code')
-        d['acco_maint_fee'] = acco_info.get('maintenance_fee')
-        acco_doc = info['acco_doc']
-        acco_doc.edit(mapping=d)
-        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
-    logger.info('"%s", "new bed allocation failed","%s"' % (student_id,code))
-    redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
-
-info = {}
-#records = [r for r in beds() if  r.student]
-records = beds.uniqueValuesFor('bed')
-list = []
-to_modify = []
-for b in records:
-    r = beds(bed=b)[0]
-    bedtype = context.getBedStatusFromHall(r.bed)
-    if not bedtype.endswith("reserved"):
-        #logger.info('"%s", "allocated bed is NOT reserved","%s"' % (student_id,bedtype))
-        #list.append("Student %s bed_type %s ok" % (r.student,bedtype))
-        continue
-    if not r.student:
-        beds.modifyRecord(bed=b,
-                      bed_type=bedtype)
-        list.append("empty bed %s set to %s" % (r.bed,bedtype))
-        continue
-    info = context.getAccommodationInfo(r.student)
-    sbt = info.get('student_status',None)
-    if sbt is None:
-        continue
-    list.append("Student %s bed_type %s != %s" % (r.student,
-                                                  r.bed_type,
-                                                  bedtype))
-    to_modify.append((r.bed,r.student,info['student_status'],info['acco_doc'],bedtype))
-for former_bed, student, status,acco_doc,bedtype in to_modify:
-    beds.modifyRecord(bed=former_bed,
-                      student='',
-                      bed_type=bedtype)
-    code,bed = beds.searchAndReserveBed(student,status)
-    if code > 0:
-        #from Products.zdb import set_trace; set_trace()
-        d = {}
-        d['bed'] = bed
-        d['student_status'] = status
-        acco_info = context.waeup_tool.getAccommodationInfo(bed)
-        d['acco_maint_code'] = acco_info.get('maintenance_code')
-        d['acco_maint_fee'] = acco_info.get('maintenance_fee')
-        acco_doc.edit(mapping=d)
-        list.append("Student %s new bed %s assigned code = %s" % (student,
-                                                              bed,
-                                                              code))
-return "\r".join(list)
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/reallocate_bed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/reallocate_bed.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/reallocate_bed.py	(revision 1593)
@@ -0,0 +1,107 @@
+## Script (Python) "reallocate_bed"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: reallocateBed.py 1206 2007-01-05 18:24:56Z joachim $
+"""
+reallocate beds
+"""
+import logging
+logger = logging.getLogger('Skins.reallocate_bed')
+
+request = context.REQUEST
+redirect = request.RESPONSE.redirect
+mtool = context.portal_membership
+wf = context.portal_workflow
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+path_info = request.get('PATH_INFO').split('/')
+
+if mtool.isAnonymousUser():
+    return None
+students = context.portal_url.getPortalObject().campus.students
+beds = context.portal_accommodation
+studs = context.students_catalog
+student_id = context.getStudentId()
+
+if student_id is not None:
+    logger.info('%s requests bed_change for %s' % (member_id,student_id))
+    info = context.getAccommodationInfo(student_id)
+    res = beds(student=student_id)
+    if len(res) == 0:
+        logger.info('No bed found for %s' % (student_id))
+        redirect("%s/%s" % (students.absolute_url(),student_id))
+    allocated_bed = res[0]
+    status = info['student_status']
+    student = student_id
+    bedtype = context.getBedStatusFromHall(allocated_bed.bed)
+    if not bedtype.endswith("reserved"):
+        logger.info('%s is NOT a reserved bed' % (bedtype))
+        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
+    logger.info('%s reallocate reserved bed %s/%s' % (student_id,bedtype,status))
+    beds.modifyRecord(bed=allocated_bed.bed,
+                      student='',
+                      bed_type=bedtype)
+    code,bed = beds.searchAndReserveBed(student_id,status)
+    if code > 0:
+        #from Products.zdb import set_trace; set_trace()
+        d = {}
+        d['bed'] = bed
+        d['student_status'] = status
+        acco_info = context.waeup_tool.getAccommodationInfo(bed)
+        d['acco_maint_code'] = acco_info.get('maintenance_code')
+        d['acco_maint_fee'] = acco_info.get('maintenance_fee')
+        acco_doc = info['acco_doc']
+        acco_doc.edit(mapping=d)
+        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
+    logger.info('%s new bed allocation failed, code = %s' % (student_id,code))
+    return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
+
+info = {}
+#records = [r for r in beds() if  r.student]
+records = beds.uniqueValuesFor('bed')
+list = []
+to_modify = []
+for b in records:
+    r = beds(bed=b)[0]
+    bedtype = context.getBedStatusFromHall(r.bed)
+    if not bedtype.endswith("reserved"):
+        #logger.info('"%s", "allocated bed is NOT reserved","%s"' % (student_id,bedtype))
+        #list.append("Student %s bed_type %s ok" % (r.student,bedtype))
+        continue
+    if not r.student:
+        beds.modifyRecord(bed=b,
+                      bed_type=bedtype)
+        list.append("Empty bed %s set to %s" % (r.bed,bedtype))
+        continue
+    info = context.getAccommodationInfo(r.student)
+    sbt = info.get('student_status',None)
+    if sbt is None:
+        continue
+    list.append("Student %s bed_type %s != %s" % (r.student,
+                                                  r.bed_type,
+                                                  bedtype))
+    to_modify.append((r.bed,r.student,info['student_status'],info['acco_doc'],bedtype))
+for former_bed, student, status,acco_doc,bedtype in to_modify:
+    beds.modifyRecord(bed=former_bed,
+                      student='',
+                      bed_type=bedtype)
+    code,bed = beds.searchAndReserveBed(student,status)
+    if code > 0:
+        #from Products.zdb import set_trace; set_trace()
+        d = {}
+        d['bed'] = bed
+        d['student_status'] = status
+        acco_info = context.waeup_tool.getAccommodationInfo(bed)
+        d['acco_maint_code'] = acco_info.get('maintenance_code')
+        d['acco_maint_fee'] = acco_info.get('maintenance_fee')
+        acco_doc.edit(mapping=d)
+        list.append("Student %s got bed %s, code = %s" % (student,
+                                                              bed,
+                                                              code))
+return "\r".join(list)
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/release_bed.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/release_bed.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/release_bed.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "change_bed"
+## Script (Python) "release_bed"
 ##bind container=container
 ##bind context=context
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Accommodation.release_bed')
+logger = logging.getLogger('Skins.release_bed')
 
 request = context.REQUEST
@@ -36,8 +36,8 @@
 #set_trace()
 if student_id is not None:
-    logger.info('"%s", "requests bed_release for", "%s"' % (member_id,student_id))
+    logger.info('%s requests bed_release for %s' % (member_id,student_id))
     res = acco_cat(student=student_id)
     if len(res) == 0:
-        logger.info('"%s", "no bed found"' % (student_id))
+        logger.info('no bed of %s found' % (student_id))
         redirect("%s/%s" % (students.absolute_url(),student_id))
     allocated_bed = res[0]
@@ -45,5 +45,5 @@
     acco_doc = context.getContent()
     acco_doc.edit(mapping={'bed':"-- cancelled by section officer --"})
-    logger.info('"%s", "released bed of", "%s"' % (member_id,student_id))
+    logger.info('%s released bed of %s' % (member_id,student_id))
     redirect("%s" % (context.absolute_url()))
 
Index: WAeUP_SRP/branches/uli/skins/waeup_accommodation/reserve_accommodation.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_accommodation/reserve_accommodation.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_accommodation/reserve_accommodation.py	(revision 1593)
@@ -12,5 +12,5 @@
 
 import logging
-logger = logging.getLogger('Student.Accommodation.Reserve')
+logger = logging.getLogger('Skins.reserve_accommodation')
 
 #if info is None:
@@ -19,5 +19,5 @@
 if info is None:
     member_id = str(context.portal_membership.getAuthenticatedMember())
-    logger.info('"%s","tried to reserve accommodation"' % (member_id))
+    logger.info('%s tried to reserve accommodation' % (member_id))
     return context.REQUEST.RESPONSE.redirect("%s/srp_invalid_access" % context.portal_url())
 
@@ -55,5 +55,5 @@
 if psm == 'invalid' or info['error'] is not None:
     member_id = str(context.portal_membership.getAuthenticatedMember())
-    logger.info('"%s", %s' % (member_id,info['error'] ))
+    logger.info('%s, %s' % (member_id,info['error'] ))
     if psm == 'invalid':
         psm = "Please correct your input."
@@ -94,5 +94,5 @@
                                      )
         else:
-            bed = already[0].bed 
+            bed = already[0].bed
         student.invokeFactory('StudentAccommodation',acco_id)
         acco = getattr(student,acco_id)
Index: WAeUP_SRP/branches/uli/skins/waeup_custom/logged_in.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_custom/logged_in.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_custom/logged_in.py	(revision 1593)
@@ -21,5 +21,5 @@
 current = DateTime.DateTime()
 import logging
-logger = logging.getLogger('Member.Login')
+logger = logging.getLogger('Skins.logged_in')
 
 
@@ -71,10 +71,10 @@
         student_per = getattr(student,'personal',None)
         p_review_state = wftool.getInfoFor(student_per,'review_state',None)
-        logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state))
+        logger.info('%s logged in, review_state %s' % (member,s_review_state))
         app_doc = student_app.getContent()
         #from Products.zdb import set_trace;set_trace()
         if load_passport and 'passport' not in app_doc.objectIds():
             msg = context.waeup_tool.loadStudentFoto(student)
-            logger.info('"%s", "%s"' % (member,msg))
+            logger.info('%s, %s' % (member,msg))
         if s_review_state in ("student_created","admitted") and\
                              a_review_state == 'created' :
@@ -134,5 +134,5 @@
             redirect_url = "%s/student_index" % student.absolute_url()
     else:
-        logger.info('"%s", "logged in"' % (member))
+        logger.info('%s logged in' % (member))
         redirect_url = portal.absolute_url()
 #Anonymous
Index: WAeUP_SRP/branches/uli/skins/waeup_custom/logout.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_custom/logout.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_custom/logout.py	(revision 1593)
@@ -10,5 +10,5 @@
 # notify the event service that the user has logged out
 import logging
-logger = logging.getLogger('Member.Logout')
+logger = logging.getLogger('Skins.logout')
 user = context.portal_membership.getAuthenticatedMember()
 if user:
@@ -16,5 +16,5 @@
     evtool = getPublicEventService(context)
     evtool.notifyEvent('user_logout', user, {})
-    logger.info('"%s", "logged out"' % (user))
+    logger.info('%s logged out' % (user))
 
 REQUEST = context.REQUEST
Index: WAeUP_SRP/branches/uli/skins/waeup_default/isCourseAdviser.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_default/isCourseAdviser.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_default/isCourseAdviser.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "isClearanceOfficer"
+## Script (Python) "isCourseAdviser"
 ##bind container=container
 ##bind context=context
@@ -9,7 +9,4 @@
 ##
 # $Id: isClearanceOfficer.py 1087 2006-12-18 22:13:31Z joachim $
-
-#from Products.zdb import set_trace
-#set_trace()
 if context.isStudent():
     return False
Index: WAeUP_SRP/branches/uli/skins/waeup_default/waeup_edit.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_default/waeup_edit.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_default/waeup_edit.py	(revision 1593)
@@ -17,4 +17,10 @@
 from Products.CPSDocument.utils import getFormUidUrlArg
 
+import logging
+logger = logging.getLogger('Skins.waeup_edit')
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+
 # Check flexible controls
 #context.editLayouts(REQUEST=REQUEST)
@@ -25,5 +31,5 @@
 if context.portal_type == "StudentStudyCourse":
     if len(context.objectIds()) > 0:
-        psm = 'Edit of StudyCourse is only possible if there are no levels'
+        psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!'
         args = getFormUidUrlArg(REQUEST)
         args['portal_status_message'] = psm
@@ -58,4 +64,6 @@
                                                   department = c_path[-3],
                                                   )
+            logger.info('%s edited %s (%s) of %s' % (member,context.id,course,student_id))
+
     elif context.portal_type == "StudentApplication":
         entry_mode = ds.get('entry_mode')
@@ -64,4 +72,5 @@
                                               entry_mode = entry_mode,
                                              )
+        logger.info('%s edited %s of %s' % (member,context.id,student_id))
     elif context.portal_type == "StudentClearance":
         matric_no = ds.get('matric_no')
@@ -70,4 +79,5 @@
                                               matric_no = matric_no,
                                              )
+        logger.info('%s edited %s of %s' % (member,context.id,student_id))                                             
     elif context.portal_type in ("StudentPersonal",):
         name = "%(firstname)s %(middlename)s %(lastname)s" % ds
@@ -81,5 +91,5 @@
         #if ds.get('sex'):
         #    jamb_sex = 'F'
-        # originally imported data must be kept; app_doc should not be changed here  
+        # originally imported data must be kept; app_doc should not be changed here
         #app_doc.edit(mapping={'jamb_lastname': name,
         #                      'jamb_sex': jamb_sex
@@ -91,4 +101,5 @@
                                               sex = ds.get('sex'),
                                              )
+        logger.info('%s edited %s of %s' % (member,context.id,student_id))
     elif context.portal_type == "Course":
         dd = {}
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/approve_epayment.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/approve_epayment.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/approve_epayment.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "epayment_cb"
+## Script (Python) "approve_epayment"
 ##bind container=container
 ##bind context=context
@@ -10,8 +10,7 @@
 # $Id: aprove_epayment.py 1425 2007-02-15 17:52:01Z joachim $
 """
-payment callback
 """
 import logging
-logger = logging.getLogger('EPayment.Approve')
+logger = logging.getLogger('Skins.approve_epayment')
 import DateTime
 if context.portal_membership.isAnonymousUser():
@@ -42,5 +41,5 @@
 if doc.type_description.startswith('School Fee'):
     wftool.doActionFor(student,'pay_school_fee')
-logger.info('"%s", "approved epayment for","%s""' % (member,student_id))
+logger.info('%s approves epayment for %s' % (member,student_id))
 wftool.doActionFor(context,'close')
 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('EPayment.CallBack')
+logger = logging.getLogger('Skins.epayment_cb')
 import DateTime
 if context.portal_membership.isAnonymousUser():
@@ -43,10 +43,10 @@
 if  resp == '00':
     wftool.doActionFor(student,'pay_school_fee')
-    logger.info('"%s", "received valid callback"' % student_id)
+    logger.info('%s received valid callback' % student_id)
 
 elif len(resp) < 3:
-    logger.info('"%s", "received no callback"' % student_id)
+    logger.info('%s received no callback' % student_id)
 else:
-    logger.info('"%s", "received unsuccessfull callback"' % student_id)
+    logger.info('%s received unsuccessfull callback' % student_id)
 wftool.doActionFor(context,'close')
 
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getPaymentsInfo"
+## Script (Python) "getPaymentsFolderInfo"
 ##bind container=container
 ##bind context=context
@@ -12,6 +12,7 @@
 Info for the PaymentsFolder
 """
-import logging
-logger = logging.getLogger('EPayment.Info')
+#import logging
+#logger = logging.getLogger('Skins.getPaymentsFolderInfo')
+
 import DateTime
 request = context.REQUEST
@@ -57,5 +58,5 @@
         row['confirmed'] = 'unsuccessful'
     payments.append(row)
-    
+
 
 info['payments'] = payments
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_by_sc.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_by_sc.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_by_sc.py	(revision 1593)
@@ -14,5 +14,5 @@
 import logging
 from urllib import urlencode
-logger = logging.getLogger('EPayment.PayBySC')
+logger = logging.getLogger('Skins.pay_by_sc')
 import DateTime
 
@@ -85,7 +85,7 @@
     wftool.doActionFor(payment,'close')
     wftool.doActionFor(student,'pay_school_fee')
-    logger.info('"%s", "paid school fee by scratch card"' % student_id)
+    logger.info('%s paid school fee by scratch card' % student_id)
 else:
-    logger.info('"%s", "repeatedly paid school fee by scratch card"' % student_id)
+    logger.info('%s repeatedly paid school fee by scratch card' % student_id)
 url = "%s/payments" % (student.absolute_url())
 request.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py	(revision 1593)
@@ -14,5 +14,5 @@
 from urllib import urlencode
 import logging
-logger = logging.getLogger('EPayment.PayOnline')
+logger = logging.getLogger('Skins.pay_online')
 import DateTime
 
@@ -91,5 +91,5 @@
 info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id)
 
-logger.info('"%(student_id)s","%(type_description)s", "%(amount)s N"' % info)
+logger.info('%(student_id)s initiated online school fee payment' % info)
 payment_fields = (('x_SiteID','site_id'),
                   ('x_Redirect_url','callback_url'),
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/simulate_callback.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/simulate_callback.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/simulate_callback.py	(revision 1593)
@@ -5,9 +5,11 @@
 return html renderer + psm
 """
-import DateTime,logging
+import DateTime
 current = DateTime.DateTime()
 pr = context.portal_registration
-logger = logging.getLogger('EPayment.Simulate')
 validate = REQUEST.has_key("cpsdocument_edit_button")
+
+import logging
+logger = logging.getLogger('Skins.simulate_callback')
 
 args = {}
@@ -18,4 +20,8 @@
 args['x_ApprAmt'] = REQUEST.get('x_amt')
 
+
+student_id = context.getStudentId()
+logger.info('%s received simulated callback' % student_id)
+
 from urllib import urlencode
 #url = "%s/epayment_cb/?%s" % (context.absolute_url(),urlencode(args))
Index: WAeUP_SRP/branches/uli/skins/waeup_pins/disable_pins.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_pins/disable_pins.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_pins/disable_pins.py	(revision 1593)
@@ -15,5 +15,5 @@
 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
 import logging
-logger = logging.getLogger('Pin.Disable')
+logger = logging.getLogger('Skins.disable_pins')
 
 request = REQUEST
@@ -39,4 +39,4 @@
             }
     pincat.modifyRecord(**dict)
-    logger.info('"%s","disabled pin","%s"' % (member,uid))
+    logger.info('%s disabled pin %s' % (member,uid))
 return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url())
Index: WAeUP_SRP/branches/uli/skins/waeup_pins/enable_pins.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_pins/enable_pins.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_pins/enable_pins.py	(revision 1593)
@@ -15,5 +15,5 @@
 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
 import logging
-logger = logging.getLogger('Pin.Enable')
+logger = logging.getLogger('Skins.enable_pins')
 
 request = REQUEST
@@ -42,4 +42,4 @@
             }
     pincat.modifyRecord(**dict)
-    logger.info('"%s","enabled pin","%s"' % (member,pid))
+    logger.info('%s enabled pin %s' % (member,uid))
 return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url())
Index: WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py	(revision 1593)
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=
+##parameters=REQUEST=None, action_after_validate=None
 ##title=
 ##
@@ -12,4 +12,8 @@
 add a StudentCourseResult object
 """
+
+import logging
+logger = logging.getLogger('Skins.add_course_result')
+
 from urllib import urlencode
 try:
@@ -23,4 +27,9 @@
 aq_portal = context.portal_catalog.evalAdvancedQuery
 course_id = request.get('course_id')
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+
+
 d = context.getCourseInfo(course_id)
 args = {}
@@ -28,11 +37,14 @@
 while True:
     if d['title'] == 'unknown':
-        err = "No such course"
+        err = "No such course!"
+        logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id))
         break
     if context.hasObject(course_id):
-        err = "Course already exists"
+        err = "Course already exists!"
+        logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id))
         break
     if context.hasObject("%s_co" % course_id):
-        err = "Course already exists as carryover course"
+        err = "Course already exists as carryover course!"
+        logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id))
         break
     break
@@ -40,7 +52,10 @@
 if err:
     args['course_id'] = course_id
-    args['error'] = err
+    #args['error'] = err
+    args['portal_status_message'] = err
     url = "%s?%s" % (context.absolute_url(),urlencode(args))
     return request.RESPONSE.redirect(url)
+
+
 cr_id = context.invokeFactory('StudentCourseResult',course_id)
 #set_trace()
@@ -50,6 +65,11 @@
 context.portal_workflow.doActionFor(cr,'close')
 args['course_id'] = course_id
-from urllib import urlencode
-url = "%s?%s" % (context.absolute_url(),urlencode(args))
-return request.RESPONSE.redirect(url)
 
+logger.info('%s added StudentCourseResult object %s' % (member,course_id))
+
+args = {}
+psm = "You successfully added course %s!" % course_id
+args['portal_status_message'] = psm
+url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+return REQUEST.RESPONSE.redirect(url)
+
Index: WAeUP_SRP/branches/uli/skins/waeup_student/add_student.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/add_student.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/add_student.py	(revision 1593)
@@ -13,5 +13,5 @@
 acco_cat = context.portal_accommodation
 import logging
-logger = logging.getLogger('Student.Add')
+logger = logging.getLogger('Skins.add_student')
 
 validate = REQUEST.has_key("cpsdocument_edit_button") and\
@@ -67,5 +67,5 @@
 student_rec = context.getFormattedStudentEntry(context.students_catalog(id = sid)[0])
 psm = "Student record with Id %s and Password %s has been created." % (sid,password)
-logger.info('"%s","created student","%s"' % (member,sid))
+logger.info('%s created student %s' % (member,sid))
 return context.add_student_form(rendered = rendered,
                                  #psm = "%s, %s" % (psm,ds),
Index: WAeUP_SRP/branches/uli/skins/waeup_student/application_edit.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/application_edit.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/application_edit.py	(revision 1593)
@@ -16,5 +16,5 @@
 current = DateTime.DateTime()
 import logging
-logger = logging.getLogger('Student.Application.Edit')
+logger = logging.getLogger('Skins.application_edit')
 
 # Until ajax posts directly to its own script...
@@ -30,5 +30,5 @@
 
 if info is None:
-    logger.info('"anonymous access","%s"' % REQUEST.get('URL0'))
+    logger.info('Anonymous user tried to access %s"' % REQUEST.get('URL0'))
     return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
 
@@ -56,5 +56,5 @@
     elif cpsdocument_edit_and_view_button:
         if 1: ## app_doc.passport is not None:
-            logger.info('"%s", "proceeded to start clearance"' % (info['id']))
+            logger.info('%s proceeded to start clearance' % (info['id']))
             action = "/start_clearance"
             base_url = student.absolute_url()
Index: WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py	(revision 1593)
@@ -14,5 +14,5 @@
 current = DateTime.DateTime()
 #pr = context.portal_registration
-logger = logging.getLogger('Student.change_password')
+logger = logging.getLogger('Skins.change_password')
 validate = request.has_key("change_password")
 students_dir = context.portal_directories.students
@@ -24,5 +24,5 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access %s' % (member_id,requested_id))
     return None
 elif context.isStaff():
@@ -74,4 +74,5 @@
 args['__ac_name'] = student_id
 args['__ac_password'] = password
+logger.info('%s changed password from %s to %s' % (member_id,old_password,password))
 from urllib import urlencode
 url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
Index: WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py	(revision 1593)
@@ -16,5 +16,5 @@
 current = DateTime.DateTime()
 import logging
-logger = logging.getLogger('Student.Clearance.Edit')
+logger = logging.getLogger('Skins.clearance_edit')
 request = REQUEST
 
@@ -70,5 +70,5 @@
     if cpsdocument_edit_button or result_edit_button:
         psm = "Content changed!"
-        logger.info('"%s","edited clearance of","%s"' % (member_id,student_id ))
+        logger.info('%s edited clearance of %s' % (member_id,student_id ))
         if clear_doc.clr_ac_pin == "":
             res = context.portal_pins(student=member_id)
@@ -92,8 +92,8 @@
                     missing = True
             if missing:
-                logger.info('"%s","requested clearance with documents missing"' % (student_id))
+                logger.info('%s requested clearance with documents missing' % (student_id))
                 psm = "You have not uploaded all necessary documents to request clearance!"
             else:
-                logger.info('"%s","requested clearance"' % (student_id))
+                logger.info('%s requested clearance' % (student_id))
                 info['clear_doc'].edit(mapping = {'request_date': current,})
                 wftool.doActionFor(info['clear'],'close')
@@ -103,10 +103,10 @@
                     action = "/clearance_view"
         elif acknowledge and info['review_state'] != "clearance_pin_entered":
-            logger.info('"%s","repeatedly requested clearance"' % (student_id))
+            logger.info('%s repeatedly requested clearance' % (student_id))
             psm = "You have already requested clearance!"
         else:
             psm = "You must tick the acknowledgement check box before submission!"
     elif clear_and_validate_button and info['review_state'] == "clearance_requested":
-        logger.info('"%s","cleared","%s"' % (member_id,student_id ))
+        logger.info('%s cleared %s' % (member_id,student_id ))
         #from Products.zdb import set_trace
         #set_trace()
@@ -117,9 +117,12 @@
         psm = "This student is already cleared!"
     elif reject_clearance_button:
-        logger.info('"%s","rejected clearance for","%s"' % (member_id,student_id ))
+        logger.info('%s rejected clearance for %s' % (member_id,student_id ))
         wftool.doActionFor(info['clear'],'open')
         wftool.doActionFor(info['student'],'reject_clearance')
         action = "/contact_student_form"
         psm = "Student's clearance request has been rejected! Please fill and submit the form below!"
+        subject = "Clearance request rejected"
+        args['subject'] = subject
+        args['continue'] = 'external_clearance_edit_form'
 else:
     psm = "Please correct your errors!"
@@ -128,4 +131,4 @@
 args['portal_status_message'] = psm
 url = clear.absolute_url() + action + '?' + urlencode(args)
-REQUEST.RESPONSE.redirect(url)
+return REQUEST.RESPONSE.redirect(url)
 
Index: WAeUP_SRP/branches/uli/skins/waeup_student/clearance_slip.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/clearance_slip.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/clearance_slip.pt	(revision 1593)
@@ -1,5 +1,5 @@
-<metal:html tal:define="info context/getClearanceInfo">
-  <metal:body use-macro="here/main_template/macros/master">
-    <metal:main fill-slot="main">
+<metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main"
+                 tal:define="info context/getClearanceInfo">
       <span tal:condition="not: info">
         <span tal:content="here/illegal_view" />
@@ -66,4 +66,3 @@
       </span>
     </metal:main>
-  </metal:body>
-</metal:html>
+</metal:body>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt	(revision 1593)
@@ -1,6 +1,9 @@
+<metal:block define-macro="contact_student_form">
 <metal:body use-macro="here/main_template/macros/master">
     <metal:main fill-slot="main"
                 tal:define="member python:context.portal_membership.getAuthenticatedMember();
                         info context/getStudentBaseInfo;
+                        subject python:context.REQUEST.get('subject');
+                        continue python:context.REQUEST.get('continue')
                         ">
       <span tal:condition="not: info">
@@ -8,5 +11,5 @@
       </span>                        
     
-      <span tal:condition="info">
+      <span tal:condition="python: info and subject">
       <h3>Contact Student</h3>
       <br />
@@ -23,5 +26,7 @@
       <input type="hidden" name="student_email" type="text" id="student_email"
              tal:attributes="value info/student/email"/>                   
-
+      <input type="hidden" name="probtype" type="text" id="probtype"
+             tal:attributes="value subject"/>     
+             
       <table width="100%" border="0" cellspacing="5" cellpadding="0">
         <tr>
@@ -42,11 +47,9 @@
         </tr>
         <tr>
-          <td>
-             <strong>Type of Rejection: </strong>
+          <td valign="top">
+             <strong>Reason of Notification: </strong>
           </td>
-          <td>
-              <select name="probtype" class="boxgreen" id="probtype">
-                <option>Clearance request rejected</option>
-              </select>        
+          <td valign="bottom">
+             <span tal:content="subject" />
           </td>
         </tr>        
@@ -67,5 +70,6 @@
       </span>
       <form action="." method="post" class="group">
-            <input type="submit" name="external_clearance_edit_form:method"
+            <input type="submit" name="."
+                       tal:attributes="name string:${continue}:method"
                        class="context" value="Continue" />
       </form>      
@@ -73,2 +77,3 @@
     </metal:main>
 </metal:body>
+</metal:block>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt	(revision 1593)
@@ -1,12 +1,13 @@
-<metal:html tal:define="info context/getStudyLevelInfo;
+<metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main"
+                tal:define="info context/getStudyLevelInfo;
                   is_so context/isSectionOfficer;
                   is_ca info/is_ca;
                   show_check_boxes info/show_check_boxes;
-		  is_student info/is_student;
-		  status_info info/status_info;
-		  review_state info/review_state;
-		  view_only info/view_only">
-  <metal:body use-macro="here/main_template/macros/master">
-    <metal:main fill-slot="main">
+                  validated python:context.getStudentReviewState() in ('courses_validated',);
+		              is_student info/is_student;
+            		  status_info info/status_info;
+            		  review_state info/review_state;
+            		  view_only info/view_only">
       <span tal:condition="not: info">
         <span tal:content="here/illegal_view" />
@@ -14,29 +15,24 @@
       <span tal:condition="info">
       <h3>Course Registration Slip</h3>
+      
       <br />
-      <table width="" cellpadding="2" cellspacing="0">
+      
+      <div tal:condition="validated">
+        - validated by Course Adviser -
+      </div>
+      <div tal:condition="not: validated">
+        - not yet validated by Course Adviser -
+      </div>
+      
+      <br />
+      <span tal:omit-tag=""
+            tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
+            layout_mode='view_info', 
+            layout_id='student_application_fe')" 
+            />           
+
+      <table  cellpadding="2" cellspacing="0">
           <tr>
-            <td valign="top"><span class="dlabel">Name</span>:
-            </td>
-            <td> 
-              <span tal:content="info/student/name" />
-            </td>      
-          </tr>
-          <tr>
-            <td valign="top"><span class="dlabel">Student Id</span>:
-            </td>
-            <td> 
-              <span tal:content="info/student/id" />
-            </td>      
-          </tr>
-          <tr>
-            <td valign="top"><span class="dlabel">Matriculation No</span>:
-            </td>
-            <td> 
-              <span tal:content="info/student/matric_no" />
-            </td>      
-          </tr>
-          <tr>
-            <td valign="top"><span class="dlabel">Faculty Id</span>:
+            <td valign="top" width="180px"><span class="dlabel">Faculty Id</span>:
             </td>
             <td> 
@@ -111,5 +107,4 @@
        </span>              
     </metal:main>
-  </metal:body>
-</metal:html>
+</metal:body>
   
Index: WAeUP_SRP/branches/uli/skins/waeup_student/course_result_delete.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/course_result_delete.py	(revision 1592)
+++ 	(revision )
@@ -1,27 +1,0 @@
-## Script (Python) "folder_delete"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=ids=[], REQUEST=None
-##title=
-##
-# $Id$
-"""
-FIXME: add docstring.
-"""
-
-from Products.CMFCore.utils import getToolByName
-here = context
-
-ret_url = here.absolute_url()
-
-if ids:
-    here.manage_delObjects(ids)
-    message = 'portal_status_message=psm_item(s)_deleted'
-else:
-    message = 'portal_status_message=psm_select_at_least_one_document'
-
-if REQUEST is not None:
-    return REQUEST.RESPONSE.redirect(ret_url + '?' + message)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py	(revision 1593)
@@ -21,5 +21,5 @@
 response = request.RESPONSE
 redirect = response.redirect
-logger = logging.getLogger('Student.create_level')
+logger = logging.getLogger('Skins.create_level')
 mtool = context.portal_membership
 member = mtool.getAuthenticatedMember()
@@ -30,8 +30,13 @@
 cert_id = student.course
 current_level = student.level
-in_progress =  session.get('in_progress','finished')
-if in_progress == 'finished':
+in_progress =  request.get('in_progress','not started')
+
+if context.hasObject(current_level):
+    response.redirect("%s/%s" % (context.absolute_url(),current_level))
+    return
+
+if in_progress in ('not started','started'):
     session.set('in_progress','started')
-    view = context.in_progress_view(refresh=3,page='%s/study_level_view' % current_level)
+    view = context.in_progress_view(refresh=3,page='create_level?in_progress=started')
     response.setHeader('Content-type','text/html; charset=ISO-8859-15')
     response.setHeader('Content-length','%d' % (len(view)))
@@ -39,6 +44,8 @@
     response.write(view)
     response.write('')
-elif in_progress == 'started':
-    return
+    if in_progress == 'started':
+        return
+    
+
 context.invokeFactory('StudentStudyLevel',"%s" % current_level)
 level = getattr(context,"%s" % current_level)
@@ -57,5 +64,5 @@
         c_res = aq_courses(query)
         if not c_res:
-            logger.info('"%s","%s course not found in courses catalog"' % (student.id,co.CosCode))
+            logger.info('%s", course %s not found in courses_catalog' % (student.id,co.CosCode))
             continue
         course_cat_entry = c_res[0]
@@ -67,9 +74,9 @@
                 score = int(co.Score)
             except:
-                logger.info('"%s"," course %s invalid score %s"' % (student.id,
+                logger.info('%s, course %s has invalid score %s"' % (student.id,
                                                                     co.CosCode,
                                                                     co.Score))
                 continue
-            if int(c_res[0].passmark) <= score:  
+            if int(c_res[0].passmark) <= score:
                 continue
             carry_over = True
@@ -99,5 +106,3 @@
         d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
         course_result.getContent().edit(mapping=d)
-session.set('in_progress','finished')
 return
-return response.redirect("%s" % level.absolute_url())
Index: WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py	(revision 1593)
@@ -0,0 +1,42 @@
+## Script (Python) "delete_course_result"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=ids=[], REQUEST=None, action_after_reject=None, action_after_validate=None
+##title=
+##
+# $Id: delete_course_result.py 1557 2007-03-15 16:00:27Z joachim $
+"""
+FIXME: add docstring.
+"""
+
+from Products.CMFCore.utils import getToolByName
+here = context
+from urllib import urlencode
+import logging
+logger = logging.getLogger('Skins.delete_course_result')
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+
+ret_url = here.absolute_url()
+
+message = ''
+if ids:
+    real_ids = []
+    for id in ids:
+        if context.hasObject(id):
+            real_ids.append(id)
+    if real_ids:
+        context.manage_delObjects(real_ids)
+        logger.info('%s deleted StudentCourseResult object %s' % (member,id))
+        message = 'psm_item(s)_deleted'
+else:
+    message = 'psm_select_at_least_one_document'
+    
+args = {}
+args['portal_status_message'] = message
+url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+if REQUEST is not None:
+    return REQUEST.RESPONSE.redirect(url)    
Index: WAeUP_SRP/branches/uli/skins/waeup_student/external_contact_student_form.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/external_contact_student_form.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/external_contact_student_form.pt	(revision 1593)
@@ -0,0 +1,1 @@
+<metal:block use-macro="here/contact_student_form/macros/contact_student_form" />
Index: WAeUP_SRP/branches/uli/skins/waeup_student/external_study_level_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/external_study_level_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/external_study_level_view.pt	(revision 1593)
@@ -0,0 +1,201 @@
+<metal:html>
+  <metal:body use-macro="here/waeup_content_master/macros/master">
+    <metal:block fill-slot="header" 
+                 tal:define="global info context/getStudyLevelInfo;
+                 global is_so context/isSectionOfficer;
+                 global is_ca info/is_ca;
+                 global show_check_boxes info/show_check_boxes;
+		             global is_student info/is_student;
+		             global status_info info/status_info;
+		             global review_state info/review_state;
+		             global view_only info/view_only">
+              <div style="text-align: right"
+             tal:condition="python:review_state == 'courses_validated'">
+        <a href="" target="slip" tal:attributes="href string:course_registration_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" />
+            Course Registration Slip
+        </a>
+        
+        </div>
+
+      <h3> 
+        <span tal:condition="python: is_so or is_ca">
+          <span tal:content="info/student/name" />:
+        </span>
+        Course Registration Form for <span tal:content="here/title_or_id" />
+      </h3>
+
+    </metal:block>
+    <metal:main fill-slot="main" tal:condition="python:1">
+      <form action="." method="post" class="group">
+        <span tal:condition="info/carry_overs" tal:omit-tag="">
+        <h4>Carryover Courses</h4>
+        <br />
+        <table tal:condition="python: 1" class="contentListing" width="100%" summary="content layout" id="folder_content">
+          <tr tal:repeat="row info/carry_overs"
+              tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
+            <td align="left" valign="middle" style="width: 5px;"
+                tal:condition="show_check_boxes">
+              <input type="checkbox" name="ids:list" value="" id="" class="noborder"
+                     tal:define="id row/id"
+                     tal:attributes="value id;
+                     id python:'cb_' + id;
+                     checked python:id in info['choosen_ids'];" 
+                     />
+            </td>
+            <td width="78%" tal:content="row/title"></td>
+            <td align="center" width="10%" tal:content="row/code"></td>
+            <td align="center" width="2%">S<span tal:content="row/semester" /></td>
+            <td align="center" width="2%" tal:content="row/credits"></td>
+            <td align="center" width="8%" tal:content="row/grade|string:"></td>
+          </tr>
+        </table>
+        </span> 
+        <br />
+        <h4>Session Courses</h4>
+        <br />
+      <div class="" tal:condition="not: info/normal">
+        Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!
+      </div>
+        <table class="contentListing" width="100%" id="folder_content"
+               tal:condition="info/normal">      
+          <tr tal:repeat="row info/normal"
+              tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
+            <td align="left" valign="middle" style="width: 5px;"
+	              tal:condition="show_check_boxes">
+              <input type="checkbox" name="ids:list" value="" id="" class="noborder"
+                     tal:define="id row/id"
+                     tal:attributes="value id;
+                     id python:'cb_' + id;
+                     checked python:id in info['choosen_ids'];" 
+                     />
+            </td>
+            <td width="78%" tal:content="row/title"></td>
+            <td align="center" width="10%" tal:content="row/code"></td>
+            <td align="center" width="2%">S<span tal:content="row/semester" /></td>
+            <td align="center" width="2%" tal:content="row/credits"></td>
+            <td align="center" width="8%" tal:content="row/coe|nothing"></td>
+          </tr>
+          <tr>
+            <td tal:condition="show_check_boxes" colspan="1"></td>
+            <td colspan="1"></td>
+            <th colspan="2">Total Credits:</th>
+            <td align="center" width="2%" tal:content="info/credits_total"></td>
+          </tr>
+        </table>
+
+        
+      
+        
+        <table tal:condition="python: is_student and review_state == 'school_fee_paid'" width="100%" cellspacing="0" cellpadding="2"
+               class="folderButtons">
+          <tr>
+            <td align="left" valign="top" rowspan="3"></td>
+            <td align="left" valign="top">
+                <input type="submit" name="delete_course_result:method" value="Delete selected"
+                       class="destructive" i18n:attributes="value"
+                       tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                       ('Do you really want to delete selected courses?', )" 
+                       />
+                <input type="submit" name="refresh_level:method"
+                       class="context" value="Update" 
+                       />
+                <br /><br />
+                <input tal:condition="info/normal" 
+                       type="submit" name="register_courses:method"
+                       class="context" value="Submit" />
+            </td>
+          </tr>
+        </table>
+        <table tal:condition="python:is_so" width="100%" cellspacing="0" cellpadding="2"
+               class="folderButtons">
+          <tr>
+            <td align="left" valign="top" rowspan="3"></td>
+            <td align="left" valign="top">
+                <input type="button" value="Select all" class="context"
+                       onclick="someJavaScriptFunctionThatWillBeReplaced"
+                       i18n:attributes="value"
+                       tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')'
+                       % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
+                       />
+                <input type="submit" name="delete_course_result:method" value="Delete selected"
+                       class="destructive" i18n:attributes="value"
+                       tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                       ('Do you really want to delete the courses selected?', )" 
+                       />
+                <input 
+                       type="submit" name="refresh_level:method"
+                       class="context" value="Update" 
+                       />
+                <input tal:condition="python: review_state == 'school_fee_paid'" type="submit" name="register_courses:method"
+                       class="context" value="Submit" />  
+                <input tal:condition="python: review_state == 'courses_registered'" type="submit" name="validate_courses:method"
+                       class="context" value="Validate" />
+                <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method"
+                       class="context" value="Reject" />
+
+            </td>
+          </tr>
+        </table>
+        <table tal:condition="python:is_ca" width="100%" cellspacing="0" cellpadding="2"
+               class="folderButtons">
+          <tr>
+            <td align="left" valign="top" rowspan="3"></td>
+            <td align="left" valign="top">
+                <input tal:condition="python: review_state == 'school_fee_paid'"
+                       type="button" value="Select all" class="context"
+                       onclick="someJavaScriptFunctionThatWillBeReplaced"
+                       i18n:attributes="value"
+                       tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')'
+                       % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
+                       />
+                <input tal:condition="python: review_state == 'school_fee_paid'"
+                       type="submit" name="delete_course_result:method" value="Delete selected"
+                       class="destructive" i18n:attributes="value"
+                       tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                       ('Do you really want to delete the courses selected?', )" 
+                       />
+                <input tal:condition="python: review_state == 'school_fee_paid'"
+                       type="submit" name="refresh_level:method"
+                       class="context" value="Update" 
+                       />
+                <input tal:condition="python: review_state == 'school_fee_paid'" type="submit" name="register_courses:method"
+                       class="context" value="Submit" />  
+                <input tal:condition="python: review_state == 'courses_registered'" type="submit" name="validate_courses:method"
+                       class="context" value="Validate" />
+                <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method"
+                       class="context" value="Reject" />
+
+                <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:external_study_level_view"/>                         
+                <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
+                       tal:attributes="value string:external_contact_student_form"/>    
+                                           
+
+            </td>
+          </tr>
+        </table>
+
+      </form>
+      <br />
+        <form action="add_course_result" method="post" class="group"
+            tal:condition="show_check_boxes">
+        <table>
+          <tr>
+            <th>Course Id</th>
+            <td><input type="text" name="course_id" 
+                       tal:attributes="value request/course_id|nothing"/></td>
+            <td colspan="2">
+              <input type="submit" name="add"
+                     class="context" value="Add Course" 
+                     />
+              <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:external_study_level_view"/>                      
+            </td>                
+        </table>
+        </form>         
+    </metal:main>
+  </metal:body>
+</metal:html>
+  
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getAccommodationInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getAccommodationInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getAccommodationInfo.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Accommodation.Info')
+logger = logging.getLogger('Skins.getAccommodationInfo')
 import DateTime
 
@@ -29,5 +29,5 @@
     requested_id = context.getStudentId()
     if requested_id and not context.isStaff() and member_id != requested_id:
-        logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+        logger.info('%s tried to access %s' % (member_id,requested_id))
         return None
     elif context.isStaff():
@@ -37,5 +37,5 @@
 res = context.students_catalog(id=student_id)
 if len(res) != 1:
-    logger.info('"%s","not found in students_catalog"')
+    logger.info('%s not found in students_catalog' % student_id)
     return None
 
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getApplicationInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getApplicationInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getApplicationInfo.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Application.Info')
+logger = logging.getLogger('Skins.getApplicationInfo')
 
 request = context.REQUEST
@@ -28,6 +28,7 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "accessed application object of", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access application object of %s' % (member_id,requested_id))
     student_id = requested_id
+    return None
 elif context.isStaff():
     student_id = requested_id
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getClearanceInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getClearanceInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getClearanceInfo.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Clearance.Info')
+logger = logging.getLogger('Skins.getClearanceInfo')
 from DateTime import DateTime
 
@@ -30,5 +30,5 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access %s' % (member_id,requested_id))
     return None
 elif context.isStaff():
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getMemberInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getMemberInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getMemberInfo.py	(revision 1593)
@@ -28,6 +28,7 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "accessed personal object of", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access personal object of %s' % (member_id,requested_id))
     student_id = requested_id
+    return None
 elif context.isStaff():
     student_id = requested_id
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getNewStudentStatistics.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getNewStudentStatistics.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getNewStudentStatistics.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Statistics')
+logger = logging.getLogger('Skins.getNewStudentStatistics')
 
 try:
@@ -21,5 +21,5 @@
 except:
     evalAdvancedQuery = None
-logger.info('"%s","invoked new statistics"' % context.portal_membership.getAuthenticatedMember())
+logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember())
 l = []
 if not context.isStaff():
@@ -108,5 +108,5 @@
     if total:
         dep['cleared_and_validated_percent'] = "%.0f" % round(cav*100/total)
-        
+
     ora = len([s for s in fac_ids if s in or_ids])
     dep['objection_raised'] = ora
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getPersonalInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getPersonalInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getPersonalInfo.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Personal.Info')
+logger = logging.getLogger('Skins.getPersonalInfo')
 
 request = context.REQUEST
@@ -28,6 +28,7 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "accessed personal object of", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access personal object of %s' % (member_id,requested_id))
     student_id = requested_id
+    return None
 elif context.isStaff():
     student_id = requested_id
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getRegStatistics.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getRegStatistics.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getRegStatistics.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Statistics')
+logger = logging.getLogger('Skins.getRegStatistics')
 
 try:
@@ -21,5 +21,5 @@
 except:
     evalAdvancedQuery = None
-logger.info('"%s","invoked reg statistics"' % context.portal_membership.getAuthenticatedMember())
+logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember())
 l = []
 if not context.isStaff():
@@ -81,5 +81,5 @@
     if total:
         dep['courses_registered_percent'] = "%.0f" % round(creg*100/total)
-        
+
     cval = len([s for s in fac_ids if s in cval_ids])
     dep['courses_validated'] = cval
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getRetStudentStatistics.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getRetStudentStatistics.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getRetStudentStatistics.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Statistics')
+logger = logging.getLogger('Skins.getRetStudentStatistics')
 
 try:
@@ -21,20 +21,26 @@
 except:
     evalAdvancedQuery = None
-logger.info('"%s","invoked returning statistics"' % context.portal_membership.getAuthenticatedMember())
+logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember())
 l = []
 if not context.isStaff():
     return l
 dep = {}
-sum = 0
 dep['id'] = "All Faculties"
 
-#from Products.zdb import set_trace;set_trace()
 
-ret_res = context.portal_catalog(review_state ='returning')
-ret_ids = [r.getId for r in ret_res]
-ret = len(ret_res)
-dep['total'] = ret
+ret_res1 = context.portal_catalog(review_state = 'returning')
+ret_ids1 = [r.getId for r in ret_res1]
+total_ret = len(ret_ids1)
+
+ret_res2 = context.portal_catalog(review_state = ('school_fee_paid','courses_registered','courses_validated',))
+ret_ids2 = [r.getId for r in ret_res2]
+
+retquery = Ge('level','300') | (Eq('level','200') & Eq('entry_mode','UME'))
+ret_res3 = aq_students(retquery)
+ret_ids3 = [r.id for r in ret_res3]
 
 l.append(dep)
+sum_ret = 0
+sum_sfp = 0
 fs = context.portal_catalog(portal_type="Faculty")
 for fid in [f.getId for f in fs]:
@@ -45,18 +51,20 @@
     stud_ids = [r.id for r in stud_res]
     total = float(len(stud_res))
-
     if total == 0:
         continue
-
-    ret = len([s for s in stud_ids if s in ret_ids])
-    dep['returned'] = ret
-    sum += ret
-
-    if ret == 0:
-        continue
+    sfp = len([s for s in stud_ids if s in ret_ids2 and s in ret_ids3])
+    dep['sfp'] = sfp
+    ret = len([s for s in stud_ids if s in ret_ids1])
+    dep['ret'] = ret
+    sum_ret += ret
+    sum_sfp += sfp
 
     l.append(dep)
 
-l[0]['sum'] = sum
+l[0]['ret'] = sum_ret
+l[0]['sfp'] = sum_sfp
+l[0]['total_ret'] = total_ret + sum_sfp
+l[0]['total_li'] = sum_ret + sum_sfp
+
 
 return l
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getSchoolFeePrefix.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getSchoolFeePrefix.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getSchoolFeePrefix.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getMaintenancePrefix"
+## Script (Python) "getSchoolFeePrefix"
 ##bind container=container
 ##bind context=context
@@ -16,6 +16,6 @@
     return None
 
-import logging    
-logger = logging.getLogger('EPayment.getSchoolFeePrefix')    
+import logging
+logger = logging.getLogger('Skins.getSchoolFeePrefix')
 
 student_id = context.getStudentId()
@@ -24,5 +24,5 @@
                                      id = sbrain.course)
 if not res:
-    logger.info('"%s","certificate not found", "%s"' % (student_id,course))
+    logger.info('%s, certificate %s not found' % (student_id,course))
     prefix = "--"
 else:
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py	(revision 1593)
@@ -27,6 +27,6 @@
 if requested_id and not context.isStaff() and member_id != requested_id:
     import logging
-    logger = logging.getLogger('Student.SessionResults.Info')
-    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+    logger = logging.getLogger('Skins.getSessionResults')
+    logger.info('%s tried to access %s' % (member_id,requested_id))
     return None
 elif context.isStaff():
@@ -99,10 +99,11 @@
     gpa = "%4.2f" % gpa
 
-
+#set_trace()
 verdict_voc = context.portal_vocabularies.verdicts
-if verdict_voc.has_key(student_from_cat.verdict):
-    info['verdict'] = verdict = verdict_voc.get(student_from_cat.verdict).upper()
+verdict_code = student_from_cat.get('verdict',None)
+if verdict_code:
+    info['verdict'] = verdict = verdict_voc.get(verdict_code,'N/A').upper()
 else:
-    info['verdict'] = 'N/A'
+    info['verdict'] = verdict = 'N/A'
 
 if student_from_cat.level:
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudentBaseInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudentBaseInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudentBaseInfo.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Base.Info')
+logger = logging.getLogger('Skins.getStudentBaseInfo')
 from DateTime import DateTime
 
@@ -29,5 +29,5 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access %s' % (member_id,requested_id))
     return None
 elif context.isStaff():
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudentFolderInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudentFolderInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudentFolderInfo.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getStudentInfo"
+## Script (Python) "getStudentFolderInfo"
 ##bind container=container
 ##bind context=context
@@ -21,5 +21,5 @@
 
 import logging
-logger = logging.getLogger('Student.Info')
+logger = logging.getLogger('Skins.getStudentFolderInfo')
 
 
@@ -38,5 +38,5 @@
         break
     if member_id != requested_id:
-        logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+        logger.info('%s tried to access %s' % (member_id,requested_id))
         student_id = member_id
         mtool.assertViewable(context)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudentInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudentInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudentInfo.py	(revision 1593)
@@ -21,5 +21,5 @@
 
 import logging
-logger = logging.getLogger('Student.Info')
+logger = logging.getLogger('Skins.getStudentInfo')
 
 
@@ -42,5 +42,5 @@
             break
         if member_id != requested_id:
-            logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+            logger.info('%s tried to access %s' % (member_id,requested_id))
             student_id = member_id
             mtool.assertViewable(context)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py	(revision 1593)
@@ -52,11 +52,11 @@
 levels = context.objectIds()
 review_state = wftool.getInfoFor(context,'review_state',None)
-if review_state != 'content_addable':
+student_review_state = context.getStudentReviewState()
+if review_state != 'content_addable' and student_review_state == 'school_fee_paid': #and context.isStudent():
     wftool.doActionFor(context,'close_for_edit')
-student_review_state = context.getStudentReviewState()
 may_register = (student_review_state in ('school_fee_paid',)) and\
                current_level not in levels and\
                (sbrain.verdict in ('A','B') or sbrain.jamb_reg_no.startswith('6'))
-               
+
 levels.sort()
 info['create_level'] = None
@@ -72,8 +72,8 @@
 info['items'] = items
 
-try: 
+try:
     info['verdict'] = context.portal_vocabularies.verdicts.get(info['doc'].current_verdict).upper()
 except:
-    info['verdict'] = course.current_verdict 
+    info['verdict'] = course.current_verdict
 
 return info
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py	(revision 1593)
@@ -61,5 +61,5 @@
 info['review_state'] = review_state = context.getStudentReviewState()
 info['view_only'] =  review_state != "school_fee_paid"
-info['show_check_boxes'] =  (is_ca and review_state in ('courses_registered',)) or\
+info['show_check_boxes'] =  (is_ca and review_state in ('school_fee_paid',)) or\
                             (is_student and context.getStudentReviewState() == "school_fee_paid") or\
                             (is_so)
@@ -108,3 +108,9 @@
 normal.sort(cmp_semester)
 info['normal'] = normal
+
+students_object = context.portal_url.getPortalObject().campus.students
+student = getattr(students_object, student_id)
+info['app'] = student.application
+info['app_doc'] = student.application.getContent()
+
 return info
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getTransferInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getTransferInfo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getTransferInfo.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getClearanceInfo"
+## Script (Python) "getTransferInfo"
 ##bind container=container
 ##bind context=context
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Student.Transfer.Info')
+logger = logging.getLogger('Skins.getTransferInfo')
 from DateTime import DateTime
 
@@ -29,5 +29,5 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access %s' % (member_id,requested_id))
     return None
 elif context.isStaff():
Index: WAeUP_SRP/branches/uli/skins/waeup_student/get_searchable_student_states.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/get_searchable_student_states.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/get_searchable_student_states.py	(revision 1593)
@@ -23,4 +23,7 @@
     return [item for item in voc.items() if item[0].startswith('clear') or
                                          item[0] in ("all",)]
+elif "CourseAdvisers" in member.getGroups():
+    return [item for item in voc.items() if item[0].startswith('courses') or
+                                         item[0] in ("all",)]
 return voc.items()
 
Index: WAeUP_SRP/branches/uli/skins/waeup_student/layout_application_view_info.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/layout_application_view_info.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/layout_application_view_info.pt	(revision 1593)
@@ -5,5 +5,5 @@
               dm options/datastructure/getDataModel;
               widgets python:context.getRenderedWidgets(layout);
-              fields python:('jamb_reg_no','app_email','app_mobile')"
+              info context/getStudentBaseInfo;"
               >
   
@@ -20,5 +20,5 @@
           </td>
           <td> 
-            <span tal:content="python:context.getStudentBaseInfo()['student']['name']" />
+            <span tal:content="info/student/name" />
           </td>      
         </tr>
@@ -27,5 +27,5 @@
           </td>
           <td> 
-            <span tal:content="python:context.getStudentBaseInfo()['student']['sex']" />
+            <span tal:content="info/student/sex" />
           </td>      
         </tr>          
@@ -34,26 +34,42 @@
           </td>
           <td> 
-            <span tal:content="python:context.getStudentBaseInfo()['id']" />
+            <span tal:content="info/id" />
           </td>      
         </tr>
-
-        <tr tal:repeat="field fields">
-          <tal:block tal:define="cell python: widgets[field]">
-            <tal:block define="widget cell/widget">
-              <div tal:attributes="class cell/widget_css_class|string:label;
-              id python:widget.getHtmlWidgetId()+'_widget';"
-              >
-                <td >
-                  <span class="dlabel"
-                        tal:condition="widget/label"
-                        tal:content="widget/label">label</span>:
-                </td>
-                <td> 
-                  <span tal:replace="structure cell/widget_rendered" />
-                </td>
-              </div>
-            </tal:block>
-          </tal:block>
-        </tr>
+        <tr valign="top">
+          <td><span class="dlabel">Matriculation No</span>:
+          </td>
+          <td> 
+            <span tal:content="info/student/matric_no" />
+          </td>      
+        </tr>        
+        <tr valign="top">
+          <td><span class="dlabel">JAMB Registration No</span>:
+          </td>
+          <td> 
+            <span tal:content="info/student/jamb_reg_no" />
+          </td>      
+        </tr>   
+        <tr valign="top">
+          <td><span class="dlabel">Email</span>:
+          </td>
+          <td> 
+            <span tal:content="info/student/email" />
+          </td>      
+        </tr>         
+        <tr valign="top">
+          <td><span class="dlabel">Phone</span>:
+          </td>
+          <td> 
+            <span tal:content="info/student/phone" />
+          </td>      
+        </tr>         
+        <tr valign="top">
+          <td><span class="dlabel">Level</span>:
+          </td>
+          <td> 
+            <span tal:content="info/student/level" />
+          </td>      
+        </tr>           
       </table>
         
Index: WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py	(revision 1593)
@@ -37,5 +37,5 @@
      co_name,
      co_email,
-     student_email,  
+     student_email,
      co_email,
      'henrik@waeup.org',
Index: WAeUP_SRP/branches/uli/skins/waeup_student/personal_edit.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/personal_edit.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/personal_edit.py	(revision 1593)
@@ -16,10 +16,10 @@
 current = DateTime.DateTime()
 import logging
-logger = logging.getLogger('Student.Personal.Edit')
+logger = logging.getLogger('Skins.personal_edit')
 
 info = context.getPersonalInfo()
 
 if info is None:
-    logger.info('"anonymous access","%s"' % REQUEST.get('URL0'))
+    logger.info('Anonymous user tried to access %s' % REQUEST.get('URL0'))
     return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
 
@@ -53,5 +53,5 @@
                                               sex = ds.get('sex'),
                                              )
-        logger.info('"%s", "edited personal data"' % (info['id']))
+        logger.info('%s edited personal data' % (info['id']))
         #action = ""
         #base_url = student.absolute_url()
Index: WAeUP_SRP/branches/uli/skins/waeup_student/raise_objection.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/raise_objection.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/raise_objection.py	(revision 1593)
@@ -14,10 +14,10 @@
 import DateTime
 import logging
-logger = logging.getLogger('Student.Objection')
+logger = logging.getLogger('Skins.raise_objection')
 
 wf = context.portal_workflow
 info = context.getApplicationInfo()
 if not info:
-    logger.info('"%s", "tried to access", "%s"' % (context.portal_membership.getAuthenticatedMember(),context.getStudentId()))
+    logger.info('%s tried to access %s' % (context.portal_membership.getAuthenticatedMember(),context.getStudentId()))
     return context.admission_form()
 current = DateTime.DateTime()
Index: WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py	(revision 1593)
@@ -1,3 +1,9 @@
-##parameters=
+## Script (Python) "refresh_level"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None
 # $Id$
 """
@@ -16,4 +22,9 @@
 aq_courses = context.courses_catalog.evalAdvancedQuery
 
+import logging
+logger = logging.getLogger('Skins.refresh_level')
+
+from urllib import urlencode
+
 current = DateTime.DateTime()
 request = context.REQUEST
@@ -21,5 +32,5 @@
 response = request.RESPONSE
 redirect = response.redirect
-logger = logging.getLogger('Student.create_level')
+logger = logging.getLogger('Skins.refresh_level')
 mtool = context.portal_membership
 member = mtool.getAuthenticatedMember()
@@ -32,5 +43,5 @@
 if in_progress == 'finished':
     session.set('in_progress','started')
-    view = context.in_progress_view(refresh=3,page='study_level_view')
+    view = context.in_progress_view(refresh=3,page=action_after_validate)
     response.setHeader('Content-type','text/html; charset=ISO-8859-15')
     response.setHeader('Content-length','%d' % (len(view)))
@@ -51,5 +62,5 @@
         c_res = aq_courses(query)
         if not c_res:
-            logger.info('"%s","%s course not found in courses catalog"' % (student.id,co.CosCode))
+            logger.info('%s, course %s not found in courses_catalog' % (student.id,co.CosCode))
             continue
         course_cat_entry = c_res[0]
@@ -60,9 +71,9 @@
                 score = int(co.Score)
             except:
-                logger.info('"%s"," course %s invalid score %s"' % (student.id,
+                logger.info('%s, course %s has invalid score %s' % (student.id,
                                                                     co.CosCode,
                                                                     co.Score))
                 continue
-            if int(c_res[0].passmark) <= score:  
+            if int(c_res[0].passmark) <= score:
                 continue
             carry_over = True
@@ -96,4 +107,9 @@
             course_result.getContent().edit(mapping=d)
 session.set('in_progress','finished')
-return
-return response.redirect("%s" % level.absolute_url())
+logger.info('%s updated course list' % member)
+
+args = {}
+psm = "Course list updated!"
+args['portal_status_message'] = psm
+url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getStudyCourseInfo"
+## Script (Python) "register_courses"
 ##bind container=container
 ##bind context=context
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=student=None
+##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None
 ##title=
 ##
@@ -12,4 +12,5 @@
 close the Students StudyLevel
 """
+from Products.CMFCore.WorkflowCore import WorkflowException
 try:
     from Products.zdb import set_trace
@@ -18,4 +19,6 @@
         pass
 
+from urllib import urlencode        
+
 request = context.REQUEST
 mtool = context.portal_membership
@@ -23,11 +26,25 @@
 member_id = str(member)
 import logging
-logger = logging.getLogger('Student.register_courses')
+logger = logging.getLogger('Skins.register_courses')
 
 wftool = context.portal_workflow
-wftool.doActionFor(context,'close')
 students_folder = context.portal_url.getPortalObject().campus.students
-student = getattr(students_folder,context.getStudentId())
-wftool.doActionFor(student,'register_courses')
-logger.info('"%s","courses registered"' % student.getId())
-return request.RESPONSE.redirect("%s" % context.absolute_url())
+student_id = context.getStudentId()
+student = getattr(students_folder,student_id)
+try:
+    wftool.doActionFor(context,'close')
+except WorkflowException,E:
+    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
+    return request.RESPONSE.redirect("%s" % context.absolute_url())
+try:
+    wftool.doActionFor(student,'register_courses')
+except WorkflowException,E:
+    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
+    return request.RESPONSE.redirect("%s" % context.absolute_url())
+logger.info('%s registered course list of %s' % (member_id,student_id))
+
+args = {}
+psm = "You successfully submitted your course list!"
+args['portal_status_message'] = psm
+url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getStudyCourseInfo"
+## Script (Python) "reject_courses"
 ##bind container=container
 ##bind context=context
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=student=None
+##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None
 ##title=
 ##
@@ -12,4 +12,5 @@
 close the Students StudyLevel
 """
+from Products.CMFCore.WorkflowCore import WorkflowException
 try:
     from Products.zdb import set_trace
@@ -17,5 +18,5 @@
     def set_trace():
         pass
-
+from urllib import urlencode
 request = context.REQUEST
 mtool = context.portal_membership
@@ -23,5 +24,5 @@
 member_id = str(member)
 import logging
-logger = logging.getLogger('Student.reject_courses')
+logger = logging.getLogger('Skins.reject_courses')
 
 wftool = context.portal_workflow
@@ -29,6 +30,20 @@
 wftool.doActionFor(context,'close_for_edit')
 students_folder = context.portal_url.getPortalObject().campus.students
-student = getattr(students_folder,context.getStudentId())
-wftool.doActionFor(student,'reject_courses')
-logger.info('"%s","rejects course list for","%s"' % (member,student.getId()))
-return request.RESPONSE.redirect("%s" % context.absolute_url())
+student_id = context.getStudentId()
+student = getattr(students_folder,student_id)
+try:
+    wftool.doActionFor(student,'reject_courses')
+except WorkflowException,E:
+    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
+    return request.RESPONSE.redirect("%s" % context.absolute_url())
+logger.info('%s rejected course list of %s' % (member_id,student_id))
+
+args = {}
+
+psm = "Student's course list has been rejected! Please fill and submit the form below!"
+subject = "Course list rejected"
+args['subject'] = subject
+args['continue'] = action_after_validate
+args['portal_status_message'] = psm
+url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args)
+return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/request_transfer.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/request_transfer.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/request_transfer.py	(revision 1593)
@@ -14,5 +14,5 @@
 import logging
 from urllib import urlencode
-logger = logging.getLogger('Student.Transfer.Request')
+logger = logging.getLogger('Skins_request_transfer')
 import DateTime
 lt = context.portal_layouts
@@ -28,6 +28,7 @@
 requested_id = context.getStudentId()
 if requested_id and not context.isStaff() and member_id != requested_id:
-    logger.info('"%s", "accessed application object of", "%s"' % (member_id,requested_id))
+    logger.info('%s tried to access object of %s' % (member_id,requested_id))
     student_id = requested_id
+    return None
 elif context.isStaff():
     student_id = requested_id
@@ -50,5 +51,5 @@
 
 if paid:
-    logger.info('"%s", "opened (paid) request transfer form of", "%s"' % (member_id,student_id))
+    logger.info('%s opened (paid) request transfer form of %s' % (member_id,student_id))
     return context.request_transfer_form(rendered = None,
                                  psm = None,
@@ -91,4 +92,6 @@
     payments = getattr(student,'payments')
 #from Products.zdb import set_trace; set_trace()
+
+logger.info('%s paid transfer form for %s' % (member_id,student_id))
 info = {}
 order_id = ds.get('pin_n')
Index: WAeUP_SRP/branches/uli/skins/waeup_student/search_students.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/search_students.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/search_students.py	(revision 1593)
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('Search.Timer')
+logger = logging.getLogger('Skins.search_students')
 from DateTime import DateTime
 #
@@ -61,7 +61,9 @@
 user_info['faculties'] = []
 co_view = False
+ca_view = False
 faculties =  fget('faculties')
 departments = fget('departments')
-dep_str = fac_str = ''
+certificate_level = fget('certificate_level')
+dep_str = fac_str = certificate_level_str = ''
 if "ClearanceOfficers" in member.getGroups():
     state = "clearance_requested"
@@ -80,4 +82,5 @@
                  In('localUsersWithRoles', ("user:%s" % member,))
         res = evalAdvancedQuery(query)
+        logger.info('ClearanceOfficer %s initiated student_search' % member)
         faculties = []
         if res:
@@ -93,4 +96,22 @@
         user_info['departments'] = departments
         dep_str = " ".join(departments)
+elif "CourseAdvisers" in member.getGroups():
+    state = "courses_registered"
+    only_review = False
+    ca_view = True
+    if certificate_level:
+        #from Products.zdb import set_trace;set_trace()
+        certificate_level_str = certificate_level
+        certificate_level = certificate_level.split()
+    else:
+        query = In('portal_type',('StudyLevel',)) &\
+                 In('localUsersWithRoles', ("user:%s" % member,))
+        res = evalAdvancedQuery(query)
+        logger.info('CourseAdviser %s initiated student_search' % member)
+        certificate_level = []
+        if res:
+            certificate_level = ['/'.join(f.getPath().split('/')[-2:]) for f in res]
+        user_info['certificate_level'] = certificate_level
+        certificate_level_str = " ".join(certificate_level)
 default = {'search_mode': 'student_id',
         'review_state': state,
@@ -106,4 +127,5 @@
                       faculties = fac_str,
                       departments = dep_str,
+                      certificate_level = certificate_level_str,
                       commit = False,
                       )
@@ -148,4 +170,5 @@
         students_folder = context.portal_url.getPortalObject().campus.students
         if hasattr(students_folder,term.strip()):
+            logger.info('%s searches for student with id %s' % (member,term))
             request.RESPONSE.redirect("%s/%s" % (students_folder.absolute_url(),term))
         return context.search_students_form(rendered = rend,
@@ -156,7 +179,9 @@
     elif what == "department":
         res = context.students_catalog(department=term.strip())
+        logger.info('%s searches for student in department %s' % (member,term))
         search_set = [r.id for r in res]
     elif what == "matric_no":
         res = context.students_catalog(matric_no=term.strip())
+        logger.info('%s searches for student with matric_no %s' % (member,term))
         search_set = [r.id for r in res]
     elif what == "jamb_reg_no":
@@ -164,8 +189,10 @@
         st_u = "%s" % term.strip().upper()
         res = aq_students(In('jamb_reg_no',(st_l,st_u)))
+        logger.info('%s searches for student with jamb_reg_no %s' % (member,term))
         search_set = [r.id for r in res]
     elif what == "name":
         pt = ('StudentPersonal')
         query = In('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip())
+        logger.info('%s searches for student with name %s' % (member,term))
         res = evalAdvancedQuery(query)
         if res:
@@ -181,4 +208,7 @@
     query = Eq('review_state',state)
     review_res = evalAdvancedQuery(query)
+
+    logger.info('%s searches for students in review_state %s' % (member,state))
+
     if with_timer:
         end = DateTime().timeTime()
@@ -196,4 +226,22 @@
         logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
     start = DateTime().timeTime()
+    search_set = [r.id for r in res]
+    if with_timer:
+        end = DateTime().timeTime()
+        logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
+elif ca_view:
+    only_review = False
+    with_review = True
+    if with_timer:
+        start = DateTime().timeTime()
+        logger.info('"%s","start 200"' % member)
+    courses = [cl.split('/')[0] for cl in certificate_level]
+    levels = [cl.split('/')[1] for cl in certificate_level]
+    query = In('course',courses) & In('level',levels)
+    res = aq_students(query)
+    if with_timer:
+        end = DateTime().timeTime()
+        logger.info('"%s","searchtime","%6.2f"' % (member,end-start))
+        start = DateTime().timeTime()
     search_set = [r.id for r in res]
     if with_timer:
@@ -250,4 +298,5 @@
                              allowed = allowed,
                              co_view = co_view,
+                             ca_view = ca_view
                              )
 return context.search_students_form(rendered = rend,
Index: WAeUP_SRP/branches/uli/skins/waeup_student/search_students_form.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/search_students_form.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/search_students_form.pt	(revision 1593)
@@ -1,10 +1,3 @@
 <metal:body use-macro="here/main_template/macros/master">
-    <metal:block fill-slot="header"
-                 tal:define="creation creation|nothing;
-                 edition edition|nothing;
-                 metadata metadata|nothing"
-                 >
-    </metal:block>
-    
     <metal:main fill-slot="main"
             tal:define="rendered options/rendered;
@@ -12,5 +5,5 @@
             students options/students;
             info options/info|nothing;
-            is_so context/isSectionOfficer;            
+            is_so context/isSectionOfficer;
             allowed options/allowed|nothing"
             >
@@ -30,7 +23,6 @@
       &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
       <span tal:condition="is_so">
-      <nobr><a href="view_logs">View Log Files</a>
-      &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
-
+         <nobr><a href="view_logs">View Log Files</a>
+         &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
          <nobr><a href="add_student">Add Student Record</a>        
          &nbsp;&nbsp;&nbsp;&nbsp;</nobr>
@@ -97,5 +89,10 @@
                          onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')"
                          >[view and change state]</a></td>
-                    <td tal:condition="options/co_view|nothing"><span tal:replace="student/review_state|nothing" /></td>   
+                    <td tal:condition="options/ca_view|nothing">
+                      <a href="id" 
+                         tal:attributes="href string:${context/portal_url}/campus/students/${student/id}/study_course/study_course/${student/level}/external_study_level_view"
+                         target="edit"
+                         onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')"
+                         >[view and validate course list]</a></td>
                   </tr>
                 </span>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/set_access_data.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/set_access_data.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/set_access_data.py	(revision 1593)
@@ -8,9 +8,9 @@
 current = DateTime.DateTime()
 pr = context.portal_registration
-logger = logging.getLogger('Student.SetAccessData')
+logger = logging.getLogger('Skins.set_access_data')
 validate = REQUEST.has_key("cpsdocument_edit_button")
 
 if matric_no is None:
-    logger.info('"No matric_no in request"')
+    logger.info('No matric_no in request')
     return REQUEST.RESPONSE.redirect("%s" % context.portal_url())
 lt = context.portal_layouts
@@ -21,5 +21,5 @@
     sid = st_res[0].id
 else:
-    logger.info('"%s","Studentobject does not exist"' % matric_no)
+    logger.info('Student object with matric_no does not exist' % matric_no)
 res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
                       schema_id= 'student_returning',
@@ -53,8 +53,8 @@
         #psm = "You are already registered please log in with your UserId %s" % sid
         psm = ""
-        logger.info('"%s","repeatedly tried to set password"' % sid)
+        logger.info('%s repeatedly tried to set password' % sid)
     except:
         psm = "The system encountered an error. Please try again."
-        logger.info('"%s","set_access error","%s"' % (sid,password))
+        logger.info('%s, makeStudentMember error, password = %s' % (sid,password))
 if psm != '':
     return context.set_access_data_form(rendered = res,
Index: WAeUP_SRP/branches/uli/skins/waeup_student/start_clearance.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/start_clearance.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/start_clearance.py	(revision 1593)
@@ -8,5 +8,5 @@
 pr = context.portal_registration
 import logging
-logger = logging.getLogger('Student.Clearance.Start')
+logger = logging.getLogger('Skins.start_clearance')
 
 #type_name = 'Student'
@@ -23,5 +23,5 @@
 if info is None:
     member_id = str(context.portal_membership.getAuthenticatedMember())
-    logger.info('"%s","tried to start clearance for", "%s"' % (member_id,request.get('PATH_INFO').split('/')[-2]))
+    logger.info('%s tried to start clearance for %s' % (member_id,request.get('PATH_INFO').split('/')[-2]))
     return redirect("%s/srp_invalid_access" % context.portal_url())
 app_doc = info['app_doc']
@@ -55,13 +55,13 @@
     psm = "You have already entered a clearance pin!"
     error = True
-    logger.info('"%s", "tried to start clearance though already started"' % (info['id']))
+    logger.info('%s tried to start clearance though already started' % (info['id']))
 elif psm == 'invalid':
     psm = "Please correct your input!"
     error = True
-    logger.info('"%s","entered wrong clearance pin"' % (info['id']))
+    logger.info('%s entered wrong clearance pin' % (info['id']))
 elif app_doc.passport is None:
     #psm = "You must upload your passport picture before you can start the registration process!"
     #error = True
-    logger.info('"%s", "started clearance without passport picture"' % (info['id']))
+    logger.info('%s started clearance without passport picture' % (info['id']))
 if error:
     return context.clearance_pin_form(rendered = res,
@@ -74,5 +74,5 @@
 session.set("clicked","clicked")
 pin = str(ds.get('clr_ac_pin'))
-logger.info('"%s", "started clearance with pin", "%s"' % (info['id'],pin))
+logger.info('%s started clearance with pin %s' % (info['id'],pin))
 wf.doActionFor(info['student'],'enter_clearance_pin')
 wf.doActionFor(info['clear'],'open')
@@ -89,5 +89,5 @@
 
 if info['penalty']:
-    logger.info('"%s","started late clearance"' % (info['id']))
+    logger.info('%s started late clearance' % (info['id']))
 
 return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
Index: WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt	(revision 1593)
@@ -24,9 +24,15 @@
       <h3>Returning Student Statistics</h3>
       <br />      
+      <span tal:content="python:departments[0]['total_ret']" /> 
+      returning student records have been imported. 
+      <span tal:content="python:departments[0]['total_li']" /> returning students 
+      have logged in.
+      <br /><br />
       <span tal:condition="not:isAnon">
         <table>
           <tr class="odd ajaxtd">
             <th >Faculty</th>
-            <th align="right">Returning</th>
+            <th align="right">RET</th>
+            <th align="right">SFP</th>
           </tr>
           <tr tal:define="d python:departments[0]"
@@ -34,5 +40,8 @@
               <td width="80px">All Faculties</td>
               <td width="80px" align="right"> 
-                <span tal:content="d/sum" /> of <span tal:content="d/total" />
+                <span tal:content="d/ret" />
+              </td>   
+              <td width="80px" align="right"> 
+                <span tal:content="d/sfp" />
               </td>              
           </tr>
@@ -41,9 +50,16 @@
               <td width="80px"> <span tal:content="d/id" /> </td>
               <td width="80px" align="right"> 
-                <span tal:content="d/returned " />
-              </td>              
+                <span tal:content="d/ret" />
+              </td>       
+              <td width="80px" align="right"> 
+                <span tal:content="d/sfp" />
+              </td>                              
           </tr>
         </table>
         <br />
+        <table>
+        <tr><td>RET:</td> <td>Returning students who have logged in</td></tr>
+        <tr><td>SFP:</td> <td>Returning students who already paid their school fee</td></tr>
+        </table>        
       </span>
       </span>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/statistics_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/statistics_view.pt	(revision 1592)
+++ 	(revision )
@@ -1,66 +1,0 @@
-                      
-  <metal:body use-macro="here/main_template/macros/master">
-
-
-    <metal:main fill-slot="main">
-
-  <metal:block tal:define="departments context/getStudentStatistics;
-                        mtool here/portal_membership;
-                        member mtool/getAuthenticatedMember;">       
-
-      <span tal:condition="not: departments">
-        <span tal:content="here/illegal_view" />
-      </span>
-      <span tal:condition="departments">
-  
-      <a href="search_students"><strong>Search Students</strong></a>
-      <h3>Student Statistics</h3>
-      <br />      
-      <span tal:condition="not:isAnon">
-        <table>
-          <tr class="odd ajaxtd">
-            <th >Faculty</th>
-            <th align="right">Total</th>
-            <th align="right">OR</th>
-            <th align="right">CPE</th>
-            <th align="right">CR</th>
-            <th align="right">VC</th>
-          </tr>
-          <tr tal:repeat="d departments"
-              tal:attributes="class python:test(repeat['d'].even(), 'even ajaxtd', 'odd ajaxtd')">
-              <td width="80px"> <span tal:content="d/id" /> </td>
-              <td width="80px" align="right">
-                <span tal:content="d/students" />
-              </td>
-              <td width="80px" align="right"> 
-                <span tal:content="d/objection_raised" />
-                (<span tal:content="d/objection_raised_percent" />%)
-              </td>
-              <td width="80px" align="right"> 
-                <span tal:content="d/clearance_pin_entered" />
-                (<span tal:content="d/clearance_pin_entered_percent" />%)
-              </td>
-              <td width="80px" align="right"> 
-                <span tal:content="d/clearance_requested" />
-                (<span tal:content="d/clearance_requested_percent" />%)
-              </td>
-              <td width="80px" align="right"> 
-                <span tal:content="d/cleared_and_validated" />
-                (<span tal:content="d/cleared_and_validated_percent" />%)
-              </td>
-          </tr>
-        </table>
-        <br />
-        <table>
-        <tr><td>OR:</td> <td>Objection raised</td></tr>
-        <tr><td>CPE:</td> <td>Clearance PIN entered</td></tr>
-        <tr><td>CR: </td> <td>Clearance requested</td></tr>
-        <tr><td>VC: </td> <td>Validated and cleared</td></tr>
-        </table>
-      </span>
-      </span>
-</metal:block>      
-    </metal:main>
-
-  </metal:body>
-      
Index: WAeUP_SRP/branches/uli/skins/waeup_student/students_index.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/students_index.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/students_index.py	(revision 1593)
@@ -23,8 +23,9 @@
 students_url = "%s/campus/students" % (context.portal_url())
 
-if "ClearanceOfficers" in member.getGroups():
-    return redirect("%s/search_students" % context.portal_url())
+if "ClearanceOfficers" in member.getGroups() or\
+   "CourseAdvisers" in member.getGroups():
+    return redirect("%s/campus/students/search_students" % context.portal_url())
 if context.isSectionOfficer():
-    return redirect("%s/search_students" % context.portal_url())
+    return redirect("%s/campus/students/search_students" % context.portal_url())
 if context.isStudent():
     id = str(member)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt	(revision 1593)
@@ -6,8 +6,8 @@
                  global is_ca info/is_ca;
                  global show_check_boxes info/show_check_boxes;
-		 global is_student info/is_student;
-		 global status_info info/status_info;
-		 global review_state info/review_state;
-		 global view_only info/view_only">
+		             global is_student info/is_student;
+		             global status_info info/status_info;
+		             global review_state info/review_state;
+		             global view_only info/view_only">
       <a href=""
          tal:attributes="href string:${here/academicsParent}">
@@ -63,5 +63,9 @@
         <h4>Session Courses</h4>
         <br />
-        <table class="contentListing" width="100%" summary="content layout" id="folder_content">      
+      <div class="" tal:condition="not: info/normal">
+        Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!
+      </div>
+        <table class="contentListing" width="100%" id="folder_content"
+               tal:condition="info/normal">      
           <tr tal:repeat="row info/normal"
               tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
@@ -97,5 +101,5 @@
             <td align="left" valign="top" rowspan="3"></td>
             <td align="left" valign="top">
-                <input type="submit" name="course_result_delete:method" value="Delete selected"
+                <input type="submit" name="delete_course_result:method" value="Delete selected"
                        class="destructive" i18n:attributes="value"
                        tal:attributes="onclick python:'return window.confirm(\'%s\')' %
@@ -106,5 +110,6 @@
                        />
                 <br /><br />
-                <input type="submit" name="register_courses:method"
+                <input tal:condition="info/normal" 
+                       type="submit" name="register_courses:method"
                        class="context" value="Submit" />
             </td>
@@ -122,8 +127,8 @@
                        % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
                        />
-                <input type="submit" name="course_result_delete:method" value="Delete selected"
+                <input type="submit" name="delete_course_result:method" value="Delete selected"
                        class="destructive" i18n:attributes="value"
                        tal:attributes="onclick python:'return window.confirm(\'%s\')' %
-                       ('really delete checked courses', )" 
+                       ('Do you really want to delete the courses selected?', )" 
                        />
                 <input 
@@ -154,5 +159,5 @@
                        />
                 <input tal:condition="python: review_state == 'school_fee_paid'"
-                       type="submit" name="course_result_delete:method" value="Delete selected"
+                       type="submit" name="delete_course_result:method" value="Delete selected"
                        class="destructive" i18n:attributes="value"
                        tal:attributes="onclick python:'return window.confirm(\'%s\')' %
@@ -169,4 +174,10 @@
                 <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method"
                        class="context" value="Reject" />
+                       
+                <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:/study_level_view"/>                         
+                <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
+                       tal:attributes="value string:/contact_student_form"/>    
+                                             
 
             </td>
@@ -183,10 +194,10 @@
             <td><input type="text" name="course_id" 
                        tal:attributes="value request/course_id|nothing"/></td>
-            <td tal:condition="request/error|nothing" 
-                tal:content="request/error" />
             <td colspan="2">
               <input type="submit" name="add"
                      class="context" value="Add Course" 
                      />
+              <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:/study_level_view"/>                       
             </td>                
         </table>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "getStudyCourseInfo"
+## Script (Python) "validate_courses"
 ##bind container=container
 ##bind context=context
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=student=None
+##parameters=student=None, action_after_reject=None, action_after_validate=None
 ##title=
 ##
@@ -12,4 +12,5 @@
 close the Students StudyLevel
 """
+from Products.CMFCore.WorkflowCore import WorkflowException
 try:
     from Products.zdb import set_trace
@@ -23,10 +24,18 @@
 member_id = str(member)
 import logging
-logger = logging.getLogger('Student.validate_courses')
+logger = logging.getLogger('Skins.validate_courses')
 
 wftool = context.portal_workflow
 students_folder = context.portal_url.getPortalObject().campus.students
-student = getattr(students_folder,context.getStudentId())
-wftool.doActionFor(student,'validate_courses')
-logger.info('"%s","validated courses for","%s"' % (member,student.getId()))
-return request.RESPONSE.redirect("%s" % context.absolute_url())
+student_id = context.getStudentId()
+student = getattr(students_folder,student_id)
+try:
+    wftool.doActionFor(student,'validate_courses')
+except WorkflowException,E:
+    logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id))
+    return request.RESPONSE.redirect("%s" % context.absolute_url())
+logger.info('%s validated course list of %s' % (member_id,student_id))
+
+psm = 'portal_status_message=Course list validated!'
+url = context.absolute_url() + '/' + action_after_validate +  '?' + psm
+return request.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/createReturningStudent.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/createReturningStudent.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/createReturningStudent.py	(revision 1593)
@@ -17,5 +17,5 @@
 students_folder = context.portal_url.getPortalObject().campus.students
 import logging
-logger = logging.getLogger('createReturningStudent')
+logger = logging.getLogger('Skins.createReturningStudent')
 
 if not matric_no:
@@ -30,5 +30,5 @@
     student_brain = res[0]
     sid,jamb_reg_no = context.waeup_tool.createOne(students_folder,student_brain,'?')
-    logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no))
+    logger.info('%s creates student %s %s' % (member,sid,matric_no))
     return "Student MatricNo %s, StudentId %s (JAMBRegNo %s) created" % (matric_no,sid,jamb_reg_no)
 
@@ -36,5 +36,5 @@
 count = 1
 total = 0
-logger.info('"%s","Create Students start"' % (member))
+logger.info('%s started createReturningStudent"' % (member))
 letters = ('ABCDEFGHKLMNPQRSTUVWXYZ')
 lc = 0
@@ -42,14 +42,13 @@
     res = context.students_catalog(matric_no = matric_no)
     if len(res) == 1:
-        #logger.info('"Student already exists","%s"' % (matric_no))
         continue
     elif len(res) > 1:
-        logger.info('"Student with multiple entries","%s","%s" ' % (matric_no,len(res)))
+        logger.info('Student %s with multiple entries (%s)' % (matric_no,len(res)))
+        # fix at the beginning
         ids = [r.id for r in res if not r.id.startswith('A')]
-        #from Products.zdb import set_trace;set_trace()
         for id in ids:
             context.students_catalog.deleteRecord(id)
         students_folder.manage_delObjects(ids)
-        logger.info('"deleted students","%s" ' % " ".join(ids))
+        logger.info('Student objects deleted: %s' % " ".join(ids))
         continue
     student = context.returning_import(matric_no=matric_no)[0]
@@ -59,9 +58,9 @@
         lc = 0
     context.waeup_tool.createOne(students_folder,student,letter)
-    logger.info('"Student created","%s"' % (matric_no))
+    logger.info('Student created: %s' % (matric_no))
     count += 1
     if count > 10:
-        logger.info('"%s","Committed Students","%s", "%s" ' % (member,count,total))
+        logger.info('%s committed students %s, %s' % (member,count,total))
         total += count
         count = 1
-logger.info('"%s","Create Students finish","%s"' % (member,total))
+logger.info('createReturningStudent finished (%s)' % (total))
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/deleteStudentByMatricNo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/deleteStudentByMatricNo.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/deleteStudentByMatricNo.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "search_pins"
+## Script (Python) "deleteStudentByMatricNo"
 ##bind container=container
 ##bind context=context
@@ -12,5 +12,5 @@
 """
 import logging
-logger = logging.getLogger('DeleteStudentByMatricNo')
+logger = logging.getLogger('Skins.deleteStudentByMatricNo')
 
 request = REQUEST
@@ -26,7 +26,7 @@
 if str(member) not in ('admin','joachim') or matric_no is None:
     return
-    
-    
-# remove from students_catalog    
+
+
+# remove from students_catalog
 
 res = st_cat(matric_no=matric_no)
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/fixLevelForNewStudents.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/fixLevelForNewStudents.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/fixLevelForNewStudents.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "search_pins"
+## Script (Python) "fixLevelForNewStudents"
 ##bind container=container
 ##bind context=context
@@ -23,5 +23,5 @@
 setheader = request.RESPONSE.setHeader
 import logging
-logger = logging.getLogger('fixLevelForNewStudents')
+logger = logging.getLogger('Skins.fixLevelForNewStudents')
 
 def rwrite(s):
@@ -53,5 +53,5 @@
 count_full = 0
 commit_count = 0
-logger.info("started for %s students" % len(res))
+logger.info("Started for %s students" % len(res))
 to_change = {}
 for sbrain in res:
@@ -92,5 +92,5 @@
     if commit_count > 1000:
         context.waeup_tool.doCommit()
-        logger.info("committing %s transactions total %s" % (commit_count,count))
+        logger.info("Committing %s transactions, total %s" % (commit_count,count))
         commit_count = 0
     rwrite("%s: %s %s %s <br />" % (count,sbrain.id,entry_mode,level))
@@ -98,3 +98,3 @@
     students_cat.modifyRecord(**to_change[entry])
 rwrite("finished")
-logger.info("finished  %s students" % count)
+logger.info("Finished  %s students" % count)
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/fixReservedBeds.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/fixReservedBeds.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/fixReservedBeds.py	(revision 1593)
@@ -0,0 +1,45 @@
+##parameters=REQUEST
+# $Id: fixReservedBeds.py 1447 2007-02-20 13:41:26Z joachim $
+"""
+process the the accommodation reservation
+"""
+import DateTime
+current = DateTime.DateTime()
+request = context.REQUEST
+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('Skins.fixReservedBed')
+students = context.portal_url.getPortalObject().campus.students
+hostels = context.portal_url.getPortalObject().campus.accommodation.objectItems()
+acco_id = "accommodation_%s" % context.getSessionId()
+logger.info('%s starts fixReservedBeds' % (member))
+#from Products.zdb import set_trace;set_trace()
+for h_id,h in hostels:
+    h_doc = h.getContent()
+    reserved = context.reservedRoomsVoc(doc=h_doc)
+    for hr,hrv in reserved:
+        for k,v in context.getAccoHallBeds(doc=h_doc):
+            bid = "%s_%s_%s" % (h_id,hr,k)
+            res = acco_cat(bed = bid)
+            if not res:
+                continue
+            bed = res[0]
+            if not bed.student:
+                continue
+            student_obj = getattr(students,bed.student)
+            if acco_id in student_obj.objectIds():
+                acco_doc = getattr(student_obj, acco_id).getContent()
+                if acco_doc.bed != bid:
+                    acco_cat.modifyRecord(bed=bid,student = '')
+                    logger.info('"%s","removed allocation of %s for","%s"' % (member,bid,bed.student))
+logger.info('%s finishes fixReservedBeds' % (member))
+return request.RESPONSE.redirect("%s" % context.absolute_url())
+
+
+
+
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/reindexCoursesCatalog.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/reindexCoursesCatalog.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/reindexCoursesCatalog.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "search_pins"
+## Script (Python) "reindexCourseCatalog"
 ##bind container=container
 ##bind context=context
@@ -23,5 +23,5 @@
 setheader = request.RESPONSE.setHeader
 import logging
-logger = logging.getLogger('reindexCourseCatalog')
+logger = logging.getLogger('Skins.reindexCourseCatalog')
 
 def rwrite(s):
@@ -51,5 +51,5 @@
 count_full = 0
 commit_count = 0
-logger.info("reindexing of courses_catalog started for %s courses" % len(courses))
+logger.info("Reindexing of courses_catalog started for %s courses" % len(courses))
 for course_brain in courses:
     course_doc = course_brain.getObject().getContent()
@@ -72,7 +72,7 @@
     if commit_count > 1000:
         context.waeup_tool.doCommit()
-        logger.info("committing %s transactions total %s" % (commit_count,count))
+        logger.info("Committing %s transactions, total %s" % (commit_count,count))
         rwrite("%s: committed %s <br />" % (count,commit_count))
         commit_count = 0
 rwrite("finished")
-logger.info("finished  reindexing %s courses" % count)
+logger.info("Reindexing finished (%s courses)" % count)
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/removeResults2.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/removeResults2.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/removeResults2.py	(revision 1593)
@@ -1,3 +1,3 @@
-## Script (Python) "search_pins"
+## Script (Python) "removeResults2"
 ##bind container=container
 ##bind context=context
@@ -13,5 +13,5 @@
 """
 import logging
-logger = logging.getLogger('removeResults2')
+logger = logging.getLogger('Skins.removeResults2')
 
 request = REQUEST
@@ -43,8 +43,8 @@
         to_del.append(r.key)
         rwrite(r.matric_no + " " + r.Level +"  " + r.CosCode + "<br />")
-logger.info('"%s", "start to delete %s results"' % (member,len(to_del)))
+logger.info('%s starts to delete %s results' % (member,len(to_del)))
 for uid in to_del:
     rcat.deleteRecord(uid)
-logger.info('"%s", "finished with deletion of %s results"' % (member,len(to_del)))
+logger.info('%s finished deletion of %s results' % (member,len(to_del)))
 rwrite("Done")
 
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/unpay.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/unpay.py	(revision 1592)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/unpay.py	(revision 1593)
@@ -13,6 +13,9 @@
 """
 import logging
-logger = logging.getLogger('EPayment.Unpay')
+logger = logging.getLogger('Skins.unpay')
 import DateTime
+
+pm = context.portal_membership
+member = pm.getAuthenticatedMember()
 
 request = context.REQUEST
@@ -27,5 +30,5 @@
 #wftool.doActionFor(student,'return')
 wftool.doActionFor(student,'clear_and_validate')
-logger.info('"%s", "reset to state returning"' % student_id)
+logger.info('%s resets %s to state returning' % (member,student_id))
 
 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
