Commit 8616bedb authored by Vincent Pelletier's avatar Vincent Pelletier

Add a local copy of ERP5XhtmlStyle_getFormGroupTitleAndId script which was...

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
parent 0b7f20f0
<?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>
......@@ -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
......
490
\ No newline at end of file
497
\ 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