From e5c1b163159f70d4d89afdf9be4fd14260342b9c Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 30 Jul 2010 06:40:12 +0000
Subject: [PATCH] Make sort buttons work in gadget mode as well. CSS cleanup &
 generalization.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37370 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_km_theme/ListBox_asHTML.xml          | 41 +++++------
 .../erp5_km_theme/km_css/listbox.css.xml      | 71 ++++++++++---------
 bt5/erp5_km/bt/revision                       |  2 +-
 3 files changed, 57 insertions(+), 57 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 f1fd6882f9..20a5b7e248 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
@@ -137,11 +137,11 @@
             <td colspan="1" \n
                 class="listbox-table-domain-tree-cell"\n
                 tal:attributes="colspan python: total_depth - report_tree.depth + 1">\n
-              <a href="method" class="tree_open selected"\n
+              <a href="method" class="tree-open selected"\n
                  tal:condition="report_tree/is_open"\n
                  tal:attributes="href string:foldDomain?domain_url=${report_tree/domain_url}&form_id=${form_id}&list_selection_name=${selection_name}&domain_depth:int=${report_tree/depth}"\n
                  tal:content="report_tree/obj/getCompactTranslatedTitle"/>\n
-              <a href="method" class="tree_closed"\n
+              <a href="method" class="tree-closed"\n
                  tal:condition="not: report_tree/is_open"\n
                  tal:attributes="href string:unfoldDomain?domain_url=${report_tree/domain_url}&form_id=${form_id}&list_selection_name=${selection_name}&domain_depth:int=${report_tree/depth}"\n
                  tal:content="report_tree/obj/getCompactTranslatedTitle"/>\n
@@ -218,32 +218,29 @@
                                        title      python: value[1];\n
                                        sort_order python: value[2]">\n
 \n
-                  <th tal:condition="sql" class="listbox-table-header-cell">                 \n
+                  <th tal:condition="sql" class="listbox-table-header-cell"\n
+                      tal:define="bt_class python:  sort_order==\'ascending\' and \'sort-button sort-button-asc\' \n
+                                  or sort_order == \'descending\' and \'sort-button sort-button-desc\' \n
+                                  or \'sort-button\'">                 \n
                     <!-- Button in normal view -->\n
-                    <button tal:define="\n
-                          bt_class python:  sort_order==\'ascending\' and \'sort_button sort_button_asc\' \n
-                          or sort_order == \'descending\' and \'sort_button sort_button_desc\' \n
-                          or \'sort_button\'"\n
-                          tal:condition="not:is_gadget_mode" \n
-                          type="submit"\n
-                          name="setSelectionQuickSortOrder:method"\n
-                          tal:attributes="title string:${title}; \n
-                                          value string:${field_id}.${sql};\n
-                                          class bt_class;"\n
-                          i18n:domain="ui" i18n:attributes="title">\n
-                      <span tal:content="title" i18n:domain="ui" i18n:translate=""/>\n
-                    </button>\n
+                    <button tal:condition="not:is_gadget_mode" \n
+                            type="submit"\n
+                            name="setSelectionQuickSortOrder:method"\n
+                            tal:content="title"\n
+                            tal:attributes="title string:${title}; \n
+                                            value string:${field_id}.${sql};\n
+                                            class bt_class;"\n
+                            i18n:domain="ui" i18n:attributes="title" />\n
 \n
                     <!-- Button in gadget mode -->\n
                     <button tal:condition="is_gadget_mode" \n
                             tal:define ="params python: {\'setSelectionQuickSortOrder:method\':field_id+\'.\'+sql};"\n
                             type="button"  \n
-                            class="sort_button"\n
+                            tal:content="title"\n
                             tal:attributes="title string:${title}; \n
-                                            onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params);"\n
-                            i18n:domain="ui" i18n:attributes="title">\n
-                      <span tal:content="title" i18n:domain="ui" i18n:translate=""/>\n
-                    </button>\n
+                                            onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params);\n
+                                            class bt_class;"\n
+                            i18n:domain="ui" i18n:attributes="title"/>\n
                   </th>\n
 \n
                   <th class="listbox-table-header-cell"\n
@@ -346,7 +343,7 @@
                     <a  tal:condition="section_name"\n
                         tal:define="method_id python: line.isOpen() and \'foldReport\' or \'unfoldReport\'"\n
                         tal:attributes="href string:${method_id}?report_url=${line/getDomainUrl}&amp;form_id=${form_id}&amp;list_selection_name=${selection_name};\n
