The branch, master has been updated via e81b6c1cfd5f95ebd4809b54d6aaeed80beea52f (commit) from 8364b505ded861de265bdaf81ae5ce78493df446 (commit)
- Log ----------------------------------------------------------------- commit e81b6c1cfd5f95ebd4809b54d6aaeed80beea52f Author: Piotr Przybylski piotrprz@gmail.com Date: Sat Aug 27 22:12:54 2011 +0200
Fix broken inline edit As a bonus, data is submitted by POST so query length limit doesn't apply
-----------------------------------------------------------------------
Summary of changes: js/functions.js | 31 +++++++++++-------------------- 1 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/js/functions.js b/js/functions.js index 1c1dddb..cae7ed4 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1205,11 +1205,8 @@ function changeMIMEType(db, table, reference, mime_type) */ $(document).ready(function(){ $(".inline_edit_sql").live('click', function(){ - var server = $(this).prev().find("input[name='server']").val(); - 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 $form = $(this).prev(); + var sql_query = $form.find("input[name='sql_query']").val(); var $inner_sql = $(this).parent().prev().find('.inner_sql'); var old_text = $inner_sql.html();
@@ -1217,22 +1214,16 @@ $(document).ready(function(){ 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" - + "?server=" + encodeURIComponent(server) - + "&db=" + encodeURIComponent(db) - + "&table=" + encodeURIComponent(table) - + "&sql_query=" + encodeURIComponent(sql_query) - + "&show_query=1" - + "&token=" + token); - }); + $(".btnSave").click(function(){ + var sql_query = $(this).prev().val(); + var $fake_form = $('<form>', {action: 'import.php', method: 'post'}) + .append($form.find("input[name=server], input[name=db], input[name=table], input[name=token]").clone()) + .append($('<input>', {type: 'hidden', name: 'show_query', value: 1})) + .append($('<input>', {type: 'hidden', name: 'sql_query', value: sql_query})); + $fake_form.appendTo($('body')).submit(); }); - $(".btnDiscard").each(function(){ - $(this).click(function(){ - $(this).closest(".sql").html("<span class="syntax"><span class="inner_sql">" + old_text + "</span></span>"); - }); + $(".btnDiscard").click(function(){ + $(this).closest(".sql").html("<span class="syntax"><span class="inner_sql">" + old_text + "</span></span>"); }); return false; });
hooks/post-receive