You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2010/12/05 14:44:10 UTC

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

Author: jleroux
Date: Sun Dec  5 13:44:09 2010
New Revision: 1042349

URL: http://svn.apache.org/viewvc?rev=1042349&view=rev
Log:
>From Anne Jessel's patch at "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.

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=1042349&r1=1042348&r2=1042349&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/branches/jquery/framework/images/webapp/images/selectall.js Sun Dec  5 13:44:09 2010
@@ -563,15 +563,17 @@ function ajaxAutoCompleteDropDown() {
 function toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt){
    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;
-   }
+    if (liElement) {
+      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");
 }