source: WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py @ 503

Last change on this file since 503 was 502, checked in by joachim, 18 years ago

Scratchcard Pin Generation
basic login in apply_admission

  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1##parameters=REQUEST
2# $Id: apply_admission.py 502 2006-09-11 10:39:59Z joachim $
3"""
4process the Application Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9pr = context.portal_registration
10
11
12type_name = 'StudentApplication'
13ti = context.portal_types[type_name]
14REQUEST.set('type_name',type_name)
15
16validate = REQUEST.has_key("cpsdocument_create_button")
17
18lt = context.portal_layouts
19pr = context.portal_registration
20
21res,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 = "apply_admission",
28                      button = "Open JAMB Record",
29                      )
30if psm == 'invalid':
31    return context.application_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                                 )
38elif psm == '':
39    return context.application_pin_form(rendered = res,
40                                 psm = None,
41                                 firstlayout = True,
42                                 lastlayout = True,
43                                 ds = ds,
44                                 )
45elif psm == 'valid':
46    s_id = ds.get('s_id')
47    return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s"
48          % (context.absolute_url(),s_id,'uNsEt',ds.get('app_ac_pin')))
49   
50##    jamb_id = ds.get('jamb_reg_no')
51##    student = context.getContent().getStudentByRegNo(jamb_id)
52##    if student is None:
53##        psm = "JAMB record %s not accessible." % (jamb_id)
54##        return context.application_pin_form(rendered = res,
55##                                 psm = psm,
56##                                 #psm = "%s, %s" % (psm,ds),
57##                                 ds = ds,
58##                                 )
59##if context.portal_workflow.getInfoFor(student,'review_state',None) == "created":
60##    #student.invokeFactory('StudentClearance','clearance')
61##da = {}
62##pin = str(ds.get('app_ac_pin'))
63##da['app_ac_pin'] = pin
64##da['app_ac_date'] = current
65##apdoc.edit(mapping = da)
66
67
68# now display the passport form with jamb-data readonly
69return context.REQUEST.RESPONSE.redirect("%s/application_form" % (student.application.absolute_url()))
70return student.application_form()
71
72
Note: See TracBrowser for help on using the repository browser.