- Patch #83007 by edkwh: fixed multi-comment delete.

5.x
Dries Buytaert 2006-09-17 19:09:34 +00:00
parent a28ee0cceb
commit cb8201c337
1 changed files with 13 additions and 9 deletions

View File

@ -102,8 +102,7 @@ function comment_menu($may_cache) {
'path' => 'admin/content/comment',
'title' => t('comments'),
'description' => t('List and edit site comments and the comment moderation queue.'),
'callback' => 'drupal_get_form',
'callback arguments' => array('comment_admin_overview'),
'callback' => 'comment_admin',
'access' => $access
);
@ -115,8 +114,8 @@ function comment_menu($may_cache) {
$items[] = array('path' => 'admin/content/comment/list/new', 'title' => t('published comments'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/content/comment/list/approval', 'title' => t('approval queue'),
'callback' => 'drupal_get_form',
'callback arguments' => array('comment_admin_overview', 'approval'),
'callback' => 'comment_admin',
'callback arguments' => array('approval'),
'access' => $access,
'type' => MENU_LOCAL_TASK);
@ -1000,20 +999,25 @@ function comment_operations($action = NULL) {
/**
* Menu callback; present an administrative comment listing.
*/
function comment_admin_overview($type = 'new') {
function comment_admin($type = 'new') {
$edit = $_POST;
if ($edit['operation'] == 'delete') {
return comment_multiple_delete_confirm();
return drupal_get_form('comment_multiple_delete_confirm');
}
else {
return drupal_get_form('comment_admin_overview', $type, arg(4));
}
}
function comment_admin_overview($type = 'new', $arg) {
// build an 'Update options' form
$form['options'] = array(
'#type' => 'fieldset', '#title' => t('Update options'),
'#prefix' => '<div class="container-inline">', '#suffix' => '</div>'
);
$options = array();
foreach (comment_operations(arg(4) == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
foreach (comment_operations($arg == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
$options[$key] = $value[0];
}
$form['options']['operation'] = array('#type' => 'select', '#options' => $options, '#default_value' => 'publish');
@ -1146,8 +1150,8 @@ function comment_multiple_delete_confirm() {
* Perform the actual comment deletion.
*/
function comment_multiple_delete_confirm_submit($form_id, $form_values) {
if ($edit['confirm']) {
foreach ($edit['comments'] as $cid => $value) {
if ($form_values['confirm']) {
foreach ($form_values['comments'] as $cid => $value) {
$comment = _comment_load($cid);
_comment_delete_thread($comment);
_comment_update_node_statistics($comment->nid);