Conditional Ajax on db rename
Remove extra wrapping of jQuery object Avoid extra generation of hidden field Improve confirmation message on db rename
This commit is contained in:
@@ -378,7 +378,7 @@ if (!$is_information_schema) {
|
|||||||
*/
|
*/
|
||||||
if ($db != 'mysql') {
|
if ($db != 'mysql') {
|
||||||
?>
|
?>
|
||||||
<form id="rename_db_form" method="post" action="db_operations.php"
|
<form id="rename_db_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : ''); ?>method="post" action="db_operations.php"
|
||||||
onsubmit="return emptyFormElements(this, 'newname')">
|
onsubmit="return emptyFormElements(this, 'newname')">
|
||||||
<?php
|
<?php
|
||||||
if (isset($db_collation)) {
|
if (isset($db_collation)) {
|
||||||
@@ -399,7 +399,7 @@ if ($db != 'mysql') {
|
|||||||
echo __('Rename database to') . ':';
|
echo __('Rename database to') . ':';
|
||||||
?>
|
?>
|
||||||
</legend>
|
</legend>
|
||||||
<input type="text" name="newname" size="30" class="textfield" value="" />
|
<input id="new_db_name" type="text" name="newname" size="30" class="textfield" value="" />
|
||||||
<?php
|
<?php
|
||||||
echo '(' . __('Command') . ': ';
|
echo '(' . __('Command') . ': ';
|
||||||
/**
|
/**
|
||||||
|
@@ -25,12 +25,18 @@ $(document).ready(function() {
|
|||||||
*
|
*
|
||||||
* @uses $.PMA_confirm()
|
* @uses $.PMA_confirm()
|
||||||
* @uses PMA_ajaxShowUser()
|
* @uses PMA_ajaxShowUser()
|
||||||
|
* @see $cfg['AjaxEnable']
|
||||||
*/
|
*/
|
||||||
$("#rename_db_form").live('submit', function(event) {
|
$("#rename_db_form.ajax").live('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
var question = 'CREATE DATABASE ... and then DROP DATABASE ' + window.parent.db;
|
$form = $(this);
|
||||||
$(this).append('<input type="hidden" name="ajax_request" value="true" />');
|
|
||||||
|
var question = 'CREATE DATABASE ' + $('#new_db_name').val() + ' / DROP DATABASE ' + window.parent.db;
|
||||||
|
|
||||||
|
if (! $form.find('input:hidden').is('#ajax_request_hidden')) {
|
||||||
|
$form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var button_options Object containing options for jQueryUI dialog buttons
|
* @var button_options Object containing options for jQueryUI dialog buttons
|
||||||
@@ -43,7 +49,7 @@ $(document).ready(function() {
|
|||||||
};
|
};
|
||||||
button_options[PMA_messages['strNo']] = function() { $(this).dialog("close").remove(); }
|
button_options[PMA_messages['strNo']] = function() { $(this).dialog("close").remove(); }
|
||||||
|
|
||||||
$(this).PMA_confirm(question, $(this).attr('action'), function(url) {
|
$form.PMA_confirm(question, $form.attr('action'), function(url) {
|
||||||
PMA_ajaxShowMessage(PMA_messages['strRenamingDatabases']);
|
PMA_ajaxShowMessage(PMA_messages['strRenamingDatabases']);
|
||||||
|
|
||||||
$.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function(data) {
|
$.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function(data) {
|
||||||
|
Reference in New Issue
Block a user