Ignore:
Timestamp:
4 Nov 2011, 14:36:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement bed booking algorithm (work in progress!).

Location:
main/waeup.sirp/trunk/src/waeup/sirp/hostels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py

    r6988 r6996  
    3535from waeup.sirp.authentication import get_principal_role_manager
    3636from waeup.sirp.hostels.container import HostelsContainer
    37 from waeup.sirp.hostels.hostel import Hostel
     37from waeup.sirp.hostels.hostel import Hostel, NOT_OCCUPIED
    3838from waeup.sirp.hostels.interfaces import IHostelsContainer, IHostel
    3939
     
    204204        'Switch reservation of selected beds',
    205205        'Release selected beds']
     206    not_occupied = NOT_OCCUPIED
    206207
    207208    @property
    208209    def title(self):
    209210        return self.context.hostel_name
     211
     212    @property
     213    def students_url(self):
     214        return self.url(grok.getSite(),'students')
    210215
    211216    def update(self):
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser_templates/hostelmanagepage.pt

    r6971 r6996  
    7979                  tal:attributes="value value/__name__" />
    8080          </td>
    81           <td> <a tal:attributes="href value/__name__">
    82           <span tal:content="value/bed_id">Id</span>
    83           </a></td>
     81          <td tal:content="value/bed_id">Id</td>
    8482          <td tal:content="value/bed_type">Type</td>
    8583          <td tal:content="value/bed_number">Number</td>
    86           <td tal:content="value/owner">Owner</td>
     84          <td>
     85            <a tal:condition="python: value.owner != view.not_occupied"
     86               tal:attributes="href python: '%s/%s' % (view.students_url,value.owner)">
     87              <span tal:content="value/owner">Owner</span>
     88            </a>
     89          </td>
    8790        </tr>
    8891      </tbody>
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py

    r6991 r6996  
    121121        return self.bed_id.split('_')
    122122
     123    def bookBed(self, student_id):
     124        self.owner = student_id
     125        return
     126
    123127    def switchReservation(self):
    124128        """Reserves a bed or unreserve bed respectively.
  • main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py

    r6981 r6996  
    142142        """Determine the coordinates from bed_id.
    143143        """
     144    def bookBed(student_id):
     145        """Book a bed for a student.
     146        """
    144147
    145148    def switchReservation():
Note: See TracChangeset for help on using the changeset viewer.