1 | ##parameters=REQUEST |
---|
2 | # $Id: personal_addon.py 179 2005-11-16 16:44:13Z joachim $ |
---|
3 | """ |
---|
4 | process the Admission Form |
---|
5 | return html renderer + psm |
---|
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") |
---|
13 | |
---|
14 | |
---|
15 | lt = context.portal_layouts |
---|
16 | pr = context.portal_registration |
---|
17 | pm = context.portal_membership |
---|
18 | |
---|
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_personal_addon', |
---|
25 | schema_id= 'student_personal', |
---|
26 | context=context, |
---|
27 | mapping=validate and REQUEST, |
---|
28 | ob={}, |
---|
29 | layout_mode='create', |
---|
30 | ) |
---|
31 | res = jamb_rendered + res |
---|
32 | if psm == 'invalid': |
---|
33 | return context.personal_addon_form(rendered = res, |
---|
34 | #psm = str(ds), |
---|
35 | psm = "Please correct your input", |
---|
36 | ds = ds, |
---|
37 | ) |
---|
38 | elif psm == '': |
---|
39 | return context.personal_addon_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() |
---|