- Timestamp:
- 31 Jan 2014, 09:14:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/hostels/browser.py
r10771 r11016 26 26 NullValidator) 27 27 from waeup.kofa.browser.breadcrumbs import Breadcrumb 28 from waeup.kofa.browser.resources import datepicker, datatable, tabs, warning29 28 from waeup.kofa.browser.layout import default_primary_nav_template 30 29 from waeup.kofa.browser.pages import delSubobjects … … 134 133 _('Clear all hostels'), 135 134 _('Remove selected')] 136 137 def update(self):138 tabs.need()139 self.tab1 = self.tab2 = self.tab3 = self.tab4 = ''140 qs = self.request.get('QUERY_STRING', '')141 if not qs:142 qs = 'tab1'143 setattr(self, qs, 'active')144 warning.need()145 datatable.need()146 return super(HostelsContainerManagePage, self).update()147 135 148 136 # It's quite dangerous to remove entire hostels with its content (beds). … … 167 155 return 168 156 169 @jsaction(_('Clear all hostels') )157 @jsaction(_('Clear all hostels'), style='danger') 170 158 def clearHostels(self, **data): 171 159 self.context.clearAllHostels() 172 160 self.flash(_('All hostels cleared.')) 173 161 write_log_message(self, 'all hostels cleared') 174 self.redirect(self.url(self.context, '@@manage')+' ?tab2')162 self.redirect(self.url(self.context, '@@manage')+'#tab2') 175 163 return 176 164 … … 201 189 self.context.addHostel(hostel) 202 190 except KeyError: 203 self.flash(_('The hostel already exists.') )191 self.flash(_('The hostel already exists.'), type='warning') 204 192 return 205 193 self.flash(_('Hostel created.')) … … 251 239 return self.url(grok.getSite(),'students') 252 240 253 def update(self): 254 datepicker.need() # Enable jQuery datepicker in date fields. 255 tabs.need() 256 datatable.need() 257 warning.need() 258 self.tab1 = self.tab2 = '' 259 qs = self.request.get('QUERY_STRING', '') 260 if not qs: 261 qs = 'tab1' 262 setattr(self, qs, 'active') 263 super(HostelManageFormPage, self).update() 264 return 265 266 @action(_('Save')) 241 @action(_('Save'), style='primary') 267 242 def save(self, **data): 268 243 msave(self, **data) 269 244 return 270 245 271 @action(_('Update all beds') )246 @action(_('Update all beds'), style='primary') 272 247 def updateBeds(self, **data): 273 248 removed, added, modified, modified_beds = self.context.updateBeds() … … 280 255 self.flash(flash_message) 281 256 write_log_message(self, message) 282 self.redirect(self.url(self.context, '@@manage')+' ?tab2')257 self.redirect(self.url(self.context, '@@manage')+'#tab2') 283 258 return 284 259 … … 289 264 child_id = form['val_id'] 290 265 else: 291 self.flash(_('No item selected.') )292 self.redirect(self.url(self.context, '@@manage')+' ?tab2')266 self.flash(_('No item selected.'), type='warning') 267 self.redirect(self.url(self.context, '@@manage')+'#tab2') 293 268 return 294 269 if not isinstance(child_id, list): … … 310 285 mapping = {'a':m_translated})) 311 286 write_log_message(self, 'switched: %s' % message) 312 self.redirect(self.url(self.context, '@@manage')+' ?tab2')287 self.redirect(self.url(self.context, '@@manage')+'#tab2') 313 288 return 314 289 … … 319 294 child_id = form['val_id'] 320 295 else: 321 self.flash(_('No item selected.') )322 self.redirect(self.url(self.context, '@@manage')+' ?tab2')296 self.flash(_('No item selected.'), type='warning') 297 self.redirect(self.url(self.context, '@@manage')+'#tab2') 323 298 return 324 299 if not isinstance(child_id, list): … … 334 309 mapping = {'a':message})) 335 310 write_log_message(self, 'released: %s' % message) 336 self.redirect(self.url(self.context, '@@manage')+' ?tab2')311 self.redirect(self.url(self.context, '@@manage')+'#tab2') 337 312 else: 338 self.flash(_('No allocated bed selected.') )339 self.redirect(self.url(self.context, '@@manage')+' ?tab2')340 return 341 342 @jsaction(_('Clear hostel') )313 self.flash(_('No allocated bed selected.'), type='warning') 314 self.redirect(self.url(self.context, '@@manage')+'#tab2') 315 return 316 317 @jsaction(_('Clear hostel'), style='danger') 343 318 def clearHostel(self, **data): 344 319 self.context.clearHostel() 345 320 self.flash(_('Hostel cleared.')) 346 321 write_log_message(self, 'cleared') 347 self.redirect(self.url(self.context, '@@manage')+' ?tab2')322 self.redirect(self.url(self.context, '@@manage')+'#tab2') 348 323 return 349 324 … … 362 337 def save(self, **data): 363 338 if data['owner'] == NOT_OCCUPIED: 364 self.flash(_('No valid student id.') )339 self.flash(_('No valid student id.'), type='warning') 365 340 self.redirect(self.url(self.context)) 366 341 return 367 342 msave(self, **data) 368 self.redirect(self.url(self.context.__parent__, '@@manage')+' ?tab2')343 self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2') 369 344 return 370 345 … … 374 349 # Beds must be released first before they can be allocated to 375 350 # other students. 376 self.redirect(self.url(self.context.__parent__, '@@manage')+' ?tab2')377 return 351 self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2') 352 return
Note: See TracChangeset for help on using the changeset viewer.