[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0RC2-733-g56fc953

Michal Čihař nijel at users.sourceforge.net
Thu May 5 08:45:25 CEST 2011


The branch, master has been updated
       via  56fc953b57c3f5878c90daa2fe43f8fbeca9fff8 (commit)
       via  bacbe54a67e0b0959917506f5736cbe65cc9c5fa (commit)
      from  ea3af8325e2814641dce1e4f6dc8e22d9d286523 (commit)


- Log -----------------------------------------------------------------
commit 56fc953b57c3f5878c90daa2fe43f8fbeca9fff8
Author: Rouslan Placella <rouslan at placella.com>
Date:   Sun May 1 17:22:16 2011 +0100

    Fixed issue #2 in bug #3291301 - Problems with inline edit link for sql query

commit bacbe54a67e0b0959917506f5736cbe65cc9c5fa
Author: Rouslan Placella <rouslan at placella.com>
Date:   Sat Apr 30 16:30:08 2011 +0100

    Fixed issue #1 from bug #3291301 (Problems with inline edit link for sql query)

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

Summary of changes:
 js/functions.js          |   39 +++++++++++++++++++++++----------------
 libraries/common.lib.php |    4 ++--
 2 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/js/functions.js b/js/functions.js
index d808a0c..52c3c28 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1118,25 +1118,32 @@ function changeMIMEType(db, table, reference, mime_type)
  * Jquery Coding for inline editing SQL_QUERY
  */
 $(document).ready(function(){
-    var oldText,db,table,token,sql_query;
-    oldText=$(".inner_sql").html();
-    $("#inline_edit").live('click',function(){
-        db=$("input[name='db']").val();
-        table=$("input[name='table']").val();
-        token=$("input[name='token']").val();
-        sql_query=$("input[name='sql_query']").val();
-        $(".inner_sql").replaceWith("<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">"+ sql_query +"</textarea><input type=\"button\" id=\"btnSave\" value=\"" + PMA_messages['strGo'] + "\"><input type=\"button\" id=\"btnDiscard\" value=\"" + PMA_messages['strCancel'] + "\">");
+    $(".inline_edit").click( function(){
+        var db         = $(this).prev().find("input[name='db']").val();
+        var table      = $(this).prev().find("input[name='table']").val();
+        var token      = $(this).prev().find("input[name='token']").val();
+        var sql_query  = $(this).prev().find("input[name='sql_query']").val();
+        var $inner_sql = $(this).parent().prev().find('.inner_sql');
+        var old_text   = $inner_sql.html();
+
+        var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n";
+        new_content    += "<input type=\"button\" class=\"btnSave\" value=\"" + PMA_messages['strGo'] + "\">\n";
+        new_content    += "<input type=\"button\" class=\"btnDiscard\" value=\"" + PMA_messages['strCancel'] + "\">\n";
+        $inner_sql.replaceWith(new_content);
+        $(".btnSave").each(function(){
+            $(this).click(function(){
+                sql_query = $(this).prev().val();
+                window.location.replace("import.php?db=" + db +"&table=" + table + "&sql_query=" + sql_query + "&show_query=1&token=" + token);
+            });
+        });
+        $(".btnDiscard").each(function(){
+            $(this).click(function(){
+                $(this).closest(".sql").html("<span class=\"syntax\"><span class=\"inner_sql\">" + old_text + "</span></span>");
+            });
+        });
         return false;
     });
 
-    $("#btnSave").live("click",function(){
-        window.location.replace("import.php?db=" + db +"&table=" + table + "&sql_query=" + $("#sql_query_edit").val()+"&show_query=1&token=" + token + "");
-    });
-
-    $("#btnDiscard").live("click",function(){
-        $(".sql").html("<span class=\"syntax\"><span class=\"inner_sql\">" + oldText + "</span></span>");
-    });
-
     $('.sqlbutton').click(function(evt){
         insertQuery(evt.target.id);
         return false;
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 4969463..56618a1 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -1261,9 +1261,9 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
         // document.write conflicts with jQuery, hence used $().append()
             echo "<script type=\"text/javascript\">\n" .
                 "//<![CDATA[\n" .
-                "$('.tools form').after('[<a href=\"#\" title=\"" .
+                "$('.tools form').last().after('[<a href=\"#\" title=\"" .
                 PMA_escapeJsString(__('Inline edit of this query')) .
-                "\" id=\"inline_edit\">" .
+                "\" class=\"inline_edit\">" .
                 PMA_escapeJsString(__('Inline')) .
                 "</a>]');\n" .
                 "//]]>\n" .


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list