Ignore:
Timestamp:
19 Feb 2007, 15:06:06 (18 years ago)
Author:
joachim
Message:

book_reserverved_bed enhanced:

  • reserve and change button added

1.) all beds which are reserved for this student are unreserved.
2.) the selected bed is reserved for this student.
3.) The new bed-koordinate is reflected in the accommodation object.

The reserve functionallity is unchanged.

Location:
WAeUP_SRP/trunk/skins/waeup_accommodation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py

    r1426 r1440  
    1515logger = logging.getLogger('Accommodation.BookReservedBed')
    1616
     17change_bed = REQUEST.has_key("reserve_and_change")
     18validate = change_bed or (REQUEST.has_key("reserve") and
     19           REQUEST.get("reserve").startswith('Reserve'))
    1720mode = 'create'
    18 validate = REQUEST.has_key("cpsdocument_edit_button") and\
    19            REQUEST.get("cpsdocument_edit_button").startswith('Reserve')
     21
    2022d = {}
    2123rendered,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking',
     
    6466    bed_brain = res[0]
    6567    already = acco_cat(student=sid)
    66     if already:
     68    if already and not change_bed:
    6769        psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
    6870        break
     
    7072        psm = "Not a reserved bed %s" % bid
    7173        break
    72     if bed_brain.student:
     74    if bed_brain.student and not change_bed:
    7375        psm = "Bed %s already reserved for %s" % (bid,bed_brain.student)
    7476        break
     
    8587                                 button = "Reserve Bed",
    8688                                 )
     89if change_bed:
     90    for bed in already:
     91        acco_cat.modifyRecord(bed=bed.bed,student='')
     92       
    8793acco_cat.modifyRecord(bed = bid, student = sid)
     94students = context.portal_url.getPortalObject().campus.students
     95student_obj = getattr(students,sid)
     96acco_id = "accommodation_%s" % context.getSessionId()
     97if acco_id in student_obj.objectIds():
     98    acco_doc = getattr(student_obj, acco_id).getContent()
     99    acco_doc.edit(mapping={'bed': bid})
    88100logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
     101mode = 'view'
    89102return context.book_reserved_bed_form(rendered = "",
    90103                                 psm = "Bed reserved for %s %s" % (sid,student.name),
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt

    r1393 r1440  
    1919          <div tal:replace="structure rendered_main" />
    2020          <br />
    21           <input type="submit" class="standalone" name="cpsdocument_edit_button"
    22                  value="Save"
    23                  id="cpsdocument_edit_button"
     21          <input type="submit" class="standalone"
     22                 name="reserve"
    2423                 tal:attributes="value options/button"
    2524                 tal:condition="not:creation" />
    26           <input type="submit"
     25          <input type="submit" tal:condition="python:mode !='view'"
    2726                 class="standalone"
    28                  name="cpsdocument_create_button"
    29                  value="apply"
    30                  tal:attributes="value options/button"
    31                  tal:condition="creation" />
    32          
     27                 name="reserve_and_change"
     28                 value="Reserve and Change Bed"
     29                 />
    3330        </form>
    3431      </metal:block>
Note: See TracChangeset for help on using the changeset viewer.