Index: node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.519
diff -u -F^function -r1.519 node.module
--- node.module 11 Aug 2005 12:53:39 -0000 1.519
+++ node.module 21 Aug 2005 15:38:01 -0000
@@ -758,14 +758,24 @@ function node_admin_nodes() {
drupal_set_message(t('The items have been deleted.'));
}
else {
- $extra = '
';
- foreach ($edit['nodes'] as $nid => $value) {
- if ($value) {
- $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
- $extra .= '- '. form_hidden('nodes]['. $nid, 1) . check_plain($title) .'
';
+ //theme nodes to delete into a list, injecting any module-specific data
+ $list = array();
+ //this line pulls all of the checked node's nids from the $edit array
+ $nids = array_keys(array_intersect($edit['nodes'], array('1')));
+ foreach ($nids as $nid) {
+ $node = node_load($nid);
+ $extras = node_invoke_nodeapi(&$node, 'delete pre');
+ //check to see if any module has cancelled deletion for the node. if not, add to the list
+ if (!in_array(FALSE, $extras)) {
+ $list[] = form_hidden('nodes]['. $node->nid, 1) . check_plain($node->title) . implode('', $extras);
}
+
}
- $extra .= '
';
+ //back to the admin page if no list items present
+ if (count($list) == 0) {
+ drupal_goto('admin/node');
+ }
+ $extra = theme_item_list($list);
$extra .= form_hidden('operation', 'delete');
$output = theme('confirm',
@@ -1588,7 +1598,13 @@ function node_delete($edit) {
watchdog('content', t('%type: deleted %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))));
}
else {
- $extra = form_hidden('nid', $node->nid);
+ $extras = node_invoke_nodeapi(&$node, 'delete pre');
+ //check to see if any module has cancelled deletion for the node. if not, add extras
+ if (!in_array(FALSE, $extras)) {
+ $extra = form_hidden('nid', $node->nid) . implode('', $extras);
+ } else {
+ drupal_goto('node/'.$node->nid.'/edit');
+ }
$output = theme('confirm',
t('Are you sure you want to delete %title?', array('%title' => theme('placeholder', $node->title))),
$_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid,