patch #2979922, rfe #2804874 [interface] Add inline query editing, thanks to Muhammd Adnan.

This commit is contained in:
Muhammd Adnan
2010-04-01 14:21:56 +02:00
committed by Michal Čihař
parent 5ecbd6941d
commit 86ca31197b
5 changed files with 35 additions and 3 deletions

View File

@@ -1654,3 +1654,25 @@ function changeMIMEType(db, table, reference, mime_type)
var chgRequest = new Request({ method: 'post', url: mime_chg_url, data: params, evalScripts: true });
chgRequest.send();
}
// Jquery Coding for inline editing SQL_QUERY
$(document).ready(function(){
var $oldText,$db,$table,$token,$sql_query;
$oldText=$(".syntax").html();
$("#inline_edit").click(function(){
$db=$("input[name='db']").val();
$table=$("input[name='table']").val();
$token=$("input[name='token']").val();
$sql_query=$("input[name='sql_query']").val();
$(".syntax").replaceWith("<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">"+ $sql_query +"</textarea><input type=\"button\" id=\"btnSave\" value=\"Save\"><input type=\"button\" id=\"btnDiscard\" value=\"Discard\">");
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\">"+$oldText+"</span>");
});
});