[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA2-1486-g21fd381

Marc Delisle lem9 at users.sourceforge.net
Sat Jan 29 14:23:34 CET 2011


The branch, master has been updated
       via  21fd381c84482d2792902034f3292d274e11383c (commit)
      from  cc8e3849cf88f90218df6c5b6c42b1c4393d8ec3 (commit)


- Log -----------------------------------------------------------------
commit 21fd381c84482d2792902034f3292d274e11383c
Author: Marc Delisle <marc at infomarc.info>
Date:   Sat Jan 29 08:22:26 2011 -0500

    Conditional Ajax on db rename
    Remove extra wrapping of jQuery object
    Avoid extra generation of hidden field
    Improve confirmation message on db rename

-----------------------------------------------------------------------

Summary of changes:
 db_operations.php   |    4 ++--
 js/db_operations.js |   14 ++++++++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/db_operations.php b/db_operations.php
index b4a4263..6382fe9 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -378,7 +378,7 @@ if (!$is_information_schema) {
      */
 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')">
         <?php
     if (isset($db_collation)) {
@@ -399,7 +399,7 @@ if ($db != 'mysql') {
     echo __('Rename database to') . ':';
     ?>
         </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
     echo '(' . __('Command') . ': ';
     /**
diff --git a/js/db_operations.js b/js/db_operations.js
index 12b17c1..22511fb 100644
--- a/js/db_operations.js
+++ b/js/db_operations.js
@@ -25,12 +25,18 @@ $(document).ready(function() {
      *
      * @uses    $.PMA_confirm()
      * @uses    PMA_ajaxShowUser()
+     * @see     $cfg['AjaxEnable']
      */
-    $("#rename_db_form").live('submit', function(event) {
+    $("#rename_db_form.ajax").live('submit', function(event) {
         event.preventDefault();
 
-        var question = 'CREATE DATABASE ... and then DROP DATABASE ' + window.parent.db;
-        $(this).append('<input type="hidden" name="ajax_request" value="true" />');
+        $form = $(this);
+
+        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
@@ -43,7 +49,7 @@ $(document).ready(function() {
                                                 };
         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']);
 
             $.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function(data) {


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list