Commit 483e9029 authored by Kevin Deldycke's avatar Kevin Deldycke

This is the second attemp by Moussa to correct the bug #56.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3646 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 808f278a
...@@ -72,10 +72,6 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list ...@@ -72,10 +72,6 @@ def makeTreeBody(form, root_dict, domain_path, depth, total_depth, unfolded_list
if total_depth is None: if total_depth is None:
total_depth = max(1, len(unfolded_list)) total_depth = max(1, len(unfolded_list))
# This two lines must correct the bug #56
if domain_path == ('portal_categories',):
return ''
if type(domain_path) is type('a'): domain_path = domain_path.split('/') if type(domain_path) is type('a'): domain_path = domain_path.split('/')
portal_categories = getattr(form, 'portal_categories', None) portal_categories = getattr(form, 'portal_categories', None)
...@@ -170,6 +166,7 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol ...@@ -170,6 +166,7 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol
root = root_dict[base_category] = root_dict[None] = portal_categories[base_category] root = root_dict[base_category] = root_dict[None] = portal_categories[base_category]
report_path = report_path[1:] report_path = report_path[1:]
if root is None and portal_domains is not None: if root is None and portal_domains is not None:
if base_category in portal_domains.objectIds(): if base_category in portal_domains.objectIds():
root = root_dict[base_category] = root_dict[None] = portal_domains[base_category] root = root_dict[base_category] = root_dict[None] = portal_domains[base_category]
report_path = report_path[1:] report_path = report_path[1:]
...@@ -914,7 +911,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -914,7 +911,7 @@ class ListBoxWidget(Widget.Widget):
pass pass
else: else:
default_selection_report_path = report_root_list[0][0] default_selection_report_path = report_root_list[0][0]
selection_report_path = selection.getReportPath(default = (default_selection_report_path,)) selection_report_path = selection.getReportPath(default = default_selection_report_path)
if report_depth is not None: if report_depth is not None:
selection_report_current = () selection_report_current = ()
else: else:
...@@ -1891,20 +1888,25 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -1891,20 +1888,25 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
#Create DomainTree Selector and DomainTree box #Create DomainTree Selector and DomainTree box
if domain_tree: if domain_tree:
select_tree_options = '' select_tree_options = ''
default_selected = ''
for c in domain_root_list: for c in domain_root_list:
if c[0] == selection_domain_path: if c[0] == selection_domain_path:
select_tree_options += """<option selected value="%s">%s</option>\n""" % (c[0], c[1]) select_tree_options += """<option selected value="%s">%s</option>\n""" % (c[0], c[1])
else: else:
select_tree_options += """<option value="%s">%s</option>\n""" % (c[0], c[1]) select_tree_options += """<option value="%s">%s</option>\n""" % (c[0], c[1])
if default_selected == '':
default_selected = c[0] #the first is selected
select_tree_header = """<select name="domain_root_url" select_tree_header = """<select name="domain_root_url"
onChange="submitAction(this.form,'%s/portal_selections/setDomainRoot')"> onChange="submitAction(this.form,'%s/portal_selections/setDomainRoot')">
%s</select>""" % (here.getUrl(),select_tree_options) %s</select>""" % (here.getUrl(),select_tree_options)
try: try:
select_tree_body = makeTreeBody(form, None, selection_domain_path, if selection_domain_path == ('portal_categories',):
0, None, selection_domain_current, form.id, selection_name) selection_domain_path = default_selected
select_tree_body = makeTreeBody(form, None, selection_domain_path,
0, None, selection_domain_current, form.id, selection_name)
except KeyError: except KeyError:
select_tree_body = '' select_tree_body = ''
select_tree_html = """<!-- Select Tree --> select_tree_html = """<!-- Select Tree -->
%s %s
...@@ -1948,6 +1950,7 @@ class ListBoxValidator(Validator.Validator): ...@@ -1948,6 +1950,7 @@ class ListBoxValidator(Validator.Validator):
portal_url = getToolByName(here, 'portal_url') portal_url = getToolByName(here, 'portal_url')
portal = portal_url.getPortalObject() portal = portal_url.getPortalObject()
result = {} result = {}
error_result = {} error_result = {}
listbox_uids = REQUEST.get('%s_uid' % field.id, []) listbox_uids = REQUEST.get('%s_uid' % field.id, [])
......
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