Changeset 1269


Ignore:
Timestamp:
11 Jan 2007, 17:06:34 (18 years ago)
Author:
joachim
Message:

new acco_hall_view with csv-download

Location:
WAeUP_SRP/trunk/skins
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_accommodation/acco_hall_view.pt

    r911 r1269  
    1 <metal:html tal:define="info context/getAccoHallInfo;"
    2             >
     1<metal:html tal:define="info context/getAccoHallInfo">
    32  <metal:body use-macro="here/waeup_content_master/macros/master">
    43    <metal:block fill-slot="header">
     
    3231      </table>
    3332      <br />
    34       <table tal:condition="info/reserved"
     33      <div>
     34        <a href="download"
     35           tal:attributes="href string:hall_allocation_list">
     36          <strong>Download bedlist as csv </strong></a>
     37      </div>
     38      <br />
     39      <table tal:condition="python:info['reserved']"
    3540             tal:define="reserved info/reserved">
    3641        <tr>
    37           <th width="200px">Student</th>
     42          <th width="50px">Student-Id</th>
     43          <th width="150px">Name</th>
    3844          <th>Bed</th>
    3945        </tr>
     
    4349               tal:content="bt/student"></a>
    4450          </td>
     51          <td tal:content="bt/name" />
    4552          <td tal:content="bt/bed" />
    4653        </tr>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py

    r913 r1269  
    1010# $Id$
    1111"""
    12 return Info about the Faculties
     12return Info about a Accommodation Hall
    1313"""
     14
     15def cmp_bed(a,b):
     16    if a['bed'] > b['bed']:
     17        return 1
     18    return -1
     19
    1420request = context.REQUEST
     21#from Products.zdb import set_trace;set_trace()
    1522
    1623wf = context.portal_workflow
     
    3037for bt in bed_types:
    3138    total = len(pa(bed_type=bt,hall=context.getId()))
     39    if total <= 1:
     40        continue
    3241    free = len(pa.searchResults({'bed_type': bt,
    3342                                 'student':reserved,
     
    3948info['bed_types'] = bt_list
    4049res_list = []
    41 students_rpath = context.portal_catalog(meta_type = "StudentsFolder")[-1].relative_path
    42 students_url = "%s/%s" % (context.portal_url(),students_rpath)
    43 if reserved > 1:
     50students_url = "%s/campus/students" % (context.portal_url())
     51if reserved:
    4452    for st in reserved:
    4553        if st:
    4654            res = pa(hall=context.getId(),student=st)
    47             if res:
    48                 res_list.append({'student': st,
    49                                  'student_url': '%s/%s' % (students_url,st),
    50                                  'bed': context.formatBed(res[0].bed) })
     55            if not res:
     56                continue
     57            d = {}
     58            d['student'] = st
     59            d['student_url'] ='%s/%s' % (students_url,st)
     60            bed = context.formatBed(res[0].bed).split('/')
     61            d['bed'] = " / ".join(bed[1:])
     62            erg = context.students_catalog(id = st)
     63            if erg:
     64                sd = context.getFormattedStudentEntry(erg[0])
     65                d.update(sd)
     66            res_list.append(d)
     67res_list.sort(cmp_bed)
    5168info['reserved'] = res_list
    5269
Note: See TracChangeset for help on using the changeset viewer.