From bbc9659cdc3da089afae851ad57b515b1b96b068 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Thu, 24 Sep 2009 16:51:01 +0000 Subject: [PATCH] Authorised report rendering with ERP5Form for deferred_style git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29175 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../registered_skin_selection.xml | 6 ++++++ .../portal_skins/erp5_deferred_style.xml | 21 +------------------ .../erp5_deferred_style/report_view.xml | 2 +- .../Base_activateReport.xml | 20 +++++++++++++----- bt5/erp5_deferred_style/bt/revision | 2 +- .../bt/template_local_role_list | 0 .../bt/template_portal_type_role_list | 0 .../template_registered_skin_selection_list | 1 + 8 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 bt5/erp5_deferred_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml create mode 100644 bt5/erp5_deferred_style/bt/template_local_role_list create mode 100644 bt5/erp5_deferred_style/bt/template_portal_type_role_list create mode 100644 bt5/erp5_deferred_style/bt/template_registered_skin_selection_list diff --git a/bt5/erp5_deferred_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml b/bt5/erp5_deferred_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml new file mode 100644 index 0000000000..67a84bf624 --- /dev/null +++ b/bt5/erp5_deferred_style/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml @@ -0,0 +1,6 @@ +<registered_skin_selection> + <skin_folder_selection> + <skin_folder>erp5_deferred_style</skin_folder> + <skin_selection>Deferred</skin_selection> + </skin_folder_selection> +</registered_skin_selection> \ No newline at end of file diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style.xml index bce0ed18e0..129a83d362 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style.xml @@ -12,18 +12,7 @@ <item> <key> <string>_local_properties</string> </key> <value> - <tuple> - <dictionary> - <item> - <key> <string>id</string> </key> - <value> <string>business_template_registered_skin_selections</string> </value> - </item> - <item> - <key> <string>type</string> </key> - <value> <string>tokens</string> </value> - </item> - </dictionary> - </tuple> + <tuple/> </value> </item> <item> @@ -32,14 +21,6 @@ <tuple/> </value> </item> - <item> - <key> <string>business_template_registered_skin_selections</string> </key> - <value> - <tuple> - <string>Deferred</string> - </tuple> - </value> - </item> <item> <key> <string>id</string> </key> <value> <string>erp5_deferred_style</string> </value> diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/report_view.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/report_view.xml index 18e1bee723..4de8be8af0 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/report_view.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style/report_view.xml @@ -39,7 +39,7 @@ <key> <string>_text</string> </key> <value> <string encoding="cdata"><![CDATA[ -<tal:block tal:attributes="dummy python:here.Base_activateReport(report_method=report_method, form=form)"/> +<tal:block tal:attributes="dummy python:here.Base_activateReport(form=form)"/> ]]></string> </value> </item> diff --git a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml index e814bbef67..ab111576da 100644 --- a/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml +++ b/bt5/erp5_deferred_style/SkinTemplateItem/portal_skins/erp5_deferred_style_core/Base_activateReport.xml @@ -80,7 +80,15 @@ tag = \'active-report-%s\' % random.randint(0, 1000)\n priority = 3\n \n # compute list of report section to render\n -report_section_list = report_method()\n +if form.meta_type == \'ERP5 Report\':\n + report_section_list = getattr(context, form.report_method)()\n +elif form.meta_type == \'ERP5 Form\':\n + report_section_list = []\n + for field in form.get_fields():\n + if field.getRecursiveTemplateField().meta_type == \'ReportBox\':\n + report_section_list.extend(field.render())\n +else:\n + raise ValueError, \'form meta_type unknown\'\n \n # save request parameters (after calling the report_method which may tweak the\n # request). XXX we exclude some reserved names in a very ad hoc way\n @@ -143,7 +151,7 @@ return context.Base_redirect(\'view\', keep_items=dict(\n </item> <item> <key> <string>_params</string> </key> - <value> <string>report_method, form, **kw</string> </value> + <value> <string>form, **kw</string> </value> </item> <item> <key> <string>_proxy_roles</string> </key> @@ -171,13 +179,12 @@ return context.Base_redirect(\'view\', keep_items=dict(\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>2</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> - <string>report_method</string> <string>form</string> <string>kw</string> <string>_getattr_</string> @@ -197,9 +204,12 @@ return context.Base_redirect(\'view\', keep_items=dict(\n <string>random</string> <string>tag</string> <string>priority</string> + <string>getattr</string> <string>report_section_list</string> - <string>request_other</string> <string>_getiter_</string> + <string>field</string> + <string>ValueError</string> + <string>request_other</string> <string>k</string> <string>v</string> <string>_write_</string> diff --git a/bt5/erp5_deferred_style/bt/revision b/bt5/erp5_deferred_style/bt/revision index 7c6ba0fe18..fc9afb48e0 100644 --- a/bt5/erp5_deferred_style/bt/revision +++ b/bt5/erp5_deferred_style/bt/revision @@ -1 +1 @@ -55 \ No newline at end of file +59 \ No newline at end of file diff --git a/bt5/erp5_deferred_style/bt/template_local_role_list b/bt5/erp5_deferred_style/bt/template_local_role_list new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bt5/erp5_deferred_style/bt/template_portal_type_role_list b/bt5/erp5_deferred_style/bt/template_portal_type_role_list new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bt5/erp5_deferred_style/bt/template_registered_skin_selection_list b/bt5/erp5_deferred_style/bt/template_registered_skin_selection_list new file mode 100644 index 0000000000..cff35120c3 --- /dev/null +++ b/bt5/erp5_deferred_style/bt/template_registered_skin_selection_list @@ -0,0 +1 @@ +erp5_deferred_style | Deferred \ No newline at end of file -- 2.30.9