From df492f35aefd05af71bf15c08443f3da38e596a3 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Thu, 9 Feb 2006 07:46:04 +0000
Subject: [PATCH] - Patch #43622 / #46627 by markus: 'delete the selected
 posts' operation on admin/node doesn't work.

---
 modules/node.module      | 14 ++++++++------
 modules/node/node.module | 14 ++++++++------
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/modules/node.module b/modules/node.module
index 6cf44a50b543..417410763689 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -866,9 +866,6 @@ function node_menu($may_cache) {
       'access' => user_access('administer nodes'));
     $items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
       'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/node/action', 'title' => t('content'),
-      'callback' => 'node_admin_nodes',
-      'type' => MENU_CALLBACK);
 
     if (module_exist('search')) {
       $items[] = array('path' => 'admin/node/search', 'title' => t('search'),
@@ -1121,7 +1118,12 @@ function node_admin_nodes_submit($form_id, $edit) {
 function node_admin_nodes_validate($form_id, $edit) {
   $edit['nodes'] = array_diff($edit['nodes'], array(0));
   if (count($edit['nodes']) == 0) {
-    form_set_error('', t('Please select some items to perform the update on.'));
+    if ($edit['operation'] == 'delete') {
+      form_set_error('', t('Please select some items to perform the delete operation.'));
+    }
+    else {
+      form_set_error('', t('Please select some items to perform the update on.'));
+    }
   }
 }
 
@@ -1129,7 +1131,7 @@ function node_admin_nodes() {
   global $form_values;
   $output = node_filter_form();
 
-  if ($_POST['edit']['operation'] == 'delete') {
+  if ($_POST['edit']['operation'] == 'delete' && $_POST['edit']['nodes']) {
     return node_multiple_delete_confirm();
   }
 
@@ -1161,7 +1163,7 @@ function node_admin_nodes() {
   $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
 
   $form['#method'] = 'post';
-  $form['#action'] =  url('admin/node/action');
+  $form['#action'] =  url('admin/node');
 
   // Call the form first, to allow for the form_values array to be populated.
   $output .= drupal_get_form('node_admin_nodes', $form);
diff --git a/modules/node/node.module b/modules/node/node.module
index 6cf44a50b543..417410763689 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -866,9 +866,6 @@ function node_menu($may_cache) {
       'access' => user_access('administer nodes'));
     $items[] = array('path' => 'admin/node/overview', 'title' => t('list'),
       'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/node/action', 'title' => t('content'),
-      'callback' => 'node_admin_nodes',
-      'type' => MENU_CALLBACK);
 
     if (module_exist('search')) {
       $items[] = array('path' => 'admin/node/search', 'title' => t('search'),
@@ -1121,7 +1118,12 @@ function node_admin_nodes_submit($form_id, $edit) {
 function node_admin_nodes_validate($form_id, $edit) {
   $edit['nodes'] = array_diff($edit['nodes'], array(0));
   if (count($edit['nodes']) == 0) {
-    form_set_error('', t('Please select some items to perform the update on.'));
+    if ($edit['operation'] == 'delete') {
+      form_set_error('', t('Please select some items to perform the delete operation.'));
+    }
+    else {
+      form_set_error('', t('Please select some items to perform the update on.'));
+    }
   }
 }
 
@@ -1129,7 +1131,7 @@ function node_admin_nodes() {
   global $form_values;
   $output = node_filter_form();
 
-  if ($_POST['edit']['operation'] == 'delete') {
+  if ($_POST['edit']['operation'] == 'delete' && $_POST['edit']['nodes']) {
     return node_multiple_delete_confirm();
   }
 
@@ -1161,7 +1163,7 @@ function node_admin_nodes() {
   $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
 
   $form['#method'] = 'post';
-  $form['#action'] =  url('admin/node/action');
+  $form['#action'] =  url('admin/node');
 
   // Call the form first, to allow for the form_values array to be populated.
   $output .= drupal_get_form('node_admin_nodes', $form);
-- 
GitLab