[CMF-checkins] CVS: CMF/CMFCore - CMFCatalogAware.py:1.7.4.4 PortalContent.py:1.34.10.2 PortalFolder.py:1.37.4.3
Florent Guillaume
fg@nuxeo.com
Wed, 24 Jul 2002 11:16:13 -0400
Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv5029/CMFCore
Modified Files:
Tag: CMF-1_3-branch
CMFCatalogAware.py PortalContent.py PortalFolder.py
Log Message:
Merged changes from HEAD:
Added a ZMI 'Workflows' tab to content objects that displays the portal
type and the workflows states.
=== CMF/CMFCore/CMFCatalogAware.py 1.7.4.3 => 1.7.4.4 ===
from Acquisition import aq_base
from AccessControl import ClassSecurityInfo
-from CMFCorePermissions import ModifyPortalContent, AccessContentsInformation
+from CMFCorePermissions import ModifyPortalContent
+from CMFCorePermissions import AccessContentsInformation
+from CMFCorePermissions import ManagePortal
from utils import getToolByName
+from utils import _dtmldir
class CMFCatalogAware:
@@ -167,5 +170,49 @@
if hasattr(aq_base(ob), name):
getattr(ob, name)(*args)
if s is None: ob._p_deactivate()
+
+ # ZMI
+ # ---
+
+ manage_options = ({'label': 'Workflows',
+ 'action': 'manage_workflowsTab',
+ },
+ )
+
+ _manage_workflowsTab = Globals.DTMLFile('zmi_workflows', _dtmldir)
+
+ security.declareProtected(ManagePortal, 'manage_workflowsTab')
+ def manage_workflowsTab(self, REQUEST, manage_tabs_message=None):
+ """
+ Tab displaying the current workflows for the content object.
+ """
+ ob = self
+ wftool = getToolByName(self, 'portal_workflow', None)
+ # XXX None ?
+ if wftool is not None:
+ wf_ids = wftool.getChainFor(ob)
+ states = {}
+ chain = []
+ for wf_id in wf_ids:
+ wf = wftool.getWorkflowById(wf_id)
+ if wf is not None:
+ # XXX a standard API would be nice
+ if hasattr(wf, 'getReviewStateOf'):
+ # Default Workflow
+ state = wf.getReviewStateOf(ob)
+ elif hasattr(wf, '_getWorkflowStateOf'):
+ # DCWorkflow
+ state = wf._getWorkflowStateOf(ob, id_only=1)
+ else:
+ state = '(Unknown)'
+ states[wf_id] = state
+ chain.append(wf_id)
+ return self._manage_workflowsTab(
+ REQUEST,
+ chain=chain,
+ states=states,
+ management_view='Workflows',
+ manage_tabs_message=manage_tabs_message)
+
Globals.InitializeClass(CMFCatalogAware)
=== CMF/CMFCore/PortalContent.py 1.34.10.1 => 1.34.10.2 ===
, 'action' : 'view'
}
)
+ + CMFCatalogAware.manage_options
+ SimpleItem.manage_options
)
=== CMF/CMFCore/PortalFolder.py 1.37.4.2 => 1.37.4.3 ===
description = ''
+ manage_options = Folder.manage_options + \
+ CMFCatalogAware.manage_options
+
def __init__( self, id, title='' ):
self.id = id
self.title = title