Changeset 626 for WAeUP_SRP


Ignore:
Timestamp:
9 Oct 2006, 09:09:57 (18 years ago)
Author:
joachim
Message:

several overviews for AccoFolder?,

Location:
WAeUP_SRP/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Accommodation.py

    r624 r626  
    3939        generated = []
    4040        generated.append('"Bed","BedType","Student"' % vars())
     41        beds_generated = []
    4142        for h in l:
    4243            halls.append(h.getObject())
     
    4445            #import pdb;pdb.set_trace()
    4546            h = hall.getContent()
     47            hall_gen = {}
     48            hall_gen['name'] = hall.getId()
     49            count = 0
    4650            reserved = [int(r) for r in h.reserved_rooms.split()]
    47             print h.which_sex
    4851            sex = 'male'
    4952            if h.which_sex:
     
    6568                            bt = "%(sex)s_%(bt)s" % vars()
    6669                            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)
    7079        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
    7180        open("%s/import/bedlist_%s.csv" % (i_home,current),"w+").write('\n'.join(generated))
    72         return self.accommodation.academics_contents()
     81        return self.accommodation.accommodation_view(beds_generated=beds_generated)
    7382
    7483###)
  • WAeUP_SRP/trunk/profiles/default/accommodation.xml

    r623 r626  
    33 <column value="bed"/>
    44 <column value="bed_type"/>
     5 <column value="hall"/>
    56 <column value="student"/>
    67 <index name="bed" meta_type="FieldIndex">
     
    1314  <indexed_attr value="student"/>
    1415 </index>
     16 <index name="hall" meta_type="FieldIndex">
     17  <indexed_attr value="hall"/>
     18 </index>
    1519</object>
  • WAeUP_SRP/trunk/profiles/default/types/AccoFolder.xml

    r624 r626  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addAccoFolder</property>
    10  <property name="immediate_view">academics_contents</property>
     10 <property name="immediate_view">accommodation_index</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3232 <alias from="view" to="accommodation_index"/>
    3333 <action title="View" action_id="view" category="object" condition_expr=""
    34     url_expr="string:${object_url}/academics_contents" visible="True">
     34    url_expr="string:${object_url}/accommodation_index" visible="True">
    3535  <permission value="View"/>
    3636 </action>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_view.pt

    r622 r626  
    11<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"
    34            >
    45  <metal:body use-macro="here/waeup_content_master/macros/master">
     
    1213        Page Title
    1314      </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>
    1447    </metal:block>
    1548    <metal:main fill-slot="main">
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallsInfo.py

    r622 r626  
    3535    items.append(row)
    3636info['items'] = items
     37pa = context.portal_accommodation
     38bed_types = pa.uniqueValuesFor('bed_type')
     39bt_list = []
     40for bt in bed_types:
     41    res = pa(bed_type=bt)
     42    bt_list.append({'name': bt, 'count': len(res)})
     43info['bed_types'] = bt_list
     44reserved = pa.uniqueValuesFor('student')
     45res_list = []
     46if 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 })
     51info['reserved'] = res_list
     52
    3753return info
Note: See TracChangeset for help on using the changeset viewer.