Commit 73594d3c authored by Tatuya Kamada's avatar Tatuya Kamada

Folder Worklow: Fix Folder Worklow action when the action_url is not ERP5Form.

parent 9ce895fe
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Folder Workflow Action Without Confirmation Form/title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Folder Workflow Action Without Confirmation Form<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/expected_failure_for_anonymous_selection" /></td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
<tr>\n
<td>open</td>\n
<td tal:content="string:${here/portal_url}/foo_module/1/Foo_validate">Validate the first document</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Validated</td>\n
<td></td>\n
</tr>\n
<tr>\n
\t<td>open</td>\n
\t<td>${base_url}/foo_module/FooModule_createObjects?num:int=2&amp;start:int=2</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>assertTextPresent</td>\n
\t<td>Created Successfully.</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>open</td>\n
\t<td>${base_url}/foo_module/Zuite_waitForActivities</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>assertTextPresent</td>\n
\t<td>Done.</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>open</td>\n
\t<td>${base_url}/foo_module/view</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>selectAndWait</td>\n
\t<td>select_action</td>\n
\t<td>Change State</td>\n
</tr>\n
<!-- we have a listbox with 2 lines, one for 2 Draft Foos, the other for 1\n
Validated Foo -->\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//span[@class=&quot;listbox-current-page-total-number workflow_action_listbox-current-page-total-number&quot;]</td>\n
\t<td>2 records</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-0 DataA\']/td[1]/a</td>\n
\t<td>2</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-0 DataA\']/td[2]/a</td>\n
\t<td>Foo</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-0 DataA\']/td[3]/a</td>\n
\t<td>Draft</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-0 DataA\']/td[4]/a</td>\n
\t<td>Foo Workflow</td>\n
</tr>\n
<tr>\n
\t<td>select</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-0 DataA\']/td[5]/select</td>\n
\t<td>label=Custom Action No Dialog</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-1 DataB\']/td[1]/a</td>\n
\t<td>1</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-1 DataB\']/td[2]/a</td>\n
\t<td>Foo</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-1 DataB\']/td[3]/a</td>\n
\t<td>Validated</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'workflow_action_listbox-data-line-1 DataB\']/td[4]/a</td>\n
\t<td>Foo Workflow</td>\n
</tr>\n
<tr>\n
\t<td>click</td>\n
\t<td>field_your_enable_detail_list</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>clickAndWait</td>\n
\t<td>Base_callDialogMethod:method</td>\n
\t<td></td>\n
</tr>\n
<!-- Now we have the custom dialog, plus a listbox with the documents we are\n
modifying.\n
-->\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//span[@class=&quot;listbox-current-page-total-number&quot;]</td>\n
\t<td>2 records</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//a[@class=&quot;listbox_title&quot;]</td>\n
\t<td>exact:Foos</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'listbox-data-line-0 DataA\']/td[2]</td>\n
\t<td>Title 2</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'listbox-data-line-0 DataA\']/td[4]</td>\n
\t<td>Custom Action No Dialog</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'listbox-data-line-1 DataB\']/td[2]</td>\n
\t<td>Title 3</td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>//tr[@class=\'listbox-data-line-1 DataB\']/td[4]</td>\n
\t<td>Custom Action No Dialog</td>\n
</tr>\n
<tr>\n
\t<td>type</td>\n
\t<td>field_your_comment</td>\n
\t<td>Comment !</td>\n
</tr>\n
<!-- this field only exist in our custom dialog for this workflow action. -->\n
<tr>\n
\t<td>clickAndWait</td>\n
\t<td>Base_callDialogMethod:method</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>assertPortalStatusMessage</td>\n
\t<td>Workflow modification in progress.</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>open</td>\n
\t<td>${base_url}/foo_module/Zuite_waitForActivities</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>assertTextPresent</td>\n
\t<td>Done.</td>\n
\t<td></td>\n
</tr>\n
<!-- We\'ll check everything else (workflow history, comments, etc) in a python\n
script. -->\n
<tr>\n
\t<td>open</td>\n
\t<td>${base_url}/foo_module/Zuite_testFolderWorkflowActionCheckWorkflowHistory</td>\n
\t<td></td>\n
</tr>\n
<tr>\n
\t<td>assertText</td>\n
\t<td>result</td>\n
\t<td>OK</td>\n
</tr>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFolderWorkflowActionWithoutConfirmationForm</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = context.REQUEST\n
context.portal_workflow.doActionFor(context , workflow_action, comment=\'\', **kw)\n
message = \'direct workflow action done.\'\n
request.RESPONSE.redirect("%s/?portal_status_message=%s" % (context.absolute_url(), message) )\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>workflow_action, **kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_directWorkflowAction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -28,6 +28,7 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>custom_action_no_dialog</string>
<string>custom_dialog_action</string>
<string>delete</string>
<string>delete_action</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Custom Action No Dialog</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string> %(content_url)s/Base_directWorkflowAction?workflow_action=validate_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>NOTE: We need both \'validate\', \'validate_action\' in the Script(after) and the URL respectively.\r\n
\r\n
The validate_action in the URL is needed for user action.\r\n
\r\n
The one in Script(after) is needed when the transition is called from portal_workflow.doActionFor.</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>custom_action_no_dialog</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Custom Action No Dialog</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2014-06-13 tatuya
* Add a test for folder workflow with a no dialog transition.
2010-06-07 yusei
* Remove short title.
......
714
\ No newline at end of file
717
\ No newline at end of file
......@@ -51,6 +51,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>Base_translateString = context.Base_translateString\n
portal = context.getPortalObject()\n
item_list = [(\'\', \'\')]\n
for action in context.portal_actions.listFilteredActionsFor(brain).get(\'workflow\', []):\n
transition = action.get(\'transition\', None)\n
......@@ -58,6 +59,9 @@ for action in context.portal_actions.listFilteredActionsFor(brain).get(\'workflo
workflow_id = action[\'transition\'].aq_parent.aq_parent.getId()\n
if workflow_id == brain.workflow_id:\n
dialog_id = action[\'url\'].split(\'?\', 1)[0].split(\'/\')[-1]\n
dialog_object = getattr(portal, dialog_id, None)\n
if dialog_object is None or dialog_object.meta_type != \'ERP5 Form\':\n
dialog_id = portal.Base_viewWorkflowActionDialog.getId()\n
item_list.append((Base_translateString(action[\'title\']),\n
\'%s/%s/%s\' % (workflow_id, action[\'id\'], dialog_id)))\n
\n
......
41163
\ No newline at end of file
41164
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment