Changeset 404


Ignore:
Timestamp:
22 Aug 2006, 21:45:50 (18 years ago)
Author:
joachim
Message:

accommodation startet

Location:
WAeUP_SRP/trunk
Files:
1 deleted
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Accommodation.py

    r200 r404  
    1010from Products.CPSDocument.CPSDocument import CPSDocument
    1111from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder
     12from Products.WAeUP_SRP.WAeUPTables import AccommodationTable
    1213
    1314class AccoFolder(CPSDocument): ###(
     
    1920    security = ClassSecurityInfo()
    2021   
     22    security.declareProtected(ModifyPortalContent,"generateFreeBedsList") ###(
     23    def generateFreeBedsList(self):
     24        """
     25        generate the free Bedslist.
     26        """
     27        freelist = AccommodationTable()
     28        l = self.portal_catalog({'meta_type': "Accommodation"})
     29        halls = []
     30        for h in l:
     31            halls.append(h.getObject())
     32        for hall in halls:
     33            h = hall.getContent()
     34            for block in range(1,int(h.nr_of_blocks)):
     35                for floor in range(1,int(h.nr_of_floors)):
     36                    for room in range(1,int(h.rooms_per_floor)):
     37                        for bed in 'ABCDEFGH'[:int(h.beds_per_room)]:
     38                            room_nr = floor*100 + room
     39                            freelist.addRecord(bed = '%s_%d_%s' % (h.getId(),room_nr,bed),
     40                                               bed_type = "test")
     41
     42###)
    2143
    2244InitializeClass(AccoFolder)
     
    2850###)
    2951
    30 
    3152class Accommodation(CPSDocument): ###(
    3253    """
     
    3758    security = ClassSecurityInfo()
    3859   
    39     security.declareProtected(View,"Title")
     60    security.declareProtected(View,"Title") ###(
    4061    def Title(self):
    4162        """compose title"""
     
    4566            return self.title
    4667        return heading
    47    
     68
     69###)
     70
     71       
     72                           
     73               
    4874InitializeClass(Accommodation)
    4975
  • WAeUP_SRP/trunk/WAeUPTables.py

    r363 r404  
    6161        self.catalog_object(dict2ob(record_data), uid)
    6262
    63 class AccomodationTable(WAeUPTable):
     63class AccommodationTable(WAeUPTable):
    6464   
    65     meta_type = 'WAeUP Accomodation Tool'
     65    meta_type = 'WAeUP Accommodation Tool'
    6666   
    6767    def __init__(self):
    68         WAeUPTable.__init__(self, 'portal_accomodation')
     68        WAeUPTable.__init__(self, 'portal_accommodation')
    6969
    7070    def addRecord(self, **data):
     
    7575
    7676
    77 InitializeClass(AccomodationTable)
     77InitializeClass(AccommodationTable)
  • WAeUP_SRP/trunk/exportimport.py

    r363 r404  
    5656    pm.setLocalGroupRoles(site,['role:Authenticated',],'SectionReader')
    5757
    58     importObjects(site.portal_accomodation, '', context)
     58    importObjects(site.portal_accommodation, '', context)
    5959   
    6060##    if hasattr(site,'campus'):
     
    7777    _LOGGER_ID = 'waeup_table'
    7878
    79     name = 'accomodation'
     79    name = 'accommodation'
    8080
    8181# This the XMLAdapter itself. It encodes the im- / export logic that is specific
  • WAeUP_SRP/trunk/profiles/default/accommodation.xml

    r397 r404  
    66  <indexed_attr value="bed"/>
    77 </index>
     8 <index name="bed_type" meta_type="FieldIndex">
     9  <indexed_attr value="bed_type"/>
     10 </index>
    811 <index name="student" meta_type="FieldIndex">
    912  <indexed_attr value="student"/>
  • WAeUP_SRP/trunk/profiles/default/layouts/accommodation.xml

    r218 r404  
    77 <property name="flexible_widgets"/>
    88 <property name="validate_values_expr"></property>
    9  <widget name="beds_assigned" meta_type="Int Widget">
    10   <property name="fields">
    11    <element value="beds_assigned"/>
    12   </property>
    13   <property name="is_required">True</property>
    14   <property name="label">Nr. of Assigned Beds</property>
    15   <property name="label_edit">Nr. of Assigned Beds</property>
    16   <property name="help">Number of beds already assigned to students</property>
    17  </widget>
    18  <widget name="beds_assigned_list" meta_type="Ordered List Widget">
    19   <property name="fields">
    20    <element value="beds_assigned_list"/>
    21   </property>
    22   <property name="label">Assigned Beds</property>
    23   <property name="label_edit">Assigned Beds</property>
    24   <property name="help">List of beds already assigned to students</property>
    25  </widget>
    269 <widget name="beds_for_final" meta_type="MultiSelect Widget">
    2710  <property name="fields">
     
    10184  <property name="vocabulary">range5</property>
    10285 </widget>
     86 <widget name="reserved_rooms" meta_type="String Widget">
     87  <property name="title">Reserved Rooms</property>
     88  <property name="fields">
     89   <element value="reserved_rooms"/>
     90  </property>
     91  <property name="label">Reserved Rooms</property>
     92  <property name="label_edit">Reserved Rooms</property>
     93  <property
     94     name="help">Enter the reserved room_nrs separeted by space.</property>
     95  <property name="readonly_layout_modes"/>
     96  <property name="hidden_layout_modes"/>
     97  <property name="hidden_readonly_layout_modes"/>
     98 </widget>
    10399 <widget name="rooms_per_floor" meta_type="Select Widget">
    104100  <property name="fields">
     
    162158   <cell name="beds_for_final"/>
    163159  </row>
     160  <row>
     161   <cell name="reserved_rooms"/>
     162  </row>
    164163 </table>
    165164</object>
  • WAeUP_SRP/trunk/profiles/default/schemas/accommodation.xml

    r205 r404  
    11<?xml version="1.0"?>
    22<object name="accommodation" meta_type="CPS Schema">
    3  <field name="beds_assigned" meta_type="CPS Int Field"/>
    4  <field name="beds_assigned_list" meta_type="CPS String List Field"/>
    53 <field name="beds_for_final" meta_type="CPS String List Field"/>
    64 <field name="beds_for_fresh" meta_type="CPS String List Field"/>
     
    1210 <field name="nr_of_blocks" meta_type="CPS Int Field"/>
    1311 <field name="nr_of_floors" meta_type="CPS Int Field"/>
     12 <field name="reserved_rooms" meta_type="CPS String List Field"/>
    1413 <field name="rooms_per_floor" meta_type="CPS Int Field"/>
    1514 <field name="study_courses" meta_type="CPS String List Field"/>
  • WAeUP_SRP/trunk/profiles/default/toolset.xml

    r363 r404  
    11<?xml version="1.0"?>
    22<tool-setup>
    3  <required tool_id="portal_accomodation"
    4            class="Products.WAeUP_SRP.WAeUPTables.AccomodationTable"/>
     3 <required tool_id="portal_accommodation"
     4           class="Products.WAeUP_SRP.WAeUPTables.AccommodationTable"/>
    55</tool-setup>
  • WAeUP_SRP/trunk/profiles/default/types/AccoFolder.xml

    r332 r404  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addAccoFolder</property>
    10  <property name="immediate_view">folder_view</property>
     10 <property name="immediate_view">academics_contents</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    2222  <element value="common"/>
    2323 </property>
    24  <property name="layouts">
    25   <element value="common"/>
    26  </property>
     24 <property name="layouts"/>
    2725 <property name="layout_clusters">
    2826  <element value="metadata:metadata"/>
     
    3331 <alias from="(Default)" to="temporary_view_all"/>
    3432 <alias from="view" to="temporary_view_all"/>
    35  <action title="Standard View" action_id="view" category="object"
    36     condition_expr="" url_expr="string:${object_url}/temporary_view_all"
    37     visible="True">
     33 <action title="View" action_id="view" category="object" condition_expr=""
     34    url_expr="string:${object_url}/academics_contents" visible="True">
    3835  <permission value="View"/>
    3936 </action>
    40  <action title="Add Accommodation Hall" action_id="add_accommodation"
     37 <action title="Add Accommodation Hall" action_id="new_entry"
    4138    category="object" condition_expr=""
    42     url_expr="string:${object_url}/add_accommodation" visible="True">
    43   <permission value="University Manage"/>
     39    url_expr="string:${object_url}/content_create?type_name=Accommodation"
     40    visible="True">
     41  <permission value="Modify portal content"/>
    4442 </action>
    4543 <action title="action_metadata" action_id="metadata" category="object"
    46     condition_expr="python:member and 'Manager' in member.getRoles()"
    47     url_expr="string:${object_url}/cpsdocument_metadata" visible="True">
    48   <permission value="University Manage"/>
     44    condition_expr="" url_expr="string:${object_url}/cpsdocument_metadata"
     45    visible="True">
     46  <permission value="Modify portal content"/>
    4947 </action>
    5048 <action title="action_edit" action_id="edit" category="object"
    51     condition_expr="python:member and 'Manager' in member.getRoles()"
    52     url_expr="string:${object_url}/cpsdocument_edit_form" visible="True">
     49    condition_expr="" url_expr="string:${object_url}/cpsdocument_edit_form"
     50    visible="True">
    5351  <permission value="Modify portal content"/>
    54   <permission value="University Manage"/>
    5552 </action>
    5653 <action title="Delegate" action_id="localroles" category="object"
    5754    condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
    5855    visible="False">
    59   <permission value="University Manage"/>
     56  <permission value="Modify portal content"/>
    6057 </action>
    6158</object>
  • WAeUP_SRP/trunk/profiles/default/types/Accommodation.xml

    r319 r404  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addAccommodation</property>
    10  <property name="immediate_view">cpsdocument_view</property>
     10 <property name="immediate_view">academics_contents</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3030 <property name="storage_methods"/>
    3131 <property name="cps_is_portlet">False</property>
    32  <alias from="(Default)" to="temporary_view_all"/>
    33  <alias from="view" to="temporary_view_all"/>
    34  <action title="Standard View" action_id="view" category="object"
    35     condition_expr="" url_expr="string:${object_url}/temporary_view_all"
    36     visible="True">
     32 <alias from="(Default)" to="academics_contents"/>
     33 <alias from="view" to="academics_contents"/>
     34 <action title="View" action_id="view" category="object" condition_expr=""
     35    url_expr="string:${object_url}/academics_contents" visible="True">
    3736  <permission value="View"/>
    3837 </action>
    3938 <action title="action_edit" action_id="edit" category="object"
    40     condition_expr="" url_expr="string:${object_url}/waeup_edit_form"
     39    condition_expr="" url_expr="string:${object_url}/cpsdocument_edit_form"
    4140    visible="True">
    42   <permission value="University Manage"/>
    43   <permission value="Student Manage"/>
     41  <permission value="Modify portal content"/>
    4442 </action>
    4543 <action title="action_metadata" action_id="metadata" category="object"
    46     condition_expr="python:member and 'Manager' in member.getRoles()"
    47     url_expr="string:${object_url}/cpsdocument_metadata" visible="True">
     44    condition_expr="" url_expr="string:${object_url}/cpsdocument_metadata"
     45    visible="True">
    4846  <permission value="Modify portal content"/>
    4947 </action>
     
    5149    condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
    5250    visible="False">
    53   <permission value="University Manage"/>
     51  <permission value="Modify portal content"/>
    5452 </action>
    5553</object>
  • WAeUP_SRP/trunk/skins/waeup_student/add_course_ticket.py

    r164 r404  
    22# $Id$
    33"""
    4 book an accomodation
     4add a course_ticket
    55"""
    66type_name = 'CourseTicket'
  • WAeUP_SRP/trunk/skins/waeup_student/book_accommodation.py

    r166 r404  
    22# $Id$
    33"""
    4 book an accomodation
     4book an accoMmodation
    55"""
    66import DateTime
  • WAeUP_SRP/trunk/skins/waeup_student/pay_hostel_fee.py

    r166 r404  
    22# $Id$
    33"""
    4 book an accomodation
     4book an accommodation
    55"""
    66import DateTime
  • WAeUP_SRP/trunk/tests/test_tables.py

    r363 r404  
    2626    def test_install(self):
    2727        # Make sure the table got installed properly
    28         patool = self.portal.portal_accomodation
    29         self.failUnlessEqual(patool.meta_type, 'WAeUP Accomodation Tool')
     28        patool = self.portal.portal_accommodation
     29        self.failUnlessEqual(patool.meta_type, 'WAeUP Accommodation Tool')
    3030        self.failUnlessEqual(patool.schema(), ['bed', 'student'])
    3131        self.failUnlessEqual(patool.indexes(), ['bed', 'student'])
    3232       
    3333    def test_add_change_delete(self):
    34         patool = self.portal.portal_accomodation
     34        patool = self.portal.portal_accommodation
    3535       
    3636        # Add
Note: See TracChangeset for help on using the changeset viewer.