Changeset 1440 for WAeUP_SRP/trunk/skins/waeup_accommodation
- Timestamp:
- 19 Feb 2007, 15:06:06 (18 years ago)
- 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 15 15 logger = logging.getLogger('Accommodation.BookReservedBed') 16 16 17 change_bed = REQUEST.has_key("reserve_and_change") 18 validate = change_bed or (REQUEST.has_key("reserve") and 19 REQUEST.get("reserve").startswith('Reserve')) 17 20 mode = 'create' 18 validate = REQUEST.has_key("cpsdocument_edit_button") and\ 19 REQUEST.get("cpsdocument_edit_button").startswith('Reserve') 21 20 22 d = {} 21 23 rendered,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking', … … 64 66 bed_brain = res[0] 65 67 already = acco_cat(student=sid) 66 if already :68 if already and not change_bed: 67 69 psm = "Student %s already reserved bed %s" % (sid, already[0].bed) 68 70 break … … 70 72 psm = "Not a reserved bed %s" % bid 71 73 break 72 if bed_brain.student :74 if bed_brain.student and not change_bed: 73 75 psm = "Bed %s already reserved for %s" % (bid,bed_brain.student) 74 76 break … … 85 87 button = "Reserve Bed", 86 88 ) 89 if change_bed: 90 for bed in already: 91 acco_cat.modifyRecord(bed=bed.bed,student='') 92 87 93 acco_cat.modifyRecord(bed = bid, student = sid) 94 students = context.portal_url.getPortalObject().campus.students 95 student_obj = getattr(students,sid) 96 acco_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}) 88 100 logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid)) 101 mode = 'view' 89 102 return context.book_reserved_bed_form(rendered = "", 90 103 psm = "Bed reserved for %s %s" % (sid,student.name), -
WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt
r1393 r1440 19 19 <div tal:replace="structure rendered_main" /> 20 20 <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" 24 23 tal:attributes="value options/button" 25 24 tal:condition="not:creation" /> 26 <input type="submit" 25 <input type="submit" tal:condition="python:mode !='view'" 27 26 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 /> 33 30 </form> 34 31 </metal:block>
Note: See TracChangeset for help on using the changeset viewer.