Commit 7c765538 authored by Romain Courteaud's avatar Romain Courteaud

Corrected nextPage bug in RelationField selection.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2396 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent efdf4593
...@@ -504,6 +504,8 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -504,6 +504,8 @@ class SelectionTool( UniqueObject, SimpleItem ):
request = REQUEST request = REQUEST
#form_id = request.form_id #form_id = request.form_id
selection_name = request.list_selection_name selection_name = request.list_selection_name
selection = self.getSelectionFor(selection_name, REQUEST=REQUEST) selection = self.getSelectionFor(selection_name, REQUEST=REQUEST)
if selection is not None: if selection is not None:
params = selection.getParams() params = selection.getParams()
...@@ -878,9 +880,12 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -878,9 +880,12 @@ class SelectionTool( UniqueObject, SimpleItem ):
field_value = REQUEST.form['field_%s' % field.id] field_value = REQUEST.form['field_%s' % field.id]
selection_name = 'Base_viewRelatedObjectList' selection_name = 'Base_viewRelatedObjectList'
# reselt current selection # reselt current selection
self.portal_selections.setSelectionFor( selection_name, None) self.portal_selections.setSelectionFor( selection_name, None)
# XXX portal_status_message = "Please select one object to precise the value: '%s' in the field: '%s'" % ( field_value, field.get_orig_value('title') )
portal_status_message = "Please select one object."
if field.meta_type == "MultiRelationStringField": if field.meta_type == "MultiRelationStringField":
if method_count2 == None: if method_count2 == None:
...@@ -895,17 +900,23 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -895,17 +900,23 @@ class SelectionTool( UniqueObject, SimpleItem ):
current_uid_list = getattr( o, property_get_related_uid_method_name )( portal_type=map(lambda x:x[0],field.get_value('portal_type'))) current_uid_list = getattr( o, property_get_related_uid_method_name )( portal_type=map(lambda x:x[0],field.get_value('portal_type')))
#selected_uids = self.portal_selections.updateSelectionCheckedUidList(selection_name,[],current_uid) #selected_uids = self.portal_selections.updateSelectionCheckedUidList(selection_name,[],current_uid)
self.portal_selections.setSelectionCheckedUidsFor(selection_name , current_uid_list, REQUEST=REQUEST ) # XXX do not work.... and I do not know why... (Romain)
self.portal_selections.setSelectionCheckedUidsFor(selection_name , current_uid_list )
#self.portal_selections.setSelectionCheckedUidsFor(selection_name , current_uid_list, REQUEST=REQUEST )
# change current value to '%' # change current value to '%'
field_value = '%' field_value = '%'
REQUEST.form['field_%s' % field.id] = field_value REQUEST.form['field_%s' % field.id] = field_value
# XXX portal_status_message = "Please select one or more object to define the field: '%s'" % field.get_orig_value('title')
portal_status_message = "Please select one (or more) object."
elif field.meta_type == "RelationStringField": elif field.meta_type == "RelationStringField":
# If user click on the wheel without validate the form (ie: want to search the relation without writing '%' ) # If user click on the wheel without validate the form (ie: want to search the relation without writing '%' )
if field_value in ( '', None ): if field_value in ( '', None ):
field_value = '%' field_value = '%'
REQUEST.form['field_%s' % field.id] = field_value REQUEST.form['field_%s' % field.id] = field_value
# XXX portal_status_message = "Please select only one object to define the field: '%s'" % field.get_orig_value('title')
# Save the current REQUEST form # Save the current REQUEST form
...@@ -927,7 +938,7 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -927,7 +938,7 @@ class SelectionTool( UniqueObject, SimpleItem ):
kw['reset'] = 1 kw['reset'] = 1
kw['base_category'] = field.get_value( 'base_category') kw['base_category'] = field.get_value( 'base_category')
kw['cancel_url'] = REQUEST.get('HTTP_REFERER') kw['cancel_url'] = REQUEST.get('HTTP_REFERER')
kw['previous_form_id'] = form_id kw['previous_form_id'] = form_id
kw[field.get_value('catalog_index')] = field_value kw[field.get_value('catalog_index')] = field_value
...@@ -941,15 +952,27 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -941,15 +952,27 @@ class SelectionTool( UniqueObject, SimpleItem ):
relation_uid_list = map(lambda x: x.uid, relation_list) relation_uid_list = map(lambda x: x.uid, relation_list)
uids = [] uids = []
""" """
# Empty the selection (uid) # Need to redirect, if we want listbox nextPage to work
REQUEST.form = kw # New request form kw['form_pickle'] = form_pickle
kw['form_signature'] = form_signature
# Define new HTTP_REFERER kw['portal_status_message'] = portal_status_message
REQUEST.HTTP_REFERER = '%s/Base_viewRelatedObjectList' % o.absolute_url()
redirect_url = '%s/%s?%s' % ( o.absolute_url()
# Return the search dialog , 'Base_viewRelatedObjectList'
return o.Base_viewRelatedObjectList(REQUEST=REQUEST) , make_query(kw)
)
REQUEST[ 'RESPONSE' ].redirect( redirect_url )
# # Empty the selection (uid)
# REQUEST.form = kw # New request form
#
# # Define new HTTP_REFERER
# REQUEST.HTTP_REFERER = '%s/Base_viewRelatedObjectList' % o.absolute_url()
#
# # Return the search dialog
# return o.Base_viewRelatedObjectList(REQUEST=REQUEST)
# XXX do not use this method, use aq_dynamic (JPS) # XXX do not use this method, use aq_dynamic (JPS)
......
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