#18329: Unify confirmation messages (and make them themable)
parent
96211c616e
commit
198ec98f75
|
@ -849,6 +849,57 @@ function theme_blocks($region) {
|
|||
}
|
||||
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".
|
||||
*/
|
||||
|
|
|
@ -312,18 +312,20 @@ function block_box_add() {
|
|||
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);
|
||||
|
|
|
@ -312,18 +312,20 @@ function block_box_add() {
|
|||
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);
|
||||
|
|
|
@ -951,7 +951,7 @@ function comment_delete($cid) {
|
|||
|
||||
// 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 @@ function comment_delete($cid) {
|
|||
|
||||
}
|
||||
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.'));
|
||||
|
|
|
@ -951,7 +951,7 @@ function comment_delete($cid) {
|
|||
|
||||
// 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 @@ function comment_delete($cid) {
|
|||
|
||||
}
|
||||
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.'));
|
||||
|
|
|
@ -377,7 +377,7 @@ function filter_admin_add() {
|
|||
*/
|
||||
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 @@ function filter_admin_delete() {
|
|||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -377,7 +377,7 @@ function filter_admin_add() {
|
|||
*/
|
||||
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 @@ function filter_admin_delete() {
|
|||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -126,14 +126,17 @@ function forum_taxonomy($op, $type, $object) {
|
|||
* @param $tid ID of the term to be deleted
|
||||
*/
|
||||
function _forum_confirm_del($tid) {
|
||||
$term = taxonomy_get_term($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'));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -126,14 +126,17 @@ function forum_taxonomy($op, $type, $object) {
|
|||
* @param $tid ID of the term to be deleted
|
||||
*/
|
||||
function _forum_confirm_del($tid) {
|
||||
$term = taxonomy_get_term($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'));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -260,44 +260,28 @@ function locale_admin_manage() {
|
|||
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
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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() {
|
|||
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 @@ function locale_admin_manage_delete_screen() {
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -260,44 +260,28 @@ function locale_admin_manage() {
|
|||
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
|
||||
}
|
||||
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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() {
|
|||
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 @@ function locale_admin_manage_delete_screen() {
|
|||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,17 +113,17 @@ function menu_overview() {
|
|||
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 @@ function menu_reset_item($mid) {
|
|||
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_reset_item($mid) {
|
|||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,17 +113,17 @@ function menu_overview() {
|
|||
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 @@ function menu_reset_item($mid) {
|
|||
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_reset_item($mid) {
|
|||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -704,6 +704,11 @@ function node_menu($may_cache) {
|
|||
'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 @@ function node_admin_nodes() {
|
|||
$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 @@ function node_admin_nodes() {
|
|||
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 @@ function node_submit(&$node) {
|
|||
* 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 @@ function node_delete($edit) {
|
|||
}
|
||||
|
||||
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 @@ function node_page() {
|
|||
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:
|
||||
|
|
|
@ -704,6 +704,11 @@ function node_menu($may_cache) {
|
|||
'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 @@ function node_admin_nodes() {
|
|||
$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 @@ function node_admin_nodes() {
|
|||
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 @@ function node_submit(&$node) {
|
|||
* 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 @@ function node_delete($edit) {
|
|||
}
|
||||
|
||||
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 @@ function node_page() {
|
|||
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:
|
||||
|
|
|
@ -172,12 +172,17 @@ function taxonomy_del_vocabulary($vid) {
|
|||
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()) {
|
||||
|
@ -322,12 +327,16 @@ function taxonomy_del_term($tid) {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -172,12 +172,17 @@ function taxonomy_del_vocabulary($vid) {
|
|||
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()) {
|
||||
|
@ -322,12 +327,16 @@ function taxonomy_del_term($tid) {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -706,6 +706,9 @@ function user_menu($may_cache) {
|
|||
$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 @@ function user_edit($category = 'account') {
|
|||
$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 @@ function user_edit($category = 'account') {
|
|||
}
|
||||
}
|
||||
}
|
||||
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 @@ function user_edit($category = 'account') {
|
|||
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 @@ function user_admin_access_delete($aid = 0) {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,6 +706,9 @@ function user_menu($may_cache) {
|
|||
$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 @@ function user_edit($category = 'account') {
|
|||
$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 @@ function user_edit($category = 'account') {
|
|||
}
|
||||
}
|
||||
}
|
||||
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 @@ function user_edit($category = 'account') {
|
|||
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 @@ function user_admin_access_delete($aid = 0) {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue