Changeset 3851 for waeup/branches


Ignore:
Timestamp:
16 Jan 2009, 12:25:51 (16 years ago)
Author:
uli
Message:

Add new viewlets.

File:
1 edited

Legend:

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

    r3530 r3851  
    22import grok
    33import zope.interface
    4 from interfaces import IUniversity 
     4from interfaces import IUniversity, IWAeUPObject
    55
    66grok.context(zope.interface.Interface)
     
    1010    grok.template('master')
    1111   
    12     def __init__(self, context, request):#
    13         super(Index, self).__init__(context, request)
    14 
     12class Manage(grok.View):
     13    """Admin view for waeup objects.
     14    """
     15    grok.context(IWAeUPObject)
     16       
    1517class Head(grok.ViewletManager):
    1618    """additions to HTML head"""
     
    3032    grok.order(1)
    3133
     34    def getAppTitle(self):
     35        """Get the `name` attribute of the local site object.
     36
     37        This is normally the waeup application or IUniversity object.
     38        If this object has no ``name`` attribute, then we return the
     39        empty string.
     40        """
     41        app = grok.getSite()
     42        return getattr(app, 'name', u'')
     43
    3244class NavigationBar(grok.Viewlet):
    3345    grok.viewletmanager(Header)
     
    4254class AuthUser(grok.Viewlet):
    4355    grok.viewletmanager(LeftSidebar)
    44     grok.view(Index)
    4556    grok.order(1)
    4657
     
    5162    grok.order(2)
    5263
     64    def isAuthenticated(self):
     65        """Is the calling user authenticated?
     66        """
     67        return self.request.principal.id != 'zope.anybody'
     68   
    5369class MainArea(grok.ViewletManager):
    5470    grok.name('main')
Note: See TracChangeset for help on using the changeset viewer.