[1782] | 1 | ##parameters=REQUEST |
---|
| 2 | # $Id: firsttime_login.py 1747 2007-05-07 20:56:24Z joachim $ |
---|
| 3 | """ |
---|
| 4 | process the Application Form |
---|
| 5 | return html renderer + psm |
---|
| 6 | """ |
---|
| 7 | import DateTime |
---|
| 8 | from urllib import urlencode |
---|
| 9 | current = DateTime.DateTime() |
---|
| 10 | pr = context.portal_registration |
---|
| 11 | |
---|
| 12 | validate = REQUEST.has_key("cpsdocument_create_button") |
---|
| 13 | |
---|
| 14 | lt = context.portal_layouts |
---|
| 15 | #pr = context.portal_registration |
---|
| 16 | |
---|
| 17 | res,psm,ds = lt.renderLayout(layout_id= 'student_firsttime_login', |
---|
| 18 | schema_id= 'student_returning', |
---|
| 19 | context=context, |
---|
| 20 | mapping=validate and REQUEST, |
---|
| 21 | ob={}, |
---|
| 22 | layout_mode='create', |
---|
| 23 | formaction = "firsttime_login", |
---|
| 24 | button = "Search", |
---|
| 25 | commit=False, |
---|
| 26 | ) |
---|
| 27 | if psm == 'invalid': |
---|
| 28 | return context.firsttime_login_form(rendered = res, |
---|
| 29 | psm = "Please correct your input!", |
---|
| 30 | #psm = "%s, %s" % (psm,ds), |
---|
| 31 | firstlayout = True, |
---|
| 32 | lastlayout = True, |
---|
| 33 | ds = ds, |
---|
| 34 | ) |
---|
| 35 | elif psm == '': |
---|
| 36 | return context.firsttime_login_form(rendered = res, |
---|
| 37 | psm = None, |
---|
| 38 | firstlayout = True, |
---|
| 39 | lastlayout = True, |
---|
| 40 | ds = ds, |
---|
| 41 | ) |
---|
| 42 | elif psm == 'valid': |
---|
| 43 | pass |
---|
| 44 | action = "/set_access_data" |
---|
| 45 | args = {} |
---|
| 46 | args['matric_no'] = ds.get('matric_no') |
---|
| 47 | args['name'] = ds.get('student').name |
---|
| 48 | url = context.absolute_url() + action + '?' + urlencode(args) |
---|
| 49 | REQUEST.RESPONSE.redirect(url) |
---|