[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_5-19820-g4c56367

Marc Delisle lem9 at users.sourceforge.net
Fri Sep 23 14:43:26 CEST 2011


The branch, master has been updated
       via  4c56367ecd239689852afc0509ef7db4a10c1ca8 (commit)
       via  3fc3194bce70c44e17a2758cb52b01ec5d50825c (commit)
      from  299da6d047de5374ea8964c17f9c6bff059391e8 (commit)


- Log -----------------------------------------------------------------
commit 4c56367ecd239689852afc0509ef7db4a10c1ca8
Author: Marc Delisle <marc at infomarc.info>
Date:   Fri Sep 23 08:43:10 2011 -0400

    Incorrect messages were shown

commit 3fc3194bce70c44e17a2758cb52b01ec5d50825c
Author: Marc Delisle <marc at infomarc.info>
Date:   Fri Sep 23 08:14:42 2011 -0400

    - Bug #3383572 Cannot execute saved query
    - Remove bookmark from the list after deletion (Ajax)

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

Summary of changes:
 js/sql.js                        |   32 +++++++++++++++++++++++++++++++-
 libraries/sql_query_form.lib.php |    2 +-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/js/sql.js b/js/sql.js
index 813bf68..c6f2f0c 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -130,6 +130,22 @@ $(document).ready(function() {
         });
     }
 
+
+    /**
+     * Event handler for sqlqueryform.ajax button_submit_query 
+     *
+     * @memberOf    jQuery
+     */
+    $("#button_submit_query").live('click', function(event) {
+        var $form = $(this).closest("form");
+        // the Go button related to query submission was clicked,
+        // instead of the one related to Bookmarks, so empty the
+        // id_bookmark selector to avoid misinterpretation in 
+        // import.php about what needs to be done
+        $form.find("select[name=id_bookmark]").attr("value","");
+        // let normal event propagation happen
+    });
+
     /**
      * Ajax Event handler for 'SQL Query Submit'
      *
@@ -156,11 +172,25 @@ $(document).ready(function() {
 
         $.post($form.attr('action'), $form.serialize() , function(data) {
             if (data.success == true) {
+                // success happens if the query returns rows or not
+                //
                 // fade out previous messages, if any
                 $('.success').fadeOut();
                 $('.sqlquery_message').fadeOut();
                 // show a message that stays on screen
-                if (typeof data.sql_query != 'undefined') {
+                if (typeof data.action_bookmark != 'undefined') {
+                    // view only
+                    if ('1' == data.action_bookmark) {
+                        $('#sqlquery').text(data.sql_query);
+                        // send to codemirror if possible
+                        setQuery(data.sql_query);
+                    }
+                    // delete
+                    if ('2' == data.action_bookmark) {
+                        $("#id_bookmark option[value='" + data.id_bookmark + "']").remove();
+                    }
+                    $('#sqlqueryform').before(data.message);
+                } elseif (typeof data.sql_query != 'undefined') {
                     $('<div class="sqlquery_message"></div>')
                      .html(data.sql_query)
                      .insertBefore('#sqlqueryform');
diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php
index 44b2321..0e4f47c 100644
--- a/libraries/sql_query_form.lib.php
+++ b/libraries/sql_query_form.lib.php
@@ -367,7 +367,7 @@ function PMA_sqlQueryFormBookmark()
     echo '<legend>';
     echo __('Bookmarked SQL query') . '</legend>' . "\n";
     echo '<div class="formelement">';
-    echo '<select name="id_bookmark">' . "\n";
+    echo '<select name="id_bookmark" id="id_bookmark">' . "\n";
     echo '<option value=""> </option>' . "\n";
     foreach ($bookmark_list as $key => $value) {
         echo '<option value="' . htmlspecialchars($key) . '">'


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list