Commit de961b46 authored by Ivan Tyagov's avatar Ivan Tyagov

Listbox search columns are passed in format: <listbox_field_id>_<search_column>

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43664 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7e8fa902
......@@ -108,7 +108,7 @@
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>test_core</td>\n
</tr>\n
<tr>\n
......@@ -143,8 +143,7 @@
</tr>\n
</tal:block>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -478,7 +478,7 @@
and search parameters are remembered -->\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%Title%</td>\n
</tr>\n
<tr>\n
......@@ -544,14 +544,13 @@ and search parameters are remembered -->\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%Title%</td>\n
</tr>\n
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -86,12 +86,12 @@
\n
<tr>\n
<td>verifyElementPresent</td>\n
<td>//table/thead/tr[2]/th[2]/input[@type = \'text\'][@name = \'id\']</td>\n
<td>//table/thead/tr[2]/th[2]/input[@type = \'text\'][@name = \'listbox_id\']</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyElementPresent</td>\n
<td>//table/thead/tr[2]/th[3]/input[@type = \'text\'][@name = \'bar_category_title\']</td>\n
<td>//table/thead/tr[2]/th[3]/input[@type = \'text\'][@name = \'listbox_bar_category_title\']</td>\n
<td></td>\n
</tr>\n
\n
......
......@@ -205,8 +205,7 @@
</tbody>\n
</table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -85,7 +85,7 @@
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%3</td>\n
</tr>\n
<tr>\n
......@@ -187,8 +187,7 @@ script. -->\n
\n
\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -77,12 +77,12 @@
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>id</td>\n
<td>listbox_id</td>\n
<td tal:content="value_a"></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td tal:content="value_b"></td>\n
</tr>\n
<tr>\n
......@@ -107,12 +107,12 @@
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>id</td>\n
<td>listbox_id</td>\n
<td tal:content="other_value_a"></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td tal:content="other_value_b"></td>\n
</tr>\n
</body>\n
......
......@@ -113,7 +113,7 @@
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>Title</td>\n
</tr>\n
<tr>\n
......@@ -156,7 +156,7 @@ commands from selenium 0.8\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>Title</td>\n
</tr>\n
<!-- only \'Foo\' portal type have a simulation state, so we only have 1 document\n
......@@ -191,8 +191,7 @@ commands from selenium 0.8\n
</tr>\n
\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -122,12 +122,12 @@
\n
<tr>\n
<td>verifyElementPresent</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>Title 0</td>\n
</tr>\n
<tr>\n
......@@ -142,7 +142,7 @@
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td></td>\n
</tr>\n
<tr>\n
......@@ -152,7 +152,7 @@
</tr>\n
<tr>\n
<td>type</td>\n
<td>start_date</td>\n
<td>listbox_start_date</td>\n
<td>2009/01/01</td>\n
</tr>\n
<tr>\n
......@@ -169,8 +169,7 @@
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -101,7 +101,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>"%1%" OR "%2%"</td>\n
</tr>\n
<tr>\n
......@@ -118,7 +118,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>"%1%" OR "%2%"</td>\n
</tr>\n
\n
......@@ -136,7 +136,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>"%1%" OR "%2%"</td>\n
</tr>\n
\n
......@@ -180,7 +180,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>"%1%" OR "%2%"</td>\n
</tr>\n
\n
......@@ -212,7 +212,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>"%1%" OR "%2%"</td>\n
</tr>\n
\n
......@@ -234,8 +234,7 @@
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -135,7 +135,7 @@
\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
<tr>\n
......@@ -205,7 +205,7 @@
\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
<tr>\n
......@@ -250,8 +250,7 @@
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html>\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test Relation Field On Another Object, edit another document</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test Relation Field On Another Object</td></tr>\n
</thead><tbody>\n
<tal:block\n
metal:use-macro="here/RelationFieldZuite_CommonTemplate/macros/init"\n
/>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/FooModule_createObjects?num:int=1</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/ListBoxZuite_reset</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Reset Successfully.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/Zuite_waitForActivities</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/FooModule_createObjects?num:int=1</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Created Successfully.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/Zuite_waitForActivities</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Done.</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/0/Foo_viewRelationField</td>\n
<td></td>\n
</tr>\n
<!-- create sub document -->\n
<tr>\n
<td>selectAndWait</td>\n
<td>select_action</td>\n
<td>Add Foo Line</td>\n
</tr>\n
\n
<tr>\n
<td>open</td>\n
<td>${base_url}/foo_module/0/Foo_viewRelationField</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<td>field_my_foo_line_foo_category_title</td>\n
<td>b</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[preceding-sibling::input[@name="field_my_foo_line_foo_category_title"]][@value=\'update...\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//*[@class=\'listbox-data-line-0 DataA\']//input[@type="checkbox"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>dialog_submit_button</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//input[@name="field_my_foo_line_foo_category_title"][@value!=""]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>verifyPortalStatusMessage</td>\n
<td>Data updated.</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>field_my_foo_line_foo_category_title</td>\n
<td>b</td>\n
</tr>\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testRelationFieldOnAnotherObject</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -96,12 +96,12 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%a%</td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>a1</td>\n
</tr>\n
<tr>\n
......@@ -118,7 +118,7 @@
</tr>\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>a1</td>\n
</tr>\n
\n
......@@ -140,8 +140,7 @@
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -96,7 +96,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
<tr>\n
......@@ -113,7 +113,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
\n
......@@ -131,7 +131,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
\n
......@@ -165,7 +165,7 @@
</tr>\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
\n
......@@ -198,7 +198,7 @@
</tr>\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
<tr>\n
......@@ -216,7 +216,7 @@
\n
<tr>\n
<td>assertValue</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>%c%</td>\n
</tr>\n
\n
......@@ -238,8 +238,7 @@
\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
......@@ -125,7 +125,7 @@ metal:use-macro="here/RelationFieldZuite_CommonTemplate/macros/init"\n
</tr>\n
<tr>\n
<td>type</td>\n
<td>title</td>\n
<td>listbox_title</td>\n
<td>a</td>\n
</tr>\n
<tr>\n
......@@ -186,8 +186,7 @@ metal:use-macro="here/RelationFieldZuite_CommonTemplate/macros/init"\n
</tr>\n
</tbody></table>\n
</body>\n
</html>\n
</html>
]]></unicode> </value>
</item>
......
669
\ No newline at end of file
668
\ No newline at end of file
......@@ -2613,6 +2613,9 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
def render(self, **kw):
"""Render the data in HTML.
"""
request = self.request
field_id = self.getId()
# Make it sure to store the current selection, only if a list method is defined.
list_method = self.getListMethod()
selection = self.getSelection()
......@@ -2623,11 +2626,25 @@ class ListBoxHTMLRenderer(ListBoxRenderer):
if selection_index is not None:
list_url += '&selection_index=%s' % selection_index
selection.edit(method_path = method_path, list_url = list_url)
self.getSelectionTool().setSelectionFor(self.getSelectionName(), selection, REQUEST = self.request)
# listbox search columnd are passed in format: <listbox_field_id>_<search_column>
# this is done to allow multiple listboxes in one page with same search column names
update_selection = False
form_dict = request.form
listbox_kw = selection.getParams()
listbox_arguments_list = [x for x in form_dict.keys() if x.startswith(field_id)]
for original_listbox_argument in listbox_arguments_list:
listbox_argument = original_listbox_argument.replace('%s_' %field_id, '', 1)
listbox_argument_value = form_dict.get(original_listbox_argument, None)
if listbox_argument in list(self.getSearchColumnIdSet()) and \
listbox_argument_value not in (None,):
update_selection = True
listbox_kw[listbox_argument] = listbox_argument_value
if update_selection:
selection.edit(listbox_kw)
self.getSelectionTool().setSelectionFor(self.getSelectionName(), selection, REQUEST = request)
# do pass current form and respective field through request
request = self.request
field_id = self.getId()
form = self.getForm()
request.set('%s_form_id' %field_id, form.getId())
request.set('%s_field_id' %field_id, field_id)
......
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