svn commit: r966541 - /ofbiz/branches/jquery/framework/images/webapp/images/selectall.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r966541 - /ofbiz/branches/jquery/framework/images/webapp/images/selectall.js

erwan
Author: erwan
Date: Thu Jul 22 08:39:12 2010
New Revision: 966541

URL: http://svn.apache.org/viewvc?rev=966541&view=rev
Log:
OFBIZ-3863 - selectall.js jquery transformation for screenlet toggle

Modified:
    ofbiz/branches/jquery/framework/images/webapp/images/selectall.js

Modified: ofbiz/branches/jquery/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/selectall.js?rev=966541&r1=966540&r2=966541&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/branches/jquery/framework/images/webapp/images/selectall.js Thu Jul 22 08:39:12 2010
@@ -403,67 +403,67 @@ function ajaxAutoCompleteDropDown(descri
 }
 
 /** Toggle area visibility on/off.
-  * @param link The <a> element calling this function
-  * @param areaId The id of the HTML container to toggle
-  * @param expandTxt Localized 'Expand' text
-  * @param collapseTxt Localized 'Collapse' text
+ * @param link The <a> element calling this function
+ * @param areaId The id of the HTML container to toggle
+ * @param expandTxt Localized 'Expand' text
+ * @param collapseTxt Localized 'Collapse' text
 */
 function toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt){
-    var container = $(areaId);
-    var liElement = $(link).up('li');
-    if(container.visible()){
-        liElement.removeClassName('expanded');
-        liElement.addClassName('collapsed');
-        link.title = expandTxt;
-    } else {
-        liElement.removeClassName('collapsed');
-        liElement.addClassName('expanded');
-        link.title = collapseTxt;
-    }
-    Effect.toggle(container, 'appear');
+   var container = jQuery("#" + areaId);
+   var liElement = jQuery(link).parents('li:first');
+   if(container.is(':visible')){
+       liElement.removeClass('expanded');
+       liElement.addClass('collapsed');
+       link.title = expandTxt;
+   } else {
+       liElement.removeClass('collapsed');
+       liElement.addClass('expanded');
+       link.title = collapseTxt;
+   }
+   container.animate({opacity: 'toggle', height: 'toggle'}, "slow");
 }
 
 /** Toggle screenlet visibility on/off.
-  * @param link The <a> element calling this function
-  * @param areaId The id of the HTML container to toggle
-  * @param expandTxt Localized 'Expand' text
-  * @param collapseTxt Localized 'Collapse' text
+ * @param link The <a> element calling this function
+ * @param areaId The id of the HTML container to toggle
+ * @param expandTxt Localized 'Expand' text
+ * @param collapseTxt Localized 'Collapse' text
 */
 function toggleScreenlet(link, areaId, saveCollapsed, expandTxt, collapseTxt){
-    toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt);
-    var container = $(areaId);
-    var screenlet = container.up('div');
-    if(container.visible()){
-        var currentParam = screenlet.id + "_collapsed=false";
-        var newParam = screenlet.id + "_collapsed=true";
-        if(saveCollapsed=='true'){
-            setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'true');
-        }
-    } else {
-        var currentParam = screenlet.id + "_collapsed=true";
-        var newParam = screenlet.id + "_collapsed=false";
-        if(saveCollapsed=='true'){
-            setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'false');
-        }
-    }
-    var paginationMenus = $$('div.nav-pager');
-    paginationMenus.each(function(menu) {
-        if (menu) {
-            var childElements = menu.getElementsByTagName('a');
-            for (var i = 0; i < childElements.length; i++) {
-                if (childElements[i].href.indexOf("http") == 0) {
-                    childElements[i].href = replaceQueryParam(childElements[i].href, currentParam, newParam);
-                }
-            }
-            childElements = menu.getElementsByTagName('select');
-            for (i = 0; i < childElements.length; i++) {
-                if (childElements[i].href.indexOf("location.href") >= 0) {
-                    Element.extend(childElements[i]);
-                    childElements[i].writeAttribute("onchange", replaceQueryParam(childElements[i].readAttribute("onchange"), currentParam, newParam));
-                }
-            }
-        }
-    });
+   toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt);
+   var container = jQuery("#" + areaId);
+   var screenlet = jQuery(link).parents('div:first');;
+   if(container.is(':visible')){
+       var currentParam = screenlet.id + "_collapsed=false";
+       var newParam = screenlet.id + "_collapsed=true";
+       if(saveCollapsed=='true'){
+           setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'true');
+       }
+   } else {
+       var currentParam = screenlet.id + "_collapsed=true";
+       var newParam = screenlet.id + "_collapsed=false";
+       if(saveCollapsed=='true'){
+           setUserLayoutPreferences('GLOBAL_PREFERENCES',screenlet.id+"_collapsed",'false');
+       }
+   }
+   var paginationMenus = jQuery('div.nav-pager');
+   jQuery.each(paginationMenus, function(menu) {
+       if (menu) {
+           var childElements = menu.getElementsByTagName('a');
+           for (var i = 0; i < childElements.length; i++) {
+               if (childElements[i].href.indexOf("http") == 0) {
+                   childElements[i].href = replaceQueryParam(childElements[i].href, currentParam, newParam);
+               }
+           }
+           childElements = menu.getElementsByTagName('select');
+           for (i = 0; i < childElements.length; i++) {
+               if (childElements[i].href.indexOf("location.href") >= 0) {
+                   Element.extend(childElements[i]);
+                   childElements[i].writeAttribute("onchange", replaceQueryParam(childElements[i].readAttribute("onchange"), currentParam, newParam));
+               }
+           }
+       }
+   });
 }
 
 /** In Place Editor for display elements