Commit 5d1396aa authored by Jérome Perrin's avatar Jérome Perrin

use Base_redirect in dialog scripts

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35190 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 18864dc4
......@@ -62,8 +62,8 @@
# - Implement validation of matrix fields\n
# - Implement validation of list fields\n
#\n
from Products.ERP5Type.Message import translateString\n
from Products.Formulator.Errors import ValidationError, FormValidationError\n
from ZTUtils import make_query\n
\n
request=context.REQUEST\n
\n
......@@ -95,35 +95,14 @@ except FormValidationError, validation_errors:\n
field_errors = form.ErrorFields(validation_errors)\n
request.set(\'field_errors\', field_errors)\n
return form(request)\n
else:\n
# for web mode, we should use \'view\' instead of passed form_id\n
# after \'Save & View\'.\n
if context.REQUEST.get(\'is_web_mode\', False) and \\\n
not editable_mode:\n
form_id = \'view\'\n
\n
if not selection_index:\n
redirect_url = \'%s/%s?%s\' % (\n
context.absolute_url(),\n
form_id,\n
make_query({\'ignore_layout\':ignore_layout,\n
\'editable_mode\':editable_mode,\n
\'portal_status_message\':\'Data Updated.\',\n
})\n
)\n
else:\n
redirect_url = \'%s/%s?%s\' % (\n
context.absolute_url(),\n
form_id,\n
make_query({\'selection_index\':selection_index,\n
\'selection_name\':selection_name,\n
\'ignore_layout\':ignore_layout,\n
\'editable_mode\':editable_mode,\n
\'portal_status_message\':\'Data Updated.\',\n
})\n
)\n
# for web mode, we should use \'view\' instead of passed form_id\n
# after \'Save & View\'.\n
if request.get(\'is_web_mode\', False) and not editable_mode:\n
form_id = \'view\'\n
\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=translateString(\'Data Updated.\')))\n
]]></string> </value>
......@@ -136,7 +115,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id, selection_index=0, selection_name=\'\', ignore_layout=0, editable_mode=1</string> </value>
<value> <string>form_id=\'view\', selection_index=0, selection_name=\'\', ignore_layout=0, editable_mode=1</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -167,11 +146,11 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>selection_name</string>
<string>ignore_layout</string>
<string>editable_mode</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>Products.Formulator.Errors</string>
<string>ValidationError</string>
<string>FormValidationError</string>
<string>ZTUtils</string>
<string>make_query</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
......@@ -189,7 +168,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>validation_errors</string>
<string>field_errors</string>
<string>False</string>
<string>redirect_url</string>
<string>dict</string>
</tuple>
</value>
</item>
......@@ -202,6 +181,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>view</string>
<int>0</int>
<string></string>
<int>0</int>
......
......@@ -53,7 +53,8 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from ZTUtils import make_query\n
<value> <string>from Products.ERP5Type.Message import translateString\n
\n
request= context.REQUEST\n
listbox = request.get(\'listbox\')\n
line_list = context.Delivery_getSolverDecisionList(listbox=listbox)\n
......@@ -75,15 +76,9 @@ solver_process = line.getParentValue()\n
solver_process.buildTargetSolverList()\n
solver_process.solve()\n
\n
redirect_url = \'%s/%s?%s\' % (\n
context.absolute_url(),\n
\'view\',\n
make_query({\'ignore_layout\':request.get(\'ignore_layout\', 1),\n
\'editable_mode\':request.get(\'editable_mode\', 1),\n
\'portal_status_message\':\'Divergence solvers started in background.\',\n
})\n
)\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n
return context.Base_redirect(form_id,\n
keep_items=dict(portal_status_message=\n
translateString(\'Divergence solvers started in background.\')))\n
</string> </value>
</item>
<item>
......@@ -94,7 +89,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>listbox=[],**kw</string> </value>
<value> <string>form_id=\'view\', listbox=[], **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -114,16 +109,17 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>form_id</string>
<string>listbox</string>
<string>kw</string>
<string>ZTUtils</string>
<string>make_query</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
......@@ -144,7 +140,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<string>_write_</string>
<string>_apply_</string>
<string>solver_process</string>
<string>redirect_url</string>
<string>dict</string>
</tuple>
</value>
</item>
......@@ -157,6 +153,7 @@ request[ \'RESPONSE\' ].redirect( redirect_url )\n
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>view</string>
<list/>
</tuple>
</value>
......
109
\ No newline at end of file
111
\ 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