Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.279 diff -u -r1.279 filter.module --- modules/filter/filter.module 25 Aug 2009 10:35:32 -0000 1.279 +++ modules/filter/filter.module 25 Aug 2009 23:49:08 -0000 @@ -53,6 +53,10 @@ 'arguments' => array('form' => NULL), 'file' => 'filter.admin.inc', ), + 'filter_admin_format_form' => array( + 'arguments' => array('form' => NULL), + 'file' => 'filter.admin.inc', + ), 'filter_tips' => array( 'arguments' => array('tips' => NULL, 'long' => FALSE), 'file' => 'filter.pages.inc', @@ -119,24 +123,7 @@ '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', - 'page arguments' => array(3), - 'access arguments' => array('administer filters'), - 'type' => MENU_LOCAL_TASK, - 'weight' => 2, - 'file' => 'filter.admin.inc', - ); + return $items; } @@ -683,12 +670,7 @@ * 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. '), @@ -696,13 +678,13 @@ '#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), @@ -734,12 +716,7 @@ * 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/filter/filter.css =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.css,v retrieving revision 1.1 diff -u -r1.1 filter.css --- modules/filter/filter.css 30 Mar 2009 03:15:40 -0000 1.1 +++ modules/filter/filter.css 25 Aug 2009 23:49:02 -0000 @@ -35,3 +35,8 @@ .text-format-wrapper .description { margin-top: 0.5em; } + +#filter-order tr.odd .form-item, +#filter-ordertr.even .form-item { + white-space: normal; +} \ No newline at end of file Index: modules/filter/filter.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v retrieving revision 1.38 diff -u -r1.38 filter.admin.inc --- modules/filter/filter.admin.inc 25 Aug 2009 10:35:32 -0000 1.38 +++ modules/filter/filter.admin.inc 25 Aug 2009 23:49:02 -0000 @@ -146,19 +146,41 @@ $filter_info = filter_get_filters(); $enabled = filter_list_format($format->format); - $form['filters'] = array('#type' => 'fieldset', - '#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', ); + foreach ($filter_info as $name => $filter) { - $form['filters'][$name] = array( - '#type' => 'checkbox', + $form['filters'][$name]['title'] = array( + '#type' => 'item', '#title' => $filter['title'], - '#default_value' => isset($enabled[$name]), '#description' => $filter['description'], ); + $form['filters'][$name]['enabled'] = array( + '#type' => 'checkbox', + '#default_value' => isset($enabled[$name]), + ); + $form['filters'][$name]['weight'] = array( + '#type' => 'weight', + '#delta' => 50, + '#default_value' => 0 + ); + + + if (isset($filter_info[$name]['settings callback']) && function_exists($filter_info[$name]['settings callback'])) { + $settings_form = $filter_info[$name]['settings callback']($format->format); + $form['filters'][$name]['settings'] = array( + '#type' => 'fieldset', + '#title' => $filter['title'], + '#group' => 'filter_settings', + '#tree' => TRUE, + 'form' => $settings_form, + ); + } + } + if (!empty($format->format)) { $form['format'] = array('#type' => 'hidden', '#value' => $format->format); @@ -176,6 +198,8 @@ $form['tips'] = array('#markup' => '

      ' . t('Formatting guidelines') . '

      ' . $group); } $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); + + $form['#attached_css'][] = drupal_get_path('module', 'filter') . '/filter.css'; return $form; } @@ -269,6 +293,38 @@ return; } +function theme_filter_admin_format_form($form) { + $header = array( + t('Filter'), + array('data' => t('Enabled'), 'class' => array('checkbox')), + t('Weight'), + array('data' => t('Operations'), 'colspan' => '3'), + ); + + $rows = array(); + foreach (element_children($form['filters']) as $name) { + $form['filters'][$name]['weight']['#attributes']['class'] = array('filter-order-weight'); + $rows[] = array( + 'data' => array( + array('data' => drupal_render($form['filters'][$name]['title'])), + drupal_render($form['filters'][$name]['enabled']), + drupal_render($form['filters'][$name]['weight']), + t('Configure'), + ), + 'class' => array('draggable'), + ); + } + + $output = drupal_render($form['name']); + $output .= drupal_render($form['roles']); + $output .= theme('table', $header, $rows, array('id' => 'filter-order'), t('Choose the filters that will be used in this text format.')); + $output .= drupal_render($form['filter_settings']); + $output .= drupal_render_children($form); + + drupal_add_tabledrag('filter-order', 'order', 'sibling', 'filter-order-weight', NULL, NULL, TRUE); + + return $output;} + /** * Menu callback; confirm deletion of a format. *