? misc/collapse.js Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.452 diff -u -r1.452 common.inc --- includes/common.inc 31 May 2005 21:14:25 -0000 1.452 +++ includes/common.inc 2 Jun 2005 08:17:23 -0000 @@ -1110,6 +1110,33 @@ } /** + * Format a group of form items. + * + * @param $legend + * The label for the form item group. + * @param $group + * The form items within the group, as an HTML string. + * @param $collapsed + * A boolean value decided whether the group starts collapsed. + * @param $description + * Explanatory text to display after the form item group. + * @param $attributes + * An associative array of HTML attributes to add to the fieldset tag. + * @return + * A themed HTML string representing the form item group. + */ +function form_group_collapsible($legend, $group, $collapsed = FALSE, $description = NULL, $attributes = NULL) { + drupal_add_js('misc/collapse.js'); + + $attributes['class'] .= ' collapsible'; + if ($collapsed) { + $attributes['class'] .= ' collapsed'; + } + + return '' . ($legend ? ''. $legend .'' : '') . $group . ($description ? '
'. $description .'
' : '') . "\n"; +} + +/** * Format a radio button. * * @param $title Index: misc/drupal.css =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.css,v retrieving revision 1.107 diff -u -r1.107 drupal.css --- misc/drupal.css 31 May 2005 23:23:48 -0000 1.107 +++ misc/drupal.css 2 Jun 2005 08:17:32 -0000 @@ -586,3 +586,30 @@ input.throbbing { background-position: 100% -18px; } + +/* +** Collapsing fieldsets +*/ +html.js fieldset.collapsed { + border-bottom-width: 0; + border-left-width: 0; + border-right-width: 0; +} + +html.js fieldset.collapsed * { + display: none; +} + +html.js fieldset.collapsed legend, +html.js fieldset.collapsed legend * { + display: inline; +} + +html.js fieldset.collapsible legend a { + padding-left: 15px; + background: url('menu-expanded.png') 5px 50% no-repeat; +} + +html.js fieldset.collapsed legend a { + background-image: url('menu-collapsed.png'); +} Index: misc/drupal.js =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.js,v retrieving revision 1.2 diff -u -r1.2 drupal.js --- misc/drupal.js 1 Jun 2005 17:43:33 -0000 1.2 +++ misc/drupal.js 2 Jun 2005 09:07:16 -0000 @@ -15,7 +15,7 @@ // Global Killswitch if (isJsEnabled()) { - + document.documentElement.className = 'js'; } /** Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.213 diff -u -r1.213 system.module --- modules/system.module 1 Jun 2005 04:17:37 -0000 1.213 +++ modules/system.module 2 Jun 2005 09:06:12 -0000 @@ -203,7 +203,7 @@ // We will use a random URL so there is no way a proxy or a browser could cache the "no such image" answer. $group .= ''; - $output = form_group(t('General settings'), $group); + $output = form_group_collapsible(t('General settings'), $group); // Error handling: $period = drupal_map_assoc(array(3600, 10800, 21600, 32400, 43200, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval'); @@ -213,12 +213,12 @@ $group .= form_select(t('Error reporting'), 'error_level', variable_get('error_level', 1), array(t('Write errors to the log'), t('Write errors to the log and to the screen')), t('Where Drupal, PHP and SQL errors are logged. On a production server it is recommended that errors are only written to the error log. On a test server it can be helpful to write logs to the screen.')); $group .= form_select(t('Discard log entries older than'), 'watchdog_clear', variable_get('watchdog_clear', 604800), $period, t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')); - $output .= form_group(t('Error handling'), $group); + $output .= form_group_collapsible(t('Error handling'), $group); // Caching: $group = form_radios(t('Page cache'), 'cache', variable_get('cache', CACHE_DISABLED), array(CACHE_DISABLED => t('Disabled (low-traffic sites)'), CACHE_ENABLED_STRICT => t('Strict (medium-traffic sites)'), CACHE_ENABLED_LOOSE => t('Loose (high-traffic sites)')), t("Drupal has a caching mechanism which stores dynamically generated web pages in a database. By caching a web page, Drupal does not have to create the page each time someone wants to view it, instead it takes only one SQL query to display it, reducing response time and the server's load. Only pages requested by \"anonymous\" users are cached. In order to reduce server load and save bandwidth, Drupal stores and sends cached pages compressed. Drupal supports strict caching and loose caching. Strict caching immediately deletes cached data as soon as it becomes invalid for any user. Loose caching delays the deletion of cached data to provide better performance for high traffic sites.")); - $output .= form_group(t('Cache settings'), $group); + $output .= form_group_collapsible(t('Cache settings'), $group); // File system: $directory_path = variable_get('file_directory_path', 'files'); @@ -230,7 +230,7 @@ $group = form_textfield(t('File system path'), 'file_directory_path', $directory_path, 70, 255, t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')); $group .= form_textfield(t('Temporary directory'), 'file_directory_temp', $directory_temp, 70, 255, t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')); $group .= form_radios(t('Download method'), 'file_downloads', variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), t('If you want any sort of access control on the downloading of files, this needs to be set to private. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')); - $output .= form_group(t('File system settings'), $group); + $output .= form_group_collapsible(t('File system settings'), $group); // Image handling: $group = ''; @@ -240,7 +240,7 @@ } $group .= image_toolkit_invoke('settings'); if ($group) { - $output .= form_group(t('Image handling'), $group); + $output .= form_group_collapsible(t('Image handling'), '

'.$group.'

'); } // Date settings: @@ -276,7 +276,7 @@ $group .= form_select(t('Long date format'), 'date_format_long', variable_get('date_format_long', $datelong[0]), $datelongchoices, t('Longer date format used for detailed display.')); $group .= form_select(t('First day of week'), 'date_first_day', variable_get('date_first_day', 0), array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), t('The first day of the week for calendar views.')); - $output .= form_group(t('Date settings'), $group); + $output .= form_group_collapsible(t('Date settings'), $group); return $output; }