Commit e8b27794 authored by Sebastien Robin's avatar Sebastien Robin

updated so that we display the list of items when we want to jump with a multirelation field


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1128 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7095f0f4
<?xml version="1.0"?>
<form>
<title>Jump Relation</title>
<row_length>4</row_length>
<name>Jump Relation</name>
<pt>form_list</pt>
<action></action>
<update_action></update_action>
<method>POST</method>
<enctype></enctype>
<encoding>UTF-8</encoding>
<stored_encoding>ISO-8859-1</stored_encoding>
<unicode_mode>false</unicode_mode>
<groups>
<group>
<title>Default</title>
<fields>
<field><id>listbox</id> <type>ListBox</type>
<values>
<all_columns type="list">[('id', 'id'), ('portal_type', 'Portal Type'), ('Title', 'Title'), ('Description', 'Description')]</all_columns>
<alternate_name></alternate_name>
<columns type="list">[('id', 'id'), ('portal_type', 'Portal Type'), ('Title', 'Title'), ('Description', 'Description')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[('id', "''"), ('portal_type', "''"), ('Title', "''"), ('Description', "''")]</default_params>
<description></description>
<external_validator></external_validator>
<extra></extra>
<height type="int">5</height>
<hidden type="int">0</hidden>
<lines type="int">30</lines>
<list_cookie>SEARCH_LIST</list_cookie>
<list_method type="method">portal_catalog</list_method>
<meta_types type="list">[]</meta_types>
<portal_types type="list">[]</portal_types>
<reverse type="int">0</reverse>
<search type="int">0</search>
<select type="int">0</select>
<selection_name>Base_jumpRelationList</selection_name>
<sort type="list">[]</sort>
<title>Relation Results</title>
<width type="int">40</width>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
</fields>
</group>
</groups>
</form>
...@@ -4,17 +4,29 @@ ...@@ -4,17 +4,29 @@
# which is in a class inheriting from ERP5 Base # which is in a class inheriting from ERP5 Base
from Products.Formulator.Errors import ValidationError, FormValidationError from ZTUtils import make_query
request=context.REQUEST request=context.REQUEST
#return request #return request
#selection = context.portal_selections.getSelectionFor('modele_view')
#context.portal_selections.setSelectionFor('jump_relation',selection)
#return "ok"
form = getattr(context,form_id) form = getattr(context,form_id)
field = form.get_field(field_id) field = form.get_field(field_id)
base_category = field.get_value('base_category') base_category = field.get_value('base_category')
portal_type = map(lambda x:x[0],field.get_value('portal_type')) portal_type = map(lambda x:x[0],field.get_value('portal_type'))
jump_reference = context.getDefaultValue(base_category, portal_type=portal_type) jump_reference_list = context.getValueList(base_category, portal_type=portal_type)
if len(jump_reference_list)==1:
return request[ 'RESPONSE' ].redirect( '%s/view' % jump_reference.absolute_url() ) jump_reference = jump_reference_list[0]
return request[ 'RESPONSE' ].redirect( '%s/view' % jump_reference.absolute_url() )
else:
selection_uid_list = map(lambda x:x.getUid(),jump_reference_list)
kw = {'uid': selection_uid_list}
context.portal_selections.setSelectionParamsFor('Base_jumpRelationList',kw)
request.set('object_uid', context.getUid())
request.set('uids', selection_uid_list)
return context.Base_jumpRelationList(uids=selection_uid_list, REQUEST=request)
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