Commit 765f6905 authored by webchick's avatar webchick

#446898 by RoboPhred: Change URL of text formats settings page to...

#446898 by RoboPhred: Change URL of text formats settings page to admin/settings/formats rather than filter.
parent 276997a1
......@@ -32,8 +32,8 @@ function filter_admin_overview() {
$options[$id] = '';
$form[$id]['name'] = array('#markup' => $format->name);
$form[$id]['roles'] = array('#markup' => $default ? t('All roles may use the default format') : ($roles ? implode(', ', $roles) : t('No roles may use this format')));
$form[$id]['configure'] = array('#markup' => l(t('configure'), 'admin/settings/filter/' . $id));
$form[$id]['delete'] = array('#markup' => $default ? '' : l(t('delete'), 'admin/settings/filter/delete/' . $id));
$form[$id]['configure'] = array('#markup' => l(t('configure'), 'admin/settings/formats/' . $id));
$form[$id]['delete'] = array('#markup' => $default ? '' : l(t('delete'), 'admin/settings/formats/delete/' . $id));
$form[$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight);
}
$form['default'] = array('#type' => 'radios', '#options' => $options, '#default_value' => variable_get('filter_default_format', 1));
......@@ -263,7 +263,7 @@ function filter_admin_format_form_submit($form, &$form_state) {
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/filter';
$return = 'admin/settings/formats';
if (!empty($new)) {
$return .= '/' . $format;
}
......@@ -286,11 +286,11 @@ function filter_admin_delete() {
$form['format'] = array('#type' => 'hidden', '#value' => $format->format);
$form['name'] = array('#type' => 'hidden', '#value' => $format->name);
return confirm_form($form, t('Are you sure you want to delete the text format %format?', array('%format' => $format->name)), 'admin/settings/filter', t('If you have any content left in this text format, it will be switched to the default text format. This action cannot be undone.'), t('Delete'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to delete the text format %format?', array('%format' => $format->name)), 'admin/settings/formats', t('If you have any content left in this text format, it will be switched to the default text format. This action cannot be undone.'), t('Delete'), t('Cancel'));
}
else {
drupal_set_message(t('The default format cannot be deleted.'));
drupal_goto('admin/settings/filter');
drupal_goto('admin/settings/formats');
}
}
else {
......@@ -331,7 +331,7 @@ function filter_admin_delete_submit($form, &$form_state) {
cache_clear_all($form_state['values']['format'] . ':', 'cache_filter', TRUE);
drupal_set_message(t('Deleted text format %format.', array('%format' => $form_state['values']['name'])));
$form_state['redirect'] = 'admin/settings/filter';
$form_state['redirect'] = 'admin/settings/formats';
return;
}
......
......@@ -25,15 +25,15 @@ function filter_help($path, $arg) {
$output .= '<p>' . t('Users with access to more than one text format can use the <em>Text format</em> fieldset to choose between available text formats when creating or editing multi-line content. Administrators determine the text formats available to each user role, select a default text format, and control the order of formats listed in the <em>Text format</em> fieldset.') . '</p>';
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@filter">Filter module</a>.', array('@filter' => 'http://drupal.org/handbook/modules/filter/')) . '</p>';
return $output;
case 'admin/settings/filter':
case 'admin/settings/formats':
$output = '<p>' . t('Use the list below to review the text formats available to each user role, to select a default text format, and to control the order of formats listed in the <em>Text format</em> fieldset. (The <em>Text format</em> fieldset is displayed below textareas when users with access to more than one text format create multi-line content.) The text format selected as <em>Default</em> is available to all users and, unless another format is selected, is applied to all content. All text formats are available to users in roles with the "administer filters" permission.') . '</p>';
$output .= '<p>' . t('Since text formats, if available, are presented in the same order as the list below, it may be helpful to arrange the formats in descending order of your preference for their use. To change the order of an text format, grab a drag-and-drop handle under the <em>Name</em> column and drag to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save changes</em> button at the bottom of the page.') . '</p>';
return $output;
case 'admin/settings/filter/%':
case 'admin/settings/formats/%':
return '<p>' . t('Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this format. If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.', array('@rearrange' => url('admin/settings/filter/' . $arg[3] . '/order'))) . '</p>';
case 'admin/settings/filter/%/configure':
return '<p>' . t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">edit tab</a> first.', array('@url' => url('admin/settings/filter/' . $arg[3]))) . '</p>';
case 'admin/settings/filter/%/order':
case 'admin/settings/formats/%/configure':
return '<p>' . t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">edit tab</a> first.', array('@url' => url('admin/settings/formats/' . $arg[3]))) . '</p>';
case 'admin/settings/formats/%/order':
$output = '<p>' . t('Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted to a clickable link. When this happens, rearrange the order of the filters.') . '</p>';
$output .= '<p>' . t("Filters are executed from top-to-bottom. To change the order of the filters, modify the values in the <em>Weight</em> column or grab a drag-and-drop handle under the <em>Name</em> column and drag filters to new locations in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.") . '</p>';
return $output;
......@@ -70,25 +70,25 @@ function filter_theme() {
* Implement hook_menu().
*/
function filter_menu() {
$items['admin/settings/filter'] = array(
$items['admin/settings/formats'] = array(
'title' => 'Text formats',
'description' => 'Configure how content input by users is filtered, including allowed HTML tags. Also allows enabling of module-provided filters.',
'page callback' => 'drupal_get_form',
'page arguments' => array('filter_admin_overview'),
'access arguments' => array('administer filters'),
);
$items['admin/settings/filter/list'] = array(
$items['admin/settings/formats/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['admin/settings/filter/add'] = array(
$items['admin/settings/formats/add'] = array(
'title' => 'Add text format',
'page callback' => 'filter_admin_format_page',
'access arguments' => array('administer filters'),
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items['admin/settings/filter/delete'] = array(
$items['admin/settings/formats/delete'] = array(
'title' => 'Delete text format',
'page callback' => 'drupal_get_form',
'page arguments' => array('filter_admin_delete'),
......@@ -101,7 +101,7 @@ function filter_menu() {
'access callback' => TRUE,
'type' => MENU_SUGGESTED_ITEM,
);
$items['admin/settings/filter/%filter_format'] = array(
$items['admin/settings/formats/%filter_format'] = array(
'type' => MENU_CALLBACK,
'title callback' => 'filter_admin_format_title',
'title arguments' => array(3),
......@@ -109,12 +109,12 @@ function filter_menu() {
'page arguments' => array(3),
'access arguments' => array('administer filters'),
);
$items['admin/settings/filter/%filter_format/edit'] = array(
$items['admin/settings/formats/%filter_format/edit'] = array(
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
$items['admin/settings/filter/%filter_format/configure'] = array(
$items['admin/settings/formats/%filter_format/configure'] = array(
'title' => 'Configure',
'page callback' => 'filter_admin_configure_page',
'page arguments' => array(3),
......@@ -122,7 +122,7 @@ function filter_menu() {
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);
$items['admin/settings/filter/%filter_format/order'] = array(
$items['admin/settings/formats/%filter_format/order'] = array(
'title' => 'Rearrange',
'page callback' => 'filter_admin_order_page',
'page arguments' => array(3),
......
......@@ -28,15 +28,15 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Change default filter.
$edit = array();
$edit['default'] = $full;
$this->drupalPost('admin/settings/filter', $edit, t('Save changes'));
$this->drupalPost('admin/settings/formats', $edit, t('Save changes'));
$this->assertText(t('Default format updated.'), t('Default filter updated successfully.'));
$this->assertNoRaw('admin/settings/filter/delete/' . $full, t('Delete link not found.'));
$this->assertNoRaw('admin/settings/formats/delete/' . $full, t('Delete link not found.'));
// Add an additional tag.
$edit = array();
$edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>' . ' <quote>'; // Adding <quote> tag.
$this->drupalPost('admin/settings/filter/' . $filtered . '/configure', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $filtered . '/configure', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Allowed HTML tag added.'));
$this->assertRaw(htmlentities($edit['allowed_html_1']), t('Tag displayed.'));
......@@ -48,7 +48,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit = array();
$edit['weights[filter/' . $second_filter . ']'] = 1;
$edit['weights[filter/' . $first_filter . ']'] = 2;
$this->drupalPost('admin/settings/filter/' . $filtered . '/order', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $filtered . '/order', $edit, t('Save configuration'));
$this->assertText(t('The filter ordering has been saved.'), t('Order saved successfully.'));
$result = db_query('SELECT * FROM {filter} WHERE format = :format ORDER BY weight ASC', array(':format' => $filtered));
......@@ -66,7 +66,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit['roles[2]'] = TRUE;
$edit['filters[filter/' . $second_filter . ']'] = TRUE;
$edit['filters[filter/' . $first_filter . ']'] = TRUE;
$this->drupalPost('admin/settings/filter/add', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/add', $edit, t('Save configuration'));
$this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), t('New filter created.'));
$format = $this->getFilter($edit['name']);
......@@ -78,22 +78,22 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$this->assertFieldByName('filters[filter/' . $first_filter . ']', '', t('Url filter found.'));
// Delete new filter.
$this->drupalPost('admin/settings/filter/delete/' . $format->format, array(), t('Delete'));
$this->drupalPost('admin/settings/formats/delete/' . $format->format, array(), t('Delete'));
$this->assertRaw(t('Deleted text format %format.', array('%format' => $edit['name'])), t('Format successfully deleted.'));
}
// Change default filter back.
$edit = array();
$edit['default'] = $filtered;
$this->drupalPost('admin/settings/filter', $edit, t('Save changes'));
$this->drupalPost('admin/settings/formats', $edit, t('Save changes'));
$this->assertText(t('Default format updated.'), t('Default filter updated successfully.'));
$this->assertNoRaw('admin/settings/filter/delete/' . $filtered, t('Delete link not found.'));
$this->assertNoRaw('admin/settings/formats/delete/' . $filtered, t('Delete link not found.'));
// Allow authenticated users on full HTML.
$edit = array();
$edit['roles[2]'] = TRUE;
$this->drupalPost('admin/settings/filter/' . $full, $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $full, $edit, t('Save configuration'));
$this->assertText(t('The text format settings have been updated.'), t('Full HTML format successfully updated.'));
// Switch user.
......@@ -128,20 +128,20 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Allowed tags.
$edit = array();
$edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
$this->drupalPost('admin/settings/filter/' . $filtered . '/configure', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $filtered . '/configure', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Changes reverted.'));
// Full HTML.
$edit = array();
$edit['roles[2]'] = FALSE;
$this->drupalPost('admin/settings/filter/' . $full, $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $full, $edit, t('Save configuration'));
$this->assertText(t('The text format settings have been updated.'), t('Full HTML format successfully reverted.'));
// Filter order.
$edit = array();
$edit['weights[filter/' . $second_filter . ']'] = 2;
$edit['weights[filter/' . $first_filter . ']'] = 1;
$this->drupalPost('admin/settings/filter/' . $filtered . '/order', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/' . $filtered . '/order', $edit, t('Save configuration'));
$this->assertText(t('The filter ordering has been saved.'), t('Order successfully reverted.'));
}
......@@ -234,7 +234,7 @@ class FilterTestCase extends DrupalWebTestCase {
function deleteFormat($format) {
if ($format !== NULL) {
// Delete new filter.
$this->drupalPost('admin/settings/filter/delete/' . $format->format, array(), t('Delete'));
$this->drupalPost('admin/settings/formats/delete/' . $format->format, array(), t('Delete'));
}
}
}
......@@ -13,7 +13,7 @@ class PHPTestCase extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Confirm that the PHP filter is #3.
$this->drupalGet('admin/settings/filter/3');
$this->drupalGet('admin/settings/formats/3');
$this->assertText('PHP code', t('On PHP code filter page.'));
}
......
......@@ -463,7 +463,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
$edit = array(
'filters[filter/4]' => 1,
);
$this->drupalPost('admin/settings/filter/1', $edit, t('Save configuration'));
$this->drupalPost('admin/settings/formats/1', $edit, t('Save configuration'));
// Allow anonymous users to search content.
$edit = array(
DRUPAL_ANONYMOUS_RID . '[search content]' => 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment