Changeset 8685
- Timestamp:
- 12 Jun 2012, 07:17:01 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/static/waeup-base.css
r8463 r8685 232 232 } 233 233 234 .ordered-selection-field { 235 } 234 table .ordered-selection-field select { 235 width: 250px; 236 } -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r7833 r8685 38 38 from waeup.kofa.hostels.interfaces import ( 39 39 IHostelsContainer, IHostel, IBed, IBedAllocateStudent) 40 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 40 41 41 42 def write_log_message(view, message): … … 105 106 label = _('Accommodation Section') 106 107 pnav = 5 108 form_fields = grok.AutoFields(IHostelsContainer) 109 form_fields[ 110 'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 111 form_fields[ 112 'enddate'].custom_widget = FriendlyDatetimeDisplayWidget('le') 107 113 108 114 class HostelsContainerManageActionButton(ManageActionButton): … … 113 119 text = _('Manage accommodation section') 114 120 115 class HostelsContainerManagePage(Kofa DisplayFormPage):121 class HostelsContainerManagePage(KofaEditFormPage): 116 122 """The manage page for hostel containers. 117 123 """ … … 122 128 pnav = 5 123 129 label = _('Manage accommodation section') 130 form_fields = grok.AutoFields(IHostelsContainer) 131 taboneactions = [_('Save')] 132 tabtwoactions = [_('Add hostel'), _('Remove selected')] 124 133 125 134 def update(self): 135 tabs.need() 136 self.tab1 = self.tab2 = self.tab3 = self.tab4 = '' 137 qs = self.request.get('QUERY_STRING', '') 138 if not qs: 139 qs = 'tab1' 140 setattr(self, qs, 'active') 126 141 warning.need() 142 datatable.need() 127 143 return super(HostelsContainerManagePage, self).update() 128 144 … … 146 162 def addSubunit(self, **data): 147 163 self.redirect(self.url(self.context, 'addhostel')) 164 return 165 166 @action(_('Save'), style='primary') 167 def save(self, **data): 168 self.applyData(self.context, **data) 169 self.flash(_('Settings have been saved.')) 148 170 return 149 171 -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/containermanagepage.pt
r7811 r8685 2 2 i18n:domain="waeup.kofa" 3 3 method="POST" enctype="multipart/form-data"> 4 <table> 5 <thead> 6 <tr> 7 <th> 8 </th> 9 <th i18n:translate="">Id 10 </th> 11 <th i18n:translate="">Name 12 </th> 13 </tr> 14 </thead> 15 <tbody> 16 <tr tal:repeat="hostel context/values"> <td> 17 <input type="checkbox" name="val_id" tal:attributes="value hostel/hostel_id" /> </td> <td> 18 <a tal:attributes="href python: view.url(hostel)" tal:content="hostel/__name__"> ID</a> </td> <td> 19 <span tal:content="hostel/hostel_name">ID 20 </span> </td> 21 </tr> 22 </tbody> 23 </table> 24 <div tal:condition="view/availableActions"> 25 <span tal:repeat="action view/actions" tal:omit-tag=""> 26 <input tal:replace="structure action/render"/> 27 </span> 4 5 6 <ul class="tabs" data-tabs="tabs"> 7 <li tal:attributes="class view/tab1"> 8 <a href="#tab-1"> 9 <span i18n:translate="">Settings 10 </span></a> 11 </li> 12 <li tal:attributes="class view/tab2"> 13 <a href="#tab-2" i18n:translate="">Hostels</a> 14 </li> 15 </ul> 16 17 <div class="tab-content"> 18 <div id="tab-1" tal:attributes="class view/tab1"> 19 <table class="form-table"> 20 <tbody> 21 <tal:widgets content="structure provider:widgets" /> 22 </tbody> 23 </table> 24 <div tal:condition="view/availableActions"> 25 <span tal:repeat="action view/actions" tal:omit-tag=""> 26 <input tal:condition="python:action.label in view.taboneactions" 27 tal:replace="structure action/render"/> 28 </span> 29 </div> 30 </div> 31 <div id="tab-2" tal:attributes="class view/tab2"> <br /> 32 <table class="display dataTableManage"> 33 <thead> 34 <tr> 35 <th> 36 </th> 37 <th i18n:translate="">Id 38 </th> 39 <th i18n:translate="">Name 40 </th> 41 </tr> 42 </thead> 43 <tbody> 44 <tr tal:repeat="hostel context/values"> <td> 45 <input type="checkbox" name="val_id" tal:attributes="value hostel/hostel_id" /> </td> <td> 46 <a tal:attributes="href python: view.url(hostel)" tal:content="hostel/__name__"> ID</a> </td> <td> 47 <span tal:content="hostel/hostel_name">ID 48 </span> </td> 49 </tr> 50 </tbody> 51 </table> 52 <div tal:condition="view/availableActions"> 53 <span tal:repeat="action view/actions" tal:omit-tag=""> 54 <input tal:condition="python:action.label in view.tabtwoactions" 55 tal:replace="structure action/render"/> 56 </span> 57 </div> 58 </div> 28 59 </div> 29 60 </form> -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser_templates/containerpage.pt
r7811 r8685 1 <div i18n:domain="waeup.kofa" 2 i18n:translate="" tal:condition="python: not len(context.keys())"> 3 There no subobjects registered yet. 4 </div> 1 <table class="form-table" i18n:domain="waeup.kofa"> 2 <tbody> 3 <tal:block repeat="widget view/widgets"> 4 <tr> 5 <td class="fieldname"> 6 <span tal:content="widget/label">LABEL</span>: 7 </td> 8 <td> 9 <span tal:content="structure widget"> 10 <input type="text" /> 11 </span> 12 </td> 13 </tr> 14 </tal:block> 15 </tbody> 16 </table> 5 17 6 18 <table i18n:domain="waeup.kofa"> -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/container.py
r7811 r8685 22 22 from waeup.kofa.hostels.interfaces import IHostelsContainer, IHostel 23 23 from waeup.kofa.utils.logger import Logger 24 from waeup.kofa.utils.helpers import attrs_to_fields 24 25 25 26 class HostelsContainer(grok.Container, Logger): … … 61 62 target = self.__name__ 62 63 return self.logger_info(ob_class,target,comment) 64 65 HostelsContainer = attrs_to_fields(HostelsContainer) -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
r8234 r8685 202 202 notify(grok.ObjectModifiedEvent(self)) 203 203 accommodation_session = grok.getSite()[ 204 ' configuration'].accommodation_session204 'hostels'].accommodation_session 205 205 try: 206 206 bedticket = grok.getSite()['students'][old_owner][ -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py
r7819 r8685 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 from datetime import datetime 18 19 from zope.interface import invariant, Invalid 19 20 from zope import schema 20 from waeup.kofa.interfaces import IKofaObject 21 from waeup.kofa.interfaces import ( 22 IKofaObject, academic_sessions_vocab, registration_states_vocab) 21 23 from waeup.kofa.interfaces import MessageFactory as _ 22 24 from waeup.kofa.hostels.vocabularies import ( … … 27 29 28 30 """ 31 32 startdate = schema.Datetime( 33 title = _(u'Hostel Allocation Start Date'), 34 required = False, 35 description = _('Example:') + u'2011-12-01 18:30:00+01:00', 36 ) 37 38 enddate = schema.Datetime( 39 title = _(u'Hostel Allocation Closing Date'), 40 required = False, 41 description = _('Example:') + u'2011-12-31 23:59:59+01:00', 42 ) 43 44 accommodation_session = schema.Choice( 45 title = _(u'Booking Session'), 46 source = academic_sessions_vocab, 47 default = datetime.now().year, 48 required = False, 49 readonly = False, 50 ) 51 52 accommodation_states = schema.List( 53 title = _(u'Allowed States'), 54 value_type = schema.Choice( 55 vocabulary = registration_states_vocab, 56 ), 57 default = [], 58 ) 29 59 30 60 class IHostel(IKofaObject): -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r8234 r8685 124 124 125 125 # Set accommodation_session 126 self.app[' configuration'].accommodation_session = 2004126 self.app['hostels'].accommodation_session = 2004 127 127 128 128 # Create a hostel -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/vocabularies.py
r7819 r8685 33 33 def acco_students(self, context): 34 34 catalog = getUtility(ICatalog, name='students_catalog') 35 accommodation_session = getSite()[' configuration'].accommodation_session35 accommodation_session = getSite()['hostels'].accommodation_session 36 36 students = catalog.searchResults(current_session=( 37 37 accommodation_session,accommodation_session)) -
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r8638 r8685 516 516 ) 517 517 518 accommodation_session = schema.Choice(519 title = _(u'Accommodation Booking Session'),520 source = academic_sessions_vocab,521 default = datetime.now().year,522 required = False,523 readonly = False,524 )525 526 accommodation_states = schema.List(527 title = _(u'Allowed States for Accommodation Booking'),528 value_type = schema.Choice(529 vocabulary = registration_states_vocab,530 ),531 default = [],532 )533 534 518 name_admin = schema.TextLine( 535 519 title = _(u'Name of Administrator'), -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8642 r8685 1055 1055 if p_category == 'bed_allocation' and student[ 1056 1056 'studycourse'].current_session != grok.getSite()[ 1057 ' configuration'].accommodation_session:1057 'hostels'].accommodation_session: 1058 1058 self.flash( 1059 1059 _('Your current session does not match ' + \ -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8642 r8685 172 172 173 173 # Configure university 174 self.app[' configuration'].accommodation_states = ['admitted']175 self.app[' configuration'].accommodation_session = 2004174 self.app['hostels'].accommodation_states = ['admitted'] 175 self.app['hostels'].accommodation_session = 2004 176 176 self.app['configuration'].carry_over = True 177 177 configuration = createObject('waeup.SessionConfiguration') … … 1601 1601 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] 1602 1602 # If student is not in accommodation session, payment cannot be processed 1603 self.app[' configuration'].accommodation_session = 20111603 self.app['hostels'].accommodation_session = 2011 1604 1604 self.browser.getControl("Create ticket").click() 1605 1605 self.assertMatches('...Your current session does not match...', 1606 1606 self.browser.contents) 1607 self.app[' configuration'].accommodation_session = 20041607 self.app['hostels'].accommodation_session = 2004 1608 1608 self.browser.getControl("Add online payment ticket").click() 1609 1609 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r8621 r8685 320 320 d = {} 321 321 d['error'] = u'' 322 site_configuration = grok.getSite()['configuration']323 d['booking_session'] = site_configuration.accommodation_session324 d['allowed_states'] = site_configuration.accommodation_states322 hostels = grok.getSite()['hostels'] 323 d['booking_session'] = hostels.accommodation_session 324 d['allowed_states'] = hostels.accommodation_states 325 325 # Determine bed type 326 326 studycourse = student['studycourse'] … … 331 331 return 332 332 end_level = certificate.end_level 333 if entry_session == grok.getSite()[ 334 'configuration'].accommodation_session: 333 if entry_session == grok.getSite()['hostels'].accommodation_session: 335 334 bt = 'fr' 336 335 elif current_level >= end_level:
Note: See TracChangeset for help on using the changeset viewer.