Commit 77c643ec authored by Dries's avatar Dries
Browse files

- Patch #501466 by catch: move comment administration to a tab.

parent acac8741
......@@ -116,7 +116,7 @@ function comment_admin_overview_validate($form, &$form_state) {
// We can't execute any 'Update options' if no comments were selected.
if (count($form_state['values']['comments']) == 0) {
form_set_error('', t('Please select one or more comments to perform the update on.'));
drupal_goto('admin/content/comment');
drupal_goto('admin/content/content/comment');
}
}
......@@ -147,7 +147,7 @@ function comment_admin_overview_submit($form, &$form_state) {
}
cache_clear_all();
drupal_set_message(t('The update has been performed.'));
$form_state['redirect'] = 'admin/content/comment';
$form_state['redirect'] = 'admin/content/content/comment';
}
}
......@@ -183,12 +183,12 @@ function comment_multiple_delete_confirm(&$form_state) {
if (!$comment_counter) {
drupal_set_message(t('There do not appear to be any comments to delete, or your selected comment was deleted by another administrator.'));
drupal_goto('admin/content/comment');
drupal_goto('admin/content/content/comment');
}
else {
return confirm_form($form,
t('Are you sure you want to delete these comments and all their children?'),
'admin/content/comment', t('This action cannot be undone.'),
'admin/content/content/comment', t('This action cannot be undone.'),
t('Delete comments'), t('Cancel'));
}
}
......@@ -207,7 +207,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) {
cache_clear_all();
drupal_set_message(t('The comments have been deleted.'));
}
$form_state['redirect'] = 'admin/content/comment';
$form_state['redirect'] = 'admin/content/content/comment';
}
/**
......
......@@ -159,19 +159,20 @@ function comment_theme() {
* Implement hook_menu().
*/
function comment_menu() {
$items['admin/content/comment'] = array(
$items['admin/content/content/comment'] = array(
'title' => 'Comments',
'description' => 'List and edit site comments and the comment approval queue.',
'page callback' => 'comment_admin',
'access arguments' => array('administer comments'),
'type' => MENU_LOCAL_TASK,
);
// Tabs begin here.
$items['admin/content/comment/new'] = array(
$items['admin/content/content/comment/new'] = array(
'title' => 'Published comments',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/content/comment/approval'] = array(
$items['admin/content/content/comment/approval'] = array(
'title' => 'Approval queue',
'page arguments' => array('approval'),
'access arguments' => array('administer comments'),
......@@ -2409,3 +2410,11 @@ function comment_ranking() {
),
);
}
/**
* Implement hook_menu_alter().
*/
function comment_menu_alter(&$items) {
// Add comments to the description for admin/content/content.
$items['admin/content/content']['description'] = "View, edit, and delete your site's content and comments.";
}
......@@ -203,7 +203,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$edit = array();
$edit['operation'] = $operation;
$edit['comments[' . $comment->id . ']'] = TRUE;
$this->drupalPost('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
$this->drupalPost('admin/content/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
if ($operation == 'delete') {
$this->drupalPost(NULL, array(), t('Delete comments'));
......@@ -223,7 +223,7 @@ class CommentHelperCase extends DrupalWebTestCase {
* Comment id.
*/
function getUnapprovedComment($subject) {
$this->drupalGet('admin/content/comment/approval');
$this->drupalGet('admin/content/content/comment/approval');
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match);
return $match[2];
......@@ -422,19 +422,19 @@ class CommentAnonymous extends CommentHelperCase {
$this->drupalLogin($this->admin_user);
$this->performCommentOperation($anonymous_comment3, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
$this->drupalGet('admin/content/content/comment/approval');
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
// Publish comment.
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
$this->drupalGet('admin/content/content/comment');
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
// Delete comment.
$this->performCommentOperation($anonymous_comment3, 'delete');
$this->drupalGet('admin/content/comment');
$this->drupalGet('admin/content/content/comment');
$this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
// Reset.
......@@ -562,7 +562,7 @@ class CommentApprovalTest extends CommentHelperCase {
}
/**
* Test comment approval functionality through admin/content/comment.
* Test comment approval functionality through admin/content/content/comment.
*/
function testApprovalAdminInterface() {
$this->drupalLogin($this->admin_user);
......
......@@ -1648,16 +1648,15 @@ function _node_add_access() {
* Implement hook_menu().
*/
function node_menu() {
$items['admin/content/node'] = array(
$items['admin/content/content'] = array(
'title' => 'Content',
'description' => "View, edit, and delete your site's content.",
'page callback' => 'drupal_get_form',
'page arguments' => array('node_admin_content'),
'access arguments' => array('administer nodes'),
);
$items['admin/content/node/overview'] = array(
'title' => 'List',
$items['admin/content/content/node'] = array(
'title' => 'Content',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
......
......@@ -402,7 +402,7 @@ class AdminOverviewTestCase extends DrupalWebTestCase {
// Comments on permissions follow the format: [task], [module] that the permission relates to.
$permissions = array();
$permissions[] = 'access administration pages';
$permissions[] = 'administer comments'; // Content management, Comment.
$permissions[] = 'administer nodes'; // Content management, Comment.
$permissions[] = 'administer blocks'; // Site building, Block.
$permissions[] = 'administer filters'; // Site configuration, Filter.
$permissions[] = 'administer users'; // User management, User.
......@@ -414,7 +414,7 @@ class AdminOverviewTestCase extends DrupalWebTestCase {
$this->checkOverview(array(t('Content management'), t('User management'), t('Reports'), t('Site building'), t('Site configuration')));
$this->drupalGet('admin/by-module');
$this->checkOverview(array(t('Comment'), t('Block'), t('Filter'), t('User'), t('Database logging')));
$this->checkOverview(array(t('Node'), t('Block'), t('Filter'), t('User'), t('Database logging')));
}
/**
......
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