1 | ##parameters=REQUEST |
---|
2 | # $Id: check_admission.py 173 2005-11-15 16:28:29Z joachim $ |
---|
3 | """ |
---|
4 | process the Admission Form |
---|
5 | return html renderer + psm |
---|
6 | """ |
---|
7 | import DateTime |
---|
8 | current = DateTime.DateTime() |
---|
9 | |
---|
10 | type_name = 'StudentAdmission' |
---|
11 | |
---|
12 | ti = context.portal_types[type_name] |
---|
13 | |
---|
14 | REQUEST.set('type_name',type_name) |
---|
15 | |
---|
16 | validate = REQUEST.has_key("cpsdocument_edit_button") |
---|
17 | |
---|
18 | |
---|
19 | lt = context.portal_layouts |
---|
20 | pr = context.portal_registration |
---|
21 | |
---|
22 | res,psm,ds = lt.renderLayout(layout_id= 'student_check_pin', |
---|
23 | schema_id= 'student_admission', |
---|
24 | context=context, |
---|
25 | mapping=validate and REQUEST, |
---|
26 | ob={}, |
---|
27 | layout_mode='create', |
---|
28 | formaction = "request_admission", |
---|
29 | submit = "check", |
---|
30 | ) |
---|
31 | if psm == 'invalid': |
---|
32 | return context.request_admission_form(rendered = res, |
---|
33 | psm = "Please correct your input", |
---|
34 | ds = ds, |
---|
35 | ) |
---|
36 | elif psm == '': |
---|
37 | return context.request_admission_form(rendered = res, |
---|
38 | psm = None, |
---|
39 | ds = ds, |
---|
40 | ) |
---|
41 | elif psm == 'valid': |
---|
42 | jamb_id = ds.get('jamb_id') |
---|
43 | catalog = context.portal_catalog |
---|
44 | search = catalog({'meta_type': 'StudentAdmission', |
---|
45 | 'jamb_reg_no': jamb_id |
---|
46 | }) |
---|
47 | |
---|
48 | if len(search) < 1: |
---|
49 | psm = "No JAMB record %s" % (jamb_id) |
---|
50 | return context.request_admission_form(rendered = res, |
---|
51 | psm = psm, |
---|
52 | ds = ds, |
---|
53 | ) |
---|
54 | admission = search[0].getObject() |
---|
55 | student = admission.aq_parent |
---|
56 | student.invokeFactory('StudentClearance','clearance') |
---|
57 | student.invokeFactory('StudentPersonal','personal') |
---|
58 | # now display the passport form with jamb-data readonly |
---|
59 | return student.acknowledge_slip() |
---|
60 | |
---|
61 | |
---|