From 5044f98f9d1f03eda2e9e75db8589bf0366d04ff Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Fri, 28 May 2010 10:42:32 +0000 Subject: [PATCH] 2010-05-28 yo * Make it possible to customize the behavior after a new content is added. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35714 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_xhtml_style/Base_doAction.xml | 17 ++- .../Base_getRedirectParameterDictAfterAdd.xml | 127 ++++++++++++++++++ .../bootstrap/erp5_xhtml_style/bt/change_log | 3 + .../bootstrap/erp5_xhtml_style/bt/description | 4 +- .../bootstrap/erp5_xhtml_style/bt/revision | 2 +- 5 files changed, 143 insertions(+), 10 deletions(-) create mode 100644 product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_getRedirectParameterDictAfterAdd.xml diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml index 26e25adfaf..1fc9fee1d7 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doAction.xml @@ -89,10 +89,13 @@ elif doAction0 == \'add\':\n container=context)\n preserved_parameters[\'portal_status_message\'] = Base_translateString("Object created.")\n preserved_parameters[\'editable_mode\'] = 1\n - redirect_url = \'%s/view\' % (new_content.absolute_url(), )\n - # The created object is not a part of the selection, so prevent from displaying the selection navigation controls\n - kw[\'selection_index\']=None\n - kw[\'selection_name\']=None\n + try:\n + tmp_kw = new_content.getRedirectParameterDictAfterAdd(context, **kw)\n + except AttributeError:\n + # Maybe the Product is not upgraded yet.\n + tmp_kw = new_content.Base_getRedirectParameterDictAfterAdd(context, **kw)\n + redirect_url = tmp_kw.pop(\'redirect_url\', new_content.absolute_url() + \'/view\')\n + kw.update(tmp_kw)\n # Otherwise, check if this is an automatic menu (template)\n elif doAction0 == \'template\':\n template_relative_url = \' \'.join(Base_doAction[1:])\n @@ -169,16 +172,16 @@ return context.ERP5Site_redirect(redirect_url, keep_items=preserved_parameters, <string>doAction0</string> <string>redirect_url</string> <string>_write_</string> - <string>new_id</string> <string>type_name</string> - <string>str</string> <string>new_content</string> + <string>_apply_</string> + <string>tmp_kw</string> + <string>AttributeError</string> <string>template_relative_url</string> <string>template</string> <string>preference</string> <string>new_content_list</string> <string>new_content_id</string> - <string>_apply_</string> </tuple> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_getRedirectParameterDictAfterAdd.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_getRedirectParameterDictAfterAdd.xml new file mode 100644 index 0000000000..a7bfecee34 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_getRedirectParameterDictAfterAdd.xml @@ -0,0 +1,127 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> + </tuple> + </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># This is the default method for a redirection after being added.\n +return dict(redirect_url=context.absolute_url() + \'/view\', selection_index=None, selection_name=None)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>folder, **kw</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>folder</string> + <string>kw</string> + <string>dict</string> + <string>_getattr_</string> + <string>context</string> + <string>None</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_getRedirectParameterDictAfterAdd</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log index 137e519a16..aa958e0d5a 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/change_log @@ -1,3 +1,6 @@ +2010-05-28 yo +* Make it possible to customize the behavior after a new content is added. + 2010-03-09 * Display title in breadcrumb if getCompactTranslatedTitle does not exist. diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/description b/product/ERP5/bootstrap/erp5_xhtml_style/bt/description index b3cdee8ac8..2e2e5eae75 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/description +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/description @@ -1,3 +1,3 @@ -This style is a rewrite of erp5_html_style more CSS and semantic html oriented. - +This style is a rewrite of erp5_html_style more CSS and semantic html oriented. + Handles page parameters dynamically. \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index db8b695779..397787a80e 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -948 \ No newline at end of file +949 \ No newline at end of file -- 2.30.9