From 61d149a4b346d9f3d34d907b5b61dc9177641adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 14 Aug 2007 08:46:40 +0000 Subject: [PATCH] global_definitions: use portal in a local variable and call script from the portal to shorten acquisition chain. use Zope API to generate hidden inputs git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15663 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_xhtml_style/global_definitions.xml | 38 +++++++------------ .../bootstrap/erp5_xhtml_style/bt/revision | 2 +- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml index 9e0c7c9412..2f636fe182 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/global_definitions.xml @@ -56,15 +56,16 @@ <tal:block metal:define-macro="header_definitions">\n <tal:block tal:define="\n - global portal_path here/portal_url/getPortalPath;\n + global portal here/portal_url/getPortalObject;\n + global portal_path portal/portal_url/getPortalPath;\n local_parameter_list local_parameter_list | python: {};\n \n - global actions python: here.getPortalObject().portal_actions.listFilteredActionsFor(here);\n + global actions python: portal.portal_actions.listFilteredActionsFor(here);\n global url here/absolute_url;\n global current_form_id python: local_parameter_list.get(\'dialog_id\', local_parameter_list.get(\'form_id\', \'view\'));\n dummy python: request.set(\'current_form_id\', current_form_id);\n global current_url python: \'%s/%s\' % (url, current_form_id);\n - global current_action python: here.ERP5Site_getCurrentAction(current_url, actions);\n + global current_action python: portal.ERP5Site_getCurrentAction(current_url, actions);\n cancel_url request/cancel_url | current_url;\n dummy python: local_parameter_list.update({\'cancel_url\': cancel_url});\n \n @@ -76,40 +77,27 @@ dummy python: css_list.extend(css_list_template);\n global js_list js_list | python: [\'%s/erp5_xhtml_appearance.js\' % portal_path,];\n global js_list python:[\'%s/MochiKit/MochiKit.js\' % portal_path,\n - \'%s/erp5.js\' % portal_path,\n -] + js_list;\n + \'%s/erp5.js\' % portal_path, ] + js_list;\n \n - global http_parameter_list python: here.ERP5Site_filterParameterList(request.form);\n + global http_parameter_list python: portal.ERP5Site_filterParameterList(request.form);\n dummy python: http_parameter_list.update(local_parameter_list);\n - global http_parameters python: here.ERP5Site_renderHTTPParameterList(http_parameter_list);\n + global http_parameters python: portal.ERP5Site_renderHTTPParameterList(http_parameter_list);\n global form nocall:form | nothing;\n - portal_preferences python: here.getPortalObject().portal_preferences;\n + portal_preferences python: portal.portal_preferences;\n global preferred_html_style_developper_mode portal_preferences/getPreferredHtmlStyleDevelopperMode;\n global preferred_html_style_translator_mode portal_preferences/getPreferredHtmlStyleTranslatorMode;\n global preferred_html_style_contextual_help portal_preferences/getPreferredHtmlStyleContextualHelp;\n - global developper_shortcut_render python: (preferred_html_style_developper_mode or preferred_html_style_translator_mode) and here.developper_shortcut_render;\n - global selected_language here/Localizer/get_selected_language;\n + global developper_shortcut_render python: (preferred_html_style_developper_mode or preferred_html_style_translator_mode) and portal.developper_shortcut_render;\n + global selected_language portal/Localizer/get_selected_language;\n "/>\n </tal:block>\n \n <!-- ============================================================== -->\n \n <tal:block metal:define-macro="http_definitions">\n - <tal:block tal:repeat="parameter http_parameter_list/items">\n - <tal:block tal:condition="python: same_type(parameter[1], [])">\n - <tal:block tal:repeat="list_item python: parameter[1]">\n - <input type="hidden"\n - tal:condition="python: list_item is not None"\n - tal:attributes="name python: \'%s:list\' % (parameter[0], );\n - value python: list_item;"/>\n - </tal:block>\n - </tal:block>\n - <input type="hidden"\n - tal:condition="python: not same_type(parameter[1], []) and parameter[1] is not None"\n - tal:attributes="name python: parameter[0];\n - value python: parameter[1];"/>\n - </tal:block>\n -</tal:block> + <tal:block tal:replace="structure python: modules[\'ZTUtils\'].make_hidden_input(**http_parameter_list)"/>\n +</tal:block>\n + ]]></string> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 92c732d008..d9beed0e29 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -408 +409 \ No newline at end of file -- 2.30.9