-                                        class python:test(line.isOpen(), \'tree_open\', \'tree_closed\');\n
+                                        class python:test(line.isOpen(), \'tree-open\', \'tree-closed\');\n
                                         style python:\'white-space: nowrap;; margin-left: %spx\' % (line.getDepth() * 15)"\n
                         tal:content="section_name"/>\n
                   </td>\n
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 4323370864..4fc9581556 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
@@ -153,7 +153,6 @@ div.search_popup{\n
   position:relative;\n
 }\n
 \n
-\n
 /*Define all button image*/\n
 <tal:block tal:define="buttons python: [\'cut\',\'copy\',\'paste\',\'delete\',\'print\',\'new\',\'reset\',\'filter\',\'find\',\'sort\',\'config\']">\n
 <tal:block tal:repeat ="button buttons">\n
@@ -167,7 +166,7 @@ div.search_popup{\n
 \n
 \n
 /*********************/\n
-/*   Listbox style   */\n
+/*   Listbox style (XXX: move to erp5.css)   */\n
 /*********************/\n
 div.listbox-container{\n
   width: 100%;\n
@@ -194,7 +193,6 @@ div.listbox-body{\n
   width:auto;\n
 }\n
 \n
-/* List mode selection*/\n
 div.listbox-tree-mode-selection{\n
   height: 22px;\n
   width: auto;\n
@@ -205,18 +203,10 @@ div.listbox-tree-mode-selection input{\n
   width: auto;\n
 }\n
 \n
-\n
 th.listbox-table-report-tree-selection-cell{\n
   width: 50px; \n
 }\n
 \n
-td.listbox-table-domain-tree-cell{\n
-  text-align: left; \n
-  vertical-align: top; \n
-  white-space: nowrap;\n
-}\n
-\n
-/*Footer block*/\n
 div.listbox-footer{\n
  background-color:#F0EFE9;\n
  float:left;\n
@@ -280,14 +270,6 @@ div.listbox-full-text-search input.button{\n
  width: auto;\n
 }\n
 \n
-div.resultList{\n
-  float:left;\n
-}\n
-div.searchResultHeader{\n
-  float:left;\n
-}\n
-\n
-\n
 /* Pagination*/\n
 div.listbox-page-navigation{\n
   width:auto;\n
@@ -300,12 +282,12 @@ div.listbox-page-navigation input{\n
 }\n
 \n
 /* Report tree */\n
-a.tree_closed {\n
+a.tree-closed {\n
   background:transparent url(\'./images/tree_closed.png\') no-repeat scroll left center;\n
   padding-left:15px;\n
 }\n
 \n
-a.tree_open {\n
+a.tree-open {\n
   background:transparent url(\'./images/tree_open.png\') no-repeat scroll left center;\n
   padding-left:15px;\n
 }\n
@@ -313,29 +295,50 @@ a.tree_open {\n
 div.listbox-tree select{\n
   max-width:120px;\n
 }\n
+\n
 /*Table Listbox elements */\n
-.listbox th {\n
+table.listbox{\n
+  border-collapse:collapse;\n
+  width:100%;\n
+}\n
+\n
+table.listbox th,\n
+table.listbox td {\n
   text-align:left;\n
   vertical-align: top;\n
 }\n
-.listbox-search-line, .listbox-label-line{\n
-  background-color: #F0EFE9;\n
-}\n
-.listbox-search-line th{\n
-  background-color: inherit;\n
-}\n
 \n
-.listbox select {\n
-  max-width: 145px;\n
+table.listbox th button{\n
+  border-width:0;\n
+  cursor:pointer;\n
+  float:left;\n
+  font-weight:bold;\n
+  padding:0 6px 0 0;\n
 }\n
 \n
-button.sort_button_desc{\n
+/* KM specific */\n
+table.listbox th button.sort-button {\n
+  background:transparent url("../km_img/switch.png") no-repeat scroll 100% 50%;\n
+}\n
+table.listbox th button.sort-button:hover{\n
+  color: #FFF;\n
+}\n
+table.listbox th button.sort-button-desc{\n
   background-image: url(\'./km_img/switch_desc.png\');\n
 }\n
-button.sort_button_asc{\n
+table.listbox th button.sort-button-asc{\n
   background-image: url(\'./km_img/switch_asc.png\');\n
 }\n
 \n
+/* KM specific */\n
+.listbox-search-line, .listbox-label-line{\n
+  background-color: #F0EFE9;\n
+}\n
+\n
+.listbox-search-line th{\n
+  background-color: inherit;\n
+}\n
+\n
 /* in search mode listbox may contain top/ bottom quick search inputs */\n
 div.search-text-listbox{\n
   text-align: center;\n
@@ -344,10 +347,10 @@ div.search-text-listbox{\n
   margin-bottom:0.5em;\n
   margin-top:0.5em;\n
 }\n
+\n
 div.search-text-listbox input{\n
   width: auto;\n
-}\n
-
+}
 
 ]]></string> </value>
         </item>
diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision
index cb2ddd852a..f0cec364da 100644
--- a/bt5/erp5_km/bt/revision
+++ b/bt5/erp5_km/bt/revision
@@ -1 +1 @@
-1503
\ No newline at end of file
+1505
\ No newline at end of file
-- 
2.30.9