? block.module.diff
? block.module_5.diff
? comment.module_4.diff
? forum.module_0.diff
? image_toolkit.patch
? node-admin.patch
? node.module_1.diff
? postgres_patch.diff
? search.patch
? search_block_1.patch
? upload.diff
? upload_permissions_0.patch
? watchdog.patch
? includes/js.inc
? misc/drupal.js
? misc/watchdog-icons.zip
cvs diff: Diffing .
cvs diff: Diffing database
cvs diff: Diffing includes
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.223
diff -u -r1.223 theme.inc
--- includes/theme.inc	30 Jan 2005 09:53:19 -0000	1.223
+++ includes/theme.inc	3 Mar 2005 19:48:38 -0000
@@ -849,6 +849,57 @@
   }
   return $output;
 }
+
+/**
+ * Output a confirmation form
+ *
+ * This function outputs a complete form for confirming an action. A link is
+ * offered to go back to the item that is being changed in case the user changes
+ * his/her mind.
+ *
+ * You should use $_POST['edit'][$name] (where $name is usually 'confirm') to
+ * check if the confirmation was succesful.
+ *
+ * @param $question
+ *   The question to ask the user (e.g. "Are you sure you want to delete the
+ *   block <em>foo</em>?").
+ * @param $path
+ *   The page to go to if the user denies the action.
+ * @param $description
+ *   Additional text to display (defaults to "This action cannot be undone.").
+ * @param $yes
+ *   A caption for the button which confirms the action (e.g. "Delete",
+ *   "Replace", ...).
+ * @param $no
+ *   A caption for the link which denies the action (e.g. "Cancel").
+ * @param $extra
+ *   Additional HTML to inject into the form, for example form_hidden()s.
+ * @param $name
+ *   The internal name used to refer to the confirmation item.
+ * @return
+ *   A themed HTML string representing the form.
+ */
+function theme_confirm($question, $path, $description = NULL, $yes = NULL, $no = NULL, $extra = NULL, $name = 'confirm') {
+  drupal_set_title($question);
+
+  if (is_null($description)) {
+    $description = t('This action cannot be undone.');
+  }
+
+  $output .= '<p>'. $description ."</p>\n";
+  if (!is_null($extra)) {
+    $output .= $extra;
+  }
+  $output .= '<div class="container-inline">';
+  $output .= form_submit($yes ? $yes : t('Confirm'));
+  $output .= l($no ? $no : t('Cancel'), $path);
+  $output .= "</div>\n";
+
+  $output .= form_hidden($name, 1);
+  return form($output, 'post', NULL, array('class' => 'confirmation'));
+}
+
+
 /**
  * @} End of "defgroup themeable".
  */
