Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFPlone.ActionsTool.ActionsTool Class Reference
Inheritance diagram for CMFPlone.ActionsTool.ActionsTool:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.ActionsTool.ActionsTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def listActions
def listActionInfos
def listFilteredActionsFor

Static Public Attributes

 meta_type = ToolNames.ActionsTool
string toolicon = 'skins/plone_images/confirm_icon.gif'
tuple security = ClassSecurityInfo()

Static Private Attributes

tuple __implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__, )

Detailed Description

Definition at line 10 of file ActionsTool.py.


Member Function Documentation

def CMFPlone.ActionsTool.ActionsTool.listActionInfos (   self,
  action_chain = None,
  object = None,
  check_visibility = 1,
  check_permissions = 1,
  check_condition = 1,
  max = -1,
  categories = None,
  ignore_categories = None 
)

Definition at line 47 of file ActionsTool.py.

00047 
00048                         categories=None, ignore_categories=None):
00049         # List ActionInfo objects.
00050         # (method is without docstring to disable publishing)
00051         #
00052         ec = self._getExprContext(object)
00053         actions = self.listActions(object=object,
00054                                    categories=categories,
00055                                    ignore_categories=ignore_categories)
00056         actions = [ ActionInfo(action, ec) for action in actions ]
00057 
00058         if action_chain:
00059             filtered_actions = []
00060             if isinstance(action_chain, basestring):
00061                 action_chain = (action_chain,)
00062             for action_ident in action_chain:
00063                 sep = action_ident.rfind('/')
00064                 category, id = action_ident[:sep], action_ident[sep+1:]
00065                 for ai in actions:
00066                     if id == ai['id'] and category == ai['category']:
00067                         filtered_actions.append(ai)
00068             actions = filtered_actions
00069 
00070         if categories is not None:
00071             actions = [ai for ai in actions
00072                           if ai['category'] in categories]
00073 
00074         if ignore_categories is not None:
00075             actions = [ai for ai in actions
00076                           if ai['category'] not in ignore_categories]
00077 
00078         action_infos = []
00079         for ai in actions:
00080             if check_visibility and not ai['visible']:
00081                 continue
00082             if check_permissions and not ai['allowed']:
00083                 continue
00084             if check_condition and not ai['available']:
00085                 continue
00086             action_infos.append(ai)
00087             if max + 1 and len(action_infos) >= max:
00088                 break
00089         return action_infos

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.ActionsTool.ActionsTool.listActions (   self,
  info = None,
  object = None,
  categories = None,
  ignore_categories = None 
)
List all the actions defined by a provider.

Definition at line 24 of file ActionsTool.py.

00024 
00025                     categories=None, ignore_categories=None):
00026         """ List all the actions defined by a provider.
00027         """
00028         actions = list(self._actions)
00029 
00030         if ignore_categories is None:
00031             ignore_categories = ()
00032 
00033         if categories is None:
00034             categories = [cat for cat in self.objectIds()
00035                               if cat not in ignore_categories]
00036         else:
00037             categories = [cat for cat in self.objectIds()
00038                               if cat in categories]
00039 
00040         for category in categories:
00041             actions.extend(self[category].listActions())
00042         return tuple(actions)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.ActionsTool.ActionsTool.listFilteredActionsFor (   self,
  object = None,
  ignore_providers = (),
  ignore_categories = None 
)
List all actions available to the user.

Definition at line 96 of file ActionsTool.py.

00096 
00097                                ignore_categories=None):
00098         """ List all actions available to the user.
00099         """
00100         actions = []
00101 
00102         providers = [name for name in self.listActionProviders()
00103                           if name not in ignore_providers]
00104 
00105         # Include actions from specific tools.
00106         for provider_name in providers:
00107             provider = getattr(self, provider_name, None)
00108             # Skip missing action providers.
00109             if provider is None:
00110                 continue
00111             if IActionProvider.providedBy(provider):
00112                 if provider_name == 'portal_actions':
00113                     actions.extend(provider.listActionInfos(
00114                                    object=object,
00115                                    ignore_categories=ignore_categories
00116                                    ))
00117                 else:
00118                     actions.extend(provider.listActionInfos(object=object))
00119 
00120         # Include actions from object.
00121         if object is not None:
00122             if IActionProvider.providedBy(object):
00123                 actions.extend(object.listActionInfos(object=object))
00124 
00125         # Reorganize the actions by category.
00126         filtered_actions={'user':[],
00127                           'folder':[],
00128                           'object':[],
00129                           'global':[],
00130                           'workflow':[],
00131                           }
00132 
00133         for action in actions:
00134             catlist = filtered_actions.setdefault(action['category'], [])
00135             catlist.append(action)
00136 
00137         return filtered_actions
00138 
00139 InitializeClass(ActionsTool)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple CMFPlone.ActionsTool.ActionsTool.__implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__, ) [static, private]

Definition at line 15 of file ActionsTool.py.

Definition at line 12 of file ActionsTool.py.

tuple CMFPlone.ActionsTool.ActionsTool.security = ClassSecurityInfo() [static]

Definition at line 17 of file ActionsTool.py.

string CMFPlone.ActionsTool.ActionsTool.toolicon = 'skins/plone_images/confirm_icon.gif' [static]

Definition at line 13 of file ActionsTool.py.


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