Changeset 1444


Ignore:
Timestamp:
19 Feb 2007, 17:16:34 (18 years ago)
Author:
joachim
Message:

added release reserved bed function.

Location:
WAeUP_SRP/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/layouts/student_study_level.xml

    r734 r1444  
    11<?xml version="1.0"?>
     2<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
    23<object name="student_study_level" meta_type="CPS Layout">
    34 <property name="layout_create_method"></property>
  • WAeUP_SRP/trunk/profiles/default/types/StudentStudyLevel.xml

    r1146 r1444  
    11<?xml version="1.0"?>
     2<?xml-stylesheet type="text/xsl" href="types.xsl"?>
    23<object name="StudentStudyLevel" meta_type="CPS Flexible Type Information"
    34   xmlns:i18n="http://xml.zope.org/namespaces/i18n">
  • WAeUP_SRP/trunk/skins/waeup_accommodation/acco_folder_index.py

    r937 r1444  
    1717pm = context.portal_membership
    1818
     19#from Products.zdb import set_trace;set_trace()
    1920if context.isSectionOfficer():
    2021    if context.portal_type == 'AccoFolder':
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py

    r1440 r1444  
    1515logger = logging.getLogger('Accommodation.BookReservedBed')
    1616
    17 change_bed = REQUEST.has_key("reserve_and_change")
    18 validate = change_bed or (REQUEST.has_key("reserve") and
     17change = REQUEST.has_key("reserve_and_change")
     18release = REQUEST.has_key("release")
     19reserve = REQUEST.has_key("reserve")
     20validate = release or change or (reserve and
    1921           REQUEST.get("reserve").startswith('Reserve'))
    2022mode = 'create'
    21 
    2223d = {}
    2324rendered,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking',
     
    6667    bed_brain = res[0]
    6768    already = acco_cat(student=sid)
    68     if already and not change_bed:
    69         psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
    70         break
    71     if not bed_brain.bed_type.endswith("reserved"):
    72         psm = "Not a reserved bed %s" % bid
    73         break
    74     if bed_brain.student and not change_bed:
    75         psm = "Bed %s already reserved for %s" % (bid,bed_brain.student)
    76         break
    77     if student.sex and not block in doc.blocks_for_female:
    78         psm = "Sex does not match %s" % bid
    79         break
     69    if reserve or change:
     70        if already and not change:
     71            psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
     72            break
     73        if not bed_brain.bed_type.endswith("reserved"):
     74            psm = "Not a reserved bed %s" % bid
     75            break
     76        if bed_brain.student and not change:
     77            psm = "Bed %s already reserved for %s" % (bid,bed_brain.student)
     78            break
     79        if student.sex and not block in doc.blocks_for_female:
     80            psm = "Sex does not match %s" % bid
     81            break
     82    if release:
     83        if not already:
     84            psm = "Student %s already has no reserved beds" % (sid, already[0].bed)
     85            break
     86        if not bed_brain.bed_type.endswith("reserved"):
     87            psm = "Not a reserved bed %s" % bid
     88            break
     89        if not bed_brain.student:
     90            psm = "Bed %s not reserved for %s" % (bid,bed_brain.student)
     91            break
    8092    break
     93       
    8194if psm != '':
    8295    return context.book_reserved_bed_form(rendered = rendered,
     
    87100                                 button = "Reserve Bed",
    88101                                 )
    89 if change_bed:
     102if change:
    90103    for bed in already:
    91104        acco_cat.modifyRecord(bed=bed.bed,student='')
    92105       
    93 acco_cat.modifyRecord(bed = bid, student = sid)
    94106students = context.portal_url.getPortalObject().campus.students
    95107student_obj = getattr(students,sid)
    96108acco_id = "accommodation_%s" % context.getSessionId()
    97 if acco_id in student_obj.objectIds():
    98     acco_doc = getattr(student_obj, acco_id).getContent()
    99     acco_doc.edit(mapping={'bed': bid})
    100 logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
     109if reserve or change:
     110    acco_cat.modifyRecord(bed = bid, student = sid)
     111    if acco_id in student_obj.objectIds():
     112        acco_doc = getattr(student_obj, acco_id).getContent()
     113        acco_doc.edit(mapping={'bed': bid})
     114    logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
     115    psm = "Bed reserved for %s %s" % (sid,student.name)
     116elif release:
     117    acco_cat.modifyRecord(bed=bid,student='')
     118    if acco_id in student_obj.objectIds():
     119        acco_doc = getattr(student_obj, acco_id).getContent()
     120        acco_doc.edit(mapping={'bed': bid + "(removed)"})
     121    logger.info('"%s","released reserved bed %s for","%s"' % (member,bid,sid))
     122    psm = "Bed %s released for %s" % (sid,student.name)
     123   
    101124mode = 'view'
    102125return context.book_reserved_bed_form(rendered = "",
    103                                  psm = "Bed reserved for %s %s" % (sid,student.name),
     126                                 psm = psm,
    104127                                 mode = mode,
    105128                                 formaction = "book_reserved_bed",
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt

    r1440 r1444  
    2828                 value="Reserve and Change Bed"
    2929                 />
     30          <input type="submit" tal:condition="python:mode !='view'"
     31                 class="standalone"
     32                 name="release"
     33                 value="Release Bed"
     34                 />
    3035        </form>
    3136      </metal:block>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py

    r1301 r1444  
    3636all_booked = [st for st in res if st]
    3737booked_list = []
    38 #from Products.zdb import set_trace;set_trace()
     38from Products.zdb import set_trace;set_trace()
    3939for bt in bed_types:
    4040    total = len(pa(bed_type=bt,hall=context.getId()))
Note: See TracChangeset for help on using the changeset viewer.