Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.93 diff -u -r1.93 node.pages.inc --- modules/node/node.pages.inc 19 Oct 2009 02:00:55 -0000 1.93 +++ modules/node/node.pages.inc 29 Oct 2009 16:34:01 -0000 @@ -288,6 +288,45 @@ '#weight' => 15, '#submit' => array('node_form_delete_submit'), ); + // Create a dialog box for the confirmation form. + $form['#attached']['ui'][] = array( + 'library' => 'ui.dialog', + 'selector' => '
' . t('Please wait...') . '
', + 'arguments' => array( + array( + 'autoOpen' => FALSE, + 'title' => t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), + 'modal' => TRUE, + ), + ), + ); + // Open the box when the user clicks on Delete. + $form['#attached']['ui'][] = array( + 'library' => 'ui.dialog', + 'selector' => '#dialog-confirm', + 'arguments' => array('open'), + 'bound_element' => '#edit-delete', + 'event' => 'click', + ); + // When the dialog box displays, load the delete form and display the button. + $form['#attached']['ui'][] = array( + 'action' => 'load', + 'selector' => '#dialog-confirm', + 'arguments' => array(base_path() . "node/{$node->nid}/delete form.confirmation", array(), 'loadComplete'), + 'bound_element' => '#dialog-confirm', + 'event' => 'dialogopen', + 'functions' => array('$("#dialog-confirm input#edit-submit").hide(); + $("#dialog-confirm").dialog("option", "buttons", { + "Delete": function() { + $("#dialog-confirm input#edit-submit").click(); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }); + ', + ), + ); } $form['#validate'][] = 'node_form_validate'; $form['#theme'] = array($node->type . '_node_form', 'node_form');