From 251c964d373994243cdf69eee495f4294ba29cdf Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Tue, 18 Jan 2011 13:48:07 +0000
Subject: [PATCH] ERP5 front tabs rewriten using jQuery.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42415 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_tabber.js.xml                        | 133 ++++++++++++++++++
 bt5/erp5_xhtml_jquery_style/bt/revision       |   2 +-
 2 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 bt5/erp5_xhtml_jquery_style/SkinTemplateItem/portal_skins/erp5_xhtml_jquery_style/erp5_tabber.js.xml

diff --git a/bt5/erp5_xhtml_jquery_style/SkinTemplateItem/portal_skins/erp5_xhtml_jquery_style/erp5_tabber.js.xml b/bt5/erp5_xhtml_jquery_style/SkinTemplateItem/portal_skins/erp5_xhtml_jquery_style/erp5_tabber.js.xml
new file mode 100644
index 0000000000..61091c2ad1
--- /dev/null
+++ b/bt5/erp5_xhtml_jquery_style/SkinTemplateItem/portal_skins/erp5_xhtml_jquery_style/erp5_tabber.js.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_Cacheable__manager_id</string> </key>
+            <value> <string>http_cache</string> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <unicode encoding="cdata"><![CDATA[
+
+<tal:block define="dummy python: request.RESPONSE.setHeader(\'Content-Type\', \'application/javascript;; charset=utf-8\')"/>\n
+\n
+/*\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
+function selectTab(clicked_node) {\n
+  clicked_node = $(this);\n
+  $("#tab_box").find("li").each(\n
+    function (index){\n
+      tab = $(this);\n
+      node = tab.find("a").first();\n
+      class_name = tab.attr("class");\n
+      if (clicked_node.attr("href") == node.attr("href")){\n
+        if (class_name != "selected"){tab.attr("class", "selected");}\n
+      }\n
+      else{\n
+        if (class_name != "non_selected"){tab.attr("class", "non_selected");}\n
+      }\n
+    }\n
+  );\n
+  \n
+  var mapping = {\n
+  <tal:block \n
+  tal:replace="structure python: \',\\n\'.join([\'%s: \\x22%s\\x22\' %(x[\'id\'], x[\'renderer\']) for x in context.ERP5Site_getTabList(add_all_tabs=1)])"></tal:block>\n
+  };\n
+  \n
+  $("#container") .css("opacity", 0.5);\n
+\n
+  var url = mapping[this.parentNode.id];\n
+  $.ajax({url:url,\n
+          success: function (data){\n
+                     $("#container") .css("opacity", 1.0);\n
+                     $("#container").html(data);},\n
+          error: function (data){\n
+                     $("#container").innerHTML = "Server side error.";}});\n
+  // Set a cookie.\n
+  document.cookie = \'erp5_site_selected_tab=\' + escape(this.parentNode.id);\n
+  return false;\n
+}\n
+\n
+function addOnClickEventsToTabs() {\n
+  $("#tab_box").find("li").each(\n
+    function (index){\n
+      var node = $(this).find("a").first();\n
+      node.bind("click", selectTab);})\n
+  return true;\n
+}\n
+\n
+$(document).ready(addOnClickEventsToTabs);
+
+]]></unicode> </value>
+        </item>
+        <item>
+            <key> <string>content_type</string> </key>
+            <value> <string>text/html</string> </value>
+        </item>
+        <item>
+            <key> <string>expand</string> </key>
+            <value> <int>0</int> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>erp5_tabber.js</string> </value>
+        </item>
+        <item>
+            <key> <string>output_encoding</string> </key>
+            <value> <string>iso-8859-15</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <unicode></unicode> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_xhtml_jquery_style/bt/revision b/bt5/erp5_xhtml_jquery_style/bt/revision
index c7930257df..301160a930 100644
--- a/bt5/erp5_xhtml_jquery_style/bt/revision
+++ b/bt5/erp5_xhtml_jquery_style/bt/revision
@@ -1 +1 @@
-7
\ No newline at end of file
+8
\ No newline at end of file
-- 
2.30.9