Discussion:
[Erp5-dev] [PATCH] ListBox filtered notification todo support domain selection write tests
Boris Kocherov
2011-12-19 18:19:02 UTC
Permalink
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14 +++++++-
.../erp5_xhtml_style/erp5_listbox.css.xml | 6 +++
product/ERP5Form/ListBox.py | 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +-
5 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTML.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTML.xml
index db5ddb1..21cccc1 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTML.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTML.xml
@@ -57,6 +57,7 @@
show_select_column here/showSelectColumn;\n
show_anchor_column here/showAnchorColumn;\n
show_search_line here/showSearchLine;\n
+ global is_filtered python: show_search_line and not here.isNotFiltered();\n
is_web_mode real_context/isWebMode | nothing;\n
is_dialog_mode request/dialog_mode | nothing;\n
display_style_list here/getDisplayStyleList;\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTMLLibrary.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTMLLibrary.xml
index 8a4cbe6..5abe15d 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTMLLibrary.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asHTMLLibrary.xml
@@ -177,8 +177,10 @@
tal:attributes="class class"\n
tal:content="here/getTitle" />\n
</tal:block>\n
- <tal:block tal:condition="not: is_web_mode">:</tal:block>\n
-\n
+ <tal:block tal:condition="not: is_web_mode">:<span id="filter-note"\n
+ i18n:translate=""\n
+ i18n:domain="ui"\n
+ tal:condition="is_filtered">! filtered !</span></tal:block>\n
</div>\n
\n
<!-- Listbox navigation -->\n
@@ -353,6 +355,10 @@
<value> <string>text/html</string> </value>
</item>
<item>
+ <key> <string>expand</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
<key> <string>id</string> </key>
<value> <string>ListBox_asHTMLLibrary</string> </value>
</item>
@@ -360,6 +366,10 @@
<key> <string>output_encoding</string> </key>
<value> <string>iso-8859-15</string> </value>
</item>
+ <item>
+ <key> <string>title</string> </key>
+ <value> <unicode></unicode> </value>
+ </item>
</dictionary>
</pickle>
</record>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5_listbox.css.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5_listbox.css.xml
index 7e6238a..416839e 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5_listbox.css.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5_listbox.css.xml
@@ -470,6 +470,12 @@ div.listbox-head-content{\n
color: black;\n
}\n
\n
+#filter-note{\n
+ font-weight: bold;\n
+ color: red;\n
+ margin-left: 0.6em;\n
+}\n
+\n
div.listbox-head div.listbox-head-title{\n
float:left;\n
width:auto;\n
diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index 5f507dd..62d3cf4 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -724,22 +724,42 @@ class ListBoxRenderer:
# we show all rows and do not care to hide anything
return 0

+ # ignore_hide_rows parameter force to display the content
+ ignore_hide_rows = REQUEST.get('ignore_hide_rows', 0)
+ if ignore_hide_rows:
+ return 0
+
+ return self.isNotFiltered()
+
+ isHideRowsOnNoSearchCriterion = lazyMethod(isHideRowsOnNoSearchCriterion)
+
+ def isFiltered(self):
+ """Return True if listbox content filtered
+ """
+ return not self.isNotFiltered()
+
+ isFiltered = lazyMethod(isFiltered)
+
+ def isNotFiltered(self):
+ """Return False if listbox content filtered
+ """
+
# Always display lines in report mode
if self.isReportTreeMode():
return 0

# In domain mode, returns lines only if a domain is selected
- if self.isDomainTreeMode():
- if self.getDomainSelection():
- return 0
+ domain_selection = self.getDomainSelection()
+ if domain_selection and (len(domain_selection) > 0):
+ return 0

- # ignore_hide_rows parameter force to display the content
- ignore_hide_rows = REQUEST.get('ignore_hide_rows', 0)
- if ignore_hide_rows:
+ # Always display lines in invert mode (filter by checked uids)
+ if self.getSelection().isInvertMode():
return 0

# we could hide rows only if missing in request or selection search criterions
selection_params = self.getSelection().getParams()
+ REQUEST = self.request

# Try to get workflow state parameter, in order to always allow worklist display
# guess all column names from catalog schema
@@ -765,7 +785,7 @@ class ListBoxRenderer:
return 0
return 1

- isHideRowsOnNoSearchCriterion = lazyMethod(isHideRowsOnNoSearchCriterion)
+ isNotFiltered = lazyMethod(isNotFiltered)

def showStat(self):
"""Return a boolean that represents whether a stat line is displayed or not.
diff --git a/product/ERP5Form/Selection.py b/product/ERP5Form/Selection.py
index 29a2999..388d1c2 100644
--- a/product/ERP5Form/Selection.py
+++ b/product/ERP5Form/Selection.py
@@ -423,7 +423,7 @@ class DomainSelection(Acquisition.Implicit, Traversable, Persistent):
setattr(self, k, v)

def __len__(self):
- return len(self.domain_dict)
+ return len([1 for i in self.domain_dict if i is not None])

security.declarePublic('getCategoryList')
def getCategoryList(self):
--
1.7.8.rc3
Kazuhiko Shiozaki
2011-12-20 13:27:14 UTC
Permalink
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14 +++++++-
.../erp5_xhtml_style/erp5_listbox.css.xml | 6 +++
product/ERP5Form/ListBox.py | 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +-
5 files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.

Before merging, could you provide us more detail about this patch, like
the purpose of this patch, which problem will be solved by this patch
etc. please ?

And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.

Thanks in advance.

Best regards,
--
Kazuhiko Shiozaki, Nexedi SA Senior Consultant
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Vera Kurpas
2011-12-20 14:14:18 UTC
Permalink
Hi Kazuhiko!

Boris asked me to explain the purpose of this patch.
Our erp5 users like to see all items in listbox by default. And the
question was: how the user can understand that there are not all items
in listbox because the items were filtered?

The result of this patch: if there are not all items in listbox the
inscription !filtered! appears. The patch is not ready because the
inscription does not appear if the listbox is filtered by Report Tree or
Domain Tree. But we don't use Report Tree and Domain Tree and our users
are happy :)

Later we will write functional tests. We didn't expect that you commit
the patch, we just sent it because think it is high importance
functionality.

Vera
Post by Kazuhiko Shiozaki
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14 +++++++-
.../erp5_xhtml_style/erp5_listbox.css.xml | 6 +++
product/ERP5Form/ListBox.py | 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +-
5 files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.
Before merging, could you provide us more detail about this patch, like
the purpose of this patch, which problem will be solved by this patch
etc. please ?
And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.
Thanks in advance.
Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: filtered.jpg
Type: image/jpeg
Size: 17695 bytes
Desc: not available
URL: <Loading Image...>
jp
2011-12-21 10:31:18 UTC
Permalink
Hi,
Post by Vera Kurpas
Later we will write functional tests. We didn't expect that you commit
the patch, we just sent it because think it is high importance
functionality.
This feature (in this way or another way) is very useful. Thank you.

We are still wondering what is the best message to display. Also, whenever listbox is set to display an empty list (if not filtered), which is one option in listbox, then displaying a "filetered" message is useless. So this means that the "filtered" message does not need to be displayed in some cases since it is redundant.

Some users would also like to see which "hidden" parameters are used to filter a list. This could be achieved by rendering selection Query objects in a pretty form, something which is in theory possible thanks to the grammar which was defined for catalog query parameters. But I think it is still not implemented.

Overall, I would implement the feature you are proposing:
1- by extending Listbox API (so that this feature is explicit for all types of listbox of renderer, for example through a parameter which is passed or through a method) and not only one Listbox renderer
2- by taking into account possible conflict with the feature of displaying nothing without explicit filtering in Listbox API
3- by taking into account the problem of rendering selection query parameters (in listbox header or elsewhere) as Query objects are supposed to be able to do through the grammar which they define
4- by covering the feature with a functional test

Regards,

JPS.
Post by Vera Kurpas
Vera
Post by Kazuhiko Shiozaki
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14 +++++++-
.../erp5_xhtml_style/erp5_listbox.css.xml | 6 +++
product/ERP5Form/ListBox.py | 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +-
5 files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.
Before merging, could you provide us more detail about this patch, like
the purpose of this patch, which problem will be solved by this patch
etc. please ?
And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.
Thanks in advance.
Best regards,
bk
2011-12-21 19:49:25 UTC
Permalink
We think this answer is done by person who did not answer to users' calls.
:)
Post by jp
Hi,
Post by Vera Kurpas
Later we will write functional tests. We didn't expect that you commit
the patch, we just sent it because think it is high importance
functionality.
This feature (in this way or another way) is very useful. Thank you.
We are still wondering what is the best message to display. Also, whenever listbox is set to display an empty list (if not filtered), which is one option in listbox, then displaying a "filetered" message is useless. So this means that the "filtered" message does not need to be displayed in some cases since it is redundant.
Some users would also like to see which "hidden" parameters are used to filter a list. This could be achieved by rendering selection Query objects in a pretty form, something which is in theory possible thanks to the grammar which was defined for catalog query parameters. But I think it is still not implemented.
1- by extending Listbox API (so that this feature is explicit for all types of listbox of renderer, for example through a parameter which is passed or through a method) and not only one Listbox renderer
2- by taking into account possible conflict with the feature of displaying nothing without explicit filtering in Listbox API
3- by taking into account the problem of rendering selection query parameters (in listbox header or elsewhere) as Query objects are supposed to be able to do through the grammar which they define
4- by covering the feature with a functional test
Regards,
JPS.
Post by Vera Kurpas
Vera
Post by Kazuhiko Shiozaki
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14 +++++++-
.../erp5_xhtml_style/erp5_listbox.css.xml | 6 +++
product/ERP5Form/ListBox.py | 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +-
5 files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.
Before merging, could you provide us more detail about this patch, like
the purpose of this patch, which problem will be solved by this patch
etc. please ?
And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.
Thanks in advance.
Best regards,
_______________________________________________
Erp5-dev mailing list
Erp5-dev at erp5.org
https://mail.tiolive.com/mailman/listinfo/erp5-dev
bartek
2011-12-30 12:43:22 UTC
Permalink
On Wed, 21 Dec 2011 11:31:18 +0100
Post by jp
Hi,
Post by Vera Kurpas
Later we will write functional tests. We didn't expect that you
commit the patch, we just sent it because think it is high
importance functionality.
This feature (in this way or another way) is very useful. Thank you.
We are still wondering what is the best message to display. Also,
whenever listbox is set to display an empty list (if not filtered),
which is one option in listbox, then displaying a "filetered" message
is useless. So this means that the "filtered" message does not need
to be displayed in some cases since it is redundant.
Some users would also like to see which "hidden" parameters are used
to filter a list. This could be achieved by rendering selection Query
objects in a pretty form, something which is in theory possible
thanks to the grammar which was defined for catalog query parameters.
But I think it is still not implemented.
1- by extending Listbox API (so that this feature is explicit for all
types of listbox of renderer, for example through a parameter which
is passed or through a method) and not only one Listbox renderer 2-
by taking into account possible conflict with the feature of
displaying nothing without explicit filtering in Listbox API 3- by
taking into account the problem of rendering selection query
parameters (in listbox header or elsewhere) as Query objects are
supposed to be able to do through the grammar which they define 4- by
covering the feature with a functional test
I'm a bit confused - Boris, what do you make of this reply? Are you
going to keep working on the patch?

Bartek
Post by jp
Regards,
JPS.
Post by Vera Kurpas
Vera
Post by Kazuhiko Shiozaki
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14
+++++++- .../erp5_xhtml_style/erp5_listbox.css.xml
| 6 +++ product/ERP5Form/ListBox.py
| 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +- 5
files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.
Before merging, could you provide us more detail about this
patch, like the purpose of this patch, which problem will be
solved by this patch etc. please ?
And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.
Thanks in advance.
Best regards,
--
"Je?li boli ci? gard?o, ciesz si? ?e nie jeste? ?yraf?
(zauwa?one w aptece)
Vera Kurpas
2011-12-30 15:03:49 UTC
Permalink
Hi
Post by bartek
Post by jp
We are still wondering what is the best message to display. Also,
whenever listbox is set to display an empty list (if not filtered),
which is one option in listbox, then displaying a "filetered" message
is useless. So this means that the "filtered" message does not need
to be displayed in some cases since it is redundant.
Some users would also like to see which "hidden" parameters are used
to filter a list. This could be achieved by rendering selection Query
objects in a pretty form, something which is in theory possible
thanks to the grammar which was defined for catalog query parameters.
But I think it is still not implemented.
1- by extending Listbox API (so that this feature is explicit for all
types of listbox of renderer, for example through a parameter which
is passed or through a method) and not only one Listbox renderer
Jean-Paul, could you explain detailed what did mean in 1?
Post by bartek
2-
Post by jp
by taking into account possible conflict with the feature of
displaying nothing without explicit filtering in Listbox API 3- by
taking into account the problem of rendering selection query
parameters (in listbox header or elsewhere) as Query objects are
supposed to be able to do through the grammar which they define 4- by
covering the feature with a functional test
I'm a bit confused - Boris, what do you make of this reply? Are you
going to keep working on the patch?
Yes, of course we would keep working on the patch. We are not sure which
way it would be done but surely we will use that feature in each
project, because it was unable to explain users how should they know all
items or not in the list. Jean-Paul's opinion about the way is known and
it would be fine if other developers and users express their opinions.

The same problem is hiding the rows with empty category_property while
listbox is sorted by that property. But Nexedi developers are solving it
now. The only thing which is may be useful until the problem is solved
is sorting by default while the button "Show all" is clicked.

Vera
Post by bartek
Bartek
Post by jp
Regards,
JPS.
Vera
Post by Kazuhiko Shiozaki
Hi Boris,
Post by Boris Kocherov
---
.../erp5_xhtml_style/ListBox_asHTML.xml | 1 +
.../erp5_xhtml_style/ListBox_asHTMLLibrary.xml | 14
+++++++- .../erp5_xhtml_style/erp5_listbox.css.xml
| 6 +++ product/ERP5Form/ListBox.py
| 34 +++++++++++++++----
product/ERP5Form/Selection.py | 2 +- 5
files changed, 47 insertions(+), 10 deletions(-)
Thanks for your patch.
Before merging, could you provide us more detail about this
patch, like the purpose of this patch, which problem will be
solved by this patch etc. please ?
And also functional tests to test the new feature are required,
especially for listbox rendering changes like this patch.
Thanks in advance.
Best regards,
Loading...