Commit 11fb9734 authored by Rafael Monnerat's avatar Rafael Monnerat

Improved blocs url, start to check if the activity_content has some special method for URL.

This approach is also used by ListBox, but in Planning Box the parameters are not important 
for now. In future, it can be defined special sublinks or configuration scripts using this 
implementation.




git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15093 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d8b00390
...@@ -378,7 +378,7 @@ class PlanningBoxValidator(Validator.StringBaseValidator): ...@@ -378,7 +378,7 @@ class PlanningBoxValidator(Validator.StringBaseValidator):
REQUEST.set('error_info_dict',error_info_dict) REQUEST.set('error_info_dict',error_info_dict)
# now raise error => automatically called # now raise error => automatically called
# parameters are : # parameters are :
# -list of errors # - list of errors
# - dict with error results # - dict with error results
raise FormValidationError(errors_list, {}) raise FormValidationError(errors_list, {})
...@@ -1112,7 +1112,6 @@ class BasicStructure: ...@@ -1112,7 +1112,6 @@ class BasicStructure:
self.selection_name, self.selection_name,
self.selection, self.selection,
REQUEST=self.REQUEST) REQUEST=self.REQUEST)
# building list of portal_types # building list of portal_types
self.filtered_portal_types = [x[0] for x in self.portal_types] self.filtered_portal_types = [x[0] for x in self.portal_types]
if len(self.filtered_portal_types) == 0: if len(self.filtered_portal_types) == 0:
...@@ -1304,7 +1303,7 @@ class BasicStructure: ...@@ -1304,7 +1303,7 @@ class BasicStructure:
# self.selection_name, context=self.here, REQUEST=self.REQUEST) # self.selection_name, context=self.here, REQUEST=self.REQUEST)
message = 'No list method found, please check planningBox properties' message = 'No list method found, please check planningBox properties'
return [(Message(domain='erp5_ui', message=message,mapping=None))] return [(Message(domain='erp5_ui', message=message,mapping=None))]
# recovering exeption_uid_list # recovering exeption_uid_list
exception_uid_list = object_tree_line.getExceptionUidList() exception_uid_list = object_tree_line.getExceptionUidList()
# XXX filter the object to the right domain. # XXX filter the object to the right domain.
...@@ -1315,13 +1314,12 @@ class BasicStructure: ...@@ -1315,13 +1314,12 @@ class BasicStructure:
category_obj = domain_obj.getMembershipCriterionCategory() category_obj = domain_obj.getMembershipCriterionCategory()
membership_base_category = domain_obj.getMembershipCriterionBaseCategory() membership_base_category = domain_obj.getMembershipCriterionBaseCategory()
if (category_obj is not None) and (membership_base_category is not None): if (category_obj is not None) and (membership_base_category is not None):
category_value = (membership_base_category + '/' +category_obj.getRelativeUrl()) category_value = (membership_base_category + '/' + category_obj.getRelativeUrl())
for selected_object in object_list: for selected_object in object_list:
if category_value in selected_object.getCategoriesList(): if category_value in selected_object.getCategoriesList():
new_object_list.append(selected_object) new_object_list.append(selected_object)
object_list = new_object_list object_list = new_object_list
if exception_uid_list not in ([],None) : 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
...@@ -1929,7 +1927,17 @@ class BasicGroup: ...@@ -1929,7 +1927,17 @@ class BasicGroup:
stat_context.absolute_url = \ stat_context.absolute_url = \
lambda x: activity_content.getObject().absolute_url() lambda x: activity_content.getObject().absolute_url()
object = stat_context.getObject() object = stat_context.getObject()
url = object.getUrl()
# check if the activity_content has some special method for URL
# This approach is also used by ListBox, but in Planning Box
# the parameters are not important for now. In future, can be define
# special sublinks using this implementation.
if getattr(activity_content, 'getListItemUrl', None):
url = activity_content.getListItemUrl(cname_id='',
selection_index='',
selection_name=self.field.get_value('selection_name'))
else:
url = object.getUrl()
# XXX should define height of block here # XXX should define height of block here
height = None height = None
......
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