Changeset 6959 for main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Timestamp:
- 27 Oct 2011, 10:22:32 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py
r6956 r6959 21 21 from zope.component import createObject 22 22 from waeup.sirp.browser import ( 23 WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, WAeUPDisplayFormPage) 23 WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, WAeUPDisplayFormPage, 24 NullValidator) 24 25 from waeup.sirp.browser.breadcrumbs import Breadcrumb 25 from waeup.sirp.browser.resources import datepicker, datatable, tabs 26 from waeup.sirp.browser.resources import datepicker, datatable, tabs, toggleall 26 27 from waeup.sirp.browser.viewlets import ( 27 28 ManageActionButton, PrimaryNavTab, AddActionButton) … … 30 31 FriendlyDateWidget, FriendlyDateDisplayWidget, 31 32 FriendlyDatetimeDisplayWidget) 32 from waeup.sirp.browser. resources import toggleall33 from waeup.sirp.browser.pages import delSubobjects 33 34 from waeup.sirp.authentication import get_principal_role_manager 34 35 from waeup.sirp.hostels.container import HostelsContainer … … 82 83 grok.context(IHostel) 83 84 85 def title(self): 86 return self.context.hostel_name 87 84 88 class HostelsContainerPage(WAeUPDisplayFormPage): 85 89 """The standard view for hostels containers. … … 88 92 grok.name('index') 89 93 grok.require('waeup.viewHostels') 90 #grok.template('containerpage')94 grok.template('containerpage') 91 95 label = 'Accommodation Section' 92 title = ' Accommodation'96 title = 'Hostels' 93 97 pnav = 5 94 98 … … 106 110 grok.name('manage') 107 111 grok.require('waeup.manageHostels') 108 #grok.template('containermanagepage')109 pnav = 5 110 title = ' Accommodation'112 grok.template('containermanagepage') 113 pnav = 5 114 title = 'Hostels' 111 115 label = 'Manage accommodation section' 112 116 113 class HostelsContainerAddActionButton(AddActionButton): 114 grok.order(1) 115 grok.context(IHostelsContainer) 116 grok.view(HostelsContainerManagePage) 117 grok.require('waeup.manageHostels') 118 text = 'Add hostel' 119 target = 'addhostel' 117 # It's quite dangerous to remove entire hostels with its content (beds). 118 # Thus, this removed should be combined with an archiving function. 119 @grok.action('Remove selected') 120 def delHostels(self, **data): 121 form = self.request.form 122 if form.has_key('val_id'): 123 deleted = [] 124 child_id = form['val_id'] 125 child_id = [child_id] 126 for id in child_id: 127 deleted.append(id) 128 write_log_message(self, 'deleted: % s' % ', '.join(deleted)) 129 delSubobjects(self, redirect='@@manage', tab='2') 130 return 131 132 @grok.action('Add hostel', validator=NullValidator) 133 def addSubunit(self, **data): 134 self.redirect(self.url(self.context, 'addhostel')) 135 return 120 136 121 137 class HostelAddFormPage(WAeUPAddFormPage): … … 127 143 grok.template('hosteladdpage') 128 144 form_fields = grok.AutoFields(IHostel) 129 title = ' Accommodation'145 title = 'Hostels' 130 146 label = 'Add hostel' 131 147 pnav = 5 … … 138 154 self.context.addHostel(hostel) 139 155 self.flash('Hostel created.') 156 write_log_message(self, 'added: % s' % data['hostel_name']) 140 157 self.redirect(self.url(self.context[hostel.hostel_id], 'index')) 141 158 return … … 174 191 form_fields = grok.AutoFields(IHostel).omit('hostel_id') 175 192 #grok.template('hostelmanagepage') 176 label = 'Manage hostel data'193 label = 'Manage hostel' 177 194 pnav = 5 178 195 -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py
r6956 r6959 62 62 user, ob_class, target, comment)) 63 63 return 64 65 def loggerInfo(self, ob_class, comment=None): 66 target = self.__name__ 67 return self.logger_info(ob_class,target,comment) -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
r6958 r6959 34 34 title = u'Hall Name', 35 35 required = True, 36 default = u' hostel_1',36 default = u'Hall 1', 37 37 ) 38 38 … … 43 43 ) 44 44 45 nr_of_floors= schema.Int(46 title = u' Number of Floors',45 floors_per_block = schema.Int( 46 title = u'Floors per Block', 47 47 required = True, 48 48 default = 3,
Note: See TracChangeset for help on using the changeset viewer.