Changeset 179 for waeup_product/trunk/skins/waeup_student/eligibility.py
- Timestamp:
- 16 Nov 2005, 16:44:13 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/skins/waeup_student/eligibility.py
r176 r179 1 ##parameters=REQUEST 1 ##parameters=REQUEST=None 2 2 # $Id$ 3 3 """ … … 5 5 return html renderer + psm 6 6 """ 7 type_name = 'Jamb' 8 ti = context.portal_types[type_name] 9 10 REQUEST.set('type_name',type_name) 11 12 validate = REQUEST.has_key("cpsdocument_edit_button") 7 request = REQUEST 8 rget = request.get 9 rset = request.set 10 fget = request.form.get 11 fhas = request.form.has_key 13 12 14 13 … … 16 15 pr = context.portal_registration 17 16 pm = context.portal_membership 17 eli = context.ELIGIBILITY.getContent() 18 sr = eli.schoolresults 18 19 19 jamb = getattr(context,'JAMB') 20 jamb_rendered = jamb.getContent().render(layout_id = 'admission_slip', 21 layout_mode = 'view', 22 schema_id = 'jamb') 23 24 res,psm,ds = lt.renderLayout(layout_id= 'student_eligibility', 20 res,psm,ds = lt.renderLayout(layout_id= 'student_schoolresults', 25 21 schema_id= 'student_eligibility', 26 22 context=context, 27 mapping= validate and REQUEST,23 mapping=request, 28 24 ob={}, 29 25 layout_mode='create', 26 formaction = "eligibility", 27 schoolresults = sr, 30 28 ) 31 res = jamb_rendered + res 32 if psm == 'invalid': 33 return context.eligibility_form(rendered = res, 29 30 inr = 0 31 if fhas('add') and (fget('type') or fget('subject') or fget('result')): 32 sr.append((fget('type'),fget('subject'),fget('result'))) 33 psm = "new result added" 34 elif fhas('change') and fget('keys'): 35 for k in fget('keys'): 36 sr[int(k)] = (fget('type_%s' % k),fget('subject_%s' % k),fget('result_%s' % k)) 37 inr += 1 38 psm = "%s items changed" % inr 39 elif fhas('delete') and fget('keys'): 40 new = [] 41 todelete = fget('keys') 42 for k in range(len(sr)): 43 if str(k) not in todelete: 44 new.append(sr[k]) 45 inr = len(todelete) 46 sr = new 47 psm = "%s items deleted" % inr 48 else: 49 psm = '' 50 eli.edit(mapping={'schoolresults': sr}) 51 res,dummy,ds = lt.renderLayout(layout_id= 'student_schoolresults', 52 schema_id= 'student_eligibility', 53 context=context, 54 mapping=request, 55 ob={}, 56 layout_mode='create', 57 formaction = "eligibility", 58 schoolresults = sr, 59 ) 60 61 return context.eligibility_form(rendered = res, 34 62 #psm = str(ds), 35 psm = "Please correct your input", 36 ds = ds, 63 psm = psm, 37 64 ) 38 elif psm == '': 39 return context.eligibility_form(rendered = res, 40 psm = None, 41 ds = ds, 42 ) 43 elif psm == 'valid': 44 s_personal = context.PERSONAL.getContent() 45 s_personal.edit(mapping={'email': ds.get('email')}) 46 #pw = REQUEST.get("widget__pw") 47 #pm.setPassword(pw) 48 psm = 'Email has been successfully set.' 49 return context.REQUEST.RESPONSE.redirect('%s' % context.portal_url.getUrlFromRpath('/students')) 50 51 ##return context.eligibility_form(rendered = res, 52 ## psm = psm, 65 ##elif psm == '': 66 ## return context.eligibility_form(rendered = res, 67 ## psm = None, 53 68 ## ds = ds, 54 69 ## ) 70 ##elif psm == 'valid': 71 ## s_personal = context.PERSONAL.getContent() 72 ## s_personal.edit(mapping={'email': ds.get('email')}) 73 ## #pw = REQUEST.get("widget__pw") 74 ## #pm.setPassword(pw) 75 ##psm = 'Email has been successfully set.' 76 ##return context.REQUEST.RESPONSE.redirect('%s' % context.portal_url.getUrlFromRpath('/students')) 77 ## 78 ####return context.eligibility_form(rendered = res, 79 #### psm = psm, 80 #### ds = ds, 81 #### )
Note: See TracChangeset for help on using the changeset viewer.