You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bu...@apache.org on 2009/02/03 14:12:50 UTC

svn commit: r740296 - in /ofbiz/trunk: applications/product/widget/catalog/CommonScreens.xml framework/images/webapp/images/selectall.js

Author: buscob
Date: Tue Feb  3 13:12:49 2009
New Revision: 740296

URL: http://svn.apache.org/viewvc?rev=740296&view=rev
Log:
Added ExpandAll function in javascript. This allows to expand or collapse all fieldgroups present in a page.
An example on how to use is present in the CommonProductDecorator
TODO: does not work on IE

Modified:
    ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml
    ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml?rev=740296&r1=740295&r2=740296&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/CommonScreens.xml Tue Feb  3 13:12:49 2009
@@ -85,6 +85,9 @@
                                             <link target="CreateVirtualWithVariantsForm" text="${uiLabelMap.ProductNewVirtualProduct}" style="buttontext"/>
                                             <link target="/ecommerce/control/product?product_id=${productId}" url-mode="inter-app" text="${uiLabelMap.ProductProductPage}" style="buttontext"/>
                                             <link target="ProductBarCode.pdf?productId=${productId}&amp;productName=${productName}" target-window="_blank" text="${uiLabelMap.ProductBarcode}" style="buttontext"/>
+
+                                            <link target="javascript:expandAll(true);"  text="Expand All" style="buttontext" url-mode="plain"/>
+                                            <link target="javascript:expandAll(false);" text="Collapse All" style="buttontext" url-mode="plain"/>
                                         </container>
                                     </widgets>
                                 </section>

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=740296&r1=740295&r2=740296&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Tue Feb  3 13:12:49 2009
@@ -457,3 +457,25 @@
     button.className = button.className.substring(0, button.className.length - " disabled".length);
     button.value = button.value.substring(0, button.value.length - 1);
 }
+
+function expandAll(expanded) {
+  var divs,divs1,i,j,links,groupbody;
+
+  divs=document.getElementsByTagName('div');
+  for(i=0;i<divs.length;i++) {
+    if(/fieldgroup$/.test(divs[i].className)) {      
+      links=divs[i].getElementsByTagName('a');
+      if(links.length>0) {
+        divs1=divs[i].getElementsByTagName('div');
+        for(j=0;j<divs1.length;j++){
+          if(/fieldgroup-body/.test(divs1[j].className)) {
+            groupbody=divs1[j];
+          }
+        }
+        if(groupbody.visible() != expanded) {
+          toggleCollapsiblePanel(links[0], groupbody.id, 'expand', 'collapse');
+        }
+      }
+    }
+  }
+}