- Timestamp:
- 31 Jan 2014, 09:14:41 (11 years ago)
- Location:
- main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
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')
Note: See TracChangeset for help on using the changeset viewer.