? 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 foo?"). + * @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 .= '
'. $description ."
\n"; + if (!is_null($extra)) { + $output .= $extra; + } + $output .= ''. t('Are you sure you want to delete the block %name?', array('%name' => ''. $box['info'] .'')) ."
\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' => ''. $info .''))); + cache_clear_all(); + drupal_goto('admin/block'); + } + else { + $output = theme('confirm', + t('Are you sure you want to delete the block %name?', array('%name' => ''. $info .'')), + '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' => ''. $comment->subject .'')), + '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 .= ''. 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' => ''. $format->name .'')) ."
\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' => ''. $format->name .'')), + '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' => ''. $term->name .'')), + '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' => ''. t($languages['name'][$edit['langcode']]) .'')); - 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' => ''. t($languages['name'][$edit['langcode']]) .'')); + 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' => ''. t($languages['name'][$langcode]) .'')), + '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 = ''. t('Are you sure you want to reset all menu items to their default settings? Any custom menu items will be lost.') .'
'; - $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' => ''. $title .'')), + '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 = ''. t('Are you sure you want to reset this item to its default values?') .'
'; - $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' => ''. $title .'')), + '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 = ''. t('Are you sure you want to delete this custom menu item?') .'
'; - $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' => ''. $menu->title .'')); + } + else { + $message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => ''. $menu->title .'')); + } + $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 = ''. t('Are you sure you want to delete the %type rule for %rule?', array('%type' => $access_types[$edit->type], '%rule' => ''. $edit->mask .'')) .'
'; - $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' => ''. $edit->mask .'')), + '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 *****