Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
plone.app.contentmenu.menu.WorkflowMenu Class Reference
Inheritance diagram for plone.app.contentmenu.menu.WorkflowMenu:
Inheritance graph
[legend]
Collaboration diagram for plone.app.contentmenu.menu.WorkflowMenu:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def getMenuItems

Static Public Attributes

tuple BOGUS_WORKFLOW_ACTIONS

Detailed Description

Definition at line 624 of file menu.py.


Member Function Documentation

def plone.app.contentmenu.menu.WorkflowMenu.getMenuItems (   self,
  context,
  request 
)
Return menu item entries in a TAL-friendly form.

Definition at line 641 of file menu.py.

00641 
00642     def getMenuItems(self, context, request):
00643         """Return menu item entries in a TAL-friendly form."""
00644         results = []
00645         context = aq_inner(context)
00646 
00647         wf_tool = getToolByName(context, 'portal_workflow')
00648         workflowActions = wf_tool.listActionInfos(object=context)
00649 
00650         locking_info = queryMultiAdapter((context, request), name='plone_lock_info')
00651         if locking_info and locking_info.is_locked_for_current_user():
00652             return []
00653 
00654         for action in workflowActions:
00655             if action['category'] != 'workflow':
00656                 continue
00657 
00658             cssClass = 'kssIgnore'
00659             actionUrl = action['url']
00660             if actionUrl == "":
00661                 actionUrl = '%s/content_status_modify?workflow_action=%s' % (context.absolute_url(), action['id'])
00662                 cssClass = ''
00663 
00664             description = ''
00665 
00666             transition = action.get('transition', None)
00667             if transition is not None:
00668                 description = transition.description
00669 
00670             for bogus in self.BOGUS_WORKFLOW_ACTIONS:
00671                 if actionUrl.endswith(bogus):
00672                     if getattr(context, bogus, None) is None:
00673                         actionUrl = '%s/content_status_modify?workflow_action=%s' % (context.absolute_url(), action['id'],)
00674                         cssClass =''
00675                     break
00676 
00677             if action['allowed']:
00678                 results.append({ 'title'       : action['title'],
00679                                  'description' : description,
00680                                  'action'      : actionUrl,
00681                                  'selected'    : False,
00682                                  'icon'        : None,
00683                                  'extra'       : {'id': 'workflow-transition-%s' % action['id'], 'separator': None, 'class': cssClass},
00684                                  'submenu'     : None,
00685                                  })
00686 
00687         url = context.absolute_url()
00688 
00689         if len(results) > 0:
00690             results.append({ 'title'        : _(u'label_advanced', default=u'Advanced...'),
00691                              'description'  : '',
00692                              'action'       : url + '/content_status_history',
00693                              'selected'     : False,
00694                              'icon'         : None,
00695                              'extra'        : {'id': 'advanced', 'separator': 'actionSeparator', 'class': 'kssIgnore'},
00696                              'submenu'      : None,
00697                             })
00698 
00699         if getToolByName(context, 'portal_placeful_workflow', None) is not None:
00700             results.append({ 'title'       : _(u'workflow_policy', default=u'Policy...'),
00701                              'description' : '',
00702                              'action'      : url + '/placeful_workflow_configuration',
00703                              'selected'    : False,
00704                              'icon'        : None,
00705                              'extra'       : {'id': 'policy', 'separator': None, 'class': 'kssIgnore'},
00706                              'submenu'     : None,
00707                             })
00708 
00709         return results

Here is the call graph for this function:


Member Data Documentation

Initial value:
(
        'content_hide_form',
        'content_publish_form',
        'content_reject_form',
        'content_retract_form',
        'content_show_form',
        'content_submit_form',
    )

Definition at line 632 of file menu.py.


The documentation for this class was generated from the following file: