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
...@@ -37,11 +37,9 @@ ...@@ -37,11 +37,9 @@
# fit the constraints. # fit the constraints.
import pdb
import string, types, sys import string, types, sys
# class monitoring access security control # Class monitoring access security control
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Globals import InitializeClass from Globals import InitializeClass
...@@ -86,7 +84,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -86,7 +84,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
found. Otherwise save in the REQUEST the list of error blocks so that found. Otherwise save in the REQUEST the list of error blocks so that
they can be displayed in a special way. they can be displayed in a special way.
""" """
# init params # init params
value = None value = None
form = field.aq_parent form = field.aq_parent
...@@ -96,7 +93,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -96,7 +93,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
block_moved_string = REQUEST.get('block_moved','') block_moved_string = REQUEST.get('block_moved','')
block_previous_string = REQUEST.get('previous_block_moved','') block_previous_string = REQUEST.get('previous_block_moved','')
################################################## ##################################################
############## REBUILD STRUCTURE ################# ############## REBUILD STRUCTURE #################
################################################## ##################################################
...@@ -158,7 +154,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -158,7 +154,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
return None return None
# block_moved_list is updated # block_moved_list is updated
# dict aimed to hold all informations about block # dict aimed to hold all informations about block
final_block_dict = {} final_block_dict = {}
# dict holding all the activities that will need an update because at least # dict holding all the activities that will need an update because at least
...@@ -170,7 +165,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -170,7 +165,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
error_block_list = [] error_block_list = []
error_info_dict = {} error_info_dict = {}
################################################## ##################################################
########## GETTING BLOCK INFORMATIONS ############ ########## GETTING BLOCK INFORMATIONS ############
################################################## ##################################################
...@@ -279,7 +273,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -279,7 +273,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
activity_dict[final_block['activity_origin'].name] = [final_block] activity_dict[final_block['activity_origin'].name] = [final_block]
################################################## ##################################################
# getting object_dict to update object properties once activities are up to # getting object_dict to update object properties once activities are up to
# date. Activities values will be updated directly on the # date. Activities values will be updated directly on the
...@@ -333,7 +326,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -333,7 +326,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
activity_desc['axis_start'] = start_value activity_desc['axis_start'] = start_value
activity_desc['axis_stop'] = stop_value activity_desc['axis_stop'] = stop_value
################################################## ##################################################
############### UPDATING OBJECTS ################# ############### UPDATING OBJECTS #################
################################################## ##################################################
...@@ -363,7 +355,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -363,7 +355,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
if can_update_stop and axis_stop != None: if can_update_stop and axis_stop != None:
update_dict[object_name][stop_property] = axis_stop update_dict[object_name][stop_property] = axis_stop
# testing if need to raise errors # testing if need to raise errors
if len(errors_list) > 0: if len(errors_list) > 0:
# need to raise an error # need to raise an error
...@@ -387,11 +378,9 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -387,11 +378,9 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
# for updating data # for updating data
return update_dict return update_dict
def getBlockPositionFromString(self, block_string): def getBlockPositionFromString(self, block_string):
""" """
takes a string with block data and convert it to a list of dicts Takes a string with block data and convert it to a list of dicts
""" """
block_list = [] block_list = []
if block_string != '': if block_string != '':
...@@ -475,7 +464,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -475,7 +464,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
return None return None
def getDestinationBounds(self, structure, block_moved, block_object, def getDestinationBounds(self, structure, block_moved, block_object,
planning_coordinates, axis_length, planning_coordinates, axis_length,
destination_group=None): destination_group=None):
...@@ -528,8 +516,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -528,8 +516,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
return [new_start,new_stop, error] return [new_start,new_stop, error]
def getActivityBounds(self, activity, activity_block_moved_list, def getActivityBounds(self, activity, activity_block_moved_list,
activity_block_list): activity_block_list):
""" """
...@@ -546,7 +532,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -546,7 +532,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
block_moved_name_list = map(lambda x: x['block_moved']['name'], block_moved_name_list = map(lambda x: x['block_moved']['name'],
activity_block_moved_list) activity_block_moved_list)
for activity_block in activity_block_list: for activity_block in activity_block_list:
if activity_block.name in block_moved_name_list: if activity_block.name in block_moved_name_list:
# the block composing the activity has been moved, not taking care of # the block composing the activity has been moved, not taking care of
...@@ -583,7 +568,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -583,7 +568,6 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
return [new_start,new_stop] return [new_start,new_stop]
def getObjectDict(self, structure): def getObjectDict(self, structure):
""" """
Takes all activities related to a specified object and return Takes all activities related to a specified object and return
...@@ -638,16 +622,12 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -638,16 +622,12 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
}) })
return object_dict return object_dict
class PlanningBoxWidget(Widget.Widget): class PlanningBoxWidget(Widget.Widget):
""" """
PlanningBox main class used to run all the process in order to generate PlanningBox main class used to run all the process in order to generate
the structure of the Planning including all internal properties. the structure of the Planning including all internal properties.
Contains BasicStructure and PlanningStructure instances Contains BasicStructure and PlanningStructure instances
""" """
property_names = Widget.Widget.property_names +\ property_names = Widget.Widget.property_names +\
['js_enabled', ['js_enabled',
# kind of display : horizontal or vertical # kind of display : horizontal or vertical
...@@ -803,51 +783,42 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -803,51 +783,42 @@ class PlanningBoxWidget(Widget.Widget):
default = 5, default = 5,
required=1) required=1)
report_root_list = fields.ListTextAreaField('report_root_list', report_root_list = fields.ListTextAreaField('report_root_list',
title="Report Root", title="Report Root",
description=("A list of domains which define the possible root."), description=("A list of domains which define the possible root."),
default=[], default=[],
required=0) required=0)
selection_name = fields.StringField('selection_name', selection_name = fields.StringField('selection_name',
title='Selection Name', title='Selection Name',
description=("The name of the selection to store selections params"), description=("The name of the selection to store selections params"),
default='planning_0', default='planning_0',
required=1) required=1)
portal_types = fields.ListTextAreaField('portal_types', portal_types = fields.ListTextAreaField('portal_types',
title="Portal Types", title="Portal Types",
description=("Portal Types of objects to list. Required."), description=("Portal Types of objects to list. Required."),
default=[], default=[],
required=0) required=0)
sort = fields.ListTextAreaField('sort', sort = fields.ListTextAreaField('sort',
title='Default Sort', title='Default Sort',
description=("The default sort keys and order"), description=("The default sort keys and order"),
default=[], default=[],
required=0) required=0)
list_method = fields.MethodField('list_method', list_method = fields.MethodField('list_method',
title='List Method', title='List Method',
description=("Method to use to list objects"), description=("Method to use to list objects"),
default='searchFolder', default='searchFolder',
required=0) required=0)
title_line = fields.StringField('title_line', title_line = fields.StringField('title_line',
title="specific method which fetches the title of each line", title="specific method which fetches the title of each line",
description=("specific method for inserting title in line"), description=("specific method for inserting title in line"),
default='', default='',
required=0) required=0)
x_start_bloc = fields.StringField('x_start_bloc', x_start_bloc = fields.StringField('x_start_bloc',
title='specific property to get start of blocks (ex. start_date)', title='specific property to get start of blocks (ex. start_date)',
description=('Property for building X-Axis such as start_date\ description=('Property for building X-Axis such as start_date\
...@@ -868,7 +839,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -868,7 +839,6 @@ class PlanningBoxWidget(Widget.Widget):
default='quantity', default='quantity',
required=0) required=0)
constraint_method = fields.StringField('constraint_method', constraint_method = fields.StringField('constraint_method',
title='name of constraint method between blocks', title='name of constraint method between blocks',
description=('Constraint method between blocks objects'), description=('Constraint method between blocks objects'),
...@@ -908,7 +878,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -908,7 +878,6 @@ class PlanningBoxWidget(Widget.Widget):
default='Planning_generateAxis', default='Planning_generateAxis',
required=1) required=1)
info_center = fields.StringField('info_center', info_center = fields.StringField('info_center',
title='specific method of data called for inserting info in\ title='specific method of data called for inserting info in\
block center', block center',
...@@ -956,8 +925,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -956,8 +925,6 @@ class PlanningBoxWidget(Widget.Widget):
default=2, default=2,
required=0) required=0)
def render_css(self,field, key, value, REQUEST): def render_css(self,field, key, value, REQUEST):
""" """
first method called for rendering by PageTemplate form_view first method called for rendering by PageTemplate form_view
...@@ -967,7 +934,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -967,7 +934,6 @@ class PlanningBoxWidget(Widget.Widget):
""" """
here = REQUEST['here'] here = REQUEST['here']
# build structure # build structure
# render_structure will call all method necessary to build the entire # render_structure will call all method necessary to build the entire
# structure relative to the planning # structure relative to the planning
...@@ -975,8 +941,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -975,8 +941,6 @@ class PlanningBoxWidget(Widget.Widget):
self.render_structure(field=field, key=key, value=value, self.render_structure(field=field, key=key, value=value,
REQUEST=REQUEST, here=here) REQUEST=REQUEST, here=here)
# getting CSS script generator # getting CSS script generator
planning_css_method = getattr(REQUEST['here'],'planning_css') planning_css_method = getattr(REQUEST['here'],'planning_css')
# recover CSS data buy calling DTML document # recover CSS data buy calling DTML document
...@@ -986,11 +950,9 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -986,11 +950,9 @@ class PlanningBoxWidget(Widget.Widget):
return CSS_data return CSS_data
def render(self,field,key,value,REQUEST): def render(self,field,key,value,REQUEST):
""" """
method called to render the HTML code relative to the planning. Method called to render the HTML code relative to the planning.
for that recover the structure previouly saved in the REQUEST, and then for that recover the structure previouly saved in the REQUEST, and then
call a special Page Template aimed to render call a special Page Template aimed to render
""" """
...@@ -1007,7 +969,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -1007,7 +969,6 @@ class PlanningBoxWidget(Widget.Widget):
# return HTML data # return HTML data
return HTML_data return HTML_data
def render_structure(self, field, key, value, REQUEST, here): def render_structure(self, field, key, value, REQUEST, here):
""" this method is the begining of the rendering procedure. it calls all """ this method is the begining of the rendering procedure. it calls all
methods needed to generate BasicStructure with ERP5 objects, and then methods needed to generate BasicStructure with ERP5 objects, and then
...@@ -1019,8 +980,6 @@ class PlanningBoxWidget(Widget.Widget): ...@@ -1019,8 +980,6 @@ class PlanningBoxWidget(Widget.Widget):
# XXX testing : uncoment to put selection to null => used for debugging # XXX testing : uncoment to put selection to null => used for debugging
#here.portal_selections.setSelectionFor(selection_name, None) #here.portal_selections.setSelectionFor(selection_name, None)
####### DATA DEFINITION ####### ####### DATA DEFINITION #######
self.build_error_list = None self.build_error_list = None
# recovering usefull planning properties # recovering usefull planning properties
...@@ -1121,7 +1080,6 @@ class BasicStructure: ...@@ -1121,7 +1080,6 @@ class BasicStructure:
objects with their values objects with their values
4 - create report_sections 4 - create report_sections
""" """
default_params ={} default_params ={}
current_section = None current_section = None
#params = self.selection.getParams() #params = self.selection.getParams()
...@@ -1152,8 +1110,6 @@ class BasicStructure: ...@@ -1152,8 +1110,6 @@ class BasicStructure:
portal_categories = getattr(self.form,'portal_categories',None) portal_categories = getattr(self.form,'portal_categories',None)
portal_domains = getattr(self.form,'portal_domains',None) portal_domains = getattr(self.form,'portal_domains',None)
################################################## ##################################################
############### BUILDING QUERY ################### ############### BUILDING QUERY ###################
################################################## ##################################################
...@@ -1206,7 +1162,6 @@ class BasicStructure: ...@@ -1206,7 +1162,6 @@ class BasicStructure:
else: else:
show_stat = 1 show_stat = 1
################################################## ##################################################
############ BUILDING REPORT_TREE ################ ############ BUILDING REPORT_TREE ################
################################################## ##################################################
...@@ -1247,8 +1202,11 @@ class BasicStructure: ...@@ -1247,8 +1202,11 @@ class BasicStructure:
base_category=None, depth=0, base_category=None, depth=0,
unfolded_list=selection_report_current, unfolded_list=selection_report_current,
selection_name=self.selection_name, selection_name=self.selection_name,
report_depth=report_depth,is_report_opened=is_report_opened, report_depth=report_depth,
sort_on=self.selection.sort_on,form_id=self.form.id) list_method=self.list_method,
is_report_opened=is_report_opened,
sort_on=self.selection.sort_on,
form_id=self.form.id)
################################################## ##################################################
########### BUILDING REPORT_GROUPS ############### ########### BUILDING REPORT_GROUPS ###############
...@@ -1275,7 +1233,7 @@ class BasicStructure: ...@@ -1275,7 +1233,7 @@ class BasicStructure:
# now iterating through report_tree_list # now iterating through report_tree_list
for object_tree_line in report_tree_list: for object_tree_line in report_tree_list:
# prepare query by defining selection report object # prepare query by defining selection report object
self.selection.edit(report = object_tree_line.getSelectDomainDict())
# defining info_dict, holding all information about the current object. # defining info_dict, holding all information about the current object.
info_dict = None info_dict = None
...@@ -1376,7 +1334,6 @@ class BasicStructure: ...@@ -1376,7 +1334,6 @@ class BasicStructure:
self.nbr_groups += 1 self.nbr_groups += 1
# reset to original value # reset to original value
self.selection.edit(report = None) self.selection.edit(report = None)
#self.selection.edit(report_list=None) # comment to save report_list status #self.selection.edit(report_list=None) # comment to save report_list status
...@@ -1441,7 +1398,6 @@ class BasicStructure: ...@@ -1441,7 +1398,6 @@ class BasicStructure:
# Found error while setting secondary axis bounds # Found error while setting secondary axis bounds
return status return status
################################################## ##################################################
####### SAVING NEW PROPERTIES INTO REQUEST ####### ####### SAVING NEW PROPERTIES INTO REQUEST #######
################################################## ##################################################
...@@ -1451,7 +1407,6 @@ class BasicStructure: ...@@ -1451,7 +1407,6 @@ class BasicStructure:
self.selection, self.selection,
REQUEST = self.REQUEST) REQUEST = self.REQUEST)
################################################## ##################################################
######### BUILDING GROUP_OBJECT STRUCTURE ######## ######### BUILDING GROUP_OBJECT STRUCTURE ########
################################################## ##################################################
...@@ -1468,8 +1423,6 @@ class BasicStructure: ...@@ -1468,8 +1423,6 @@ class BasicStructure:
# everything is fine # everything is fine
return 1 return 1
def getSecondaryAxisOccurence(self): def getSecondaryAxisOccurence(self):
""" """
get secondary_axis occurences in order to define begin and end bounds. get secondary_axis occurences in order to define begin and end bounds.
...@@ -1479,7 +1432,7 @@ class BasicStructure: ...@@ -1479,7 +1432,7 @@ class BasicStructure:
secondary_axis_occurence = [] secondary_axis_occurence = []
# defining the objects requested for calendar mode testing # defining the objects requested for calendar mode testing
if self.selection_report_path == 'parent': if 'parent' in self.selection_report_path :
calendar_mode = 0 calendar_mode = 0
else: else:
calendar_mode = 1 # assuming calendar_mode = 1 by default. calendar_mode = 1 # assuming calendar_mode = 1 by default.
...@@ -1563,8 +1516,6 @@ class BasicStructure: ...@@ -1563,8 +1516,6 @@ class BasicStructure:
self.calendar_range = calendar_range self.calendar_range = calendar_range
self.secondary_axis_occurence = secondary_axis_occurence self.secondary_axis_occurence = secondary_axis_occurence
def getSecondaryAxisInfo(self, axis_dict): def getSecondaryAxisInfo(self, axis_dict):
""" """
secondary_axis_ocurence holds couples of data (begin,end) related to secondary_axis_ocurence holds couples of data (begin,end) related to
...@@ -1631,10 +1582,9 @@ class BasicStructure: ...@@ -1631,10 +1582,9 @@ class BasicStructure:
# everything is OK, returning 'true' flag # everything is OK, returning 'true' flag
return 1 return 1
def getMainAxisInfo(self, axis_dict): def getMainAxisInfo(self, axis_dict):
""" """
getting main axis properties (total pages, current page, groups per page) Getting main axis properties (total pages, current page, groups per page)
and setting selection bounds (start & stop). and setting selection bounds (start & stop).
beware this justs calculate the position of the first group present on the beware this justs calculate the position of the first group present on the
page (same for the last one), applying the selection is another thing in page (same for the last one), applying the selection is another thing in
...@@ -1646,7 +1596,6 @@ class BasicStructure: ...@@ -1646,7 +1596,6 @@ class BasicStructure:
#XXX raise exception : no group nb/page defined #XXX raise exception : no group nb/page defined
pass pass
# setting begin & end bounds # setting begin & end bounds
axis_dict['bound_begin'] = 0 axis_dict['bound_begin'] = 0
axis_dict['bound_end'] = len(self.report_groups) axis_dict['bound_end'] = len(self.report_groups)
...@@ -1694,7 +1643,6 @@ class BasicStructure: ...@@ -1694,7 +1643,6 @@ class BasicStructure:
self.params['list_lines'] = axis_dict['bound_axis_groups'] self.params['list_lines'] = axis_dict['bound_axis_groups']
self.params['list_start'] = axis_dict['bound_start'] self.params['list_start'] = axis_dict['bound_start']
def buildGroupStructure(self): def buildGroupStructure(self):
""" """
this procedure builds BasicGroup instances corresponding to the this procedure builds BasicGroup instances corresponding to the
...@@ -1992,7 +1940,6 @@ class BasicGroup: ...@@ -1992,7 +1940,6 @@ class BasicGroup:
else: else:
block_end = None block_end = None
# testing if activity is visible according to the current zoom selection # testing if activity is visible according to the current zoom selection
# over the secondary_axis # over the secondary_axis
if block_begin == None: if block_begin == None:
...@@ -2055,8 +2002,6 @@ class BasicGroup: ...@@ -2055,8 +2002,6 @@ class BasicGroup:
self.basic_activity_list = [] self.basic_activity_list = []
self.basic_activity_list.append(activity) self.basic_activity_list.append(activity)
class BasicActivity: class BasicActivity:
""" Represents an activity, a task, in the group it belongs to. Beware """ Represents an activity, a task, in the group it belongs to. Beware
nothing about multitask rendering. """ nothing about multitask rendering. """
...@@ -2082,8 +2027,6 @@ class BasicActivity: ...@@ -2082,8 +2027,6 @@ class BasicActivity:
self.property_dict = property_dict # dict containing specific properties self.property_dict = property_dict # dict containing specific properties
class PlanningStructure: class PlanningStructure:
""" class aimed to generate the Planning final structure, including : """ class aimed to generate the Planning final structure, including :
- activities with their blocs (so contains Activity structure) - activities with their blocs (so contains Activity structure)
...@@ -2091,7 +2034,6 @@ class PlanningStructure: ...@@ -2091,7 +2034,6 @@ class PlanningStructure:
The zoom properties on secondary axis are applied to this structure. The zoom properties on secondary axis are applied to this structure.
""" """
def __init__ (self): def __init__ (self):
self.main_axis = '' self.main_axis = ''
self.secondary_axis = '' self.secondary_axis = ''
...@@ -2171,7 +2113,6 @@ class PlanningStructure: ...@@ -2171,7 +2113,6 @@ class PlanningStructure:
""" """
build secondary axis structure build secondary axis structure
""" """
# defining min and max delimiter number # defining min and max delimiter number
delimiter_min_number = basic_structure.field.get_value('delimiter') delimiter_min_number = basic_structure.field.get_value('delimiter')
if basic_structure.calendar_mode: if basic_structure.calendar_mode:
...@@ -2778,7 +2719,7 @@ class Position: ...@@ -2778,7 +2719,7 @@ class Position:
self.absolute_begin = absolute_begin self.absolute_begin = absolute_begin
self.absolute_end = absolute_end self.absolute_end = absolute_end
self.absolute_range = absolute_range self.absolute_range = absolute_range
# selative size in % of the current axis size # relative size in % of the current axis size
self.relative_begin = relative_begin self.relative_begin = relative_begin
self.relative_end = relative_end self.relative_end = relative_end
self.relative_range = relative_range self.relative_range = relative_range
...@@ -2786,7 +2727,7 @@ class Position: ...@@ -2786,7 +2727,7 @@ class Position:
class Axis: class Axis:
""" """
Structure holding informations about a specified axis.Can be X or Y axis. Structure holding informations about a specified axis. Can be X or Y axis.
Is aimed to handle axis with any kind of unit : continuous or listed ( Is aimed to handle axis with any kind of unit : continuous or listed (
including possibly a listed ReportTree). including possibly a listed ReportTree).
Two of them are needed in a PlanningStructure to have X and Y axis. Two of them are needed in a PlanningStructure to have X and Y axis.
...@@ -2901,7 +2842,7 @@ class AxisGroup: ...@@ -2901,7 +2842,7 @@ class AxisGroup:
def addActivity(self, activity=None, axis_element_already_insered= 0): def addActivity(self, activity=None, axis_element_already_insered= 0):
""" """
procedure that permits to add activity to the corresponding AxisElement in Procedure that permits to add activity to the corresponding AxisElement in
an AxisGroup. can create new Axis Element in the actual Axisgroup if an AxisGroup. can create new Axis Element in the actual Axisgroup if
necessary. Permits representation of MULTITASKING necessary. Permits representation of MULTITASKING
""" """
......
...@@ -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