source: WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_acco.py @ 635

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

halls can now be deleted, first steps for accommodation reservation

File size: 2.3 KB
Line 
1##parameters=REQUEST
2# $Id: apply_admission.py 543 2006-09-24 07:44:32Z henrik $
3"""
4process the Application Form
5return html renderer + psm
6"""
7import DateTime
8current = DateTime.DateTime()
9pr = context.portal_registration
10
11info = context.getStudentInfo()
12validate = REQUEST.has_key("cpsdocument_create_button")
13
14lt = context.portal_layouts
15pr = context.portal_registration
16
17res,psm,ds = lt.renderLayout(layout_id= 'student_acco_reserve',
18                      schema_id= 'student_acco_reserve',
19                      context=context,
20                      mapping=validate and REQUEST,
21                      ob={},
22                      layout_mode='create',
23                      formaction = "reserve_acco",
24                      button = "book Bed",
25                      )
26if psm == 'invalid':
27    return context.acco_reserve_form(rendered = res,
28                                 #psm = "Please correct your input.",
29                                 psm = "%s, %s" % (psm,ds),
30                                 firstlayout = True,
31                                 lastlayout = True,
32                                 ds = ds,
33                                 )
34elif psm == '':
35    return context.acco_reserve_form(rendered = res,
36                                 psm = None,
37                                 firstlayout = True,
38                                 lastlayout = True,
39                                 ds = ds,
40                                 )
41elif psm == 'valid':
42    s_id = ds.get('s_id')
43    pin = str(ds.get('acco_res_ac_pin'))
44    pa = context.portal_accommodation
45    code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
46    if code < 0:
47        return context.acco_reserve_form(rendered = res,
48                                 psm = bed,
49                                 firstlayout = True,
50                                 lastlayout = True,
51                                 ds = ds,
52                                 )
53    else:
54        return context.acco_reserve_form(rendered = res,
55                                 psm = "successfully reserved bed %s" % bed,
56                                 firstlayout = True,
57                                 lastlayout = True,
58                                 ds = ds,
59                                 )
60
61
Note: See TracBrowser for help on using the repository browser.