Commit 7786cf4e authored by Rafael Monnerat's avatar Rafael Monnerat

Fix for blocs when use report domains.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13946 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ee271744
...@@ -1289,7 +1289,22 @@ class BasicStructure: ...@@ -1289,7 +1289,22 @@ class BasicStructure:
# recovering exeption_uid_list # recovering exeption_uid_list
exception_uid_list = object_tree_line.getExceptionUidList() exception_uid_list = object_tree_line.getExceptionUidList()
if exception_uid_list is not None: # XXX filter the object to the right domain.
# Can be improved in future.
domain_obj = object_tree_line.getObject()
new_object_list = []
if domain_obj.getPortalType() == 'Domain':
category_obj = domain_obj.getMembershipCriterionCategory()
membership_base_category = domain_obj.getMembershipCriterionBaseCategory()
if (category_obj is not None) and (membership_base_category is not None):
category_value = (membership_base_category + '/' +category_obj.getRelativeUrl())
for selected_object in object_list:
if category_value in selected_object.getCategoriesList():
new_object_list.append(selected_object)
object_list = new_object_list
if exception_uid_list not in ([],None) :
# Filter folders if parent tree : # Filter folders if parent tree :
# build new object_list for current line # build new object_list for current line
# (list of relative elements) # (list of relative elements)
...@@ -1546,9 +1561,10 @@ class BasicStructure: ...@@ -1546,9 +1561,10 @@ class BasicStructure:
message = 'can not find secondary axis bounds for planning view :\ message = 'can not find secondary axis bounds for planning view :\
No object has good start & stop properties, please check your objects \ No object has good start & stop properties, please check your objects \
and their corresponding properties' and their corresponding properties'
#axis_dict['bound_begin'] = 0
#axis_dict['bound_end'] = 1
return 1 #[(Message(domain=None, message=message,mapping=None))] return 1 #[(Message(domain=None, message=message,mapping=None))]
axis_dict['bound_range'] = axis_dict['bound_end'] - axis_dict['bound_begin'] axis_dict['bound_range'] = axis_dict['bound_end'] - axis_dict['bound_begin']
# now start and stop have the extreme values of the second axis bound. # now start and stop have the extreme values of the second axis bound.
# this represents in fact the size of the Planning's secondary axis # this represents in fact the size of the Planning's secondary axis
...@@ -1943,67 +1959,70 @@ class BasicGroup: ...@@ -1943,67 +1959,70 @@ class BasicGroup:
else: else:
block_end = None block_end = None
# testing if activity is visible according to the current zoom selection if secondary_axis_info.has_key('bound_start') and \
# over the secondary_axis secondary_axis_info.has_key('bound_stop'):
if block_begin == None: # testing if activity is visible according to the current zoom selection
block_begin = secondary_axis_info['bound_start'] # over the secondary_axis
current_color='#E4CCE1' if (block_begin == None):
if block_end == None: block_begin = secondary_axis_info['bound_start']
block_end = secondary_axis_info['bound_stop'] current_color='#E4CCE1'
current_color='#E4CCE1' if block_end == None:
if (block_begin > secondary_axis_info['bound_stop'] or \ block_end = secondary_axis_info['bound_stop']
block_end < secondary_axis_info['bound_start']): current_color='#E4CCE1'
# activity will not be displayed, stopping process
pass if (block_begin > secondary_axis_info['bound_stop'] or \
else: block_end < secondary_axis_info['bound_start']):
# activity is somehow displayed. checking if need to cut its bounds # activity will not be displayed, stopping process
if block_begin < secondary_axis_info['bound_start']: pass
# need to cut begin bound
block_start = secondary_axis_info['bound_start']
else: block_start = block_begin
if block_end > secondary_axis_info['bound_stop']:
block_stop = secondary_axis_info['bound_stop']
else: else:
block_stop = block_end # activity is somehow displayed. checking if need to cut its bounds
if block_begin < secondary_axis_info['bound_start']:
# testing if some activities have errors # need to cut begin bound
error = 'false' block_start = secondary_axis_info['bound_start']
if list_error not in (None,[]): else: block_start = block_begin
for activity_error in list_error:
if activity_error[0][0] == name: if block_end > secondary_axis_info['bound_stop']:
error = 'true' block_stop = secondary_axis_info['bound_stop']
break else:
block_stop = block_end
# XXX testing constraint result here.
# if current object url in list of error constranint urls, then # testing if some activities have errors
# colorizing the block. error = 'false'
if list_error not in (None,[]):
# defining name for activity_error in list_error:
name = "Activity_%s" % (self.object.getObject().getTitle()) if activity_error[0][0] == name:
error = 'true'
# height should be implemented here break
height = None
# XXX testing constraint result here.
# get object url, not group url # if current object url in list of error constranint urls, then
url = self.object.getObject().getUrl() # colorizing the block.
# creating new activity instance # defining name
activity=BasicActivity(title=info['info_center'], name=name, name = "Activity_%s" % (self.object.getObject().getTitle())
object=self.object.object, url=url,
absolute_begin=block_begin, # height should be implemented here
absolute_end=block_end, height = None
absolute_start=block_start,
absolute_stop=block_stop, height=height, # get object url, not group url
color=current_color, info_dict=info, url = self.object.getObject().getUrl()
error=error, property_dict=self.property_dict)
# creating new activity instance
# adding new activity to personal group activity list activity=BasicActivity(title=info['info_center'], name=name,
try: object=self.object.object, url=url,
self.basic_activity_list.append(activity) absolute_begin=block_begin,
except (AttributeError): absolute_end=block_end,
self.basic_activity_list = [] absolute_start=block_start,
self.basic_activity_list.append(activity) absolute_stop=block_stop, height=height,
color=current_color, info_dict=info,
error=error, property_dict=self.property_dict)
# adding new activity to personal group activity list
try:
self.basic_activity_list.append(activity)
except (AttributeError):
self.basic_activity_list = []
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
......
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