Ignore:
Timestamp:
31 Jan 2014, 09:14:41 (11 years ago)
Author:
Henrik Bettermann
Message:

Remove resources and theming completely.

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  
    4646from waeup.kofa.browser.interfaces import ICaptchaManager
    4747from waeup.kofa.browser.breadcrumbs import Breadcrumb
    48 from waeup.kofa.browser.resources import toggleall
    4948from waeup.kofa.browser.layout import (
    5049    NullValidator, jsaction, action, UtilityView, JSAction)
    5150from waeup.kofa.browser.pages import (
    5251    add_local_role, del_local_roles, doll_up, ExportCSVView)
    53 from waeup.kofa.browser.resources import datepicker, warning
    5452from waeup.kofa.interfaces import (
    5553    IKofaObject, ILocalRolesAssignable, IExtFileStore, IPDF,
     
    147145    tabthreeactions2 = [_('Add local role')]
    148146    subunits = _('Applicants Containers')
    149 
    150     def update(self):
    151         warning.need()
    152         return super(ApplicantsRootManageFormPage, self).update()
    153147
    154148    def getLocalRoles(self):
     
    228222        IApplicantsContainerAdd).omit('code').omit('title')
    229223
    230     def update(self):
    231         datepicker.need() # Enable jQuery datepicker in date fields.
    232         return super(ApplicantsContainerAddFormPage, self).update()
    233 
    234224    @action(_('Add applicants container'))
    235225    def addApplicantsContainer(self, **data):
     
    371361            return True
    372362        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()
    379363
    380364    def getLocalRoles(self):
     
    840824
    841825    def update(self):
    842         datepicker.need() # Enable jQuery datepicker in date fields.
    843         warning.need()
    844826        super(ApplicantManageFormPage, self).update()
    845827        self.wf_info = IWorkflowInfo(self.context)
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/async.py

    r9217 r11016  
    44from waeup.kofa.async import IJob, IJobManager
    55from waeup.kofa.browser.layout import KofaPage
    6 from waeup.kofa.browser.resources import jquery, loadbar
    76from waeup.kofa.interfaces import IKofaObject, IDataCenter
    87from waeup.kofa.interfaces import MessageFactory as _
     
    5150        self.exports = self.getRunningExports()
    5251        self.uncompleted = [x for x in self.exports if x[0] != 'completed']
    53         loadbar.need()
    5452
    5553    def render(self):
     
    126124
    127125    def update(self, START_NEW=None, REMOVE=None, job_id=None):
    128         jquery.need()
    129126        if REMOVE and job_id:
    130127            self.context.remove(job_id)
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/browser.txt

    r11001 r11016  
    3030  >>> browser = Browser()
    3131
    32 Let's get the default view of a university and see if the
    33 favicon is properly referenced::
     32Let's get the default view of a university::
    3433
    3534  >>> browser.open('http://localhost/myuniversity')
    3635  >>> print browser.contents
    3736  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    38   ...href="http://localhost/myuniversity/@@/waeup_kofa/favicon.ico"
    3937  ...Welcome to WAeUP.Kofa...
    4038  ...
     
    102100
    103101  >>> 'Sample University' in browser.contents
    104   True
    105 
    106 The edit form contains the default value for the portal skin::
    107 
    108   >>> 'waeup-base.css' in browser.contents
    109102  True
    110103
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/captcha.py

    r9217 r11016  
    2828from zope.interface import Interface
    2929from zope.publisher.interfaces.http import IHTTPRequest
    30 from waeup.kofa.browser import resources
    3130from waeup.kofa.browser.layout import KofaPage
    3231from waeup.kofa.browser.interfaces import (
     
    229228    #: name of challenge field in HTTP request
    230229    chal_field = 'recaptcha_challenge_field'
    231     #: resource to set theme and other options
    232     theme = resources.recaptcha_white
    233230
    234231    # Do not use the following keys in productive environments!  As
     
    294291        form).
    295292        """
    296         if self.theme is not None:
    297             self.theme.need()
    298293        error_param = ''
    299294        if error_code:
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/interfaces.py

    r10685 r11016  
    5959        """Get the list of breadcrumbs as real Python list.
    6060        """
    61 class ITheme(Interface):
    62     """An theme or 'skin'.
    63 
    64     Themes are basically collections of CSS- and/or JavaScript files
    65     stored somewhere. In Grok-contexts these files can be registered
    66     as 'resources' (see :mod:`waeup.kofa.browser.resources`).
    67 
    68     Furthermore, to make themes selectable and distinctable from each
    69     other we assign them short descriptions.
    70 
    71     Themes should be registered as named utilities so that they can be
    72     defined also in third-party packages and be looked up by other
    73     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 to
    85         let it be rendered in the theme's style.
    86 
    87         A resource is normally defined in the `resources` module. If a
    88         theme needs several of them which normally do not depend on
    89         each other then all these resources can be returned by this
    90         method. Normally, you will only return one resource.
    91 
    92         These resources will (if the theme is selected) be `need()`-ed
    93         by the `update()` method of the general site layout.
    94         """
    95 
    9661class ICaptchaRequest(Interface):
    9762    """A set of data required to verify captcha solutions.
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/browser/layout.py

    r10999 r11016  
    2626from zope.i18n import translate
    2727from zope.i18nmessageid import Message
    28 from hurry.resource import mode
    2928from megrok.layout import Page, Layout, Form, EditForm, DisplayForm, AddForm
    3029from z3c.flashmessage.interfaces import IMessageSource, IMessageReceiver
     
    3736from waeup.kofa.utils.helpers import to_timezone
    3837from waeup.kofa.browser.interfaces import (
    39     ITheme, IStudentNavigationBase, IApplicantBase)
    40 from waeup.kofa.browser.theming import get_all_themes, KofaThemeBase
     38    IStudentNavigationBase, IApplicantBase)
    4139from waeup.kofa.authentication import get_principal_role_manager
    4240
     
    114112        msg = translate(self.msg, context=self.form.request)
    115113        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)" />' %
    117115                (self.__name__, self.__name__, escape(label, quote=True),
    118116                 self.style, msg)
     
    230228
    231229    #: An instance of the default theme to use for the site layout
    232     default_theme = KofaThemeBase()
    233230    stafftemp = grok.PageTemplateFile('templates/staffsitelayout.pt')
    234231    studenttemp = grok.PageTemplateFile('templates/studentsitelayout.pt')
     
    310307            return None         
    311308
    312     def update(self):
    313         """Include the resources required by the chosen skin/theme.
    314 
    315         University instances provide a 'skin' attribute, that should
    316         hold the internal name of a theme.
    317 
    318         A theme in the waeup.kofa sense consists of a list of
    319         CSS/JavaScript resources defined in the
    320         :mod:`waeup.kofa.browser.resources` module.
    321 
    322         If the context University object has no such attribute or the
    323         set value is not a valid theme name, we pick 'gray waeup
    324         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         return
    333 
    334309    def render(self):
    335310        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  
    5151    ICaptchaManager, IChangePassword)
    5252from waeup.kofa.browser.layout import jsaction, action, UtilityView
    53 from waeup.kofa.browser.resources import (
    54     warning, tabs)
    5553from waeup.kofa.interfaces import MessageFactory as _
    5654from waeup.kofa.interfaces import(
     
    790788        'frontpage_dict')
    791789
    792     def update(self):
    793         warning.need()
    794         return super(ConfigurationContainerManageFormPage, self).update()
    795 
    796790    def _frontpage(self):
    797791        view = ConfigurationContainerDisplayFormPage(
     
    900894    label = _(u'Data Center')
    901895    pnav = 0
    902 
    903     def update(self):
    904         warning.need()
    905         return super(DatacenterPage, self).update()
    906896
    907897    @jsaction(_('Remove selected'))
     
    17231713        return _('Manage academic section')
    17241714
    1725     def update(self):
    1726         warning.need()
    1727         return super(FacultiesContainerManageFormPage, self).update()
    1728 
    17291715    @jsaction(_('Remove selected'))
    17301716    def delFaculties(self, **data):
     
    18121798    def label(self):
    18131799        return _('Manage faculty')
    1814 
    1815     def update(self):
    1816         warning.need()
    1817         return super(FacultyManageFormPage, self).update()
    18181800
    18191801    @jsaction(_('Remove selected'))
     
    19951977            url = self.url(val)
    19961978            yield(dict(url=url, name=key, container=val))
    1997 
    1998     def update(self):
    1999         warning.need()
    2000         super(DepartmentManageFormPage, self).update()
    2001         return
    20021979
    20031980    @action(_('Save'), style='primary')
     
    21582135    form_fields = grok.AutoFields(ICourse).omit('code')
    21592136
    2160     def update(self):
    2161         warning.need()
    2162         return super(CourseManageFormPage, self).update()
    2163 
    21642137    @action(_('Save'), style='primary')
    21652138    def save(self, **data):
     
    22222195    def label(self):
    22232196        return _('Manage certificate')
    2224 
    2225     def update(self):
    2226         warning.need()
    2227         return super(CertificateManageFormPage, self).update()
    22282197
    22292198    @action(_('Save'), style='primary')
  • main/waeup.kofa/branches/uli-diazo-themed/src/waeup/kofa/hostels/browser.py

    r10771 r11016  
    2626    NullValidator)
    2727from waeup.kofa.browser.breadcrumbs import Breadcrumb
    28 from waeup.kofa.browser.resources import datepicker, datatable, tabs, warning
    2928from waeup.kofa.browser.layout import default_primary_nav_template
    3029from waeup.kofa.browser.pages import delSubobjects
     
    134133        _('Clear all hostels'),
    135134        _('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()
    147135
    148136    # It's quite dangerous to remove entire hostels with its content (beds).
     
    167155        return
    168156
    169     @jsaction(_('Clear all hostels'))
     157    @jsaction(_('Clear all hostels'), style='danger')
    170158    def clearHostels(self, **data):
    171159        self.context.clearAllHostels()
    172160        self.flash(_('All hostels cleared.'))
    173161        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')
    175163        return
    176164
     
    201189            self.context.addHostel(hostel)
    202190        except KeyError:
    203             self.flash(_('The hostel already exists.'))
     191            self.flash(_('The hostel already exists.'), type='warning')
    204192            return
    205193        self.flash(_('Hostel created.'))
     
    251239        return self.url(grok.getSite(),'students')
    252240
    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')
    267242    def save(self, **data):
    268243        msave(self, **data)
    269244        return
    270245
    271     @action(_('Update all beds'))
     246    @action(_('Update all beds'), style='primary')
    272247    def updateBeds(self, **data):
    273248        removed, added, modified, modified_beds = self.context.updateBeds()
     
    280255        self.flash(flash_message)
    281256        write_log_message(self, message)
    282         self.redirect(self.url(self.context, '@@manage')+'?tab2')
     257        self.redirect(self.url(self.context, '@@manage')+'#tab2')
    283258        return
    284259
     
    289264            child_id = form['val_id']
    290265        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')
    293268            return
    294269        if not isinstance(child_id, list):
     
    310285                mapping = {'a':m_translated}))
    311286            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')
    313288        return
    314289
     
    319294            child_id = form['val_id']
    320295        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')
    323298            return
    324299        if not isinstance(child_id, list):
     
    334309                mapping = {'a':message}))
    335310            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')
    337312        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')
    343318    def clearHostel(self, **data):
    344319        self.context.clearHostel()
    345320        self.flash(_('Hostel cleared.'))
    346321        write_log_message(self, 'cleared')
    347         self.redirect(self.url(self.context, '@@manage')+'?tab2')
     322        self.redirect(self.url(self.context, '@@manage')+'#tab2')
    348323        return
    349324
     
    362337    def save(self, **data):
    363338        if data['owner'] == NOT_OCCUPIED:
    364             self.flash(_('No valid student id.'))
     339            self.flash(_('No valid student id.'), type='warning')
    365340            self.redirect(self.url(self.context))
    366341            return
    367342        msave(self, **data)
    368         self.redirect(self.url(self.context.__parent__, '@@manage')+'?tab2')
     343        self.redirect(self.url(self.context.__parent__, '@@manage')+'#tab2')
    369344        return
    370345
     
    374349            # Beds must be released first before they can be allocated to
    375350            # 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  
    3939from waeup.kofa.browser.breadcrumbs import Breadcrumb
    4040from waeup.kofa.browser.pages import ContactAdminForm, ExportCSVView, doll_up
    41 from waeup.kofa.browser.resources import (
    42     datepicker, warning, toggleall)
    4341from waeup.kofa.browser.layout import jsaction, action, UtilityView
    4442from waeup.kofa.browser.interfaces import ICaptchaManager
     
    307305
    308306    def update(self, *args, **kw):
    309         toggleall.need()
    310         warning.need()
    311307        form = self.request.form
    312308        self.hitlist = []
     
    535531
    536532    def update(self):
    537         datepicker.need() # Enable jQuery datepicker in date fields.
    538533        super(StudentBaseManageFormPage, self).update()
    539534        self.wf_info = IWorkflowInfo(self.context)
     
    758753        return form_fields
    759754
    760     def update(self):
    761         datepicker.need() # Enable jQuery datepicker in date fields.
    762         return super(StudentClearanceManageFormPage, self).update()
    763 
    764755    @action(_('Save'), style='primary')
    765756    def save(self, **data):
     
    975966            return
    976967        super(StudyCourseManageFormPage, self).update()
    977         warning.need()
    978968        return
    979969
     
    12941284    pnav = 4
    12951285
    1296     def update(self):
    1297         super(StudentTransferFormPage, self).update()
    1298         warning.need()
    1299         return
    1300 
    13011286    @jsaction(_('Transfer'))
    13021287    def transferStudent(self, **data):
     
    13251310
    13261311    def update(self):
    1327         warning.need()
    13281312        if not self.context.has_key('studycourse_1'):
    13291313            self.flash(_('No previous transfer.'), type="warning")
     
    14701454            return
    14711455        super(StudyLevelManageFormPage, self).update()
    1472         warning.need()
    14731456        if ADD is not None:
    14741457            if not course:
     
    16911674        return _('${a}: Payments',
    16921675            mapping = {'a':self.context.__parent__.display_fullname})
    1693 
    1694     def update(self):
    1695         super(PaymentsManageFormPage, self).update()
    1696         warning.need()
    1697         return
    16981676
    16991677    @jsaction(_('Remove selected tickets'))
     
    19611939        return _('${a}: Accommodation',
    19621940            mapping = {'a':self.context.__parent__.display_fullname})
    1963 
    1964     def update(self):
    1965         super(AccommodationManageFormPage, self).update()
    1966         warning.need()
    1967         return
    19681941
    19691942    @jsaction(_('Remove selected'))
     
    26342607            return
    26352608        super(StudyLevelEditFormPage, self).update()
    2636         warning.need()
    26372609        if ADD is not None:
    26382610            if not course:
Note: See TracChangeset for help on using the changeset viewer.