diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-07-20 10:48:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-07-20 10:48:20 +0000 |
commit | 31387c5a77f6331a65360ddc9acd1e8053da2e3f (patch) | |
tree | 8781ead559d92cd2a4caa93d8ceeb7fbaa65e588 /modules/node.module | |
parent | 02ca763ea0e93e7b0bb9cf13e2d9810e753c982c (diff) | |
download | brdo-31387c5a77f6331a65360ddc9acd1e8053da2e3f.tar.gz brdo-31387c5a77f6331a65360ddc9acd1e8053da2e3f.tar.bz2 |
- Patch #26467 by drumm: make the destination persist across multiple pages
and fixed the node delete form to use a return destination.
Diffstat (limited to 'modules/node.module')
-rw-r--r-- | modules/node.module | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/modules/node.module b/modules/node.module index cc1d36a40..9871ae87e 100644 --- a/modules/node.module +++ b/modules/node.module @@ -673,7 +673,7 @@ function node_menu($may_cache) { 'weight' => 1, 'type' => MENU_LOCAL_TASK); $items[] = array('path' => 'node/'. arg(1) .'/delete', 'title' => t('delete'), - 'callback' => 'node_page', + 'callback' => 'node_delete_page', 'access' => node_access('delete', $node), 'weight' => 1, 'type' => MENU_CALLBACK); @@ -1696,21 +1696,15 @@ function node_page() { return node_preview($edit); } break; - case 'delete': + case t('Delete'): // Note: we redirect from node/uid/edit to node/uid/delete to make the tabs disappear. - if ($_GET['q'] == 'node/'. arg(1) .'/edit') { + if ($_REQUEST['destination']) { + $destination = drupal_get_destination(); unset($_REQUEST['destination']); - drupal_goto('node/'. arg(1) .'/delete'); } - $edit['nid'] = $edit['nid'] ? $edit['nid'] : arg(1); - $output = node_delete($edit); - if (!$output) { - drupal_set_message(t('The node has been deleted.')); - drupal_goto('admin/node'); - } - return node_delete($edit); - break; + drupal_goto('node/'. arg(1) .'/delete', $destination); + default: drupal_set_title(''); return node_page_default(); @@ -1718,6 +1712,20 @@ function node_page() { } /** + * Menu callback; the page for deleting a single node. + */ +function node_delete_page() { + $edit = $_POST['edit']; + $edit['nid'] = $edit['nid'] ? $edit['nid'] : arg(1); + $node = node_load($edit['nid']); + if (!($output = node_delete($edit))) { + drupal_set_message(t('%title has been deleted.', array('%title' => theme('placeholder', $node->title)))); + drupal_goto(''); + } + return $output; +} + +/** * Implementation of hook_update_index(). */ function node_update_index() { |