Changeset 742
- Timestamp:
- 24 Oct 2006, 16:32:10 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 4 added
- 10 edited
- 2 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r727 r742 125 125 student_obj = getattr(self,sid) 126 126 access_code = "%d" % random.randint(1000000000,9999999999) 127 self.portal_registration.addMember(sid, 128 access_code , 129 roles=('Member', 130 'Student',)) 127 student_obj.getContent().addMember(sid,access_code ,) 131 128 pwl_dict = {'student_id': sid,'access_code':access_code} 132 129 student_obj.invokeFactory('StudentApplication','application') … … 220 217 pwlist.append(pwl_template.substitute(pwl_dict)) 221 218 wftool.doActionFor(student_obj,'clear_and_validate') 219 student_obj.manage_setLocalRoles(sid, ['Owner',]) 222 220 wftool.doActionFor(application,'close') 221 application.manage_setLocalRoles(sid, ['Owner',]) 223 222 wftool.doActionFor(clearance,'close') 223 clearance.manage_setLocalRoles(sid, ['Owner',]) 224 224 wftool.doActionFor(personal,'close') 225 personal.manage_setLocalRoles(sid, ['Owner',]) 225 226 wftool.doActionFor(studycourse,'close_for_edit') 227 studycourse.manage_setLocalRoles(sid, ['Owner',]) 228 open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist)) 229 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) 230 ###) 231 232 security.declareProtected(ModifyPortalContent,"loadPumeResultsFromCSV")###( 233 def loadPumeResultsFromCSV(self): 234 """load Fulltime Studentdata from CSV values""" 235 import transaction 236 import random 237 tr_count = 0 238 name = 'pume_results' 239 no_import = False 240 if not no_import: 241 no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w") 242 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') 243 logger = logging.getLogger('%s_import' % name) 244 logger.info('Start loading from %s.csv' % name) 245 pwlist = [] 246 pwlist.append('"student_id","firstname","middlename","lastname","jamb_reg_no","access_code"') 247 pwl_template = Template('"$student_id","$firstname","$middlename","$lastname","$jamb_reg_no","$access_code"') 248 students_folder = self.portal_catalog({'meta_type': 'StudentsFolder'})[-1].getObject() 249 try: 250 students = csv.DictReader(open("%s/import/%s.csv" % (i_home,name),"rb")) 251 except: 252 logger.error('Error reading %s.csv' % name) 253 return 254 l = self.portal_catalog({'meta_type': "StudentClearance",}) 255 matrics = [] 256 for s in l: 257 matrics.append(s.getObject().getContent().matric_no) 258 print matrics 259 l = self.portal_catalog({'meta_type': "Certificate"}) 260 certs = {} 261 for c in l: 262 ca,ac,fa,dep_id,co,certcode = c.relative_path.split('/') 263 cid = "%(dep_id)s_%(certcode)s" % vars() 264 certs[cid] = c.getObject() 265 for student in students: 266 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) 267 sid = student.get('MatricNo') 268 if sid == "": 269 em = 'Empty MatricNo\n' 270 logger.info(em) 271 no_import.write(em) 272 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) 273 continue 274 certcode = makeCertificateCode(student.get('CourseMajor')) 275 dep_id = student.get('Dept') 276 fac_id = student.get('Faculty') 277 cid = "%(dep_id)s_%(certcode)s" % vars() 278 if cid not in certs.keys(): 279 em = 'Certificate with ID %s %s not found\n' % (certcode, student.get('CourseMajor')) 280 logger.info(em) 281 no_import.write(em) 282 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) 283 continue 284 certificate_doc = certs[cid].getContent() 285 level = student.get('StudentLevel') 286 try: 287 int(level) 288 except: 289 em = 'Student with ID %(MatricNo)s StudentLevel is empty\n' % student 290 logger.info(em) 291 no_import.write(em) 292 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) 293 continue 294 matric_no = student.get('MatricNo') 295 if matric_no not in matrics: 296 matrics.append(matric_no) 297 sid = self.generateStudentId(student.get('Lastname')[0]) 298 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 299 students_folder.invokeFactory('Student', sid) 300 logger.info('%(tr_count)s: Creating Student with ID %(sid)s Matric_no %(matric_no)s ' % vars()) 301 student_obj = getattr(self,sid) 302 access_code = "%d" % random.randint(1000000000,9999999999) 303 student_obj.getContent().addMember(sid,access_code ,) 304 pwl_dict = {'student_id': sid,'access_code':access_code} 305 student_obj.invokeFactory('StudentApplication','application') 306 application = student_obj.application 307 da = {'Title': 'Application Data'} 308 student_obj.invokeFactory('StudentPersonal','personal') 309 da['jamb_reg_no'] = student.get('EntryRegNo') 310 personal = student_obj.personal 311 dp = {'Title': 'Personal Data'} 312 student_obj.invokeFactory('StudentClearance','clearance') 313 clearance = student_obj.clearance 314 dc = {'Title': 'Clearance Data'} 315 dc['matric_no'] = matric_no 316 state = student.get('State') 317 lga = student.get('LGA') 318 if state and lga: 319 lga = state + ' / ' + lga 320 else: 321 lga = "None" 322 dc['lga'] = lga 323 dc['nationality'] = student.get('Nationality') 324 dc['email'] = student.get('Emailaddress') 325 dp['firstname'] = student.get('FirstName') 326 dp['middlename'] = student.get('MiddleName') 327 dp['lastname'] = student.get('Lastname') 328 dp['former_surname'] = student.get('FormerSurname') 329 dp['sex'] = student.get('Sex') == 'F' 330 dp['perm_address'] = student.get('PermanentAddress') 331 dp['perm_city'] = student.get('PermanentAddressCity') 332 dp['campus_address'] = student.get('CampusAddress') 333 dp['phone'] = student.get('PhoneNumber') 334 application.getContent().edit(mapping=da) 335 personal.getContent().edit(mapping=dp) 336 clearance.getContent().edit(mapping=dc) 337 # 338 # Study Course 339 # 340 student_obj.invokeFactory('StudentStudyCourse','study_course') 341 studycourse = student_obj.study_course 342 dsc = {} 343 from_certificate = ['title', 344 'max_elect', 345 'max_pass', 346 'n_core', 347 'nr_years', 348 'probation_credits', 349 'promotion_credits', 350 'start_level', 351 ] 352 for f in from_certificate: 353 dsc[f] = getattr(certificate_doc,f) 354 dsc['faculty'] = fac_id 355 dsc['department'] = dep_id 356 dsc['study_course'] = certcode 357 css = student.get('CurrentSession') or '2004-2005' 358 cs = int(css.split('-')[0]) - 2000 359 cl = int(student.get('StudentLevel') or '100')/100 360 dsc['entry_session'] = "200%s" % (cs - cl) 361 dsc['clr_ac_pin'] = access_code 362 studycourse.getContent().edit(mapping=dsc) 363 # 364 # Level 365 # 366 ## l = getattr(studycourse,level,None) 367 ## if 0 and l is None: 368 ## #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 369 ## logger.info('Creating Level %(StudentLevel)s for %(fullname)s' % student) 370 ## studycourse.invokeFactory('StudentStudyLevel', level) 371 ## l = getattr(studycourse, level) 372 ## certificate = certs[certcode] 373 ## cert_level = getattr(certificate,level,None) 374 ## if cert_level is None: 375 ## logger.info('Level %(level)s not in %(certcode)s' % vars()) 376 ## l.getContent().edit(mapping={'Title': "Level %s" % level}) 377 else: 378 em = 'Student with ID %(MatricNo)s %(fullname)s already exists\n' % student 379 logger.info(em) 380 no_import.write(em) 381 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) 382 continue 383 if tr_count > MAX_TRANS: 384 transaction.commit() 385 em = 'Transaction commited\n' % student 386 logger.info(em) 387 tr_count = 0 388 tr_count += 1 389 pwl_dict.update(dc) 390 pwl_dict.update(da) 391 pwl_dict.update(dp) 392 wftool = self.portal_workflow 393 pwlist.append(pwl_template.substitute(pwl_dict)) 394 wftool.doActionFor(student_obj,'clear_and_validate') 395 student_obj.manage_setLocalRoles(sid, ['Owner',]) 396 wftool.doActionFor(application,'close') 397 application.manage_setLocalRoles(sid, ['Owner',]) 398 wftool.doActionFor(clearance,'close') 399 clearance.manage_setLocalRoles(sid, ['Owner',]) 400 wftool.doActionFor(personal,'close') 401 personal.manage_setLocalRoles(sid, ['Owner',]) 402 wftool.doActionFor(studycourse,'close_for_edit') 403 studycourse.manage_setLocalRoles(sid, ['Owner',]) 226 404 open("%s/import/pwlist-%s.csv" % (i_home,name),"w+").write('\n'.join(pwlist)) 227 405 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) … … 294 472 course_doc = courses[course].getContent() 295 473 temp_level = result.get('Level') 296 result['StudentId'] = sf.getId() 474 student_id = sf.getId() 475 result['StudentId'] = student_id 297 476 if temp_level != level: 298 477 try: … … 313 492 sc.invokeFactory('StudentStudyLevel', level) 314 493 l = getattr(sc, level) 494 l.manage_setLocalRoles(student_id, ['Owner',]) 315 495 else: 316 496 level_changed = False … … 341 521 dlev['imported_gpa'] = getFloat(gpa) 342 522 cr.getContent().edit(mapping = dcr) 523 cr.manage_setLocalRoles(student_id, ['Owner',]) 343 524 l.getContent().edit(mapping = dlev) 344 525 if tr_count > MAX_TRANS: -
WAeUP_SRP/trunk/Widgets.py
r714 r742 340 340 prefix = '' 341 341 reference = '' 342 343 342 def prepare(self, datastructure, **kw): ###( 344 343 """Prepare datastructure from datamodel.""" … … 346 345 v = datamodel[self.fields[0]] 347 346 widget_id = self.getWidgetId() 348 if v and type(v) is StringType: 349 p,b,n = v.split('-') 350 v = ScratchCardPin(v,b,n) 347 #import pdb;pdb.set_trace() 348 ## if v and type(v) is StringType: 349 ## p,b,n = v.split('-') 350 ## v = ScratchCardPin(v,b,n) 351 351 if v: 352 p = '%s' % v.p 352 353 b = '%s' % v.b 353 354 n = '%s' % v.n 354 355 else: 356 p = self.prefix 357 if p.startswith('@'): 358 p = getattr(self,self.prefix[1:])() 355 359 b = n = '' 360 v = ScratchCardPin(p,b,n) 356 361 datastructure[widget_id] = v 362 datastructure[widget_id+'_p'] = p 357 363 datastructure[widget_id+'_b'] = b 358 364 datastructure[widget_id+'_n'] = n … … 362 368 def validate(self, datastructure, **kw): 363 369 """Validate datastructure and update datamodel.""" 370 #import pdb;pdb.set_trace() 364 371 widget_id = self.getWidgetId() 365 372 v = datastructure[widget_id] 366 373 err = 0 367 p = self.prefix 374 prefix= self.prefix 375 if prefix.startswith('@'): 376 prefix= getattr(self,self.prefix[1:])() 368 377 b = datastructure[widget_id+'_b'].strip() 369 378 n = datastructure[widget_id+'_n'].strip() 370 379 pins = self.portal_pins 371 pin = "%(p )s%(b)s%(n)s" % vars()380 pin = "%(prefix)s%(b)s%(n)s" % vars() 372 381 if self.reference == "": 373 382 ref = str(self.portal_membership.getAuthenticatedMember()) 374 383 else: 375 384 ref = datastructure[self.reference] 376 #import pdb;pdb.set_trace() 377 ok = pins.searchAndSetRecord(pin,ref,self.prefix) 385 ok = pins.searchAndSetRecord(pin,ref,prefix) 378 386 while 1: 379 387 if ok == -2: … … 406 414 else: 407 415 datamodel = datastructure.getDataModel() 408 datamodel[self.fields[0]] = ScratchCardPin(self.prefix,b,n) 409 datastructure[widget_id] = ScratchCardPin(self.prefix,b,n) 416 datamodel[self.fields[0]] = ScratchCardPin(prefix,b,n) 417 datastructure[widget_id] = ScratchCardPin(prefix,b,n) 418 datastructure[widget_id+'_p'] = prefix 410 419 datastructure[widget_id+'_b'] = b 411 420 datastructure[widget_id+'_n'] = n 412 421 datastructure['s_id'] = s_id 413 #import pdb;pdb.set_trace()414 422 return not err 415 423 … … 428 436 v = datamodel[self.fields[0]] 429 437 if v and type(v) is StringType: 430 p ,b,n = v.split('-')431 v = ScratchCardPin(p ,b,n)438 prefix,b,n = v.split('-') 439 v = ScratchCardPin(prefix,b,n) 432 440 if v: 441 prefix= '%s' % v.p 433 442 b = '%s' % v.b 434 443 n = '%s' % v.n 435 444 else: 445 prefix= self.prefix 446 if prefix.startswith('@'): 447 prefix= getattr(self,self.prefix[1:])() 436 448 b = n = '' 437 if mode in ['edit', 'create']: 438 widget_id = self.getWidgetId() 439 datastructure[widget_id] = v 440 datastructure[widget_id+'_b'] = b 441 datastructure[widget_id+'_n'] = n 449 v = ScratchCardPin(prefix,b,n) 450 widget_id = self.getWidgetId() 451 datastructure[widget_id] = v 452 datastructure[widget_id+'_p'] = prefix 453 datastructure[widget_id+'_b'] = b 454 datastructure[widget_id+'_n'] = n 442 455 return meth(mode=mode, 443 456 datastructure=datastructure, 444 prefix=self.prefix,445 457 ) 446 458 ###) -
WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation_fe.xml
r694 r742 4 4 <property name="layout_edit_method"></property> 5 5 <property name="layout_view_method"></property> 6 <property name="style_prefix">layout_ accommodation_</property>6 <property name="style_prefix">layout_student_acco_</property> 7 7 <property name="flexible_widgets"/> 8 8 <property name="validate_values_expr"></property> 9 <widget name="acco_res_sc_pin" meta_type="Scratchcard Pin Widget">10 <property name="title">Hostel Application PIN</property>11 <property name="fields">12 <element value="acco_res_sc_pin"/>13 </property>14 <property name="is_required">True</property>15 <property name="label">Hostel Application PIN</property>16 <property name="label_edit">Hostel Application PIN</property>17 <property name="readonly_layout_modes"/>18 <property name="hidden_layout_modes"/>19 <property name="hidden_readonly_layout_modes"/>20 <property name="prefix">HOS</property>21 </widget>22 <widget name="student_status" meta_type="Select Widget">23 <property name="title">Status</property>24 <property name="fields">25 <element value="student_status"/>26 </property>27 <property name="label">Status</property>28 <property name="label_edit">Status</property>29 <property name="readonly_layout_modes"/>30 <property name="hidden_layout_modes"/>31 <property name="hidden_readonly_layout_modes"/>32 <property name="vocabulary">student_status_voc</property>33 </widget>34 35 9 <widget name="acco_maint_date" meta_type="DateTime Widget"> 36 10 <property name="title">Maintainance Payment Date</property> … … 41 15 <property name="label_edit">Maintainance Payment Date</property> 42 16 <property name="readonly_layout_modes"/> 43 <property name="hidden_layout_modes"/> 17 <property name="hidden_layout_modes"> 18 <element value="create"/> 19 <element value="edit"/> 20 </property> 44 21 <property name="hidden_readonly_layout_modes"/> 45 22 <property name="view_format">iso8601_medium_easy</property> 46 <property name="hidden_empty"></property>47 23 </widget> 48 24 <widget name="acco_maint_sc_pin" meta_type="Scratchcard Pin Widget"> … … 54 30 <property name="label_edit">Maintainance Payment PIN</property> 55 31 <property name="readonly_layout_modes"/> 56 <property name="hidden_layout_modes"/> 32 <property name="hidden_layout_modes"> 33 <element value="create"/> 34 </property> 57 35 <property name="hidden_readonly_layout_modes"/> 58 <property name="hidden_empty"></property>36 <property name="prefix">@getMaintainancePrefix</property> 59 37 </widget> 60 61 62 38 <widget name="acco_res_date" meta_type="DateTime Widget"> 63 39 <property name="title">Hostel Application Date</property> … … 67 43 <property name="label">Hostel Application Date</property> 68 44 <property name="label_edit">Hostel Application Date</property> 69 <property name="readonly_layout_modes"/> 70 <property name="hidden_layout_modes"/> 45 <property name="readonly_layout_modes"> 46 <element value="edit"/> 47 </property> 48 <property name="hidden_layout_modes"> 49 <element value="create"/> 50 </property> 71 51 <property name="hidden_readonly_layout_modes"/> 72 52 <property name="view_format">iso8601_medium_easy</property> 73 53 </widget> 74 54 <widget name="acco_res_sc_pin" meta_type="Scratchcard Pin Widget"> 55 <property name="title">Hostel Application PIN</property> 56 <property name="fields"> 57 <element value="acco_res_sc_pin"/> 58 </property> 59 <property name="is_required">True</property> 60 <property name="label">Hostel Application PIN</property> 61 <property name="label_edit">Hostel Application PIN</property> 62 <property name="readonly_layout_modes"> 63 <element value="edit"/> 64 </property> 65 <property name="hidden_layout_modes"/> 66 <property name="hidden_readonly_layout_modes"/> 67 <property name="prefix">HOS</property> 68 </widget> 75 69 <widget name="bed" meta_type="Method Widget"> 76 <property name="title">Bed</property> 77 <property name="fields"> 78 <element value="bed"/> 79 </property> 80 <property name="label">Bed</property> 81 <property name="label_edit">Bed</property> 82 <property name="readonly_layout_modes"/> 83 <property name="hidden_layout_modes"/> 84 <property name="hidden_readonly_layout_modes"/> 85 <property name="render_method">formatBed</property> 86 </widget> 70 <property name="title">Bed</property> 71 <property name="fields"> 72 <element value="bed"/> 73 </property> 74 <property name="label">Bed</property> 75 <property name="label_edit">Bed</property> 76 <property name="readonly_layout_modes"> 77 <element value="edit"/> 78 </property> 79 <property name="hidden_layout_modes"/> 80 <property name="hidden_readonly_layout_modes"/> 81 <property name="render_method">formatBed</property> 82 </widget> 87 83 <widget name="session" meta_type="String Widget"> 88 84 <property name="title">Session</property> … … 92 88 <property name="label">Session</property> 93 89 <property name="label_edit">Session</property> 94 <property name="readonly_layout_modes">edit</property> 90 <property name="readonly_layout_modes"> 91 <element value="edit"/> 92 <element value="create"/> 93 </property> 95 94 <property name="hidden_layout_modes"/> 96 95 <property name="hidden_readonly_layout_modes"/> 97 96 </widget> 98 99 97 <widget name="student_status" meta_type="Select Widget"> 98 <property name="title">Status</property> 99 <property name="fields"> 100 <element value="student_status"/> 101 </property> 102 <property name="label">Status</property> 103 <property name="label_edit">Status</property> 104 <property name="readonly_layout_modes"> 105 <element value="edit"/> 106 </property> 107 <property name="hidden_layout_modes"/> 108 <property name="hidden_readonly_layout_modes"/> 109 <property name="vocabulary">student_status_voc</property> 110 </widget> 100 111 <table> 101 112 <row> -
WAeUP_SRP/trunk/profiles/default/workflows.xml
r723 r742 15 15 <object name="waeup_section_wf" meta_type="CPS Workflow"/> 16 16 <object name="waeup_student_wf" meta_type="CPS Workflow"/> 17 <object name="waeup_student_accommodation_wf" meta_type="CPS Workflow"/> 17 18 <object name="waeup_student_subobject_wf" meta_type="CPS Workflow"/> 18 19 <object name="waeup_workspace_wf" meta_type="CPS Workflow"/> … … 62 63 </type> 63 64 <type type_id="StudentAccommodation"> 64 <bound-workflow workflow_id="waeup_student_ subobject_wf"/>65 <bound-workflow workflow_id="waeup_student_accommodation_wf"/> 65 66 </type> 66 67 <type type_id="StudentApplication"> -
WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml
r723 r742 30 30 </state> 31 31 <state state_id="cleared_and_validated" title=""> 32 <exit-transition transition_id="create_content"/> 32 33 </state> 33 34 <state state_id="clearence_requested" title=""> -
WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
r659 r742 80 80 member.setProperties(last_login_time=current,login_time=current) 81 81 if info['review_state'] == "application_pin_entered": 82 83 82 return response.redirect("%s/passport_entry_view" % student.absolute_url()) 84 return response.redirect("%s " % student.absolute_url())83 return response.redirect("%s/student_index" % info['url']) 85 84 86 85 elif to_member_home: -
WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
r741 r742 28 28 if context.isManager() and 'students' in path_info: 29 29 student_id = path_info[path_info.index('students')+1] 30 ## if context.portal_type == 'Student':31 ## student_id = context.getId()32 ## elif context.aq_parent.portal_type == 'Student':33 ## student_id = context.aq_parent.getId()34 ## elif context.aq_parent.aq_parent.portal_type == 'Student':35 ## student_id = context.aq_parent.aq_parent.getId()36 ## elif context.aq_parent.aq_parent.aq_parent.portal_type == 'Student':37 ## student_id = context.aq_parent.aq_parent.aq_parent.getId()38 ## else:39 ## student_id = member_id40 30 else: 41 student_id = member_id 31 student_id = member_id 42 32 else: 43 33 student_id = student.getId() 44 34 res = context.portal_catalog(id = student_id,portal_type='Student') 45 if not res or len(res) > 1:35 if not res:# or len(res) > 1: 46 36 return None 47 37 brain = res[-1] 48 38 student = brain.getObject() 49 39 student_path = brain.getPath() 50 info['review_state'] = wf.getInfoFor(student,'review_state', 'keiner')40 info['review_state'] = wf.getInfoFor(student,'review_state',None) 51 41 info['student'] = student 52 42 info['id'] = student.getId() … … 66 56 info['acco'] = acco 67 57 info['acco_doc'] = acco.getContent() 58 info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None) 68 59 else: 69 60 info['acco'] = None … … 96 87 row['s_edit_link'] = "%s/%s" % (student.absolute_url(),se_link) 97 88 row['review_state'] = so.review_state 98 row['display'] = so.review_state in ('opened','closed' )89 row['display'] = so.review_state in ('opened','closed',) or so.portal_type == "StudentAccommodation" 99 90 items.append(row) 100 91 info['items'] = items 92 request.set('student_id',student_id) 93 request.set('student_url',info['url']) 101 94 return info -
WAeUP_SRP/trunk/skins/waeup_student/layout_student_acco_edit.pt
r741 r742 1 <tal:block define="global creation python: 1;1 <tal:block define="global creation python:0; 2 2 global formaction string:apply_admission" /> 3 3 <!-- a layout_lib macro --> -
WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py
r701 r742 11 11 12 12 info = context.getStudentInfo() 13 validate = REQUEST.has_key("cpsdocument_create_button") 13 validate = REQUEST.has_key("cpsdocument_create_button") or\ 14 REQUEST.has_key("cpsdocument_edit_button") 14 15 15 16 lt = context.portal_layouts … … 19 20 info = context.getStudentInfo() 20 21 student = info['student'] 21 if info['acco']: 22 return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url()) 23 res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation', 22 mode = 'create' 23 if info.has_key('acco') and info['acco']: 24 if info['acco_review_state'] == "maintainance_fee_payed": 25 return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url()) 26 else: 27 mode = 'edit' 28 d = {} 29 if mode == 'edit': 30 info = context.getStudentInfo() 31 d['acco_res_date'] = info['acco_doc'].acco_res_date 32 d['acco_res_sc_pin'] = info['acco_doc'].acco_res_sc_pin 33 d['bed'] = info['acco_doc'].bed 34 d['session'] = info['acco_doc'].session 35 res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation_fe', 24 36 schema_id= 'student_accommodation', 25 37 context=context, 26 38 mapping=validate and REQUEST, 27 ob= {},28 layout_mode= 'create',39 ob=d, 40 layout_mode=mode, 29 41 formaction = "reserve_accommodation", 30 42 button = "Book", … … 47 59 elif psm == 'valid': 48 60 s_id = ds.get('s_id') 49 pin = str(ds.get('acco_res_ac_pin'))50 51 pa = context.portal_accommodation52 code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))53 if code < 0:54 return context.accommodation_pin_form(rendered = res,61 if mode == 'create': 62 pin = str(ds.get('acco_res_sc_pin')) 63 pa = context.portal_accommodation 64 code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status'))) 65 if code < 0: 66 return context.accommodation_pin_form(rendered = res, 55 67 psm = bed, 56 68 firstlayout = True, … … 58 70 ds = ds, 59 71 ) 60 student.invokeFactory('StudentAccommodation',acco_id) 72 student.invokeFactory('StudentAccommodation',acco_id) 73 acco = getattr(student,acco_id) 74 ds.set('acco_res_date', current) 75 ds.set('bed', bed) 76 ds.set('session', session) 77 acco.getContent().edit(mapping=ds) 78 #wftool.doActionFor(acco,'pay_maintainance_fee',dest_container=acco) 79 return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % student.absolute_url()) 80 pin = str(ds.get('acco_main_sc_pin')) 81 pp = context.portal_pins 61 82 acco = getattr(student,acco_id) 62 wftool.doActionFor(acco,'open',dest_container=acco) 63 ds.set('acco_res_date', current) 64 ds.set('bed', bed) 65 ds.set('session', session) 83 ds.set('acco_maint_date', current) 66 84 acco.getContent().edit(mapping=ds) 85 wftool.doActionFor(acco,'pay_maintainance_fee',dest_container=acco) 67 86 return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % student.absolute_url()) 87 68 88 ##return context.accommodation_pin_form(rendered = res, 69 89 ## psm = "successfully reserved bed %s" % bed, -
WAeUP_SRP/trunk/skins/waeup_student/student_index.py
r723 r742 34 34 elif state == 'application_pin_entered': 35 35 return redirect("%s/passport_entry_view" % student.absolute_url()) 36 return redirect("%s/student_view" % student.absolute_url()) 36 37 37 38 -
WAeUP_SRP/trunk/skins/waeup_student/widget_scratch_card_pin_render.pt
r523 r742 1 1 <tal:block define="mode options/mode; 2 2 id here/getWidgetId; 3 id_p string:${id}_p; 3 4 id_b string:${id}_b; 4 5 id_n string:${id}_n; 5 prefix options/ prefix;6 prefix options/datastructure/?id_p; 6 7 batch options/datastructure/?id_b; 7 8 nr options/datastructure/?id_n;
Note: See TracChangeset for help on using the changeset viewer.