[Checkins] SVN: Products.DCWorkflow/trunk/Products/DCWorkflow/ - Worklists and Transitions: Add icon expression properties to worklist
Jens Vagelpohl
jens at dataflake.org
Wed Sep 17 17:35:47 EDT 2008
Log message for revision 91225:
- Worklists and Transitions: Add icon expression properties to worklist
and transition actions and their GenericSetup profiles.
Changed:
U Products.DCWorkflow/trunk/Products/DCWorkflow/CHANGES.txt
U Products.DCWorkflow/trunk/Products/DCWorkflow/DCWorkflow.py
U Products.DCWorkflow/trunk/Products/DCWorkflow/Transitions.py
U Products.DCWorkflow/trunk/Products/DCWorkflow/Worklists.py
U Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/transition_properties.dtml
U Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/worklist_properties.dtml
U Products.DCWorkflow/trunk/Products/DCWorkflow/exportimport.py
U Products.DCWorkflow/trunk/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml
U Products.DCWorkflow/trunk/Products/DCWorkflow/tests/test_exportimport.py
U Products.DCWorkflow/trunk/Products/DCWorkflow/xml/wtcWorkflowExport.xml
-=-
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/CHANGES.txt
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/CHANGES.txt 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/CHANGES.txt 2008-09-17 21:35:47 UTC (rev 91225)
@@ -4,6 +4,9 @@
2.2.0 (unreleased)
------------------
+- Worklists and Transitions: Add icon expression properties to worklist
+ and transition actions and their GenericSetup profiles.
+
- Fixed an import error (Products.PageTemplates.TALES is gone on
Zope trunk). Because we require Zope >= 2.10, we don't need a
BBB conditional import.
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/DCWorkflow.py
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/DCWorkflow.py 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/DCWorkflow.py 2008-09-17 21:35:47 UTC (rev 91225)
@@ -200,6 +200,7 @@
'id': tid,
'name': tdef.actbox_name % info,
'url': tdef.actbox_url % info,
+ 'icon': tdef.actbox_icon % info,
'permissions': (), # Predetermined.
'category': tdef.actbox_category,
'transition': tdef}))
@@ -243,6 +244,7 @@
res.append((id, {'id': id,
'name': qdef.actbox_name % fmt_data,
'url': qdef.actbox_url % fmt_data,
+ 'icon': qdef.actbox_icon % fmt_data,
'permissions': (), # Predetermined.
'category': qdef.actbox_category}))
fmt_data._pop()
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/Transitions.py
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/Transitions.py 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/Transitions.py 2008-09-17 21:35:47 UTC (rev 91225)
@@ -48,6 +48,7 @@
guard = None
actbox_name = ''
actbox_url = ''
+ actbox_icon = ''
actbox_category = 'workflow'
var_exprs = None # A mapping.
script_name = None # Executed before transition
@@ -112,7 +113,7 @@
trigger_type=TRIGGER_USER_ACTION, script_name='',
after_script_name='',
actbox_name='', actbox_url='',
- actbox_category='workflow',
+ actbox_category='workflow', actbox_icon='',
props=None, REQUEST=None, description=''):
'''
'''
@@ -129,6 +130,7 @@
self.guard = None
self.actbox_name = str(actbox_name)
self.actbox_url = str(actbox_url)
+ self.actbox_icon = str(actbox_icon)
self.actbox_category = str(actbox_category)
if REQUEST is not None:
return self.manage_properties(REQUEST, 'Properties changed.')
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/Worklists.py
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/Worklists.py 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/Worklists.py 2008-09-17 21:35:47 UTC (rev 91225)
@@ -41,6 +41,7 @@
var_matches = None # Compared with catalog when set.
actbox_name = ''
actbox_url = ''
+ actbox_icon = ''
actbox_category = 'global'
guard = None
@@ -108,7 +109,7 @@
def setProperties(self, description,
actbox_name='', actbox_url='', actbox_category='global',
- props=None, REQUEST=None):
+ actbox_icon='', props=None, REQUEST=None):
'''
'''
if props is None:
@@ -129,6 +130,7 @@
self.actbox_name = str(actbox_name)
self.actbox_url = str(actbox_url)
self.actbox_category = str(actbox_category)
+ self.actbox_icon = str(actbox_icon)
g = Guard()
if g.changeFromProperties(props or REQUEST):
self.guard = g
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/transition_properties.dtml
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/transition_properties.dtml 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/transition_properties.dtml 2008-09-17 21:35:47 UTC (rev 91225)
@@ -111,6 +111,13 @@
</td>
</tr>
<tr>
+ <th align="left">Icon URL (formatted)</th>
+ <td>
+ <input type="text" name="actbox_icon"
+ value="&dtml-actbox_icon;" size="50" />
+ </td>
+ </tr>
+ <tr>
<th align="left">Category</th>
<td>
<input type="text" name="actbox_category"
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/worklist_properties.dtml
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/worklist_properties.dtml 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/dtml/worklist_properties.dtml 2008-09-17 21:35:47 UTC (rev 91225)
@@ -58,6 +58,13 @@
</td>
</tr>
<tr>
+ <th align="left">Icon URL (formatted)</th>
+ <td>
+ <input type="text" name="actbox_icon"
+ value="&dtml-actbox_icon;" size="50" />
+ </td>
+ </tr>
+ <tr>
<th align="left">Category</th>
<td>
<input type="text" name="actbox_category"
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/exportimport.py
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/exportimport.py 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/exportimport.py 2008-09-17 21:35:47 UTC (rev 91225)
@@ -437,6 +437,9 @@
'actbox_url' -- the URL of the action by which the user
triggers the transition
+ 'actbox_icon' -- the icon URL for the action by which the user
+ triggers the transition
+
'actbox_category' -- the category of the action by which the user
triggers the transition
@@ -475,6 +478,7 @@
, 'after_script_name' : v.after_script_name
, 'actbox_name' : v.actbox_name
, 'actbox_url' : v.actbox_url
+ , 'actbox_icon' : v.actbox_icon
, 'actbox_category' : v.actbox_category
, 'variables' : v_info
, 'guard_permissions' : guard.permissions
@@ -509,6 +513,9 @@
'actbox_url' -- the URL of the "action" corresponding to the
worklist
+ 'actbox_icon' -- the icon URL of the "action" corresponding to
+ the worklist
+
'actbox_category' -- the category of the "action" corresponding
to the worklist
@@ -539,6 +546,7 @@
, 'var_match' : var_match
, 'actbox_name' : v.actbox_name
, 'actbox_url' : v.actbox_url
+ , 'actbox_icon' : v.actbox_icon
, 'actbox_category' : v.actbox_category
, 'guard_permissions' : guard.permissions
, 'guard_roles' : guard.roles
@@ -800,13 +808,14 @@
assert len( nodes ) <= 1, nodes
if len( nodes ) < 1:
- return { 'name' : '', 'url' : '', 'category' : '' }
+ return { 'name' : '', 'url' : '', 'category' : '', 'icon': ''}
node = nodes[ 0 ]
return { 'name' : _coalesceTextNodeChildren( node, encoding )
, 'url' : _getNodeAttribute( node, 'url', encoding )
, 'category' : _getNodeAttribute( node, 'category', encoding )
+ , 'icon' : _queryNodeAttribute( node, 'icon', '', encoding )
}
def _extractGuardNode( parent, encoding=None ):
@@ -1087,6 +1096,7 @@
, actbox_name = action[ 'name' ]
, actbox_url = action[ 'url' ]
, actbox_category = action[ 'category' ]
+ , actbox_icon = action.get('icon', '')
, props = props
)
var_mapping = [(name, Expression(text)) for name, text in
@@ -1121,6 +1131,7 @@
, actbox_name = action[ 'name' ]
, actbox_url = action[ 'url' ]
, actbox_category = action[ 'category' ]
+ , actbox_icon = action.get('icon', '')
, props = props
)
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/profiles/revision2/workflows/default_workflow/definition.xml 2008-09-17 21:35:47 UTC (rev 91225)
@@ -97,6 +97,7 @@
new_state="private" trigger="USER"
before_script="" after_script="">
<action url="%(content_url)s/content_hide_form"
+ icon="%(portal_url)s/retract_icon.png"
category="workflow">Make private</action>
<guard>
<guard-role>Owner</guard-role>
@@ -108,6 +109,7 @@
new_state="published" trigger="USER"
before_script="" after_script="">
<action url="%(object_url)s/content_publish_form"
+ icon="%(portal_url)s/approve_icon.png"
category="workflow">Publish</action>
<guard>
<guard-permission>Review portal content</guard-permission>
@@ -119,6 +121,7 @@
new_state="visible" trigger="USER"
before_script="" after_script="">
<action url="%(object_url)s/content_reject_form"
+ icon="%(portal_url)s/reject_icon.png"
category="workflow">Reject</action>
<guard>
<guard-permission>Review portal content</guard-permission>
@@ -130,6 +133,7 @@
new_state="visible" trigger="USER"
before_script="" after_script="">
<action url="%(object_url)s/content_retract_form"
+ icon="%(portal_url)s/retract_icon.png"
category="workflow">Retract</action>
<guard>
<guard-permission>Request review</guard-permission>
@@ -141,6 +145,7 @@
new_state="visible" trigger="USER"
before_script="" after_script="">
<action url="%(content_url)s/content_show_form"
+ icon="%(portal_url)s/approve_icon.png"
category="workflow">Make visible</action>
<guard>
<guard-role>Owner</guard-role>
@@ -152,6 +157,7 @@
new_state="pending" trigger="USER"
before_script="" after_script="">
<action url="%(object_url)s/content_submit_form"
+ icon="%(portal_url)s/submit_icon.png"
category="workflow">Submit</action>
<guard>
<guard-permission>Request review</guard-permission>
@@ -161,6 +167,7 @@
<worklist worklist_id="reviewer_queue" title="">
<description>Reviewer tasks</description>
<action url="%(portal_url)s/search?review_state=pending"
+ icon="%(portal_url)s/worklist_icon.png"
category="global">Pending (%(count)d)</action>
<guard>
<guard-permission>Review portal content</guard-permission>
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/tests/test_exportimport.py
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/tests/test_exportimport.py 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/tests/test_exportimport.py 2008-09-17 21:35:47 UTC (rev 91225)
@@ -144,11 +144,12 @@
, after_script_name=v[ 5 ]
, actbox_name=v[ 6 ]
, actbox_url=v[ 7 ]
- , actbox_category=v[ 8 ]
+ , actbox_icon=v[ 8 ]
+ , actbox_category=v[ 9 ]
, props=self._genGuardProps( *v[ -4: ] )
)
- for k, v in v[ 9 ].items():
+ for k, v in v[ 10 ].items():
transition.addVariable( k, v )
def _initWorklists( self, dcworkflow ):
@@ -168,7 +169,8 @@
worklist.setProperties( description=v[ 1 ]
, actbox_name=v[ 3 ]
, actbox_url=v[ 4 ]
- , actbox_category=v[ 5 ]
+ , actbox_icon=v[ 5 ]
+ , actbox_category=v[ 6 ]
, props=props
)
@@ -377,14 +379,15 @@
self.assertEqual( info[ 'after_script_name' ], expected[ 5 ] )
self.assertEqual( info[ 'actbox_name' ], expected[ 6 ] )
self.assertEqual( info[ 'actbox_url' ], expected[ 7 ] )
- self.assertEqual( info[ 'actbox_category' ], expected[ 8 ] )
+ self.assertEqual( info[ 'actbox_icon' ], expected[ 8 ] )
+ self.assertEqual( info[ 'actbox_category' ], expected[ 9 ] )
variables = info[ 'variables' ]
- self.assertEqual( len( variables ), len( expected[ 9 ] ) )
+ self.assertEqual( len( variables ), len( expected[ 10 ] ) )
for v_info in variables:
self.assertEqual( v_info[ 'expr' ]
- , expected[ 9 ][ v_info[ 'name' ] ] )
+ , expected[ 10 ][ v_info[ 'name' ] ] )
self._assertGuard( info, *expected[ -4: ] )
@@ -415,7 +418,8 @@
self.assertEqual( info[ 'description' ], expected[ 1 ] )
self.assertEqual( info[ 'actbox_name' ], expected[ 3 ] )
self.assertEqual( info[ 'actbox_url' ], expected[ 4 ] )
- self.assertEqual( info[ 'actbox_category' ], expected[ 5 ] )
+ self.assertEqual( info[ 'actbox_icon' ], expected[ 5 ] )
+ self.assertEqual( info[ 'actbox_category' ], expected[ 6 ] )
var_match = info[ 'var_match' ]
self.assertEqual( len( var_match ), len( expected[ 2 ] ) )
@@ -765,18 +769,19 @@
action = transition[ 'action' ]
self.assertEqual( action.get( 'name', '' ), expected[ 6 ] )
self.assertEqual( action.get( 'url', '' ), expected[ 7 ] )
- self.assertEqual( action.get( 'category', '' ), expected[ 8 ] )
+ self.assertEqual( action.get( 'icon', '' ), expected[ 8 ] )
+ self.assertEqual( action.get( 'category', '' ), expected[ 9 ] )
- self.assertEqual( transition[ 'variables' ], expected[ 9 ] )
+ self.assertEqual( transition[ 'variables' ], expected[ 10 ] )
guard = transition[ 'guard' ]
self.assertEqual( tuple( guard.get( 'permissions', () ) )
- , expected[ 10 ] )
+ , expected[ 11 ] )
self.assertEqual( tuple( guard.get( 'roles', () ) )
- , expected[ 11 ] )
+ , expected[ 12 ] )
self.assertEqual( tuple( guard.get( 'groups', () ) )
- , expected[ 12 ] )
- self.assertEqual( guard.get( 'expression', '' ), expected[ 13 ] )
+ , expected[ 13 ] )
+ self.assertEqual( guard.get( 'expression', '' ), expected[ 14 ] )
def test_parseWorkflowXML_normal_variables( self ):
@@ -907,16 +912,17 @@
action = worklist[ 'action' ]
self.assertEqual( action.get( 'name', '' ), expected[ 3 ] )
self.assertEqual( action.get( 'url', '' ), expected[ 4 ] )
- self.assertEqual( action.get( 'category', '' ), expected[ 5 ] )
+ self.assertEqual( action.get( 'icon', '' ), expected[ 5 ] )
+ self.assertEqual( action.get( 'category', '' ), expected[ 6 ] )
guard = worklist[ 'guard' ]
self.assertEqual( tuple( guard.get( 'permissions', () ) )
- , expected[ 6 ] )
+ , expected[ 7 ] )
self.assertEqual( tuple( guard.get( 'roles', () ) )
- , expected[ 7 ] )
+ , expected[ 8 ] )
self.assertEqual( tuple( guard.get( 'groups', () ) )
- , expected[ 8 ] )
- self.assertEqual( guard.get( 'expression', '' ), expected[ 9 ] )
+ , expected[ 9 ] )
+ self.assertEqual( guard.get( 'expression', '' ), expected[ 10 ] )
def test_parseWorkflowXML_normal_permissions( self ):
@@ -1094,6 +1100,7 @@
, ''
, 'Open'
, 'string:${object_url}/open_for_modifications'
+ , 'string:${portal_url}/open.png'
, 'workflow'
, { 'when_opened' : 'object/ZopeTime' }
, ( 'Open content for modifications', )
@@ -1109,6 +1116,7 @@
, 'after_close'
, 'Close'
, 'string:${object_url}/close_for_modifications'
+ , 'string:${portal_url}/close.png'
, 'workflow'
, {}
, ()
@@ -1124,6 +1132,7 @@
, 'after_kill'
, 'Kill'
, 'string:${object_url}/kill_object'
+ , 'string:${portal_url}/kill.png'
, 'workflow'
, { 'killed_by' : 'string:${user/getId}' }
, ()
@@ -1140,6 +1149,7 @@
, ''
, ''
, ''
+ , ''
, { 'when_expired' : 'object/ZopeTime' }
, ()
, ()
@@ -1154,6 +1164,7 @@
, { 'state' : ( 'expired', ) }
, 'Expired items'
, 'string:${portal_url}/expired_items'
+ , 'string:${portal_url}/expired.png'
, 'workflow'
, ( 'Restore expired content', )
, ()
@@ -1165,6 +1176,7 @@
, { 'state' : ( 'open', 'closed' ) }
, 'Expired items'
, 'string:${portal_url}/expired_items'
+ , 'string:${portal_url}/alive.png'
, 'workflow'
, ( 'Restore expired content', )
, ()
@@ -1623,7 +1635,8 @@
<description>Close the object for modifications</description>
<action
category="workflow"
- url="string:${object_url}/close_for_modifications">Close</action>
+ url="string:${object_url}/close_for_modifications"
+ icon="string:${portal_url}/close.png">Close</action>
<guard>
<guard-role>Owner</guard-role>
<guard-role>Manager</guard-role>
@@ -1653,7 +1666,8 @@
<description>Make the object permanently unavailable.</description>
<action
category="workflow"
- url="string:${object_url}/kill_object">Kill</action>
+ url="string:${object_url}/kill_object"
+ icon="string:${portal_url}/kill.png">Kill</action>
<guard>
<guard-group>Content_assassins</guard-group>
</guard>
@@ -1670,7 +1684,8 @@
<description>Open the object for modifications</description>
<action
category="workflow"
- url="string:${object_url}/open_for_modifications">Open</action>
+ url="string:${object_url}/open_for_modifications"
+ icon="string:${portal_url}/open.png">Open</action>
<guard>
<guard-permission>Open content for modifications</guard-permission>
</guard>
@@ -1683,7 +1698,8 @@
<description>Worklist for content not yet expired / killed</description>
<action
category="workflow"
- url="string:${portal_url}/expired_items">Expired items</action>
+ url="string:${portal_url}/expired_items"
+ icon="string:${portal_url}/alive.png">Expired items</action>
<guard>
<guard-permission>Restore expired content</guard-permission>
</guard>
@@ -1695,7 +1711,8 @@
<description>Worklist for expired content</description>
<action
category="workflow"
- url="string:${portal_url}/expired_items">Expired items</action>
+ url="string:${portal_url}/expired_items"
+ icon="string:${portal_url}/expired.png">Expired items</action>
<guard>
<guard-permission>Restore expired content</guard-permission>
</guard>
@@ -2313,21 +2330,22 @@
self.assertEqual( transition.after_script_name, expected[ 5 ] )
self.assertEqual( transition.actbox_name, expected[ 6 ] )
self.assertEqual( transition.actbox_url, expected[ 7 ] )
- self.assertEqual( transition.actbox_category, expected[ 8 ] )
+ self.assertEqual( transition.actbox_icon, expected[ 8 ] )
+ self.assertEqual( transition.actbox_category, expected[ 9 ] )
var_exprs = transition.var_exprs
- self.assertEqual( len( var_exprs ), len( expected[ 9 ] ) )
+ self.assertEqual( len( var_exprs ), len( expected[ 10 ] ) )
for var_id, expr in var_exprs.items():
- self.assertEqual( expr.text, expected[ 9 ][ var_id ] )
+ self.assertEqual( expr.text, expected[ 10 ][ var_id ] )
guard = transition.getGuard()
- self.assertEqual( guard.permissions, expected[ 10 ] )
- self.assertEqual( guard.roles, expected[ 11 ] )
- self.assertEqual( guard.groups, expected[ 12 ] )
- self.assertEqual( guard.getExprText(), expected[ 13 ] )
+ self.assertEqual( guard.permissions, expected[ 11 ] )
+ self.assertEqual( guard.roles, expected[ 12 ] )
+ self.assertEqual( guard.groups, expected[ 13 ] )
+ self.assertEqual( guard.getExprText(), expected[ 14 ] )
def test_from_empty_dcworkflow_workflow_worklists( self ):
@@ -2364,14 +2382,15 @@
self.assertEqual( worklist.actbox_name, expected[ 3 ] )
self.assertEqual( worklist.actbox_url, expected[ 4 ] )
- self.assertEqual( worklist.actbox_category, expected[ 5 ] )
+ self.assertEqual( worklist.actbox_icon, expected[ 5 ] )
+ self.assertEqual( worklist.actbox_category, expected[ 6 ] )
guard = worklist.getGuard()
- self.assertEqual( guard.permissions, expected[ 6 ] )
- self.assertEqual( guard.roles, expected[ 7 ] )
- self.assertEqual( guard.groups, expected[ 8 ] )
- self.assertEqual( guard.getExprText(), expected[ 9 ] )
+ self.assertEqual( guard.permissions, expected[ 7 ] )
+ self.assertEqual( guard.roles, expected[ 8 ] )
+ self.assertEqual( guard.groups, expected[ 9 ] )
+ self.assertEqual( guard.getExprText(), expected[ 10 ] )
def test_from_old_dcworkflow_workflow_scripts( self ):
Modified: Products.DCWorkflow/trunk/Products/DCWorkflow/xml/wtcWorkflowExport.xml
===================================================================
--- Products.DCWorkflow/trunk/Products/DCWorkflow/xml/wtcWorkflowExport.xml 2008-09-17 21:32:25 UTC (rev 91224)
+++ Products.DCWorkflow/trunk/Products/DCWorkflow/xml/wtcWorkflowExport.xml 2008-09-17 21:35:47 UTC (rev 91225)
@@ -83,6 +83,7 @@
category="CATEGORY"
tal:condition="transition/actbox_name"
tal:attributes="url transition/actbox_url;
+ icon transition/actbox_icon;
category transition/actbox_category;
"
tal:content="transition/actbox_name">ACTION NAME</action>
@@ -126,6 +127,7 @@
tal:condition="worklist/actbox_name"
tal:attributes="url worklist/actbox_url;
category worklist/actbox_category;
+ icon worklist/actbox_icon;
"
tal:content="worklist/actbox_name">ACTION NAME</action>
<guard
More information about the Checkins
mailing list