The branch, QA_3_5 has been updated via a952ee531ab944bd19f0cb073a41d78a83001285 (commit) via 3151d41d0e13e2f422aaf88faeffd5e1f93c897a (commit) from 5fe9a03bb8ffd6cd4679f119591e1953da56a938 (commit)
- Log ----------------------------------------------------------------- commit a952ee531ab944bd19f0cb073a41d78a83001285 Author: Michal Čihař mcihar@suse.cz Date: Wed Feb 1 11:49:05 2012 +0100
Coding style
commit 3151d41d0e13e2f422aaf88faeffd5e1f93c897a Author: Eric Krona eric@krona.tm Date: Sun Jan 29 22:02:13 2012 +0100
Activated codemirror for inline edits of queries.
-----------------------------------------------------------------------
Summary of changes: js/functions.js | 19 ++++++++++++++++++- sql.php | 4 ++++ 2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/js/functions.js b/js/functions.js index 12c6a65..ed8ebaf 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1150,8 +1150,25 @@ $(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); + + // These settings are duplicated from the .ready()function in functions.js + var height = $('#sql_query_edit').css('height'); + codemirror_editor = CodeMirror.fromTextArea($('textarea[name="sql_query_edit"]')[0], { + lineNumbers: true, + matchBrackets: true, + indentUnit: 4, + mode: "text/x-mysql", + lineWrapping: true + }); + codemirror_editor.getScrollerElement().style.height = height; + codemirror_editor.refresh(); + $(".btnSave").click(function(){ - var sql_query = $(this).prev().val(); + if (codemirror_editor !== undefined) { + var sql_query = codemirror_editor.getValue(); + } else { + 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})) diff --git a/sql.php b/sql.php index 3e6e6d4..d736bdf 100644 --- a/sql.php +++ b/sql.php @@ -20,6 +20,10 @@ $GLOBALS['js_include'][] = 'tbl_change.js'; // the next one needed because sql.php may do a "goto" to tbl_structure.php $GLOBALS['js_include'][] = 'tbl_structure.js'; $GLOBALS['js_include'][] = 'gis_data_editor.js'; +$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js'; +$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js'; + +
if (isset($_SESSION['profiling'])) { $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
hooks/post-receive