diff --git a/js/functions.js b/js/functions.js index d808a0cea..52c3c287f 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(""); + $(".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 = "\n"; + new_content += "\n"; + new_content += "\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("" + old_text + ""); + }); + }); 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("" + oldText + ""); - }); - $('.sqlbutton').click(function(evt){ insertQuery(evt.target.id); return false; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 29eb2e912..56618a180 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1263,7 +1263,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view "//" . + "\" class=\"inline_edit\">" . PMA_escapeJsString(__('Inline')) . "]');\n" . "//]]>\n" .