From 5fe9a03bb8ffd6cd4679f119591e1953da56a938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Feb 2012 10:45:36 +0100 Subject: [PATCH 1/3] Another whitespace removal... --- test/libraries/common/PMA_extractFieldSpec_test.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test/libraries/common/PMA_extractFieldSpec_test.php b/test/libraries/common/PMA_extractFieldSpec_test.php index cd2a6cb34b..cb5bb1e8ff 100644 --- a/test/libraries/common/PMA_extractFieldSpec_test.php +++ b/test/libraries/common/PMA_extractFieldSpec_test.php @@ -1,4 +1,3 @@ - Date: Sun, 29 Jan 2012 22:02:13 +0100 Subject: [PATCH 2/3] Activated codemirror for inline edits of queries. --- js/functions.js | 18 +++++++++++++++++- sql.php | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/js/functions.js b/js/functions.js index 12c6a653c7..46869fb919 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1150,8 +1150,24 @@ $(document).ready(function(){ new_content += "\n"; new_content += "\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 = $('
', {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})) diff --git a/sql.php b/sql.php index 3e6e6d445f..d736bdf58c 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'; From a952ee531ab944bd19f0cb073a41d78a83001285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Feb 2012 11:49:05 +0100 Subject: [PATCH 3/3] Coding style --- js/functions.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/functions.js b/js/functions.js index 46869fb919..ed8ebafa6b 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1164,10 +1164,11 @@ $(document).ready(function(){ codemirror_editor.refresh(); $(".btnSave").click(function(){ - if( codemirror_editor!==undefined ) + if (codemirror_editor !== undefined) { var sql_query = codemirror_editor.getValue(); - else + } else { 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}))