Commit 62d3fd54 authored by Ivan Tyagov's avatar Ivan Tyagov

Use buttons to fold / unfold domain in order to save rest of form's input elements' values.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45718 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3648adf5
......@@ -112,6 +112,7 @@
<tal:block tal:define="global box_relative_url python: request.get(\'box_relative_url\', \'\');\n
global box python: real_context.restrictedTraverse(box_relative_url); \n
global box_id python: \'%s_content\' %box_relative_url.replace(\'/\', \'_\');\n
global box_id python: \'%s_content\' %real_context.getRelativeUrl().replace(\'/\', \'_\');\n
global dom_id python: request.get(\'dom_id\',None) or box_id;\n
global field_prefix string:${box_id}_">\n
<input tal:condition="python:form_id" \n
......@@ -156,14 +157,18 @@
<td colspan="1" \n
class="listbox-table-domain-tree-cell"\n
tal:attributes="colspan python: total_depth - report_tree.depth + 1">\n
<a href="method" class="tree-open"\n
tal:condition="report_tree/is_open"\n
tal:attributes="href string:foldDomain?domain_url=${report_tree/domain_url}&form_id=${form_id}&list_selection_name=${selection_name}&domain_depth:int=${report_tree/depth}"\n
tal:content="report_tree/obj/getCompactTranslatedTitle"/>\n
<a href="method" class="tree-closed"\n
tal:condition="not: report_tree/is_open"\n
tal:attributes="href string:unfoldDomain?domain_url=${report_tree/domain_url}&form_id=${form_id}&list_selection_name=${selection_name}&domain_depth:int=${report_tree/depth}"\n
tal:content="report_tree/obj/getCompactTranslatedTitle"/>\n
<button type="submit"\n
name="foldDomain:method"\n
class="tree-open"\n
tal:condition="report_tree/is_open"\n
tal:content="report_tree/obj/getCompactTranslatedTitle"\n
tal:attributes="value string:${report_tree/domain_url}.${report_tree/depth}"/>\n
<button type="submit"\n
name="unfoldDomain:method"\n
class="tree-closed"\n
tal:condition="not: report_tree/is_open"\n
tal:content="report_tree/obj/getCompactTranslatedTitle"\n
tal:attributes="value string:${report_tree/domain_url}.${report_tree/depth}"/>\n
</td>\n
</tr>\n
</table>\n
......
......@@ -561,6 +561,25 @@ div.listbox-list-style-selection li a.selected,\n
font-weight: bold;\n
}\n
\n
/* Domain / Report tree buttons */\n
button.tree-open,\n
button.tree-closed{\n
background: none;\n
border: none;\n
cursor: pointer;\n
}\n
button.tree-open{\n
background: url("./images/tree_open.png") no-repeat scroll left center transparent;\n
font-weight: bold;\n
padding-left: 15px;\n
}\n
\n
button.tree-closed{\n
background: url("./images/tree_closed.png") no-repeat scroll left center transparent;\n
padding-left: 15px;\n
}\n
\n
\n
/* Listbox full text search bar */\n
div.listbox-full-text-search {\n
}\n
......
1069
\ No newline at end of file
1070
\ No newline at end of file
......@@ -942,8 +942,11 @@ class SelectionTool( BaseTool, SimpleItem ):
"""
selection_name = REQUEST.list_selection_name
selection = self.getSelectionFor(selection_name, REQUEST)
domain_url = REQUEST.form.get('domain_url',None)
domain_depth = REQUEST.form.get('domain_depth',0)
unfoldDomain = REQUEST.form.get('unfoldDomain', None)
domain_url, domain_depth = unfoldDomain.split('.', 2)
domain_depth = int(domain_depth)
domain_list = list(selection.getDomainList())
domain_list = domain_list[0:min(domain_depth, len(domain_list))]
if isinstance(domain_url, str):
......@@ -960,8 +963,11 @@ class SelectionTool( BaseTool, SimpleItem ):
"""
selection_name = REQUEST.list_selection_name
selection = self.getSelectionFor(selection_name, REQUEST)
domain_url = REQUEST.form.get('domain_url',None)
domain_depth = REQUEST.form.get('domain_depth',0)
foldDomain = REQUEST.form.get('foldDomain', None)
domain_url, domain_depth = foldDomain.split('.', 2)
domain_depth = int(domain_depth)
domain_list = list(selection.getDomainList())
domain_list = domain_list[0:min(domain_depth, len(domain_list))]
selection.edit(domain_list=[x for x in domain_list if x != domain_url])
......
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