1 | ##parameters=REQUEST |
---|
2 | # $Id: check_admission.py 55 2005-10-17 11:37:09Z 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 | |
---|
18 | res,psm,ds = lt.renderLayout(layout_id= 'admission', |
---|
19 | schema_id= 'jamb', |
---|
20 | context=context, |
---|
21 | mapping=validate and REQUEST, |
---|
22 | ob={}, |
---|
23 | layout_mode='create', |
---|
24 | ) |
---|
25 | if psm == 'invalid': |
---|
26 | return context.check_admission_form(rendered = res, |
---|
27 | psm = "Please correct your input", |
---|
28 | ds = ds, |
---|
29 | ) |
---|
30 | elif psm == '': |
---|
31 | return context.check_admission_form(rendered = res, |
---|
32 | psm = None, |
---|
33 | ds = ds, |
---|
34 | ) |
---|
35 | elif psm == 'valid': |
---|
36 | s_id = "s%s" % ds.get('jamb_id') |
---|
37 | sf = getattr(context,s_id,None) |
---|
38 | if sf is None: |
---|
39 | psm = "Your not admitted" |
---|
40 | return context.check_admission_form(rendered = res, |
---|
41 | psm = psm, |
---|
42 | ds = ds, |
---|
43 | ) |
---|
44 | elif hasattr(sf,'PERSONAL'): |
---|
45 | psm = "Your already admitted" |
---|
46 | return context.check_admission_form(rendered = res, |
---|
47 | psm = psm, |
---|
48 | ds = ds, |
---|
49 | ) |
---|
50 | rset = REQUEST.set |
---|
51 | sc_pin = ds.get('sc_pin') |
---|
52 | return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s" |
---|
53 | % (context.absolute_url(),s_id,sc_pin)) |
---|
54 | return context.student_admitted_form(rendered = res, |
---|
55 | psm = psm, |
---|
56 | ds = ds, |
---|
57 | student = student, |
---|
58 | jamb = jamb, |
---|
59 | pd = pd, |
---|
60 | ) |
---|
61 | |
---|
62 | return res,psm,ds |
---|
63 | |
---|