From 8616bedb70cc806eee27dd3b28a742c17f4c810e Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 20 Oct 2006 14:35:06 +0000 Subject: [PATCH] Add a local copy of ERP5XhtmlStyle_getFormGroupTitleAndId script which was modified and renamed in erp5_xhtml_style. Update caller of ERP5XhtmlStyle_getFormEnctype. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10859 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5XhtmlStyle_getFormGroupTitleAndId.xml | 212 ++++++++++++++++++ .../erp5_web/erp5_web_template_header.xml | 2 +- bt5/erp5_web/bt/revision | 2 +- 3 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5XhtmlStyle_getFormGroupTitleAndId.xml diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5XhtmlStyle_getFormGroupTitleAndId.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5XhtmlStyle_getFormGroupTitleAndId.xml new file mode 100644 index 0000000000..5631dae12a --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/ERP5XhtmlStyle_getFormGroupTitleAndId.xml @@ -0,0 +1,212 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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>"""\n + This script split a form group id in two part:\n + * a group id,\n + * a group title.\n +\n + The group should be named based on the following pattern: "group id (Group Title)" \n +\n + This script is a hack to let us merge two informations (id and title) into one (id) to get\n + over Formulator limitations. This script should disappear with Formulator\'s refactoring.\n +\n + Features: \n + * Multiple parenthesis allowed;\n + * Group id can continue after the title definition.\n +\n + Example:\n + A string like\n + "left webcontent (The Fantastic Group (and (funky) lisp-like parenthesis)) extra",\n + will return the following tuple:\n + ( \'left webcontent extra\'\n + , \'The Fantastic Group (and (funky) lisp-like parenthesis)\'\n + , \'left webcontent (The Fantastic Group (and (funky) lisp-like parenthesis)) extra\'\n + )\n +"""\n +\n +if not same_type(original_group_id, \'string\'):\n + return None\n +\n +# Separate the group id and the group title using parenthesis as marker from the original form group id\n +o_gid_list = original_group_id.strip().split(\'(\')\n +\n +# Get the first part of the group id (which is the part before the first opened parenthesis)\n +group_id = o_gid_list[0]\n +\n +# Get the end of the list (which is the part just after the first opened parenthesis)\n +group_title_list = \'(\'.join(o_gid_list[1:]).split(\')\')\n +\n +# Get the last part of the group id (the part which stand after the last closing parenthesis)\n +group_id += group_title_list[-1]\n +\n +# Normalize the group id (suppress unecessary multiple-space)\n +group_id_list = []\n +for group_word in group_id.split(\' \'):\n + if len(group_word):\n + group_id_list.append(group_word)\n +group_id = \' \'.join(group_id_list)\n +\n +# Generate the group title\n +group_title = \')\'.join(group_title_list[:-1]).strip()\n +\n +# Return the group id if no title found\n +if len(group_title) == 0:\n + group_title = group_id\n +\n +return ( group_id\n + , group_title\n + , original_group_id\n + )\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>original_group_id=None</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>original_group_id</string> + <string>same_type</string> + <string>None</string> + <string>_getattr_</string> + <string>o_gid_list</string> + <string>_getitem_</string> + <string>group_id</string> + <string>group_title_list</string> + <string>group_id_list</string> + <string>_getiter_</string> + <string>group_word</string> + <string>len</string> + <string>group_title</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5XhtmlStyle_getFormGroupTitleAndId</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_template_header.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_template_header.xml index c461b3a5f9..81290673cc 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_template_header.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/erp5_web_template_header.xml @@ -113,7 +113,7 @@ <body> <!-- TODO: This conflicts with tabber.js => onload="autoFocus()"-->\n <!-- Global form is used to save data of other fields when we edit one another (generally make sense in listbox and/or relation string field) -->\n <form id="main_form"\n - tal:attributes="enctype python: here.ERP5XhtmlStyle_getFormEnctype(form);\n + tal:attributes="enctype python: here.ERP5Site_getFormEnctype(form);\n action url;\n method form/method | string:post">\n \n diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index 560731b56b..df2d2b6cee 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -490 \ No newline at end of file +497 \ No newline at end of file -- 2.30.9