- Patch #501466 by catch: move comment administration to a tab.
parent
acac8741fd
commit
77c643ec17
|
@ -116,7 +116,7 @@ function comment_admin_overview_validate($form, &$form_state) {
|
||||||
// We can't execute any 'Update options' if no comments were selected.
|
// We can't execute any 'Update options' if no comments were selected.
|
||||||
if (count($form_state['values']['comments']) == 0) {
|
if (count($form_state['values']['comments']) == 0) {
|
||||||
form_set_error('', t('Please select one or more comments to perform the update on.'));
|
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();
|
cache_clear_all();
|
||||||
drupal_set_message(t('The update has been performed.'));
|
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) {
|
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_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 {
|
else {
|
||||||
return confirm_form($form,
|
return confirm_form($form,
|
||||||
t('Are you sure you want to delete these comments and all their children?'),
|
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'));
|
t('Delete comments'), t('Cancel'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) {
|
||||||
cache_clear_all();
|
cache_clear_all();
|
||||||
drupal_set_message(t('The comments have been deleted.'));
|
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().
|
* Implement hook_menu().
|
||||||
*/
|
*/
|
||||||
function comment_menu() {
|
function comment_menu() {
|
||||||
$items['admin/content/comment'] = array(
|
$items['admin/content/content/comment'] = array(
|
||||||
'title' => 'Comments',
|
'title' => 'Comments',
|
||||||
'description' => 'List and edit site comments and the comment approval queue.',
|
'description' => 'List and edit site comments and the comment approval queue.',
|
||||||
'page callback' => 'comment_admin',
|
'page callback' => 'comment_admin',
|
||||||
'access arguments' => array('administer comments'),
|
'access arguments' => array('administer comments'),
|
||||||
|
'type' => MENU_LOCAL_TASK,
|
||||||
);
|
);
|
||||||
// Tabs begin here.
|
// Tabs begin here.
|
||||||
$items['admin/content/comment/new'] = array(
|
$items['admin/content/content/comment/new'] = array(
|
||||||
'title' => 'Published comments',
|
'title' => 'Published comments',
|
||||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||||
'weight' => -10,
|
'weight' => -10,
|
||||||
);
|
);
|
||||||
$items['admin/content/comment/approval'] = array(
|
$items['admin/content/content/comment/approval'] = array(
|
||||||
'title' => 'Approval queue',
|
'title' => 'Approval queue',
|
||||||
'page arguments' => array('approval'),
|
'page arguments' => array('approval'),
|
||||||
'access arguments' => array('administer comments'),
|
'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 = array();
|
||||||
$edit['operation'] = $operation;
|
$edit['operation'] = $operation;
|
||||||
$edit['comments[' . $comment->id . ']'] = TRUE;
|
$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') {
|
if ($operation == 'delete') {
|
||||||
$this->drupalPost(NULL, array(), t('Delete comments'));
|
$this->drupalPost(NULL, array(), t('Delete comments'));
|
||||||
|
@ -223,7 +223,7 @@ class CommentHelperCase extends DrupalWebTestCase {
|
||||||
* Comment id.
|
* Comment id.
|
||||||
*/
|
*/
|
||||||
function getUnapprovedComment($subject) {
|
function getUnapprovedComment($subject) {
|
||||||
$this->drupalGet('admin/content/comment/approval');
|
$this->drupalGet('admin/content/content/comment/approval');
|
||||||
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match);
|
preg_match('/href="(.*?)#comment-([^"]+)"(.*?)>(' . $subject . ')/', $this->drupalGetContent(), $match);
|
||||||
|
|
||||||
return $match[2];
|
return $match[2];
|
||||||
|
@ -422,19 +422,19 @@ class CommentAnonymous extends CommentHelperCase {
|
||||||
$this->drupalLogin($this->admin_user);
|
$this->drupalLogin($this->admin_user);
|
||||||
$this->performCommentOperation($anonymous_comment3, 'unpublish');
|
$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.'));
|
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
|
||||||
|
|
||||||
// Publish comment.
|
// Publish comment.
|
||||||
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
|
$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.'));
|
$this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
|
||||||
|
|
||||||
// Delete comment.
|
// Delete comment.
|
||||||
$this->performCommentOperation($anonymous_comment3, 'delete');
|
$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.'));
|
$this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
|
||||||
|
|
||||||
// Reset.
|
// 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() {
|
function testApprovalAdminInterface() {
|
||||||
$this->drupalLogin($this->admin_user);
|
$this->drupalLogin($this->admin_user);
|
||||||
|
|
|
@ -1648,16 +1648,15 @@ function _node_add_access() {
|
||||||
* Implement hook_menu().
|
* Implement hook_menu().
|
||||||
*/
|
*/
|
||||||
function node_menu() {
|
function node_menu() {
|
||||||
$items['admin/content/node'] = array(
|
$items['admin/content/content'] = array(
|
||||||
'title' => 'Content',
|
'title' => 'Content',
|
||||||
'description' => "View, edit, and delete your site's content.",
|
'description' => "View, edit, and delete your site's content.",
|
||||||
'page callback' => 'drupal_get_form',
|
'page callback' => 'drupal_get_form',
|
||||||
'page arguments' => array('node_admin_content'),
|
'page arguments' => array('node_admin_content'),
|
||||||
'access arguments' => array('administer nodes'),
|
'access arguments' => array('administer nodes'),
|
||||||
);
|
);
|
||||||
|
$items['admin/content/content/node'] = array(
|
||||||
$items['admin/content/node/overview'] = array(
|
'title' => 'Content',
|
||||||
'title' => 'List',
|
|
||||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||||
'weight' => -10,
|
'weight' => -10,
|
||||||
);
|
);
|
||||||
|
|
|
@ -402,7 +402,7 @@ class AdminOverviewTestCase extends DrupalWebTestCase {
|
||||||
// Comments on permissions follow the format: [task], [module] that the permission relates to.
|
// Comments on permissions follow the format: [task], [module] that the permission relates to.
|
||||||
$permissions = array();
|
$permissions = array();
|
||||||
$permissions[] = 'access administration pages';
|
$permissions[] = 'access administration pages';
|
||||||
$permissions[] = 'administer comments'; // Content management, Comment.
|
$permissions[] = 'administer nodes'; // Content management, Comment.
|
||||||
$permissions[] = 'administer blocks'; // Site building, Block.
|
$permissions[] = 'administer blocks'; // Site building, Block.
|
||||||
$permissions[] = 'administer filters'; // Site configuration, Filter.
|
$permissions[] = 'administer filters'; // Site configuration, Filter.
|
||||||
$permissions[] = 'administer users'; // User management, User.
|
$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->checkOverview(array(t('Content management'), t('User management'), t('Reports'), t('Site building'), t('Site configuration')));
|
||||||
|
|
||||||
$this->drupalGet('admin/by-module');
|
$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')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue