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