Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.37 diff -u -p -r1.37 filter.admin.inc --- modules/filter/filter.admin.inc 24 Aug 2009 00:14:20 -0000 1.37 +++ modules/filter/filter.admin.inc 25 Aug 2009 06:13:49 -0000 @@ -142,27 +142,49 @@ function filter_admin_format_form(&$form $form['roles'][$rid]['#disabled'] = TRUE; } } - // Table with filters - $all = filter_list_all(); - $enabled = filter_list_format($format->format); - $form['filters'] = array('#type' => 'fieldset', + // @todo Move back into 'filters' when vertical tabs support #title and + // #description. + $form['filters_heading'] = array( + '#type' => 'item', '#title' => t('Filters'), '#description' => t('Choose the filters that will be used in this text format.'), - '#tree' => TRUE, ); + $form['filter_settings'] = array( + '#type' => 'vertical_tabs', + '#attributes' => array('#id' => 'foo'), + '#attached_js' => array( + drupal_get_path('module', 'filter') . '/filter.admin.js', + ), + ); + $all = filter_list_all(); + $enabled = filter_list_format($format->format); foreach ($all as $id => $filter) { $filter_info = module_invoke($filter->module, 'filter_info'); - $form['filters'][$id] = array('#type' => 'checkbox', + $form['filters'][$id] = array( + '#type' => 'fieldset', + '#title' => $filter->title, + '#group' => 'filter_settings', + '#tree' => TRUE, + ); + $form['filters'][$id]['enabled'] = array( + '#type' => 'checkbox', '#title' => $filter->title, '#default_value' => isset($enabled[$id]), '#description' => $filter_info[$filter->name]['description'], + '#parents' => array('filters', $id), ); + if (isset($filter_info[$filter->name]['settings callback']) && function_exists($filter_info[$filter->name]['settings callback'])) { + $settings = $filter_info[$filter->name]['settings callback']($format->format); + $settings['#parents'] = array('filter_settings', $id); + $form['filters'][$id]['settings'] = _system_settings_form_automatic_defaults($settings); + } } + if (!empty($format->format)) { $form['format'] = array('#type' => 'hidden', '#value' => $format->format); - // Composition tips (guidelines) + // Output preview of text format guidelines. $tips = _filter_tips($format->format, FALSE); $tiplist = theme('filter_tips', $tips, FALSE); if (!$tiplist) { @@ -231,6 +253,16 @@ function filter_admin_format_form_submit )); // Check if there are any 'no cache' filters. $cache &= !module_invoke($module, 'filter', 'no cache', $filter_name); + // Store filter configuration. + // @see system_settings_form_submit() + if (!empty($form_state['values']['filter_settings'][$id]) && is_array($form_state['values']['filter_settings'][$id])) { + foreach ($form_state['values']['filter_settings'][$id] as $key => $value) { + if (is_array($value) && isset($form_state['values']['array_filter'])) { + $value = array_keys(array_filter($value)); + } + variable_set($key, $value); + } + } } $query->execute(); } @@ -262,15 +294,8 @@ function filter_admin_format_form_submit ->condition('format', $format) ->execute(); + // Clear the filter's cache when configuration settings are saved. cache_clear_all($format . ':', 'cache_filter', TRUE); - - // If a new filter was added, return to the main list of filters. Otherwise, stay on edit filter page to show new changes. - $return = 'admin/settings/formats'; - if (!empty($new)) { - $return .= '/' . $format; - } - $form_state['redirect'] = $return; - return; } /** @@ -343,42 +368,6 @@ function filter_admin_configure_page($fo } /** - * Build a form to change the settings for a format's filters. - * - * @ingroup forms - */ -function filter_admin_configure(&$form_state, $format) { - $list = filter_list_format($format->format); - $form = array(); - foreach ($list as $filter) { - $filter_info = module_invoke($filter->module, 'filter_info'); - if (isset($filter_info[$filter->name]['settings callback']) && function_exists($filter_info[$filter->name]['settings callback'])) { - $form_module = call_user_func($filter_info[$filter->name]['settings callback'], $format->format); - } - if (isset($form_module) && is_array($form_module)) { - $form = array_merge($form, $form_module); - } - } - - if (!empty($form)) { - $form = system_settings_form($form, TRUE); - } - else { - $form['error'] = array('#markup' => t('No settings are available.')); - } - $form['format'] = array('#type' => 'hidden', '#value' => $format->format); - $form['#submit'][] = 'filter_admin_configure_submit'; - return $form; -} - -/** - * Clear the filter's cache when configuration settings are saved. - */ -function filter_admin_configure_submit($form, &$form_state) { - cache_clear_all($form_state['values']['format'] . ':', 'cache_filter', TRUE); -} - -/** * Menu callback; display form for ordering filters for a format. */ function filter_admin_order_page($format) { Index: modules/filter/filter.admin.js =================================================================== RCS file: modules/filter/filter.admin.js diff -N modules/filter/filter.admin.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/filter/filter.admin.js 25 Aug 2009 06:13:37 -0000 @@ -0,0 +1,33 @@ +// $Id: node.js,v 1.4 2009/04/27 20:19:37 webchick Exp $ + +(function ($) { + +Drupal.behaviors.filterFieldsetSummaries = { + attach: function (context) { + // Cherry-pick all fieldsets in the vertical tabs group. If that makes sense. ;) + // @todo There seems to be no way to attach a CSS id to target a specific + // vertical tabs group. + $('.vertical-tabs fieldset', context).each(function () { + var $fieldset = $(this); + // Get the fucking tab. + var tab = $fieldset.data('verticalTab'); + // Abuse the summary updater to... + $fieldset.setSummary(function (context) { + if ($('.form-checkbox:first', context).is(':checked')) { + // ...highlight enabled filters. + $(tab.item).addClass('ok'); + // @todo Accessibility? + // return Drupal.t('Enabled'); + } + else { + // ...remove highlight for disabled filters. + $(tab.item).removeClass('ok'); + // @todo Accessibility? + // return Drupal.t('Disabled'); + } + }); + }); + } +}; + +})(jQuery); Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.278 diff -u -p -r1.278 filter.module --- modules/filter/filter.module 25 Aug 2009 03:04:13 -0000 1.278 +++ modules/filter/filter.module 25 Aug 2009 06:16:29 -0000 @@ -119,15 +119,6 @@ function filter_menu() { 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0, ); - $items['admin/settings/formats/%filter_format/configure'] = array( - 'title' => 'Configure', - 'page callback' => 'filter_admin_configure_page', - 'page arguments' => array(3), - 'access arguments' => array('administer filters'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 1, - 'file' => 'filter.admin.inc', - ); $items['admin/settings/formats/%filter_format/order'] = array( 'title' => 'Rearrange', 'page callback' => 'filter_admin_order_page', @@ -687,12 +678,7 @@ function filter_filter_info() { * Settings for the HTML filter. */ function _filter_html_settings($format) { - $form['filter_html'] = array( - '#type' => 'fieldset', - '#title' => t('HTML filter'), - '#collapsible' => TRUE, - ); - $form['filter_html']["allowed_html_$format"] = array( + $form["allowed_html_$format"] = array( '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#default_value' => variable_get("allowed_html_$format", '
    1. '), @@ -700,13 +686,13 @@ function _filter_html_settings($format) '#maxlength' => 1024, '#description' => t('Specify a list of tags which should not be stripped. (Note that JavaScript event attributes are always stripped.)'), ); - $form['filter_html']["filter_html_help_$format"] = array( + $form["filter_html_help_$format"] = array( '#type' => 'checkbox', '#title' => t('Display HTML help'), '#default_value' => variable_get("filter_html_help_$format", 1), '#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'), ); - $form['filter_html']["filter_html_nofollow_$format"] = array( + $form["filter_html_nofollow_$format"] = array( '#type' => 'checkbox', '#title' => t('Spam link deterrent'), '#default_value' => variable_get("filter_html_nofollow_$format", FALSE), @@ -738,12 +724,7 @@ function _filter_html($text, $format) { * Settings for URL filter. */ function _filter_url_settings($format) { - $form['filter_urlfilter'] = array( - '#type' => 'fieldset', - '#title' => t('URL filter'), - '#collapsible' => TRUE, - ); - $form['filter_urlfilter']['filter_url_length_' . $format] = array( + $form['filter_url_length_' . $format] = array( '#type' => 'textfield', '#title' => t('Maximum link text length'), '#default_value' => variable_get('filter_url_length_' . $format, 72), 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 25 Aug 2009 05:34:48 -0000 @@ -88,9 +88,11 @@ div.warning, table tr.warning { div.ok { border: 1px solid #00aa00; } -div.ok, tr.ok { +div.ok, tr.ok, li.ok { background: #dfd; color: #020; +} +div.ok, tr.ok { padding: 2px; } .item-list .icon { 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 25 Aug 2009 06:28:30 -0000 @@ -892,6 +892,10 @@ div.vertical-tabs ul.vertical-tabs-list border-color: #d9eaf5; } +div.vertical-tabs ul.vertical-tabs-list li.ok { + background-color: #ddffdd; +} + div.vertical-tabs ul.vertical-tabs-list li strong { font-weight: normal; }