Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.54 diff -u -r1.54 node.pages.inc --- modules/node/node.pages.inc 5 Feb 2009 03:42:58 -0000 1.54 +++ modules/node/node.pages.inc 8 Feb 2009 00:05:58 -0000 @@ -248,14 +248,30 @@ '#weight' => 10, '#submit' => array('node_form_build_preview'), ); - if (!empty($node->nid) && node_access('delete', $node)) { + if (!empty($node->nid)) { $form['buttons']['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), '#weight' => 15, '#submit' => array('node_form_delete_submit'), + '#access' => node_access('delete', $node), ); } + + // Generate a URL for the cancel link. + if (!isset($_REQUEST['destination']) || $_REQUEST['destination'] == $_GET['q']) { + $cancel_url = !empty($node->nid) ? 'node/'. $node->nid : ''; + } + else { + $cancel_url = $_REQUEST['destination']; + } + + $form['buttons']['cancel'] = array( + '#type' => 'markup', + '#markup' => l(t('Cancel'), $cancel_url, array('attributes' => array('class' => 'cancel'))), + '#weight' => 20, + ); + $form['#validate'][] = 'node_form_validate'; $form['#theme'] = array($node->type . '_node_form', 'node_form');