Changeset 8685 for main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Timestamp:
- 12 Jun 2012, 07:17:01 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
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))
Note: See TracChangeset for help on using the changeset viewer.