Changeset 1175
- Timestamp:
- 2 Jan 2007, 11:37:44 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Widgets.py
r1169 r1175 141 141 widgetRegistry.register(CertificateCourseIdWidget) 142 142 ###) 143 144 143 145 144 class CourseIdWidget(CPSStringWidget): ###( … … 366 365 ###) 367 366 367 class SecretWidget(CPSStringWidget): ###( 368 """ Secret Widget""" 369 meta_type = "Secret Widget" 370 _properties = CPSStringWidget._properties + ( 371 {'id': 'reference', 'type': 'string', 'mode': 'w', 372 'label': 'Reference Record'}, 373 {'id': 'check_fields', 'type': 'tokens', 'mode': 'w', 374 'label': 'Fields to check'}, 375 ) 376 reference = "student" 377 check_fields = ("Firstname", "Middlename","Lastname") 378 def validate(self, datastructure, **kw): 379 """Validate datastructure and update datamodel.""" 380 logger = logging.getLogger('Secret.Validate') 381 valid = CPSStringWidget.validate(self, datastructure, **kw) 382 #import pdb;pdb.set_trace() 383 widget_id = self.getWidgetId() 384 value = datastructure[widget_id].upper() 385 err = 0 386 if not valid: 387 err = 'Invalid String' 388 else: 389 #import pdb;pdb.set_trace() 390 record = datastructure[self.reference] 391 found = False 392 cvs = [] 393 for field in self.check_fields: 394 cv = getattr(record,field).upper() 395 cvs.append(cv) 396 if cv == value.upper(): 397 found = True 398 break 399 matric_no = record.matric_no 400 name = " ".join(cvs) 401 if not found: 402 logger.info('"%(matric_no)s","mismatch", "%(value)s", "not in","%(name)s"' % vars()) 403 err = 'No Name does match.' 404 else: 405 logger.info('"%(matric_no)s","found", "%(value)s", "in","%(name)s"' % vars()) 406 if err: 407 datastructure.setError(widget_id, err) 408 else: 409 datamodel = datastructure.getDataModel() 410 datamodel[self.fields[0]] = value 411 return not err 412 413 InitializeClass(SecretWidget) 414 415 widgetRegistry.register(SecretWidget) 416 ###) 417 368 418 class MatricNoWidget(CPSStringWidget): ###( 369 419 """ MatricNo Widget""" … … 372 422 """Validate datastructure and update datamodel.""" 373 423 valid = CPSStringWidget.validate(self, datastructure, **kw) 424 logger = logging.getLogger('MatricNo.Validate') 374 425 #import pdb;pdb.set_trace() 375 426 returning = self.returning_import -
WAeUP_SRP/trunk/profiles/default/layouts/student_session_results_search.xml
r1169 r1175 19 19 </property> 20 20 <property name="hidden_readonly_layout_modes"/> 21 </widget> 22 <widget name="secret" meta_type="Secret Widget"> 23 <property name="title">Secret Widget</property> 24 <property name="fields"> 25 <element value="secret"/> 26 </property> 27 <property name="label">Enter Your Firstname,Middlename or Lastname</property> 28 <property name="label_edit">Enter Your Firstname,Middlename or Lastname</property> 29 <property name="readonly_layout_modes"/> 30 <property name="hidden_layout_modes"> 31 <element value="edit"/> 32 </property> 33 <property name="hidden_readonly_layout_modes"/> 34 <property name="check_fields"> 35 <element value="Firstname"/> 36 <element value="Middlename"/> 37 <element value="Lastname"/> 38 </property> 39 <property name="reference">student</property> 40 <property name="display_width">10</property> 41 <property name="size_max">10</property> 21 42 </widget> 22 43 <widget name="jamb_reg_no" meta_type="JambRegNo Widget"> … … 104 125 </row> 105 126 <row> 106 <cell name=" jamb_reg_no" />127 <cell name="secret" /> 107 128 </row> 108 129 <row> -
WAeUP_SRP/trunk/profiles/default/schemas/student_returning.xml
r1158 r1175 3 3 <field name="email" meta_type="CPS String Field"/> 4 4 <field name="phone_nr" meta_type="CPS String Field"/> 5 <field name=" jamb_reg_no" meta_type="CPS String Field"/>5 <field name="secret" meta_type="CPS String Field"/> 6 6 <field name="matric_no" meta_type="CPS String Field"/> 7 7 <field name="password" meta_type="CPS Password Field"/> -
WAeUP_SRP/trunk/skins/waeup_student/createReturningStudent.py
r1171 r1175 52 52 return "MatricNo %s not found in Returning Table" % matric_no 53 53 student_brain = res[0] 54 #sid,jamb_reg_no = context.waeup_tool.createOne(student_brain) 55 sid,jamb_reg_no = context.createOne(student_brain) 54 sid,jamb_reg_no = context.waeup_tool.createOne(student_brain) 56 55 logger.info('"%s","Created Student","%s", "%s" ' % (member,sid,matric_no)) 57 56 return "Student MatricNo %s, StudentId %s Jamb %s created" % (matric_no,sid,jamb_reg_no) -
WAeUP_SRP/trunk/skins/waeup_student/display_session_results.py
r1166 r1175 62 62 #from Products.zdb import set_trace;set_trace() 63 63 results = (sem1, sem2) 64 return context.session_results_anon_view(student=ds.get('student'), 65 results=results) 64 registered = None 65 student_rec = ds.get('student') 66 res = context.students_catalog(matric_no = student_rec.matric_no) 67 if res: 68 student_id = res[0].id 69 student_obj = getattr(context.portal_url.getPortalObject().campus.students,student_id,None) 70 if student_obj and hasattr(student_obj,'application'): 71 registered = student_id 72 73 return context.session_results_anon_view(student=student_rec, 74 results=results, 75 registered = registered) 66 76 -
WAeUP_SRP/trunk/skins/waeup_student/session_results_anon_view.pt
r1174 r1175 1 1 <metal:html tal:define="student options/student; 2 results options/results" 2 results options/results; 3 registered options/registered" 3 4 > 4 5 <metal:body use-macro="here/main_template/macros/master"> … … 52 53 </table> 53 54 <br /> 54 <form action="" method="post" 55 <div tal:condition="registered">You have already set your Password, please 56 <a href="" tal:attributes="href string:${context/portal_url}/login_student">login</a> 57 with your UserId <span tal:replace="registered" /> 58 </div> 59 <form tal:condition="not: registered" action="" method="post" 55 60 tal:attributes="action string:${context/portal_url}/set_access_data"> 56 61 <input type="hidden" name="matric_no" tal:attributes="value student/matric_no" />
Note: See TracChangeset for help on using the changeset viewer.