Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
139
Merge Requests
139
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
f860a113
Commit
f860a113
authored
Mar 12, 2015
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search dialog : implement exclusion of selected category in dialog
parent
0275ae43
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
271 additions
and
23 deletions
+271
-23
bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testSearchDialog.xml
...em/portal_tests/page_templates_zuite/testSearchDialog.xml
+172
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/BarModule_viewBarList.xml
...eItem/portal_skins/erp5_ui_test/BarModule_viewBarList.xml
+1
-1
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/BarModule_viewBarList/listbox.xml
...rtal_skins/erp5_ui_test/BarModule_viewBarList/listbox.xml
+52
-14
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml
...SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml
+24
-4
product/ERP5Form/Extensions/Folder_viewSearchDialog.py
product/ERP5Form/Extensions/Folder_viewSearchDialog.py
+22
-4
No files found.
bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testSearchDialog.xml
View file @
f860a113
...
@@ -195,6 +195,178 @@ commands from selenium 0.8\n
...
@@ -195,6 +195,178 @@ commands from selenium 0.8\n
<td>
0 records
</td>
\n
<td>
0 records
</td>
\n
</tr>
\n
</tr>
\n
\n
\n
<!-- test selection and exclusion of category -->
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
name=Folder_show:method
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
addSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=a
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
0 records
</td>
\n
</tr>
\n
\n
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
click
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url_is_excluded_
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
2 records
</td>
\n
</tr>
\n
\n
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
removeSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=a
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
addSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=b
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
1 records
</td>
\n
</tr>
\n
\n
\n
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
click
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url_is_excluded_
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
1 records
</td>
\n
</tr>
\n
\n
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
addSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=a
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
removeSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=b
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
addSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=b
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
click
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url_is_excluded_
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
1 records
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
name=Folder_show:method
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
clickAndWait
</td>
\n
<td>
//a[@title=\'Find\']
</td>
\n
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
addSelection
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url
</td>
\n
\t
<td>
label=a
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
type
</td>
\n
\t
<td>
name=field_your_title
</td>
\n
\t
<td>
Title 1
</td>
\n
</tr>
\n
<tr>
\n
\t
<td>
click
</td>
\n
\t
<td>
name=field_your_foo_category_relative_url_is_excluded_
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
\t
<td>
clickAndWait
</td>
\n
\t
<td>
id=dialog_submit_button
</td>
\n
\t
<td></td>
\n
</tr>
\n
<tr>
\n
<td>
verifyText
</td>
\n
<td>
//span[@class="listbox-current-page-total-number"]
</td>
\n
<td>
1 records
</td>
\n
</tr>
\n
\n
\n
</body>
\n
</body>
\n
</html>
</html>
...
...
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/BarModule_viewBarList.xml
View file @
f860a113
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"ERP5
Form"
module=
"Products.ERP5Form.Form
"
/>
<global
name=
"ERP5
Form"
module=
"erp5.portal_type
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
...
...
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/BarModule_viewBarList/listbox.xml
View file @
f860a113
...
@@ -327,6 +327,10 @@
...
@@ -327,6 +327,10 @@
<key>
<string>
alternate_name
</string>
</key>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
anchor
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<item>
<key>
<string>
columns
</string>
</key>
<key>
<string>
columns
</string>
</key>
<value>
<value>
...
@@ -343,6 +347,10 @@
...
@@ -343,6 +347,10 @@
<string>
quantity
</string>
<string>
quantity
</string>
<string>
Quantity
</string>
<string>
Quantity
</string>
</tuple>
</tuple>
<tuple>
<string>
foo_category_title
</string>
<string>
Foo
</string>
</tuple>
</list>
</list>
</value>
</value>
</item>
</item>
...
@@ -360,6 +368,10 @@
...
@@ -360,6 +368,10 @@
<key>
<string>
default
</string>
</key>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
default_display_style
</string>
</key>
<value>
<string>
table
</string>
</value>
</item>
<item>
<item>
<key>
<string>
default_params
</string>
</key>
<key>
<string>
default_params
</string>
</key>
<value>
<value>
...
@@ -370,6 +382,12 @@
...
@@ -370,6 +382,12 @@
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
display_style_list
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<item>
<key>
<string>
domain_root_list
</string>
</key>
<key>
<string>
domain_root_list
</string>
</key>
<value>
<value>
...
@@ -404,10 +422,18 @@
...
@@ -404,10 +422,18 @@
<list/>
<list/>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
global_search_column
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<item>
<key>
<string>
hidden
</string>
</key>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
0
</int>
</value>
</item>
</item>
<item>
<key>
<string>
hide_rows_on_no_search_criterion
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<item>
<key>
<string>
lines
</string>
</key>
<key>
<string>
lines
</string>
</key>
<value>
<int>
3
</int>
</value>
<value>
<int>
3
</int>
</value>
...
@@ -428,6 +454,14 @@
...
@@ -428,6 +454,14 @@
<list/>
<list/>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
page_navigation_template
</string>
</key>
<value>
<string>
ListBox_viewSliderPageNavigationRenderer
</string>
</value>
</item>
<item>
<key>
<string>
page_template
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<item>
<key>
<string>
portal_types
</string>
</key>
<key>
<string>
portal_types
</string>
</key>
<value>
<value>
...
@@ -453,6 +487,10 @@
...
@@ -453,6 +487,10 @@
<key>
<string>
report_tree
</string>
</key>
<key>
<string>
report_tree
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
0
</int>
</value>
</item>
</item>
<item>
<key>
<string>
row_css_method
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<item>
<key>
<string>
search
</string>
</key>
<key>
<string>
search
</string>
</key>
<value>
<int>
1
</int>
</value>
<value>
<int>
1
</int>
</value>
...
@@ -498,10 +536,22 @@
...
@@ -498,10 +536,22 @@
<key>
<string>
stat_method
</string>
</key>
<key>
<string>
stat_method
</string>
</key>
<value>
<string></string>
</value>
<value>
<string></string>
</value>
</item>
</item>
<item>
<key>
<string>
style_columns
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
<value>
<string>
Foos and Bars
</string>
</value>
<value>
<string>
Foos and Bars
</string>
</value>
</item>
</item>
<item>
<key>
<string>
untranslatable_columns
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<item>
<key>
<string>
url_columns
</string>
</key>
<key>
<string>
url_columns
</string>
</key>
<value>
<value>
...
@@ -516,13 +566,7 @@
...
@@ -516,13 +566,7 @@
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<pickle>
<tuple>
<global
name=
"Method"
module=
"Products.Formulator.MethodField"
/>
<tuple>
<string>
Products.Formulator.MethodField
</string>
<string>
Method
</string>
</tuple>
<none/>
</tuple>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
...
@@ -535,13 +579,7 @@
...
@@ -535,13 +579,7 @@
</record>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<tuple>
<global
name=
"Method"
module=
"Products.Formulator.MethodField"
/>
<tuple>
<string>
Products.Formulator.MethodField
</string>
<string>
Method
</string>
</tuple>
<none/>
</tuple>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_search.xml
View file @
f860a113
...
@@ -54,6 +54,8 @@
...
@@ -54,6 +54,8 @@
request = container.REQUEST\n
request = container.REQUEST\n
\n
\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery, ComplexQuery\n
\n
def sorted(seq):\n
def sorted(seq):\n
seq = [x for x in seq]\n
seq = [x for x in seq]\n
seq.sort()\n
seq.sort()\n
...
@@ -73,10 +75,11 @@ usage_map = dict(min=\'>=\',\n
...
@@ -73,10 +75,11 @@ usage_map = dict(min=\'>=\',\n
nlt=\'>\',)\n
nlt=\'>\',)\n
\n
\n
new_mapping = dict(ignore_hide_rows=1)\n
new_mapping = dict(ignore_hide_rows=1)\n
query_list = []\n
left_join_list = []\n
for key in sorted(request.form.keys()):\n
for key in sorted(request.form.keys()):\n
# we use sorted to make sure x_search_key appears before x\n
# we use sorted to make sure x_search_key appears before x\n
value = request.form[key]\n
value = request.form[key]\n
\n
# to remove unnecessary None value\n
# to remove unnecessary None value\n
if value is None:\n
if value is None:\n
request.form.pop(key)\n
request.form.pop(key)\n
...
@@ -105,11 +108,28 @@ for key in sorted(request.form.keys()):\n
...
@@ -105,11 +108,28 @@ for key in sorted(request.form.keys()):\n
# we\'ll simply keep the query.\n
# we\'ll simply keep the query.\n
new_mapping[real_key] = \'%s %s\' % (usage_map[value], new_mapping[real_key])\n
new_mapping[real_key] = \'%s %s\' % (usage_map[value], new_mapping[real_key])\n
\n
\n
else:\n
if request.form.get(\'%s_is_excluded_\' % key):\n
# Build a negated query\n
nq_kw = {\'strict_%s\' % key : value}\n
q_kw = {key : None}\n
left_join_list.append(key) \n
left_join_list.append(\'strict_%s\' % key)\n
query_list.append(ComplexQuery(NegatedQuery(Query(**nq_kw)), Query(**q_kw), operator="OR"))\n
new_mapping[key] = ""\n
new_mapping["dialog_%s" %(key,)] = value\n
new_mapping["dialog_excluded_%s" %(key,)] = True\n
else:\n
else:\n
if request.form.get(\'%s_is_strict_\' % key):\n
if request.form.get(\'%s_is_strict_\' % key):\n
new_mapping[\'strict_%s\' % key] = value\n
new_mapping[\'strict_%s\' % key] = value\n
new_mapping[\'dialog_strict_%s\' % key] = value\n
else:\n
else:\n
new_mapping[key] = value\n
new_mapping[key] = value\n
new_mapping[\'dialog_%s\' % key] = value\n
\n
\n
new_mapping["query"] = ComplexQuery(query_list)\n
new_mapping[\'left_join_list\'] = left_join_list\n
\n
\n
# set selection parameters\n
# set selection parameters\n
container.portal_selections.setSelectionParamsFor(selection_name, new_mapping)\n
container.portal_selections.setSelectionParamsFor(selection_name, new_mapping)\n
...
...
product/ERP5Form/Extensions/Folder_viewSearchDialog.py
View file @
f860a113
############################################################################
#
############################################################################
#
#
# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved.
# Jerome Perrin <jerome@nexedi.com>
# Jerome Perrin <jerome@nexedi.com>
...
@@ -70,8 +70,8 @@ def getSearchDialog(self, REQUEST=None):
...
@@ -70,8 +70,8 @@ def getSearchDialog(self, REQUEST=None):
field
.
_surcharged_tales
(
field
.
_surcharged_tales
(
dict
(
dict
(
default
=
TALESMethod
(
default
=
TALESMethod
(
'here/portal_selections/%s/%s_relative_url | '
'here/portal_selections/%s/
dialog_
%s_relative_url | '
'here/portal_selections/%s/strict_%s_relative_url | nothing'
'here/portal_selections/%s/
dialog_
strict_%s_relative_url | nothing'
%
(
selection_name
,
request_key
,
%
(
selection_name
,
request_key
,
selection_name
,
request_key
)),
selection_name
,
request_key
)),
items
=
TALESMethod
(
'python: getattr(here.portal_categories["%s"],'
items
=
TALESMethod
(
'python: getattr(here.portal_categories["%s"],'
...
@@ -94,10 +94,28 @@ def getSearchDialog(self, REQUEST=None):
...
@@ -94,10 +94,28 @@ def getSearchDialog(self, REQUEST=None):
field
.
_surcharged_tales
(
field
.
_surcharged_tales
(
dict
(
dict
(
default
=
TALESMethod
(
default
=
TALESMethod
(
'here/portal_selections/%s/strict_%s_relative_url | nothing'
'here/portal_selections/%s/
dialog_
strict_%s_relative_url | nothing'
%
(
selection_name
,
request_key
,))),
%
(
selection_name
,
request_key
,))),
[
'title'
,
'default'
])
[
'title'
,
'default'
])
field_id
=
'your_%s_relative_url_is_excluded_'
%
request_key
if
field_id
not
in
temp_form
.
objectIds
():
temp_form
.
manage_addField
(
field_id
,
field_title
,
'ProxyField'
)
field
=
temp_form
.
_getOb
(
field_id
)
field
.
manage_edit_xmlrpc
(
dict
(
form_id
=
'Base_viewFieldLibrary'
,
field_id
=
'your_checkbox'
))
field
.
_surcharged_edit
(
dict
(
title
=
'%s Excluded'
%
field_title
),
[
'title'
])
from
zLOG
import
LOG
LOG
(
"selection_name %r, request_key %r"
%
(
selection_name
,
request_key
),
300
,
field_id
)
field
.
_surcharged_tales
(
dict
(
default
=
TALESMethod
(
'here/portal_selections/%s/dialog_excluded_%s_relative_url | nothing'
%
(
selection_name
,
request_key
,))),
[
'title'
,
'default'
])
def
addFloatField
(
field_id
,
field_title
):
def
addFloatField
(
field_id
,
field_title
):
request_key
=
field_id
request_key
=
field_id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment