Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.366 diff -u -p -r1.366 form.inc --- includes/form.inc 25 Aug 2009 21:16:31 -0000 1.366 +++ includes/form.inc 27 Aug 2009 04:13:43 -0000 @@ -1595,6 +1595,7 @@ function form_get_options($element, $key function theme_fieldset($element) { if (!empty($element['#collapsible'])) { $element['#attached_js']['misc/collapse.js'] = array(); + drupal_add_js('misc/collapse.js'); /* TEMPORARY FIX for http://drupal.org/node/505084 and 559838 */ if (!isset($element['#attributes']['class'])) { $element['#attributes']['class'] = array(); Index: misc/collapse.js =================================================================== RCS file: /cvs/drupal/drupal/misc/collapse.js,v retrieving revision 1.23 diff -u -p -r1.23 collapse.js --- misc/collapse.js 27 Apr 2009 20:19:35 -0000 1.23 +++ misc/collapse.js 27 Aug 2009 04:13:43 -0000 @@ -10,6 +10,7 @@ Drupal.toggleFieldset = function (fields // that alters the default submit button behavior. var content = $('> div:not(.action)', fieldset); $(fieldset).removeClass('collapsed'); + $('> legend > a > img', fieldset).replaceWith(Drupal.collapseLinkImage(false)); content.hide(); content.slideDown({ duration: 'fast', @@ -29,6 +30,7 @@ Drupal.toggleFieldset = function (fields $('div.action', fieldset).hide(); var content = $('> div:not(.action)', fieldset).slideUp('fast', function () { $(this.parentNode).addClass('collapsed'); + $('> legend > a > img', this.parentNode).replaceWith(Drupal.collapseLinkImage(true)); this.parentNode.animating = false; }); } @@ -71,7 +73,7 @@ Drupal.behaviors.collapse = { // Turn the legend into a clickable link and wrap the contents of the fieldset // in a div for easier animation var text = this.innerHTML; - $(this).empty().append($('' + text + '').click(function () { + $(this).empty().append($('' + Drupal.collapseLinkImage(true) + ' ' + text + '').click(function () { var fieldset = $(this).parents('fieldset:first')[0]; // Don't animate multiple times if (!fieldset.animating) { @@ -88,4 +90,28 @@ Drupal.behaviors.collapse = { } }; +/** + * Construct the image for the collapse/expand link. + * + * Parameters: + * collapsed: true if collapsed, false if expanded + * + * Returns the HTML for the img element. + */ +Drupal.collapseLinkImage = function (collapsed) { + Drupal.settings.img_src_collapsed = 'misc/menu-collapsed.png'; + Drupal.settings.img_src_expanded = 'misc/menu-expanded.png'; + var img_src_collapsed = Drupal.settings.img_src_collapsed; + var img_src_expanded = Drupal.settings.img_src_expanded; + if (typeof(Drupal.settings.base_path) !== 'undefined') { + img_src_collapsed = Drupal.settings.base_path + img_src_collapsed; + img_src_expanded = Drupal.settings.base_path + img_src_expanded; + } + if (collapsed) { + return '' + Drupal.t('Show') + ''; + } else { + return '' + Drupal.t('Hide') + ''; + } +}; + })(jQuery); Index: modules/system/system.css =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.css,v retrieving revision 1.61 diff -u -p -r1.61 system.css --- modules/system/system.css 24 Aug 2009 03:11:34 -0000 1.61 +++ modules/system/system.css 27 Aug 2009 04:13:44 -0000 @@ -325,8 +325,9 @@ html.js fieldset.collapsed legend { } html.js fieldset.collapsible legend a { display: inline; - padding-left: 15px; /* LTR */ - background: url(../../misc/menu-expanded.png) 5px 75% no-repeat; /* LTR */ +} +html.js fieldset.collapsible legend a img { + display: inline; } html.js fieldset.collapsible legend span.summary { display: inline; @@ -334,10 +335,6 @@ html.js fieldset.collapsible legend span color: #999; margin-left: 0.5em; } -html.js fieldset.collapsed legend a { - background-image: url(../../misc/menu-collapsed.png); /* LTR */ - background-position: 5px 50%; /* LTR */ -} /* Note: IE-only fix due to '* html' (breaks Konqueror otherwise). */ * html.js fieldset.collapsed legend, * html.js fieldset.collapsed legend *, Index: themes/garland/style.css =================================================================== RCS file: /cvs/drupal/drupal/themes/garland/style.css,v retrieving revision 1.63 diff -u -p -r1.63 style.css --- themes/garland/style.css 17 Aug 2009 19:05:26 -0000 1.63 +++ themes/garland/style.css 27 Aug 2009 04:13:44 -0000 @@ -858,19 +858,10 @@ html.js fieldset.collapsed { padding-bottom: .6em; } -html.js fieldset.collapsible legend a { - padding-left: 2em; /* LTR */ - background: url(images/menu-expanded.gif) no-repeat 0% 50%; /* LTR */ -} - html.js fieldset.collapsible legend span.summary { color: #898989; } -html.js fieldset.collapsed legend a { - background: url(images/menu-collapsed.gif) no-repeat 0% 50%; /* LTR */ -} - /** * Vertical tabs. */