From 7efd78e6038a5cff63ea83546f823b55680b4709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 3 Dec 2022 15:02:06 -0300 Subject: [PATCH] Extract Functions.highlightSql() into modules/sql-highlight.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- js/src/database/search.js | 3 +- js/src/export.js | 3 +- js/src/makegrid.js | 3 +- js/src/modules/ajax.js | 7 +- js/src/modules/functions.js | 126 ++---------------- js/src/modules/indexes.js | 3 +- .../{doc-links.js => sql-highlight.js} | 111 ++++++++++++++- js/src/server/status/processes.js | 3 +- js/src/sql.js | 9 +- js/src/table/operations.js | 9 +- js/src/table/select.js | 3 +- js/src/table/structure.js | 7 +- js/src/table/zoom_plot_jqplot.js | 3 +- 13 files changed, 152 insertions(+), 138 deletions(-) rename js/src/modules/{doc-links.js => sql-highlight.js} (85%) diff --git a/js/src/database/search.js b/js/src/database/search.js index 850bcc3f50..5589f6e5da 100644 --- a/js/src/database/search.js +++ b/js/src/database/search.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { AJAX } from '../modules/ajax.js'; import { Functions } from '../modules/functions.js'; import { CommonParams } from '../modules/common.js'; +import highlightSql from '../modules/sql-highlight.js'; /** * JavaScript functions used on Database Search page @@ -142,7 +143,7 @@ AJAX.registerOnload('database/search.js', function () { window.makeGrid(this, true, true, true, true); }); $('#browse-results').show(); - Functions.highlightSql($('#browse-results')); + highlightSql($('#browse-results')); $('html, body') .animate({ scrollTop: $('#browse-results').offset().top diff --git a/js/src/export.js b/js/src/export.js index da2b40e659..664cf26040 100644 --- a/js/src/export.js +++ b/js/src/export.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { AJAX } from './modules/ajax.js'; import { Functions } from './modules/functions.js'; import { CommonParams } from './modules/common.js'; +import highlightSql from './modules/sql-highlight.js'; /** * Functions used in the export tab @@ -239,7 +240,7 @@ AJAX.registerOnload('export.js', function () { modal.modal('show'); modal.on('shown.bs.modal', function () { $('#showSqlQueryModalLabel').first().html(window.Messages.strQuery); - Functions.highlightSql(modal); + highlightSql(modal); }); }); diff --git a/js/src/makegrid.js b/js/src/makegrid.js index 1747f8d8f1..3a7267ac68 100644 --- a/js/src/makegrid.js +++ b/js/src/makegrid.js @@ -3,6 +3,7 @@ import { AJAX } from './modules/ajax.js'; import { Functions } from './modules/functions.js'; import { CommonParams } from './modules/common.js'; import tooltip from './modules/tooltip.js'; +import highlightSql from './modules/sql-highlight.js'; /* global Sql */ /* global firstDayOfCalendar */ // templates/javascript/variables.twig @@ -1424,7 +1425,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG } else { $existingQuery.append(sqlOuter + tools); } - Functions.highlightSql($existingQuery); + highlightSql($existingQuery); } } // hide and/or update the successfully saved cells diff --git a/js/src/modules/ajax.js b/js/src/modules/ajax.js index fdd0805583..7205c62347 100644 --- a/js/src/modules/ajax.js +++ b/js/src/modules/ajax.js @@ -3,6 +3,7 @@ import { Functions } from './functions.js'; import { Navigation } from './navigation.js'; import { CommonParams } from './common.js'; import { initializeTopMenuResizer } from './menu-resizer.js'; +import highlightSql from './sql-highlight.js'; /** * This object handles ajax requests for pages. It also @@ -375,7 +376,7 @@ const AJAX = { if (data.displayMessage) { $('#page_content').prepend(data.displayMessage); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); } $('#pma_errors').remove(); @@ -532,7 +533,7 @@ const AJAX = { $('#page_content').replaceWith( '
' + data.message + '
' ); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); Functions.checkNumberOfFields(); } @@ -558,7 +559,7 @@ const AJAX = { } if (data.displayMessage) { $('#page_content').prepend(data.displayMessage); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); } $('#pma_errors').remove(); diff --git a/js/src/modules/functions.js b/js/src/modules/functions.js index 0fefd67525..983f40a890 100644 --- a/js/src/modules/functions.js +++ b/js/src/modules/functions.js @@ -2,15 +2,15 @@ import $ from 'jquery'; import { AJAX } from './ajax.js'; import { Navigation } from './navigation.js'; import { CommonActions, CommonParams } from './common.js'; -import { mysqlDocKeyword, mysqlDocBuiltin } from './doc-links.js'; import { Indexes } from './indexes.js'; import { Config } from './config.js'; import { resizeTopMenu } from './menu-resizer.js'; import tooltip from './tooltip.js'; +import highlightSql from './sql-highlight.js'; /* global ChartType, ColumnType, DataTable, JQPlotChartFactory */ // js/chart.js /* global DatabaseStructure */ // js/database/structure.js -/* global firstDayOfCalendar, maxInputVars, mysqlDocTemplate, themeImagePath */ // templates/javascript/variables.twig +/* global firstDayOfCalendar, maxInputVars, themeImagePath */ // templates/javascript/variables.twig /** * General functions, usually for data manipulation pages. @@ -1378,108 +1378,6 @@ Functions.catchKeypressesFromSqlInlineEdit = function (event) { } }; -/** - * Adds doc link to single highlighted SQL element - * - * @param $elm - * @param params - */ -Functions.documentationAdd = function ($elm, params) { - if (typeof mysqlDocTemplate === 'undefined') { - return; - } - - var url = window.sprintf( - decodeURIComponent(mysqlDocTemplate), - params[0] - ); - if (params.length > 1) { - // The # needs to be escaped to be part of the destination URL - url += encodeURIComponent('#') + params[1]; - } - var content = $elm.text(); - $elm.text(''); - $elm.append('' + content + ''); -}; - -/** - * Generates doc links for keywords inside highlighted SQL - * - * @param idx - * @param elm - */ -Functions.documentationKeyword = function (idx, elm) { - var $elm = $(elm); - /* Skip already processed ones */ - if ($elm.find('a').length > 0) { - return; - } - var keyword = $elm.text().toUpperCase(); - var $next = $elm.next('.cm-keyword'); - if ($next) { - var nextKeyword = $next.text().toUpperCase(); - var full = keyword + ' ' + nextKeyword; - - var $next2 = $next.next('.cm-keyword'); - if ($next2) { - var next2Keyword = $next2.text().toUpperCase(); - var full2 = full + ' ' + next2Keyword; - if (full2 in mysqlDocKeyword) { - Functions.documentationAdd($elm, mysqlDocKeyword[full2]); - Functions.documentationAdd($next, mysqlDocKeyword[full2]); - Functions.documentationAdd($next2, mysqlDocKeyword[full2]); - return; - } - } - if (full in mysqlDocKeyword) { - Functions.documentationAdd($elm, mysqlDocKeyword[full]); - Functions.documentationAdd($next, mysqlDocKeyword[full]); - return; - } - } - if (keyword in mysqlDocKeyword) { - Functions.documentationAdd($elm, mysqlDocKeyword[keyword]); - } -}; - -/** - * Generates doc links for builtins inside highlighted SQL - * - * @param idx - * @param elm - */ -Functions.documentationBuiltin = function (idx, elm) { - var $elm = $(elm); - var builtin = $elm.text().toUpperCase(); - if (builtin in mysqlDocBuiltin) { - Functions.documentationAdd($elm, mysqlDocBuiltin[builtin]); - } -}; - -/** - * Higlights SQL using CodeMirror. - * - * @param $base - */ -Functions.highlightSql = function ($base) { - var $elm = $base.find('code.sql'); - $elm.each(function () { - var $sql = $(this); - var $pre = $sql.find('pre'); - /* We only care about visible elements to avoid double processing */ - if ($pre.is(':visible')) { - var $highlight = $('
'); - $sql.append($highlight); - if (typeof window.CodeMirror !== 'undefined') { - window.CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]); - $pre.hide(); - $highlight.find('.cm-keyword').each(Functions.documentationKeyword); - $highlight.find('.cm-builtin').each(Functions.documentationBuiltin); - } - } - }); -}; - /** * Updates an element containing code. * @@ -1655,7 +1553,7 @@ Functions.ajaxShowMessage = function (message = null, timeout = null, type = nul if (msg !== window.Messages.strLoading) { $retval.css('background-image', 'none'); } - Functions.highlightSql($retval); + highlightSql($retval); return $retval; }; @@ -1706,7 +1604,7 @@ Functions.previewSql = function ($form) { $('#previewSqlModal').find('.modal-body').first().html(response.sql_data); $('#previewSqlModalLabel').first().html(window.Messages.strPreviewSQL); $('#previewSqlModal').on('shown.bs.modal', function () { - Functions.highlightSql($('#previewSqlModal')); + highlightSql($('#previewSqlModal')); }); } else { Functions.ajaxShowMessage(response.message); @@ -1738,7 +1636,7 @@ Functions.confirmPreviewSql = function (sqlData, url, callback) { $('#previewSqlConfirmModalLabel').first().html(window.Messages.strPreviewSQL); $('#previewSqlConfirmCode').first().text(sqlData); $('#previewSqlConfirmModal').on('shown.bs.modal', function () { - Functions.highlightSql($('#previewSqlConfirmModal')); + highlightSql($('#previewSqlConfirmModal')); }); $('#previewSQLConfirmOkButton').on('click', function () { callback(url); @@ -2341,7 +2239,7 @@ Functions.onloadCreateTableEvents = function () { if (typeof data !== 'undefined' && data.success) { var $pageContent = $('#page_content'); $pageContent.html(data.message); - Functions.highlightSql($pageContent); + highlightSql($pageContent); Functions.verifyColumnsProperties(); Functions.hideShowConnection($('.create_table_form select[name=tbl_storage_engine]')); Functions.ajaxRemoveMessage($msgbox); @@ -2547,7 +2445,7 @@ Functions.onloadChangePasswordEvents = function () { var $pageContent = $('#page_content'); $pageContent.prepend(data.message); - Functions.highlightSql($pageContent); + highlightSql($pageContent); $('#change_password_dialog').hide().remove(); $('#edit_user_dialog').dialog('close').remove(); Functions.ajaxRemoveMessage($msgbox); @@ -3118,7 +3016,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca } modalBody.innerHTML = response.sql_data; - Functions.highlightSql($('#indexDialogPreviewModal')); + highlightSql($('#indexDialogPreviewModal')); }, error: () => { modalBody.innerHTML = ''; @@ -3147,7 +3045,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca } if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); - Functions.highlightSql($('.result_query')); + highlightSql($('.result_query')); $('.result_query .alert').remove(); /* Reload the field form*/ $('#table_index').remove(); @@ -3523,7 +3421,7 @@ Functions.slidingMessage = function (msg, $object) { $obj .append('
' + msg + '
'); // highlight any sql before taking height; - Functions.highlightSql($obj); + highlightSql($obj); $obj.find('div') .first() .hide(); @@ -3541,7 +3439,7 @@ Functions.slidingMessage = function (msg, $object) { $obj.width('100%') .html('
' + msg + '
'); // highlight any sql before taking height; - Functions.highlightSql($obj); + highlightSql($obj); var h = $obj .find('div') .first() @@ -3588,7 +3486,7 @@ Functions.onloadCodeMirrorEditor = () => { $elm.trigger('focus').on('blur', Functions.updateQueryParameters); } } - Functions.highlightSql($('body')); + highlightSql($('body')); }; /** diff --git a/js/src/modules/indexes.js b/js/src/modules/indexes.js index 339cb3da9f..9da220453d 100644 --- a/js/src/modules/indexes.js +++ b/js/src/modules/indexes.js @@ -3,6 +3,7 @@ import { AJAX } from './ajax.js'; import { Functions } from './functions.js'; import { Navigation } from './navigation.js'; import { CommonActions, CommonParams } from './common.js'; +import highlightSql from './sql-highlight.js'; /** * @fileoverview function used for index manipulation pages @@ -656,7 +657,7 @@ Indexes.on = () => function () { $('
') .html(data.sql_query) .prependTo('#structure_content'); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); } Navigation.reload(); CommonActions.refreshMain('index.php?route=/table/structure'); diff --git a/js/src/modules/doc-links.js b/js/src/modules/sql-highlight.js similarity index 85% rename from js/src/modules/doc-links.js rename to js/src/modules/sql-highlight.js index 01723ce10e..d12f4b38ea 100644 --- a/js/src/modules/doc-links.js +++ b/js/src/modules/sql-highlight.js @@ -1,8 +1,11 @@ +import $ from 'jquery'; + +/* global mysqlDocTemplate */ // templates/javascript/variables.twig + /** * Definition of links to MySQL documentation. */ - -export const mysqlDocKeyword = { +const mysqlDocKeyword = { /* Multi word */ 'CHARACTER SET': ['charset'], 'SHOW AUTHORS': ['show-authors'], @@ -331,7 +334,7 @@ export const mysqlDocKeyword = { 'NOT_IN': ['comparison-operators', 'function_not-in'] }; -export const mysqlDocBuiltin = { +const mysqlDocBuiltin = { 'TINYINT': ['numeric-types'], 'SMALLINT': ['numeric-types'], 'MEDIUMINT': ['numeric-types'], @@ -364,3 +367,105 @@ export const mysqlDocBuiltin = { 'ENUM': ['string-types'], 'SET': ['string-types'] }; + +/** + * Adds doc link to single highlighted SQL element + * + * @param $elm + * @param params + */ +function documentationAdd ($elm, params) { + if (typeof mysqlDocTemplate === 'undefined') { + return; + } + + var url = window.sprintf( + decodeURIComponent(mysqlDocTemplate), + params[0] + ); + if (params.length > 1) { + // The # needs to be escaped to be part of the destination URL + url += encodeURIComponent('#') + params[1]; + } + var content = $elm.text(); + $elm.text(''); + $elm.append('' + content + ''); +} + +/** + * Generates doc links for keywords inside highlighted SQL + * + * @param idx + * @param elm + */ +function documentationKeyword (idx, elm) { + var $elm = $(elm); + /* Skip already processed ones */ + if ($elm.find('a').length > 0) { + return; + } + var keyword = $elm.text().toUpperCase(); + var $next = $elm.next('.cm-keyword'); + if ($next) { + var nextKeyword = $next.text().toUpperCase(); + var full = keyword + ' ' + nextKeyword; + + var $next2 = $next.next('.cm-keyword'); + if ($next2) { + var next2Keyword = $next2.text().toUpperCase(); + var full2 = full + ' ' + next2Keyword; + if (full2 in mysqlDocKeyword) { + documentationAdd($elm, mysqlDocKeyword[full2]); + documentationAdd($next, mysqlDocKeyword[full2]); + documentationAdd($next2, mysqlDocKeyword[full2]); + return; + } + } + if (full in mysqlDocKeyword) { + documentationAdd($elm, mysqlDocKeyword[full]); + documentationAdd($next, mysqlDocKeyword[full]); + return; + } + } + if (keyword in mysqlDocKeyword) { + documentationAdd($elm, mysqlDocKeyword[keyword]); + } +} + +/** + * Generates doc links for builtins inside highlighted SQL + * + * @param idx + * @param elm + */ +function documentationBuiltin (idx, elm) { + var $elm = $(elm); + var builtin = $elm.text().toUpperCase(); + if (builtin in mysqlDocBuiltin) { + documentationAdd($elm, mysqlDocBuiltin[builtin]); + } +} + +/** + * Higlights SQL using CodeMirror. + * + * @param $base + */ +export default function highlightSql ($base) { + var $elm = $base.find('code.sql'); + $elm.each(function () { + var $sql = $(this); + var $pre = $sql.find('pre'); + /* We only care about visible elements to avoid double processing */ + if ($pre.is(':visible')) { + var $highlight = $('
'); + $sql.append($highlight); + if (typeof window.CodeMirror !== 'undefined') { + window.CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]); + $pre.hide(); + $highlight.find('.cm-keyword').each(documentationKeyword); + $highlight.find('.cm-builtin').each(documentationBuiltin); + } + } + }); +} diff --git a/js/src/server/status/processes.js b/js/src/server/status/processes.js index db5f9d0288..c00c9721db 100644 --- a/js/src/server/status/processes.js +++ b/js/src/server/status/processes.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { AJAX } from '../../modules/ajax.js'; import { Functions } from '../../modules/functions.js'; import { CommonParams } from '../../modules/common.js'; +import highlightSql from '../../modules/sql-highlight.js'; /** * Server Status Processes @@ -101,7 +102,7 @@ var processList = { if (data.hasOwnProperty('success') && data.success) { var $newTable = $(data.message); $('#tableprocesslist').html($newTable.html()); - Functions.highlightSql($('#tableprocesslist')); + highlightSql($('#tableprocesslist')); } processList.refreshTimeout = setTimeout( processList.refresh, diff --git a/js/src/sql.js b/js/src/sql.js index 7c0943d567..22a712159e 100644 --- a/js/src/sql.js +++ b/js/src/sql.js @@ -4,6 +4,7 @@ import { Functions } from './modules/functions.js'; import { Navigation } from './modules/navigation.js'; import { CommonActions, CommonParams } from './modules/common.js'; import { Config } from './modules/config.js'; +import highlightSql from './modules/sql-highlight.js'; /** * @fileoverview functions used wherever an sql query form is used @@ -800,7 +801,7 @@ AJAX.registerOnload('sql.js', function () { $sqlqueryresultsouter .show() .html(data.message); - Functions.highlightSql($sqlqueryresultsouter); + highlightSql($sqlqueryresultsouter); if (data.menu) { history.replaceState({ @@ -841,7 +842,7 @@ AJAX.registerOnload('sql.js', function () { $('#sqlqueryresultsouter') .show() .html(data.message); - Functions.highlightSql($('#sqlqueryresultsouter')); + highlightSql($('#sqlqueryresultsouter')); }); } @@ -884,7 +885,7 @@ AJAX.registerOnload('sql.js', function () { $sqlqueryresults .html(data.message) .trigger('makegrid'); - Functions.highlightSql($sqlqueryresults); + highlightSql($sqlqueryresults); }); // end $.post() }); // end displayOptionsForm handler @@ -997,7 +998,7 @@ AJAX.registerOnload('sql.js', function () { modal.modal('show'); modal.find('.modal-body').first().html($dialogContent); modal.on('shown.bs.modal', function () { - Functions.highlightSql(modal); + highlightSql(modal); }); } else { Functions.ajaxShowMessage(response.error); diff --git a/js/src/table/operations.js b/js/src/table/operations.js index 3f0652ee19..65888e9895 100644 --- a/js/src/table/operations.js +++ b/js/src/table/operations.js @@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js'; import { Functions } from '../modules/functions.js'; import { Navigation } from '../modules/navigation.js'; import { CommonActions, CommonParams } from '../modules/common.js'; +import highlightSql from '../modules/sql-highlight.js'; /** * Unbind all event handlers before tearing down a page @@ -55,7 +56,7 @@ var confirmAndPost = function (linkObject, action) { Functions.ajaxShowMessage(data.message); $('
').prependTo('#page_content'); $('.sqlqueryresults').html(data.sql_query); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); } else { Functions.ajaxShowMessage(data.error, false); } @@ -164,7 +165,7 @@ AJAX.registerOnload('table/operations.js', function () { CommonParams.set('table', data.params.table); CommonActions.refreshMain(false, function () { $('#page_content').html(data.message); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); }); // Refresh navigation when the table is renamed Navigation.reload(); @@ -207,7 +208,7 @@ AJAX.registerOnload('table/operations.js', function () { Functions.ajaxShowMessage(data.message); $('
').prependTo('#page_content'); $('.sqlqueryresults').html(data.sql_query); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); scrollToTop(); } else if (typeof data !== 'undefined' && data.success === true) { $tempDiv = $('
'); @@ -216,7 +217,7 @@ AJAX.registerOnload('table/operations.js', function () { Functions.ajaxShowMessage($success); $('
').prependTo('#page_content'); $('.sqlqueryresults').html(data.message); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); $('.sqlqueryresults').children('fieldset,br').remove(); scrollToTop(); } else { diff --git a/js/src/table/select.js b/js/src/table/select.js index bac4cd12ee..cde44016a3 100644 --- a/js/src/table/select.js +++ b/js/src/table/select.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { AJAX } from '../modules/ajax.js'; import { Functions } from '../modules/functions.js'; import { CommonParams } from '../modules/common.js'; +import highlightSql from '../modules/sql-highlight.js'; /** * @fileoverview JavaScript functions used on /table/search @@ -179,7 +180,7 @@ AJAX.registerOnload('table/select.js', function () { } else { $('#sqlqueryresultsouter').html(data.error); } - Functions.highlightSql($('#sqlqueryresultsouter')); + highlightSql($('#sqlqueryresultsouter')); }); // end $.post() }); diff --git a/js/src/table/structure.js b/js/src/table/structure.js index 8f2f32d439..8c4af7ad35 100644 --- a/js/src/table/structure.js +++ b/js/src/table/structure.js @@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js'; import { Functions } from '../modules/functions.js'; import { Navigation } from '../modules/navigation.js'; import { CommonActions, CommonParams } from '../modules/common.js'; +import highlightSql from '../modules/sql-highlight.js'; /** * @fileoverview functions used on the table structure page @@ -87,7 +88,7 @@ AJAX.registerOnload('table/structure.js', function () { .empty() .append(data.message) .show(); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); $('.result_query .alert-primary').remove(); if (typeof data.structure_refresh_route !== 'string') { // Do not reload the form when the code below freshly filled it @@ -208,7 +209,7 @@ AJAX.registerOnload('table/structure.js', function () { $('
') .html(data.sql_query) .prependTo('#structure_content'); - Functions.highlightSql($('#page_content')); + highlightSql($('#page_content')); } // Adjust the row numbers for (var $row = $currRow.next(); $row.length > 0; $row = $row.next()) { @@ -337,7 +338,7 @@ AJAX.registerOnload('table/structure.js', function () { } modalBody.innerHTML = response.sql_data; - Functions.highlightSql($('#designerModalPreviewModal')); + highlightSql($('#designerModalPreviewModal')); }, error: () => { modalBody.innerHTML = ''; diff --git a/js/src/table/zoom_plot_jqplot.js b/js/src/table/zoom_plot_jqplot.js index 5cc2cb015b..8099668a4f 100644 --- a/js/src/table/zoom_plot_jqplot.js +++ b/js/src/table/zoom_plot_jqplot.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { AJAX } from '../modules/ajax.js'; import { Functions } from '../modules/functions.js'; import { CommonParams } from '../modules/common.js'; +import highlightSql from '../modules/sql-highlight.js'; // TODO: change the axis /** @@ -401,7 +402,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { }, function (data) { if (typeof data !== 'undefined' && data.success === true) { $('#sqlqueryresultsouter').html(data.sql_query); - Functions.highlightSql($('#sqlqueryresultsouter')); + highlightSql($('#sqlqueryresultsouter')); } else { Functions.ajaxShowMessage(data.error, false); }