portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r889191 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
Date Thu, 10 Dec 2009 11:14:54 GMT
Author: woonsan
Date: Thu Dec 10 11:14:49 2009
New Revision: 889191

URL: http://svn.apache.org/viewvc?rev=889191&view=rev
Log:
JS2-1057: Localizing event handlers and sharing cookie for all toolbox portlets.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp?rev=889191&r1=889190&r2=889191&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
Thu Dec 10 11:14:49 2009
@@ -42,9 +42,9 @@
     <td class="portlet-section-subheader" colspan='10'>
         <a href="#" id="<portlet:namespace/>portletsTabAction">Portlets</a>
         |
-        <a href="#" id="<portlet:namespace/>layoutsTabAction">Layout</a>
+        <a href="#" id="<portlet:namespace/>layoutTabAction">Layout</a>
         |
-        <a href="#" id="<portlet:namespace/>themesTabAction">Theme</a>
+        <a href="#" id="<portlet:namespace/>themeTabAction">Theme</a>
         |
         <a href="#" id="<portlet:namespace/>widgetsTabAction">Widgets</a>
     </td>
@@ -105,7 +105,7 @@
     </table>
 </div>
 
-<table id="<portlet:namespace/>layoutsTab" style="display: none; border-collapse:
collapse;  width: 100%; margin-top: 0px; margin-bottom: 0px; float: left;">
+<table id="<portlet:namespace/>layoutTab" style="display: none; border-collapse:
collapse;  width: 100%; margin-top: 0px; margin-bottom: 0px; float: left;">
     <tr>
         <th class="portlet-section-header" colspan="2">Layouts</th>
     </tr>
@@ -137,7 +137,7 @@
 </table>
 
 
-<table id="<portlet:namespace/>themesTab" style="display: none; border-collapse:
collapse;  width: 100%; margin-top: 0px; margin-bottom: 0px; float: left;">
+<table id="<portlet:namespace/>themeTab" style="display: none; border-collapse:
collapse;  width: 100%; margin-top: 0px; margin-bottom: 0px; float: left;">
     <tr>
         <th class="portlet-section-header" colspan="2">Themes</th>
     </tr>
@@ -172,16 +172,20 @@
 YUI().use('io', 'json', 'node-base', 'cookie', function(Y) {
 
     function switchTab(e) {
-        var tabId = ('string' == typeof(e) ? e : e.target.get("id"));
-        
-        Y.Node.one("#<portlet:namespace/>portletsTab").setStyle("display", (tabId ==
"<portlet:namespace/>portletsTabAction" ? "" : "none"));
-        Y.Node.one("#<portlet:namespace/>layoutsTab").setStyle("display", (tabId ==
"<portlet:namespace/>layoutsTabAction" ? "" : "none"));
-        Y.Node.one("#<portlet:namespace/>themesTab").setStyle("display", (tabId ==
"<portlet:namespace/>themesTabAction" ? "" : "none"));
-        Y.Node.one("#<portlet:namespace/>widgetsTab").setStyle("display", (tabId ==
"<portlet:namespace/>widgetsTabAction" ? "" : "none"));
+        var tabId = null;
+        if ('string' == typeof(e)) {
+            tabId = e;
+        } else {
+            tabId = e.target.get("id").replace(/TabAction$/, "").substring("<portlet:namespace/>".length);
+        }
+        Y.Node.one("#<portlet:namespace/>portletsTab").setStyle("display", (tabId ==
"portlets" ? "" : "none"));
+        Y.Node.one("#<portlet:namespace/>layoutTab").setStyle("display", (tabId ==
"layout" ? "" : "none"));
+        Y.Node.one("#<portlet:namespace/>themeTab").setStyle("display", (tabId == "theme"
? "" : "none"));
+        Y.Node.one("#<portlet:namespace/>widgetsTab").setStyle("display", (tabId ==
"widgets" ? "" : "none"));
         
         Y.Cookie.set("toolboxtab", tabId);
 
-        if (tabId == "<portlet:namespace/>portletsTabAction") {
+        if (tabId == "portlets") {
 	        var category = Y.Cookie.get("toolboxcat");
 	        if (!category) {
 		        category = "News";
@@ -269,8 +273,7 @@
         Y.Cookie.set("toolboxcat", category);
         var uri = "${portalContextPath}/services/portletregistry/definition/?_type=json";
         uri += "&query=" + category;
-        Y.on('io:complete', onLoadPortletComplete, this, []); 
-        var request = Y.io(uri);
+        var request = Y.io(uri, { on: { complete: onLoadPortletComplete } });
         Y.Node.getDOMNode(Y.Node.one("#<portlet:namespace/>form")).query.value = "";
     }
     
@@ -281,8 +284,7 @@
         if (query) {
             uri += "&query=" + query;
         }
-        Y.on('io:complete', onLoadPortletComplete, this, []); 
-        var request = Y.io(uri);
+        var request = Y.io(uri, { on: { complete: onLoadPortletComplete } });
         
         Y.Node.getDOMNode(Y.Node.one("#<portlet:namespace/>categories")).selectedIndex
= 0;
 
@@ -302,27 +304,27 @@
         if (portletUniqueName) {
             var re = new RegExp("\\" + "${portalServletPath}" + "(\\/|$)");
             var uri = location.href.replace(re, "/services/").replace(/#$/, "");
-            Y.on('io:complete', onAddPortletComplete, this, []);
             var config = {
+                    on: { complete: onAddPortletComplete },
                     method: "POST",
                     data: "type=portlet&name=" + portletUniqueName 
                 };
             var request = Y.io(uri, config);
         }
-            
+        
         e.halt();
     };
     
     Y.on("click", switchTab, "#<portlet:namespace/>portletsTabAction");
-    Y.on("click", switchTab, "#<portlet:namespace/>layoutsTabAction");
-    Y.on("click", switchTab, "#<portlet:namespace/>themesTabAction");
+    Y.on("click", switchTab, "#<portlet:namespace/>layoutTabAction");
+    Y.on("click", switchTab, "#<portlet:namespace/>themeTabAction");
     Y.on("click", switchTab, "#<portlet:namespace/>widgetsTabAction");
     Y.on("change", loadPortletsInCategory, "#<portlet:namespace/>categories");
     Y.on("submit", loadPortletsByQuery, "#<portlet:namespace/>form");
     
     var tabId = Y.Cookie.get("toolboxtab");
     if (!tabId) {
-        tabId = "<portlet:namespace/>portletsTabAction";
+        tabId = "portlets";
     }
     
     switchTab(tabId);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message