From e81b6c1cfd5f95ebd4809b54d6aaeed80beea52f Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Sat, 27 Aug 2011 22:12:54 +0200 Subject: [PATCH] Fix broken inline edit As a bonus, data is submitted by POST so query length limit doesn't apply --- js/functions.js | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/js/functions.js b/js/functions.js index 1c1dddbf80..cae7ed42df 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 += "\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" - + "?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 = $('
', {action: 'import.php', method: 'post'}) + .append($form.find("input[name=server], input[name=db], input[name=table], input[name=token]").clone()) + .append($('', {type: 'hidden', name: 'show_query', value: 1})) + .append($('', {type: 'hidden', name: 'sql_query', value: sql_query})); + $fake_form.appendTo($('body')).submit(); }); - $(".btnDiscard").each(function(){ - $(this).click(function(){ - $(this).closest(".sql").html("" + old_text + ""); - }); + $(".btnDiscard").click(function(){ + $(this).closest(".sql").html("" + old_text + ""); }); return false; }); -- 2.11.4.GIT