The branch, master has been updated via 3c573fc82e35834646ed861bbc53f55d30db1b4e (commit) from 21fd381c84482d2792902034f3292d274e11383c (commit)
- Log ----------------------------------------------------------------- commit 3c573fc82e35834646ed861bbc53f55d30db1b4e Author: Marc Delisle marc@infomarc.info Date: Sat Jan 29 10:32:56 2011 -0500
Conditional Ajax for other db operations
-----------------------------------------------------------------------
Summary of changes: db_operations.php | 8 ++++++-- js/db_operations.js | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/db_operations.php b/db_operations.php index 6382fe9..9280467 100644 --- a/db_operations.php +++ b/db_operations.php @@ -458,7 +458,7 @@ echo __('Remove database'); * Copy database */ ?> - <form id="copy_db_form" method="post" action="db_operations.php" + <form id="copy_db_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : ''); ?>method="post" action="db_operations.php" onsubmit="return emptyFormElements(this, 'newname')"> <?php if (isset($db_collation)) { @@ -528,7 +528,11 @@ echo __('Remove database'); /** * Change database charset */ - echo '<form id="change_db_charset_form" method="post" action="./db_operations.php">' . "\n" + echo '<form id="change_db_charset_form" '; + if ($GLOBALS['cfg']['AjaxEnable']) { + echo ' class="ajax" '; + } + echo 'method="post" action="./db_operations.php">' . PMA_generate_common_hidden_inputs($db, $table) . '<fieldset>' . "\n" . ' <legend>'; diff --git a/js/db_operations.js b/js/db_operations.js index 22511fb..915c537 100644 --- a/js/db_operations.js +++ b/js/db_operations.js @@ -30,7 +30,7 @@ $(document).ready(function() { $("#rename_db_form.ajax").live('submit', function(event) { event.preventDefault();
- $form = $(this); + var $form = $(this);
var question = 'CREATE DATABASE ' + $('#new_db_name').val() + ' / DROP DATABASE ' + window.parent.db;
@@ -86,12 +86,15 @@ $(document).ready(function() { * Ajax Event Handler for 'Copy Database' * * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ - $("#copy_db_form").live('submit', function(event) { + $("#copy_db_form.ajax").live('submit', function(event) { event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strCopyingDatabase']); - $form = $(this); + + var $form = $(this); + if (! $form.find('input:hidden').is('#ajax_request_hidden')) { $form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />'); } @@ -123,15 +126,20 @@ $(document).ready(function() { * Ajax Event handler for 'Change Charset' of the database * * @uses PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] */ - $("#change_db_charset_form").live('submit', function(event) { + $("#change_db_charset_form.ajax").live('submit', function(event) { event.preventDefault();
- $(this).append('<input type="hidden" name="ajax_request" value="true" />'); + var $form = $(this); + + if (! $form.find('input:hidden').is('#ajax_request_hidden')) { + $form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />'); + }
PMA_ajaxShowMessage(PMA_messages['strChangingCharset']);
- $.get($(this).attr('action'), $(this).serialize() + "&submitcollation=" + $(this).find("input[name=submitcollation]").attr('value'), function(data) { + $.get($form.attr('action'), $form.serialize() + "&submitcollation=" + $form.find("input[name=submitcollation]").attr('value'), function(data) { if(data.success == true) { PMA_ajaxShowMessage(data.message); }
hooks/post-receive