From 85db24653a7973c086341e037388e3d4e6a83535 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Mon, 27 Jul 2009 09:16:37 +0000
Subject: [PATCH] Omit showing listbox rows if no input (i.e. search
 criterions) are provided by user.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28181 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_xhtml_style/ListBox_asHTML.xml             |  6 +++++-
 .../erp5_xhtml_style/ListBox_asStandardHTML.xml     | 13 ++++++++++++-
 .../erp5_xhtml_style/ListBox_asTableStyleHTML.xml   | 11 +++++++++++
 .../portal_skins/erp5_xhtml_style/erp5.css.xml      |  9 ++++++++-
 product/ERP5/bootstrap/erp5_xhtml_style/bt/revision |  2 +-
 5 files changed, 37 insertions(+), 4 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 e56ece0764..2db1ce4457 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
@@ -51,7 +51,10 @@
               real_context here/getContext;\n
               context_url real_context/absolute_url;\n
               md5_string here/getMD5Checksum;\n
-              line_list here/query;\n
+              hide_rows_on_no_search_criterion \n
+                python: here.isHideRowsOnNoSearchCriterion(request);\n
+              line_list python: test(hide_rows_on_no_search_criterion, \n
+                                     [], here.query());\n
               is_domain_tree_mode here/isDomainTreeMode;\n
               is_report_tree_mode here/isReportTreeMode;\n
               is_domain_tree_supported here/isDomainTreeSupported;\n
@@ -150,6 +153,7 @@
   <tal:block tal:condition="python: list_style not in (\'search\', \'table\')">\n
     <span metal:use-macro="real_context/ListBox_asStandardHTML/macros/main"/>\n
   </tal:block>\n
+\n
 </tal:block>\n
 
 
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
index e3a85521b9..f3615f7150 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asStandardHTML.xml
@@ -243,8 +243,8 @@
                 </td>\n
               </tal:block>\n
             </tr>\n
-\n
             <tal:block tal:repeat="line line_list" tal:define="checked_uid_set here/getCheckedUidSet">\n
+\n
               <tr id="listbox_data_line_0" class="DataA"\n
                 tal:define="css python: line.getRowCSSClassName() or test(repeat[\'line\'].index % 2, \'DataB\', \'DataA\');\n
                             render_result line/render;"\n
@@ -287,6 +287,16 @@
                 </tal:block>\n
               </tr>\n
             </tal:block>\n
+\n
+            <tr tal:condition="hide_rows_on_no_search_criterion"\n
+                class="listbox_missing_search_criterion">\n
+                <td tal:attributes="colspan python: len(here.getSearchValueList()) + 1">\n
+                  <span i18n:translate="" \n
+                      i18n:domain="ui">\n
+                      To display actual content, please fill in one or more search criterion.\n
+                </span>\n
+              </td>\n
+            </tr>\n
 \n
             <tr tal:condition="here/showStat" id="listbox_stat_line"\n
               class="listbox_stat_line"\n
@@ -301,6 +311,7 @@
                   tal:content="structure processed_value" />\n
               </tal:block>\n
             </tr>\n
+\n
           </table>\n
         </div>\n
       </tal:block>\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asTableStyleHTML.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asTableStyleHTML.xml
index c3a86669f9..7d406d535f 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asTableStyleHTML.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ListBox_asTableStyleHTML.xml
@@ -315,6 +315,17 @@
                   <tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
                 </td>\n
               </tr>\n
+\n
+              <tr tal:condition="hide_rows_on_no_search_criterion"\n
+                  class="listbox_missing_search_criterion">\n
+                <td tal:attributes="colspan python: len(here.getSearchValueList()) + 1">\n
+                  <span i18n:translate="" \n
+                        i18n:domain="ui">\n
+                    To display actual content, please fill in one or more search criterion.\n
+                  </span>\n
+                </td>\n
+              </tr>\n
+\n
           </table>\n
 \n
           <!-- Advanced Search footer -->\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
index c8e971aaef..335d0dd426 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/erp5.css.xml
@@ -1506,7 +1506,14 @@ div.search .searchPages .selected{\n
 .document div.page div {\n
   color: black;\n
 }\n
-
+\n
+/* Listbox missing search criterion table row*/\n
+.listbox_missing_search_criterion {\n
+  background-color: white;\n
+}\n
+.listbox_missing_search_criterion td{\n
+  text-align: center!important;\n
+}
 
 ]]></string> </value>
         </item>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 83249da5a1..2975e638ba 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-784
\ No newline at end of file
+788
\ No newline at end of file
-- 
2.30.9