Changeset 4937 for main


Ignore:
Timestamp:
30 Jan 2010, 09:53:16 (15 years ago)
Author:
uli
Message:

Add viewlmanager and viewlets for entries on administration overview
page. This way we can easily set different permissions for different
tasks and only allowed tasks will be displayed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py

    r4930 r4937  
    2727class ActionBar(grok.ViewletManager):
    2828    grok.name('actionbar')
    29     pass
     29
     30class AdministrationTasks(grok.ViewletManager):
     31    grok.name('admintasks')
     32
    3033
    3134#
     
    485488    def link_target(self):
    486489        return self.view.application_url('@@search')
     490
     491#
     492# Administration tasks
     493#
     494class AdminTask(grok.Viewlet):
     495    """The base for task entries on administration page.
     496    """
     497    grok.baseclass()
     498    grok.order(1)
     499    grok.viewletmanager(AdministrationTasks)
     500    grok.require('waeup.manageUniversity')
     501    grok.template('admintask')
     502
     503    link_title = 'Manage users' # How the link to the target will be titled.
     504    target_viewname = 'users'   # The name of the target view.
     505   
     506    @property
     507    def link_target(self):
     508        return self.view.url(self.context[self.target_viewname])
     509
     510class AdminTaskUsers(AdminTask):
     511    """Entry on administration page that link to user folder.
     512    """
     513    grok.order(1)
     514    grok.require('waeup.manageUniversity')
     515
     516    link_title = 'Manage users'
     517    target_viewname = 'users'
     518   
     519class AdminTaskDatacenter(AdminTask):
     520    """Entry on administration page that link to datacenter.
     521    """
     522    grok.order(2)
     523    grok.require('waeup.manageUniversity')
     524
     525    link_title = 'Data center'
     526    target_viewname = 'datacenter'
Note: See TracChangeset for help on using the changeset viewer.