1 | ##parameters=REQUEST |
---|
2 | # $Id: apply_admission.py 649 2006-10-11 06:24:39Z joachim $ |
---|
3 | """ |
---|
4 | request Clearance |
---|
5 | """ |
---|
6 | import DateTime |
---|
7 | current = DateTime.DateTime() |
---|
8 | pr = context.portal_registration |
---|
9 | |
---|
10 | |
---|
11 | type_name = 'StudentApplication' |
---|
12 | ti = context.portal_types[type_name] |
---|
13 | REQUEST.set('type_name',type_name) |
---|
14 | redirect = REQUEST.RESPONSE.redirect |
---|
15 | wf = context.portal_workflow |
---|
16 | validate = REQUEST.has_key("cpsdocument_create_button") |
---|
17 | |
---|
18 | lt = context.portal_layouts |
---|
19 | pr = context.portal_registration |
---|
20 | |
---|
21 | res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe', |
---|
22 | schema_id= 'student_application', |
---|
23 | context=context, |
---|
24 | mapping=validate and REQUEST, |
---|
25 | ob={}, |
---|
26 | layout_mode='create', |
---|
27 | formaction = "check_admission", |
---|
28 | button = "Check Admission", |
---|
29 | ) |
---|
30 | if psm == 'invalid': |
---|
31 | return context.check_admission_pin_form(rendered = res, |
---|
32 | psm = "Please correct your input.", |
---|
33 | #psm = "%s, %s" % (psm,ds), |
---|
34 | firstlayout = True, |
---|
35 | lastlayout = True, |
---|
36 | ds = ds, |
---|
37 | ) |
---|
38 | elif psm == '': |
---|
39 | return context.check_admission_pin_form(rendered = res, |
---|
40 | psm = None, |
---|
41 | firstlayout = True, |
---|
42 | lastlayout = True, |
---|
43 | ds = ds, |
---|
44 | ) |
---|
45 | elif psm == 'valid': |
---|
46 | s_id = ds.get('s_id') |
---|
47 | student = getattr(context.campus.students, s_id) |
---|
48 | review_state = wf.getInfoFor(student,'review_state',None) |
---|
49 | if review_state == "finally_rejected": |
---|
50 | url = "%s/campus/students/%s/pume/finally_rejected_view" % (context.portal_url(),s_id) |
---|
51 | return redirect(url) |
---|
52 | pin = str(ds.get('app_ac_pin')) |
---|
53 | return redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" |
---|
54 | % (context.absolute_url(),s_id,pin.split('-')[2],pin)) |
---|
55 | return |
---|