source: WAeUP_SRP/base/skins/waeup_student/start_clearance.py @ 2496

Last change on this file since 2496 was 1857, checked in by joachim, 17 years ago

avoid conflicts (in custom)

  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1##parameters=REQUEST
2# $Id: start_clearance.py 1857 2007-06-05 20:41:11Z joachim $
3"""
4request Clearance
5"""
6import DateTime
7current = DateTime.DateTime()
8pr = context.portal_registration
9import logging
10logger = logging.getLogger('Skins.start_clearance')
11
12#type_name = 'Student'
13#ti = context.portal_types[type_name]
14#request.set('type_name',type_name)
15wf = context.portal_workflow
16request=REQUEST
17redirect = request.RESPONSE.redirect
18validate = REQUEST.has_key("cpsdocument_create_button")
19lt = context.portal_layouts
20#pr = context.portal_registration
21
22info = context.getClearanceInfo()
23if info is None:
24    member_id = str(context.portal_membership.getAuthenticatedMember())
25    logger.info('%s tried to start clearance for %s' % (member_id,request.get('PATH_INFO').split('/')[-2]))
26    return redirect("%s/srp_invalid_access" % context.portal_url())
27app_doc = info['app_doc']
28review_state = info['review_state']
29#session = REQUEST.SESSION
30res,psm,ds = lt.renderLayout('student_clearance',
31                             'student_clearance',
32                             context,
33                             mapping=validate and REQUEST,
34                             layout_mode='create',
35                             ob={},
36                             commit = False,
37                             formaction = "start_clearance",
38                             button = "Start",
39                      )
40if psm == '':
41    return context.clearance_pin_form(rendered = res,
42                                 psm = None,
43                                 firstlayout = True,
44                                 lastlayout = True,
45                                 ds = ds,
46                                 info = info,
47                                 )
48error = False
49
50##if session.get("clicked",None):
51##    psm = 'Please wait a moment until "Clearance started" turns green, then click on the green link!'
52##    error = True
53##    logger.info('"%s","repeatedly pressed the clearance button"' % (info['id']))
54
55if review_state == "clearance_pin_entered":
56    psm = "You have already entered a clearance pin!"
57    error = True
58    logger.info('%s tried to start clearance though already started' % (info['id']))
59elif psm == 'invalid':
60    psm = "Please correct your input!"
61    error = True
62    logger.info('%s entered wrong clearance pin' % (info['id']))
63elif app_doc.passport is None:
64    #psm = "You must upload your passport picture before you can start the registration process!"
65    #error = True
66    logger.info('%s started clearance without passport picture' % (info['id']))
67if error:
68    return context.clearance_pin_form(rendered = res,
69                                 psm = psm,
70                                 firstlayout = True,
71                                 lastlayout = True,
72                                 ds = ds,
73                                 info = info,
74                                 )
75#session.set("clicked","clicked")
76pin = str(ds.get('clr_ac_pin'))
77logger.info('%s started clearance with pin %s' % (info['id'],pin))
78wf.doActionFor(info['student'],'enter_clearance_pin')
79wf.doActionFor(info['clear'],'open')
80dc = {}
81app_doc = info['app_doc']
82dc['lga_ident'] = app_doc.get('jamb_lga')
83dc['lga'] = app_doc.get('jamb_state','no state') + ' / ' + app_doc.get('jamb_lga','no lga')
84dc['clr_ac_pin'] = pin
85dc['clr_ac_date'] = current
86dc['entry_date'] = current
87#dc['entry_session'] = "2006/2007"
88wf.doActionFor(info['app'],'close')
89info['clear_doc'].edit(mapping = dc)
90
91if info['penalty']:
92    logger.info('%s started late clearance' % (info['id']))
93
94return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
95
Note: See TracBrowser for help on using the repository browser.