From 770d1e2db22cc96715e2eaf09f7e7072630c38a1 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 9 Jul 2010 13:34:27 +0000
Subject: [PATCH] Use some JavaSCript to show only first n possible formats
 followed by "More" link which will show rest (more user frinedly for log OOo
 format lists). I18n & CSS fixes.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37022 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_km_theme/km_css/layout.css.xml       |  5 ++-
 .../erp5_km_theme/km_js/erp5_km.js.xml        |  9 +++--
 .../Base_viewDownloadWidget.xml               | 35 ++++++++++++++++---
 .../WebSite_viewWebSiteBrowserGadget.xml      |  2 +-
 bt5/erp5_km/bt/revision                       |  2 +-
 5 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml
index 28ba98bffe..1b45c53eb5 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml
@@ -1544,6 +1544,7 @@ div.download-document-format-list-menu{\n
   border: 1px solid #A8A799;\n
   background-color: #FFFFFF;\n
 }\n
+\n
 div.download-document-format-list-container span:hover,\n
 div.download-document-format-list-menu ul li:hover{\n
   background-color: #A8A799;\n
@@ -1564,7 +1565,9 @@ div.download-document-format-list-menu ul li.separator{\n
   padding-bottom:3px;\n
 }\n
 \n
-\n
+div.download-document-format-list-menu ul li.toggle-hidden-format-dialog-selection-link{\n
+  height:20px;\n
+}\n
 \n
 
 
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
index 327031e689..f13db98fae 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
@@ -15,7 +15,7 @@
         </item>
         <item>
             <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts78059655.7</string> </value>
+            <value> <string>ts78681256.09</string> </value>
         </item>
         <item>
             <key> <string>__name__</string> </key>
@@ -70,6 +70,11 @@ function toggleElement(tag_name, class_name){\n
   MochiKit.Visual.toggle(dom_element);\n
 }\n
 \n
+function toggleHiddenFormatDialogSelection(){\n
+  toggleElement(\'div\', \'download-document-format-list-menu-hidden\');\n
+  MochiKit.DOM.removeElement(MochiKit.DOM.getFirstElementByTagAndClassName(\'li\', \'toggle-hidden-format-dialog-selection-link\'));\n
+}\n
+\n
 MochiKit.DOM.addLoadEvent(setScreenClass);\n
 connect(window, "onresize", setScreenClass);\n
 \n
@@ -88,7 +93,7 @@ function setScreenClass(){\n
         </item>
         <item>
             <key> <string>size</string> </key>
-            <value> <int>1540</int> </value>
+            <value> <int>1787</int> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml
index e773d07b1a..3c9045aa95 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml
@@ -48,15 +48,40 @@
 \n
 <div class="download-document-format-list-container"\n
      tal:define="target_format_item_list python: here.getTargetFormatItemList();\n
-                       document_url here/absolute_url">\n
- <span onClick="javascript:toggleElement(\'div\', \'download-document-format-list-menu\');"> Download</span>\n
+                 document_url here/absolute_url;\n
+                 list_index python: 5">\n
+ <span i18n:domain="erp5_ui" \n
+       i18n:translate=""\n
+       onClick="javascript:toggleElement(\'div\', \'download-document-format-list-menu\');"> Download</span>\n
   <div class="download-document-format-list-menu" style="opacity: 0.999999; display: none;">\n
     <ul>\n
-      <li class="separator"><a tal:attributes="href document_url"> Original </a></li>\n
-      <li tal:repeat="target_format_item target_format_item_list">\n
-        <a tal:attributes="href python: \'%s?format=%s\' %(document_url, target_format_item[1])"\n
+      <li class="separator">\n
+        <a tal:attributes="href document_url"\n
+           i18n:domain="erp5_ui" \n
+           i18n:translate=""\n
+           title="Download in original format">Original</a>\n
+      </li>\n
+      <li tal:repeat="target_format_item python: target_format_item_list[:list_index]">\n
+        <a tal:attributes="href python: \'%s?format=%s\' %(document_url, target_format_item[1]);\n
+                           title python: \'Download in %s format\' %target_format_item[0];"\n
            tal:content="python: target_format_item[0]"/>\n
       </li>\n
+      <!-- Show more than list_index in initially hidden div -->\n
+      <tal:block tal:condition="python: len(target_format_item_list)>list_index">\n
+        <div class="download-document-format-list-menu-hidden" style="opacity: 0.999999; display: none;">\n
+          <li tal:repeat="target_format_item python: target_format_item_list[list_index:]">\n
+            <a tal:attributes="href python: \'%s?format=%s\' %(document_url, target_format_item[1]);\n
+                               title python: \'Download in %s format\' %target_format_item[0];"\n
+               tal:content="python: target_format_item[0]"/>\n
+          </li>\n
+        </div>\n
+        <li class="toggle-hidden-format-dialog-selection-link">\n
+          <span onClick="javascript:toggleHiddenFormatDialogSelection();"\n
+                i18n:domain="erp5_ui" \n
+                i18n:translate=""\n
+                title="Show more download formats"> More... </span>\n
+        </li>\n
+      </tal:block>\n
     </ul>\n
   </div>\n
 \n
diff --git a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/WebSite_viewWebSiteBrowserGadget.xml b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/WebSite_viewWebSiteBrowserGadget.xml
index 3028d2bbcb..ee533a7ba3 100644
--- a/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/WebSite_viewWebSiteBrowserGadget.xml
+++ b/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/WebSite_viewWebSiteBrowserGadget.xml
@@ -60,7 +60,7 @@
   </tal:block>\n
 \n
   <tal:block tal:condition="python: len(section_list)==0">\n
-<p i18n:domain="erp5_ui" i18n:translate=""> No subsections found. </p>\n
+    <p i18n:domain="erp5_ui" i18n:translate=""> No subsections found. </p>\n
   </tal:block>\n
   \n
 </div>\n
diff --git a/bt5/erp5_km/bt/revision b/bt5/erp5_km/bt/revision
index 74eeb81441..4601fe622a 100644
--- a/bt5/erp5_km/bt/revision
+++ b/bt5/erp5_km/bt/revision
@@ -1 +1 @@
-1489
\ No newline at end of file
+1491
\ No newline at end of file
-- 
2.30.9