Commit aedcfbdf authored by Rafael Monnerat's avatar Rafael Monnerat

Small typo fixes in Planning Box.

The modification in SelectionTool should not modify any 
other result in ERP5, just The PlanningBox.

Basically you can pass another list_method as parameter 
instead use only searchFolder. searchFolder was kept as default.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13227 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 84c8a0c3
This diff is collapsed.
...@@ -615,7 +615,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -615,7 +615,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
# PlanningBox related methods # PlanningBox related methods
security.declareProtected(ERP5Permissions.View, 'setZoomLevel') security.declareProtected(ERP5Permissions.View, 'setZoomLevel')
def setZoomLevel(self, uids=None, REQUEST=None): def setZoomLevel(self, uids=None, REQUEST=None, form_id=None, query_string=None):
""" """
Set graphic zoom level in PlanningBox Set graphic zoom level in PlanningBox
""" """
...@@ -634,10 +634,11 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -634,10 +634,11 @@ class SelectionTool( UniqueObject, SimpleItem ):
params['zoom_start'] = zoom_start params['zoom_start'] = zoom_start
selection.edit(params= params) selection.edit(params= params)
if REQUEST is not None: if REQUEST is not None:
return self._redirectToOriginalForm(REQUEST=REQUEST) return self._redirectToOriginalForm(REQUEST=REQUEST, form_id=form_id,
query_string=query_string)
security.declareProtected(ERP5Permissions.View, 'setZoom') security.declareProtected(ERP5Permissions.View, 'setZoom')
def setZoom(self, uids=None, REQUEST=None): def setZoom(self, uids=None, REQUEST=None, form_id=None, query_string=None):
""" """
Set graphic zoom in PlanningBox Set graphic zoom in PlanningBox
""" """
...@@ -651,10 +652,11 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -651,10 +652,11 @@ class SelectionTool( UniqueObject, SimpleItem ):
params['zoom_start'] = zoom_start params['zoom_start'] = zoom_start
selection.edit(params= params) selection.edit(params= params)
if REQUEST is not None: if REQUEST is not None:
return self._redirectToOriginalForm(REQUEST=REQUEST) return self._redirectToOriginalForm(REQUEST=REQUEST, form_id=form_id,
query_string=query_string)
security.declareProtected(ERP5Permissions.View, 'nextZoom') security.declareProtected(ERP5Permissions.View, 'nextZoom')
def nextZoom(self, uids=None, REQUEST=None): def nextZoom(self, uids=None, REQUEST=None, form_id=None, query_string=None):
""" """
Set next graphic zoom start in PlanningBox Set next graphic zoom start in PlanningBox
""" """
...@@ -668,10 +670,11 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -668,10 +670,11 @@ class SelectionTool( UniqueObject, SimpleItem ):
params['zoom_start'] = int(zoom_start) + 1 params['zoom_start'] = int(zoom_start) + 1
selection.edit(params= params) selection.edit(params= params)
if REQUEST is not None: if REQUEST is not None:
return self._redirectToOriginalForm(REQUEST=REQUEST) return self._redirectToOriginalForm(REQUEST=REQUEST, form_id=form_id,
query_string=query_string)
security.declareProtected(ERP5Permissions.View, 'previousZoom') security.declareProtected(ERP5Permissions.View, 'previousZoom')
def previousZoom(self, uids=None, REQUEST=None): def previousZoom(self, uids=None, REQUEST=None, form_id=None, query_string=None):
""" """
Set previous graphic zoom in PlanningBox Set previous graphic zoom in PlanningBox
""" """
...@@ -685,7 +688,8 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -685,7 +688,8 @@ class SelectionTool( UniqueObject, SimpleItem ):
params['zoom_start'] = int(zoom_start) - 1 params['zoom_start'] = int(zoom_start) - 1
selection.edit(params= params) selection.edit(params= params)
if REQUEST is not None: if REQUEST is not None:
return self._redirectToOriginalForm(REQUEST=REQUEST) return self._redirectToOriginalForm(REQUEST=REQUEST, form_id=form_id,
query_string=query_string)
security.declareProtected(ERP5Permissions.View, 'setDomainRoot') security.declareProtected(ERP5Permissions.View, 'setDomainRoot')
def setDomainRoot(self, REQUEST, form_id=None, query_string=None): def setDomainRoot(self, REQUEST, form_id=None, query_string=None):
...@@ -1278,7 +1282,10 @@ class TreeListLine: ...@@ -1278,7 +1282,10 @@ class TreeListLine:
return self.exception_uid_list return self.exception_uid_list
def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfolded_list, form_id, selection_name, report_depth, is_report_opened=1, sort_on = (('id', 'ASC'),)): def makeTreeList(here, form, root_dict, report_path, base_category,
depth, unfolded_list, form_id, selection_name,
report_depth, is_report_opened=1, list_method=None,
sort_on = (('id', 'ASC'),)):
""" """
(object, is_pure_summary, depth, is_open, select_domain_dict) (object, is_pure_summary, depth, is_open, select_domain_dict)
...@@ -1328,26 +1335,40 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol ...@@ -1328,26 +1335,40 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol
if root is None: return tree_list if root is None: return tree_list
if base_category == 'parent': if base_category == 'parent':
# Use searchFolder as default
if list_method is None:
if hasattr(aq_base(root), 'objectValues'): if hasattr(aq_base(root), 'objectValues'):
# If this is a folder, try to browse the hierarchy # If this is a folder, try to browse the hierarchy
for zo in root.searchFolder(sort_on=sort_on): object_list = root.searchFolder(sort_on=sort_on)
elif hasattr(aq_base(root), list_method.__name__ ):
object_list = list_method()
else:
object_list = []
for zo in object_list:
o = zo.getObject() o = zo.getObject()
if o is not None: if o is not None:
new_root_dict = root_dict.copy() new_root_dict = root_dict.copy()
new_root_dict[None] = new_root_dict[base_category] = o new_root_dict[None] = new_root_dict[base_category] = o
selection_domain = DomainSelection(domain_dict = new_root_dict) selection_domain = DomainSelection(domain_dict = new_root_dict)
if (report_depth is not None and depth <= (report_depth - 1)) or o.getRelativeUrl() in unfolded_list: if (report_depth is not None and depth <= (report_depth - 1)) or \
o.getRelativeUrl() in unfolded_list:
exception_uid_list = [] # Object we do not want to display exception_uid_list = [] # Object we do not want to display
for sub_zo in o.searchFolder(sort_on=sort_on): for sub_zo in o.searchFolder(sort_on=sort_on):
sub_o = sub_zo.getObject() sub_o = sub_zo.getObject()
if sub_o is not None and hasattr(aq_base(root), 'objectValues'): if sub_o is not None and hasattr(aq_base(root), 'objectValues'):
exception_uid_list.append(sub_o.getUid()) exception_uid_list.append(sub_o.getUid())
tree_list += [TreeListLine(o, 1, depth, 1, selection_domain, exception_uid_list)] # Summary (open) # Summary (open)
tree_list += [TreeListLine(o, 1, depth, 1, selection_domain, exception_uid_list)]
if is_report_opened : if is_report_opened :
tree_list += [TreeListLine(o, 0, depth, 0, selection_domain, exception_uid_list)] # List (contents, closed, must be strict selection) # List (contents, closed, must be strict selection)
tree_list += makeTreeList(here, form, new_root_dict, report_path, base_category, depth + 1, unfolded_list, form_id, selection_name, report_depth, is_report_opened=is_report_opened, sort_on=sort_on) tree_list += [TreeListLine(o, 0, depth, 0, selection_domain, exception_uid_list)]
tree_list += makeTreeList(here, form, new_root_dict, report_path,
base_category, depth + 1, unfolded_list, form_id,
selection_name, report_depth,
is_report_opened=is_report_opened, sort_on=sort_on)
else: else:
tree_list += [TreeListLine(o, 1, depth, 0, selection_domain, ())] # Summary (closed) tree_list += [TreeListLine(o, 1, depth, 0, selection_domain, ())] # Summary (closed)
else: else:
......
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