From f7ffbd2be4bc6671e9a2c6dfb239a75382c274da Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Wed, 28 Jul 2010 08:47:33 +0000
Subject: [PATCH] When showing search results define other listbox modes and
 mark current one. Follow CSS convention.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37314 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_km_theme/ListBox_asHTML.xml          | 26 ++++++++-----------
 .../listbox.xml                               | 19 +++++++++++++-
 .../erp5_km_theme/km_css/listbox.css.xml      | 14 +++++-----
 bt5/erp5_km/bt/revision                       |  2 +-
 4 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/ListBox_asHTML.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/ListBox_asHTML.xml
index 4fb8c3d0fa..f060a18b37 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/ListBox_asHTML.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/ListBox_asHTML.xml
@@ -62,10 +62,11 @@
               show_search_line here/showSearchLine;\n
               is_web_mode request/is_web_mode | nothing;\n
               is_dialog_mode request/dialog_mode | nothing;\n
+              display_style_list here/getDisplayStyleList;\n
               list_style python:request.get(\'list_style\', \n
-              selection.getParams().get(\'list_style\', is_web_mode and \'table\' or None));\n
+                                             selection.getParams().get(\'list_style\', here.getDefaultDisplayStyle()));\n
               dummy python: list_style == \'search\' and here.setDisplayedColumnIdList((\'getIconAsHTML\', \'getSummaryAsHTML\'))\n
-                         or list_style == \'thumb\' and here.setDisplayedColumnIdList((\'title\', \'thumbnail\'));\n
+                           or list_style == \'thumbnail\' and here.setDisplayedColumnIdList((\'title\', \'thumbnail\'));\n
               line_list here/query;\n
               listbox_max_lines  python: int(here.getMaxLineNumber());\n
               total_line         python: int(here.total_size);\n
@@ -73,10 +74,8 @@
               current_page_max   python: listbox_max_lines * current_page;\n
               current_page_start python: (listbox_max_lines * (current_page - 1)) + 1;\n
               current_page_stop  python: (total_line < current_page_max) and total_line or current_page_max;\n
-\n
               listbox_id request/current_form_id | form_id ;\n
               listbox_url string:${context_url}/${listbox_id};\n
-\n
               ">\n
 \n
   <!-- Define hidden input.  -->\n
@@ -438,19 +437,16 @@
       </div>\n
 \n
       <!-- Choose display mode -->\n
-      <!--TODO define show_display_selection-->\n
-      <div  tal:define="style_list here/getDisplayStyleList"\n
-            tal:condition="python: not is_gadget_mode and len(style_list) > 0"\n
-            class="display_selection"\n
-            i18n:domain="ui">\n
-        <span i18n:translate="">Display :</span>\n
+      <!--TODO define show_display_selection macro-->\n
+      <div tal:condition="python: len(display_style_list) > 0"\n
+           class="list-style-selection">\n
+        <span i18n:translate="" i18n:domain="ui">Display :</span>\n
         <ul>\n
-          <li tal:repeat="style style_list">\n
-            <a tal:attributes="href python: \'%s?list_style=%s\' % (listbox_url, style[0])"\n
+          <li tal:repeat="style display_style_list">\n
+            <a tal:attributes="href python: \'%s?list_style=%s\' % (listbox_url, style[0]);\n
+                               class python: test(style[0]==list_style, \'selected\',\'\');"\n
                tal:content="python: style[1]"\n
-                i18n:translate="">\n
-              Tabular\n
-            </a>\n
+               i18n:translate="" i18n:domain="ui"/>\n
           </li>\n
         </ul>\n
       </div>\n
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewAdvancedSearchResultList/listbox.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewAdvancedSearchResultList/listbox.xml
index c13e07dfe0..3d9e7e460a 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewAdvancedSearchResultList/listbox.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSite_viewAdvancedSearchResultList/listbox.xml
@@ -384,6 +384,10 @@
                     <key> <string>default</string> </key>
                     <value> <string></string> </value>
                 </item>
+                <item>
+                    <key> <string>default_display_style</string> </key>
+                    <value> <string>search</string> </value>
+                </item>
                 <item>
                     <key> <string>default_params</string> </key>
                     <value>
@@ -397,7 +401,20 @@
                 <item>
                     <key> <string>display_style_list</string> </key>
                     <value>
-                      <list/>
+                      <list>
+                        <tuple>
+                          <string>table</string>
+                          <string>table</string>
+                        </tuple>
+                        <tuple>
+                          <string>search</string>
+                          <string>search</string>
+                        </tuple>
+                        <tuple>
+                          <string>thumbnail</string>
+                          <string>thumbnail</string>
+                        </tuple>
+                      </list>
                     </value>
                 </item>
                 <item>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/listbox.css.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/listbox.css.xml
index 781e3c2a00..4df159aab5 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/listbox.css.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/listbox.css.xml
@@ -218,26 +218,28 @@ div.search_popup{\n
   float:left;\n
 }\n
 \n
-/*Display selection choice*/\n
-.display_selection {\n
+/* List style selection */\n
+div.list-style-selection {\n
   width:auto;\n
   float:left;\n
 }\n
-.display_selection span{\n
+div.list-style-selection span{\n
   font-weight:bold;\n
   padding-left:10px;\n
   vertical-align:-4px;\n
 }\n
-.display_selection ul{\n
+div.list-style-selection ul{\n
   display:inline;\n
   padding-left:0;\n
   margin: 0;\n
   vertical-align: -4px;\n
 }\n
-.display_selection li{\n
+div.list-style-selection li{\n
   display: inline;\n
 }\n
-\n
+div.list-style-selection li a.selected{\n
+  font-weight: bold;\n
+}\n
 /* Search bar */\n
 div.extendedSearchBar {\n
   float:left;\n
diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision
index aeef4a7483..bcddd5d377 100644
--- a/bt5/erp5_km/bt/revision
+++ b/bt5/erp5_km/bt/revision
@@ -1 +1 @@
-1493
\ No newline at end of file
+1494
\ No newline at end of file
-- 
2.30.9