From 76accb78c9b4eafdcb8276b8de2d9ab51d8865bc Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 14 Jan 2011 08:08:22 +0000
Subject: [PATCH] Web toolbar's JavaScript code should use JQuery rather than
 MochiKit which is to be deprecated.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42327 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Document_getSummaryAsHTML.xml             |  7 +--
 .../erp5_web_toolbar.js.xml                   | 62 ++++++++++++-------
 bt5/erp5_web/bt/revision                      |  2 +-
 3 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.xml
index 92fea38c9c..be89df9eaf 100644
--- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.xml
+++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.xml
@@ -49,7 +49,7 @@
               dom_id python: (\'%s-%s\' %(box_relative_url, here.getRelativeUrl())).replace(\'/\',\'_\')">\n
   <div class="document-gadget-quick-preview">\n
   <div class="teaser"\n
-       tal:attributes="onclick string:toggle(\'${dom_id}\');">\n
+       tal:attributes="onclick string:$(\'#${dom_id}\').toggle();">\n
     <img alt="Icon" class="icon"\n
          tal:attributes="src icon" />\n
 \n
@@ -82,8 +82,7 @@
   </div>\n
   </div>\n
   \n
-</tal:block>\n
-
+</tal:block>
 
 ]]></unicode> </value>
         </item>
@@ -101,7 +100,7 @@
         </item>
         <item>
             <key> <string>output_encoding</string> </key>
-            <value> <string>utf-8</string> </value>
+            <value> <string>iso-8859-15</string> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/erp5_web_toolbar.js.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/erp5_web_toolbar.js.xml
index 44604c6206..2584168058 100644
--- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/erp5_web_toolbar.js.xml
+++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/erp5_web_toolbar.js.xml
@@ -12,7 +12,7 @@
         </item>
         <item>
             <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts50863427.77</string> </value>
+            <value> <string>ts94991458.99</string> </value>
         </item>
         <item>
             <key> <string>__name__</string> </key>
@@ -24,30 +24,46 @@
         </item>
         <item>
             <key> <string>data</string> </key>
-            <value> <string>function initialize_toolbar(){\n
-  // for each menues\n
-  var menus = getElementsByTagAndClassName(\'li\', \'toolboxSection\');\n
-  forEach(menus, function (menu) {\n
-     var menu_title = getFirstElementByTagAndClassName(\'h3\', \'menu_title\', menu);\n
-     var item = getFirstElementByTagAndClassName(\'div\', \'menu\', menu);\n
-     connect(menu_title, \'onclick\', function (){display_menu(item)});\n
-  });\n
-}\n
+            <value> <string>/*\n
+Copyright (c) 2011-2012 Nexedi SARL and Contributors. All Rights Reserved.\n
+\n
+This program is Free Software; you can redistribute it and/or\n
+modify it under the terms of the GNU General Public License\n
+as published by the Free Software Foundation; either version 2\n
+of the License, or (at your option) any later version.\n
+\n
+This program is distributed in the hope that it will be useful,\n
+but WITHOUT ANY WARRANTY; without even the implied warranty of\n
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n
+GNU General Public License for more details.\n
+\n
+You should have received a copy of the GNU General Public License\n
+along with this program; if not, write to the Free Software\n
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n
+*/\n
+\n
+\n
+function initialize_toolbar(){\n
+  /* initialize all toolbar menues */\n
+  $("li.toolboxSection").each(\n
+    function (index, menu){\n
+      menu = $(this);\n
+      var menu_title = menu.children("h3.menu_title").first();\n
+      var item = menu.children("div.menu").first();\n
+      menu_title.bind("click", function (){display_menu(item)} );\n
+  })}\n
 \n
 function display_menu(clicked_item){\n
-  toggle(clicked_item, \'appear\', {duration:0});\n
-  // for each menues\n
-  var menus = getElementsByTagAndClassName(\'li\', \'toolboxSection\');\n
-  forEach(menus, function (menu) {\n
-     var item = getFirstElementByTagAndClassName(\'div\', \'menu\', menu);\n
-     if (item != clicked_item) {\n
-       //item.style.display = \'none\';\n
-       fade(item, {duration:0});\n
-     }\n
-  });\n
-}\n
+  /* when called funtion will display current menu and hide rest */\n
+  clicked_item.toggle();\n
+  $("li.toolboxSection").each(\n
+    function (index, menu){\n
+      menu = $(this);\n
+      var item = menu.children("div.menu").first();\n
+      if (item.parent().attr("id") != clicked_item.parent().attr("id")) {item.hide();}\n
+  })};\n
 \n
-initialize_toolbar();\n
+$(document).ready(initialize_toolbar);\n
 </string> </value>
         </item>
         <item>
@@ -56,7 +72,7 @@ initialize_toolbar();\n
         </item>
         <item>
             <key> <string>size</string> </key>
-            <value> <int>809</int> </value>
+            <value> <int>1497</int> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision
index 0f746c73b1..23cbfa7704 100644
--- a/bt5/erp5_web/bt/revision
+++ b/bt5/erp5_web/bt/revision
@@ -1 +1 @@
-1038
\ No newline at end of file
+1024
\ No newline at end of file
-- 
2.30.9