Changeset 1444 for WAeUP_SRP/trunk/skins/waeup_accommodation
- Timestamp:
- 19 Feb 2007, 17:16:34 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_accommodation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_accommodation/acco_folder_index.py
r937 r1444 17 17 pm = context.portal_membership 18 18 19 #from Products.zdb import set_trace;set_trace() 19 20 if context.isSectionOfficer(): 20 21 if context.portal_type == 'AccoFolder': -
WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py
r1440 r1444 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 17 change = REQUEST.has_key("reserve_and_change") 18 release = REQUEST.has_key("release") 19 reserve = REQUEST.has_key("reserve") 20 validate = release or change or (reserve and 19 21 REQUEST.get("reserve").startswith('Reserve')) 20 22 mode = 'create' 21 22 23 d = {} 23 24 rendered,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking', … … 66 67 bed_brain = res[0] 67 68 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 80 92 break 93 81 94 if psm != '': 82 95 return context.book_reserved_bed_form(rendered = rendered, … … 87 100 button = "Reserve Bed", 88 101 ) 89 if change _bed:102 if change: 90 103 for bed in already: 91 104 acco_cat.modifyRecord(bed=bed.bed,student='') 92 105 93 acco_cat.modifyRecord(bed = bid, student = sid)94 106 students = context.portal_url.getPortalObject().campus.students 95 107 student_obj = getattr(students,sid) 96 108 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}) 100 logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid)) 109 if 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) 116 elif 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 101 124 mode = 'view' 102 125 return context.book_reserved_bed_form(rendered = "", 103 psm = "Bed reserved for %s %s" % (sid,student.name),126 psm = psm, 104 127 mode = mode, 105 128 formaction = "book_reserved_bed", -
WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt
r1440 r1444 28 28 value="Reserve and Change Bed" 29 29 /> 30 <input type="submit" tal:condition="python:mode !='view'" 31 class="standalone" 32 name="release" 33 value="Release Bed" 34 /> 30 35 </form> 31 36 </metal:block> -
WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py
r1301 r1444 36 36 all_booked = [st for st in res if st] 37 37 booked_list = [] 38 #from Products.zdb import set_trace;set_trace()38 from Products.zdb import set_trace;set_trace() 39 39 for bt in bed_types: 40 40 total = len(pa(bed_type=bt,hall=context.getId()))
Note: See TracChangeset for help on using the changeset viewer.