Changeset 821


Ignore:
Timestamp:
9 Nov 2006, 21:37:29 (18 years ago)
Author:
joachim
Message:

make hostel allocation work

Location:
WAeUP_SRP/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/University.py

    r197 r821  
    11from Globals import InitializeClass,HTMLFile
    22from AccessControl import ClassSecurityInfo
     3from Products.ZCatalog.ZCatalog import ZCatalog
    34
    45from Products.CMFCore.utils import getToolByName
     
    2122    security = ClassSecurityInfo()
    2223       
    23     security.declarePublic('waeup_url')
    24     def waeup_url(self):
    25         """ return the base_url"""
    26         return "%s/sections/waeup" % self.portal_url
    27         return self.REQUEST
    28    
     24    security.declarePublic('getHallTitle')
     25    def getHallTitle(self,hall):
     26        """get the Hall Title"""
     27        res = ZCatalog.searchResults(self.portal_catalog,portal_type="AccoHall",id=hall)
     28        if res and len(res) == 1:
     29            return res[0].Title
     30        return hall
     31
    2932InitializeClass(University)
    3033
  • WAeUP_SRP/trunk/skins/waeup_accommodation/formatBed.py

    r805 r821  
     1## Script (Python) "students_indext"
     2##bind container=container
     3##bind context=context
     4##bind namespace=
     5##bind script=script
     6##bind subpath=traverse_subpath
    17##parameters=bed=None,mode=None,datastructure=None
     8##title=
    29# $Id$
    310"""
     
    1017    return ''
    1118hall,block,room,letter = bed.split('_')
    12 res = context.portal_catalog(portal_type="AccoHall",id=hall)
    13 if res and len(res) == 1:
    14     hall_title = res[0].Title
     19hall_title = context.restrictedTraverse("%s/campus/getHallTitle" %
     20                         (context.portal_url.getPortalPath()))(hall)
    1521return " %s / Block %s / Room %s / Bed %s" % (hall_title,block,room,letter)
  • WAeUP_SRP/trunk/skins/waeup_student/accommodation_pin_form.pt

    r805 r821  
    22                   portal_status_message options/psm;
    33                   data_storage options/ds;
    4                    jamb options/jamb/getContent|nothing;
     4                   mode options/mode;
    55                   edition python:1;"
    66                   >
     
    1414    </metal:block>
    1515      <metal:block fill-slot="main">
    16         <h3>Book Your Accommodation! </h3>
     16        <h3 tal:condition="python: mode == 'create'">Book Your Accommodation! </h3>
     17        <h3 tal:condition="python: mode == 'edit'">Pay Your Accommodation Maintainance Fee! </h3>
    1718        <br />
    1819        <div tal:replace="structure rendered_main" />
    1920          <p>Instructions :</p>
    20           <ul>
     21          <ul tal:condition="python: mode == 'create'">
    2122            <li>Buy a Hostel Application Scratch Card.</li>
     23            <li>Enter the PIN above.</li>
     24            <li>Print the Hostel Allocation Slip.</li>
     25          </ul>
     26          <ul tal:condition="python: mode == 'edit'">
     27            <li>Buy a Hostel Maintainance Scratch Card.</li>
    2228            <li>Enter the PIN above.</li>
    2329            <li>Print the Hostel Allocation Slip.</li>
  • WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py

    r805 r821  
    1111
    1212info = context.getStudentInfo()
    13 validate = REQUEST.has_key("cpsdocument_create_button") or\
    14            REQUEST.has_key("cpsdocument_edit_button")
     13validate = REQUEST.has_key("cpsdocument_create_button")
     14#           REQUEST.has_key("cpsdocument_edit_button")
    1515
    1616lt = context.portal_layouts
     
    2222mode = 'create'
    2323if info.has_key('acco') and info['acco']:
     24    validate = REQUEST.has_key("cpsdocument_edit_button")
    2425    if info['acco_review_state'] == "maintenance_fee_payed":
    2526        return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url())
     
    2728        mode = 'edit'
    2829d = {}
     30button = "Bookaccommodation"
    2931if mode == 'edit':
    3032    info = context.getStudentInfo()
    3133    d['acco_res_date'] = info['acco_doc'].acco_res_date
    3234    d['acco_res_sc_pin'] = info['acco_doc'].acco_res_sc_pin
     35    d['student_status'] = info['acco_doc'].student_status
    3336    d['bed'] = info['acco_doc'].bed
    3437    d['session'] = info['acco_doc'].session
     38    button = "Pay Maintainance Fee"
    3539res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation_fe',
    3640                      schema_id= 'student_accommodation',
     
    4044                      layout_mode=mode,
    4145                      formaction = "reserve_accommodation",
    42                       button = "Book",
     46                      button = button
    4347                      )
    4448if psm == 'invalid':
     
    4650                                 psm = "Please correct your input.",
    4751                                 #psm = "%s, %s" % (psm,ds),
    48                                  firstlayout = True,
    49                                  lastlayout = True,
     52                                 mode = mode,
    5053                                 ds = ds,
    5154                                 )
     
    5356    return context.accommodation_pin_form(rendered = res,
    5457                                 psm = None,
    55                                  firstlayout = True,
    56                                  lastlayout = True,
     58                                 mode = mode,
    5759                                 ds = ds,
    5860                                 )
     
    6668            return context.accommodation_pin_form(rendered = res,
    6769                                 psm = bed,
    68                                  firstlayout = True,
    69                                  lastlayout = True,
     70                                 mode = mode,
    7071                                 ds = ds,
    7172                                 )
     
    8687return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % student.absolute_url())
    8788
    88 ##return context.accommodation_pin_form(rendered = res,
    89 ##                                 psm = "successfully reserved bed %s" % bed,
    90 ##                                 firstlayout = True,
    91 ##                                 lastlayout = True,
    92 ##                                 ds = ds,
    93 ##                                 )
    9489
Note: See TracChangeset for help on using the changeset viewer.