[477] | 1 | ##parameters=REQUEST |
---|
[486] | 2 | # $Id: apply_admission.py 511 2006-09-13 06:47:55Z joachim $ |
---|
[477] | 3 | """ |
---|
| 4 | process the Application Form |
---|
| 5 | return html renderer + psm |
---|
| 6 | """ |
---|
[482] | 7 | import DateTime |
---|
| 8 | current = DateTime.DateTime() |
---|
[502] | 9 | pr = context.portal_registration |
---|
[482] | 10 | |
---|
| 11 | |
---|
[477] | 12 | type_name = 'StudentApplication' |
---|
| 13 | ti = context.portal_types[type_name] |
---|
| 14 | REQUEST.set('type_name',type_name) |
---|
| 15 | |
---|
[478] | 16 | validate = REQUEST.has_key("cpsdocument_create_button") |
---|
[477] | 17 | |
---|
| 18 | lt = context.portal_layouts |
---|
| 19 | pr = context.portal_registration |
---|
| 20 | |
---|
[479] | 21 | res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe', |
---|
| 22 | schema_id= 'student_application', |
---|
[477] | 23 | context=context, |
---|
| 24 | mapping=validate and REQUEST, |
---|
[488] | 25 | ob={}, |
---|
[477] | 26 | layout_mode='create', |
---|
| 27 | formaction = "apply_admission", |
---|
[502] | 28 | button = "Open JAMB Record", |
---|
[477] | 29 | ) |
---|
| 30 | if psm == 'invalid': |
---|
| 31 | return context.application_pin_form(rendered = res, |
---|
[484] | 32 | psm = "Please correct your input.", |
---|
[488] | 33 | #psm = "%s, %s" % (psm,ds), |
---|
[478] | 34 | firstlayout = True, |
---|
| 35 | lastlayout = True, |
---|
[477] | 36 | ds = ds, |
---|
| 37 | ) |
---|
| 38 | elif psm == '': |
---|
| 39 | return context.application_pin_form(rendered = res, |
---|
| 40 | psm = None, |
---|
[478] | 41 | firstlayout = True, |
---|
| 42 | lastlayout = True, |
---|
[477] | 43 | ds = ds, |
---|
| 44 | ) |
---|
| 45 | elif psm == 'valid': |
---|
[502] | 46 | s_id = ds.get('s_id') |
---|
[511] | 47 | pin = str(ds.get('app_ac_pin')) |
---|
[502] | 48 | return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" |
---|
[511] | 49 | % (context.absolute_url(),s_id,pin.split('-')[2],pin)) |
---|
[502] | 50 | |
---|
| 51 | ## jamb_id = ds.get('jamb_reg_no') |
---|
| 52 | ## student = context.getContent().getStudentByRegNo(jamb_id) |
---|
| 53 | ## if student is None: |
---|
| 54 | ## psm = "JAMB record %s not accessible." % (jamb_id) |
---|
| 55 | ## return context.application_pin_form(rendered = res, |
---|
| 56 | ## psm = psm, |
---|
| 57 | ## #psm = "%s, %s" % (psm,ds), |
---|
| 58 | ## ds = ds, |
---|
| 59 | ## ) |
---|
| 60 | ##if context.portal_workflow.getInfoFor(student,'review_state',None) == "created": |
---|
| 61 | ## #student.invokeFactory('StudentClearance','clearance') |
---|
| 62 | ##da = {} |
---|
| 63 | ##pin = str(ds.get('app_ac_pin')) |
---|
| 64 | ##da['app_ac_pin'] = pin |
---|
| 65 | ##da['app_ac_date'] = current |
---|
| 66 | ##apdoc.edit(mapping = da) |
---|
[478] | 67 | |
---|
[479] | 68 | |
---|
[477] | 69 | # now display the passport form with jamb-data readonly |
---|
[479] | 70 | return context.REQUEST.RESPONSE.redirect("%s/application_form" % (student.application.absolute_url())) |
---|
[477] | 71 | return student.application_form() |
---|
| 72 | |
---|
| 73 | |
---|