- Timestamp:
- 9 Oct 2006, 09:09:57 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Accommodation.py
r624 r626 39 39 generated = [] 40 40 generated.append('"Bed","BedType","Student"' % vars()) 41 beds_generated = [] 41 42 for h in l: 42 43 halls.append(h.getObject()) … … 44 45 #import pdb;pdb.set_trace() 45 46 h = hall.getContent() 47 hall_gen = {} 48 hall_gen['name'] = hall.getId() 49 count = 0 46 50 reserved = [int(r) for r in h.reserved_rooms.split()] 47 print h.which_sex48 51 sex = 'male' 49 52 if h.which_sex: … … 65 68 bt = "%(sex)s_%(bt)s" % vars() 66 69 uid = '%s_%d_%d_%s' % (hall.getId(),block,room_nr,bed) 67 print bt,uid 68 freelist.addRecord(bed = uid, bed_type = bt, student= '') 69 generated.append('"%(uid)s","%(bt)s"' % vars()) 70 try: 71 freelist.addRecord(bed = uid, bed_type = bt,hall =hall.getId()) 72 count +=1 73 generated.append('"%(uid)s","%(bt)s"' % vars()) 74 except ValueError: 75 freelist.modifyRecord(bed = uid, bed_type = bt,hall =hall.getId()) 76 pass 77 hall_gen['count']= count 78 beds_generated.append(hall_gen) 70 79 current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") 71 80 open("%s/import/bedlist_%s.csv" % (i_home,current),"w+").write('\n'.join(generated)) 72 return self.accommodation.ac ademics_contents()81 return self.accommodation.accommodation_view(beds_generated=beds_generated) 73 82 74 83 ###) -
WAeUP_SRP/trunk/profiles/default/accommodation.xml
r623 r626 3 3 <column value="bed"/> 4 4 <column value="bed_type"/> 5 <column value="hall"/> 5 6 <column value="student"/> 6 7 <index name="bed" meta_type="FieldIndex"> … … 13 14 <indexed_attr value="student"/> 14 15 </index> 16 <index name="hall" meta_type="FieldIndex"> 17 <indexed_attr value="hall"/> 18 </index> 15 19 </object> -
WAeUP_SRP/trunk/profiles/default/types/AccoFolder.xml
r624 r626 8 8 <property name="product">WAeUP_SRP</property> 9 9 <property name="factory">addAccoFolder</property> 10 <property name="immediate_view">ac ademics_contents</property>10 <property name="immediate_view">accommodation_index</property> 11 11 <property name="global_allow">True</property> 12 12 <property name="filter_content_types">True</property> … … 32 32 <alias from="view" to="accommodation_index"/> 33 33 <action title="View" action_id="view" category="object" condition_expr="" 34 url_expr="string:${object_url}/ac ademics_contents" visible="True">34 url_expr="string:${object_url}/accommodation_index" visible="True"> 35 35 <permission value="View"/> 36 36 </action> -
WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_view.pt
r622 r626 1 1 <metal:html tal:define="info context/getAccoHallsInfo; 2 is_manager info/is_manager|nothing;" 2 is_manager info/is_manager|nothing; 3 beds_generated options/beds_generated|nothing" 3 4 > 4 5 <metal:body use-macro="here/waeup_content_master/macros/master"> … … 12 13 Page Title 13 14 </h3> 15 <table tal:condition="beds_generated"> 16 <tr> 17 <th>Hall</th> 18 <th>Beds generated</th> 19 </tr> 20 <tr tal:repeat="hall beds_generated"> 21 <td tal:content="hall/name"></td> 22 <td align="right" tal:content="hall/count"></td> 23 </tr> 24 </table> 25 <table tal:condition="info/bed_types" 26 tal:define="bed_types info/bed_types"> 27 <tr> 28 <th>Bed Type</th> 29 <th>Beds</th> 30 </tr> 31 <tr tal:repeat="bt bed_types"> 32 <td tal:content="bt/name" /> 33 <td tal:content="bt/count" /> 34 </tr> 35 </table> 36 <table tal:condition="info/reserved" 37 tal:define="reserved info/reserved"> 38 <tr> 39 <th>Student</th> 40 <th>Bed</th> 41 </tr> 42 <tr tal:repeat="bt reserved"> 43 <td tal:content="bt/student" /> 44 <td tal:content="bt/bed" /> 45 </tr> 46 </table> 14 47 </metal:block> 15 48 <metal:main fill-slot="main"> -
WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallsInfo.py
r622 r626 35 35 items.append(row) 36 36 info['items'] = items 37 pa = context.portal_accommodation 38 bed_types = pa.uniqueValuesFor('bed_type') 39 bt_list = [] 40 for bt in bed_types: 41 res = pa(bed_type=bt) 42 bt_list.append({'name': bt, 'count': len(res)}) 43 info['bed_types'] = bt_list 44 reserved = pa.uniqueValuesFor('student') 45 res_list = [] 46 if reserved > 1: 47 for st in reserved: 48 if st: 49 res = pa(student=st) 50 bt_list.append({'student': st, 'bed': res[0].bed }) 51 info['reserved'] = res_list 52 37 53 return info
Note: See TracChangeset for help on using the changeset viewer.