Changeset 511 for WAeUP_SRP/trunk
- Timestamp:
- 13 Sep 2006, 06:47:55 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r502 r511 22 22 MAX_TRANS = 1000 23 23 24 def generateStudentId( ):24 def generateStudentId(letter): 25 25 import random 26 26 r = random 27 return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) 27 if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): 28 letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') 29 return "%c%d" % (letter,r.randint(99999,1000000)) 30 #return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) 28 31 29 32 def getStudentByRegNo(self,reg_no): … … 294 297 import transaction 295 298 tr_count = 0 296 name = 'SampleJAMBDataII' 299 name = 'SampleJAMBDataII_short' 300 wftool = self.portal_workflow 297 301 no_import = False 298 302 if not no_import: … … 317 321 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) 318 322 continue 319 sid = generateStudentId() 323 jamb_name = jamb.get("NAME") 324 names = jamb_name.split() 325 letter = names[-1][0].upper() 326 sid = generateStudentId(letter) 320 327 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 321 328 not_created = True … … 325 332 not_created = False 326 333 except BadRequest: 327 sid = generateStudentId( )334 sid = generateStudentId(letter) 328 335 logger.info('%(tr_count)s: Creating Student with ID %(sid)s REG-NO %(jamb_reg_no)s ' % vars()) 329 s = getattr(self,sid) 330 self.portal_registration.addMember(sid, 331 'uNsEt' , 332 roles=('Member', 333 'Student',)) 334 s.invokeFactory('StudentApplication','application') 336 student = getattr(self,sid) 337 student.invokeFactory('StudentApplication','application') 335 338 da = {'Title': 'Application Data'} 336 ## s.invokeFactory('StudentPersonal','personal')337 ## sp = s.personal338 ## d = {'Title': 'Personal Data'}339 ## s.invokeFactory('StudentClearance','clearance')340 ## sc = s.clearance341 ## dc = {'Title': 'Clearance Data'}342 339 da["jamb_reg_no"] = jamb.get("REG-NO") 343 da["jamb_lastname"] = jamb.get("NAME") 344 ## d["lastname"] = jamb.get("NAME") 340 da["jamb_lastname"] = jamb_name 345 341 da["jamb_sex"] = jamb.get("SEX") 346 342 da["jamb_state"] = jamb.get("STATE") … … 351 347 da["jamb_first_uni"] = jamb.get("UNIV1") 352 348 da["jamb_second_uni"] = jamb.get("UNIV2") 353 ## s.personal.getContent().edit(mapping=d) 354 s.application.getContent().edit(mapping=da) 355 s.application.getContent().content_status_modify(workflow_action="open") 356 s.application.manage_setLocalRoles(s_id, ['Owner',]) 349 app = student.application 350 app_doc = app.getContent() 351 app_doc.edit(mapping=da) 352 wftool.doActionFor(app,'open',dest_container=app) 353 app.manage_setLocalRoles(sid, ['Owner',]) 354 student.getContent().createSubObjects() 357 355 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 358 356 ###) 359 357 360 358 359 security.declareProtected(View,"fixOwnership") 360 def fixOwnership(self): 361 """fix Ownership""" 362 for s in self.portal_catalog(meta_type = 'Student'): 363 student = s.getObject() 364 sid = s.getId 365 import pdb;pdb.set_trace() 366 student.application.manage_setLocalRoles(sid, ['Owner',]) 367 student.personal.manage_setLocalRoles(sid, ['Owner',]) 368 361 369 security.declareProtected(View,"Title") 362 370 def Title(self): … … 393 401 return "%s" % (content.jamb_lastname) 394 402 return self.title 403 404 security.declarePrivate('makeStudentMember') ###( 405 def makeStudentMember(self,sid,password='uNsEt'): 406 """make the student a member""" 407 membership = self.portal_membership 408 membership.addMember(sid, 409 password , 410 roles=('Member', 411 'Student', 412 'Owner'), 413 domains='', 414 properties = None,) 415 member = membership.getMemberById(sid) 416 self.portal_registration.afterAdd(member, sid, password, None) 417 self.manage_setLocalRoles(sid, ['Owner',]) 418 419 ###) 420 421 security.declareProtected(View,'createSubObjects') ###( 422 def createSubObjects(self): 423 """make the student a member""" 424 dp = {'Title': 'Personal Data'} 425 names = self.application.getContent().jamb_lastname.split() 426 if len(names) == 3: 427 dp['firstname'] = names[0].capitalize() 428 dp['middlename'] = names[1].capitalize() 429 dp['lastname'] = names[2].capitalize() 430 elif len(names) == 2: 431 dp['firstname'] = names[0].capitalize() 432 dp['lastname'] = names[1].capitalize() 433 else: 434 dp['lastname'] = app_doc.jamb_lastname 435 dp['sex'] = app_doc.jamb_sex == 'F' 436 dp['lga'] = "%s/%s" % (app_doc.jamb_state,app_doc.jamb_lga ) 437 proxy = self.aq_parent 438 proxy.invokeFactory('StudentPersonal','personal') 439 per = proxy.personal 440 per_doc = per.getContent() 441 per.manage_setLocalRoles(self.getId(), ['Owner',]) 442 self.portal_workflow.doActionFor(per,'open',dest_container=per) 443 per_doc.edit(mapping = dp) 444 445 ###) 395 446 396 447 InitializeClass(Student) -
WAeUP_SRP/trunk/Widgets.py
r502 r511 316 316 pin = "%(p)s%(b)s%(n)s" % vars() 317 317 ref = datastructure[self.reference] 318 import pdb;pdb.set_trace()318 #import pdb;pdb.set_trace() 319 319 ok = pins.searchAndSetRecord(pin,ref) 320 320 while 1: … … 333 333 if ok == 2: 334 334 break 335 student.getContent().makeStudentMember(s_id,password=pin[4:]) 336 #student.getContent().createSubObjects() 335 337 break 336 338 if err: -
WAeUP_SRP/trunk/__init__.py
r488 r511 11 11 from Products.CPSCore.interfaces import ICPSSite 12 12 13 import PatchCPSWorkflowWorkflowDefinition 14 import PatchCatalogToolXMLAdapter 13 15 # Only for CPS 3.4.1. In 3.4.2 and later this should be fixed. 14 16 import PatchCPSDefaultImportExport 15 import PatchCatalogToolXMLAdapter16 17 17 18 import Products.WAeUP_SRP.WAeUPPermissions -
WAeUP_SRP/trunk/profiles/default/rolemap.xml
r502 r511 2 2 <rolemap> 3 3 <roles> 4 <role name="Staff"/> 4 5 <role name="Student"/> 5 6 <role name="SectionReader"/> -
WAeUP_SRP/trunk/skins/waeup_default/process_waeup_login.py
r506 r511 13 13 if "Manager" in member.getRoles(): 14 14 return 15 return16 15 member_id = str(member) 17 16 student = getattr(context.students,member_id) 18 17 application = student.application 19 student.invokeFactory('StudentPersonal','personal')20 apdoc = application.getContent()21 names = apdoc.jamb_lastname.split()22 dp = {}23 if len(names) == 3:24 dp['firstname'] = names[0].capitalize()25 dp['middlename'] = names[1].capitalize()26 dp['lastname'] = names[2].capitalize()27 elif len(names) == 2:28 dp['firstname'] = names[0].capitalize()29 dp['lastname'] = names[1].capitalize()30 else:31 dp['lastname'] = apdoc.jamb_lastname32 dp['sex'] = apdoc.jamb_sex == 'F'33 dp['lga'] = "%s/%s" % (apdoc.jamb_state,apdoc.jamb_lga )34 student.personal.getContent().edit(mapping = dp)35 18 ##student.content_status_modify(workflow_action="enter_application_pin") 36 37 19 da = {} 38 da['app_ac_pin'] = request.get('pin') 20 pin = request.get('pin') 21 da['app_ac_pin'] = pin 39 22 da['app_ac_date'] = current 40 apdoc.edit(mapping = da) 41 23 application.getContent().edit(mapping = da) 42 24 return response.redirect("%s/application_form" % student.application.absolute_url()) 43 44 ##ma = getattr(context,member_id)45 ##jkw = {'application_sc_pin': sc_pin}46 ##jamb = getattr(ma,'JAMB')47 ##jamb.getContent().edit(mapping=jkw)48 ###pdid = 'personal%s' % member_id49 ##pdid = 'PERSONAL'50 ##ma.invokeFactory('StudentPersonal', pdid)51 ##pd = getattr(ma,pdid)52 ##pkw = {}53 ##jc = jamb.getContent()54 ##pkw['sex'] = getattr(jc,'sex')55 ##pkw['firstname'] = getattr(jc,'firstname')56 ##pkw['middlename'] = getattr(jc,'middlename')57 ##pkw['lastname'] = getattr(jc,'lastname')58 ##pkw['aggregate'] = getattr(jc,'aggregate')59 ##pkw['faculty'] = getattr(jc,'faculty')60 ##pkw['course'] = getattr(jc,'course')61 ##pkw['age'] = getattr(jc,'age')62 ##pkw['jamb_results'] = getattr(jc,'exam_results')63 ##pkw['jamb_aggregate'] = getattr(jc,'aggregate')64 ##pkw['jamb_listing_date'] = getattr(jc,'listing_date')65 ##pkw['state'] = getattr(jc,'state')66 ##67 ##pd.getContent().edit(mapping=pkw)68 ##context.notifyCPSDocumentCreation(ob=pd)69 ##70 ##pdid = 'DOCUMENTS'71 ##ma.invokeFactory('StudentDocuments', pdid)72 ##pd = getattr(ma,pdid)73 ##context.notifyCPSDocumentCreation(ob=pd)74 ##75 ##pdid = 'ELIGIBILITY'76 ##ma.invokeFactory('StudentEligibility', pdid)77 ##pd = getattr(ma,pdid)78 ##pd.getContent().edit(mapping=pkw)79 ##context.notifyCPSDocumentCreation(ob=pd)80 ##81 ###return ma.personal_addon(REQUEST=context.REQUEST)82 -
WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py
r502 r511 45 45 elif psm == 'valid': 46 46 s_id = ds.get('s_id') 47 pin = str(ds.get('app_ac_pin')) 47 48 return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" 48 % (context.absolute_url(),s_id, 'uNsEt',ds.get('app_ac_pin')))49 % (context.absolute_url(),s_id,pin.split('-')[2],pin)) 49 50 50 51 ## jamb_id = ds.get('jamb_reg_no') -
WAeUP_SRP/trunk/skins/waeup_student/portlet_student_workflow_display.pt
r509 r511 13 13 <table class="registration"> 14 14 15 <span tal:condition="python:1"> 16 <tr> 17 <td class="active"><a href="apply" 18 tal:attributes="href string:${context/absolute_url}/students/apply_admission"> 19 Apply for PUME</a></td> 20 </tr> 21 </span> 15 22 <span tal:condition="python:path('info/review_state')=='application_pin_entered'"> 16 23 <tr><td class="active">Admission started</td></tr>
Note: See TracChangeset for help on using the changeset viewer.