Changeset 4411 for waeup/branches


Ignore:
Timestamp:
21 Jul 2009, 14:57:16 (15 years ago)
Author:
uli
Message:

Replace AppCSS by HeadIncludes?.
Add actions as viewlets rendering buttons similar to old style SRP
portal.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/viewlets.py

    r4380 r4411  
    22import grok
    33import zope.interface
     4from grok.interfaces import IGrokSecurityView
     5from hurry import yui
    46from zope.component import getMultiAdapter
    57from zope.location.interfaces import ISite
    68from waeup.interfaces import (IUniversity, IWAeUPObject, IWAeUPXMLExporter,
    7                         IWAeUPXMLImporter)
     9                              IWAeUPXMLImporter, IFacultyContainer, IFaculty,
     10                              IDepartment)
    811from waeup.utils.helpers import getInnerHTMLPart
    912
     
    7780    grok.viewletmanager(Head)
    7881
    79 class AppCSS(grok.Viewlet):
     82class HeadIncludes(grok.Viewlet):
     83    """Register CSS and JavaScripts.
     84    """
    8085    grok.viewletmanager(Head)
     86
     87    def update(self):
     88        yui.reset_fonts_grids.need()
     89        yui.sam.need()
     90        yui.tabview.need()
     91        yui.layout.need()
     92        yui.animation.need()
     93        yui.resize.need()
     94       
    8195
    8296class Header(grok.ViewletManager):
     
    160174class Copyright(grok.Viewlet):
    161175    grok.viewletmanager(Footer)
     176
     177
     178class ActionBar(grok.ViewletManager):
     179    grok.name('actionbar')
     180    pass
     181
     182
     183class AddAction(grok.Viewlet):
     184    grok.viewletmanager(ActionBar)
     185    grok.view(Index)
     186    grok.context(IFaculty)
     187    grok.order(4)
     188    grok.template('addaction')
     189    grok.require('waeup.manageUniversity')
     190
     191    addview_name = 'add'
     192    addlink_text = 'Add department'
     193
     194    def getTargetURL(self):
     195        return '%s/@@%s' % (self.view.url(self.view.context), self.addview_name)
     196
     197class AddFacultyAction(AddAction):
     198    grok.context(IFacultyContainer)
     199    grok.template('addaction')
     200
     201    addview_name = 'add'
     202    addlink_text = 'Add faculty'
     203
     204
     205class ManageUniversityAction(grok.Viewlet):
     206    grok.viewletmanager(ActionBar)
     207    grok.context(IUniversity)
     208    grok.view(Index)
     209    grok.require('waeup.manageUniversity')
     210    grok.order(2)
     211    grok.template('manageaction')
     212
     213class ManageFacultiesAction(ManageUniversityAction):
     214    grok.context(IFacultyContainer)
     215
     216class ManageFacultyAction(ManageUniversityAction):
     217    grok.context(IFaculty)
     218
     219class ManageDepartmentAction(ManageUniversityAction):
     220    grok.context(IDepartment)
     221   
     222class ExportXMLAction(grok.Viewlet):
     223    grok.viewletmanager(ActionBar)
     224    grok.view(Index)
     225    grok.order(98)
     226    grok.require('waeup.manageUniversity')
     227
    162228
    163229class FormWrapMixin(object):
Note: See TracChangeset for help on using the changeset viewer.