svn commit: r1042348 - /ofbiz/trunk/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: r1042348 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

jleroux@apache.org
Author: jleroux
Date: Sun Dec  5 13:37:07 2010
New Revision: 1042348

URL: http://svn.apache.org/viewvc?rev=1042348&view=rev
Log:
A patch from Anne Jessel "Collapse all broken if hyperlink in pane" (https://issues.apache.org/jira/browse/OFBIZ-4022) - OFBIZ-4022

To reproduce the bug:
    * edit the EditProduct form in applications/product/widget/catalog/ProductForms.xml
    * add a new field with a hyperlink sub-element.
    * refer to this new field in the first, non-collapsible field-group in the sort-order
    * go to this page in the UI (edit a product in the catalog)
    * the Expand All and Collapse All buttons do not work properly

The problem is caused by the javascript finding the added hyperlink field in the first field-group, and incorrectly assuming it is
the expand/collapse link for the field-group. This causes the javascript to crash when it gets a null reference to an enclosing li element.

It is not specific to the EditProduct form, but applies to any group of collapsible panes where one contains a hyperlink.

The attached patch simply checks that the li element actually exists.

Modified:
    ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1042348&r1=1042347&r2=1042348&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Sun Dec  5 13:37:07 2010
@@ -444,16 +444,18 @@ function ajaxAutoCompleteDropDown(descri
 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;
+    if (liElement){
+        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');
     }
-    Effect.toggle(container, 'appear');
 }
 
 /** Toggle screenlet visibility on/off.