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