Changeset 11016 for main/waeup.kofa/branches/uli-diazo-themed/src/waeup
- Timestamp:
- 31 Jan 2014, 09:14:41 (11 years ago)
- Location:
- main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/applicants/browser.py
r11014 r11016 46 46 from waeup.kofa.browser.interfaces import ICaptchaManager 47 47 from waeup.kofa.browser.breadcrumbs import Breadcrumb 48 from waeup.kofa.browser.resources import toggleall49 48 from waeup.kofa.browser.layout import ( 50 49 NullValidator, jsaction, action, UtilityView, JSAction) 51 50 from waeup.kofa.browser.pages import ( 52 51 add_local_role, del_local_roles, doll_up, ExportCSVView) 53 from waeup.kofa.browser.resources import datepicker, warning54 52 from waeup.kofa.interfaces import ( 55 53 IKofaObject, ILocalRolesAssignable, IExtFileStore, IPDF, … … 147 145 tabthreeactions2 = [_('Add local role')] 148 146 subunits = _('Applicants Containers') 149 150 def update(self):151 warning.need()152 return super(ApplicantsRootManageFormPage, self).update()153 147 154 148 def getLocalRoles(self): … … 228 222 IApplicantsContainerAdd).omit('code').omit('title') 229 223 230 def update(self):231 datepicker.need() # Enable jQuery datepicker in date fields.232 return super(ApplicantsContainerAddFormPage, self).update()233 234 224 @action(_('Add applicants container')) 235 225 def addApplicantsContainer(self, **data): … … 371 361 return True 372 362 return False 373 374 def update(self):375 datepicker.need() # Enable jQuery datepicker in date fields.376 toggleall.need()377 warning.need()378 return super(ApplicantsContainerManageFormPage, self).update()379 363 380 364 def getLocalRoles(self): … … 840 824 841 825 def update(self): 842 datepicker.need() # Enable jQuery datepicker in date fields.843 warning.need()844 826 super(ApplicantManageFormPage, self).update() 845 827 self.wf_info = IWorkflowInfo(self.context) -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/async.py
r9217 r11016 4 4 from waeup.kofa.async import IJob, IJobManager 5 5 from waeup.kofa.browser.layout import KofaPage 6 from waeup.kofa.browser.resources import jquery, loadbar7 6 from waeup.kofa.interfaces import IKofaObject, IDataCenter 8 7 from waeup.kofa.interfaces import MessageFactory as _ … … 51 50 self.exports = self.getRunningExports() 52 51 self.uncompleted = [x for x in self.exports if x[0] != 'completed'] 53 loadbar.need()54 52 55 53 def render(self): … … 126 124 127 125 def update(self, START_NEW=None, REMOVE=None, job_id=None): 128 jquery.need()129 126 if REMOVE and job_id: 130 127 self.context.remove(job_id) -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/browser.txt
r11001 r11016 30 30 >>> browser = Browser() 31 31 32 Let's get the default view of a university and see if the 33 favicon is properly referenced:: 32 Let's get the default view of a university:: 34 33 35 34 >>> browser.open('http://localhost/myuniversity') 36 35 >>> print browser.contents 37 36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"... 38 ...href="http://localhost/myuniversity/@@/waeup_kofa/favicon.ico"39 37 ...Welcome to WAeUP.Kofa... 40 38 ... … … 102 100 103 101 >>> 'Sample University' in browser.contents 104 True105 106 The edit form contains the default value for the portal skin::107 108 >>> 'waeup-base.css' in browser.contents109 102 True 110 103 -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/captcha.py
r9217 r11016 28 28 from zope.interface import Interface 29 29 from zope.publisher.interfaces.http import IHTTPRequest 30 from waeup.kofa.browser import resources31 30 from waeup.kofa.browser.layout import KofaPage 32 31 from waeup.kofa.browser.interfaces import ( … … 229 228 #: name of challenge field in HTTP request 230 229 chal_field = 'recaptcha_challenge_field' 231 #: resource to set theme and other options232 theme = resources.recaptcha_white233 230 234 231 # Do not use the following keys in productive environments! As … … 294 291 form). 295 292 """ 296 if self.theme is not None:297 self.theme.need()298 293 error_param = '' 299 294 if error_code: -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/interfaces.py
r10685 r11016 59 59 """Get the list of breadcrumbs as real Python list. 60 60 """ 61 class ITheme(Interface):62 """An theme or 'skin'.63 64 Themes are basically collections of CSS- and/or JavaScript files65 stored somewhere. In Grok-contexts these files can be registered66 as 'resources' (see :mod:`waeup.kofa.browser.resources`).67 68 Furthermore, to make themes selectable and distinctable from each69 other we assign them short descriptions.70 71 Themes should be registered as named utilities so that they can be72 defined also in third-party packages and be looked up by other73 components like theme-selectors.74 """75 description = schema.TextLine(76 title = u'Description',77 description = u'Short description of the theme for choice fields',78 required = False,79 )80 81 def getResources():82 """Get resources of the theme.83 84 Deliver a list of resources that must be included in a web page to85 let it be rendered in the theme's style.86 87 A resource is normally defined in the `resources` module. If a88 theme needs several of them which normally do not depend on89 each other then all these resources can be returned by this90 method. Normally, you will only return one resource.91 92 These resources will (if the theme is selected) be `need()`-ed93 by the `update()` method of the general site layout.94 """95 96 61 class ICaptchaRequest(Interface): 97 62 """A set of data required to verify captcha solutions. -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/layout.py
r10999 r11016 26 26 from zope.i18n import translate 27 27 from zope.i18nmessageid import Message 28 from hurry.resource import mode29 28 from megrok.layout import Page, Layout, Form, EditForm, DisplayForm, AddForm 30 29 from z3c.flashmessage.interfaces import IMessageSource, IMessageReceiver … … 37 36 from waeup.kofa.utils.helpers import to_timezone 38 37 from waeup.kofa.browser.interfaces import ( 39 ITheme, IStudentNavigationBase, IApplicantBase) 40 from waeup.kofa.browser.theming import get_all_themes, KofaThemeBase 38 IStudentNavigationBase, IApplicantBase) 41 39 from waeup.kofa.authentication import get_principal_role_manager 42 40 … … 114 112 msg = translate(self.msg, context=self.form.request) 115 113 return ('<input type="submit" id="%s" name="%s" value="%s"' 116 ' class="btn btn-%s" onclick="return confirmPost(%s)" />' %114 ' class="btn btn-%s" onclick="return window.confirm(%s)" />' % 117 115 (self.__name__, self.__name__, escape(label, quote=True), 118 116 self.style, msg) … … 230 228 231 229 #: An instance of the default theme to use for the site layout 232 default_theme = KofaThemeBase()233 230 stafftemp = grok.PageTemplateFile('templates/staffsitelayout.pt') 234 231 studenttemp = grok.PageTemplateFile('templates/studentsitelayout.pt') … … 310 307 return None 311 308 312 def update(self):313 """Include the resources required by the chosen skin/theme.314 315 University instances provide a 'skin' attribute, that should316 hold the internal name of a theme.317 318 A theme in the waeup.kofa sense consists of a list of319 CSS/JavaScript resources defined in the320 :mod:`waeup.kofa.browser.resources` module.321 322 If the context University object has no such attribute or the323 set value is not a valid theme name, we pick 'gray waeup324 theme' as default.325 """326 mode('minified')327 theme_name = getattr(grok.getSite()['configuration'], 'skin', '')328 theme = queryUtility(ITheme, name=theme_name,329 default=self.default_theme)330 for resource in theme.getResources():331 resource.need()332 return333 334 309 def render(self): 335 310 if self.isStudent() or self.isApplicant() or not self.isAuthenticated(): -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/pages.py
r11008 r11016 51 51 ICaptchaManager, IChangePassword) 52 52 from waeup.kofa.browser.layout import jsaction, action, UtilityView 53 from waeup.kofa.browser.resources import (54 warning, tabs)55 53 from waeup.kofa.interfaces import MessageFactory as _ 56 54 from waeup.kofa.interfaces import( … … 790 788 'frontpage_dict') 791 789 792 def update(self):793 warning.need()794 return super(ConfigurationContainerManageFormPage, self).update()795 796 790 def _frontpage(self): 797 791 view = ConfigurationContainerDisplayFormPage( … … 900 894 label = _(u'Data Center') 901 895 pnav = 0 902 903 def update(self):904 warning.need()905 return super(DatacenterPage, self).update()906 896 907 897 @jsaction(_('Remove selected')) … … 1723 1713 return _('Manage academic section') 1724 1714 1725 def update(self):1726 warning.need()1727 return super(FacultiesContainerManageFormPage, self).update()1728 1729 1715 @jsaction(_('Remove selected')) 1730 1716 def delFaculties(self, **data): … … 1812 1798 def label(self): 1813 1799 return _('Manage faculty') 1814 1815 def update(self):1816 warning.need()1817 return super(FacultyManageFormPage, self).update()1818 1800 1819 1801 @jsaction(_('Remove selected')) … … 1995 1977 url = self.url(val) 1996 1978 yield(dict(url=url, name=key, container=val)) 1997 1998 def update(self):1999 warning.need()2000 super(DepartmentManageFormPage, self).update()2001 return2002 1979 2003 1980 @action(_('Save'), style='primary') … … 2158 2135 form_fields = grok.AutoFields(ICourse).omit('code') 2159 2136 2160 def update(self):2161 warning.need()2162 return super(CourseManageFormPage, self).update()2163 2164 2137 @action(_('Save'), style='primary') 2165 2138 def save(self, **data): … … 2222 2195 def label(self): 2223 2196 return _('Manage certificate') 2224 2225 def update(self):2226 warning.need()2227 return super(CertificateManageFormPage, self).update()2228 2197 2229 2198 @action(_('Save'), style='primary') -
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 -
main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/students/browser.py
r11014 r11016 39 39 from waeup.kofa.browser.breadcrumbs import Breadcrumb 40 40 from waeup.kofa.browser.pages import ContactAdminForm, ExportCSVView, doll_up 41 from waeup.kofa.browser.resources import (42 datepicker, warning, toggleall)43 41 from waeup.kofa.browser.layout import jsaction, action, UtilityView 44 42 from waeup.kofa.browser.interfaces import ICaptchaManager … … 307 305 308 306 def update(self, *args, **kw): 309 toggleall.need()310 warning.need()311 307 form = self.request.form 312 308 self.hitlist = [] … … 535 531 536 532 def update(self): 537 datepicker.need() # Enable jQuery datepicker in date fields.538 533 super(StudentBaseManageFormPage, self).update() 539 534 self.wf_info = IWorkflowInfo(self.context) … … 758 753 return form_fields 759 754 760 def update(self):761 datepicker.need() # Enable jQuery datepicker in date fields.762 return super(StudentClearanceManageFormPage, self).update()763 764 755 @action(_('Save'), style='primary') 765 756 def save(self, **data): … … 975 966 return 976 967 super(StudyCourseManageFormPage, self).update() 977 warning.need()978 968 return 979 969 … … 1294 1284 pnav = 4 1295 1285 1296 def update(self):1297 super(StudentTransferFormPage, self).update()1298 warning.need()1299 return1300 1301 1286 @jsaction(_('Transfer')) 1302 1287 def transferStudent(self, **data): … … 1325 1310 1326 1311 def update(self): 1327 warning.need()1328 1312 if not self.context.has_key('studycourse_1'): 1329 1313 self.flash(_('No previous transfer.'), type="warning") … … 1470 1454 return 1471 1455 super(StudyLevelManageFormPage, self).update() 1472 warning.need()1473 1456 if ADD is not None: 1474 1457 if not course: … … 1691 1674 return _('${a}: Payments', 1692 1675 mapping = {'a':self.context.__parent__.display_fullname}) 1693 1694 def update(self):1695 super(PaymentsManageFormPage, self).update()1696 warning.need()1697 return1698 1676 1699 1677 @jsaction(_('Remove selected tickets')) … … 1961 1939 return _('${a}: Accommodation', 1962 1940 mapping = {'a':self.context.__parent__.display_fullname}) 1963 1964 def update(self):1965 super(AccommodationManageFormPage, self).update()1966 warning.need()1967 return1968 1941 1969 1942 @jsaction(_('Remove selected')) … … 2634 2607 return 2635 2608 super(StudyLevelEditFormPage, self).update() 2636 warning.need()2637 2609 if ADD is not None: 2638 2610 if not course:
Note: See TracChangeset for help on using the changeset viewer.