Commit 9c7b3136 authored by Dries's avatar Dries
Browse files

- Patch #260050 by Gurpartap Singh: move forum administration to site building.

parent b806c1b0
...@@ -93,7 +93,7 @@ function forum_form_submit($form, &$form_state) { ...@@ -93,7 +93,7 @@ function forum_form_submit($form, &$form_state) {
drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_state['values']['name'], '@type' => $type))); drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_state['values']['name'], '@type' => $type)));
break; break;
} }
$form_state['redirect'] = 'admin/content/forum'; $form_state['redirect'] = 'admin/build/forum';
return; return;
} }
...@@ -165,7 +165,7 @@ function forum_confirm_delete(&$form_state, $tid) { ...@@ -165,7 +165,7 @@ function forum_confirm_delete(&$form_state, $tid) {
$form['tid'] = array('#type' => 'value', '#value' => $tid); $form['tid'] = array('#type' => 'value', '#value' => $tid);
$form['name'] = array('#type' => 'value', '#value' => $term->name); $form['name'] = array('#type' => 'value', '#value' => $term->name);
return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/content/forum', t('Deleting a forum or container will also delete its sub-forums, if any. To delete posts in this forum, visit <a href="@content">content administration</a> first. This action cannot be undone.', array('@content' => url('admin/content/node'))), t('Delete'), t('Cancel')); return confirm_form($form, t('Are you sure you want to delete the forum %name?', array('%name' => $term->name)), 'admin/build/forum', t('Deleting a forum or container will also delete its sub-forums, if any. To delete posts in this forum, visit <a href="@content">content administration</a> first. This action cannot be undone.', array('@content' => url('admin/content/node'))), t('Delete'), t('Cancel'));
} }
/** /**
...@@ -176,7 +176,7 @@ function forum_confirm_delete_submit($form, &$form_state) { ...@@ -176,7 +176,7 @@ function forum_confirm_delete_submit($form, &$form_state) {
drupal_set_message(t('The forum %term and all sub-forums have been deleted.', array('%term' => $form_state['values']['name']))); drupal_set_message(t('The forum %term and all sub-forums have been deleted.', array('%term' => $form_state['values']['name'])));
watchdog('content', 'forum: deleted %term and all its sub-forums.', array('%term' => $form_state['values']['name'])); watchdog('content', 'forum: deleted %term and all its sub-forums.', array('%term' => $form_state['values']['name']));
$form_state['redirect'] = 'admin/content/forum'; $form_state['redirect'] = 'admin/build/forum';
return; return;
} }
...@@ -227,10 +227,10 @@ function forum_overview(&$form_state) { ...@@ -227,10 +227,10 @@ function forum_overview(&$form_state) {
$term = $form[$key]['#term']; $term = $form[$key]['#term'];
$form[$key]['view']['#value'] = l($term['name'], 'forum/' . $term['tid']); $form[$key]['view']['#value'] = l($term['name'], 'forum/' . $term['tid']);
if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) { if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) {
$form[$key]['edit']['#value'] = l(t('edit container'), 'admin/content/forum/edit/container/' . $term['tid']); $form[$key]['edit']['#value'] = l(t('edit container'), 'admin/build/forum/edit/container/' . $term['tid']);
} }
else { else {
$form[$key]['edit']['#value'] = l(t('edit forum'), 'admin/content/forum/edit/forum/' . $term['tid']); $form[$key]['edit']['#value'] = l(t('edit forum'), 'admin/build/forum/edit/forum/' . $term['tid']);
} }
} }
} }
...@@ -242,7 +242,7 @@ function forum_overview(&$form_state) { ...@@ -242,7 +242,7 @@ function forum_overview(&$form_state) {
$form['#theme'] = 'taxonomy_overview_terms'; $form['#theme'] = 'taxonomy_overview_terms';
$form['#submit'] = array('taxonomy_overview_terms_submit'); // Use the existing taxonomy overview submit handler. $form['#submit'] = array('taxonomy_overview_terms_submit'); // Use the existing taxonomy overview submit handler.
$form['#validate'] = array('taxonomy_overview_terms_validate'); $form['#validate'] = array('taxonomy_overview_terms_validate');
$form['#empty_text'] = '<em>' . t('There are no existing containers or forums. Containers and forums may be added using the <a href="@container">add container</a> and <a href="@forum">add forum</a> pages.', array('@container' => url('admin/content/forum/add/container'), '@forum' => url('admin/content/forum/add/forum'))) . '</em>'; $form['#empty_text'] = '<em>' . t('There are no existing containers or forums. Containers and forums may be added using the <a href="@container">add container</a> and <a href="@forum">add forum</a> pages.', array('@container' => url('admin/build/forum/add/container'), '@forum' => url('admin/build/forum/add/forum'))) . '</em>';
return $form; return $form;
} }
......
...@@ -21,13 +21,13 @@ function forum_help($path, $arg) { ...@@ -21,13 +21,13 @@ function forum_help($path, $arg) {
$output .= '<li>' . t('selecting <em>Disabled</em> under <em>Comment settings</em> while editing a forum topic will hide all existing comments on the thread, and prevent new ones.') . '</li></ul>'; $output .= '<li>' . t('selecting <em>Disabled</em> under <em>Comment settings</em> while editing a forum topic will hide all existing comments on the thread, and prevent new ones.') . '</li></ul>';
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@forum">Forum module</a>.', array('@forum' => 'http://drupal.org/handbook/modules/forum/')) . '</p>'; $output .= '<p>' . t('For more information, see the online handbook entry for <a href="@forum">Forum module</a>.', array('@forum' => 'http://drupal.org/handbook/modules/forum/')) . '</p>';
return $output; return $output;
case 'admin/content/forum': case 'admin/build/forum':
return '<p>' . t('This page displays a list of existing forums and containers. Containers (optionally) hold forums, and forums hold forum topics (a forum topic is the initial post to a threaded discussion). To provide structure, both containers and forums may be placed inside other containers and forums. To rearrange forums and containers, grab a drag-and-drop handle under the <em>Name</em> column and drag the forum or container 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</em> button at the bottom of the page.') . '</p>'; return '<p>' . t('This page displays a list of existing forums and containers. Containers (optionally) hold forums, and forums hold forum topics (a forum topic is the initial post to a threaded discussion). To provide structure, both containers and forums may be placed inside other containers and forums. To rearrange forums and containers, grab a drag-and-drop handle under the <em>Name</em> column and drag the forum or container 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</em> button at the bottom of the page.') . '</p>';
case 'admin/content/forum/add/container': case 'admin/build/forum/add/container':
return '<p>' . t('By grouping related or similar forums, containers help organize forums. For example, a container named "Food" may hold two forums named "Fruit" and "Vegetables", respectively.') . '</p>'; return '<p>' . t('By grouping related or similar forums, containers help organize forums. For example, a container named "Food" may hold two forums named "Fruit" and "Vegetables", respectively.') . '</p>';
case 'admin/content/forum/add/forum': case 'admin/build/forum/add/forum':
return '<p>' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '</p>'; return '<p>' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '</p>';
case 'admin/content/forum/settings': case 'admin/build/forum/settings':
return '<p>' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the <em>Content types</em> on the <a href="@forum-vocabulary">forum vocabulary page</a>.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', '')))) . '</p>'; return '<p>' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the <em>Content types</em> on the <a href="@forum-vocabulary">forum vocabulary page</a>.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', '')))) . '</p>';
} }
} }
...@@ -88,56 +88,56 @@ function forum_menu() { ...@@ -88,56 +88,56 @@ function forum_menu() {
'access arguments' => array('access content'), 'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM, 'type' => MENU_SUGGESTED_ITEM,
); );
$items['admin/content/forum'] = array( $items['admin/build/forum'] = array(
'title' => 'Forums', 'title' => 'Forums',
'description' => 'Control forums and their hierarchy and change forum settings.', 'description' => 'Control forums and their hierarchy and change forum settings.',
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',
'page arguments' => array('forum_overview'), 'page arguments' => array('forum_overview'),
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
); );
$items['admin/content/forum/list'] = array( $items['admin/build/forum/list'] = array(
'title' => 'List', 'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK, 'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10, 'weight' => -10,
); );
$items['admin/content/forum/add/container'] = array( $items['admin/build/forum/add/container'] = array(
'title' => 'Add container', 'title' => 'Add container',
'page callback' => 'forum_form_main', 'page callback' => 'forum_form_main',
'page arguments' => array('container'), 'page arguments' => array('container'),
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'parent' => 'admin/content/forum', 'parent' => 'admin/build/forum',
); );
$items['admin/content/forum/add/forum'] = array( $items['admin/build/forum/add/forum'] = array(
'title' => 'Add forum', 'title' => 'Add forum',
'page callback' => 'forum_form_main', 'page callback' => 'forum_form_main',
'page arguments' => array('forum'), 'page arguments' => array('forum'),
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'parent' => 'admin/content/forum', 'parent' => 'admin/build/forum',
); );
$items['admin/content/forum/settings'] = array( $items['admin/build/forum/settings'] = array(
'title' => 'Settings', 'title' => 'Settings',
'page callback' => 'drupal_get_form', 'page callback' => 'drupal_get_form',
'page arguments' => array('forum_admin_settings'), 'page arguments' => array('forum_admin_settings'),
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
'weight' => 5, 'weight' => 5,
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,
'parent' => 'admin/content/forum', 'parent' => 'admin/build/forum',
); );
$items['admin/content/forum/edit/%forum_term'] = array( $items['admin/build/forum/edit/%forum_term'] = array(
'page callback' => 'forum_form_main', 'page callback' => 'forum_form_main',
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
); );
$items['admin/content/forum/edit/container/%forum_term'] = array( $items['admin/build/forum/edit/container/%forum_term'] = array(
'title' => 'Edit container', 'title' => 'Edit container',
'page callback' => 'forum_form_main', 'page callback' => 'forum_form_main',
'page arguments' => array('container', 5), 'page arguments' => array('container', 5),
'access arguments' => array('administer forums'), 'access arguments' => array('administer forums'),
'type' => MENU_CALLBACK, 'type' => MENU_CALLBACK,
); );
$items['admin/content/forum/edit/forum/%forum_term'] = array( $items['admin/build/forum/edit/forum/%forum_term'] = array(
'title' => 'Edit forum', 'title' => 'Edit forum',
'page callback' => 'forum_form_main', 'page callback' => 'forum_form_main',
'page arguments' => array('forum', 5), 'page arguments' => array('forum', 5),
......
...@@ -191,7 +191,7 @@ class ForumTestCase extends DrupalWebTestCase { ...@@ -191,7 +191,7 @@ class ForumTestCase extends DrupalWebTestCase {
); );
// Create forum. // Create forum.
$this->drupalPost('admin/content/forum/add/' . $type, $edit, t('Save')); $this->drupalPost('admin/build/forum/add/' . $type, $edit, t('Save'));
$this->assertResponse(200); $this->assertResponse(200);
$type = ($type == 'container') ? 'forum container' : 'forum'; $type = ($type == 'container') ? 'forum container' : 'forum';
$this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created')); $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created'));
......
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