Changeset 2845 for WAeUP_SRP/base/skins
- Timestamp:
- 3 Dec 2007, 21:14:20 (17 years ago)
- Location:
- WAeUP_SRP/base/skins/waeup_accommodation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt
r2825 r2845 53 53 <strong tal:content="row/title" /></a> </td> 54 54 <td tal:content="row/id"> </td> 55 55 <td tal:content="row/sort_id"> </td> 56 56 <td> 57 <a tal:condition="row/is_editable"57 <a tal:condition="row/is_editable" 58 58 href="edit" tal:attributes="href string:/${row/url}/external_edit_form" 59 59 target="edit" -
WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py
r1447 r2845 12 12 return Info about the Accommodation-Folder 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 14 19 request = context.REQUEST 15 20 … … 23 28 items = [] 24 29 is_editable = mtool.checkPermission('Modify portal content', context) 25 is_editable = False 26 halls = context.portal_catalog(portal_type='AccoHall') 27 for f in halls: 30 #is_editable = False 31 #halls = context.portal_catalog(portal_type='AccoHall') 32 for id,hall in context.objectItems(): 33 hall_doc = hall.getContent() 28 34 row = {} 29 row['id'] = f.id 30 row['title'] = f.Title 31 row['url'] = "%s/%s" % (context.absolute_url(),f.id) 35 row['id'] = id 36 row['title'] = hall_doc.Title() 37 row['sort_id'] = getattr(hall_doc,'sort_id',0) 38 row['url'] = "%s/%s" % (context.absolute_url(),id) 32 39 #fo = f.getObject() 33 40 #row['is_editable'] = mtool.checkPermission('Modify portal content', fo) 34 41 row['is_editable'] = is_editable 35 42 items.append(row) 43 items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id'])) 36 44 info['items'] = items 37 45 return info -
WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py
r1914 r2845 12 12 return Info about a Accommodation Hall 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 19 20 from Products.AdvancedQuery import Eq, Between, Le,In 14 21 15 22 def cmp_bed(a,b): … … 23 30 path_info = request.get('PATH_INFO').split('/') 24 31 mtool = context.portal_membership 25 pa = context.portal_accommodation 32 portal_accommodation = context.portal_accommodation 33 aq_accommodation = portal_accommodation.evalAdvancedQuery 26 34 info = {} 27 35 #dep_id = request.get('PATH_TRANSLATED').split('/')[-2] … … 30 38 info['choosen_ids'] = request.get('ids',[]) 31 39 info['doc'] = context.getContent() 32 bed_types = p a.uniqueValuesFor('bed_type')40 bed_types = portal_accommodation.uniqueValuesFor('bed_type') 33 41 bt_list = [] 34 42 bt_names = context.getBedTypeNames() 35 res = p a.uniqueValuesFor('student')36 all_booked = [st for st in res if st ]43 res = portal_accommodation.uniqueValuesFor('student') 44 all_booked = [st for st in res if st and st != 'not_occupied'] 37 45 booked_list = [] 38 #from Products.zdb import set_trace;set_trace()39 46 for bt in bed_types: 40 total = len(p a(bed_type=bt,hall=context.getId()))47 total = len(portal_accommodation(bed_type=bt,hall=context.getId())) 41 48 if total <= 1: 42 49 continue 43 booked = p a.searchResults({'bed_type': bt,50 booked = portal_accommodation.searchResults({'bed_type': bt, 44 51 'student':all_booked, 45 52 'hall': context.getId()}) … … 49 56 }) 50 57 booked_list.extend(booked) 58 # query = ~Eq('student','not_occupied') 59 # beds = aq_accommodation(query,sortSpecs=('bed_type',)) 60 # bt_list = [] 61 # bt_names = context.getBedTypeNames() 62 # bt = 'xxx' 63 # for bed in beds: 64 # if bt != bed.bed_type: 65 # bt = bed.bed_type 66 # total = len(aq_accommodation(Eq('bed_type',bt))) 67 # bt_list.append({'name': bt_names[bt], 68 # 'total': total, 69 # 'reserved': len(booked), 70 # }) 71 51 72 info['bed_types'] = bt_list 52 73 res_list = []
Note: See TracChangeset for help on using the changeset viewer.