Changeset 710 for WAeUP_SRP/trunk
- Timestamp:
- 16 Oct 2006, 22:30:16 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Students.py
r708 r710 28 28 if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): 29 29 letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') 30 return "%c%d" % (letter,r.randint(99999,1000000)) 30 students = context.portal_catalog(meta_type = "StudentsFolder")[-1] 31 sid = "%c%d" % (letter,r.randint(99999,1000000)) 32 while hasattr(students, sid): 33 sid = "%c%d" % (letter,r.randint(99999,1000000)) 34 return sid 31 35 #return "%c%d" % (r.choice('ABCDEFGHKLMNPQRSTUVWXY'),r.randint(99999,1000000)) 32 36 -
WAeUP_SRP/trunk/WAeUPTables.py
r686 r710 104 104 105 105 106 def searchAndSetRecord(self, uid, student_id ):106 def searchAndSetRecord(self, uid, student_id,prefix): 107 107 #records = self.searchResults(uid=uid) 108 records = self.searchResults(student = student_id) 109 if len(records) > 0: 110 for r in records: 111 if r.pin != uid and r.prefix_batch.startswith(prefix): 112 return -2 108 113 records = self.searchResults({"%s" % self.key : uid}) 109 114 if len(records) > 1: -
WAeUP_SRP/trunk/Widgets.py
r667 r710 214 214 ###) 215 215 216 class StudentIdWidget(CPSStringWidget): ###(217 """ StudentId Widget"""218 meta_type = "StudentId Widget"219 digits = 8220 digits_str = "N"*digits221 letters = 2222 letters_str = "L"*letters223 224 def validate(self, datastructure, **kw):225 """Validate datastructure and update datamodel."""226 227 valid = CPSStringWidget.validate(self, datastructure, **kw)228 if not valid:229 return 0230 else:231 widget_id = self.getWidgetId()232 value = datastructure[widget_id]233 err = 0234 if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()):235 err = 'Invalid Registration Number in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)236 if err:237 datastructure.setError(widget_id, err)238 else:239 datamodel = datastructure.getDataModel()240 datamodel[self.fields[0]] = value241 242 return not err243 244 InitializeClass(StudentIdWidget)245 widgetRegistry.register(StudentIdWidget)246 247 ### )216 ##class StudentIdWidget(CPSStringWidget): ###( 217 ## """ StudentId Widget""" 218 ## meta_type = "StudentId Widget" 219 ## digits = 8 220 ## digits_str = "N"*digits 221 ## letters = 2 222 ## letters_str = "L"*letters 223 ## 224 ## def validate(self, datastructure, **kw): 225 ## """Validate datastructure and update datamodel.""" 226 ## 227 ## valid = CPSStringWidget.validate(self, datastructure, **kw) 228 ## if not valid: 229 ## return 0 230 ## else: 231 ## widget_id = self.getWidgetId() 232 ## value = datastructure[widget_id] 233 ## err = 0 234 ## if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()): 235 ## err = 'Invalid Registration Number in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str) 236 ## if err: 237 ## datastructure.setError(widget_id, err) 238 ## else: 239 ## datamodel = datastructure.getDataModel() 240 ## datamodel[self.fields[0]] = value 241 ## 242 ## return not err 243 ## 244 ##InitializeClass(StudentIdWidget) 245 ##widgetRegistry.register(StudentIdWidget) 246 ## 247 #####) 248 248 249 249 class JambRegNoWidget(CPSStringWidget): ###( … … 270 270 s = getStudentByRegNo(self,value) 271 271 if s is None: 272 err = 'No JAMB data for%s' % (value)272 err = 'No Student with JAMB-Reg-No %s' % (value) 273 273 if err: 274 274 datastructure.setError(widget_id, err) … … 342 342 ref = datastructure[self.reference] 343 343 #import pdb;pdb.set_trace() 344 ok = pins.searchAndSetRecord(pin,ref )344 ok = pins.searchAndSetRecord(pin,ref,self.prefix) 345 345 while 1: 346 if ok == -1: 346 if ok == -2: 347 err = 'You have already applied with a different Pin, please login' 348 break 349 elif ok == -1: 347 350 err = 'invalid Pin' 348 351 break … … 351 354 break 352 355 if ok >= 1: 356 #import pdb;pdb.set_trace() 353 357 if self.isStudent(): 354 358 student = self.getStudentInfo()['student'] -
WAeUP_SRP/trunk/profiles/default/layouts/student_application.xml
r707 r710 50 50 </widget> 51 51 <widget name="appl_email" meta_type="Email Widget"> 52 <property name="is_required">True</property> 52 53 <property name="title">Email Address</property> 53 54 <property name="fields"> … … 158 159 <property name="hidden_readonly_layout_modes"/> 159 160 </widget> 160 <widget name="jamb_reg_no" meta_type=" StudentIdWidget">161 <widget name="jamb_reg_no" meta_type="JambRegNo Widget"> 161 162 <property name="title">JAMB Registration Number</property> 162 163 <property name="fields"> -
WAeUP_SRP/trunk/profiles/default/layouts/student_application_fe.xml
r707 r710 61 61 <property name="label">Email Address</property> 62 62 <property name="label_edit">Email Address</property> 63 <property name=" readonly_layout_modes">64 < /property>65 < property name="hidden_layout_modes">66 < /property>63 <property name="is_required">False</property> 64 <property name="readonly_layout_modes"> 65 </property> 66 <property name="hidden_layout_modes">create</property> 67 67 <property name="hidden_readonly_layout_modes"/> 68 68 </widget> … … 73 73 </property> 74 74 <property name="label">Mobile Phone No</property> 75 <property name="is_required">False</property> 75 76 <property name="label_edit">Mobile Phone No</property> 76 77 <property name="readonly_layout_modes"> 77 78 </property> 78 <property name="hidden_layout_modes"> 79 </property> 79 <property name="hidden_layout_modes">create</property> 80 80 <property name="hidden_readonly_layout_modes"/> 81 81 </widget> … … 142 142 <property name="hidden_readonly_layout_modes"/> 143 143 </widget> 144 <widget name="jamb_reg_no" meta_type=" StudentIdWidget">144 <widget name="jamb_reg_no" meta_type="JambRegNo Widget"> 145 145 <property name="title">JAMB Registration Number</property> 146 146 <property name="fields"> -
WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py
r709 r710 32 32 jno = item['student'] 33 33 res = context.portal_catalog(SearchableText=jno,portal_type='StudentApplication') 34 if len(res) > 1:34 if len(res) > 0: 35 35 item['student_url'] = "%s/%s" % (context.portal_url(),res[0].relative_path) 36 36 else: -
WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt
r672 r710 27 27 err python:ds.getError(wid); 28 28 err_mapping python:ds.getErrorMapping(wid); 29 is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);29 is_required python: widget.is_required; 30 30 tooltip_id python:wid + '_help'; 31 31 widget_css_class cell/widget_css_class|nothing; -
WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt
r672 r710 1 <metal:html tal:define="info context/getStudentInfo"> 1 <metal:html tal:define="info context/getStudentInfo; 2 rendered_main python:info['app_doc'].renderEdit( 3 layout_mode='edit', 4 proxy=info['app'], 5 no_form = True, 6 schema_id = 'student_application', 7 layout_id='student_application_fe', 8 )"> 2 9 <metal:body use-macro="here/main_template/macros/master"> 3 10 <metal:main fill-slot="main"> … … 12 19 <h3>Upload your Passport Picture!</h3> 13 20 <br /> 14 <span tal:omit-tag="" 15 tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'], 16 layout_mode='edit', 17 layout_id='student_application_fe', 18 )" 19 /> 21 <span tal:omit-tag="" tal:replace="structure rendered_main"/> 20 22 </span> 21 23 </metal:main> -
WAeUP_SRP/trunk/skins/waeup_student/student_edit.py
r659 r710 48 48 use_session=True) 49 49 action = "/passport_entry_view" 50 if app_doc.passport is not None: 51 psm = 'You successfully uploaded your passport image.' 52 args = {'apply_button': 'Apply',} 50 if is_valid: 51 if app_doc.passport is not None: 52 psm = 'You successfully uploaded your passport image.' 53 args = {'apply_button': 'Apply',} 54 else: 55 psm = "You didn't upload a passport image." 56 args = {} 53 57 else: 54 psm = "You didn't upload a passport image."55 args = {}58 psm = 'psm_content_error' 59 args = getFormUidUrlArg(REQUEST) 56 60 elif 'apply_admission' not in REQUEST.form: 57 61 is_valid, ds = app_doc.validate(request=REQUEST,
Note: See TracChangeset for help on using the changeset viewer.