Changeset 5914 for main/waeup.sirp/trunk


Ignore:
Timestamp:
5 Apr 2011, 19:57:39 (14 years ago)
Author:
Henrik Bettermann
Message:

Remove AddAction? viewlet. It's not used and its docstring is misleading.

File:
1 edited

Legend:

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

    r5472 r5914  
    332332# Add actions...
    333333#
    334 class AddAction(grok.Viewlet):
    335     """Base class for 'adding actions'.
    336 
    337     AddActions are viewlets that render a button linked to an adding
    338     page. To create such a button in one of your pages, follow the
    339     following steps:
    340 
    341     - Create a new class derived from AddAction. In this class:
    342    
    343     - Set a grok.context() for the context type of your page. So, if
    344       your page sets grok.context(IMyFunnyType), do the same in the
    345       viewlet class.
    346 
    347     - Set the Page on which the button should appear using
    348       grok.view(). So, if your page class is MyFunnyPage, do
    349       grok.view(MyFunnyPage).
    350 
    351     - Set the template to use to 'addaction'. This means to use the
    352       'addaction.pt' template in the templates/ dir. Don't fiddle
    353       around with this template file, as it is used also by other
    354       viewlets.
    355 
    356     - If you want only certain authorized users to see the button, use
    357       grok.require(<Permission>). By default only people with
    358       waeup.manageUniversity permission are able to see your new
    359       button. Other users, however, will still see your page, only
    360       without the button rendered.
    361 
    362     - As one can define several buttons for a certain page, you can
    363       influence the order of buttons by setting grok.order(<num>). The
    364       lower the number, the more left the button will be displayed and
    365       vice versa. Default is 4.
    366      
    367     - Set the page name as ``addview_name`` attribute. This means, if
    368       the page, the button is linked to can be reached by calling
    369       http://localhost:8080/<current_location>/@@addfoo, then you should set::
    370 
    371         addview_name = 'addfoo'
    372 
    373       By default the target page name 'add' is assumed. You should
    374       have good reasons not to name your AddFormPage 'add'.
    375 
    376     - Set the button text by setting the ``addlink_text``
    377       attribute. If you set it to 'Add foobar', then on the page will
    378       appear a button with a small 'add stuff' icon and the text 'Add
    379       foobar'.
    380     """
    381     grok.viewletmanager(ActionBar)
    382     grok.view(FacultyContainerPage)
    383     grok.context(IFacultyContainer)
    384     grok.order(4)
    385     grok.template('addaction')
    386     grok.require('waeup.manageUniversity')
    387     grok.baseclass()
    388 
    389     addview_name = 'add'
    390     addlink_text = 'Add department'
    391 
    392     def getTargetURL(self):
    393         return '%s/@@%s' % (self.view.url(self.view.context), self.addview_name)
    394334
    395335class AddFacultyActionButton(AddActionButton):
     
    550490
    551491    @property
     492    def active(self):
     493        view_pnav = getattr(self.view, 'pnav', 0)
     494        userid = self.request.principal.id
     495        if view_pnav == self.pnav and userid == 'zope.anybody':
     496            return 'active'
     497        return ''
     498
     499    @property
    552500    def link_target(self):
    553501        return self.view.application_url('contactadmin')       
Note: See TracChangeset for help on using the changeset viewer.