Changeset 1593
- Timestamp:
- 19 Mar 2007, 18:57:54 (18 years ago)
- Location:
- WAeUP_SRP/branches/uli
- Files:
-
- 5 deleted
- 85 edited
- 9 copied
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/branches/uli/Academics.py
r1146 r1593 51 51 def importLocalRoles(self,portal_type): ###( 52 52 name = '%sLocalRoles' % portal_type 53 logger = logging.getLogger(' Import.%s' % name)53 logger = logging.getLogger('Academics.AcademicsFolder.importLocalRoles') 54 54 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 55 55 logger.info('Start importing %(name)s to %(name)s_%(current)s.csv' % vars()) … … 74 74 member_id = r.split(':')[1] 75 75 odict[obj_id].manage_setLocalRoles(member_id, roles_dict[r]) 76 logger.info(' importing role for %s %s %s' % (obj_id, member_id,roles_dict[r]))76 logger.info('Importing role for %s %s %s' % (obj_id, member_id,roles_dict[r])) 77 77 78 78 ###) … … 87 87 name = 'Faculties' 88 88 no_import = False 89 logger = logging.getLogger(' Import.%s_csv' % name)89 logger = logging.getLogger('Academics.AcademicsFolder.loadFacultiesFromCSV') 90 90 logger.info('Start loading from %s.csv' % name) 91 91 academics = self.portal_catalog({'meta_type': 'AcademicsFolder'})[-1].getObject() … … 134 134 name = 'Departments' 135 135 no_import = False 136 logger = logging.getLogger(' Import.Departments')136 logger = logging.getLogger('Academics.AcademicsFolder.loadDepartmentsFromCSV') 137 137 fields = ("code", 138 138 "review_state", … … 191 191 name = 'Courses' 192 192 no_import = False 193 logger = logging.getLogger(' Import.Courses')193 logger = logging.getLogger('Academics.AcademicsFolder.loadCoursesFromCSV') 194 194 fields = ("code", 195 195 "review_state", … … 296 296 wf = self.portal_workflow 297 297 no_import_list = [] 298 logger = logging.getLogger(' Import.Certificates')298 logger = logging.getLogger('Academics.AcademicsFolder.loadCertificatesFromCSV') 299 299 fields = ("code", 300 300 "review_state", … … 374 374 """install Certificate Courses from CSV values""" 375 375 #return 376 logger = logging.getLogger(' Import.CertificateCourses')376 logger = logging.getLogger('Academics.AcademicsFolder.loadCertificateCoursesFromCSV') 377 377 name = 'CertificateCourses' 378 378 wf = self.portal_workflow 379 379 no_import_list = [] 380 logger = logging.getLogger('Import.CertificateCourses')381 380 fields = ("code", 382 381 "review_state", … … 446 445 continue 447 446 l.invokeFactory('CertificateCourse',course_code) 448 logger.info('Creating CertificateCourse %(code)s in certificate %(certificate_code)sLevel %(level)s' % cert_course)447 logger.info('Creating CertificateCourse %(code)s in Certificate %(certificate_code)s StudyLevel %(level)s' % cert_course) 449 448 cc = getattr(l,course_code) 450 449 semester = 'first' … … 492 491 def exportLocalRoles(self,portal_type): ###( 493 492 name = '%sLocalRoles' % portal_type 494 logger = logging.getLogger(' Export.%s' % name)493 logger = logging.getLogger('Academics.AcademicsFolder.exportLocalRoles') 495 494 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 496 495 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 505 504 for (groupname, roles) in obj.get_local_group_roles(): 506 505 lr[ 'group:' + group ] = [x for x in roles] 507 logger.info(' exporting %s %s ' % (obj.id, lr))506 logger.info('Exporting %s %s ' % (obj.id, lr)) 508 507 export.append('"%s","%s"' % (obj.getId(),lr)) 509 508 open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export)) … … 519 518 name = 'Faculties' 520 519 no_import = False 521 logger = logging.getLogger(' Export.%s' % name)520 logger = logging.getLogger('Academics.AcademicsFolder.exportFacultiesToCSV') 522 521 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 523 522 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 526 525 export.append('"code","review_state","title","title_prefix","college_code","degree_grade","bank_code"') 527 526 for obj in objects: 528 logger.info(' exporting %s %s ' % (obj.id, obj.title))527 logger.info('Exporting %s %s ' % (obj.id, obj.title)) 529 528 obj_d = obj.getContent() 530 529 di = {} … … 552 551 name = 'Departments' 553 552 no_import = False 554 logger = logging.getLogger(' Export.%s' % name)553 logger = logging.getLogger('Academics.AcademicsFolder.exportDepartmentsToCSV') 555 554 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 556 555 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 570 569 di['review_state'] = self.portal_workflow.getInfoFor(department,'review_state','no_state') 571 570 export.append('"%(code)s","%(review_state)s","%(title)s","%(title_prefix)s","%(faculty_code)s"' % di) 572 logger.info(' exporting %s %s ' % (department.id, department.title))571 logger.info('Exporting %s %s ' % (department.id, department.title)) 573 572 except: 574 573 logger.info('could not export %s %s ' % (department.id, department.title)) … … 584 583 name = 'Courses' 585 584 no_import = False 586 logger = logging.getLogger(' Export.%s' % name)585 logger = logging.getLogger('Academics.AcademicsFolder.exportCoursesToCSV') 587 586 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 588 587 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 614 613 di['review_state'] = self.portal_workflow.getInfoFor(course,'review_state','no_state') 615 614 export.append(dataline % di) 616 logger.info(' exporting %s %s ' % (course.id, course.title))615 logger.info('Exporting %s %s ' % (course.id, course.title)) 617 616 continue 618 617 open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export)) … … 626 625 name = 'Certificates' 627 626 no_import = False 628 logger = logging.getLogger(' Export.%s' % name)627 logger = logging.getLogger('Academics.AcademicsFolder.exportCertificatesToCSV') 629 628 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 630 629 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 668 667 try: 669 668 export.append(dataline % di) 670 logger.info(' exporting %s %s ' % (certificate.id, certificate.title))669 logger.info('Exporting %s %s ' % (certificate.id, certificate.title)) 671 670 except: 672 671 logger.info('could not export %s %s ' % (certificate.id, certificate.title)) … … 682 681 name = 'CertificateCourses' 683 682 no_import = False 684 logger = logging.getLogger(' Export.%s' % name)683 logger = logging.getLogger('Academics.AcademicsFolder.exportCertificateCoursesToCSV') 685 684 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 686 685 logger.info('Start exporting %(name)s to %(name)s_%(current)s.csv' % vars()) … … 714 713 try: 715 714 export.append(dataline % di) 716 logger.info(' exporting %s %s ' % (certificate.id, certificate.title))715 logger.info('Exporting %s %s ' % (certificate.id, certificate.title)) 717 716 except: 718 logger.info(' could not export %s %s ' % (certificate.id, certificate.title))717 logger.info('Could not export %s %s ' % (certificate.id, certificate.title)) 719 718 continue 720 719 open("%s/import/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export)) -
WAeUP_SRP/branches/uli/Accommodation.py
r1449 r1593 107 107 no_import = [] 108 108 imported = [] 109 logger = logging.getLogger(' Import.%s' % name)109 logger = logging.getLogger('Accommodation.AccoFolder.importReservedBeds') 110 110 try: 111 111 beds = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 169 169 no_import.append( format_error % bed) 170 170 continue 171 halls[hall] = hall_doc = hall_object.getContent() 171 halls[hall] = hall_doc = hall_object.getContent() 172 172 bid = "%(hall)s_%(block)s_%(room)s_%(bed)s" % bed 173 173 res = accommodation(bed = bid) … … 201 201 acco_doc.edit(mapping={'bed': bid}) 202 202 member = self.portal_membership.getAuthenticatedMember() 203 logger.info(' "%s","changed reserved bed %s for","%s"' % (member,bid,sid))203 logger.info('%s changed reserved bed %s for %s' % (member,bid,sid)) 204 204 accommodation.modifyRecord(bed = bid, student = sid) 205 205 imported.append( format % bed) … … 227 227 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 228 228 229 229 230 230 InitializeClass(AccoFolder) 231 231 … … 256 256 InitializeClass(AccoHall) 257 257 258 258 259 259 def addAccoHall(container, id, REQUEST=None, **kw): 260 260 """Add a AccoHall.""" -
WAeUP_SRP/branches/uli/PatchCPSUserFolderUserFolder.py
r1515 r1593 71 71 ## patch to assign dynamic roles for WAeUP 72 72 while 1: 73 if self.isStudent(): 74 break 75 groups = self.portal_membership.getAuthenticatedMember().getGroups() 76 if not ("ClearanceOfficers" in groups or "CourseAdvisers" in groups): 77 break 73 78 if callable(real_object) and hasattr(real_object,'im_self'): 74 79 real_object = real_object.im_self 80 81 if real_object is None: 82 break 75 83 if hasattr(real_object,'portal_type') and\ 76 real_object.portal_type not in ("Student","StudentClearance","StudentStudyLevel"): 84 real_object.portal_type not in ("Student", 85 "StudentClearance", 86 "StudentStudyLevel"): 77 87 break 88 # don't test if it is not a proxy 89 if real_object.portal_type == real_object.meta_type: 90 break 91 # can be later simplified by replacing by students_catalog values - Henrik 92 # getattr works always because of acquisition ?! Henrik 78 93 sc = getattr(real_object,'study_course',None) 79 94 if sc is None: 80 95 break 96 #from pdb import set_trace;set_trace() 81 97 sc_obj = sc.getContent() 82 res_sc = self.portal_catalog(portal_type="Certificate",83 id = sc_obj.study_course)84 if len(res_ sc) != 1:98 cert_id = sc_obj.study_course 99 res_cert = self.portal_catalog(id = cert_id) 100 if len(res_cert) != 1: 85 101 break 86 cert_path = res_sc[0].getPath().split('/') 102 certificate_brain = res_cert[0] 103 certificate_obj = certificate_brain.getObject() 104 cert_path = certificate_brain.getPath().split('/') 87 105 fac_id = cert_path[-4] 88 106 dep_id = cert_path[-3] 89 90 91 # temporary sel-healing function 107 # temporary self-healing function 92 108 # deprecated after reindexing the students_catalog 93 109 student_id = self.getStudentId() … … 95 111 if len(res) != 1: 96 112 break 97 self.students_catalog.modifyRecord(id = student_id, 113 st_entry = res[0] 114 if st_entry.faculty != fac_id or\ 115 st_entry.department != dep_id or\ 116 st_entry.course != cert_id: 117 self.students_catalog.modifyRecord(id = student_id, 98 118 faculty = fac_id, 99 119 department = dep_id, 120 course = cert_id 100 121 ) 101 102 103 res = self.portal_catalog(portal_type="Department",id=dep_id) 104 if len(res) != 1: 122 if real_object.portal_type == "StudentStudyLevel": 123 context_obj = getattr(certificate_obj,real_object.getId(),None) 124 if context_obj is None: 125 break 126 allowed = set(('CourseAdviser', 'SectionManager')) 127 elif real_object.portal_type == "Student" and "CourseAdvisers" in groups: 128 #we need some special processing since CourseAdvisers are only 129 #specified per StudyLevel 130 allowed = set(('CourseAdviser', 'SectionManager')) 131 for context_obj in certificate_obj.objectValues(): 132 dynamic_roles = set(self.getRolesInContext(context_obj)) 133 intersect = dynamic_roles & allowed 134 if intersect: 135 roles.extend(list(intersect)) 105 136 break 106 dynamic_roles = self.getRolesInContext(res[0].getObject()) 107 for dr in ('ClearanceOfficer','CourseAdviser', 'SectionManager'): 108 if dr in dynamic_roles: 109 roles.append(dr) 137 else: 138 res = self.portal_catalog(portal_type="Department",id=dep_id) 139 allowed = set(('ClearanceOfficer', 'SectionManager')) 140 if len(res) != 1: 141 break 142 context_obj = res[0].getObject() 143 dynamic_roles = set(self.getRolesInContext(context_obj)) 144 intersect = dynamic_roles & allowed 145 if intersect: 146 roles.extend(list(intersect)) 110 147 break 111 148 return roles -
WAeUP_SRP/branches/uli/ScratchCards.py
r1395 r1593 37 37 """import PinBatch""" 38 38 name = "PINS" 39 logger = logging.getLogger(' Import.%s' % name)39 logger = logging.getLogger('Students.ScratchCardBatchesFolder.importPinBatch') 40 40 logger.info('Start loading from %s.csv' % name) 41 41 pins_section = self.portal_url.getPortalObject().campus.pins … … 66 66 dict['no_of_pins'] = n - 1 67 67 batch.getContent().edit(mapping=dict) 68 logger.info(' Added %s with %d Pins' % (bid,n-1))68 logger.info('%s with %d PINs added' % (bid,n-1)) 69 69 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 70 70 ###) … … 140 140 return unused[-max_pins:] 141 141 return unused 142 142 143 143 security.declareProtected(View,"getUsedPins") 144 144 def getUsedPins(self): -
WAeUP_SRP/branches/uli/Students.py
r1529 r1593 82 82 security = ClassSecurityInfo() 83 83 84 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsFromCSV")###( 85 def loadFullTimeStudentsFromCSV(self): 86 """load Fulltime Studentdata from CSV values""" 87 import transaction 88 import random 89 tr_count = 0 90 name = 'short_full_time' 91 no_import = False 92 if not no_import: 93 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 94 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') 95 logger = logging.getLogger('Import.%s' % name) 96 logger.info('Start loading from %s.csv' % name) 97 pwlist = [] 98 pwlist.append('"student_id","firstname","middlename","lastname","matric_no","jamb_reg_no","access_code"') 99 pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$matric_no","$jamb_reg_no","$access_code"') 100 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 101 try: 102 students = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 103 except: 104 logger.error('Error reading %s.csv' % name) 105 return 106 l = self.portal_catalog({'meta_type': "StudentClearance",}) 107 matrics = [] 108 for s in l: 109 matrics.append(s.getObject().getContent().matric_no) 110 print matrics 111 l = self.portal_catalog({'meta_type': "Certificate"}) 112 certs = {} 113 for c in l: 114 ca,ac,fa,dep_id,co,certcode = c.relative_path.split('/') 115 cid = "%(dep_id)s_%(certcode)s" % vars() 116 certs[cid] = c.getObject() 117 for student in students: 118 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) 119 sid = student.get('MatricNo') 120 if sid == "": 121 em = 'Empty MatricNo\n' 122 logger.info(em) 123 no_import.write(em) 124 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) 125 continue 126 certcode = makeCertificateCode(student.get('CourseMajor')) 127 dep_id = student.get('Dept') 128 fac_id = student.get('Faculty') 129 cid = "%(dep_id)s_%(certcode)s" % vars() 130 if cid not in certs.keys(): 131 em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor')) 132 logger.info(em) 133 no_import.write(em) 134 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) 135 continue 136 certificate_doc = certs[cid].getContent() 137 level = student.get('StudentLevel') 138 try: 139 int(level) 140 except: 141 em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student 142 logger.info(em) 143 no_import.write(em) 144 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) 145 continue 146 matric_no = student.get('MatricNo') 147 if matric_no not in matrics: 148 matrics.append(matric_no) 149 sid = self.generateStudentId(student.get('Lastname')[0]) 150 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 151 students_folder.invokeFactory('Student', sid) 152 logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) 153 student_obj = getattr(self,sid) 154 access_code = "%d" % random.randint(1000000000,9999999999) 155 student_obj.getContent().makeStudentMember(sid,access_code,) 156 pwl_dict = {'student_id': sid,'access_code':access_code} 157 student_obj.invokeFactory('StudentApplication','application') 158 application = student_obj.application 159 da = {'Title': 'Application Data'} 160 student_obj.invokeFactory('StudentPersonal','personal') 161 da['jamb_reg_no'] = student.get('EntryRegNo') 162 personal = student_obj.personal 163 dp = {'Title': 'Personal Data'} 164 student_obj.invokeFactory('StudentClearance','clearance') 165 clearance = student_obj.clearance 166 dc = {'Title': 'Clearance/Eligibility Record'} 167 dc['matric_no'] = matric_no 168 state = student.get('State') 169 lga = student.get('LGA') 170 if state and lga: 171 lga = state + ' / ' + lga 172 else: 173 lga = "None" 174 dc['lga'] = lga 175 dc['nationality'] = student.get('Nationality') 176 dc['email'] = student.get('Emailaddress') 177 dp['firstname'] = student.get('FirstName') 178 dp['middlename'] = student.get('MiddleName') 179 dp['lastname'] = student.get('Lastname') 180 dp['former_surname'] = student.get('FormerSurname') 181 dp['sex'] = student.get('Sex') == 'F' 182 dp['perm_address'] = student.get('PermanentAddress') 183 dp['perm_city'] = student.get('PermanentAddressCity') 184 dp['campus_address'] = student.get('CampusAddress') 185 dp['phone'] = student.get('PhoneNumber') 186 application.getContent().edit(mapping=da) 187 personal.getContent().edit(mapping=dp) 188 clearance.getContent().edit(mapping=dc) 189 # 190 # Study Course 191 # 192 student_obj.invokeFactory('StudentStudyCourse','study_course') 193 studycourse = student_obj.study_course 194 dsc = {} 195 from_certificate = ['title', 196 'max_elect', 197 'max_pass', 198 'n_core', 199 'nr_years', 200 'probation_credits', 201 'promotion_credits', 202 'start_level', 203 ] 204 for f in from_certificate: 205 dsc[f] = getattr(certificate_doc,f) 206 dsc['faculty'] = fac_id 207 dsc['department'] = dep_id 208 dsc['study_course'] = certcode 209 css = student.get('CurrentSession') or '2004-2005' 210 cs = int(css.split('-')[0]) - 2000 211 cl = int(student.get('StudentLevel') or '100')/100 212 dsc['entry_session'] = "200%s" % (cs - cl) 213 dsc['clr_ac_pin'] = access_code 214 studycourse.getContent().edit(mapping=dsc) 215 # 216 # Level 217 # 218 ## l = getattr(studycourse,level,None) 219 ## if 0 and l is None: 220 ## #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 221 ## logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student) 222 ## studycourse.invokeFactory('StudentStudyLevel', level) 223 ## l = getattr(studycourse, level) 224 ## certificate = certs[certcode] 225 ## cert_level = getattr(certificate,level,None) 226 ## if cert_level is None: 227 ## logger.info('Level %(level)s not in %(certcode)s' % vars()) 228 ## l.getContent().edit(mapping={'Title': "Level %s" % level}) 229 else: 230 em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student 231 logger.info(em) 232 no_import.write(em) 233 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) 234 continue 235 if tr_count > MAX_TRANS: 236 transaction.commit() 237 em = 'Transaction commited\n' % student 238 logger.info(em) 239 tr_count = 0 240 tr_count += 1 241 pwl_dict.update(dc) 242 pwl_dict.update(da) 243 pwl_dict.update(dp) 244 wftool = self.portal_workflow 245 pwlist.append(pwl_template.substitute(pwl_dict)) 246 wftool.doActionFor(student_obj,'clear_and_validate') 247 student_obj.manage_setLocalRoles(sid, ['Owner',]) 248 wftool.doActionFor(application,'close') 249 application.manage_setLocalRoles(sid, ['Owner',]) 250 wftool.doActionFor(clearance,'close') 251 clearance.manage_setLocalRoles(sid, ['Owner',]) 252 wftool.doActionFor(personal,'close') 253 personal.manage_setLocalRoles(sid, ['Owner',]) 254 wftool.doActionFor(studycourse,'close_for_edit') 255 studycourse.manage_setLocalRoles(sid, ['Owner',]) 256 open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist)) 257 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 258 ###) 259 260 security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###( 261 def loadPumeResultsFromCSV(self): 262 """load Fulltime Studentdata from CSV values into pumeresults catalog""" 263 import transaction 264 import random 265 ## csv_d = {'jamb_reg_no': "RegNumber", ###( 266 ## 'status': "Admission Status", 267 ## 'name': "Name", 268 ## 'score': "Score", 269 ## 'sex': "Sex", 270 ## 'faculty': "Faculty", 271 ## 'department': "Dept", 272 ## 'course': "Course", 273 ## 'course_code_org': "Course Code", 274 ## } 275 ###) 276 csv_d = {'jamb_reg_no': "JAMBRegno", 277 'name': "Name", 278 'score': "Score", 279 'sex': "Sex", 280 'course': "Course", 281 'faculty': "Faculty", 282 'department': "Dept", 283 'course_code_org': "Course Code", 284 'status': "Admission Status", 285 'result_type': None, 286 } 287 csv_fields = [f[1] for f in csv_d.items() if f[1]] 288 tr_count = 0 289 total = 0 290 #name = 'pup_new' 291 name = 'pup_update' 292 update = name.endswith('update') 293 no_import = [] 294 ok_import = [] 295 ok_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_d.keys()])) 296 no_import.append('%s' % ','.join(['"%s"' % fn for fn in csv_fields])) 297 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 298 ok_import_name = "%s/import/%s_imported_%s.csv" % (i_home,name,current) 299 #open(ok_import_name,"w").write('\n'.join(no_import)) 300 no_import_name = "%s/import/%s_not_imported_%s.csv" % (i_home,name,current) 301 #open(no_import_name,"w").write('\n'.join(no_import)) 302 logger = logging.getLogger('Import.%s' % name) 303 starttime = DateTime.now() 304 logger.info('Start loading from %s.csv' % name) 305 try: 306 result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 307 except: 308 logger.error('Error reading %s.csv' % name) 309 return 310 pume = self.portal_pumeresults 311 format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields]) 312 import_format = ','.join(['"%%(%s)s"' % fn for fn in csv_d.keys()]) 313 eduplicate = '%s,"duplicate"' % format 314 einvalidjamb = '%s,"invalid JambRegNo"' % format 315 added = 'added ,%s' % format 316 #from pdb import set_trace;set_trace() 317 for jamb in result: 318 dict = {} 319 for f,fn in csv_d.items(): 320 dict[f] = jamb.get(csv_d[f]) 321 dict['result_type'] = 'DE' 322 jnr = jamb.get(csv_d['jamb_reg_no']) 323 if not checkJambNo(jnr): 324 logger.info(einvalidjamb % jamb) 325 dd = {} 326 for f,fn in csv_d.items(): 327 dd[fn] = getattr(data,f) 328 no_import.append(eduplicate % dd) 329 no_import.append(eduplicate % jamb) 330 continue 331 res = pume(jamb_reg_no=jnr) 332 if len(res) > 0: 333 if update: 334 try: 335 pume.modifyRecord(**dict) 336 except ValueError: 337 logger.info(eduplicate % jamb) 338 continue 339 except KeyError: 340 pume.addRecord(**dict) 341 logger.info(added % jamb) 342 continue 343 else: 344 data = res[0] 345 if data.name != jamb.get(csv_d['name']): 346 #set_trace() 347 logger.info(eduplicate % jamb) 348 #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict 349 #logger.info(em) 350 dd = {} 351 for f,fn in csv_d.items(): 352 dd[fn] = getattr(data,f) 353 no_import.append(eduplicate % dd) 354 no_import.append(eduplicate % jamb) 355 continue 356 try: 357 pume.addRecord(**dict) 358 ok_import.append(import_format % dict) 359 except ValueError: 360 logger.info(eduplicate % jamb) 361 #em = 'Student with REG-NO %(jamb_reg_no)s already exists\n' % dict 362 #logger.info(em) 363 no_import.append(eduplicate % jamb) 364 logger.info('End loading from %s.csv' % name) 365 if len(no_import) > 1: 366 open(no_import_name,"w+").write('\n'.join(no_import)) 367 open(ok_import_name,"w+").write('\n'.join(ok_import)) 368 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 369 ###) 84 370 85 371 86 security.declareProtected(ModifyPortalContent,"createDEStudents")###( … … 405 120 no_certificate = "no certificate %s" % format 406 121 open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write('\n'.join(no_import)) 407 logger = logging.getLogger(' Import.%s' % name)408 logger.info(' start loading from %s.csv' % name)122 logger = logging.getLogger('Students.StudentsFolder.createDEStudents') 123 logger.info('Start loading from %s.csv' % name) 409 124 l = self.portal_catalog({'meta_type': "Certificate"}) 410 125 certs = {} … … 418 133 return 419 134 for jamb in result: 420 jamb['Error'] = "Processing 135 jamb['Error'] = "Processing" 421 136 logger.info(format % jamb) 422 137 jamb_reg_no = jamb.get(csv_d['jamb_reg_no']) … … 624 339 no_certificate = "no certificate %s" % format 625 340 open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write('\n'.join(no_import)) 626 logger = logging.getLogger(' Import.%s' % name)627 logger.info(' start loading from %s.csv' % name)341 logger = logging.getLogger('Students.StudentsFolder.createNewStudents') 342 logger.info('Start loading from %s.csv' % name) 628 343 l = self.portal_catalog({'meta_type': "Certificate"}) 629 344 certs = {} … … 829 544 no_import = [] 830 545 imported = [] 831 logger = logging.getLogger(' Import.%s' % name)546 logger = logging.getLogger('Students.StudentsFolder.importReturningStudents') 832 547 try: 833 548 returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 849 564 if start: 850 565 start = False 851 logger.info(' start loading from %s.csv' % name)566 logger.info('Start loading from %s.csv' % name) 852 567 s = ','.join(['"%s"' % fn for fn in student.keys()]) 853 568 imported.append(s) … … 922 637 for k,v in verdicts_voc.items(): 923 638 rverdicts[v.upper()] = k 924 logger = logging.getLogger('fixVerdicts') 639 rverdicts['STUDENT ON PROBATION'] = 'C' 640 logger = logging.getLogger('Students.StudentsFolder.fixVerdicts') 925 641 try: 926 642 verdicts = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 933 649 if start: 934 650 start = False 935 logger.info(' start loading from %s.csv' % name)651 logger.info('Start loading from %s.csv' % name) 936 652 s = ','.join(['"%s"' % fn for fn in verdict.keys()]) 937 653 no_import.append('%s,"Error"' % s) … … 957 673 no_import.append( format_error % verdict) 958 674 continue 959 try: 960 st_cat.modifyRecord(id = student_id, 675 st_cat.modifyRecord(id = student_id, 961 676 verdict=verdict_code) 962 except KeyError: 963 student['Error'] = "Not found in students_catalog" 964 no_import.append( format_error % student) 965 continue 677 966 678 dsc = {} 967 679 dsc['current_verdict'] = verdict_code 968 680 study_course.getContent().edit(mapping=dsc) 681 else: 682 verdict['Error'] = "Not found in students_catalog" 683 no_import.append( format_error % verdict) 684 continue 969 685 tr_count += 1 970 686 if tr_count > 1000: … … 1017 733 st_cat = self.students_catalog 1018 734 no_import = [] 1019 logger = logging.getLogger(' getEntryMode.%s' % name)735 logger = logging.getLogger('Students.StudentsFolder.fixEntryModeForReturning') 1020 736 try: 1021 737 returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 1027 743 if start: 1028 744 start = False 1029 logger.info(' start loading from %s.csv' % name)745 logger.info('Start loading from %s.csv' % name) 1030 746 s = ','.join(['"%s"' % fn for fn in student.keys()]) 1031 747 no_import.append('%s,"Error"' % s) … … 1120 836 no_import = [] 1121 837 imported = [] 1122 logger = logging.getLogger(' Import.%s' % name)838 logger = logging.getLogger('Students.StudentsFolder.updateReturningStudents') 1123 839 try: 1124 840 returning = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 1139 855 if start: 1140 856 start = False 1141 logger.info(' start loading from %s.csv' % name)857 logger.info('Start loading from %s.csv' % name) 1142 858 s = ','.join(['"%s"' % fn for fn in student.keys()]) 1143 859 imported.append(s) … … 1214 930 no_import = [] 1215 931 imported = [] 1216 logger = logging.getLogger(' Import.%s' % name)932 logger = logging.getLogger('Students.StudentsFolder.importResults') 1217 933 try: 1218 934 results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) … … 1233 949 if start: 1234 950 start = False 1235 logger.info(' start loading from %s.csv' % name)951 logger.info('Start loading from %s.csv' % name) 1236 952 s = ','.join(['"%s"' % fn for fn in result.keys()]) 1237 953 imported.append(s) … … 1339 1055 open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write( 1340 1056 '\n'.join(no_import)) 1341 logger = logging.getLogger(' Import.%s' % name)1057 logger = logging.getLogger('Students.StudentsFolder.updateStudyCourse') 1342 1058 logger.info('Start loading from %s.csv' % name) 1343 1059 l = self.portal_catalog({'meta_type': "Certificate"}) … … 1354 1070 'SearchableText': jamb_reg_no }) 1355 1071 if not res: 1356 em = 'Student with RegNo %s does not exists\n' % jamb_reg_no1072 em = 'Student with jamb_reg_no %s does not exists\n' % jamb_reg_no 1357 1073 logger.info(em) 1358 jamb['Error'] = "Student not exists"1074 jamb['Error'] = "Student does not exist" 1359 1075 no_import.append(format % jamb) 1360 1076 continue … … 1398 1114 ###) 1399 1115 1400 security.declareProtected(ModifyPortalContent,"OLDloadPumeResultsFromCSV")###( 1401 def OLDloadPumeResultsFromCSV(self): 1402 """load Fulltime Studentdata from CSV values""" 1403 import transaction 1404 import random 1405 wftool = self.portal_workflow 1406 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 1407 csv_d = {'jamb_reg_no': "JAMBRegno", 1408 'jamb_lastname': "Name", 1409 'pume_options': "Options", 1410 'session': "Session", 1411 'days': "Days", 1412 'response': "Responce", 1413 'wrong': "Wrong", 1414 'pume_eng_score': "EngScore", 1415 'pume_gen_score': "GenScore", 1416 'pume_tot_score': "Score", 1417 'batch': "Batch", 1418 'serial': "SerialNo", 1419 'jamb_score': "JambScore", 1420 'omitted':"Omitted", 1421 'search_key': "SearchKey", 1422 'jamb_sex': "Sex", 1423 'fac1': "Fac1", 1424 'fac2': "Fac2", 1425 'jamb_first_cos': "CourseofStudy", 1426 'stud_status':"StudStatus", 1427 'registered': "Registered", 1428 'jamb_state': "State", 1429 'eng_fail': "EngFail", 1430 'gen_fail': "GenFail", 1431 'un_ans_eng': "UnAnsEng", 1432 'un_ans_eng': "UnAnsGen", 1433 'total_ans': "TotalUnAns", 1434 'dept': "Dept", 1435 'jamb_second_cos': "Course2", 1436 'jamb_third_cos': "course3", 1437 } 1438 csv_fields = [f[1] for f in csv_d.items()] 1439 tr_count = 0 1440 name = 'pume_results' 1441 no_import = [] 1442 s = ','.join(['"%s"' % fn for fn in csv_fields]) 1443 no_import.append('%s\n' % s) 1444 logger = logging.getLogger('Import.%s' % name) 1445 logger.info('Start loading from %s.csv' % name) 1446 try: 1447 result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 1448 except: 1449 logger.error('Error reading %s.csv' % name) 1450 return 1451 for jamb in result: 1452 format = ','.join(['"%%(%s)s"' % fn for fn in csv_fields]) 1453 processing = "processing %s" % format 1454 logger.info(processing % jamb) 1455 jamb_reg_no = jamb.get(csv_d['jamb_reg_no']) 1456 #import pdb;pdb.set_trace() 1457 res = self.portal_catalog({'portal_type': "StudentApplication", 1458 'jamb_reg_no': jamb_reg_no }) 1459 if res: 1460 em = 'Student with REG-NO %s already exists\n' % jamb_reg_no 1461 logger.info(em) 1462 no_import.append(em) 1463 no_import.append(format % jamb) 1464 continue 1465 cert_id = jamb.get(csv_d['jamb_first_cos']).upper() 1466 res = self.portal_catalog({'portal_type': "Certificate", 1467 'id': cert_id }) 1468 if len(res) < 1: 1469 em = 'No Certificate with ID %s \n' % cert_id 1470 logger.info(em) 1471 no_import.append(em) 1472 no_import.append(format % jamb) 1473 continue 1474 cert = res[0].getObject() 1475 cert_path = res[0].getPath() 1476 cert_doc = cert.getContent() 1477 jamb_name = jamb.get(csv_d['jamb_lastname']) 1478 jamb_name.replace('>','') 1479 names = jamb_name.split() 1480 letter = names[-1][0].upper() 1481 sid = self.generateStudentId(letter) 1482 not_created = True 1483 while not_created: 1484 try: 1485 students_folder.invokeFactory('Student', sid) 1486 not_created = False 1487 except BadRequest: 1488 sid = self.generateStudentId(letter) 1489 logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars()) 1490 student = getattr(self,sid) 1491 student.manage_setLocalRoles(sid, ['Owner',]) 1492 student.invokeFactory('StudentClearance','clearance') 1493 #wftool.doActionFor(student.clearance,'open') 1494 dp = {'Title': 'Clearance/Eligibility Record'} 1495 student.clearance.manage_setLocalRoles(sid, ['Owner',]) 1496 student.invokeFactory('StudentPume','pume') 1497 dp = {'Title': 'Pume Data'} 1498 student.invokeFactory('StudentApplication','application') 1499 da = {'Title': 'Application Data'} 1500 da["jamb_lastname"] = jamb_name 1501 da_fields = ('jamb_reg_no', 1502 'jamb_sex', 1503 'jamb_state', 1504 'jamb_score', 1505 'jamb_first_cos', 1506 'jamb_sex', 1507 'jamb_state', 1508 'jamb_first_cos', 1509 'jamb_second_cos', 1510 ) 1511 for f in da_fields: 1512 da[f] = jamb.get(csv_d[f]) 1513 app = student.application 1514 app.getContent().edit(mapping=da) 1515 app.manage_setLocalRoles(sid, ['Owner',]) 1516 #wftool.doActionFor(app,'close') 1517 dp_fields = ( 1518 'pume_eng_score', 1519 'pume_gen_score', 1520 'pume_tot_score', 1521 ) 1522 for f in dp_fields: 1523 dp[f] = float(jamb.get(csv_d[f])) 1524 pume = student.pume 1525 pume.getContent().edit(mapping=dp) 1526 #wftool.doActionFor(pume,'close') 1527 pume.manage_setLocalRoles(sid, ['Owner',]) 1528 # 1529 # Study Course 1530 # 1531 student.invokeFactory('StudentStudyCourse','study_course') 1532 study_course = student.study_course 1533 dsc = {} 1534 from_certificate = ['title', 1535 'max_elect', 1536 'max_pass', 1537 'n_core', 1538 'nr_years', 1539 'probation_credits', 1540 'promotion_credits', 1541 'start_level', 1542 ] 1543 for f in from_certificate: 1544 dsc[f] = getattr(cert_doc,f) 1545 cpl = cert_path.split('/') 1546 dsc['faculty'] = cpl[-4] 1547 dsc['department'] = cpl[-3] 1548 dsc['study_course'] = cert_id 1549 dsc['entry_session'] = jamb.get(csv_d['session']) 1550 study_course.getContent().edit(mapping=dsc) 1551 student.getContent().createSubObjects() 1552 if dp['pume_tot_score']>49: 1553 wftool.doActionFor(student,'pume_pass') 1554 wftool.doActionFor(student,'admit') 1555 else: 1556 wftool.doActionFor(student,'pume_fail') 1557 wftool.doActionFor(student,'reject_admission') 1558 if len(no_import) > 1: 1559 open("%s/import/%s_not_imported.csv" % (i_home,name),"w").write( 1560 '\n'.join(no_import)) 1561 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 1562 ###) 1563 1564 security.declareProtected(ModifyPortalContent,"loadFullTimeStudentsResultsFromCSV") ###( 1565 def loadFullTimeStudentsResultsFromCSV(self): 1566 """load Fulltime Studentdata from CSV values""" 1567 #return 1568 level_wf_actions = {} 1569 level_wf_actions["SUCCESSFUL STUDENT"] = "pass_A" 1570 level_wf_actions["STUDENT WITH CARRYOVER COURSES"] = "pass_B" 1571 level_wf_actions["STUDENT FOR PROBATION"] = "probate_C" 1572 level_wf_actions["STUDENT ON PROBATION/TRANSFER"] = "reject_D" 1573 import transaction 1574 wftool = self.portal_workflow 1575 tr_count = 0 1576 name = 'short_full_time_results_2004_2005' 1577 no_import = False 1578 if not no_import: 1579 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 1580 no_import.write('"Matnumber","CosCode","Ansbook","CosStuatus","Session","Mat_Cos","Score","CarryLevel","Grade","Weight","Semster","Verdict","Level","id","GPA"\n') 1581 logger = logging.getLogger('import.%s' % name) 1582 logger.info('Start loading from %s.csv' % name) 1583 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 1584 try: 1585 results = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 1586 except: 1587 logger.error('Error reading %s.csv' % name) 1588 return 1589 l = self.portal_catalog({'meta_type': "Course"}) 1590 courses = {} 1591 for c in l: 1592 courses[c.id] = c.getObject() 1593 level_changed = False 1594 student_changed = False 1595 sid = '' 1596 #import pdb;pdb.set_trace() 1597 for result in results: 1598 temp_sid = result.get('Matnumber') 1599 if temp_sid != sid: 1600 student_changed = True 1601 res = self.portal_catalog({'meta_type': "StudentClearance", 1602 'SearchableText': temp_sid }) 1603 if not res: 1604 em = 'Student with ID %(Matnumber)s not found\n' % result 1605 logger.info(em) 1606 no_import.write(em) 1607 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) 1608 continue 1609 elif len(res) > 1: 1610 em = 'More than one Student with ID %(Matnumber)s found\n' % result 1611 logger.info(em) 1612 no_import.write(em) 1613 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) 1614 continue 1615 sid = temp_sid 1616 sf = res[0].getObject().aq_parent 1617 sc = getattr(sf,'study_course') 1618 level = '' 1619 else: 1620 student_changed = False 1621 course = result.get('CosCode') 1622 if course not in courses.keys(): 1623 em = 'Course with ID %(CosCode)s not found\n' % result 1624 logger.info(em) 1625 no_import.write(em) 1626 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) 1627 continue 1628 course_doc = courses[course].getContent() 1629 temp_level = result.get('Level') 1630 student_id = sf.getId() 1631 result['StudentId'] = student_id 1632 if temp_level != level: 1633 try: 1634 int(temp_level) 1635 except: 1636 em = 'Result with ID %(Matnumber)s Course %(CosCode)s Level is empty\n' % result 1637 logger.info(em) 1638 no_import.write(em) 1639 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) 1640 continue 1641 level_changed = True 1642 if 'dlev' in vars().keys(): 1643 wftool.doActionFor(l,level_wf_actions[dlev['verdict']]) 1644 level = temp_level 1645 l = getattr(sc,level,None) 1646 if l is None: 1647 logger.info('Creating Level %(Level)s for %(StudentId)s %(Matnumber)s' % result) 1648 sc.invokeFactory('StudentStudyLevel', level) 1649 l = getattr(sc, level) 1650 l.manage_setLocalRoles(student_id, ['Owner',]) 1651 else: 1652 level_changed = False 1653 cr = getattr(l,course,None) 1654 if cr is None: 1655 logger.info('Creating Course %(CosCode)s for %(StudentId)s %(Matnumber)s in Level %(Level)s' % result) 1656 l.invokeFactory('StudentCourseResult',course) 1657 cr = getattr(l,course) 1658 dcr = {} 1659 from_course = ['title', 1660 'credits', 1661 'passmark', 1662 ] 1663 for f in from_course: 1664 dcr[f] = getattr(course_doc,f) 1665 dlev = {} 1666 dcr['ansbook'] = result.get('Ansbook') 1667 dcr['semester'] = getInt(result.get('Semster')) 1668 dcr['status'] = result.get('CosStuatus') 1669 dcr['score'] = getInt(result.get('Score')) 1670 dlev['session'] = result.get('Session') 1671 dcr['carry_level'] = result.get('CarryLevel') 1672 dcr['grade'] = result.get('Grade') 1673 dcr['weight'] = result.get('Weight') 1674 dlev['verdict'] = result.get('Verdict') 1675 dcr['import_id'] = result.get('id') 1676 gpa = result.get('GPA').replace(',','.') 1677 dlev['imported_gpa'] = getFloat(gpa) 1678 cr.getContent().edit(mapping = dcr) 1679 cr.manage_setLocalRoles(student_id, ['Owner',]) 1680 l.getContent().edit(mapping = dlev) 1681 if tr_count > MAX_TRANS: 1682 transaction.commit() 1683 tr_count = 0 1684 tr_count += 1 1685 wftool.doActionFor(cr,'close') 1686 wftool.doActionFor(l,level_wf_actions[dlev['verdict']]) 1687 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 1688 1689 ###) 1690 1691 security.declareProtected(ModifyPortalContent,"loadJAMBFromCSV")###( 1692 def loadJAMBFromCSV(self): 1693 """load JAMB data from CSV values""" 1694 #return 1695 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 1696 import transaction 1697 tr_count = 0 1698 name = 'SampleJAMBDataII' 1699 wftool = self.portal_workflow 1700 no_import = False 1701 if not no_import: 1702 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 1703 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') 1704 logger = logging.getLogger('Import.%s' % name) 1705 logger.info('Start loading from %s.csv' % name) 1706 try: 1707 result = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 1708 except: 1709 logger.error('Error reading %s.csv' % name) 1710 return 1711 for jamb in result: 1712 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) 1713 jamb_reg_no = jamb.get('REG-NO') 1714 res = self.portal_catalog({'meta_type': "StudentApplication", 1715 'jamb_reg_no': jamb_reg_no }) 1716 if res: 1717 em = 'Student with REG-NO %(REG-NO)s already exists\n' % jamb 1718 logger.info(em) 1719 no_import.write(em) 1720 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) 1721 continue 1722 jamb_name = jamb.get("NAME") 1723 jamb_name.replace('>','') 1724 names = jamb_name.split() 1725 letter = names[-1][0].upper() 1726 sid = self.generateStudentId(letter) 1727 not_created = True 1728 while not_created: 1729 try: 1730 students_folder.invokeFactory('Student', sid) 1731 not_created = False 1732 except BadRequest: 1733 sid = self.generateStudentId(letter) 1734 logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars()) 1735 student = getattr(self,sid) 1736 student.manage_setLocalRoles(sid, ['Owner',]) 1737 student.invokeFactory('StudentApplication','application') 1738 da = {'Title': 'Application Data'} 1739 da["jamb_reg_no"] = jamb.get("REG-NO") 1740 da["jamb_lastname"] = jamb_name 1741 da["jamb_sex"] = jamb.get("SEX") 1742 da["jamb_state"] = jamb.get("STATE") 1743 da["jamb_lga"] = jamb.get("LGA") 1744 da["jamb_score"] = jamb.get("AGGREGATE") 1745 da["jamb_first_cos"] = jamb.get("COURSE1") 1746 da["jamb_second_cos"] = jamb.get("COURSE2") 1747 da["jamb_first_uni"] = jamb.get("UNIV1") 1748 da["jamb_second_uni"] = jamb.get("UNIV2") 1749 app = student.application 1750 app_doc = app.getContent() 1751 app_doc.edit(mapping=da) 1752 #wftool.doActionFor(app,'open',dest_container=app) 1753 app.manage_setLocalRoles(sid, ['Owner',]) 1754 student.getContent().createSubObjects() 1755 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 1756 ###) 1757 1758 1116 1117 1759 1118 security.declareProtected(View,"fixOwnership") 1760 1119 def fixOwnership(self): -
WAeUP_SRP/branches/uli/WAeUPTables.py
r1306 r1593 142 142 rec = records[0] 143 143 self.modifyRecord(bed=rec.bed,student=student_id) 144 s_logger = logging.getLogger(' Accommodation.SearchAndReserveBed')145 s_logger.info( "%s reserved bed %s"% (student_id,rec.bed))144 s_logger = logging.getLogger('WAeUPTables.AccommodationTable.searchAndReserveBed') 145 s_logger.info('%s reserved bed %s' % (student_id,rec.bed)) 146 146 return 1,rec.bed 147 147 -
WAeUP_SRP/branches/uli/WAeUPTool.py
r1550 r1593 109 109 student_entry = getattr(self.portal_directories.students,student_id,None) 110 110 if student_entry is None: 111 return 111 return 112 112 setattr(student_entry,'password',password) 113 113 ###) … … 288 288 "create Datastructure for a returning Student" 289 289 #import pdb;pdb.set_trace() 290 logger = logging.getLogger(' Student.CreateData')290 logger = logging.getLogger('WAeUPTool.makeStudentData') 291 291 students_folder = self.portal_url.getPortalObject().campus.students 292 292 res = self.students_catalog(id=student_id) … … 296 296 if res: 297 297 student = res[0] 298 logger.info(' "%s", "creating Datastructure"' % student_id)298 logger.info('%s creates data structure' % student_id) 299 299 s_results = self.results_import(matric_no = st.matric_no) 300 300 lnr = self.getLevelFromResultsCosCode(s_results) … … 404 404 "create the StudyLevel for a returning Student" 405 405 #import pdb;pdb.set_trace() 406 logger = logging.getLogger(' Student.CreateLevel')406 logger = logging.getLogger('WAeUPTool.makeStudentLevel') 407 407 students_folder = self.portal_url.getPortalObject().campus.students 408 408 res = self.students_catalog(id=student_id) … … 415 415 if res: 416 416 results = res 417 logger.info(' "%s", "creating Level", "%s"' % (student_id,level))417 logger.info('%s creating Level %s' % (student_id,level)) 418 418 # 419 419 # Level … … 481 481 def getLogfileLines(self,filename="event.log",numlines=20): 482 482 """Get last NUMLINES lines of logfile FILENAME. 483 483 484 484 Return last lines' of a file in the instances logfile directory as 485 485 a list. The number of returned lines equals `numlines' or less. If … … 497 497 # Attempt to access file outside log-dir... 498 498 return [] 499 499 500 500 try: 501 501 fd = file( filename, "rb" ) … … 504 504 if not fd: 505 505 return [] 506 506 507 507 if os.linesep == None: 508 508 linesep = '\n' 509 509 else: 510 510 linesep = os.linesep 511 511 512 512 # Try to find 'numlines' times a lineseparator, searching from end 513 513 # and moving to the beginning of file... … … 528 528 # Remove line endings... 529 529 result = [x.strip() for x in result] 530 fd.close() 530 fd.close() 531 531 return result 532 532 ###) 533 533 534 535 534 InitializeClass(WAeUPTool) -
WAeUP_SRP/branches/uli/Widgets.py
r1449 r1593 343 343 def validate(self, datastructure, **kw): 344 344 """Validate datastructure and update datamodel.""" 345 logger = logging.getLogger(' Secret.Validate')345 logger = logging.getLogger('Widgets.SecretWidget.validate') 346 346 valid = CPSStringWidget.validate(self, datastructure, **kw) 347 347 #import pdb;pdb.set_trace() … … 370 370 name = " ".join(cvs) 371 371 if not found: 372 logger.info(' "%(matric_no)s","mismatch", "%(value)s", "not in","%(name)s"' % vars())373 err = 'No Name does match.'374 else: 375 logger.info(' "%(matric_no)s","found", "%(value)s", "in","%(name)s"' % vars())372 logger.info('%(matric_no)s did not find %(value)s in %(name)s' % vars()) 373 err = 'No name does match.' 374 else: 375 logger.info('%(matric_no)s found %(value)s in %(name)s' % vars()) 376 376 if err: 377 377 datastructure.setError(widget_id, err) … … 392 392 """Validate datastructure and update datamodel.""" 393 393 valid = CPSStringWidget.validate(self, datastructure, **kw) 394 logger = logging.getLogger(' MatricNo.Validate')394 logger = logging.getLogger('Widgets.MatricNoWidget.validate') 395 395 #import pdb;pdb.set_trace() 396 396 returning = self.returning_import … … 400 400 value = datastructure[widget_id] 401 401 if not valid or not value: 402 err = 'Invalid MatricNo String %s.' % value403 logger.info(' "%s","invalid MatricNo String"' % value)402 err = 'Invalid matric_no string %s.' % value 403 logger.info('Invalid matric_no string %s' % value) 404 404 else: 405 405 value = value.upper() … … 408 408 res = returning(matric_no = value) 409 409 if len(res) < 1: 410 logger.info(' "%s","MatricNo not found."' % value)411 err = 'No Student with MatricNo %s.' % (value)410 logger.info('matric_no %s not found' % value) 411 err = 'No student with matric_no %s.' % (value) 412 412 continue 413 413 datastructure['student'] = res[0] 414 414 res = results(matric_no = value) 415 415 if len(res) < 1: 416 err = 'No Results with MatricNo %s.' % (value)416 err = 'No results with matric_no %s.' % (value) 417 417 continue 418 418 datastructure['results'] = res … … 436 436 """Validate datastructure and update datamodel.""" 437 437 valid = CPSStringWidget.validate(self, datastructure, **kw) 438 logger = logging.getLogger(' StudentId.Validate')438 logger = logging.getLogger('Widgets.StudentIdWidget.validate') 439 439 #import pdb;pdb.set_trace() 440 440 s_cat = self.students_catalog … … 443 443 value = datastructure[widget_id] 444 444 if not valid or not value: 445 err = 'Invalid StudentId String %s.' % value446 logger.info(' "%s","invalid StudentId String"' % value)445 err = 'Invalid id string %s.' % value 446 logger.info('Invalid id string %s' % value) 447 447 datastructure['student'] = None 448 448 else: … … 450 450 res = s_cat(id = value) 451 451 if not res: 452 logger.info(' "%s","StudentId not found."' % value)453 err = 'No Student with StudentId %s.' % (value)452 logger.info('Student id %s not found' % value) 453 err = 'No student with id %s.' % (value) 454 454 datastructure['student'] = None 455 455 else: … … 699 699 def validate(self, datastructure, **kw): ###( 700 700 """Validate datastructure and update datamodel.""" 701 s_logger = logging.getLogger(' Pin.Validate')701 s_logger = logging.getLogger('Widgets.ScratchcardPinWidget.validate') 702 702 widget_id = self.getWidgetId() 703 703 v = datastructure[widget_id] … … 718 718 do = 0 719 719 err ='You are not a Student. PIN neither checked nor used.' 720 s_logger.info('"%s","tried to use Scratchcard", "%s"' % (s_id,pin_str)) 720 s_logger.info('%s tried to use scratch card %s' % (s_id,pin_str)) 721 elif len(b) > 1 and b.find('-') > -1: 722 do = 0 723 err = 'PIN must not contain "-"' 724 s_logger.info('%s entered invalid PIN containing "-"' % (s_id)) 725 elif n.find('-') > -1: 726 do = 0 727 err = 'PIN must not contain "-"' 728 s_logger.info('%s entered invalid PIN containing "-"' % (s_id)) 721 729 elif len(n) != 10: 722 730 do = 0 723 err = 'Invalid PIN -Numberlength %d' % len(n)724 s_logger.info(' "%s","Invalid PIN-Number length", "%d"' % (s_id,len(n)))731 err = 'Invalid PIN length %d' % len(n) 732 s_logger.info('%s entered invalid PIN with length %d' % (s_id,len(n))) 725 733 elif self.reference == "": 726 734 ref = s_id … … 729 737 if datastructure.errors: 730 738 do = 0 731 datastructure.setError(widget_id, ' Errors in other data, PIN neither checked nor used.')732 s_logger.info(' "%s", "%s","entered wrong data together with pin", "%s"' % (s_id,ref,pin_str))739 datastructure.setError(widget_id, 'errors in other data, PIN neither checked nor used') 740 s_logger.info('%s/%s entered wrong data together with PIN %s' % (s_id,ref,pin_str)) 733 741 while do: 734 742 ok = pins.searchAndSetRecord(pin,ref,prefix) 735 743 if ok < -2 or ok > 2: 736 744 err = 'Unknown error, please report!' 737 s_logger.info(' "%s","%s", "caused unknown error with pin", "%s"' % (s_id,ref,pin_str))745 s_logger.info('%s/%s caused unknown error with PIN %s' % (s_id,ref,pin_str)) 738 746 break 739 747 elif ok == -2: 740 748 err = 'Service already activated but with a different PIN.' 741 s_logger.info(' "%s","%s", "repeatedly activated service but with different pin", "%s"' % (s_id,ref,pin_str))749 s_logger.info('%s/%s repeatedly activated service but with different PIN %s' % (s_id,ref,pin_str)) 742 750 break 743 751 elif ok == -1: 744 752 err = 'Invalid PIN' 745 s_logger.info(' "%s","%s", "entered invalid pin", "%s"' % (s_id,ref,pin_str))753 s_logger.info('%s/%s entered invalid PIN %s' % (s_id,ref,pin_str)) 746 754 break 747 755 if ok == 0: 748 err = 'PIN already used .'749 s_logger.info(' "%s","%s", "entered used pin", "%s"' % (s_id,ref,pin_str))756 err = 'PIN already used' 757 s_logger.info('%s/%s entered used PIN %s' % (s_id,ref,pin_str)) 750 758 break 751 759 if ok >= 1: … … 754 762 if self.reference == "jamb_reg_no": 755 763 err = "You are already logged in." 756 s_logger.info(' "%s","%s", "checked admission though logged in", "%s"' % (s_id,ref,pin_str))764 s_logger.info('%s/%s checked admission with PIN %s though logged in' % (s_id,ref,pin_str)) 757 765 break 758 766 if ok == 1: 759 s_logger.info(' "%s","%s", "successfully used pin", "%s"' % (s_id,ref,pin_str))767 s_logger.info('%s/%s successfully used PIN %s' % (s_id,ref,pin_str)) 760 768 else: 761 s_logger.info(' "%s","%s", "repeatedly used pin", "%s"' % (s_id,ref,pin_str))769 s_logger.info('%s/%s repeatedly used PIN %s' % (s_id,ref,pin_str)) 762 770 break 763 771 else: 764 772 student = getStudentByRegNo(self,ref) 765 s_logger.info(' "%s","%s","successfully used pin","%s"' % (s_id,ref,pin_str))773 s_logger.info('%s/%s successfully used PIN %s' % (s_id,ref,pin_str)) 766 774 if student is None: 767 775 err = "Student not found." 768 s_logger.info(' "%s","not found in admission list"' % (ref))776 s_logger.info('%s not found in admission list' % (ref)) 769 777 break 770 778 s_id = student.getId() … … 773 781 if hasattr(self.portal_directories.students,s_id): 774 782 err = "Please login with your Student Id %s and 10-digit PIN." % s_id 775 s_logger.info(' "%s","%s", "repeatedly checked admission with pin", "%s"' % (s_id,ref,pin_str))783 s_logger.info('%s/%s repeatedly checked admission with PIN %s' % (s_id,ref,pin_str)) 776 784 break 777 785 else: 778 s_logger.info(' "%s","%s","(non-member) repeatedly checked admission with pin", "%s"' % (s_id,ref,pin_str))786 s_logger.info('%s/%s (non-member) repeatedly checked admission with PIN %s' % (s_id,ref,pin_str)) 779 787 else: 780 788 err = "Unknown error" % s_id 781 s_logger.info(' "%s","%s", "repeatedly activated service with pin", "%s"' % (s_id,ref,pin_str))789 s_logger.info('%s/%s repeatedly activated service with PIN %s' % (s_id,ref,pin_str)) 782 790 break 783 791 try: 784 792 student.getContent().makeStudentMember(s_id,password=pin[4:]) 785 s_logger.info(' "%s","%s", "has been created using pin", "%s"' % (s_id,ref,pin_str))793 s_logger.info('%s/%s has been created using PIN %s' % (s_id,ref,pin_str)) 786 794 except: 787 795 err = "Please login with your Student Id %s and 10-digit PIN." % s_id 788 s_logger.info(' "%s","%s", "could not be made a member with pin", "%s"' % (s_id,ref,pin_str))796 s_logger.info('%s/%s could not be made a member with PIN %s' % (s_id,ref,pin_str)) 789 797 break 790 798 break -
WAeUP_SRP/branches/uli/profiles/default/actionicons.xml
r1477 r1593 57 57 action_id="allocate_reserved_bed" 58 58 title="Allocate Reserved Bed" priority="100" 59 icon_expr="bed_list_refresh.gif"/> 59 icon_expr="bed_list_refresh.gif"/> 60 <action-icon category="object" 61 action_id="release_bed" 62 title="Relase Bed" priority="110" 63 icon_expr="door_out.png"/> 60 64 <action-icon category="folder" action_id="portlets" 61 65 title="Manage portlets" priority="270" -
WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation.xml
r1449 r1593 110 110 </property> 111 111 <property name="hidden_readonly_layout_modes"/> 112 <property name="render_method"> formatBed</property>112 <property name="render_method">getFormattedBed</property> 113 113 </widget> 114 114 <widget name="session" meta_type="String Widget"> -
WAeUP_SRP/branches/uli/profiles/default/layouts/student_accommodation_fe.xml
r1449 r1593 79 79 </property> 80 80 <property name="hidden_readonly_layout_modes"/> 81 <property name="render_method"> formatBed</property>81 <property name="render_method">getFormattedBed</property> 82 82 </widget> 83 83 <widget name="session" meta_type="String Widget"> -
WAeUP_SRP/branches/uli/profiles/default/payments_catalog.xml
r1403 r1593 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name="payments_catalog" meta_type=" CMF Catalog">3 <object name="payments_catalog" meta_type="WAeUP Table"> 4 4 <column value="id"/> 5 5 <column value="student_id"/> -
WAeUP_SRP/branches/uli/profiles/default/pumeresults.xml
r1456 r1593 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name="portal_ catalog" meta_type="WAeUP Table">3 <object name="portal_pumeresults" meta_type="WAeUP Table"> 4 4 <column value="jamb_reg_no"/> 5 5 <column value="name"/> -
WAeUP_SRP/branches/uli/profiles/default/results_import.xml
r1456 r1593 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name=" portal_catalog" meta_type="CMF Catalog">3 <object name="results_import" meta_type="WAeUP Table"> 4 4 <column value="key"/> 5 5 <column value="matric_no"/> -
WAeUP_SRP/branches/uli/profiles/default/returning_import.xml
r1456 r1593 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name=" portal_catalog" meta_type="CMF Catalog">3 <object name="returning_import" meta_type="WAeUP Table"> 4 4 <column value="matric_no"/> 5 5 <column value="Entryregno"/> -
WAeUP_SRP/branches/uli/profiles/default/schemas/import_student_course_results.xml
r1533 r1593 6 6 <field name="score" meta_type="CPS String Field"/> 7 7 </object> 8 -
WAeUP_SRP/branches/uli/profiles/default/themes.xml
r1518 r1593 25 25 <element key="payment_receipt" value="WAeUP_Student+Slippage"/> 26 26 <element key="course_registration_slip" value="WAeUP_Student+Slippage"/> 27 <element key="external_study_level_view" value="WAeUP_Student+Slippage"/> 28 <element key="external_contact_student_form" value="WAeUP_Student+Slippage"/> 27 29 </property> 28 30 <object name="default" meta_type="Portal Theme"/> -
WAeUP_SRP/branches/uli/profiles/default/types/StudyLevel.xml
r1449 r1593 37 37 <permission value="View"/> 38 38 </action> 39 <action title="Add Course" action_id="new_entry" category="object" 40 condition_expr="" 41 url_expr="string:${object_url}/content_create?type_name=CertificateCourse" 42 visible="True"> 43 <permission value="Modify portal content"/> 39 <action title="Add Course" action_id="new_entry" category="object" 40 condition_expr="" 41 url_expr="string:${object_url}/content_create?type_name=CertificateCourse" 42 visible="True"> 43 <permission value="Modify portal content"/> 44 </action> 45 <action title="Delegate" action_id="localroles" category="object" 46 condition_expr="" url_expr="string:${object_url}/folder_localrole_form" 47 visible="True"> 48 <permission value="Modify portal content"/> 44 49 </action> 50 45 51 </object> -
WAeUP_SRP/branches/uli/profiles/default/vocabularies/searchable_student_states.xml
r1516 r1593 19 19 <item key="clearance_requested" msgid="">clearance requested</item> 20 20 <item key="cleared_and_validated" msgid="">cleared and validated</item> 21 <item key="content_addable" msgid="">content addable</item> 21 <item key="courses_registered" msgid="">courses registered</item> 22 <item key="courses_validated" msgid="">courses validated</item> 22 23 </object> -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/allocate_reserved_bed.py
r1477 r1593 13 13 acco_cat = context.portal_accommodation 14 14 import logging 15 logger = logging.getLogger(' Accommodation.AllocateReservedBed')15 logger = logging.getLogger('Skins.allocate_reserved_bed') 16 16 17 17 #change = REQUEST.has_key("allocate_and_change") … … 73 73 if allocate or change: 74 74 if already and not change: 75 psm = "Student %s already reserved bed %s" % (sid, already[0].bed)75 psm = "Student %s has already reserved bed %s" % (sid, already[0].bed) 76 76 break 77 77 if not bed_brain.bed_type.endswith("reserved"): 78 psm = " Not a reserved bed: %s" % bid78 psm = "%s is not a reserved bed" % bid 79 79 break 80 80 if bed_brain.student and not change: … … 88 88 acco_doc = getattr(student_obj, acco_id).getContent() 89 89 if acco_doc.bed == bid: 90 psm = "Student %s has already booked ( paid) bed %s" % (sid, bid)90 psm = "Student %s has already booked (and paid) bed %s" % (sid, bid) 91 91 break 92 92 if not already: … … 94 94 break 95 95 if not bed_brain.bed_type.endswith("reserved"): 96 psm = " Not a reserved bed: %s" % bid96 psm = "%s is not a reserved bed" % bid 97 97 break 98 98 if not bed_brain.student: … … 118 118 acco_doc = getattr(student_obj, acco_id).getContent() 119 119 acco_doc.edit(mapping={'bed': bid}) 120 logger.info(' "%s","booked reserved bed %s for","%s"' % (member,bid,sid))120 logger.info('%s booked reserved bed %s for %s' % (member,bid,sid)) 121 121 psm = "Bed %s reserved for %s %s" % (bid,sid,student.name) 122 122 elif release: … … 130 130 if modify: 131 131 acco_cat.modifyRecord(bed=bid,student='') 132 logger.info(' "%s","cancelled reservation %s by","%s"' % (member,bid,sid))132 logger.info('%s released bed %s booked by %s' % (member,bid,sid)) 133 133 psm = "%s removed from %s" % (student.name,bid) 134 134 else: 135 psm = " %s removing failed from %s" % (student.name,bid)135 psm = "Removing of %s from bed %s failed" % (student.name,bid) 136 136 137 137 mode = 'view' -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py
r1452 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Accommodation.change_bed')15 logger = logging.getLogger('Skins.change_bed') 16 16 17 17 request = context.REQUEST … … 31 31 32 32 if student_id is not None: 33 logger.info(' "%s", "requests bed_change for", "%s"' % (member_id,student_id))33 logger.info('%s requests bed change for %s' % (member_id,student_id)) 34 34 info = context.getAccommodationInfo(student_id) 35 35 res = beds(student=student_id) 36 36 if len(res) == 0: 37 logger.info(' "%s", "no bed found"' % (student_id))38 re direct("%s/%s" % (students.absolute_url(),student_id))37 logger.info('No bed found for %s' % (student_id)) 38 return redirect("%s/%s" % (students.absolute_url(),student_id)) 39 39 allocated_bed = res[0] 40 40 status = info['student_status'] 41 41 student = student_id 42 42 if allocated_bed.bed_type == status: 43 logger.info(' "%s", "correct bed allocated","%s"' % (student_id,status))44 re direct("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))45 logger.info(' "%s", "change bed", "%s/%s"' % (student_id,allocated_bed.bed_type,status))43 logger.info('Status %s of %s has not changed' % (status,student_id)) 44 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 45 logger.info('Bed status %s of %s has changed to %s' % (allocated_bed.bed_type,student_id,status)) 46 46 beds.modifyRecord(bed=allocated_bed.bed,student='') 47 logger.info('Bed %s released' % (allocated_bed.bed)) 47 48 code,bed = beds.searchAndReserveBed(student_id,status) 48 49 if code > 0: … … 56 57 acco_doc = info['acco_doc'] 57 58 acco_doc.edit(mapping=d) 59 logger.info('Bed %s allocated to %s' % (bed,student_id)) 58 60 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 59 61 student_obj = getattr(students,student_id) … … 62 64 acco_doc = getattr(student_obj, acco_id).getContent() 63 65 if acco_doc.bed == bed: 64 acco_doc.edit(mapping={'bed':"-- cancelled by %s --" % member})65 logger.info(' "%s", "new bed allocation failed","%s"' % (student_id,code))66 logger.info(' "%s","cancelled booking of bed %s by %s"' % (member,bed,sid))66 acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"}) 67 logger.info('New bed allocation for %s failed, code = %s' % (student_id,code)) 68 logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id)) 67 69 redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 68 70 … … 95 97 d['acco_maint_fee'] = acco_info.get('maintenance_fee') 96 98 acco_doc.edit(mapping=d) 97 list.append(" Student %s new bed %s assigned code = %s" % (student,98 bed,99 list.append("New bed %s allocated to %s, code = %s" % (bed, 100 student, 99 101 code)) 100 102 return "\r".join(list) -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/getAccoHallInfo.py
r1445 r1593 59 59 d['student'] = st 60 60 d['student_url'] ='%s/%s' % (students_url,st) 61 bed = context. formatBed(sbrain.bed).split('/')61 bed = context.getFormattedBed(sbrain.bed).split('/') 62 62 d['bed'] = " / ".join(bed[1:]) 63 63 erg = context.students_catalog(id = st) -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/hall_delete.py
r805 r1593 1 ## Script (Python) " folder_delete"1 ## Script (Python) "hall_delete" 2 2 ##bind container=container 3 3 ##bind context=context … … 12 12 FIXME: add docstring. 13 13 """ 14 15 import logging 16 logger = logging.getLogger('Skins.hall_delete') 17 member_id = str(context.portal_membership.getAuthenticatedMember()) 14 18 15 19 from Products.CMFCore.utils import getToolByName … … 41 45 here.manage_delObjects(ids) 42 46 message = 'portal_status_message=hall(s) %s with %s beds deleted' % (" ".join(halls),len(urls)) 47 logger.info('%s deletes hall(s) %s with %s beds' % (member_id," ".join(halls),len(urls))) 43 48 else: 44 49 message = 'portal_status_message=psm_select_at_least_one_document' -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/release_bed.py
r1536 r1593 1 ## Script (Python) " change_bed"1 ## Script (Python) "release_bed" 2 2 ##bind container=container 3 3 ##bind context=context … … 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Accommodation.release_bed')15 logger = logging.getLogger('Skins.release_bed') 16 16 17 17 request = context.REQUEST … … 36 36 #set_trace() 37 37 if student_id is not None: 38 logger.info(' "%s", "requests bed_release for", "%s"' % (member_id,student_id))38 logger.info('%s requests bed_release for %s' % (member_id,student_id)) 39 39 res = acco_cat(student=student_id) 40 40 if len(res) == 0: 41 logger.info(' "%s", "no bed found"' % (student_id))41 logger.info('no bed of %s found' % (student_id)) 42 42 redirect("%s/%s" % (students.absolute_url(),student_id)) 43 43 allocated_bed = res[0] … … 45 45 acco_doc = context.getContent() 46 46 acco_doc.edit(mapping={'bed':"-- cancelled by section officer --"}) 47 logger.info(' "%s", "released bed of", "%s"' % (member_id,student_id))47 logger.info('%s released bed of %s' % (member_id,student_id)) 48 48 redirect("%s" % (context.absolute_url())) 49 49 -
WAeUP_SRP/branches/uli/skins/waeup_accommodation/reserve_accommodation.py
r1412 r1593 12 12 13 13 import logging 14 logger = logging.getLogger('S tudent.Accommodation.Reserve')14 logger = logging.getLogger('Skins.reserve_accommodation') 15 15 16 16 #if info is None: … … 19 19 if info is None: 20 20 member_id = str(context.portal_membership.getAuthenticatedMember()) 21 logger.info(' "%s","tried to reserve accommodation"' % (member_id))21 logger.info('%s tried to reserve accommodation' % (member_id)) 22 22 return context.REQUEST.RESPONSE.redirect("%s/srp_invalid_access" % context.portal_url()) 23 23 … … 55 55 if psm == 'invalid' or info['error'] is not None: 56 56 member_id = str(context.portal_membership.getAuthenticatedMember()) 57 logger.info(' "%s", %s' % (member_id,info['error'] ))57 logger.info('%s, %s' % (member_id,info['error'] )) 58 58 if psm == 'invalid': 59 59 psm = "Please correct your input." … … 94 94 ) 95 95 else: 96 bed = already[0].bed 96 bed = already[0].bed 97 97 student.invokeFactory('StudentAccommodation',acco_id) 98 98 acco = getattr(student,acco_id) -
WAeUP_SRP/branches/uli/skins/waeup_custom/logged_in.py
r1489 r1593 21 21 current = DateTime.DateTime() 22 22 import logging 23 logger = logging.getLogger(' Member.Login')23 logger = logging.getLogger('Skins.logged_in') 24 24 25 25 … … 71 71 student_per = getattr(student,'personal',None) 72 72 p_review_state = wftool.getInfoFor(student_per,'review_state',None) 73 logger.info(' "%s", "logged in", "review_state %s"' % (member,s_review_state))73 logger.info('%s logged in, review_state %s' % (member,s_review_state)) 74 74 app_doc = student_app.getContent() 75 75 #from Products.zdb import set_trace;set_trace() 76 76 if load_passport and 'passport' not in app_doc.objectIds(): 77 77 msg = context.waeup_tool.loadStudentFoto(student) 78 logger.info(' "%s", "%s"' % (member,msg))78 logger.info('%s, %s' % (member,msg)) 79 79 if s_review_state in ("student_created","admitted") and\ 80 80 a_review_state == 'created' : … … 134 134 redirect_url = "%s/student_index" % student.absolute_url() 135 135 else: 136 logger.info(' "%s", "logged in"' % (member))136 logger.info('%s logged in' % (member)) 137 137 redirect_url = portal.absolute_url() 138 138 #Anonymous -
WAeUP_SRP/branches/uli/skins/waeup_custom/logout.py
r1082 r1593 10 10 # notify the event service that the user has logged out 11 11 import logging 12 logger = logging.getLogger(' Member.Logout')12 logger = logging.getLogger('Skins.logout') 13 13 user = context.portal_membership.getAuthenticatedMember() 14 14 if user: … … 16 16 evtool = getPublicEventService(context) 17 17 evtool.notifyEvent('user_logout', user, {}) 18 logger.info(' "%s", "logged out"' % (user))18 logger.info('%s logged out' % (user)) 19 19 20 20 REQUEST = context.REQUEST -
WAeUP_SRP/branches/uli/skins/waeup_default/isCourseAdviser.py
r1515 r1593 1 ## Script (Python) "isC learanceOfficer"1 ## Script (Python) "isCourseAdviser" 2 2 ##bind container=container 3 3 ##bind context=context … … 9 9 ## 10 10 # $Id: isClearanceOfficer.py 1087 2006-12-18 22:13:31Z joachim $ 11 12 #from Products.zdb import set_trace13 #set_trace()14 11 if context.isStudent(): 15 12 return False -
WAeUP_SRP/branches/uli/skins/waeup_default/waeup_edit.py
r1456 r1593 17 17 from Products.CPSDocument.utils import getFormUidUrlArg 18 18 19 import logging 20 logger = logging.getLogger('Skins.waeup_edit') 21 22 mtool = context.portal_membership 23 member = mtool.getAuthenticatedMember() 24 19 25 # Check flexible controls 20 26 #context.editLayouts(REQUEST=REQUEST) … … 25 31 if context.portal_type == "StudentStudyCourse": 26 32 if len(context.objectIds()) > 0: 27 psm = 'Edit of Stud yCourse is only possible if there are no levels'33 psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!' 28 34 args = getFormUidUrlArg(REQUEST) 29 35 args['portal_status_message'] = psm … … 58 64 department = c_path[-3], 59 65 ) 66 logger.info('%s edited %s (%s) of %s' % (member,context.id,course,student_id)) 67 60 68 elif context.portal_type == "StudentApplication": 61 69 entry_mode = ds.get('entry_mode') … … 64 72 entry_mode = entry_mode, 65 73 ) 74 logger.info('%s edited %s of %s' % (member,context.id,student_id)) 66 75 elif context.portal_type == "StudentClearance": 67 76 matric_no = ds.get('matric_no') … … 70 79 matric_no = matric_no, 71 80 ) 81 logger.info('%s edited %s of %s' % (member,context.id,student_id)) 72 82 elif context.portal_type in ("StudentPersonal",): 73 83 name = "%(firstname)s %(middlename)s %(lastname)s" % ds … … 81 91 #if ds.get('sex'): 82 92 # jamb_sex = 'F' 83 # originally imported data must be kept; app_doc should not be changed here 93 # originally imported data must be kept; app_doc should not be changed here 84 94 #app_doc.edit(mapping={'jamb_lastname': name, 85 95 # 'jamb_sex': jamb_sex … … 91 101 sex = ds.get('sex'), 92 102 ) 103 logger.info('%s edited %s of %s' % (member,context.id,student_id)) 93 104 elif context.portal_type == "Course": 94 105 dd = {} -
WAeUP_SRP/branches/uli/skins/waeup_epayment/approve_epayment.py
r1427 r1593 1 ## Script (Python) " epayment_cb"1 ## Script (Python) "approve_epayment" 2 2 ##bind container=container 3 3 ##bind context=context … … 10 10 # $Id: aprove_epayment.py 1425 2007-02-15 17:52:01Z joachim $ 11 11 """ 12 payment callback13 12 """ 14 13 import logging 15 logger = logging.getLogger(' EPayment.Approve')14 logger = logging.getLogger('Skins.approve_epayment') 16 15 import DateTime 17 16 if context.portal_membership.isAnonymousUser(): … … 42 41 if doc.type_description.startswith('School Fee'): 43 42 wftool.doActionFor(student,'pay_school_fee') 44 logger.info(' "%s", "approved epayment for","%s""' % (member,student_id))43 logger.info('%s approves epayment for %s' % (member,student_id)) 45 44 wftool.doActionFor(context,'close') 46 45 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url()) -
WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py
r1367 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger(' EPayment.CallBack')15 logger = logging.getLogger('Skins.epayment_cb') 16 16 import DateTime 17 17 if context.portal_membership.isAnonymousUser(): … … 43 43 if resp == '00': 44 44 wftool.doActionFor(student,'pay_school_fee') 45 logger.info(' "%s", "received valid callback"' % student_id)45 logger.info('%s received valid callback' % student_id) 46 46 47 47 elif len(resp) < 3: 48 logger.info(' "%s", "received no callback"' % student_id)48 logger.info('%s received no callback' % student_id) 49 49 else: 50 logger.info(' "%s", "received unsuccessfull callback"' % student_id)50 logger.info('%s received unsuccessfull callback' % student_id) 51 51 wftool.doActionFor(context,'close') 52 52 -
WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py
r1431 r1593 1 ## Script (Python) "getPayments Info"1 ## Script (Python) "getPaymentsFolderInfo" 2 2 ##bind container=container 3 3 ##bind context=context … … 12 12 Info for the PaymentsFolder 13 13 """ 14 import logging 15 logger = logging.getLogger('EPayment.Info') 14 #import logging 15 #logger = logging.getLogger('Skins.getPaymentsFolderInfo') 16 16 17 import DateTime 17 18 request = context.REQUEST … … 57 58 row['confirmed'] = 'unsuccessful' 58 59 payments.append(row) 59 60 60 61 61 62 info['payments'] = payments -
WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_by_sc.py
r1390 r1593 14 14 import logging 15 15 from urllib import urlencode 16 logger = logging.getLogger(' EPayment.PayBySC')16 logger = logging.getLogger('Skins.pay_by_sc') 17 17 import DateTime 18 18 … … 85 85 wftool.doActionFor(payment,'close') 86 86 wftool.doActionFor(student,'pay_school_fee') 87 logger.info(' "%s", "paid school fee by scratch card"' % student_id)87 logger.info('%s paid school fee by scratch card' % student_id) 88 88 else: 89 logger.info(' "%s", "repeatedly paid school fee by scratch card"' % student_id)89 logger.info('%s repeatedly paid school fee by scratch card' % student_id) 90 90 url = "%s/payments" % (student.absolute_url()) 91 91 request.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py
r1365 r1593 14 14 from urllib import urlencode 15 15 import logging 16 logger = logging.getLogger(' EPayment.PayOnline')16 logger = logging.getLogger('Skins.pay_online') 17 17 import DateTime 18 18 … … 91 91 info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id) 92 92 93 logger.info(' "%(student_id)s","%(type_description)s", "%(amount)s N"' % info)93 logger.info('%(student_id)s initiated online school fee payment' % info) 94 94 payment_fields = (('x_SiteID','site_id'), 95 95 ('x_Redirect_url','callback_url'), -
WAeUP_SRP/branches/uli/skins/waeup_epayment/simulate_callback.py
r1427 r1593 5 5 return html renderer + psm 6 6 """ 7 import DateTime ,logging7 import DateTime 8 8 current = DateTime.DateTime() 9 9 pr = context.portal_registration 10 logger = logging.getLogger('EPayment.Simulate')11 10 validate = REQUEST.has_key("cpsdocument_edit_button") 11 12 import logging 13 logger = logging.getLogger('Skins.simulate_callback') 12 14 13 15 args = {} … … 18 20 args['x_ApprAmt'] = REQUEST.get('x_amt') 19 21 22 23 student_id = context.getStudentId() 24 logger.info('%s received simulated callback' % student_id) 25 20 26 from urllib import urlencode 21 27 #url = "%s/epayment_cb/?%s" % (context.absolute_url(),urlencode(args)) -
WAeUP_SRP/branches/uli/skins/waeup_pins/disable_pins.py
r1540 r1593 15 15 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 16 16 import logging 17 logger = logging.getLogger(' Pin.Disable')17 logger = logging.getLogger('Skins.disable_pins') 18 18 19 19 request = REQUEST … … 39 39 } 40 40 pincat.modifyRecord(**dict) 41 logger.info(' "%s","disabled pin","%s"' % (member,uid))41 logger.info('%s disabled pin %s' % (member,uid)) 42 42 return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url()) -
WAeUP_SRP/branches/uli/skins/waeup_pins/enable_pins.py
r1082 r1593 15 15 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 16 16 import logging 17 logger = logging.getLogger(' Pin.Enable')17 logger = logging.getLogger('Skins.enable_pins') 18 18 19 19 request = REQUEST … … 42 42 } 43 43 pincat.modifyRecord(**dict) 44 logger.info(' "%s","enabled pin","%s"' % (member,pid))44 logger.info('%s enabled pin %s' % (member,uid)) 45 45 return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url()) -
WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py
r1520 r1593 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= 7 ##parameters=REQUEST=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 add a StudentCourseResult object 13 13 """ 14 15 import logging 16 logger = logging.getLogger('Skins.add_course_result') 17 14 18 from urllib import urlencode 15 19 try: … … 23 27 aq_portal = context.portal_catalog.evalAdvancedQuery 24 28 course_id = request.get('course_id') 29 30 mtool = context.portal_membership 31 member = mtool.getAuthenticatedMember() 32 33 25 34 d = context.getCourseInfo(course_id) 26 35 args = {} … … 28 37 while True: 29 38 if d['title'] == 'unknown': 30 err = "No such course" 39 err = "No such course!" 40 logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id)) 31 41 break 32 42 if context.hasObject(course_id): 33 err = "Course already exists" 43 err = "Course already exists!" 44 logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id)) 34 45 break 35 46 if context.hasObject("%s_co" % course_id): 36 err = "Course already exists as carryover course" 47 err = "Course already exists as carryover course!" 48 logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id)) 37 49 break 38 50 break … … 40 52 if err: 41 53 args['course_id'] = course_id 42 args['error'] = err 54 #args['error'] = err 55 args['portal_status_message'] = err 43 56 url = "%s?%s" % (context.absolute_url(),urlencode(args)) 44 57 return request.RESPONSE.redirect(url) 58 59 45 60 cr_id = context.invokeFactory('StudentCourseResult',course_id) 46 61 #set_trace() … … 50 65 context.portal_workflow.doActionFor(cr,'close') 51 66 args['course_id'] = course_id 52 from urllib import urlencode53 url = "%s?%s" % (context.absolute_url(),urlencode(args))54 return request.RESPONSE.redirect(url)55 67 68 logger.info('%s added StudentCourseResult object %s' % (member,course_id)) 69 70 args = {} 71 psm = "You successfully added course %s!" % course_id 72 args['portal_status_message'] = psm 73 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 74 return REQUEST.RESPONSE.redirect(url) 75 -
WAeUP_SRP/branches/uli/skins/waeup_student/add_student.py
r1422 r1593 13 13 acco_cat = context.portal_accommodation 14 14 import logging 15 logger = logging.getLogger('S tudent.Add')15 logger = logging.getLogger('Skins.add_student') 16 16 17 17 validate = REQUEST.has_key("cpsdocument_edit_button") and\ … … 67 67 student_rec = context.getFormattedStudentEntry(context.students_catalog(id = sid)[0]) 68 68 psm = "Student record with Id %s and Password %s has been created." % (sid,password) 69 logger.info(' "%s","created student","%s"' % (member,sid))69 logger.info('%s created student %s' % (member,sid)) 70 70 return context.add_student_form(rendered = rendered, 71 71 #psm = "%s, %s" % (psm,ds), -
WAeUP_SRP/branches/uli/skins/waeup_student/application_edit.py
r1343 r1593 16 16 current = DateTime.DateTime() 17 17 import logging 18 logger = logging.getLogger('S tudent.Application.Edit')18 logger = logging.getLogger('Skins.application_edit') 19 19 20 20 # Until ajax posts directly to its own script... … … 30 30 31 31 if info is None: 32 logger.info(' "anonymous access","%s"' % REQUEST.get('URL0'))32 logger.info('Anonymous user tried to access %s"' % REQUEST.get('URL0')) 33 33 return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 34 34 … … 56 56 elif cpsdocument_edit_and_view_button: 57 57 if 1: ## app_doc.passport is not None: 58 logger.info(' "%s", "proceeded to start clearance"' % (info['id']))58 logger.info('%s proceeded to start clearance' % (info['id'])) 59 59 action = "/start_clearance" 60 60 base_url = student.absolute_url() -
WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py
r1527 r1593 14 14 current = DateTime.DateTime() 15 15 #pr = context.portal_registration 16 logger = logging.getLogger('S tudent.change_password')16 logger = logging.getLogger('Skins.change_password') 17 17 validate = request.has_key("change_password") 18 18 students_dir = context.portal_directories.students … … 24 24 requested_id = context.getStudentId() 25 25 if requested_id and not context.isStaff() and member_id != requested_id: 26 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))26 logger.info('%s tried to access %s' % (member_id,requested_id)) 27 27 return None 28 28 elif context.isStaff(): … … 74 74 args['__ac_name'] = student_id 75 75 args['__ac_password'] = password 76 logger.info('%s changed password from %s to %s' % (member_id,old_password,password)) 76 77 from urllib import urlencode 77 78 url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args)) -
WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py
r1217 r1593 16 16 current = DateTime.DateTime() 17 17 import logging 18 logger = logging.getLogger('S tudent.Clearance.Edit')18 logger = logging.getLogger('Skins.clearance_edit') 19 19 request = REQUEST 20 20 … … 70 70 if cpsdocument_edit_button or result_edit_button: 71 71 psm = "Content changed!" 72 logger.info(' "%s","edited clearance of","%s"' % (member_id,student_id ))72 logger.info('%s edited clearance of %s' % (member_id,student_id )) 73 73 if clear_doc.clr_ac_pin == "": 74 74 res = context.portal_pins(student=member_id) … … 92 92 missing = True 93 93 if missing: 94 logger.info(' "%s","requested clearance with documents missing"' % (student_id))94 logger.info('%s requested clearance with documents missing' % (student_id)) 95 95 psm = "You have not uploaded all necessary documents to request clearance!" 96 96 else: 97 logger.info(' "%s","requested clearance"' % (student_id))97 logger.info('%s requested clearance' % (student_id)) 98 98 info['clear_doc'].edit(mapping = {'request_date': current,}) 99 99 wftool.doActionFor(info['clear'],'close') … … 103 103 action = "/clearance_view" 104 104 elif acknowledge and info['review_state'] != "clearance_pin_entered": 105 logger.info(' "%s","repeatedly requested clearance"' % (student_id))105 logger.info('%s repeatedly requested clearance' % (student_id)) 106 106 psm = "You have already requested clearance!" 107 107 else: 108 108 psm = "You must tick the acknowledgement check box before submission!" 109 109 elif clear_and_validate_button and info['review_state'] == "clearance_requested": 110 logger.info(' "%s","cleared","%s"' % (member_id,student_id ))110 logger.info('%s cleared %s' % (member_id,student_id )) 111 111 #from Products.zdb import set_trace 112 112 #set_trace() … … 117 117 psm = "This student is already cleared!" 118 118 elif reject_clearance_button: 119 logger.info(' "%s","rejected clearance for","%s"' % (member_id,student_id ))119 logger.info('%s rejected clearance for %s' % (member_id,student_id )) 120 120 wftool.doActionFor(info['clear'],'open') 121 121 wftool.doActionFor(info['student'],'reject_clearance') 122 122 action = "/contact_student_form" 123 123 psm = "Student's clearance request has been rejected! Please fill and submit the form below!" 124 subject = "Clearance request rejected" 125 args['subject'] = subject 126 args['continue'] = 'external_clearance_edit_form' 124 127 else: 125 128 psm = "Please correct your errors!" … … 128 131 args['portal_status_message'] = psm 129 132 url = clear.absolute_url() + action + '?' + urlencode(args) 130 REQUEST.RESPONSE.redirect(url)133 return REQUEST.RESPONSE.redirect(url) 131 134 -
WAeUP_SRP/branches/uli/skins/waeup_student/clearance_slip.pt
r1156 r1593 1 <metal: html tal:define="info context/getClearanceInfo">2 <metal:body use-macro="here/main_template/macros/master">3 <metal:main fill-slot="main">1 <metal:body use-macro="here/main_template/macros/master"> 2 <metal:main fill-slot="main" 3 tal:define="info context/getClearanceInfo"> 4 4 <span tal:condition="not: info"> 5 5 <span tal:content="here/illegal_view" /> … … 66 66 </span> 67 67 </metal:main> 68 </metal:body> 69 </metal:html> 68 </metal:body> -
WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt
r1455 r1593 1 <metal:block define-macro="contact_student_form"> 1 2 <metal:body use-macro="here/main_template/macros/master"> 2 3 <metal:main fill-slot="main" 3 4 tal:define="member python:context.portal_membership.getAuthenticatedMember(); 4 5 info context/getStudentBaseInfo; 6 subject python:context.REQUEST.get('subject'); 7 continue python:context.REQUEST.get('continue') 5 8 "> 6 9 <span tal:condition="not: info"> … … 8 11 </span> 9 12 10 <span tal:condition=" info">13 <span tal:condition="python: info and subject"> 11 14 <h3>Contact Student</h3> 12 15 <br /> … … 23 26 <input type="hidden" name="student_email" type="text" id="student_email" 24 27 tal:attributes="value info/student/email"/> 25 28 <input type="hidden" name="probtype" type="text" id="probtype" 29 tal:attributes="value subject"/> 30 26 31 <table width="100%" border="0" cellspacing="5" cellpadding="0"> 27 32 <tr> … … 42 47 </tr> 43 48 <tr> 44 <td >45 <strong> Type of Rejection: </strong>49 <td valign="top"> 50 <strong>Reason of Notification: </strong> 46 51 </td> 47 <td> 48 <select name="probtype" class="boxgreen" id="probtype"> 49 <option>Clearance request rejected</option> 50 </select> 52 <td valign="bottom"> 53 <span tal:content="subject" /> 51 54 </td> 52 55 </tr> … … 67 70 </span> 68 71 <form action="." method="post" class="group"> 69 <input type="submit" name="external_clearance_edit_form:method" 72 <input type="submit" name="." 73 tal:attributes="name string:${continue}:method" 70 74 class="context" value="Continue" /> 71 75 </form> … … 73 77 </metal:main> 74 78 </metal:body> 79 </metal:block> -
WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt
r1516 r1593 1 <metal:html tal:define="info context/getStudyLevelInfo; 1 <metal:body use-macro="here/main_template/macros/master"> 2 <metal:main fill-slot="main" 3 tal:define="info context/getStudyLevelInfo; 2 4 is_so context/isSectionOfficer; 3 5 is_ca info/is_ca; 4 6 show_check_boxes info/show_check_boxes; 5 is_student info/is_student; 6 status_info info/status_info; 7 review_state info/review_state; 8 view_only info/view_only"> 9 <metal:body use-macro="here/main_template/macros/master"> 10 <metal:main fill-slot="main"> 7 validated python:context.getStudentReviewState() in ('courses_validated',); 8 is_student info/is_student; 9 status_info info/status_info; 10 review_state info/review_state; 11 view_only info/view_only"> 11 12 <span tal:condition="not: info"> 12 13 <span tal:content="here/illegal_view" /> … … 14 15 <span tal:condition="info"> 15 16 <h3>Course Registration Slip</h3> 17 16 18 <br /> 17 <table width="" cellpadding="2" cellspacing="0"> 19 20 <div tal:condition="validated"> 21 - validated by Course Adviser - 22 </div> 23 <div tal:condition="not: validated"> 24 - not yet validated by Course Adviser - 25 </div> 26 27 <br /> 28 <span tal:omit-tag="" 29 tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'], 30 layout_mode='view_info', 31 layout_id='student_application_fe')" 32 /> 33 34 <table cellpadding="2" cellspacing="0"> 18 35 <tr> 19 <td valign="top"><span class="dlabel">Name</span>: 20 </td> 21 <td> 22 <span tal:content="info/student/name" /> 23 </td> 24 </tr> 25 <tr> 26 <td valign="top"><span class="dlabel">Student Id</span>: 27 </td> 28 <td> 29 <span tal:content="info/student/id" /> 30 </td> 31 </tr> 32 <tr> 33 <td valign="top"><span class="dlabel">Matriculation No</span>: 34 </td> 35 <td> 36 <span tal:content="info/student/matric_no" /> 37 </td> 38 </tr> 39 <tr> 40 <td valign="top"><span class="dlabel">Faculty Id</span>: 36 <td valign="top" width="180px"><span class="dlabel">Faculty Id</span>: 41 37 </td> 42 38 <td> … … 111 107 </span> 112 108 </metal:main> 113 </metal:body> 114 </metal:html> 109 </metal:body> 115 110 -
WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py
r1513 r1593 21 21 response = request.RESPONSE 22 22 redirect = response.redirect 23 logger = logging.getLogger('S tudent.create_level')23 logger = logging.getLogger('Skins.create_level') 24 24 mtool = context.portal_membership 25 25 member = mtool.getAuthenticatedMember() … … 30 30 cert_id = student.course 31 31 current_level = student.level 32 in_progress = session.get('in_progress','finished') 33 if in_progress == 'finished': 32 in_progress = request.get('in_progress','not started') 33 34 if context.hasObject(current_level): 35 response.redirect("%s/%s" % (context.absolute_url(),current_level)) 36 return 37 38 if in_progress in ('not started','started'): 34 39 session.set('in_progress','started') 35 view = context.in_progress_view(refresh=3,page=' %s/study_level_view' % current_level)40 view = context.in_progress_view(refresh=3,page='create_level?in_progress=started') 36 41 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 37 42 response.setHeader('Content-length','%d' % (len(view))) … … 39 44 response.write(view) 40 45 response.write('') 41 elif in_progress == 'started': 42 return 46 if in_progress == 'started': 47 return 48 49 43 50 context.invokeFactory('StudentStudyLevel',"%s" % current_level) 44 51 level = getattr(context,"%s" % current_level) … … 57 64 c_res = aq_courses(query) 58 65 if not c_res: 59 logger.info(' "%s","%s course not found in courses catalog"' % (student.id,co.CosCode))66 logger.info('%s", course %s not found in courses_catalog' % (student.id,co.CosCode)) 60 67 continue 61 68 course_cat_entry = c_res[0] … … 67 74 score = int(co.Score) 68 75 except: 69 logger.info(' "%s"," course %s invalid score %s"' % (student.id,76 logger.info('%s, course %s has invalid score %s"' % (student.id, 70 77 co.CosCode, 71 78 co.Score)) 72 79 continue 73 if int(c_res[0].passmark) <= score: 80 if int(c_res[0].passmark) <= score: 74 81 continue 75 82 carry_over = True … … 99 106 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 100 107 course_result.getContent().edit(mapping=d) 101 session.set('in_progress','finished')102 108 return 103 return response.redirect("%s" % level.absolute_url()) -
WAeUP_SRP/branches/uli/skins/waeup_student/getAccommodationInfo.py
r1474 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Accommodation.Info')15 logger = logging.getLogger('Skins.getAccommodationInfo') 16 16 import DateTime 17 17 … … 29 29 requested_id = context.getStudentId() 30 30 if requested_id and not context.isStaff() and member_id != requested_id: 31 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))31 logger.info('%s tried to access %s' % (member_id,requested_id)) 32 32 return None 33 33 elif context.isStaff(): … … 37 37 res = context.students_catalog(id=student_id) 38 38 if len(res) != 1: 39 logger.info(' "%s","not found in students_catalog"')39 logger.info('%s not found in students_catalog' % student_id) 40 40 return None 41 41 -
WAeUP_SRP/branches/uli/skins/waeup_student/getApplicationInfo.py
r1435 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Application.Info')15 logger = logging.getLogger('Skins.getApplicationInfo') 16 16 17 17 request = context.REQUEST … … 28 28 requested_id = context.getStudentId() 29 29 if requested_id and not context.isStaff() and member_id != requested_id: 30 logger.info(' "%s", "accessed application object of", "%s"' % (member_id,requested_id))30 logger.info('%s tried to access application object of %s' % (member_id,requested_id)) 31 31 student_id = requested_id 32 return None 32 33 elif context.isStaff(): 33 34 student_id = requested_id -
WAeUP_SRP/branches/uli/skins/waeup_student/getClearanceInfo.py
r1162 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Clearance.Info')15 logger = logging.getLogger('Skins.getClearanceInfo') 16 16 from DateTime import DateTime 17 17 … … 30 30 requested_id = context.getStudentId() 31 31 if requested_id and not context.isStaff() and member_id != requested_id: 32 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))32 logger.info('%s tried to access %s' % (member_id,requested_id)) 33 33 return None 34 34 elif context.isStaff(): -
WAeUP_SRP/branches/uli/skins/waeup_student/getMemberInfo.py
r1541 r1593 28 28 requested_id = context.getStudentId() 29 29 if requested_id and not context.isStaff() and member_id != requested_id: 30 logger.info(' "%s", "accessed personal object of", "%s"' % (member_id,requested_id))30 logger.info('%s tried to access personal object of %s' % (member_id,requested_id)) 31 31 student_id = requested_id 32 return None 32 33 elif context.isStaff(): 33 34 student_id = requested_id -
WAeUP_SRP/branches/uli/skins/waeup_student/getNewStudentStatistics.py
r1530 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Statistics')15 logger = logging.getLogger('Skins.getNewStudentStatistics') 16 16 17 17 try: … … 21 21 except: 22 22 evalAdvancedQuery = None 23 logger.info(' "%s","invoked new statistics"' % context.portal_membership.getAuthenticatedMember())23 logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) 24 24 l = [] 25 25 if not context.isStaff(): … … 108 108 if total: 109 109 dep['cleared_and_validated_percent'] = "%.0f" % round(cav*100/total) 110 110 111 111 ora = len([s for s in fac_ids if s in or_ids]) 112 112 dep['objection_raised'] = ora -
WAeUP_SRP/branches/uli/skins/waeup_student/getPersonalInfo.py
r1203 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Personal.Info')15 logger = logging.getLogger('Skins.getPersonalInfo') 16 16 17 17 request = context.REQUEST … … 28 28 requested_id = context.getStudentId() 29 29 if requested_id and not context.isStaff() and member_id != requested_id: 30 logger.info(' "%s", "accessed personal object of", "%s"' % (member_id,requested_id))30 logger.info('%s tried to access personal object of %s' % (member_id,requested_id)) 31 31 student_id = requested_id 32 return None 32 33 elif context.isStaff(): 33 34 student_id = requested_id -
WAeUP_SRP/branches/uli/skins/waeup_student/getRegStatistics.py
r1530 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Statistics')15 logger = logging.getLogger('Skins.getRegStatistics') 16 16 17 17 try: … … 21 21 except: 22 22 evalAdvancedQuery = None 23 logger.info(' "%s","invoked reg statistics"' % context.portal_membership.getAuthenticatedMember())23 logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) 24 24 l = [] 25 25 if not context.isStaff(): … … 81 81 if total: 82 82 dep['courses_registered_percent'] = "%.0f" % round(creg*100/total) 83 83 84 84 cval = len([s for s in fac_ids if s in cval_ids]) 85 85 dep['courses_validated'] = cval -
WAeUP_SRP/branches/uli/skins/waeup_student/getRetStudentStatistics.py
r1536 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Statistics')15 logger = logging.getLogger('Skins.getRetStudentStatistics') 16 16 17 17 try: … … 21 21 except: 22 22 evalAdvancedQuery = None 23 logger.info(' "%s","invoked returning statistics"' % context.portal_membership.getAuthenticatedMember())23 logger.info('%s invoked statistics' % context.portal_membership.getAuthenticatedMember()) 24 24 l = [] 25 25 if not context.isStaff(): 26 26 return l 27 27 dep = {} 28 sum = 029 28 dep['id'] = "All Faculties" 30 29 31 #from Products.zdb import set_trace;set_trace()32 30 33 ret_res = context.portal_catalog(review_state ='returning') 34 ret_ids = [r.getId for r in ret_res] 35 ret = len(ret_res) 36 dep['total'] = ret 31 ret_res1 = context.portal_catalog(review_state = 'returning') 32 ret_ids1 = [r.getId for r in ret_res1] 33 total_ret = len(ret_ids1) 34 35 ret_res2 = context.portal_catalog(review_state = ('school_fee_paid','courses_registered','courses_validated',)) 36 ret_ids2 = [r.getId for r in ret_res2] 37 38 retquery = Ge('level','300') | (Eq('level','200') & Eq('entry_mode','UME')) 39 ret_res3 = aq_students(retquery) 40 ret_ids3 = [r.id for r in ret_res3] 37 41 38 42 l.append(dep) 43 sum_ret = 0 44 sum_sfp = 0 39 45 fs = context.portal_catalog(portal_type="Faculty") 40 46 for fid in [f.getId for f in fs]: … … 45 51 stud_ids = [r.id for r in stud_res] 46 52 total = float(len(stud_res)) 47 48 53 if total == 0: 49 54 continue 50 51 ret = len([s for s in stud_ids if s in ret_ids]) 52 dep['returned'] = ret 53 sum += ret 54 55 if ret == 0: 56 continue 55 sfp = len([s for s in stud_ids if s in ret_ids2 and s in ret_ids3]) 56 dep['sfp'] = sfp 57 ret = len([s for s in stud_ids if s in ret_ids1]) 58 dep['ret'] = ret 59 sum_ret += ret 60 sum_sfp += sfp 57 61 58 62 l.append(dep) 59 63 60 l[0]['sum'] = sum 64 l[0]['ret'] = sum_ret 65 l[0]['sfp'] = sum_sfp 66 l[0]['total_ret'] = total_ret + sum_sfp 67 l[0]['total_li'] = sum_ret + sum_sfp 68 61 69 62 70 return l -
WAeUP_SRP/branches/uli/skins/waeup_student/getSchoolFeePrefix.py
r1364 r1593 1 ## Script (Python) "get MaintenancePrefix"1 ## Script (Python) "getSchoolFeePrefix" 2 2 ##bind container=container 3 3 ##bind context=context … … 16 16 return None 17 17 18 import logging 19 logger = logging.getLogger(' EPayment.getSchoolFeePrefix')18 import logging 19 logger = logging.getLogger('Skins.getSchoolFeePrefix') 20 20 21 21 student_id = context.getStudentId() … … 24 24 id = sbrain.course) 25 25 if not res: 26 logger.info(' "%s","certificate not found", "%s"' % (student_id,course))26 logger.info('%s, certificate %s not found' % (student_id,course)) 27 27 prefix = "--" 28 28 else: -
WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py
r1524 r1593 27 27 if requested_id and not context.isStaff() and member_id != requested_id: 28 28 import logging 29 logger = logging.getLogger('S tudent.SessionResults.Info')30 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))29 logger = logging.getLogger('Skins.getSessionResults') 30 logger.info('%s tried to access %s' % (member_id,requested_id)) 31 31 return None 32 32 elif context.isStaff(): … … 99 99 gpa = "%4.2f" % gpa 100 100 101 101 #set_trace() 102 102 verdict_voc = context.portal_vocabularies.verdicts 103 if verdict_voc.has_key(student_from_cat.verdict): 104 info['verdict'] = verdict = verdict_voc.get(student_from_cat.verdict).upper() 103 verdict_code = student_from_cat.get('verdict',None) 104 if verdict_code: 105 info['verdict'] = verdict = verdict_voc.get(verdict_code,'N/A').upper() 105 106 else: 106 info['verdict'] = 'N/A'107 info['verdict'] = verdict = 'N/A' 107 108 108 109 if student_from_cat.level: -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudentBaseInfo.py
r1369 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Base.Info')15 logger = logging.getLogger('Skins.getStudentBaseInfo') 16 16 from DateTime import DateTime 17 17 … … 29 29 requested_id = context.getStudentId() 30 30 if requested_id and not context.isStaff() and member_id != requested_id: 31 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))31 logger.info('%s tried to access %s' % (member_id,requested_id)) 32 32 return None 33 33 elif context.isStaff(): -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudentFolderInfo.py
r1472 r1593 1 ## Script (Python) "getStudent Info"1 ## Script (Python) "getStudentFolderInfo" 2 2 ##bind container=container 3 3 ##bind context=context … … 21 21 22 22 import logging 23 logger = logging.getLogger('S tudent.Info')23 logger = logging.getLogger('Skins.getStudentFolderInfo') 24 24 25 25 … … 38 38 break 39 39 if member_id != requested_id: 40 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))40 logger.info('%s tried to access %s' % (member_id,requested_id)) 41 41 student_id = member_id 42 42 mtool.assertViewable(context) -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudentInfo.py
r1286 r1593 21 21 22 22 import logging 23 logger = logging.getLogger('S tudent.Info')23 logger = logging.getLogger('Skins.getStudentInfo') 24 24 25 25 … … 42 42 break 43 43 if member_id != requested_id: 44 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))44 logger.info('%s tried to access %s' % (member_id,requested_id)) 45 45 student_id = member_id 46 46 mtool.assertViewable(context) -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py
r1537 r1593 52 52 levels = context.objectIds() 53 53 review_state = wftool.getInfoFor(context,'review_state',None) 54 if review_state != 'content_addable': 54 student_review_state = context.getStudentReviewState() 55 if review_state != 'content_addable' and student_review_state == 'school_fee_paid': #and context.isStudent(): 55 56 wftool.doActionFor(context,'close_for_edit') 56 student_review_state = context.getStudentReviewState()57 57 may_register = (student_review_state in ('school_fee_paid',)) and\ 58 58 current_level not in levels and\ 59 59 (sbrain.verdict in ('A','B') or sbrain.jamb_reg_no.startswith('6')) 60 60 61 61 levels.sort() 62 62 info['create_level'] = None … … 72 72 info['items'] = items 73 73 74 try: 74 try: 75 75 info['verdict'] = context.portal_vocabularies.verdicts.get(info['doc'].current_verdict).upper() 76 76 except: 77 info['verdict'] = course.current_verdict 77 info['verdict'] = course.current_verdict 78 78 79 79 return info -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py
r1515 r1593 61 61 info['review_state'] = review_state = context.getStudentReviewState() 62 62 info['view_only'] = review_state != "school_fee_paid" 63 info['show_check_boxes'] = (is_ca and review_state in (' courses_registered',)) or\63 info['show_check_boxes'] = (is_ca and review_state in ('school_fee_paid',)) or\ 64 64 (is_student and context.getStudentReviewState() == "school_fee_paid") or\ 65 65 (is_so) … … 108 108 normal.sort(cmp_semester) 109 109 info['normal'] = normal 110 111 students_object = context.portal_url.getPortalObject().campus.students 112 student = getattr(students_object, student_id) 113 info['app'] = student.application 114 info['app_doc'] = student.application.getContent() 115 110 116 return info -
WAeUP_SRP/branches/uli/skins/waeup_student/getTransferInfo.py
r1368 r1593 1 ## Script (Python) "get ClearanceInfo"1 ## Script (Python) "getTransferInfo" 2 2 ##bind container=container 3 3 ##bind context=context … … 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Transfer.Info')15 logger = logging.getLogger('Skins.getTransferInfo') 16 16 from DateTime import DateTime 17 17 … … 29 29 requested_id = context.getStudentId() 30 30 if requested_id and not context.isStaff() and member_id != requested_id: 31 logger.info(' "%s", "tried to access", "%s"' % (member_id,requested_id))31 logger.info('%s tried to access %s' % (member_id,requested_id)) 32 32 return None 33 33 elif context.isStaff(): -
WAeUP_SRP/branches/uli/skins/waeup_student/get_searchable_student_states.py
r1033 r1593 23 23 return [item for item in voc.items() if item[0].startswith('clear') or 24 24 item[0] in ("all",)] 25 elif "CourseAdvisers" in member.getGroups(): 26 return [item for item in voc.items() if item[0].startswith('courses') or 27 item[0] in ("all",)] 25 28 return voc.items() 26 29 -
WAeUP_SRP/branches/uli/skins/waeup_student/layout_application_view_info.pt
r1435 r1593 5 5 dm options/datastructure/getDataModel; 6 6 widgets python:context.getRenderedWidgets(layout); 7 fields python:('jamb_reg_no','app_email','app_mobile')"7 info context/getStudentBaseInfo;" 8 8 > 9 9 … … 20 20 </td> 21 21 <td> 22 <span tal:content=" python:context.getStudentBaseInfo()['student']['name']" />22 <span tal:content="info/student/name" /> 23 23 </td> 24 24 </tr> … … 27 27 </td> 28 28 <td> 29 <span tal:content=" python:context.getStudentBaseInfo()['student']['sex']" />29 <span tal:content="info/student/sex" /> 30 30 </td> 31 31 </tr> … … 34 34 </td> 35 35 <td> 36 <span tal:content=" python:context.getStudentBaseInfo()['id']" />36 <span tal:content="info/id" /> 37 37 </td> 38 38 </tr> 39 40 <tr tal:repeat="field fields"> 41 <tal:block tal:define="cell python: widgets[field]"> 42 <tal:block define="widget cell/widget"> 43 <div tal:attributes="class cell/widget_css_class|string:label; 44 id python:widget.getHtmlWidgetId()+'_widget';" 45 > 46 <td > 47 <span class="dlabel" 48 tal:condition="widget/label" 49 tal:content="widget/label">label</span>: 50 </td> 51 <td> 52 <span tal:replace="structure cell/widget_rendered" /> 53 </td> 54 </div> 55 </tal:block> 56 </tal:block> 57 </tr> 39 <tr valign="top"> 40 <td><span class="dlabel">Matriculation No</span>: 41 </td> 42 <td> 43 <span tal:content="info/student/matric_no" /> 44 </td> 45 </tr> 46 <tr valign="top"> 47 <td><span class="dlabel">JAMB Registration No</span>: 48 </td> 49 <td> 50 <span tal:content="info/student/jamb_reg_no" /> 51 </td> 52 </tr> 53 <tr valign="top"> 54 <td><span class="dlabel">Email</span>: 55 </td> 56 <td> 57 <span tal:content="info/student/email" /> 58 </td> 59 </tr> 60 <tr valign="top"> 61 <td><span class="dlabel">Phone</span>: 62 </td> 63 <td> 64 <span tal:content="info/student/phone" /> 65 </td> 66 </tr> 67 <tr valign="top"> 68 <td><span class="dlabel">Level</span>: 69 </td> 70 <td> 71 <span tal:content="info/student/level" /> 72 </td> 73 </tr> 58 74 </table> 59 75 -
WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py
r909 r1593 37 37 co_name, 38 38 co_email, 39 student_email, 39 student_email, 40 40 co_email, 41 41 'henrik@waeup.org', -
WAeUP_SRP/branches/uli/skins/waeup_student/personal_edit.py
r1457 r1593 16 16 current = DateTime.DateTime() 17 17 import logging 18 logger = logging.getLogger('S tudent.Personal.Edit')18 logger = logging.getLogger('Skins.personal_edit') 19 19 20 20 info = context.getPersonalInfo() 21 21 22 22 if info is None: 23 logger.info(' "anonymous access","%s"' % REQUEST.get('URL0'))23 logger.info('Anonymous user tried to access %s' % REQUEST.get('URL0')) 24 24 return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 25 25 … … 53 53 sex = ds.get('sex'), 54 54 ) 55 logger.info(' "%s", "edited personal data"' % (info['id']))55 logger.info('%s edited personal data' % (info['id'])) 56 56 #action = "" 57 57 #base_url = student.absolute_url() -
WAeUP_SRP/branches/uli/skins/waeup_student/raise_objection.py
r1161 r1593 14 14 import DateTime 15 15 import logging 16 logger = logging.getLogger('S tudent.Objection')16 logger = logging.getLogger('Skins.raise_objection') 17 17 18 18 wf = context.portal_workflow 19 19 info = context.getApplicationInfo() 20 20 if not info: 21 logger.info(' "%s", "tried to access", "%s"' % (context.portal_membership.getAuthenticatedMember(),context.getStudentId()))21 logger.info('%s tried to access %s' % (context.portal_membership.getAuthenticatedMember(),context.getStudentId())) 22 22 return context.admission_form() 23 23 current = DateTime.DateTime() -
WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py
r1510 r1593 1 ##parameters= 1 ## Script (Python) "refresh_level" 2 ##bind container=container 3 ##bind context=context 4 ##bind namespace= 5 ##bind script=script 6 ##bind subpath=traverse_subpath 7 ##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None 2 8 # $Id$ 3 9 """ … … 16 22 aq_courses = context.courses_catalog.evalAdvancedQuery 17 23 24 import logging 25 logger = logging.getLogger('Skins.refresh_level') 26 27 from urllib import urlencode 28 18 29 current = DateTime.DateTime() 19 30 request = context.REQUEST … … 21 32 response = request.RESPONSE 22 33 redirect = response.redirect 23 logger = logging.getLogger('S tudent.create_level')34 logger = logging.getLogger('Skins.refresh_level') 24 35 mtool = context.portal_membership 25 36 member = mtool.getAuthenticatedMember() … … 32 43 if in_progress == 'finished': 33 44 session.set('in_progress','started') 34 view = context.in_progress_view(refresh=3,page= 'study_level_view')45 view = context.in_progress_view(refresh=3,page=action_after_validate) 35 46 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 36 47 response.setHeader('Content-length','%d' % (len(view))) … … 51 62 c_res = aq_courses(query) 52 63 if not c_res: 53 logger.info(' "%s","%s course not found in courses catalog"' % (student.id,co.CosCode))64 logger.info('%s, course %s not found in courses_catalog' % (student.id,co.CosCode)) 54 65 continue 55 66 course_cat_entry = c_res[0] … … 60 71 score = int(co.Score) 61 72 except: 62 logger.info(' "%s"," course %s invalid score %s"' % (student.id,73 logger.info('%s, course %s has invalid score %s' % (student.id, 63 74 co.CosCode, 64 75 co.Score)) 65 76 continue 66 if int(c_res[0].passmark) <= score: 77 if int(c_res[0].passmark) <= score: 67 78 continue 68 79 carry_over = True … … 96 107 course_result.getContent().edit(mapping=d) 97 108 session.set('in_progress','finished') 98 return 99 return response.redirect("%s" % level.absolute_url()) 109 logger.info('%s updated course list' % member) 110 111 args = {} 112 psm = "Course list updated!" 113 args['portal_status_message'] = psm 114 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 115 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py
r1513 r1593 1 ## Script (Python) " getStudyCourseInfo"1 ## Script (Python) "register_courses" 2 2 ##bind container=container 3 3 ##bind context=context … … 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= student=None7 ##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 close the Students StudyLevel 13 13 """ 14 from Products.CMFCore.WorkflowCore import WorkflowException 14 15 try: 15 16 from Products.zdb import set_trace … … 18 19 pass 19 20 21 from urllib import urlencode 22 20 23 request = context.REQUEST 21 24 mtool = context.portal_membership … … 23 26 member_id = str(member) 24 27 import logging 25 logger = logging.getLogger('S tudent.register_courses')28 logger = logging.getLogger('Skins.register_courses') 26 29 27 30 wftool = context.portal_workflow 28 wftool.doActionFor(context,'close')29 31 students_folder = context.portal_url.getPortalObject().campus.students 30 student = getattr(students_folder,context.getStudentId()) 31 wftool.doActionFor(student,'register_courses') 32 logger.info('"%s","courses registered"' % student.getId()) 33 return request.RESPONSE.redirect("%s" % context.absolute_url()) 32 student_id = context.getStudentId() 33 student = getattr(students_folder,student_id) 34 try: 35 wftool.doActionFor(context,'close') 36 except WorkflowException,E: 37 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 38 return request.RESPONSE.redirect("%s" % context.absolute_url()) 39 try: 40 wftool.doActionFor(student,'register_courses') 41 except WorkflowException,E: 42 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 43 return request.RESPONSE.redirect("%s" % context.absolute_url()) 44 logger.info('%s registered course list of %s' % (member_id,student_id)) 45 46 args = {} 47 psm = "You successfully submitted your course list!" 48 args['portal_status_message'] = psm 49 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 50 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py
r1515 r1593 1 ## Script (Python) " getStudyCourseInfo"1 ## Script (Python) "reject_courses" 2 2 ##bind container=container 3 3 ##bind context=context … … 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= student=None7 ##parameters=REQUEST=None, student=None, action_after_reject=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 close the Students StudyLevel 13 13 """ 14 from Products.CMFCore.WorkflowCore import WorkflowException 14 15 try: 15 16 from Products.zdb import set_trace … … 17 18 def set_trace(): 18 19 pass 19 20 from urllib import urlencode 20 21 request = context.REQUEST 21 22 mtool = context.portal_membership … … 23 24 member_id = str(member) 24 25 import logging 25 logger = logging.getLogger('S tudent.reject_courses')26 logger = logging.getLogger('Skins.reject_courses') 26 27 27 28 wftool = context.portal_workflow … … 29 30 wftool.doActionFor(context,'close_for_edit') 30 31 students_folder = context.portal_url.getPortalObject().campus.students 31 student = getattr(students_folder,context.getStudentId()) 32 wftool.doActionFor(student,'reject_courses') 33 logger.info('"%s","rejects course list for","%s"' % (member,student.getId())) 34 return request.RESPONSE.redirect("%s" % context.absolute_url()) 32 student_id = context.getStudentId() 33 student = getattr(students_folder,student_id) 34 try: 35 wftool.doActionFor(student,'reject_courses') 36 except WorkflowException,E: 37 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 38 return request.RESPONSE.redirect("%s" % context.absolute_url()) 39 logger.info('%s rejected course list of %s' % (member_id,student_id)) 40 41 args = {} 42 43 psm = "Student's course list has been rejected! Please fill and submit the form below!" 44 subject = "Course list rejected" 45 args['subject'] = subject 46 args['continue'] = action_after_validate 47 args['portal_status_message'] = psm 48 url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args) 49 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/request_transfer.py
r1378 r1593 14 14 import logging 15 15 from urllib import urlencode 16 logger = logging.getLogger('S tudent.Transfer.Request')16 logger = logging.getLogger('Skins_request_transfer') 17 17 import DateTime 18 18 lt = context.portal_layouts … … 28 28 requested_id = context.getStudentId() 29 29 if requested_id and not context.isStaff() and member_id != requested_id: 30 logger.info(' "%s", "accessed application object of", "%s"' % (member_id,requested_id))30 logger.info('%s tried to access object of %s' % (member_id,requested_id)) 31 31 student_id = requested_id 32 return None 32 33 elif context.isStaff(): 33 34 student_id = requested_id … … 50 51 51 52 if paid: 52 logger.info(' "%s", "opened (paid) request transfer form of", "%s"' % (member_id,student_id))53 logger.info('%s opened (paid) request transfer form of %s' % (member_id,student_id)) 53 54 return context.request_transfer_form(rendered = None, 54 55 psm = None, … … 91 92 payments = getattr(student,'payments') 92 93 #from Products.zdb import set_trace; set_trace() 94 95 logger.info('%s paid transfer form for %s' % (member_id,student_id)) 93 96 info = {} 94 97 order_id = ds.get('pin_n') -
WAeUP_SRP/branches/uli/skins/waeup_student/search_students.py
r1500 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S earch.Timer')15 logger = logging.getLogger('Skins.search_students') 16 16 from DateTime import DateTime 17 17 # … … 61 61 user_info['faculties'] = [] 62 62 co_view = False 63 ca_view = False 63 64 faculties = fget('faculties') 64 65 departments = fget('departments') 65 dep_str = fac_str = '' 66 certificate_level = fget('certificate_level') 67 dep_str = fac_str = certificate_level_str = '' 66 68 if "ClearanceOfficers" in member.getGroups(): 67 69 state = "clearance_requested" … … 80 82 In('localUsersWithRoles', ("user:%s" % member,)) 81 83 res = evalAdvancedQuery(query) 84 logger.info('ClearanceOfficer %s initiated student_search' % member) 82 85 faculties = [] 83 86 if res: … … 93 96 user_info['departments'] = departments 94 97 dep_str = " ".join(departments) 98 elif "CourseAdvisers" in member.getGroups(): 99 state = "courses_registered" 100 only_review = False 101 ca_view = True 102 if certificate_level: 103 #from Products.zdb import set_trace;set_trace() 104 certificate_level_str = certificate_level 105 certificate_level = certificate_level.split() 106 else: 107 query = In('portal_type',('StudyLevel',)) &\ 108 In('localUsersWithRoles', ("user:%s" % member,)) 109 res = evalAdvancedQuery(query) 110 logger.info('CourseAdviser %s initiated student_search' % member) 111 certificate_level = [] 112 if res: 113 certificate_level = ['/'.join(f.getPath().split('/')[-2:]) for f in res] 114 user_info['certificate_level'] = certificate_level 115 certificate_level_str = " ".join(certificate_level) 95 116 default = {'search_mode': 'student_id', 96 117 'review_state': state, … … 106 127 faculties = fac_str, 107 128 departments = dep_str, 129 certificate_level = certificate_level_str, 108 130 commit = False, 109 131 ) … … 148 170 students_folder = context.portal_url.getPortalObject().campus.students 149 171 if hasattr(students_folder,term.strip()): 172 logger.info('%s searches for student with id %s' % (member,term)) 150 173 request.RESPONSE.redirect("%s/%s" % (students_folder.absolute_url(),term)) 151 174 return context.search_students_form(rendered = rend, … … 156 179 elif what == "department": 157 180 res = context.students_catalog(department=term.strip()) 181 logger.info('%s searches for student in department %s' % (member,term)) 158 182 search_set = [r.id for r in res] 159 183 elif what == "matric_no": 160 184 res = context.students_catalog(matric_no=term.strip()) 185 logger.info('%s searches for student with matric_no %s' % (member,term)) 161 186 search_set = [r.id for r in res] 162 187 elif what == "jamb_reg_no": … … 164 189 st_u = "%s" % term.strip().upper() 165 190 res = aq_students(In('jamb_reg_no',(st_l,st_u))) 191 logger.info('%s searches for student with jamb_reg_no %s' % (member,term)) 166 192 search_set = [r.id for r in res] 167 193 elif what == "name": 168 194 pt = ('StudentPersonal') 169 195 query = In('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip()) 196 logger.info('%s searches for student with name %s' % (member,term)) 170 197 res = evalAdvancedQuery(query) 171 198 if res: … … 181 208 query = Eq('review_state',state) 182 209 review_res = evalAdvancedQuery(query) 210 211 logger.info('%s searches for students in review_state %s' % (member,state)) 212 183 213 if with_timer: 184 214 end = DateTime().timeTime() … … 196 226 logger.info('"%s","searchtime","%6.2f"' % (member,end-start)) 197 227 start = DateTime().timeTime() 228 search_set = [r.id for r in res] 229 if with_timer: 230 end = DateTime().timeTime() 231 logger.info('"%s","searchtime","%6.2f"' % (member,end-start)) 232 elif ca_view: 233 only_review = False 234 with_review = True 235 if with_timer: 236 start = DateTime().timeTime() 237 logger.info('"%s","start 200"' % member) 238 courses = [cl.split('/')[0] for cl in certificate_level] 239 levels = [cl.split('/')[1] for cl in certificate_level] 240 query = In('course',courses) & In('level',levels) 241 res = aq_students(query) 242 if with_timer: 243 end = DateTime().timeTime() 244 logger.info('"%s","searchtime","%6.2f"' % (member,end-start)) 245 start = DateTime().timeTime() 198 246 search_set = [r.id for r in res] 199 247 if with_timer: … … 250 298 allowed = allowed, 251 299 co_view = co_view, 300 ca_view = ca_view 252 301 ) 253 302 return context.search_students_form(rendered = rend, -
WAeUP_SRP/branches/uli/skins/waeup_student/search_students_form.pt
r1570 r1593 1 1 <metal:body use-macro="here/main_template/macros/master"> 2 <metal:block fill-slot="header"3 tal:define="creation creation|nothing;4 edition edition|nothing;5 metadata metadata|nothing"6 >7 </metal:block>8 9 2 <metal:main fill-slot="main" 10 3 tal:define="rendered options/rendered; … … 12 5 students options/students; 13 6 info options/info|nothing; 14 is_so context/isSectionOfficer; 7 is_so context/isSectionOfficer; 15 8 allowed options/allowed|nothing" 16 9 > … … 30 23 </nobr> 31 24 <span tal:condition="is_so"> 32 <nobr><a href="view_logs">View Log Files</a> 33 </nobr> 34 25 <nobr><a href="view_logs">View Log Files</a> 26 </nobr> 35 27 <nobr><a href="add_student">Add Student Record</a> 36 28 </nobr> … … 97 89 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')" 98 90 >[view and change state]</a></td> 99 <td tal:condition="options/co_view|nothing"><span tal:replace="student/review_state|nothing" /></td> 91 <td tal:condition="options/ca_view|nothing"> 92 <a href="id" 93 tal:attributes="href string:${context/portal_url}/campus/students/${student/id}/study_course/study_course/${student/level}/external_study_level_view" 94 target="edit" 95 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')" 96 >[view and validate course list]</a></td> 100 97 </tr> 101 98 </span> -
WAeUP_SRP/branches/uli/skins/waeup_student/set_access_data.py
r1267 r1593 8 8 current = DateTime.DateTime() 9 9 pr = context.portal_registration 10 logger = logging.getLogger('S tudent.SetAccessData')10 logger = logging.getLogger('Skins.set_access_data') 11 11 validate = REQUEST.has_key("cpsdocument_edit_button") 12 12 13 13 if matric_no is None: 14 logger.info(' "No matric_no in request"')14 logger.info('No matric_no in request') 15 15 return REQUEST.RESPONSE.redirect("%s" % context.portal_url()) 16 16 lt = context.portal_layouts … … 21 21 sid = st_res[0].id 22 22 else: 23 logger.info(' "%s","Studentobject does not exist"' % matric_no)23 logger.info('Student object with matric_no does not exist' % matric_no) 24 24 res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search', 25 25 schema_id= 'student_returning', … … 53 53 #psm = "You are already registered please log in with your UserId %s" % sid 54 54 psm = "" 55 logger.info(' "%s","repeatedly tried to set password"' % sid)55 logger.info('%s repeatedly tried to set password' % sid) 56 56 except: 57 57 psm = "The system encountered an error. Please try again." 58 logger.info(' "%s","set_access error","%s"' % (sid,password))58 logger.info('%s, makeStudentMember error, password = %s' % (sid,password)) 59 59 if psm != '': 60 60 return context.set_access_data_form(rendered = res, -
WAeUP_SRP/branches/uli/skins/waeup_student/start_clearance.py
r1364 r1593 8 8 pr = context.portal_registration 9 9 import logging 10 logger = logging.getLogger('S tudent.Clearance.Start')10 logger = logging.getLogger('Skins.start_clearance') 11 11 12 12 #type_name = 'Student' … … 23 23 if info is None: 24 24 member_id = str(context.portal_membership.getAuthenticatedMember()) 25 logger.info(' "%s","tried to start clearance for", "%s"' % (member_id,request.get('PATH_INFO').split('/')[-2]))25 logger.info('%s tried to start clearance for %s' % (member_id,request.get('PATH_INFO').split('/')[-2])) 26 26 return redirect("%s/srp_invalid_access" % context.portal_url()) 27 27 app_doc = info['app_doc'] … … 55 55 psm = "You have already entered a clearance pin!" 56 56 error = True 57 logger.info(' "%s", "tried to start clearance though already started"' % (info['id']))57 logger.info('%s tried to start clearance though already started' % (info['id'])) 58 58 elif psm == 'invalid': 59 59 psm = "Please correct your input!" 60 60 error = True 61 logger.info(' "%s","entered wrong clearance pin"' % (info['id']))61 logger.info('%s entered wrong clearance pin' % (info['id'])) 62 62 elif app_doc.passport is None: 63 63 #psm = "You must upload your passport picture before you can start the registration process!" 64 64 #error = True 65 logger.info(' "%s", "started clearance without passport picture"' % (info['id']))65 logger.info('%s started clearance without passport picture' % (info['id'])) 66 66 if error: 67 67 return context.clearance_pin_form(rendered = res, … … 74 74 session.set("clicked","clicked") 75 75 pin = str(ds.get('clr_ac_pin')) 76 logger.info(' "%s", "started clearance with pin", "%s"' % (info['id'],pin))76 logger.info('%s started clearance with pin %s' % (info['id'],pin)) 77 77 wf.doActionFor(info['student'],'enter_clearance_pin') 78 78 wf.doActionFor(info['clear'],'open') … … 89 89 90 90 if info['penalty']: 91 logger.info(' "%s","started late clearance"' % (info['id']))91 logger.info('%s started late clearance' % (info['id'])) 92 92 93 93 return redirect("%s/clearance_edit_form" % info['clear'].absolute_url()) -
WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt
r1532 r1593 24 24 <h3>Returning Student Statistics</h3> 25 25 <br /> 26 <span tal:content="python:departments[0]['total_ret']" /> 27 returning student records have been imported. 28 <span tal:content="python:departments[0]['total_li']" /> returning students 29 have logged in. 30 <br /><br /> 26 31 <span tal:condition="not:isAnon"> 27 32 <table> 28 33 <tr class="odd ajaxtd"> 29 34 <th >Faculty</th> 30 <th align="right">Returning</th> 35 <th align="right">RET</th> 36 <th align="right">SFP</th> 31 37 </tr> 32 38 <tr tal:define="d python:departments[0]" … … 34 40 <td width="80px">All Faculties</td> 35 41 <td width="80px" align="right"> 36 <span tal:content="d/sum" /> of <span tal:content="d/total" /> 42 <span tal:content="d/ret" /> 43 </td> 44 <td width="80px" align="right"> 45 <span tal:content="d/sfp" /> 37 46 </td> 38 47 </tr> … … 41 50 <td width="80px"> <span tal:content="d/id" /> </td> 42 51 <td width="80px" align="right"> 43 <span tal:content="d/returned " /> 44 </td> 52 <span tal:content="d/ret" /> 53 </td> 54 <td width="80px" align="right"> 55 <span tal:content="d/sfp" /> 56 </td> 45 57 </tr> 46 58 </table> 47 59 <br /> 60 <table> 61 <tr><td>RET:</td> <td>Returning students who have logged in</td></tr> 62 <tr><td>SFP:</td> <td>Returning students who already paid their school fee</td></tr> 63 </table> 48 64 </span> 49 65 </span> -
WAeUP_SRP/branches/uli/skins/waeup_student/students_index.py
r1239 r1593 23 23 students_url = "%s/campus/students" % (context.portal_url()) 24 24 25 if "ClearanceOfficers" in member.getGroups(): 26 return redirect("%s/search_students" % context.portal_url()) 25 if "ClearanceOfficers" in member.getGroups() or\ 26 "CourseAdvisers" in member.getGroups(): 27 return redirect("%s/campus/students/search_students" % context.portal_url()) 27 28 if context.isSectionOfficer(): 28 return redirect("%s/ search_students" % context.portal_url())29 return redirect("%s/campus/students/search_students" % context.portal_url()) 29 30 if context.isStudent(): 30 31 id = str(member) -
WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt
r1519 r1593 6 6 global is_ca info/is_ca; 7 7 global show_check_boxes info/show_check_boxes; 8 global is_student info/is_student;9 global status_info info/status_info;10 global review_state info/review_state;11 global view_only info/view_only">8 global is_student info/is_student; 9 global status_info info/status_info; 10 global review_state info/review_state; 11 global view_only info/view_only"> 12 12 <a href="" 13 13 tal:attributes="href string:${here/academicsParent}"> … … 63 63 <h4>Session Courses</h4> 64 64 <br /> 65 <table class="contentListing" width="100%" summary="content layout" id="folder_content"> 65 <div class="" tal:condition="not: info/normal"> 66 Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty! 67 </div> 68 <table class="contentListing" width="100%" id="folder_content" 69 tal:condition="info/normal"> 66 70 <tr tal:repeat="row info/normal" 67 71 tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')"> … … 97 101 <td align="left" valign="top" rowspan="3"></td> 98 102 <td align="left" valign="top"> 99 <input type="submit" name=" course_result_delete:method" value="Delete selected"103 <input type="submit" name="delete_course_result:method" value="Delete selected" 100 104 class="destructive" i18n:attributes="value" 101 105 tal:attributes="onclick python:'return window.confirm(\'%s\')' % … … 106 110 /> 107 111 <br /><br /> 108 <input type="submit" name="register_courses:method" 112 <input tal:condition="info/normal" 113 type="submit" name="register_courses:method" 109 114 class="context" value="Submit" /> 110 115 </td> … … 122 127 % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))" 123 128 /> 124 <input type="submit" name=" course_result_delete:method" value="Delete selected"129 <input type="submit" name="delete_course_result:method" value="Delete selected" 125 130 class="destructive" i18n:attributes="value" 126 131 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 127 (' really delete checked courses', )"132 ('Do you really want to delete the courses selected?', )" 128 133 /> 129 134 <input … … 154 159 /> 155 160 <input tal:condition="python: review_state == 'school_fee_paid'" 156 type="submit" name=" course_result_delete:method" value="Delete selected"161 type="submit" name="delete_course_result:method" value="Delete selected" 157 162 class="destructive" i18n:attributes="value" 158 163 tal:attributes="onclick python:'return window.confirm(\'%s\')' % … … 169 174 <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method" 170 175 class="context" value="Reject" /> 176 177 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 178 tal:attributes="value string:/study_level_view"/> 179 <input type="hidden" name="action_after_reject" type="text" id="action_after_reject" 180 tal:attributes="value string:/contact_student_form"/> 181 171 182 172 183 </td> … … 183 194 <td><input type="text" name="course_id" 184 195 tal:attributes="value request/course_id|nothing"/></td> 185 <td tal:condition="request/error|nothing"186 tal:content="request/error" />187 196 <td colspan="2"> 188 197 <input type="submit" name="add" 189 198 class="context" value="Add Course" 190 199 /> 200 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 201 tal:attributes="value string:/study_level_view"/> 191 202 </td> 192 203 </table> -
WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py
r1513 r1593 1 ## Script (Python) " getStudyCourseInfo"1 ## Script (Python) "validate_courses" 2 2 ##bind container=container 3 3 ##bind context=context … … 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters=student=None 7 ##parameters=student=None, action_after_reject=None, action_after_validate=None 8 8 ##title= 9 9 ## … … 12 12 close the Students StudyLevel 13 13 """ 14 from Products.CMFCore.WorkflowCore import WorkflowException 14 15 try: 15 16 from Products.zdb import set_trace … … 23 24 member_id = str(member) 24 25 import logging 25 logger = logging.getLogger('S tudent.validate_courses')26 logger = logging.getLogger('Skins.validate_courses') 26 27 27 28 wftool = context.portal_workflow 28 29 students_folder = context.portal_url.getPortalObject().campus.students 29 student = getattr(students_folder,context.getStudentId()) 30 wftool.doActionFor(student,'validate_courses') 31 logger.info('"%s","validated courses for","%s"' % (member,student.getId())) 32 return request.RESPONSE.redirect("%s" % context.absolute_url()) 30 student_id = context.getStudentId() 31 student = getattr(students_folder,student_id) 32 try: 33 wftool.doActionFor(student,'validate_courses') 34 except WorkflowException,E: 35 logger.info('%s WorkflowException %s for %s' % (member_id,E,student_id)) 36 return request.RESPONSE.redirect("%s" % context.absolute_url()) 37 logger.info('%s validated course list of %s' % (member_id,student_id)) 38 39 psm = 'portal_status_message=Course list validated!' 40 url = context.absolute_url() + '/' + action_after_validate + '?' + psm 41 return request.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_utilities/createReturningStudent.py
r1413 r1593 17 17 students_folder = context.portal_url.getPortalObject().campus.students 18 18 import logging 19 logger = logging.getLogger(' createReturningStudent')19 logger = logging.getLogger('Skins.createReturningStudent') 20 20 21 21 if not matric_no: … … 30 30 student_brain = res[0] 31 31 sid,jamb_reg_no = context.waeup_tool.createOne(students_folder,student_brain,'?') 32 logger.info(' "%s","Created Student","%s", "%s"' % (member,sid,matric_no))32 logger.info('%s creates student %s %s' % (member,sid,matric_no)) 33 33 return "Student MatricNo %s, StudentId %s (JAMBRegNo %s) created" % (matric_no,sid,jamb_reg_no) 34 34 … … 36 36 count = 1 37 37 total = 0 38 logger.info(' "%s","Create Students start"' % (member))38 logger.info('%s started createReturningStudent"' % (member)) 39 39 letters = ('ABCDEFGHKLMNPQRSTUVWXYZ') 40 40 lc = 0 … … 42 42 res = context.students_catalog(matric_no = matric_no) 43 43 if len(res) == 1: 44 #logger.info('"Student already exists","%s"' % (matric_no))45 44 continue 46 45 elif len(res) > 1: 47 logger.info('"Student with multiple entries","%s","%s" ' % (matric_no,len(res))) 46 logger.info('Student %s with multiple entries (%s)' % (matric_no,len(res))) 47 # fix at the beginning 48 48 ids = [r.id for r in res if not r.id.startswith('A')] 49 #from Products.zdb import set_trace;set_trace()50 49 for id in ids: 51 50 context.students_catalog.deleteRecord(id) 52 51 students_folder.manage_delObjects(ids) 53 logger.info(' "deleted students","%s"' % " ".join(ids))52 logger.info('Student objects deleted: %s' % " ".join(ids)) 54 53 continue 55 54 student = context.returning_import(matric_no=matric_no)[0] … … 59 58 lc = 0 60 59 context.waeup_tool.createOne(students_folder,student,letter) 61 logger.info(' "Student created","%s"' % (matric_no))60 logger.info('Student created: %s' % (matric_no)) 62 61 count += 1 63 62 if count > 10: 64 logger.info(' "%s","Committed Students","%s", "%s"' % (member,count,total))63 logger.info('%s committed students %s, %s' % (member,count,total)) 65 64 total += count 66 65 count = 1 67 logger.info(' "%s","Create Students finish","%s"' % (member,total))66 logger.info('createReturningStudent finished (%s)' % (total)) -
WAeUP_SRP/branches/uli/skins/waeup_utilities/deleteStudentByMatricNo.py
r1400 r1593 1 ## Script (Python) " search_pins"1 ## Script (Python) "deleteStudentByMatricNo" 2 2 ##bind container=container 3 3 ##bind context=context … … 12 12 """ 13 13 import logging 14 logger = logging.getLogger(' DeleteStudentByMatricNo')14 logger = logging.getLogger('Skins.deleteStudentByMatricNo') 15 15 16 16 request = REQUEST … … 26 26 if str(member) not in ('admin','joachim') or matric_no is None: 27 27 return 28 29 30 # remove from students_catalog 28 29 30 # remove from students_catalog 31 31 32 32 res = st_cat(matric_no=matric_no) -
WAeUP_SRP/branches/uli/skins/waeup_utilities/fixLevelForNewStudents.py
r1491 r1593 1 ## Script (Python) " search_pins"1 ## Script (Python) "fixLevelForNewStudents" 2 2 ##bind container=container 3 3 ##bind context=context … … 23 23 setheader = request.RESPONSE.setHeader 24 24 import logging 25 logger = logging.getLogger(' fixLevelForNewStudents')25 logger = logging.getLogger('Skins.fixLevelForNewStudents') 26 26 27 27 def rwrite(s): … … 53 53 count_full = 0 54 54 commit_count = 0 55 logger.info(" started for %s students" % len(res))55 logger.info("Started for %s students" % len(res)) 56 56 to_change = {} 57 57 for sbrain in res: … … 92 92 if commit_count > 1000: 93 93 context.waeup_tool.doCommit() 94 logger.info(" committing %s transactionstotal %s" % (commit_count,count))94 logger.info("Committing %s transactions, total %s" % (commit_count,count)) 95 95 commit_count = 0 96 96 rwrite("%s: %s %s %s <br />" % (count,sbrain.id,entry_mode,level)) … … 98 98 students_cat.modifyRecord(**to_change[entry]) 99 99 rwrite("finished") 100 logger.info(" finished %s students" % count)100 logger.info("Finished %s students" % count) -
WAeUP_SRP/branches/uli/skins/waeup_utilities/reindexCoursesCatalog.py
r1499 r1593 1 ## Script (Python) " search_pins"1 ## Script (Python) "reindexCourseCatalog" 2 2 ##bind container=container 3 3 ##bind context=context … … 23 23 setheader = request.RESPONSE.setHeader 24 24 import logging 25 logger = logging.getLogger(' reindexCourseCatalog')25 logger = logging.getLogger('Skins.reindexCourseCatalog') 26 26 27 27 def rwrite(s): … … 51 51 count_full = 0 52 52 commit_count = 0 53 logger.info(" reindexing of courses_catalog started for %s courses" % len(courses))53 logger.info("Reindexing of courses_catalog started for %s courses" % len(courses)) 54 54 for course_brain in courses: 55 55 course_doc = course_brain.getObject().getContent() … … 72 72 if commit_count > 1000: 73 73 context.waeup_tool.doCommit() 74 logger.info(" committing %s transactionstotal %s" % (commit_count,count))74 logger.info("Committing %s transactions, total %s" % (commit_count,count)) 75 75 rwrite("%s: committed %s <br />" % (count,commit_count)) 76 76 commit_count = 0 77 77 rwrite("finished") 78 logger.info(" finished reindexing %s courses" % count)78 logger.info("Reindexing finished (%s courses)" % count) -
WAeUP_SRP/branches/uli/skins/waeup_utilities/removeResults2.py
r1508 r1593 1 ## Script (Python) " search_pins"1 ## Script (Python) "removeResults2" 2 2 ##bind container=container 3 3 ##bind context=context … … 13 13 """ 14 14 import logging 15 logger = logging.getLogger(' removeResults2')15 logger = logging.getLogger('Skins.removeResults2') 16 16 17 17 request = REQUEST … … 43 43 to_del.append(r.key) 44 44 rwrite(r.matric_no + " " + r.Level +" " + r.CosCode + "<br />") 45 logger.info(' "%s", "start to delete %s results"' % (member,len(to_del)))45 logger.info('%s starts to delete %s results' % (member,len(to_del))) 46 46 for uid in to_del: 47 47 rcat.deleteRecord(uid) 48 logger.info(' "%s", "finished with deletion of %s results"' % (member,len(to_del)))48 logger.info('%s finished deletion of %s results' % (member,len(to_del))) 49 49 rwrite("Done") 50 50 -
WAeUP_SRP/branches/uli/skins/waeup_utilities/unpay.py
r1352 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger(' EPayment.Unpay')15 logger = logging.getLogger('Skins.unpay') 16 16 import DateTime 17 18 pm = context.portal_membership 19 member = pm.getAuthenticatedMember() 17 20 18 21 request = context.REQUEST … … 27 30 #wftool.doActionFor(student,'return') 28 31 wftool.doActionFor(student,'clear_and_validate') 29 logger.info(' "%s", "reset to state returning"' % student_id)32 logger.info('%s resets %s to state returning' % (member,student_id)) 30 33 31 34 return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracChangeset for help on using the changeset viewer.