cvs diff: Diffing misc
cvs diff: Diffing modules
Index: modules/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block.module,v
retrieving revision 1.155
diff -u -r1.155 block.module
--- modules/block.module	3 Mar 2005 05:54:25 -0000	1.155
+++ modules/block.module	3 Mar 2005 19:48:42 -0000
@@ -312,18 +312,20 @@
 function block_box_delete($bid = 0) {
   $op = $_POST['op'];
   $box = block_box_get($bid);
+  $info = $box['info'] ? $box['info'] : $box['title'];
 
-  switch ($op) {
-    case t('Delete'):
-      db_query('DELETE FROM {boxes} WHERE bid = %d', $bid);
-      drupal_set_message(t('The block %name has been deleted.', array('%name' => '<em>'. $box['info'] .'</em>')));
-      cache_clear_all();
-      drupal_goto('admin/block');
-
-    default:
-      $form = '<p>'. t('Are you sure you want to delete the block %name?', array('%name' => '<em>'. $box['info'] .'</em>')) ."</p>\n";
-      $form .= form_submit(t('Delete'));
-      $output = form($form);
+  if ($_POST['edit']['confirm']) {
+    db_query('DELETE FROM {boxes} WHERE bid = %d', $bid);
+    drupal_set_message(t('The block %name has been deleted.', array('%name' => '<em>'. $info .'</em>')));
+    cache_clear_all();
+    drupal_goto('admin/block');
+  }
+  else {
+    $output = theme('confirm',
+                    t('Are you sure you want to delete the block %name?', array('%name' => '<em>'. $info .'</em>')),
+                    'admin/block',
+                    NULL,
+                    t('Delete'));
   }
 
   print theme('page', $output);
Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.336
diff -u -r1.336 comment.module
--- modules/comment.module	27 Feb 2005 02:56:12 -0000	1.336
+++ modules/comment.module	3 Mar 2005 19:48:54 -0000
@@ -951,7 +951,7 @@
 
   // We'll only delete if the user has confirmed the
   // deletion using the form in our else clause below.
-  if ($comment->cid && $_POST['op'] == t('Delete')) {
+  if ($comment->cid && $_POST['edit']['confirm']) {
     drupal_set_message(t('The comment and all its replies have been deleted.'));
 
     // Delete comment and its replies.
@@ -966,11 +966,15 @@
 
   }
   else if ($comment->cid) {
-    drupal_set_message(t('Do you want to delete this comment and all its replies?'));
+    $output = theme('confirm',
+                    t('Are you sure you want to delete the comment %title?', array('%title' => '<em>'. $comment->subject .'</em>')),
+                    'node/'. $comment->nid,
+                    t('Any replies to this comment will be lost. This action cannot be undone.'),
+                    t('Delete'));
+    // Show comment that is being deleted
     $comment->comment = check_output($comment->comment, $comment->format);
-    $output  = theme('comment', $comment);
-    $output .= form_submit(t('Delete'));
-    $output = form($output);
+    $output .= theme('comment', $comment);
+
   }
   else {
     drupal_set_message(t('The comment no longer exists.'));
Index: modules/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter.module,v
retrieving revision 1.52
diff -u -r1.52 filter.module
--- modules/filter.module	23 Jan 2005 22:29:28 -0000	1.52
+++ modules/filter.module	3 Mar 2005 19:49:01 -0000
@@ -377,7 +377,7 @@
  */
 function filter_admin_delete() {
   $edit = $_POST['edit'];
-  if ($_POST['op'] == t('Delete')) {
+  if ($edit['confirm']) {
     if ($edit['format'] != variable_get('filter_default_format', 1)) {
       db_query("DELETE FROM {filter_formats} WHERE format = %d", $edit['format']);
       db_query("DELETE FROM {filters} WHERE format = %d", $edit['format']);
@@ -397,11 +397,16 @@
   $format = arg(3);
   $format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
 
-  $form .= form_hidden('format', $format->format);
-  $form .= form_hidden('name', $format->name);
-  $form .= '<p>'. t('Are you sure you want to delete the input format %format? If you have any content left in this input format, it will be switched to the default input format.', array('%format' => '<em>'. $format->name .'</em>')) ."</p>\n";
-  $form .= form_submit(t('Delete'));
-  print theme('page', form($form));
+  $extra  = form_hidden('format', $format->format);
+  $extra .= form_hidden('name', $format->name);
+  $output = theme('confirm',
+                  t('Are you sure you want to delete the input format %format?', array('%format' => '<em>'. $format->name .'</em>')),
+                  'admin/filters',
+                  t('If you have any content left in this input format, it will be switched to the default input format. This action cannot be undone.'),
+                  t('Delete'),
+                  t('Cancel'),
+                  $extra);
+  print theme('page', $output);
 }
 
 /**
Index: modules/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum.module,v
retrieving revision 1.231
diff -u -r1.231 forum.module
--- modules/forum.module	3 Mar 2005 05:10:28 -0000	1.231
+++ modules/forum.module	3 Mar 2005 19:49:06 -0000
@@ -126,14 +126,17 @@
  * @param $tid ID of the term to be deleted
  */
 function _forum_confirm_del($tid) {
-   $term = taxonomy_get_term($tid);
-
-   $form .= form_hidden('confirm', 1);
-   $form .= form_hidden('tid', $tid);
-   $form .= form_submit(t('Delete'));
-   $form .= form_submit(t('Cancel'));
+  $term = taxonomy_get_term($tid);
 
-   return form(form_item(t('Delete "%name"', array('%name' => $term->name)), $form, t('Deleteing a forum or container will delete all sub-forums as well.  Are you sure you want to delete?')));
+  $extra = form_hidden('tid', $tid);
+  $output = theme('confirm',
+                  t('Are you sure you want to delete the forum %name?', array('%name' => '<em>'. $term->name .'</em>')),
+                  'admin/forums',
+                  t('Deleting a forum or container will delete all sub-forums as well. This action cannot be undone.'),
+                  t('Delete'),
+                  t('Cancel'),
+                  $extra);
+  print theme('page', $output);
 }
 
 /**
Index: modules/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale.module,v
retrieving revision 1.118
diff -u -r1.118 locale.module
--- modules/locale.module	9 Jan 2005 09:22:39 -0000	1.118
+++ modules/locale.module	3 Mar 2005 19:49:08 -0000
@@ -260,44 +260,28 @@
   include_once 'includes/locale.inc';
   $edit = &$_POST['edit'];
 
-  switch ($_POST['op']) {
+  if ($_POST['op'] == t('Save configuration')) {
     // Save changes to existing languages
-    case t('Save configuration'):
-      $languages = locale_supported_languages(FALSE, TRUE);
-      foreach($languages['name'] as $key => $value) {
-        if ($edit['sitedefault'] == $key) {
-          $edit['enabled'][$key] = 1; // autoenable the default language
-        }
-        if ($key == 'en') {
-          // Disallow name change for English locale
-          db_query("UPDATE {locales_meta} SET isdefault = %d, enabled = %d WHERE locale = 'en'", ($edit['sitedefault'] == $key), $edit['enabled'][$key]);
-        }
-        else {
-          db_query("UPDATE {locales_meta} SET name = '%s', isdefault = %d, enabled = %d WHERE locale = '%s'", $edit['name'][$key], ($edit['sitedefault'] == $key), $edit['enabled'][$key], $key);
-        }
+    $languages = locale_supported_languages(FALSE, TRUE);
+    foreach($languages['name'] as $key => $value) {
+      if ($edit['sitedefault'] == $key) {
+        $edit['enabled'][$key] = 1; // autoenable the default language
+      }
+      if ($key == 'en') {
+        // Disallow name change for English locale
+        db_query("UPDATE {locales_meta} SET isdefault = %d, enabled = %d WHERE locale = 'en'", ($edit['sitedefault'] == $key), $edit['enabled'][$key]);
       }
-
-      // Changing the locale settings impacts the interface:
-      cache_clear_all();
-
-      break;
-
-    // Remove existing language
-    case t('Delete'):
-      $languages = locale_supported_languages(FALSE, TRUE);
-      if (isset($languages['name'][$edit['langcode']])) {
-        db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $edit['langcode']);
-        db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $edit['langcode']);
-        $message = t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>'));
-        drupal_set_message($message);
-        watchdog('locale', $message);
+      else {
+        db_query("UPDATE {locales_meta} SET name = '%s', isdefault = %d, enabled = %d WHERE locale = '%s'", $edit['name'][$key], ($edit['sitedefault'] == $key), $edit['enabled'][$key], $key);
       }
+    }
 
-      // Changing the locale settings impacts the interface:
-      cache_clear_all();
+    // Changing the locale settings impacts the interface:
+    cache_clear_all();
 
-      break;
+    drupal_goto('admin/locale/language/overview');
   }
+
   print theme('page', _locale_admin_manage_screen());
 }
 
@@ -307,6 +291,23 @@
 function locale_admin_manage_delete_screen() {
   include_once 'includes/locale.inc';
   $langcode = arg(4);
+  $edit = $_POST['edit'];
+
+  // Check confirmation and if so, delete language
+  if ($edit['confirm']) {
+    $languages = locale_supported_languages(FALSE, TRUE);
+    if (isset($languages['name'][$edit['langcode']])) {
+      db_query("DELETE FROM {locales_meta} WHERE locale = '%s'", $edit['langcode']);
+      db_query("DELETE FROM {locales_target} WHERE locale = '%s'", $edit['langcode']);
+      $message = t('%locale language removed.', array('%locale' => '<em>'. t($languages['name'][$edit['langcode']]) .'</em>'));
+      drupal_set_message($message);
+      watchdog('locale', $message);
+    }
+
+    // Changing the locale settings impacts the interface:
+    cache_clear_all();
+    drupal_goto('admin/locale/language/overview');
+  }
 
   // Do not allow deletion of English locale
   if ($langcode == 'en') {
@@ -315,10 +316,17 @@
   }
 
   // For other locales, warn user that data loss is ahead
-  $form = form_hidden('langcode', $langcode);
-  $form .= form_submit(t('Delete'));
   $languages = locale_supported_languages(FALSE, TRUE);
-  print theme('page', form(form_item(t("Delete language '%name'", array('%name' => t($languages['name'][$langcode]))), $form, t('Are you sure you want to delete the language and all data associated with it?')), 'POST', url('admin/locale/language/overview')));
+
+  $extra = form_hidden('langcode', $langcode);
+  $output = theme('confirm',
+                  t('Are you sure you want to delete the language %name?', array('%name' => '<em>'. t($languages['name'][$langcode]) .'</em>')),
+                  'admin/locale/language/overview',
+                  t('Deleting a language will remove all data associated with it. This action cannot be undone.'),
+                  t('Delete'),
+                  t('Cancel'),
+                  $extra);
+  print theme('page', $output);
 }
 
 /**
Index: modules/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu.module,v
retrieving revision 1.26
diff -u -r1.26 menu.module
--- modules/menu.module	23 Nov 2004 22:20:41 -0000	1.26
+++ modules/menu.module	3 Mar 2005 19:49:12 -0000
@@ -113,17 +113,17 @@
 function menu_reset() {
   $op = $_POST['op'];
   switch ($op) {
-    case t('Reset'):
+    case t('Reset all'):
       db_query('DELETE FROM {menu}');
       drupal_set_message(t('All menu items reset.'));
       drupal_goto('admin/menu');
       break;
-    case t('Cancel'):
-      drupal_goto('admin/menu');
-      break;
     default:
-      $output = '<p>'. t('Are you sure you want to reset all menu items to their default settings? Any custom menu items will be lost.') .'</p>';
-      $output .= form(form_submit(t('Reset')) . form_submit(t('Cancel')));
+      $output = theme('confirm',
+                      t('Are you sure you want to reset all menu items to their default settings?', array('%item' => '<em>'. $title .'</em>')),
+                      'admin/menu',
+                      t('Any custom additions or changes to the menu will be lost.'),
+                      t('Reset all'));
       print theme('page', $output);
   }
 }
@@ -164,12 +164,13 @@
       drupal_set_message(t('Menu item reset.'));
       drupal_goto('admin/menu');
       break;
-    case t('Cancel'):
-      drupal_goto('admin/menu');
-      break;
     default:
-      $output = '<p>'. t('Are you sure you want to reset this item to its default values?') .'</p>';
-      $output .= form(form_submit(t('Reset')) . form_submit(t('Cancel')));
+      $title = db_result(db_query('SELECT title FROM {menu} WHERE mid = %d', $mid));
+      $output = theme('confirm',
+                      t('Are you sure you want to reset the item %item to its default values?', array('%item' => '<em>'. $title .'</em>')),
+                      'admin/menu',
+                      t('Any customizations will be lost. This action cannot be undone.'),
+                      t('Reset'));
       print theme('page', $output);
   }
 }
@@ -179,18 +180,30 @@
  */
 function menu_delete_item($mid) {
   $op = $_POST['op'];
+  $result = db_query('SELECT type, title FROM {menu} WHERE mid = %d', $mid);
+  $menu = db_fetch_object($result);
+  if (!$menu) {
+    drupal_goto('admin/menu');
+  }
   switch ($op) {
     case t('Delete'):
       db_query('DELETE FROM {menu} WHERE mid = %d', $mid);
-      drupal_set_message(t('Menu item deleted.'));
-      drupal_goto('admin/menu');
-      break;
-    case t('Cancel'):
+      if ($menu->type & MENU_IS_ROOT) {
+        drupal_set_message(t('Menu deleted.'));
+      }
+      else {
+        drupal_set_message(t('Menu item deleted.'));
+      }
       drupal_goto('admin/menu');
       break;
     default:
-      $output = '<p>'. t('Are you sure you want to delete this custom menu item?') .'</p>';
-      $output .= form(form_submit(t('Delete')) . form_submit(t('Cancel')));
+      if ($menu->type & MENU_IS_ROOT) {
+        $message = t('Are you sure you want to delete the menu %item?', array('%item' => '<em>'. $menu->title .'</em>'));
+      }
+      else {
+        $message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => '<em>'. $menu->title .'</em>'));
+      }     
+      $output = theme('confirm', $message, 'admin/menu', t('This action cannot be undone.'), t('Delete'));
       print theme('page', $output);
   }
 }
Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.471
diff -u -r1.471 node.module
--- modules/node.module	1 Mar 2005 20:07:48 -0000	1.471
+++ modules/node.module	3 Mar 2005 19:49:21 -0000
@@ -704,6 +704,11 @@
           'access' => node_access('update', $node),
           'weight' => 1,
           'type' => MENU_LOCAL_TASK);
+        $items[] = array('path' => 'node/'. arg(1) .'/delete', 'title' => t('delete'),
+          'callback' => 'node_page',
+          'access' => node_access('delete', $node),
+          'weight' => 1,
+          'type' => MENU_CALLBACK);
 
         if ($node->revisions) {
           $items[] = array('path' => 'node/'. arg(1) .'/revisions', 'title' => t('revisions'),
@@ -749,7 +754,7 @@
   $op = $_POST['op'];
 
   $edit = $_POST['edit'];
-  if (($op == t('Update') || $op == t('Delete')) && isset($edit['operation']) && isset($edit['nodes'])) {
+  if (($op == t('Update') || $op == t('Delete all')) && isset($edit['operation']) && isset($edit['nodes'])) {
     $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.'));
@@ -774,20 +779,23 @@
           drupal_set_message(t('The items have been deleted.'));
         }
         else {
-          $list = '<ul>';
+          $extra = '<ul>';
           foreach ($edit['nodes'] as $nid => $value) {
             if ($value) {
               $title = db_result(db_query('SELECT title FROM {node} WHERE nid = %d', $nid));
-              $list .= '<li>'. form_hidden('nodes]['. $nid, 1) . $title .'</li>';
+              $extra .= '<li>'. form_hidden('nodes]['. $nid, 1) . $title .'</li>';
             }
           }
-          $list .= '</ul>';
+          $extra .= '</ul>';
+          $extra .= form_hidden('operation', 'delete');
 
-          $output = '<h3>'. t('Are you sure you want to delete these items?') .'</h3>'. $list;
-          $output .= form_hidden('operation', 'delete');
-          $output .= form_hidden('confirm', 1);
-          $output .= form_submit(t('Delete'));
-          $output = form($output);
+          $output = theme('confirm',
+                          t('Are you sure you want to delete these items?'),
+                          'admin/node',
+                          t('This action cannot be undone.'),
+                          t('Delete all'),
+                          t('Cancel'),
+                          $extra);
           return $output;
         }
       }
@@ -1575,7 +1583,6 @@
  * Ask for confirmation, and delete the node.
  */
 function node_delete($edit) {
-
   $node = node_load(array('nid' => $edit['nid']));
 
   if (node_access('delete', $node)) {
@@ -1597,14 +1604,16 @@
       }
 
       watchdog('content', t('%type: deleted %title.', array('%type' => '<em>'. t($node->type) .'</em>', '%title' => "<em>$node->title</em>")));
-      $output = t('The node has been deleted.');
     }
     else {
-      $output .= form_item(t('Confirm deletion'), $node->title);
-      $output .= form_hidden('nid', $node->nid);
-      $output .= form_hidden('confirm', 1);
-      $output .= form_submit(t('Delete'));
-      $output = form($output);
+      $extra = form_hidden('nid', $node->nid);
+      $output = theme('confirm',
+                      t('Are you sure you want to delete %title?', array('%title' => '<em>'. $node->title .'</em>')),
+                      $_GET['destination'] ? $_GET['destination'] : 'node/'. $node->nid,
+                      t('This action cannot be undone.'),
+                      t('Delete'),
+                      t('Cancel'),
+                      $extra);
     }
   }
 
@@ -1699,8 +1708,19 @@
         print theme('page', node_preview($edit));
       }
       break;
+    case 'delete':
     case t('Delete'):
-      drupal_set_title(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') {
+        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');
+      }
       print theme('page', node_delete($edit));
       break;
     default:
Index: modules/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.180
diff -u -r1.180 taxonomy.module
--- modules/taxonomy.module	3 Mar 2005 19:18:19 -0000	1.180
+++ modules/taxonomy.module	3 Mar 2005 19:49:27 -0000
@@ -172,12 +172,17 @@
 function _taxonomy_confirm_del_vocabulary($vid) {
   $vocabulary = taxonomy_get_vocabulary($vid);
 
-  $form .= form_hidden('confirm', 1);
-  $form .= form_hidden('type', 'vocabulary');
-  $form .= form_hidden('vid', $vid);
-  $form .= form_submit(t('Delete'));
+  $extra  = form_hidden('type', 'vocabulary');
+  $extra .= form_hidden('vid', $vid);
 
-  return form(form_item(t('Delete vocabulary "%name"', array('%name' => $vocabulary->name)), $form, t('Are you sure you want to delete the vocabulary and all its terms?')));
+  $output = theme('confirm',
+                  t('Are you sure you want to delete the vocabulary %title?', array('%title' => $vocabulary->name)),
+                  'admin/taxonomy',
+                  t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'),
+                  t('Delete'),
+                  t('Cancel'),
+                  $extra);
+  return $output;
 }
 
 function taxonomy_form_term($edit = array()) {
@@ -318,12 +323,16 @@
 function _taxonomy_confirm_del_term($tid) {
   $term = taxonomy_get_term($tid);
 
-  $form .= form_hidden('confirm', 1);
-  $form .= form_hidden('type', 'term');
-  $form .= form_hidden('tid', $tid);
-  $form .= form_submit(t('Delete'));
+  $extra  = form_hidden('type', 'term');
+  $extra .= form_hidden('tid', $tid);
 
-  $output = form(form_item(t('Delete term "%name" and all its children', array('%name' => $term->name)), $form, t('Are you sure you want to delete the term and all its children (if any)?')));
+  $output = theme('confirm',
+                  t('Are you sure you want to delete the term %name?', array('%title' => '<em>'. $vocabulary->name .'</em>')),
+                  'admin/taxonomy',
+                  t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
+                  t('Delete'),
+                  t('Cancel'),
+                  $extra);
 
   return $output;
 }
Index: modules/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user.module,v
retrieving revision 1.447
diff -u -r1.447 user.module
--- modules/user.module	1 Mar 2005 20:21:08 -0000	1.447
+++ modules/user.module	3 Mar 2005 19:49:44 -0000
@@ -706,6 +706,9 @@
       $items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
         'callback' => 'user_edit', 'access' => $access || $user->uid == arg(1),
         'type' => MENU_LOCAL_TASK);
+      $items[] = array('path' => 'user/'. arg(1) .'/delete', 'title' => t('delete'),
+        'callback' => 'user_edit', 'access' => $access,
+        'type' => MENU_CALLBACK);
 
       if (arg(2) == 'edit') {
         if (($categories = _user_categories()) && (count($categories) > 1)) {
@@ -1119,7 +1122,7 @@
   $account = user_load(array('uid' => arg(1)));
   $edit = $_POST['op'] ? $_POST['edit'] : object2array($account);
 
-  if ($_POST['op'] == t('Save account')) {
+  if ($_POST['op'] == t('Submit')) {
     user_module_invoke('validate', $edit, $account, $category);
 
     if (!form_get_errors()) {
@@ -1136,8 +1139,8 @@
       }
     }
   }
-  else if ($_POST['op'] == t('Delete account')) {
-    if ($account->status == 0) {
+  else if (arg(2) == 'delete') {
+    if ($edit['confirm']) {
       db_query('DELETE FROM {users} WHERE uid = %d', $account->uid);
       db_query('DELETE FROM {users_roles} WHERE uid = %d', $account->uid);
       db_query('DELETE FROM {authmap} WHERE uid = %d', $account->uid);
@@ -1146,14 +1149,24 @@
       drupal_goto('admin/user');
     }
     else {
-      drupal_set_message(t('Failed to delete account: the account has to be blocked first.'), 'error');
-    }
+      $output = theme('confirm',
+                      t('Are you sure you want to delete the account %name?', array('%name' => '<em>'. $account->name .'</em>')),
+                      'user/'. $account->uid,
+                      t('Deleting a user will remove all their submissions as well. This action cannot be undone.'),
+                      t('Delete'));
+      print theme('page', $output);
+      return;
+    }    
+  }
+  else if ($_POST['op'] == t('Delete')) {
+    // Note: we redirect from user/uid/edit to user/uid/delete to make the tabs disappear.
+    drupal_goto("user/$account->uid/delete");
   }
 
   $output  = _user_forms($edit, $account, $category);
-  $output .= form_submit(t('Save account'));
+  $output .= form_submit(t('Submit'));
   if (user_access('administer users')) {
-    $output .= form_submit(t('Delete account'));
+    $output .= form_submit(t('Delete'));
   }
   $output = form($output, 'post', 0, array('enctype' => 'multipart/form-data'));
 
@@ -1368,10 +1381,14 @@
   else {
     $access_types = array('user' => t('username'), 'mail' => t('e-mail'));
     $edit = db_fetch_object(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
-    $output = '<p>'. t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => '<em>'. $edit->mask .'</em>')) .'</p>';
-    $output .= form_hidden('confirm', 1);
-    $output .= form_submit(t('Delete'));
-    $output = form($output);
+
+    $output = theme('confirm',
+                    t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => '<em>'. $edit->mask .'</em>')),
+                    'admin/access/rules',
+                    t('This action cannot be undone.'),
+                    t('Delete'),
+                    t('Cancel'),
+                    $extra);
     print theme('page', $output);
   }
 }
cvs diff: Diffing scripts
cvs diff: Diffing sites
cvs diff: Diffing sites/default
cvs diff: Diffing themes
cvs diff: Diffing themes/bluemarine
cvs diff: Diffing themes/chameleon
cvs diff: Diffing themes/chameleon/marvin
cvs diff: Diffing themes/engines
cvs diff: Diffing themes/engines/xtemplate
cvs diff: Diffing themes/pushbutton


***** CVS exited normally with code 1 *****

