Changeset 1653 for WAeUP_SRP/branches/uli
- Timestamp:
- 28 Mar 2007, 02:35:25 (18 years ago)
- Location:
- WAeUP_SRP/branches/uli
- Files:
-
- 44 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/branches/uli/PatchCPSUserFolderUserFolder.py
r1593 r1653 86 86 "StudentStudyLevel"): 87 87 break 88 # don't test if it is not a proxy 89 if real_object.portal_type == real_object.meta_type: 90 break 88 89 # don't test if it is not a proxy 90 #if real_object.portal_type == real_object.meta_type: 91 # break 92 91 93 # can be later simplified by replacing by students_catalog values - Henrik 92 94 # getattr works always because of acquisition ?! Henrik … … 94 96 if sc is None: 95 97 break 96 #from pdb import set_trace;set_trace()97 98 sc_obj = sc.getContent() 98 99 cert_id = sc_obj.study_course … … 121 122 ) 122 123 if real_object.portal_type == "StudentStudyLevel": 123 context_obj = getattr(certificate_obj,real_object.getId(),None) 124 if real_object.meta_type != "StudentStudyLevel": 125 context_obj = getattr(certificate_obj,real_object.getId(),None) 126 else: 127 context_obj = getattr(certificate_obj,real_object.aq_parent.getId(),None) 124 128 if context_obj is None: 129 #from pdb import set_trace;set_trace() 125 130 break 126 131 allowed = set(('CourseAdviser', 'SectionManager')) 127 132 elif real_object.portal_type == "Student" and "CourseAdvisers" in groups: 128 #we need some special processing since CourseAdvisers are only 133 #we need some special processing since CourseAdvisers are only 129 134 #specified per StudyLevel 130 135 allowed = set(('CourseAdviser', 'SectionManager')) -
WAeUP_SRP/branches/uli/PatchCatalogToolXMLAdapter.py
r1062 r1653 21 21 inds[ind.attributes.items()[1][1]] = ind.attributes.items()[0][1] 22 22 #print ind.attributes.items() 23 # print "indexes: ", inds23 #from pdb import set_trace; set_trace() 24 24 na = node.attributes.items() 25 25 not_found = True 26 26 new_indexes = [] 27 27 new_columns = [] 28 if na[0][1] in ("WAeUP Table"): 29 not_found = False 30 elif na[0][1] == "CMF Catalog": 28 if na[0][1] in ("CMF Catalog","WAeUP Table"): 31 29 #print na[1][1] 32 30 not_found = False … … 49 47 not_found = True 50 48 if not_found: 51 self._initProperties(node) 52 self._initObjects(node) 53 self._initIndexes(node) 49 self._logger.info("%s modified." % na[1][1]) 50 #self._initProperties(node) 51 #self._initObjects(node) 52 if new_indexes and len(self.context()) == 0: #disable creation of new indexes if records in the table 53 self._initIndexes(node) 54 54 self._initColumns(node) 55 self._refreshCatalog()55 #self._refreshCatalog() 56 56 57 self._logger.info("Catalog tool imported.")57 self._logger.info("Catalog tool %s imported." % na[1][1]) 58 58 59 59 from Products.CPSCore.exportimport.catalog import CatalogToolXMLAdapter -
WAeUP_SRP/branches/uli/Students.py
r1593 r1653 16 16 from Products.CPSCore.CPSMembershipTool import CPSUnrestrictedUser 17 17 from Products.WAeUP_SRP.Academics import makeCertificateCode 18 from Products.AdvancedQuery import Eq, Between, Le,In 18 19 import logging 19 20 import csv,re,os … … 22 23 i_home = Globals.INSTANCE_HOME 23 24 MAX_TRANS = 1000 25 from urllib import urlencode 26 24 27 import DateTime 25 28 # import PIL.Image … … 36 39 37 40 ###) 41 42 def response_write(response,s): 43 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 44 while s.find('<') > -1: 45 s = s.replace('<','<') 46 while s.find('>') > -1: 47 #from pdb import set_trace;set_trace() 48 s = s.replace('>','>') 49 response.write("%s<br>\n" % s) 38 50 39 51 def getInt(s): ###( … … 81 93 portal_type = meta_type 82 94 security = ClassSecurityInfo() 83 84 85 95 86 96 security.declareProtected(ModifyPortalContent,"createDEStudents")###( … … 537 547 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 538 548 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 549 #students_folder = self.portal_url().getPortalObject().campus.students 539 550 tr_count = 1 540 551 total = 0 … … 701 712 logger.info(em) 702 713 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 714 ###) 715 716 security.declareProtected(ModifyPortalContent,"fixAllNames")###( 717 def fixAllNames(self): 718 "fix all students names" 719 import transaction 720 response = self.REQUEST.RESPONSE 721 logger = logging.getLogger('fixAllNames') 722 logger.info('Start') 723 students = self.portal_catalog(portal_type='Student') 724 count = 0 725 total = 0 726 for student in students: 727 scat_res = self.students_catalog(id = student.getId) 728 if not scat_res: 729 self.students_catalog.addRecord(id = student.getId) 730 scat_res = self.students_catalog(id = student.getId) 731 student_entry = scat_res[0] 732 old_new = self.fixName(student,student_entry) 733 count += 1 734 response_write(response,'"%d","%s",%s' % (count + total,student_entry.id,old_new)) 735 if count > 2000: 736 transaction.commit() 737 logger.info("%d transactions commited" % count) 738 total += count 739 count = 0 740 ###) 741 742 security.declareProtected(ModifyPortalContent,"fixName")###( 743 def fixName(self,student_brain, student_entry): 744 "fix the name of a student" 745 fix = "first" 746 if student_entry.get('name_fixed',None) == fix: 747 return "Name already fixed" 748 student_id = student_entry.id 749 new_student = student_entry.jamb_reg_no.startswith('6') 750 student_obj = student_brain.getObject() 751 personal = getattr(student_obj,'personal',None) 752 invalid = '' 753 if personal is None: 754 return '"%s","Returning","%s","%s"' % (invalid,student_entry.name,"not logged in") 755 per_doc = personal.getContent() 756 old_first = per_doc.firstname 757 old_middle = per_doc.middlename 758 old_last = per_doc.lastname 759 new_first = '' 760 new_middle = '' 761 new_last = '' 762 if new_student: 763 if not old_first and not old_middle and old_last: 764 new_names = [n.capitalize() for n in old_last.split()] 765 if len(new_names) > 1: 766 old_first = new_names[0] 767 old_last = new_names[-1] 768 old_middle = ' '.join(new_names[1:-1]) 769 else: 770 old_last = new_names[0] 771 old_first = '' 772 old_middle = '' 773 if old_first: 774 new_first = old_first 775 if old_middle: 776 new_middle = old_middle 777 if old_last: 778 new_last = old_last 779 if old_first.find('<') != -1 or\ 780 old_first.find('>') != -1 or\ 781 old_middle.find('<') != -1 or\ 782 old_middle.find('>') != -1 or\ 783 old_last.find('<') != -1 or\ 784 old_last.find('>') != -1: 785 invalid = "invalid characters" 786 else: 787 new_first = old_first 788 if new_first.strip() == '-': 789 new_first = '' 790 new_middle = old_middle 791 if new_middle.strip() == '-': 792 new_middle = '' 793 new_last = old_last 794 if new_last.strip() == '-': 795 new_last = '' 796 name = "%(new_first)s %(new_middle)s %(new_last)s" % vars() 797 if new_student: 798 text = "New" 799 else: 800 text = "Returning" 801 old_new = '"%s","%s","%s","%s"' % (invalid,text, 802 student_entry.name, 803 name) 804 if not invalid: 805 self.students_catalog.modifyRecord(id = student_id, 806 name_fixed = fix, 807 name = name) 808 per_doc.edit(mapping = {'firstname' : new_first, 809 'middlename' : new_middle, 810 'lastname' : new_last, 811 }) 812 return old_new 703 813 ###) 704 814 … … 1114 1224 ###) 1115 1225 1116 1117 1118 security.declareProtected(View,"fixOwnership") 1226 security.declareProtected(View,"fixOwnership") ###( 1119 1227 def fixOwnership(self): 1120 1228 """fix Ownership""" … … 1125 1233 student.application.manage_setLocalRoles(sid, ['Owner',]) 1126 1234 student.personal.manage_setLocalRoles(sid, ['Owner',]) 1127 1128 security.declareProtected(View,"Title") 1235 ###) 1236 1237 security.declareProtected(View,"Title") ###( 1129 1238 def Title(self): 1130 1239 """compose title""" 1131 1240 return "Student Section" 1241 ###) 1132 1242 1133 1243 def generateStudentId(self,letter): ###( … … 1146 1256 InitializeClass(StudentsFolder) 1147 1257 1148 def addStudentsFolder(container, id, REQUEST=None, **kw): 1258 def addStudentsFolder(container, id, REQUEST=None, **kw): ###( 1149 1259 """Add a Student.""" 1150 1260 ob = StudentsFolder(id, **kw) 1151 1261 return CPSBase_adder(container, ob, REQUEST=REQUEST) 1262 ###) 1263 1152 1264 ###) 1265 1153 1266 1154 1267 class Student(CPSDocument): ###( … … 1316 1429 return "Level %s" % self.aq_parent.getId() 1317 1430 1318 ## security.declarePublic("gpa") 1319 ## def gpa(self): 1320 ## """calculate the gpa""" 1321 ## sum = 0 1322 ## course_count = 0 1323 ## for sc in self.objectValues(): 1324 ## result = sc.getContent() 1325 ## if not result.grade: 1326 ## continue 1327 ## res = self.portal_catalog({'meta_type': 'Course', 1328 ## 'id': sc.aq_parent.id}) 1329 ## if len(res) != 1: 1330 ## continue 1331 ## course = res[0].getObject().getContent() 1332 ## sum += course.credits * ['F','E','D','C','B','A'].index(result.grade) 1333 ## course_count += 1 1334 ## if course_count: 1335 ## return sum/course_count 1336 ## return 0.0 1431 def create_course_results(self,cert_id,current_level): 1432 "create all courses in a level" 1433 aq_portal = self.portal_catalog.evalAdvancedQuery 1434 res = self.portal_catalog(portal_type="Certificate", id = cert_id) 1435 l = [] 1436 import transaction 1437 if res: 1438 cert = res[0] 1439 path = cert.getPath() 1440 query = Eq("path","%s/%s" % (path,current_level)) &\ 1441 Eq('portal_type','CertificateCourse') 1442 courses = aq_portal(query) 1443 #from pdb import set_trace;set_trace() 1444 self_proxy = self.aq_parent 1445 for c in courses: 1446 d = self.getCourseInfo(c.getId) 1447 cr_id = self_proxy.invokeFactory('StudentCourseResult',c.getId) 1448 course_result = getattr(self_proxy,cr_id) 1449 self.portal_workflow.doActionFor(course_result,'open') 1450 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 1451 course_result.getContent().edit(mapping=d) 1452 transaction.commit() 1337 1453 1338 1454 InitializeClass(StudentStudyLevel) -
WAeUP_SRP/branches/uli/WAeUPTables.py
r1593 r1653 22 22 from Globals import InitializeClass 23 23 from Products.ZCatalog.ZCatalog import ZCatalog 24 from Products.ZCatalog.ProgressHandler import ZLogHandler 24 25 from AccessControl import ClassSecurityInfo 25 26 from Products.CMFCore.permissions import ModifyPortalContent 26 27 27 import DateTime 28 import DateTime,time 28 29 import csv,re 29 30 import logging … … 48 49 implements(IWAeUPTable) 49 50 security = ClassSecurityInfo() 51 52 def refreshCatalog(self, clear=0, pghandler=None): 53 """ don't refresh for a normal table """ 54 55 if self.REQUEST and self.REQUEST.RESPONSE: 56 self.REQUEST.RESPONSE.redirect( 57 URL1 + 58 '/manage_catalogAdvanced?manage_tabs_message=Catalog%20refresh%20not%20implemented') 59 60 def manage_catalogClear(self, REQUEST=None, RESPONSE=None, URL1=None): 61 """ clears the whole enchilada """ 62 #self._catalog.clear() 63 64 if REQUEST and RESPONSE: 65 RESPONSE.redirect( 66 URL1 + 67 '/manage_catalogAdvanced?manage_tabs_message=Catalog%20Clearing%20disabled') 50 68 51 69 def addRecord(self, **data): … … 75 93 raise KeyError("No record for uid %s" % uid) 76 94 record = records[0] 77 record_data = {}78 for field in self.schema() + self.indexes():79 record_data[field] = getattr(record, field)80 95 record_data = {} 81 96 for field in self.schema() + self.indexes(): … … 210 225 211 226 class StudentsCatalog(WAeUPTable): ###( 227 security = ClassSecurityInfo() 212 228 213 229 meta_type = 'WAeUP Students Catalog' 214 230 name = "students_catalog" 215 231 key = "id" 232 interesting_types = ('Student', 233 'StudentApplication', 234 'StudentCLearance', 235 'StudentPersonal', 236 'StudentStudyCourse', 237 ) 238 216 239 def __init__(self): 217 240 WAeUPTable.__init__(self, 'students_catalog') 241 return 242 243 def get_review_state(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): ###( 244 "return the students review_state from portal_catalog" 245 cat_res = self.portal_catalog(id = sid) 246 if len(cat_res) != 1: 247 return None 248 return cat_res[0].review_state 249 250 def get_course(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 251 "return the students study_course" 252 if study_course_doc is None: 253 return None 254 return getattr(study_course_doc,'study_course',None) 255 256 def get_department(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 257 "return the students department" 258 if study_course_doc is None: 259 return None 260 certificate_res = self.portal_catalog(id = study_course_doc.study_course) 261 if len(certificate_res) != 1: 262 return None 263 return certificate_res[0].getPath().split('/')[-3] 264 265 def get_email(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 266 "return the students email from the personal" 267 if personal_doc is None: 268 return None 269 return getattr(personal_doc,'email',None) 270 271 def get_entry_mode(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 272 "return the students entry_mode from the application" 273 if application_doc is None: 274 return None 275 return getattr(application_doc,'entry_mode',None) 276 277 def get_jamb_reg_no(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 278 "return the students jamb_reg_no from the application" 279 if application_doc is None: 280 return None 281 return getattr(application_doc,'jamb_reg_no',None) 282 283 def get_faculty(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 284 "return the students faculty" 285 if study_course_doc is None: 286 return None 287 certificate_res = self.portal_catalog(id = study_course_doc.study_course) 288 if len(certificate_res) != 1: 289 return None 290 return certificate_res[0].getPath().split('/')[-4] 291 292 def get_level(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 293 "return the students study_course" 294 if study_course_doc is None: 295 return None 296 #from pdb import set_trace;set_trace() 297 return getattr(study_course_doc,'current_level',None) 298 299 def get_matric_no(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 300 "return the students matric_no from the clearance " 301 if clearance_doc is None: 302 return None 303 return getattr(clearance_doc,'matric_no',None) 304 305 def get_name(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 306 "return the students name from the personal" 307 if personal_doc is None: 308 return None 309 doc = personal_doc 310 return "%s %s %s" % (doc.firstname,doc.middlename,doc.lastname) 311 312 def get_phone(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 313 "return the students phone from the personal" 314 if personal_doc is None: 315 return None 316 return getattr(personal_doc,'phone',None) 317 318 def get_sex(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 319 "return the students sex from the personal" 320 if personal_doc is None: 321 return None 322 return getattr(personal_doc,'sex',None) 323 324 def get_verdict(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): 325 "return the students study_course" 326 if study_course_doc is None: 327 return None 328 return getattr(study_course_doc,'current_verdict',None) 329 ###) 330 331 def refreshCatalog(self, clear=0, pghandler=None): ###( 332 """ re-index everything we can find """ 333 students_folder = self.portal_url.getPortalObject().campus.students 334 335 cat = self._catalog 336 paths = self._catalog.uids.items() 337 if clear: 338 paths = tuple(paths) 339 cat.clear() 340 341 num_objects = len(paths) 342 if pghandler: 343 pghandler.init('Refreshing catalog: %s' % self.absolute_url(1), num_objects) 344 for i in xrange(num_objects): 345 if pghandler: pghandler.report(i) 346 p = paths[i] 347 sid = p[0] 348 pcat_res = self.portal_catalog(id=sid) 349 if len(pcat_res) != 1: 350 continue 351 student_brain = pcat_res[0] 352 student_obj = student_brain.getObject() 353 if student_obj.hasObject('application'): 354 application_doc = getattr(student_obj,'application').getContent() 355 else: 356 application_doc = None 357 if student_obj.hasObject('clearance'): 358 clearance_doc = getattr(student_obj,'clearance').getContent() 359 else: 360 clearance_doc = None 361 if student_obj.hasObject('personal'): 362 personal_doc = getattr(student_obj,'personal').getContent() 363 else: 364 personal_doc = None 365 if student_obj.hasObject('study_course'): 366 study_course_doc = getattr(student_obj,'study_course').getContent() 367 else: 368 study_course_doc = None 369 data = {} 370 data['id'] = sid 371 for field in self.schema(): 372 function = getattr(self,"get_%s" % field, None) 373 if function is None: 374 continue 375 value = function(sid,application_doc,clearance_doc,personal_doc,study_course_doc) 376 if value is not None: 377 data[field] = value 378 self.modifyRecord(**data) 379 if pghandler: pghandler.finish() 380 ###) 381 382 def manage_catalogReindex(self, REQUEST, RESPONSE, URL1): 383 """ clear the catalog, then re-index everything """ 384 385 elapse = time.time() 386 c_elapse = time.clock() 387 388 pgthreshold = self._getProgressThreshold() 389 handler = (pgthreshold > 0) and ZLogHandler(pgthreshold) or None 390 self.refreshCatalog(clear=0, pghandler=handler) 391 392 elapse = time.time() - elapse 393 c_elapse = time.clock() - c_elapse 394 395 RESPONSE.redirect( 396 URL1 + 397 '/manage_catalogAdvanced?manage_tabs_message=' + 398 urllib.quote('Catalog Updated \n' 399 'Total time: %s\n' 400 'Total CPU time: %s' % (`elapse`, `c_elapse`))) 401 402 403 security.declarePrivate('notify_event_listener') 404 def notify_event_listener(self,event_type,object,infos): 405 "listen for events" 406 pt = object.portal_type 407 mt = object.meta_type 408 students_catalog = self.students_catalog 409 #if pt not in self.interesting_types: 410 # return 411 #print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars() 412 if not infos.has_key('rpath'): 413 return 414 if pt == 'Student' and event_type == "workflow": 415 pass 416 elif mt == 'StudentApplication': 417 if event_type not in ('sys_modify_object'): 418 return 419 print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars() 420 from pdb import set_trace;set_trace() 421 jamb_reg_no = getattr(object,'jamb_reg_no',None) 422 if jamb_reg_no is None: 423 return 424 student_id = infos['rpath'].split('/')[2] 425 self.fixName(student_id) 426 student_entry = students_catalog(id = student_id)[0] 427 if student_entry.jamb_reg_no == jamb_reg_no: 428 return 429 students_catalog.modifyRecord(id = student_id, 430 jamb_reg_no = jamb_reg_no) 431 elif mt == 'StudentPersonal': 432 if event_type not in ('sys_modify_object'): 433 return 434 print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars() 435 student_id = infos['rpath'].split('/')[2] 436 self.fixName(student_id) 218 437 219 438 … … 234 453 ###) 235 454 455 class OnlinePaymentsImport(WAeUPTable): ###( 456 457 meta_type = 'WAeUP Online Payment Transactions' 458 name = "online_payments_import" 459 key = "order_id" 460 def __init__(self): 461 WAeUPTable.__init__(self, self.name) 462 463 464 InitializeClass(CoursesCatalog) 465 ###) 466 236 467 class ReturningImport(WAeUPTable): ###( 237 468 -
WAeUP_SRP/branches/uli/WAeUPTool.py
r1593 r1653 38 38 p_home = package_home(globals()) 39 39 i_home = INSTANCE_HOME 40 import logging,os 40 import DateTime 41 import logging 41 42 import transaction 42 43 44 43 import csv,re,os 45 44 46 45 class WAeUPTool(UniqueObject, SimpleItem, ActionProviderBase): … … 113 112 ###) 114 113 115 security.declareProtected( ModifyPortalContent,'doCommit') ###(114 security.declareProtected(View,'doCommit') ###( 116 115 def doCommit(self,logger=None): 117 116 "commit some transactions" … … 532 531 ###) 533 532 533 security.declareProtected(ModifyPortalContent,"importOnlinePaymentTransactions")###( 534 def importOnlinePaymentTransactions(self): 535 """load Online Payment Transactions from CSV values""" 536 import transaction 537 import random 538 #from pdb import set_trace 539 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 540 opt = self.online_payments_import 541 students_folder = self.portal_url.getPortalObject().campus.students 542 start = True 543 tr_count = 1 544 total = 0 545 #name = 'pume_results' 546 name = 'OnlineTransactions' 547 no_import = [] 548 imported = [] 549 logger = logging.getLogger('WAeUPTool.importOnlinePaymentTransactions') 550 try: 551 transactions = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 552 except: 553 logger.error('Error reading %s.csv' % name) 554 return 555 for pay_transaction in transactions: 556 if start: 557 start = False 558 logger.info('Start loading from %s.csv' % name) 559 s = ','.join(['"%s"' % fn for fn in pay_transaction.keys()]) 560 no_import.append('%s,"Error"' % s) 561 format = ','.join(['"%%(%s)s"' % fn for fn in pay_transaction.keys()]) 562 format_error = format + ',"%(Error)s"' 563 data = {} 564 565 # format of the first file sent from Tayo 566 #data['datetime'] = date = DateTime.DateTime(pay_transaction['Date']) 567 #data['student_id'] = student_id = pay_transaction['Payer ID'] 568 #data['order_id'] = order_id = pay_transaction['Order ID (Tranx Ref)'] 569 #data['response_code'] = response_code = pay_transaction['Resp Code'] 570 #data['amount'] = amount = pay_transaction['Amount'] 571 572 # format of the second file sent from Tayo 573 data['datetime'] = date = 0 574 data['student_id'] = student_id = pay_transaction['Payer ID'] 575 data['order_id'] = order_id = pay_transaction['Order ID (Tranx Ref)'] 576 data['response_code'] = response_code = '00' 577 data['amount'] = amount = pay_transaction['Amount'] 578 579 dup = False 580 if response_code == "12": 581 continue 582 try: 583 opt.addRecord(**data) 584 except ValueError: 585 dup = True 586 #from pdb import set_trace;set_trace() 587 if dup: 588 if response_code == "00": 589 opt.modifyRecord(**data) 590 else: 591 pay_transaction['Error'] = "Duplicate order Id" 592 no_import.append( format_error % pay_transaction) 593 logger.info("dupplicate order_id %(order_id)s for %(student_id)s %(response_code)s" % data) 594 continue 595 tr_count += 1 596 if tr_count > 1000: 597 if len(no_import) > 0: 598 open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( 599 '\n'.join(no_import) + '\n') 600 no_import = [] 601 em = '%d transactions committed\n' % (tr_count) 602 transaction.commit() 603 regs = [] 604 logger.info(em) 605 total += tr_count 606 tr_count = 0 607 open("%s/import/%s_not_imported%s.csv" % (i_home,name,current),"a").write( 608 '\n'.join(no_import)) 609 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 610 ###) 611 534 612 InitializeClass(WAeUPTool) -
WAeUP_SRP/branches/uli/doc/srp_documentation.mm
r1530 r1653 8 8 </node> 9 9 <node CREATED="1172489529057" ID="Freemind_Link_43083883" MODIFIED="1172489545651" POSITION="right" TEXT="SRP Data Structure"> 10 <node CREATED="1170079621592" FOLDED="true"ID="Freemind_Link_1297017754" MODIFIED="1170079640872" TEXT="Campus">10 <node CREATED="1170079621592" ID="Freemind_Link_1297017754" MODIFIED="1170079640872" TEXT="Campus"> 11 11 <node CREATED="1171710559043" ID="Freemind_Link_1592396213" MODIFIED="1171710565212" TEXT="Id: campus"/> 12 12 <node CREATED="1170079643589" FOLDED="true" ID="Freemind_Link_1231068129" MODIFIED="1171710686426" TEXT="Academic Section"> … … 48 48 </node> 49 49 </node> 50 <node CREATED="1170082138244" FOLDED="true"ID="Freemind_Link_1354366927" MODIFIED="1171710679266" TEXT="Student Section">50 <node CREATED="1170082138244" ID="Freemind_Link_1354366927" MODIFIED="1171710679266" TEXT="Student Section"> 51 51 <node CREATED="1171709784119" ID="_" MODIFIED="1171709937449" TEXT="Type: StudentsFolder" VSHIFT="104"/> 52 52 <node CREATED="1171710545564" ID="Freemind_Link_221165828" MODIFIED="1171710551332" TEXT="Id: students"/> 53 <node CREATED="1170082147831" FOLDED="true"ID="Freemind_Link_115332414" MODIFIED="1171709774415" TEXT="{Student}">53 <node CREATED="1170082147831" ID="Freemind_Link_115332414" MODIFIED="1171709774415" TEXT="{Student}"> 54 54 <node CREATED="1171114205479" ID="Freemind_Link_1051911128" LINK="../profiles/default/types/Student.xml" MODIFIED="1171353141707" TEXT="Type: Student"/> 55 55 <node CREATED="1171124926993" ID="Freemind_Link_1838352082" LINK="../profiles/default/schemas/student.xml" MODIFIED="1171353152905" TEXT="Schema: student"/> … … 171 171 </node> 172 172 </node> 173 <node CREATED="1170082392807" FOLDED="true"ID="Freemind_Link_1979443941" MODIFIED="1171711179966" TEXT="Study Course">173 <node CREATED="1170082392807" ID="Freemind_Link_1979443941" MODIFIED="1171711179966" TEXT="Study Course"> 174 174 <node CREATED="1170930140692" ID="Freemind_Link_607082969" MODIFIED="1171009488850" TEXT="Id: study_course"/> 175 175 <node CREATED="1170930264337" ID="Freemind_Link_1384807180" LINK="../profiles/default/types/StudentStudyCourse.xml" MODIFIED="1172159914623" TEXT="Type: StudentStudyCourse"/> -
WAeUP_SRP/branches/uli/exportimport.py
r1515 r1653 90 90 roles=('SectionReader',)) 91 91 students.manage_setLocalGroupRoles(groupid = 'CourseAdvisers', 92 roles=('SectionReader',)) 92 roles=('SectionReader',)) 93 93 students.manage_setLocalGroupRoles(groupid='MemberAdmins', 94 94 roles=('SectionOfficer',)) … … 120 120 importWAeUPTable(site.courses_catalog, '', context,'courses_catalog') 121 121 importWAeUPTable(site.payments_catalog, '', context,'payments_catalog') 122 importWAeUPTable(site.online_payments_import, '', context,'online_payments_import') 122 123 importWAeUPTable(site.portal_pins, '', context,'pins') 123 124 importWAeUPTable(site.portal_pumeresults, '', context,'pumeresults') -
WAeUP_SRP/branches/uli/profiles/default/actions.xml
r1474 r1653 177 177 <action title="Change Password" action_id="change_password" 178 178 category="student" condition_expr="member" 179 url_expr="string:${portal_url}/change_password" visible=" True">179 url_expr="string:${portal_url}/change_password" visible="False"> 180 180 <permission>View</permission> 181 181 </action> -
WAeUP_SRP/branches/uli/profiles/default/courses_catalog.xml
r1410 r1653 1 1 <?xml version="1.0"?> 2 2 <?xml-stylesheet type="text/xsl" href="catalog.xsl"?> 3 <object name="courses_catalog" meta_type=" WAeUP Table">3 <object name="courses_catalog" meta_type="CMF Catalog"> 4 4 <column value="code"/> 5 5 <column value="faculty"/> -
WAeUP_SRP/branches/uli/profiles/default/layouts/student_change_password.xml
r1474 r1653 35 35 <property name="hidden_readonly_layout_modes"/> 36 36 <property name="password_widget"></property> 37 <property name="check_digit"> False</property>37 <property name="check_digit">True</property> 38 38 <property name="size_min">6</property> 39 39 <property name="size_max">10</property> -
WAeUP_SRP/branches/uli/profiles/default/schemas/payment.xml
r1399 r1653 6 6 <field name="type_description" meta_type="CPS String Field" > 7 7 <property name="is_searchabletext">True</property> 8 </field> <field name="order_id" meta_type="CPS String Field"/>8 </field> 9 9 <field name="amount" meta_type="CPS String Field"/> 10 10 <field name="resp_pay_reference" meta_type="CPS String Field"/> -
WAeUP_SRP/branches/uli/profiles/default/schemas/student_study_level.xml
r1399 r1653 4 4 <field name="code" meta_type="CPS String Field"/> 5 5 <field name="session" meta_type="CPS String Field"/> 6 <field name="gpa" meta_type="CPS Float Field"/>7 <field name="status" meta_type="CPS String Field"/>8 6 <field name="verdict" meta_type="CPS String Field"/> 9 <field name="imported_gpa" meta_type="CPS Float Field"/> 7 <field name="validated_by" meta_type="CPS String Field"/> 8 <field name="validation_date" meta_type="CPS DateTime Field"/> 10 9 </object> -
WAeUP_SRP/branches/uli/profiles/default/students_catalog.xml
r1403 r1653 19 19 </index> 20 20 <index name="jamb_reg_no" meta_type="FieldIndex"> 21 <indexed_attr value=" student_application:jamb_reg_no"/>21 <indexed_attr value="jamb_reg_no"/> 22 22 </index> 23 23 <index name="matric_no" meta_type="FieldIndex"> 24 <indexed_attr value=" student_clearance:matric_no"/>24 <indexed_attr value="matric_no"/> 25 25 </index> 26 26 <index name="faculty" meta_type="KeywordIndex"> … … 28 28 </index> 29 29 <index name="entry_mode" meta_type="KeywordIndex"> 30 <indexed_attr value=" student_application:entry_mode"/>30 <indexed_attr value="entry_mode"/> 31 31 </index> 32 32 <index name="department" meta_type="KeywordIndex"> … … 34 34 </index> 35 35 <index name="level" meta_type="KeywordIndex"> 36 <indexed_attr value=" student_study_course:current_level"/>36 <indexed_attr value="current_level"/> 37 37 </index> 38 38 <index name="verdict" meta_type="KeywordIndex"> 39 <indexed_attr value=" student_study_course:current_verdict"/>39 <indexed_attr value="current_verdict"/> 40 40 </index> 41 41 <index name="course" meta_type="KeywordIndex"> 42 <indexed_attr value="stud ent_study_course:study_course"/>42 <indexed_attr value="study_course"/> 43 43 </index> 44 44 </object> -
WAeUP_SRP/branches/uli/profiles/default/toolset.xml
r1151 r1653 7 7 <required tool_id="payments_catalog" 8 8 class="Products.WAeUP_SRP.WAeUPTables.PaymentsCatalog"/> 9 <required tool_id="online_payments_import" 10 class="Products.WAeUP_SRP.WAeUPTables.OnlinePaymentsImport"/> 9 11 <required tool_id="portal_pins" 10 12 class="Products.WAeUP_SRP.WAeUPTables.PinTable"/> -
WAeUP_SRP/branches/uli/profiles/default/workflows/waeup_student_subobject_wf/definition.xml
r1515 r1653 9 9 <permission>Modify portal content</permission> 10 10 <permission>View</permission> 11 <permission>View</permission> 11 12 <state state_id="closed" title=""> 13 <exit-transition transition_id="create_content"/> 12 14 <exit-transition transition_id="open"/> 13 15 <permission-map name="Add portal content" acquired="True"> … … 103 105 new_state="closed" trigger="USER" 104 106 before_script="" after_script=""> 105 107 106 108 <guard> 107 109 <guard-role>SectionOfficer</guard-role> … … 115 117 new_state="content_addable" trigger="USER" 116 118 before_script="" after_script=""> 117 119 118 120 <guard> 119 121 <guard-role>SectionOfficer</guard-role> … … 127 129 new_state="created" trigger="USER" 128 130 before_script="" after_script=""> 129 131 130 132 <guard> 131 133 </guard> … … 136 138 new_state="" trigger="USER" before_script="" 137 139 after_script=""> 138 140 139 141 <guard> 140 142 </guard> … … 144 146 new_state="opened" trigger="USER" 145 147 before_script="" after_script=""> 146 148 147 149 <guard> 148 150 <guard-role>SectionOfficer</guard-role> -
WAeUP_SRP/branches/uli/skins/waeup_academics/getCertificateInfo.py
r913 r1653 18 18 19 19 info = {} 20 info['action'] = "%s" % context. campus.absolute_url()20 info['action'] = "%s" % context.absolute_url() 21 21 info['choosen_ids'] = request.get('ids',[]) 22 22 info['doc'] = context.getContent() -
WAeUP_SRP/branches/uli/skins/waeup_academics/getLevelInfo.py
r1514 r1653 16 16 wf = context.portal_workflow 17 17 mtool = context.portal_membership 18 academics_path = "%s/campus/academics" % context.portal_url() 18 19 path_info = request.get('PATH_INFO').split('/') 19 20 try: … … 44 45 ro = r.getObject() 45 46 rd = ro.getContent() 46 row['id'] = r.getId47 course_id = row['id'] = r.getId 47 48 row['title'] = rd.Title() 48 49 row['core'] = rd.core_or_elective … … 50 51 row['url'] = ro.absolute_url() 51 52 row['review_state'] = wf.getInfoFor(ro,'review_state','None') 52 row['is_editable'] = mtool.checkPermission('Modify portal content', ro) 53 editable = row['is_editable'] = mtool.checkPermission('Modify portal content', ro) 54 if editable: 55 course_res = context.courses_catalog(code=course_id) 56 if course_res: 57 rc = course_res[0] 58 row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path,rc.faculty,rc.department,course_id) 53 59 if rd.semester == 'first': 54 60 first.append(row) -
WAeUP_SRP/branches/uli/skins/waeup_academics/level_view.pt
r1511 r1653 48 48 [edit] 49 49 </a> 50 <a tal:condition="row/real_course_path|nothing" 51 href="edit" tal:attributes="href string:${row/real_course_path}"> 52 [goto course] 53 </a> 50 54 </td> 51 55 </tr> -
WAeUP_SRP/branches/uli/skins/waeup_default/mail2admin.py
r976 r1653 37 37 email, 38 38 'kehindesamuel@waeup.org', 39 ' henrik@waeup.org',39 'waeup@saoas.org', 40 40 # 'js@aixtraware.de', 41 41 email, -
WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py
r1593 r1653 14 14 import logging 15 15 logger = logging.getLogger('Skins.epayment_cb') 16 from AccessControl import Unauthorized 16 17 import DateTime 17 18 if context.portal_membership.isAnonymousUser(): … … 21 22 students = context.portal_url.getPortalObject().campus.students 22 23 wftool = context.portal_workflow 24 mtool = context.portal_membership 25 member = mtool.getAuthenticatedMember() 26 member_id = str(member) 23 27 student_id = context.getStudentId() 24 if student_id is None: 28 if student_id is None or student_id != member_id: 29 logger.info('%s tried to access payment object of %s' % (member_id,student_id)) 30 referer = request.get('HTTP_REFERER','none') 31 logger.info('%s:%s illegal access, referer = %s' % (member_id,student_id,referer)) 32 real_ip = request.get('HTTP_X_REAL_IP',"none") 33 logger.info('%s:%s illegal access, real_x_ip = %s' % (member_id,student_id,real_ip)) 25 34 return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 26 35 … … 37 46 for rc,pdk in resp_codes: 38 47 pd[pdk] = request.get(rc) 39 context.getContent().edit(mapping=pd) 48 try: 49 context.getContent().edit(mapping=pd) 50 except UnAuthorized,E: 51 logger.info('%s ' % student_id) 52 40 53 #resp = pd['resp_desc'] 41 54 #if resp.startswith('Appro') and resp.endswith('essful'): … … 44 57 wftool.doActionFor(student,'pay_school_fee') 45 58 logger.info('%s received valid callback' % student_id) 59 referer = request.get('HTTP_REFERER','none') 60 logger.info('%s valid callback referer = %s' % (student_id,referer)) 61 real_ip = request.get('HTTP_X_REAL_IP',"none") 62 logger.info('%s valid callback real_ip = %s' % (student_id,real_ip)) 46 63 47 64 elif len(resp) < 3: -
WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py
r1593 r1653 53 53 else: 54 54 row['is_approvable'] = is_so and (review_state == "opened") 55 if (review_state == "closed") and so_object.resp_code in ('SC','00','AP',): 55 if so_object.type_description.startswith('School Fee'): 56 row['is_requeryable'] = (review_state == "opened") and info['review_state'] == 'cleared_and_validated' 57 else: 58 row['is_requeryable'] = is_so and (review_state == "opened") 59 if (review_state == "closed") and so_object.resp_code in ('SC','00','AP','IP',): 56 60 row['confirmed'] = 'active' 57 61 else: -
WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py
r1593 r1653 91 91 info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id) 92 92 93 logger.info('%(student_id)s initiated online school fee payment ' % info)93 logger.info('%(student_id)s initiated online school fee payment with order_id %(order_id)s and callback url %(callback_url)s' % info) 94 94 payment_fields = (('x_SiteID','site_id'), 95 95 ('x_Redirect_url','callback_url'), -
WAeUP_SRP/branches/uli/skins/waeup_epayment/payment_receipt.pt
r1427 r1653 8 8 <span tal:condition="info"> 9 9 10 <metal:block tal:condition="python:info_doc['doc'].resp_code in ('00','AP', )">10 <metal:block tal:condition="python:info_doc['doc'].resp_code in ('00','AP','IP')"> 11 11 <h3>Online Payment Receipt</h3> 12 12 <br /> … … 106 106 </metal:block> 107 107 108 <metal:block tal:condition="python:info_doc['doc'].resp_code not in ('SC','00','AP',' ')">108 <metal:block tal:condition="python:info_doc['doc'].resp_code not in ('SC','00','AP','IP','')"> 109 109 <h3>Response from Bank: "<span tal:content="python:info_doc['doc'].resp_desc" />"</h3> 110 110 <br /> -
WAeUP_SRP/branches/uli/skins/waeup_epayment/payments_view.pt
r1431 r1653 34 34 </td> 35 35 <td> 36 <a tal:condition=" python:row['is_approvable']"36 <a tal:condition="row/is_approvable" 37 37 tal:attributes="href string:${context/absolute_url}/${row/id}/approve_epayment; 38 38 onclick python:'return window.confirm(\'%s\')' %(cpsmcat('Are you sure? You will not be able to undo the approval.'), ); 39 39 "> 40 40 [approve payment] 41 </a> 42 </td> 43 <td tal:condition="nothing"> 44 <a tal:condition="row/is_requeryable" 45 tal:attributes="href string:${context/absolute_url}/${row/id}/requery_payment; 46 onclick python:'return window.confirm(\'%s\')' %(cpsmcat('Are you sure? You will not be able to undo the approval.'), ); 47 "> 48 [requery payment] 41 49 </a> 42 50 </td> … … 53 61 value="Initiate School Fee Online Payment" 54 62 /> 63 64 65 66 55 67 </form> 56 68 -
WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py
r1593 r1653 38 38 if d['title'] == 'unknown': 39 39 err = "No such course!" 40 logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id))40 #logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id)) 41 41 break 42 42 if context.hasObject(course_id): 43 43 err = "Course already exists!" 44 logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id))44 #logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id)) 45 45 break 46 46 if context.hasObject("%s_co" % course_id): 47 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))48 #logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id)) 49 49 break 50 50 break … … 54 54 #args['error'] = err 55 55 args['portal_status_message'] = err 56 url = "%s?%s" % (context.absolute_url(),urlencode(args))56 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 57 57 return request.RESPONSE.redirect(url) 58 58 … … 66 66 args['course_id'] = course_id 67 67 68 logger.info('%s added StudentCourseResult object %s ' % (member,course_id))68 logger.info('%s added StudentCourseResult object %s for %s' % (member,course_id,context.getStudentId())) 69 69 70 args = {}71 70 psm = "You successfully added course %s!" % course_id 72 71 args['portal_status_message'] = psm 73 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 72 if action_after_validate: 73 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 74 else: 75 url = context.absolute_url() + '?' + urlencode(args) 74 76 return REQUEST.RESPONSE.redirect(url) 75 77 -
WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py
r1593 r1653 4 4 5 5 """ 6 7 return 8 9 10 11 12 13 14 15 6 16 request = context.REQUEST 7 17 import DateTime,logging -
WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py
r1593 r1653 120 120 wftool.doActionFor(info['clear'],'open') 121 121 wftool.doActionFor(info['student'],'reject_clearance') 122 action = "/ contact_student_form"122 action = "/external_contact_student_form" 123 123 psm = "Student's clearance request has been rejected! Please fill and submit the form below!" 124 124 subject = "Clearance request rejected" -
WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt
r1593 r1653 28 28 <input type="hidden" name="probtype" type="text" id="probtype" 29 29 tal:attributes="value subject"/> 30 <input type="hidden" name="action" type="text" id="action" 31 tal:attributes="value continue"/> 30 32 31 33 <table width="100%" border="0" cellspacing="5" cellpadding="0"> -
WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt
r1593 r1653 19 19 20 20 <div tal:condition="validated"> 21 - validated by Course Adviser - 21 - validated by Course Adviser - 22 <span tal:condition="info/doc/validated_by|nothing" tal:omit-tag=""> 23 <span tal:replace="info/doc/validated_by" /> on <span tal:replace="info/doc/validation_date" /> 24 </span> 22 25 </div> 23 26 <div tal:condition="not: validated"> -
WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py
r1593 r1653 31 31 current_level = student.level 32 32 in_progress = request.get('in_progress','not started') 33 level_created = request.get('level_created','xxx') 34 create_level = request.get('create_level',None) 33 35 34 if context.hasObject(current_level) :35 response.redirect("%s/%s" % (context.absolute_url(),current_level))36 if context.hasObject(current_level) and create_level : 37 logger.info('%s", level %s already exists' % (student.id,current_level)) 36 38 return 37 39 38 if in_progress in ('not started','started'):39 session.set('in_progress','started')40 view = context.in_progress_view(refresh=3,page='create_level?in_progress=started')41 response.setHeader('Content-type','text/html; charset=ISO-8859-15')42 response.setHeader('Content-length','%d' % (len(view)))43 response.setStatus('OK')44 response.write(view)45 response.write('')46 if in_progress == 'started':47 return40 ##if in_progress in ('not started','started'): 41 ## session.set('in_progress','started') 42 ## view = context.in_progress_view(refresh=20,page='create_level?in_progress=started') 43 ## response.setHeader('Content-type','text/html; charset=ISO-8859-15') 44 ## response.setHeader('Content-length','%d' % (len(view))) 45 ## response.setStatus('OK') 46 ## response.write(view) 47 ## response.write('') 48 ## if in_progress == 'started': 49 ## return 48 50 49 50 context.invokeFactory('StudentStudyLevel',"%s" % current_level) 51 level = getattr(context,"%s" % current_level) 52 context.portal_workflow.doActionFor(level,'open') 53 study_session = context.getSessionString() 54 level.getContent().edit(mapping={'session': study_session}) 55 context.portal_workflow.doActionFor(level,'close_for_edit') 51 if level_created == current_level: 52 level = getattr(context,"%s" % current_level) 53 else: 54 context.invokeFactory('StudentStudyLevel',"%s" % current_level) 55 level = getattr(context,"%s" % current_level) 56 context.portal_workflow.doActionFor(level,'open') 57 study_session = context.getSessionString() 58 level.getContent().edit(mapping={'session': study_session}) 59 context.portal_workflow.doActionFor(level,'close_for_edit') 60 response.redirect("%s?level_created=%s" % (context.absolute_url(),current_level)) 56 61 results = context.results_import(matric_no = student.matric_no) 57 62 if results: … … 90 95 context.portal_workflow.doActionFor(course_result,'open') 91 96 course_result.getContent().edit(mapping=d) 92 res = context.portal_catalog(portal_type="Certificate", id = cert_id) 93 l = [] 94 if res: 95 cert = res[0] 96 path = cert.getPath() 97 query = Eq("path",path) &\ 98 Eq('portal_type','CertificateCourse') &\ 99 Eq('SearchableText', "%s" % student.level) 100 courses = aq_portal(query) 101 for c in courses: 102 d = context.getCourseInfo(c.getId) 103 cr_id = level.invokeFactory('StudentCourseResult',c.getId) 104 course_result = getattr(level,cr_id) 105 context.portal_workflow.doActionFor(course_result,'open') 106 d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 107 course_result.getContent().edit(mapping=d) 108 return 97 level['create_course_results'](cert_id,current_level) 98 ##res = context.portal_catalog(portal_type="Certificate", id = cert_id) 99 ##l = [] 100 ##if res: 101 ## cert = res[0] 102 ## path = cert.getPath() 103 ## #set_trace() 104 ## query = Eq("path","%s/%s" % (path,current_level)) &\ 105 ## Eq('portal_type','CertificateCourse') 106 ## courses = aq_portal(query) 107 ## for c in courses: 108 ## d = context.getCourseInfo(c.getId) 109 ## cr_id = level.invokeFactory('StudentCourseResult',c.getId) 110 ## course_result = getattr(level,cr_id) 111 ## context.portal_workflow.doActionFor(course_result,'open') 112 ## d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective') 113 ## course_result.getContent().edit(mapping=d) 114 115 return response.redirect("%s/%s" % (context.absolute_url(),current_level)) 116 -
WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py
r1593 r1653 14 14 15 15 from Products.CMFCore.utils import getToolByName 16 from AccessControl import Unauthorized 17 16 18 here = context 17 19 from urllib import urlencode … … 30 32 real_ids.append(id) 31 33 if real_ids: 32 context.manage_delObjects(real_ids) 33 logger.info('%s deleted StudentCourseResult object %s' % (member,id)) 34 message = 'psm_item(s)_deleted' 34 try: 35 context.manage_delObjects(real_ids) 36 logger.info('%s deleted StudentCourseResult object %s for %s' % (member,id,context.getStudentId())) 37 message = 'psm_item(s)_deleted' 38 except Unauthorized: 39 logger.info('%s has no permission to delete StudentCourseResult objects for %s' % (member,context.getStudentId())) 40 message = 'no item(s) deleted' 35 41 else: 36 42 message = 'psm_select_at_least_one_document' 37 43 38 44 args = {} 39 45 args['portal_status_message'] = message 40 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 46 47 if action_after_validate: 48 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 49 else: 50 url = context.absolute_url() + '?' + urlencode(args) 41 51 if REQUEST is not None: 42 return REQUEST.RESPONSE.redirect(url) 52 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py
r1593 r1653 101 101 #set_trace() 102 102 verdict_voc = context.portal_vocabularies.verdicts 103 verdict_code = student_from_cat. get('verdict',None)103 verdict_code = student_from_cat.verdict 104 104 if verdict_code: 105 105 info['verdict'] = verdict = verdict_voc.get(verdict_code,'N/A').upper() -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py
r1593 r1653 25 25 info = {} 26 26 info['is_so'] = context.isSectionOfficer() 27 info['action'] = "%s" % context. campus.absolute_url()27 info['action'] = "%s" % context.absolute_url() 28 28 info['choosen_ids'] = request.get('ids',[]) 29 29 course = info['doc'] = context.getContent() … … 57 57 may_register = (student_review_state in ('school_fee_paid',)) and\ 58 58 current_level not in levels and\ 59 (sbrain.verdict in ('A','B' ) or sbrain.jamb_reg_no.startswith('6'))59 (sbrain.verdict in ('A','B','C') or sbrain.jamb_reg_no.startswith('6')) 60 60 61 61 levels.sort() -
WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py
r1593 r1653 40 40 return 0.0 41 41 42 def cmp_semester(a,b): 43 if a['semester'] == b['semester']: 42 def cmp_semester_id(a,b): 43 s1 = "%(semester)s%(id)s" % a 44 s2 = "%(semester)s%(id)s" % b 45 if s1 == s2: 44 46 return 0 45 if a['semester'] > b['semester']:47 if s1 > s2: 46 48 return 1 47 49 return -1 … … 104 106 normal.append(d) 105 107 info['credits_total'] = credits_total 106 carry_overs.sort(cmp_semester )108 carry_overs.sort(cmp_semester_id) 107 109 info['carry_overs'] = carry_overs 108 normal.sort(cmp_semester )110 normal.sort(cmp_semester_id) 109 111 info['normal'] = normal 110 112 -
WAeUP_SRP/branches/uli/skins/waeup_student/layout_personal_view.pt
r1201 r1653 9 9 <td><span class="dlabel">Student ID</span>: 10 10 </td> 11 <td tal:condition="nothing">11 <td> 12 12 <span tal:replace="context/getStudentId" /> 13 13 </td> -
WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py
r1593 r1653 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None 7 ##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None, action=None 8 8 ##title= 9 9 ## 10 10 # $Id: mail2admin.py 869 2006-11-15 13:46:49Z henrik $ 11 12 from urllib import urlencode 11 13 12 14 mhost = context.MailHost … … 27 29 #prop.email_from_address should be used for To: 28 30 REQUEST = context.REQUEST 29 url_tuple = REQUEST.HTTP_REFERER.split('?') 30 if len(url_tuple) == 2: 31 url_tuple[1] ='portal_status_message=Your message has been sent!' 32 else: 33 url_tuple.append('portal_status_message=Your message has been sent!') 34 redirect_url = "?".join(url_tuple) 35 REQUEST.set('rurl', redirect_url) # to see the result in the error log 31 32 #url_tuple = REQUEST.HTTP_REFERER.split('?') 33 #if len(url_tuple) == 2: 34 # url_tuple[1] ='portal_status_message=Your message has been sent!' 35 #else: 36 # url_tuple.append('portal_status_message=Your message has been sent!') 37 #redirect_url = "?".join(url_tuple) 38 #REQUEST.set('rurl', redirect_url) # to see the result in the error log 39 36 40 msg = message % ( 37 41 co_name, … … 39 43 student_email, 40 44 co_email, 41 ' henrik@waeup.org',45 'waeup@saoas.org', 42 46 # 'js@aixtraware.de', 43 47 co_email, … … 47 51 mhost.send(msg) 48 52 49 REQUEST = context.REQUEST50 RESPONSE = REQUEST.RESPONSE51 53 52 RESPONSE.redirect(redirect_url) 54 #REQUEST = context.REQUEST 55 #RESPONSE = REQUEST.RESPONSE 56 #RESPONSE.redirect(redirect_url) 57 58 args = {} 59 psm = "Your message has been sent!" 60 args['portal_status_message'] = psm 61 if action: 62 url = context.absolute_url() + '/' + action + '?' + urlencode(args) 63 else: 64 url = context.absolute_url() +'?' + urlencode(args) 65 return REQUEST.RESPONSE.redirect(url) 66 67 68 -
WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py
r1593 r1653 112 112 psm = "Course list updated!" 113 113 args['portal_status_message'] = psm 114 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 114 if action_after_validate: 115 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 116 else: 117 url = context.absolute_url() + '?' + urlencode(args) 115 118 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py
r1593 r1653 19 19 pass 20 20 21 from urllib import urlencode 21 from urllib import urlencode 22 22 23 23 request = context.REQUEST … … 47 47 psm = "You successfully submitted your course list!" 48 48 args['portal_status_message'] = psm 49 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 49 if action_after_validate: 50 url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) 51 else: 52 url = context.absolute_url() + '?' + urlencode(args) 50 53 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py
r1593 r1653 46 46 args['continue'] = action_after_validate 47 47 args['portal_status_message'] = psm 48 url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args) 48 if action_after_reject: 49 url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args) 50 else: 51 url = context.absolute_url() + '?' + urlencode(args) 49 52 return REQUEST.RESPONSE.redirect(url) -
WAeUP_SRP/branches/uli/skins/waeup_student/statistics_new_view.pt
r1532 r1653 33 33 <th align="right">CR</th> 34 34 <th align="right">VC</th> 35 <th align="right">SFP </th>35 <th align="right">SFP+</th> 36 36 </tr> 37 37 <tr tal:repeat="d departments" … … 74 74 <tr><td>CR: </td> <td>Clearance requested</td></tr> 75 75 <tr><td>VC: </td> <td>Validated and cleared</td></tr> 76 <tr><td>SFP : </td> <td>School fee paid</td></tr>76 <tr><td>SFP+: </td> <td>School fee paid and further</td></tr> 77 77 </table> 78 78 </span> -
WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt
r1593 r1653 34 34 <th >Faculty</th> 35 35 <th align="right">RET</th> 36 <th align="right">SFP </th>36 <th align="right">SFP+</th> 37 37 </tr> 38 38 <tr tal:define="d python:departments[0]" … … 60 60 <table> 61 61 <tr><td>RET:</td> <td>Returning students who have logged in</td></tr> 62 <tr><td>SFP:</td> <td>Returning students who alreadypaid their school fee</td></tr>62 <tr><td>SFP:</td> <td>Returning students who paid their school fee</td></tr> 63 63 </table> 64 64 </span> -
WAeUP_SRP/branches/uli/skins/waeup_student/study_course_view.pt
r1518 r1653 66 66 tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')"> 67 67 <td align="left" valign="middle" style="width: 5px;" 68 tal:condition="python: 0 andis_so">68 tal:condition="python:is_so"> 69 69 <input type="checkbox" name="ids:list" value="" id="" class="noborder" 70 70 tal:condition="is_so" … … 84 84 summary="contents of the folder" 85 85 class="folderButtons"> 86 <tr >86 <tr tal:condition="python: is_so and info['items']"> 87 87 <td align="left" valign="top" rowspan="3"></td> 88 88 <td align="left" valign="top"> 89 <span tal:condition="python:0 and is_so"> 90 <input type="button" value="button_select_all" class="context" 89 <input type="button" value="button_select_all" class="context" 91 90 onclick="someJavaScriptFunctionThatWillBeReplaced" 92 91 i18n:attributes="value" … … 94 93 % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))" 95 94 /> 96 <input type="submit" name="folder_delete:method" value="button_delete" 97 class="destructive" i18n:attributes="value" 98 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 99 (cpsmcat('description_confirm_delete'), )" 100 /> 101 </span> 95 <input type="submit" name="folder_delete:method" value="button_delete" 96 class="destructive" i18n:attributes="value" 97 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 98 (cpsmcat('description_confirm_delete'), )" 99 /> 102 100 </td> 103 101 </tr> -
WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt
r1593 r1653 64 64 <br /> 65 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! 66 <font color="red">Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!</font> 67 <br /><br /> 67 68 </div> 68 69 <table class="contentListing" width="100%" id="folder_content" … … 109 110 class="context" value="Update" 110 111 /> 112 113 111 114 <br /><br /> 112 115 <input tal:condition="info/normal" 113 116 type="submit" name="register_courses:method" 114 117 class="context" value="Submit" /> 118 119 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 120 tal:attributes="value string:study_level_view"/> 121 122 <br /><br /> 123 124 <strong>Note:</strong> 'Update' checks for all courses in your certificate and will add them to your course list irrespective of 125 prior deletion, i.e. already deleted courses will show up again. 126 127 Please use this function only if you are sure that your faculty has added courses which are not yet on your course list. 128 115 129 </td> 116 130 </tr> … … 142 156 <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method" 143 157 class="context" value="Reject" /> 158 159 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 160 tal:attributes="value string:study_level_view"/> 161 <input type="hidden" name="action_after_reject" type="text" id="action_after_reject" 162 tal:attributes="value string:contact_student_form"/> 144 163 145 164 </td> … … 176 195 177 196 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 178 tal:attributes="value string: /study_level_view"/>197 tal:attributes="value string:study_level_view"/> 179 198 <input type="hidden" name="action_after_reject" type="text" id="action_after_reject" 180 tal:attributes="value string: /contact_student_form"/>199 tal:attributes="value string:contact_student_form"/> 181 200 182 201 … … 199 218 /> 200 219 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate" 201 tal:attributes="value string: /study_level_view"/>220 tal:attributes="value string:study_level_view"/> 202 221 </td> 203 222 </table> -
WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py
r1593 r1653 13 13 """ 14 14 from Products.CMFCore.WorkflowCore import WorkflowException 15 import DateTime 16 current = DateTime.DateTime() 15 17 try: 16 18 from Products.zdb import set_trace … … 30 32 student_id = context.getStudentId() 31 33 student = getattr(students_folder,student_id) 34 level_doc = context.getContent() 35 if level_doc.portal_type == 'StudentStudyLevel': 36 level_doc.edit(mapping={'validated_by': member_id, 37 'validation_date': current,}) 32 38 try: 33 39 wftool.doActionFor(student,'validate_courses')
Note: See TracChangeset for help on using the changeset viewer.