Changeset 2307
- Timestamp:
- 4 Oct 2007, 06:21:53 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/Widgets.py
r2289 r2307 1333 1333 meta_type = "Pume Pin Widget" 1334 1334 catalog = "applicants_catalog" 1335 reference = '' 1335 1336 1336 1337 def validate(self, datastructure, **kw): ###( … … 1341 1342 err = 0 1342 1343 mapping = {} 1343 1344 #import pdb;pdb.set_trace() 1344 1345 prefix= self.prefix 1345 1346 if prefix.startswith('@'): … … 1350 1351 pin = "%(prefix)s%(b)s%(n)s" % vars() 1351 1352 pin_str = "%(prefix)s-%(b)s-%(n)s" % vars() 1353 member_id = str(self.portal_membership.getAuthenticatedMember()) 1352 1354 do = 1 1353 s_id = str(self.portal_membership.getAuthenticatedMember())1354 1355 if self.isStaff(): 1355 1356 do = 0 … … 1359 1360 do = 0 1360 1361 err = 'PIN must not contain "-"' 1361 s_logger.info('%s entered invalid PIN containing "-"' % ( s_id))1362 s_logger.info('%s entered invalid PIN containing "-"' % (member_id)) 1362 1363 elif n.find('-') > -1: 1363 1364 do = 0 1364 1365 err = 'PIN must not contain "-"' 1365 s_logger.info('%s entered invalid PIN containing "-"' % ( s_id))1366 s_logger.info('%s entered invalid PIN containing "-"' % (member_id)) 1366 1367 elif len(n) != 10: 1367 1368 do = 0 1368 1369 err = 'Invalid PIN length' 1369 s_logger.info('%s entered invalid PIN with length %d' % ( s_id,len(n)))1370 s_logger.info('%s entered invalid PIN with length %d' % (member_id,len(n))) 1370 1371 elif self.reference == "": 1371 ref = s_id1372 ref = n 1372 1373 else: 1373 1374 ref = datastructure[self.reference] … … 1375 1376 do = 0 1376 1377 datastructure.setError(widget_id, 'PIN neither checked nor used.') 1377 s_logger.info('%s/%s entered wrong data together with PIN %s' % ( s_id,ref,pin_str))1378 s_logger.info('%s/%s entered wrong data together with PIN %s' % (member_id,ref,pin_str)) 1378 1379 while do: 1379 1380 ok = pins.searchAndSetRecord(pin,ref,prefix) 1380 1381 if ok < -2 or ok > 2: 1381 1382 err = 'Unknown error, please report!' 1382 s_logger.info('%s/%s caused unknown error with PIN %s' % ( s_id,ref,pin_str))1383 s_logger.info('%s/%s caused unknown error with PIN %s' % (member_id,ref,pin_str)) 1383 1384 break 1384 1385 elif ok == -2: 1385 1386 err = 'Service already is activated but with a different PIN.' 1386 s_logger.info('%s/%s repeatedly activated service but with different PIN %s' % ( s_id,ref,pin_str))1387 s_logger.info('%s/%s repeatedly activated service but with different PIN %s' % (member_id,ref,pin_str)) 1387 1388 break 1388 1389 elif ok == -1: 1389 1390 err = 'Invalid PIN' 1390 s_logger.info('%s/%s entered invalid PIN %s' % ( s_id,ref,pin_str))1391 s_logger.info('%s/%s entered invalid PIN %s' % (member_id,ref,pin_str)) 1391 1392 break 1392 1393 if ok == 0: 1393 1394 err = 'PIN already used' 1394 s_logger.info('%s/%s entered used PIN %s' % ( s_id,ref,pin_str))1395 s_logger.info('%s/%s entered used PIN %s' % (member_id,ref,pin_str)) 1395 1396 break 1396 1397 if ok >= 1: 1397 1398 if self.isStudent(): 1398 1399 err = "This is only for Pume application." 1399 s_logger.info('%s/%s applied for screening test with PIN %s' % ( s_id,ref,pin_str))1400 s_logger.info('%s/%s applied for screening test with PIN %s' % (member_id,ref,pin_str)) 1400 1401 break 1401 el se:1402 elif datastructure.has_key('record'): 1402 1403 applicant = datastructure['record'] 1403 1404 if not applicant.pin: … … 1409 1410 getattr(self,self.catalog).modifyRecord(**d) 1410 1411 elif applicant.pin != pin_str: 1411 s_logger.info('%s/%s tried to enter application record with different PIN %s' % ( s_id,ref,pin_str))1412 s_logger.info('%s/%s tried to enter application record with different PIN %s' % (member_id,ref,pin_str)) 1412 1413 elif applicant.pin == pin_str: 1413 s_logger.info('%s/%s repeatedly entered application record with PIN %s' % (s_id,ref,pin_str)) 1414 s_logger.info('%s/%s repeatedly entered application record with PIN %s' % (member_id,ref,pin_str)) 1415 else: 1416 datastructure['reg_no'] = ref 1417 res = self.applicants_catalog(reg_no = ref) 1418 if not res: 1419 s_logger.info('%s successfully used PIN %s' % (ref,pin_str)) 1420 d = {} 1421 d['reg_no'] = ref 1422 d['pin'] = pin_str 1423 d['status'] = 'entered' 1424 self.applicants_catalog.addRecord(**d) 1425 else: 1426 s_logger.info('%s/%s repeatedly entered application record with PIN %s' % (ref,ref,pin_str)) 1414 1427 break 1415 1428 if err: … … 1422 1435 datastructure[widget_id+'_b'] = b 1423 1436 datastructure[widget_id+'_n'] = n 1424 datastructure['s_id'] = s_id1425 1437 return not err 1426 1438 ###) -
WAeUP_SRP/base/skins/waeup_student/apply_pume.py
r2184 r2307 48 48 if manage: 49 49 validate = False 50 50 layout = "application" 51 prence = "" 52 without_reg_no = False 53 if traverse_subpath and traverse_subpath[0] == "prence": 54 layout = "application_prence" 55 prence = "prence" 56 without_reg_no = True 51 57 lt = context.portal_layouts 52 58 reg_no = request.get('widget__reg_no','').upper() … … 81 87 logger.info('%s/%s views application slip' % (member,reg_no)) 82 88 83 res,psm,ds = lt.renderLayout(layout_id= 'application',89 res,psm,ds = lt.renderLayout(layout_id= layout, 84 90 schema_id= 'application', 85 91 layout_mode = mode, … … 96 102 mode = mode, 97 103 ds = ds, 104 prence = prence, 98 105 ) 99 106 … … 104 111 mode = mode, 105 112 ds = ds, 113 prence = prence, 106 114 ) 107 115 elif psm == '' and not manage: … … 110 118 ds = ds, 111 119 mode = mode, 120 prence = prence, 112 121 ) 113 122 elif psm == 'valid' or (psm == '' and manage): 114 123 pass 124 if without_reg_no: 125 reg_no = ds.get('reg_no') 115 126 data = {} 116 127 dm = ds.getDataModel() … … 120 131 data['reg_no'] = reg_no 121 132 122 123 124 133 if apply_pume: 125 134 if submitted: … … 127 136 psm = "The form has already been submitted and you are not allowed to resubmit the data!" 128 137 logger.info('%s/%s tried to resubmit application record' % (member,reg_no)) 129 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',138 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 130 139 schema_id= 'application', 131 140 layout_mode = mode, … … 152 161 context.applicants_catalog.modifyRecord(**data) 153 162 154 res,psm_dummy,ds = lt.renderLayout(layout_id= 'application',163 res,psm_dummy,ds = lt.renderLayout(layout_id= layout, 155 164 schema_id= 'application', 156 165 layout_mode = mode, … … 169 178 psm = "" 170 179 #set_trace() 180 if without_reg_no: 181 object['reg_no'] = reg_no 171 182 object['pin'] = str(ds.get('pin')) 172 res,psm,ds_dummy = lt.renderLayout(layout_id= 'application',183 res,psm,ds_dummy = lt.renderLayout(layout_id= layout, 173 184 schema_id= 'application', 174 185 layout_mode = mode, … … 183 194 psm = "The form has already been submitted and you are not allowed to modify the data!" 184 195 logger.info('%s/%s tried to edit submitted application record' % (member,reg_no)) 185 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',196 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 186 197 schema_id= 'application', 187 198 layout_mode = mode, … … 203 214 psm = "You are now assuming the applicant's role!" 204 215 logger.info('%s/%s entered application record' % (member,reg_no)) 205 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= 'application',216 res,psm_dummy,ds_dummy = lt.renderLayout(layout_id= layout, 206 217 schema_id= 'application', 207 218 layout_mode = mode, … … 223 234 224 235 return context.apply_pume_form(rendered = res, 225 psm = psm, 226 #psm = "%s, %s" % (psm,ds), 227 mode = mode, 228 show_submit = passport_uploaded, 229 ds = ds, 230 ) 231 232 236 psm = psm, 237 #psm = "%s, %s" % (psm,ds), 238 mode = mode, 239 show_submit = passport_uploaded, 240 ds = ds, 241 prence = prence, 242 ) 243 244 -
WAeUP_SRP/base/skins/waeup_student/apply_pume_form.pt
r2157 r2307 15 15 <form action="" id="editForm" method="post" 16 16 enctype="multipart/form-data" class="workflow" 17 tal:attributes="action string:${context/absolute_url}/apply_pume "17 tal:attributes="action string:${context/absolute_url}/apply_pume/${options/prence}" 18 18 > 19 19 <input type="hidden" name="reg_no" -
WAeUP_SRP/uniben/profiles/default/layouts.xml
r2285 r2307 7 7 <object name="academics_search" meta_type="CPS Layout"/> 8 8 <object name="application" meta_type="CPS Layout"/> 9 <object name="application_prence" meta_type="CPS Layout"/> 9 10 <object name="application_manage" meta_type="CPS Layout"/> 10 11 <object name="certificate" meta_type="CPS Layout"/>
Note: See TracChangeset for help on using the changeset viewer.