From e4ea2308c070a046caa00cb3556f9f61b6c65bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 2 Jul 2022 11:23:07 -0300 Subject: Assign Messages global var to the window object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .eslintrc.json | 3 +- js/src/ajax.js | 24 +- js/src/config.js | 14 +- js/src/database/central_columns.js | 10 +- js/src/database/events.js | 24 +- js/src/database/multi_table_query.js | 2 +- js/src/database/operations.js | 18 +- js/src/database/qbe.js | 2 +- js/src/database/routines.js | 38 +-- js/src/database/search.js | 38 +-- js/src/database/structure.js | 48 ++-- js/src/database/tracking.js | 8 +- js/src/database/triggers.js | 20 +- js/src/datetimepicker.js | 112 ++++----- js/src/designer/database.js | 12 +- js/src/designer/history.js | 8 +- js/src/designer/move.js | 76 +++--- js/src/designer/page.js | 4 +- js/src/drag_drop_import.js | 18 +- js/src/error_report.js | 8 +- js/src/export.js | 18 +- js/src/functions.js | 118 +++++----- js/src/gis_data_editor.js | 34 +-- js/src/home.js | 6 +- js/src/import.js | 10 +- js/src/indexes.js | 28 +-- js/src/jqplot/plugins/jqplot.byteFormatter.js | 14 +- js/src/makegrid.js | 30 +-- js/src/menu_resizer.js | 2 +- js/src/modules/console.js | 20 +- js/src/navigation.js | 14 +- js/src/normalization.js | 70 +++--- js/src/replication.js | 2 +- js/src/server/databases.js | 12 +- js/src/server/privileges.js | 24 +- js/src/server/status/monitor.js | 260 ++++++++++----------- js/src/server/status/processes.js | 4 +- js/src/server/status/sorter.js | 4 +- js/src/server/user_groups.js | 2 +- js/src/server/variables.js | 4 +- js/src/sql.js | 38 +-- js/src/table/change.js | 10 +- js/src/table/chart.js | 2 +- js/src/table/find_replace.js | 8 +- js/src/table/operations.js | 28 +-- js/src/table/relation.js | 6 +- js/src/table/select.js | 18 +- js/src/table/structure.js | 20 +- js/src/table/tracking.js | 6 +- js/src/table/zoom_plot_jqplot.js | 20 +- js/src/u2f.js | 20 +- js/src/validator-messages.js | 40 ++-- .../Controllers/JavaScriptMessagesController.php | 2 +- libraries/classes/ErrorHandler.php | 4 +- templates/config/form_display/display.twig | 2 +- templates/import/javascript.twig | 6 +- templates/preferences/manage/main.twig | 2 +- .../JavaScriptMessagesControllerTest.php | 4 +- test/classes/ErrorReportTest.php | 2 +- 59 files changed, 700 insertions(+), 701 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f69d501621..e5605ec45d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,8 +15,7 @@ "jquery": true }, "globals": { - "Functions": "readonly", - "Messages": "readonly" + "Functions": "readonly" }, "rules": { "valid-jsdoc": ["error", { diff --git a/js/src/ajax.js b/js/src/ajax.js index 6a54781ed0..2cca6db451 100644 --- a/js/src/ajax.js +++ b/js/src/ajax.js @@ -197,7 +197,7 @@ window.AJAX = { // Show lock icon if locked targets is not empty. // otherwise remove lock icon if (!jQuery.isEmptyObject(window.AJAX.lockedTargets)) { - $('#lock_page_icon').html(Functions.getImage('s_lock', Messages.strLockToolTip).toString()); + $('#lock_page_icon').html(Functions.getImage('s_lock', window.Messages.strLockToolTip).toString()); } else { $('#lock_page_icon').html(''); } @@ -262,7 +262,7 @@ window.AJAX = { if (typeof event !== 'undefined' && event.type === 'click' && event.isTrigger !== true && !jQuery.isEmptyObject(window.AJAX.lockedTargets) && - confirm(Messages.strConfirmNavigation) === false + confirm(window.Messages.strConfirmNavigation) === false ) { return false; } @@ -279,7 +279,7 @@ window.AJAX = { window.AJAX.xhr.abort(); if (window.AJAX.xhr.status === 0 && window.AJAX.xhr.statusText === 'abort') { // If aborted - window.AJAX.$msgbox = Functions.ajaxShowMessage(Messages.strAbortedRequest); + window.AJAX.$msgbox = Functions.ajaxShowMessage(window.Messages.strAbortedRequest); window.AJAX.active = false; window.AJAX.xhr = null; previousLinkAborted = true; @@ -398,11 +398,11 @@ window.AJAX = { data.stopErrorReportLoop !== '1' ) { $('#pma_report_errors_form').trigger('submit'); - Functions.ajaxShowMessage(Messages.phpErrorsBeingSubmitted, false); + Functions.ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false); $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } else if (data.promptPhpErrors) { // otherwise just prompt user if it is set so. - msg = msg + Messages.phpErrorsFound; + msg = msg + window.Messages.phpErrorsFound; // scroll to bottom where all the errors are displayed. $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } @@ -421,7 +421,7 @@ window.AJAX = { // reload page if user trying to login has changed if (window.CommonParams.get('user') !== data.params.user) { window.location = 'index.php'; - Functions.ajaxShowMessage(Messages.strLoading, false); + Functions.ajaxShowMessage(window.Messages.strLoading, false); window.AJAX.active = false; window.AJAX.xhr = null; return; @@ -581,11 +581,11 @@ window.AJAX = { data.stopErrorReportLoop !== '1' ) { $('#pma_report_errors_form').trigger('submit'); - Functions.ajaxShowMessage(Messages.phpErrorsBeingSubmitted, false); + Functions.ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false); $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } else if (data.promptPhpErrors) { // otherwise just prompt user if it is set so. - msg = msg + Messages.phpErrorsFound; + msg = msg + window.Messages.phpErrorsFound; // scroll to bottom where all the errors are displayed. $('html, body').animate({ scrollTop:$(document).height() }, 'slow'); } @@ -919,15 +919,15 @@ window.AJAX = { } if (request.status !== 0) { - details += '
' + Functions.escapeHtml(Functions.sprintf(Messages.strErrorCode, request.status)) + '
'; + details += '
' + Functions.escapeHtml(Functions.sprintf(window.Messages.strErrorCode, request.status)) + '
'; } - details += '
' + Functions.escapeHtml(Functions.sprintf(Messages.strErrorText, request.statusText + ' (' + state + ')')) + '
'; + details += '
' + Functions.escapeHtml(Functions.sprintf(window.Messages.strErrorText, request.statusText + ' (' + state + ')')) + '
'; if (state === 'rejected' || state === 'timeout') { - details += '
' + Functions.escapeHtml(Messages.strErrorConnection) + '
'; + details += '
' + Functions.escapeHtml(window.Messages.strErrorConnection) + '
'; } Functions.ajaxShowMessage( '', false diff --git a/js/src/config.js b/js/src/config.js index c1d343d4f2..0a028c08ce 100644 --- a/js/src/config.js +++ b/js/src/config.js @@ -26,7 +26,7 @@ window.Config.isStorageSupported = (type, warn = false) => { } catch (error) { // Not supported if (warn) { - Functions.ajaxShowMessage(Messages.strNoLocalStorage, false); + Functions.ajaxShowMessage(window.Messages.strNoLocalStorage, false); } } return false; @@ -250,7 +250,7 @@ window.validators = { return true; } var result = this.value !== '0' && window.validators.regExpNumeric.test(this.value); - return result ? true : Messages.error_nan_p; + return result ? true : window.Messages.error_nan_p; }, /** * Validates non-negative number @@ -264,7 +264,7 @@ window.validators = { return true; } var result = window.validators.regExpNumeric.test(this.value); - return result ? true : Messages.error_nan_nneg; + return result ? true : window.Messages.error_nan_nneg; }, /** * Validates port number @@ -276,7 +276,7 @@ window.validators = { return true; } var result = window.validators.regExpNumeric.test(this.value) && this.value !== '0'; - return result && this.value <= 65535 ? true : Messages.error_incorrect_port; + return result && this.value <= 65535 ? true : window.Messages.error_incorrect_port; }, /** * Validates value according to given regular expression @@ -293,7 +293,7 @@ window.validators = { // convert PCRE regexp var parts = regexp.match(window.validators.regExpPcreExtract); var valid = this.value.match(new RegExp(parts[2], parts[3])) !== null; - return valid ? true : Messages.error_invalid_value; + return valid ? true : window.Messages.error_invalid_value; }, /** * Validates upper bound for numeric inputs @@ -308,7 +308,7 @@ window.validators = { if (isNaN(val)) { return true; } - return val <= maxValue ? true : Functions.sprintf(Messages.error_value_lte, maxValue); + return val <= maxValue ? true : Functions.sprintf(window.Messages.error_value_lte, maxValue); }, // field validators field: {}, @@ -678,7 +678,7 @@ function savePrefsToLocalStorage (form) { */ function updatePrefsDate () { var d = new Date(window.localStorage.configMtimeLocal); - var msg = Messages.strSavedOn.replace( + var msg = window.Messages.strSavedOn.replace( '@DATE@', Functions.formatDateTime(d) ); diff --git a/js/src/database/central_columns.js b/js/src/database/central_columns.js index b5e2bae98d..ae66057610 100644 --- a/js/src/database/central_columns.js +++ b/js/src/database/central_columns.js @@ -49,7 +49,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { event.preventDefault(); var multiDeleteColumns = $('.checkall:checkbox:checked').serialize(); if (multiDeleteColumns === '') { - Functions.ajaxShowMessage(Messages.strRadioUnchecked); + Functions.ajaxShowMessage(window.Messages.strRadioUnchecked); return false; } Functions.ajaxShowMessage(); @@ -60,7 +60,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { event.preventDefault(); var editColumnList = $('.checkall:checkbox:checked').serialize(); if (editColumnList === '') { - Functions.ajaxShowMessage(Messages.strRadioUnchecked); + Functions.ajaxShowMessage(window.Messages.strRadioUnchecked); return false; } var argsep = window.CommonParams.get('arg_separator'); @@ -115,7 +115,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { event.preventDefault(); event.stopPropagation(); var $td = $(this); - var question = Messages.strDeleteCentralColumnWarning; + var question = window.Messages.strDeleteCentralColumnWarning; $td.confirm(question, null, function () { var rownum = $td.data('rownum'); $('#del_col_name').val('selected_fld%5B%5D=' + $('#checkbox_row_' + rownum).val()); @@ -183,7 +183,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { error: function () { Functions.ajaxShowMessage( '', false ); @@ -200,7 +200,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { 'db' : window.CommonParams.get('db'), 'selectedTable' : selectValue }; - $('#column-select').html(''); + $('#column-select').html(''); if (selectValue !== '') { $.post(href, params, function (data) { $('#column-select').empty().append(defaultColumnSelect); diff --git a/js/src/database/events.js b/js/src/database/events.js index f54e1b2dca..1cc2497d64 100644 --- a/js/src/database/events.js +++ b/js/src/database/events.js @@ -40,7 +40,7 @@ const DatabaseEvents = { $elm = $('table.rte_table').last().find('input[name=item_name]'); if ($elm.val() === '') { $elm.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } $elm = $('table.rte_table').find('textarea[name=item_definition]'); @@ -50,7 +50,7 @@ const DatabaseEvents = { } else { $('textarea[name=item_definition]').last().trigger('focus'); } - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } // The validation has so far passed, so now @@ -63,7 +63,7 @@ const DatabaseEvents = { if ($this.attr('id') === 'bulkActionExportButton') { var combined = { success: true, - title: Messages.strExport, + title: window.Messages.strExport, message: '', error: '' }; @@ -106,7 +106,7 @@ const DatabaseEvents = { * for jQueryUI dialog buttons */ var buttonOptions = {}; - buttonOptions[Messages.strClose] = function () { + buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close').remove(); }; /** @@ -155,7 +155,7 @@ const DatabaseEvents = { Functions.ajaxRemoveMessage($msg); // Now define the function that is called when // the user presses the "Go" button - that.buttonOptions[Messages.strGo] = function () { + that.buttonOptions[window.Messages.strGo] = function () { // Move the data from the codemirror editor back to the // textarea, where it can be used in the form submission. if (typeof window.CodeMirror !== 'undefined') { @@ -168,7 +168,7 @@ const DatabaseEvents = { */ var data = $('form.rte_form').last().serialize(); $msg = Functions.ajaxShowMessage( - Messages.strProcessingRequest + window.Messages.strProcessingRequest ); var url = $('form.rte_form').last().attr('action'); $.post(url, data, function (data) { @@ -270,7 +270,7 @@ const DatabaseEvents = { }); // end $.post() } // end "if (that.validate())" }; // end of function that handles the submission of the Editor - that.buttonOptions[Messages.strClose] = function () { + that.buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close'); }; /** @@ -342,7 +342,7 @@ const DatabaseEvents = { * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $this.getPostData()); $.post(url, params, function (data) { if (data.success === true) { @@ -399,12 +399,12 @@ const DatabaseEvents = { dropMultipleDialog: function ($this) { // We ask for confirmation here - $this.confirm(Messages.strDropRTEitems, '', function () { + $this.confirm(window.Messages.strDropRTEitems, '', function () { /** * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); // drop anchors of all selected rows var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor'); @@ -495,7 +495,7 @@ const DatabaseEvents = { $elm = this.$ajaxDialog.find('input[name=item_interval_value]'); if ($elm.val() === '') { $elm.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } } else { @@ -503,7 +503,7 @@ const DatabaseEvents = { $elm = this.$ajaxDialog.find('input[name=item_execute_at]'); if ($elm.val() === '') { $elm.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } } diff --git a/js/src/database/multi_table_query.js b/js/src/database/multi_table_query.js index de2ef3c0e6..eeb4e1c9b1 100644 --- a/js/src/database/multi_table_query.js +++ b/js/src/database/multi_table_query.js @@ -120,7 +120,7 @@ window.AJAX.registerOnload('database/multi_table_query.js', function () { var query = editor.getDoc().getValue(); // Verifying that the query is not empty if (query === '') { - Functions.ajaxShowMessage(Messages.strEmptyQuery, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strEmptyQuery, false, 'error'); return; } var data = { diff --git a/js/src/database/operations.js b/js/src/database/operations.js index e13e8fd76f..ea1d483290 100644 --- a/js/src/database/operations.js +++ b/js/src/database/operations.js @@ -38,7 +38,7 @@ window.AJAX.registerOnload('database/operations.js', function () { event.preventDefault(); if (Functions.emptyCheckTheField(this, 'newname')) { - Functions.ajaxShowMessage(Messages.strFormEmpty, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strFormEmpty, false, 'error'); return false; } @@ -46,7 +46,7 @@ window.AJAX.registerOnload('database/operations.js', function () { var newDbName = $('#new_db_name').val(); if (newDbName === oldDbName) { - Functions.ajaxShowMessage(Messages.strDatabaseRenameToSameName, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strDatabaseRenameToSameName, false, 'error'); return false; } @@ -57,7 +57,7 @@ window.AJAX.registerOnload('database/operations.js', function () { Functions.prepareForAjaxRequest($form); $form.confirm(question, $form.attr('action'), function (url) { - Functions.ajaxShowMessage(Messages.strRenamingDatabases, false); + Functions.ajaxShowMessage(window.Messages.strRenamingDatabases, false); $.post(url, $('#rename_db_form').serialize() + window.CommonParams.get('arg_separator') + 'is_js_confirmed=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); @@ -89,11 +89,11 @@ window.AJAX.registerOnload('database/operations.js', function () { event.preventDefault(); if (Functions.emptyCheckTheField(this, 'newname')) { - Functions.ajaxShowMessage(Messages.strFormEmpty, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strFormEmpty, false, 'error'); return false; } - Functions.ajaxShowMessage(Messages.strCopyingDatabase, false); + Functions.ajaxShowMessage(window.Messages.strCopyingDatabase, false); var $form = $(this); Functions.prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize(), function (data) { @@ -131,7 +131,7 @@ window.AJAX.registerOnload('database/operations.js', function () { event.preventDefault(); var $form = $(this); Functions.prepareForAjaxRequest($form); - Functions.ajaxShowMessage(Messages.strChangingCharset); + Functions.ajaxShowMessage(window.Messages.strChangingCharset); $.post($form.attr('action'), $form.serialize(), function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); @@ -150,15 +150,15 @@ window.AJAX.registerOnload('database/operations.js', function () { /** * @var {String} question String containing the question to be asked for confirmation */ - var question = Messages.strDropDatabaseStrongWarning + ' '; + var question = window.Messages.strDropDatabaseStrongWarning + ' '; question += Functions.sprintf( - Messages.strDoYouReally, + window.Messages.strDoYouReally, 'DROP DATABASE `' + Functions.escapeHtml(window.CommonParams.get('db') + '`') ); var params = Functions.getJsConfirmCommonParam(this, $link.getPostData()); $(this).confirm(question, $(this).attr('href'), function (url) { - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post(url, params, function (data) { if (typeof data !== 'undefined' && data.success) { // Database deleted successfully, refresh both the frames diff --git a/js/src/database/qbe.js b/js/src/database/qbe.js index 9a13693ca5..888096a21e 100644 --- a/js/src/database/qbe.js +++ b/js/src/database/qbe.js @@ -73,7 +73,7 @@ window.AJAX.registerOnload('database/qbe.js', function () { * Ajax event handlers for 'Delete bookmark' */ $(document).on('click', '#deleteSearch', function () { - var question = Functions.sprintf(Messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text()); + var question = Functions.sprintf(window.Messages.strConfirmDeleteQBESearch, $('#searchId').find('option:selected').text()); if (!confirm(question)) { return false; } diff --git a/js/src/database/routines.js b/js/src/database/routines.js index e2e6c4de23..d7b9804e44 100644 --- a/js/src/database/routines.js +++ b/js/src/database/routines.js @@ -50,7 +50,7 @@ const DatabaseRoutines = { $elm = $('table.rte_table').last().find('input[name=item_name]'); if ($elm.val() === '') { $elm.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } $elm = $('table.rte_table').find('textarea[name=item_definition]'); @@ -60,7 +60,7 @@ const DatabaseRoutines = { } else { $('textarea[name=item_definition]').last().trigger('focus'); } - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } // The validation has so far passed, so now @@ -73,7 +73,7 @@ const DatabaseRoutines = { if ($this.attr('id') === 'bulkActionExportButton') { var combined = { success: true, - title: Messages.strExport, + title: window.Messages.strExport, message: '', error: '' }; @@ -84,7 +84,7 @@ const DatabaseRoutines = { // No routine is exportable (due to privilege issues) if (count === 0) { - Functions.ajaxShowMessage(Messages.NoExportable); + Functions.ajaxShowMessage(window.Messages.NoExportable); } var p = $.when(); exportAnchors.each(function () { @@ -121,7 +121,7 @@ const DatabaseRoutines = { * for jQueryUI dialog buttons */ var buttonOptions = {}; - buttonOptions[Messages.strClose] = function () { + buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close').remove(); }; /** @@ -170,7 +170,7 @@ const DatabaseRoutines = { Functions.ajaxRemoveMessage($msg); // Now define the function that is called when // the user presses the "Go" button - that.buttonOptions[Messages.strGo] = function () { + that.buttonOptions[window.Messages.strGo] = function () { // Move the data from the codemirror editor back to the // textarea, where it can be used in the form submission. if (typeof window.CodeMirror !== 'undefined') { @@ -183,7 +183,7 @@ const DatabaseRoutines = { */ var data = $('form.rte_form').last().serialize(); $msg = Functions.ajaxShowMessage( - Messages.strProcessingRequest + window.Messages.strProcessingRequest ); var url = $('form.rte_form').last().attr('action'); $.post(url, data, function (data) { @@ -287,7 +287,7 @@ const DatabaseRoutines = { }); // end $.post() } // end "if (that.validate())" }; // end of function that handles the submission of the Editor - that.buttonOptions[Messages.strClose] = function () { + that.buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close'); }; /** @@ -363,7 +363,7 @@ const DatabaseRoutines = { * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $this.getPostData()); $.post(url, params, function (data) { if (data.success === true) { @@ -420,12 +420,12 @@ const DatabaseRoutines = { dropMultipleDialog: function ($this) { // We ask for confirmation here - $this.confirm(Messages.strDropRTEitems, '', function () { + $this.confirm(window.Messages.strDropRTEitems, '', function () { /** * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); // drop anchors of all selected rows var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor'); @@ -611,7 +611,7 @@ const DatabaseRoutines = { } }); if (! isSuccess) { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } this.$ajaxDialog.find('table.routine_params_table').last().find('tr').each(function () { @@ -629,7 +629,7 @@ const DatabaseRoutines = { } }); if (! isSuccess) { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } if (this.$ajaxDialog.find('select[name=item_type]').find(':selected').val() === 'FUNCTION') { @@ -641,7 +641,7 @@ const DatabaseRoutines = { $returnlen.val() === '' ) { $returnlen.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } } @@ -649,7 +649,7 @@ const DatabaseRoutines = { // A function must contain a RETURN statement in its definition if (this.$ajaxDialog.find('table.rte_table').find('textarea[name=item_definition]').val().toUpperCase().indexOf('RETURN') < 0) { this.syntaxHiglighter.focus(); - alert(Messages.MissingReturn); + alert(window.Messages.MissingReturn); return false; } } @@ -761,13 +761,13 @@ const DatabaseRoutines = { if (data.dialog) { // Define the function that is called when // the user presses the "Go" button - that.buttonOptions[Messages.strGo] = function () { + that.buttonOptions[window.Messages.strGo] = function () { /** * @var data Form data to be sent in the AJAX request */ var data = $('form.rte_form').last().serialize(); $msg = Functions.ajaxShowMessage( - Messages.strProcessingRequest + window.Messages.strProcessingRequest ); $.post('index.php?route=/database/routines', data, function (data) { if (data.success === true) { @@ -780,7 +780,7 @@ const DatabaseRoutines = { } }); }; - that.buttonOptions[Messages.strClose] = function () { + that.buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close'); }; /** @@ -813,7 +813,7 @@ const DatabaseRoutines = { */ var data = $(this).serialize(); $msg = Functions.ajaxShowMessage( - Messages.strProcessingRequest + window.Messages.strProcessingRequest ); var url = $(this).attr('action'); $.post(url, data, function (data) { diff --git a/js/src/database/search.js b/js/src/database/search.js index e23e291f91..3bbb7858ca 100644 --- a/js/src/database/search.js +++ b/js/src/database/search.js @@ -55,14 +55,14 @@ window.AJAX.registerOnload('database/search.js', function () { * the hide/show criteria in search result forms */ $('#togglesearchresultlink') - .html(Messages.strHideSearchResults) + .html(window.Messages.strHideSearchResults) .on('click', function () { var $link = $(this); $('#searchresults').slideToggle(); - if ($link.text() === Messages.strHideSearchResults) { - $link.text(Messages.strShowSearchResults); + if ($link.text() === window.Messages.strHideSearchResults) { + $link.text(window.Messages.strShowSearchResults); } else { - $link.text(Messages.strHideSearchResults); + $link.text(window.Messages.strHideSearchResults); } /** avoid default click action */ return false; @@ -84,10 +84,10 @@ window.AJAX.registerOnload('database/search.js', function () { .on('click', function () { var $link = $(this); $('#sqlqueryform').slideToggle('medium'); - if ($link.text() === Messages.strHideQueryBox) { - $link.text(Messages.strShowQueryBox); + if ($link.text() === window.Messages.strHideQueryBox) { + $link.text(window.Messages.strShowQueryBox); } else { - $link.text(Messages.strHideQueryBox); + $link.text(window.Messages.strHideQueryBox); } /** avoid default click action */ return false; @@ -100,14 +100,14 @@ window.AJAX.registerOnload('database/search.js', function () { * the hide/show criteria in search criteria form */ $('#togglesearchformlink') - .html(Messages.strShowSearchCriteria) + .html(window.Messages.strShowSearchCriteria) .on('click', function () { var $link = $(this); $('#db_search_form').slideToggle(); - if ($link.text() === Messages.strHideSearchCriteria) { - $link.text(Messages.strShowSearchCriteria); + if ($link.text() === window.Messages.strHideSearchCriteria) { + $link.text(window.Messages.strShowSearchCriteria); } else { - $link.text(Messages.strHideSearchCriteria); + $link.text(window.Messages.strHideSearchCriteria); } /** avoid default click action */ return false; @@ -119,7 +119,7 @@ window.AJAX.registerOnload('database/search.js', function () { $(document).on('click', 'a.browse_results', function (e) { e.preventDefault(); /** Hides the results shown by the delete criteria */ - var $msg = Functions.ajaxShowMessage(Messages.strBrowsing, false); + var $msg = Functions.ajaxShowMessage(window.Messages.strBrowsing, false); $('#sqlqueryform').hide(); $('#togglequerybox').hide(); /** Load the browse results to the page */ @@ -164,11 +164,11 @@ window.AJAX.registerOnload('database/search.js', function () { $('#togglequerybox').hide(); /** Conformation message for deletion */ var msg = Functions.sprintf( - Messages.strConfirmDeleteResults, + window.Messages.strConfirmDeleteResults, $(this).data('table-name') ); if (confirm(msg)) { - var $msg = Functions.ajaxShowMessage(Messages.strDeleting, false); + var $msg = Functions.ajaxShowMessage(window.Messages.strDeleting, false); /** Load the deleted option to the page*/ $('#sqlqueryform').html(''); var params = { @@ -187,7 +187,7 @@ window.AJAX.registerOnload('database/search.js', function () { $('#sqlqueryform').html(data.sql_query); /** Refresh the search results after the deletion */ $('#buttonGo').trigger('click'); - $('#togglequerybox').html(Messages.strHideQueryBox); + $('#togglequerybox').html(window.Messages.strHideQueryBox); /** Show the results of the deletion option */ $('#browse-results').hide(); $('#sqlqueryform').show(); @@ -207,10 +207,10 @@ window.AJAX.registerOnload('database/search.js', function () { $(document).on('submit', '#db_search_form.ajax', function (event) { event.preventDefault(); if ($('#criteriaTables :selected').length === 0) { - Functions.ajaxShowMessage(Messages.strNoTableSelected); + Functions.ajaxShowMessage(window.Messages.strNoTableSelected); return; } - var $msgbox = Functions.ajaxShowMessage(Messages.strSearching, false); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strSearching, false); // jQuery object to reuse var $form = $(this); @@ -224,7 +224,7 @@ window.AJAX.registerOnload('database/search.js', function () { $('#togglesearchresultlink') // always start with the Show message - .text(Messages.strHideSearchResults); + .text(window.Messages.strHideSearchResults); $('#togglesearchresultsdiv') // now it's time to show the div containing the link .show(); @@ -237,7 +237,7 @@ window.AJAX.registerOnload('database/search.js', function () { .hide(); $('#togglesearchformlink') // always start with the Show message - .text(Messages.strShowSearchCriteria); + .text(window.Messages.strShowSearchCriteria); $('#togglesearchformdiv') // now it's time to show the div containing the link .show(); diff --git a/js/src/database/structure.js b/js/src/database/structure.js index cb83d95f87..9bcbd0abb4 100644 --- a/js/src/database/structure.js +++ b/js/src/database/structure.js @@ -40,13 +40,13 @@ window.AJAX.registerTeardown('database/structure.js', function () { */ DatabaseStructure.adjustTotals = function () { var byteUnits = [ - Messages.strB, - Messages.strKiB, - Messages.strMiB, - Messages.strGiB, - Messages.strTiB, - Messages.strPiB, - Messages.strEiB + window.Messages.strB, + window.Messages.strKiB, + window.Messages.strMiB, + window.Messages.strGiB, + window.Messages.strTiB, + window.Messages.strPiB, + window.Messages.strEiB ]; /** * @var $allTr jQuery object that references all the rows in the list of tables @@ -130,7 +130,7 @@ DatabaseStructure.adjustTotals = function () { // Update summary with new data var $summary = $('#tbl_summary_row'); - $summary.find('.tbl_num').text(Functions.sprintf(Messages.strNTables, tableSum)); + $summary.find('.tbl_num').text(Functions.sprintf(window.Messages.strNTables, tableSum)); if (rowSumApproximated) { $summary.find('.row_count_sum').text(strRowSum); } else { @@ -176,11 +176,11 @@ DatabaseStructure.fetchRealRowCount = function ($target) { // Adjust the 'Sum' displayed at the bottom. DatabaseStructure.adjustTotals(); } else { - Functions.ajaxShowMessage(Messages.strErrorRealRowCount); + Functions.ajaxShowMessage(window.Messages.strErrorRealRowCount); } }, error: function () { - Functions.ajaxShowMessage(Messages.strErrorRealRowCount); + Functions.ajaxShowMessage(window.Messages.strErrorRealRowCount); } }); }; @@ -233,16 +233,16 @@ window.AJAX.registerOnload('database/structure.js', function () { var modalTitle = ''; if (action === 'copy_tbl') { url = 'index.php?route=/database/structure/copy-form'; - modalTitle = Messages.strCopyTablesTo; + modalTitle = window.Messages.strCopyTablesTo; } else if (action === 'add_prefix_tbl') { url = 'index.php?route=/database/structure/add-prefix'; - modalTitle = Messages.strAddPrefix; + modalTitle = window.Messages.strAddPrefix; } else if (action === 'replace_prefix_tbl') { url = 'index.php?route=/database/structure/change-prefix-form'; - modalTitle = Messages.strReplacePrefix; + modalTitle = window.Messages.strReplacePrefix; } else if (action === 'copy_tbl_change_prefix') { url = 'index.php?route=/database/structure/change-prefix-form'; - modalTitle = Messages.strCopyPrefix; + modalTitle = window.Messages.strCopyPrefix; } $.ajax({ type: 'POST', @@ -323,12 +323,12 @@ window.AJAX.registerOnload('database/structure.js', function () { /** * @var question String containing the question to be asked for confirmation */ - var question = Messages.strTruncateTableStrongWarning + ' ' + - Functions.sprintf(Messages.strDoYouReally, 'TRUNCATE `' + Functions.escapeHtml(currTableName) + '`') + + var question = window.Messages.strTruncateTableStrongWarning + ' ' + + Functions.sprintf(window.Messages.strDoYouReally, 'TRUNCATE `' + Functions.escapeHtml(currTableName) + '`') + Functions.getForeignKeyCheckboxLoader(); $thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) { - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData()); @@ -341,7 +341,7 @@ window.AJAX.registerOnload('database/structure.js', function () { $tr.find('.tbl_size, .tbl_overhead').text('-'); DatabaseStructure.adjustTotals(); } else { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false); } }); // end $.post() }, Functions.loadForeignKeyCheckbox); @@ -373,16 +373,16 @@ window.AJAX.registerOnload('database/structure.js', function () { */ var question; if (! isView) { - question = Messages.strDropTableStrongWarning + ' ' + - Functions.sprintf(Messages.strDoYouReally, 'DROP TABLE `' + Functions.escapeHtml(currTableName) + '`'); + question = window.Messages.strDropTableStrongWarning + ' ' + + Functions.sprintf(window.Messages.strDoYouReally, 'DROP TABLE `' + Functions.escapeHtml(currTableName) + '`'); } else { question = - Functions.sprintf(Messages.strDoYouReally, 'DROP VIEW `' + Functions.escapeHtml(currTableName) + '`'); + Functions.sprintf(window.Messages.strDoYouReally, 'DROP VIEW `' + Functions.escapeHtml(currTableName) + '`'); } question += Functions.getForeignKeyCheckboxLoader(); $thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) { - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData()); @@ -394,7 +394,7 @@ window.AJAX.registerOnload('database/structure.js', function () { Navigation.reload(); Functions.ajaxRemoveMessage($msg); } else { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false); } }); // end $.post() }, Functions.loadForeignKeyCheckbox); @@ -411,7 +411,7 @@ window.AJAX.registerOnload('database/structure.js', function () { /** * @var question String containing the question to be asked for confirmation */ - var question = Messages.strOperationTakesLongTime; + var question = window.Messages.strOperationTakesLongTime; $(this).confirm(question, '', function () { return true; diff --git a/js/src/database/tracking.js b/js/src/database/tracking.js index e1a75bef81..c1154d3a3a 100644 --- a/js/src/database/tracking.js +++ b/js/src/database/tracking.js @@ -47,9 +47,9 @@ window.AJAX.registerOnload('database/tracking.js', function () { var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val(); if ($button.val() === 'delete_tracking') { - var question = Messages.strDeleteTrackingDataMultiple; + var question = window.Messages.strDeleteTrackingDataMultiple; $button.confirm(question, $form.attr('action'), function (url) { - Functions.ajaxShowMessage(Messages.strDeletingTrackingData); + Functions.ajaxShowMessage(window.Messages.strDeletingTrackingData); window.AJAX.source = $form; $.post(url, submitData, window.AJAX.responseHandler); }); @@ -80,9 +80,9 @@ window.AJAX.registerOnload('database/tracking.js', function () { $body.on('click', 'a.delete_tracking_anchor.ajax', function (e) { e.preventDefault(); var $anchor = $(this); - var question = Messages.strDeleteTrackingData; + var question = window.Messages.strDeleteTrackingData; $anchor.confirm(question, $anchor.attr('href'), function (url) { - Functions.ajaxShowMessage(Messages.strDeletingTrackingData); + Functions.ajaxShowMessage(window.Messages.strDeletingTrackingData); window.AJAX.source = $anchor; var argSep = window.CommonParams.get('arg_separator'); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); diff --git a/js/src/database/triggers.js b/js/src/database/triggers.js index 8c8c486a6c..5a1970f9c1 100644 --- a/js/src/database/triggers.js +++ b/js/src/database/triggers.js @@ -39,7 +39,7 @@ const DatabaseTriggers = { $elm = $('table.rte_table').last().find('input[name=item_name]'); if ($elm.val() === '') { $elm.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } $elm = $('table.rte_table').find('textarea[name=item_definition]'); @@ -49,7 +49,7 @@ const DatabaseTriggers = { } else { $('textarea[name=item_definition]').last().trigger('focus'); } - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return false; } // The validation has so far passed, so now @@ -72,7 +72,7 @@ const DatabaseTriggers = { if ($this.attr('id') === 'bulkActionExportButton') { var combined = { success: true, - title: Messages.strExport, + title: window.Messages.strExport, message: '', error: '' }; @@ -115,7 +115,7 @@ const DatabaseTriggers = { * for jQueryUI dialog buttons */ var buttonOptions = {}; - buttonOptions[Messages.strClose] = function () { + buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close').remove(); }; /** @@ -164,7 +164,7 @@ const DatabaseTriggers = { Functions.ajaxRemoveMessage($msg); // Now define the function that is called when // the user presses the "Go" button - that.buttonOptions[Messages.strGo] = function () { + that.buttonOptions[window.Messages.strGo] = function () { // Move the data from the codemirror editor back to the // textarea, where it can be used in the form submission. if (typeof window.CodeMirror !== 'undefined') { @@ -177,7 +177,7 @@ const DatabaseTriggers = { */ var data = $('form.rte_form').last().serialize(); $msg = Functions.ajaxShowMessage( - Messages.strProcessingRequest + window.Messages.strProcessingRequest ); var url = $('form.rte_form').last().attr('action'); $.post(url, data, function (data) { @@ -279,7 +279,7 @@ const DatabaseTriggers = { }); // end $.post() } // end "if (that.validate())" }; // end of function that handles the submission of the Editor - that.buttonOptions[Messages.strClose] = function () { + that.buttonOptions[window.Messages.strClose] = function () { $(this).dialog('close'); }; /** @@ -351,7 +351,7 @@ const DatabaseTriggers = { * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $this.getPostData()); $.post(url, params, function (data) { if (data.success === true) { @@ -408,12 +408,12 @@ const DatabaseTriggers = { dropMultipleDialog: function ($this) { // We ask for confirmation here - $this.confirm(Messages.strDropRTEitems, '', function () { + $this.confirm(window.Messages.strDropRTEitems, '', function () { /** * @var msg jQuery object containing the reference to * the AJAX message shown to the user */ - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); // drop anchors of all selected rows var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor'); diff --git a/js/src/datetimepicker.js b/js/src/datetimepicker.js index 8257976b38..f444f26878 100644 --- a/js/src/datetimepicker.js +++ b/js/src/datetimepicker.js @@ -5,68 +5,68 @@ function registerDatePickerTranslations () { return; } - $.datepicker.regional[''].closeText = Messages.strCalendarClose; - $.datepicker.regional[''].prevText = Messages.strCalendarPrevious; - $.datepicker.regional[''].nextText = Messages.strCalendarNext; - $.datepicker.regional[''].currentText = Messages.strCalendarCurrent; + $.datepicker.regional[''].closeText = window.Messages.strCalendarClose; + $.datepicker.regional[''].prevText = window.Messages.strCalendarPrevious; + $.datepicker.regional[''].nextText = window.Messages.strCalendarNext; + $.datepicker.regional[''].currentText = window.Messages.strCalendarCurrent; $.datepicker.regional[''].monthNames = [ - Messages.strMonthNameJan, - Messages.strMonthNameFeb, - Messages.strMonthNameMar, - Messages.strMonthNameApr, - Messages.strMonthNameMay, - Messages.strMonthNameJun, - Messages.strMonthNameJul, - Messages.strMonthNameAug, - Messages.strMonthNameSep, - Messages.strMonthNameOct, - Messages.strMonthNameNov, - Messages.strMonthNameDec, + window.Messages.strMonthNameJan, + window.Messages.strMonthNameFeb, + window.Messages.strMonthNameMar, + window.Messages.strMonthNameApr, + window.Messages.strMonthNameMay, + window.Messages.strMonthNameJun, + window.Messages.strMonthNameJul, + window.Messages.strMonthNameAug, + window.Messages.strMonthNameSep, + window.Messages.strMonthNameOct, + window.Messages.strMonthNameNov, + window.Messages.strMonthNameDec, ]; $.datepicker.regional[''].monthNamesShort = [ - Messages.strMonthNameJanShort, - Messages.strMonthNameFebShort, - Messages.strMonthNameMarShort, - Messages.strMonthNameAprShort, - Messages.strMonthNameMayShort, - Messages.strMonthNameJunShort, - Messages.strMonthNameJulShort, - Messages.strMonthNameAugShort, - Messages.strMonthNameSepShort, - Messages.strMonthNameOctShort, - Messages.strMonthNameNovShort, - Messages.strMonthNameDecShort, + window.Messages.strMonthNameJanShort, + window.Messages.strMonthNameFebShort, + window.Messages.strMonthNameMarShort, + window.Messages.strMonthNameAprShort, + window.Messages.strMonthNameMayShort, + window.Messages.strMonthNameJunShort, + window.Messages.strMonthNameJulShort, + window.Messages.strMonthNameAugShort, + window.Messages.strMonthNameSepShort, + window.Messages.strMonthNameOctShort, + window.Messages.strMonthNameNovShort, + window.Messages.strMonthNameDecShort, ]; $.datepicker.regional[''].dayNames = [ - Messages.strDayNameSun, - Messages.strDayNameMon, - Messages.strDayNameTue, - Messages.strDayNameWed, - Messages.strDayNameThu, - Messages.strDayNameFri, - Messages.strDayNameSat, + window.Messages.strDayNameSun, + window.Messages.strDayNameMon, + window.Messages.strDayNameTue, + window.Messages.strDayNameWed, + window.Messages.strDayNameThu, + window.Messages.strDayNameFri, + window.Messages.strDayNameSat, ]; $.datepicker.regional[''].dayNamesShort = [ - Messages.strDayNameSunShort, - Messages.strDayNameMonShort, - Messages.strDayNameTueShort, - Messages.strDayNameWedShort, - Messages.strDayNameThuShort, - Messages.strDayNameFriShort, - Messages.strDayNameSatShort, + window.Messages.strDayNameSunShort, + window.Messages.strDayNameMonShort, + window.Messages.strDayNameTueShort, + window.Messages.strDayNameWedShort, + window.Messages.strDayNameThuShort, + window.Messages.strDayNameFriShort, + window.Messages.strDayNameSatShort, ]; $.datepicker.regional[''].dayNamesMin = [ - Messages.strDayNameSunMin, - Messages.strDayNameMonMin, - Messages.strDayNameTueMin, - Messages.strDayNameWedMin, - Messages.strDayNameThuMin, - Messages.strDayNameFriMin, - Messages.strDayNameSatMin, + window.Messages.strDayNameSunMin, + window.Messages.strDayNameMonMin, + window.Messages.strDayNameTueMin, + window.Messages.strDayNameWedMin, + window.Messages.strDayNameThuMin, + window.Messages.strDayNameFriMin, + window.Messages.strDayNameSatMin, ]; - $.datepicker.regional[''].weekHeader = Messages.strWeekHeader; - $.datepicker.regional[''].showMonthAfterYear = Messages.strMonthAfterYear === 'calendar-year-month'; - $.datepicker.regional[''].yearSuffix = Messages.strYearSuffix !== 'none' ? Messages.strYearSuffix : ''; + $.datepicker.regional[''].weekHeader = window.Messages.strWeekHeader; + $.datepicker.regional[''].showMonthAfterYear = window.Messages.strMonthAfterYear === 'calendar-year-month'; + $.datepicker.regional[''].yearSuffix = window.Messages.strYearSuffix !== 'none' ? window.Messages.strYearSuffix : ''; // eslint-disable-next-line no-underscore-dangle $.extend($.datepicker._defaults, $.datepicker.regional['']); @@ -79,10 +79,10 @@ function registerTimePickerTranslations () { return; } - $.timepicker.regional[''].timeText = Messages.strCalendarTime; - $.timepicker.regional[''].hourText = Messages.strCalendarHour; - $.timepicker.regional[''].minuteText = Messages.strCalendarMinute; - $.timepicker.regional[''].secondText = Messages.strCalendarSecond; + $.timepicker.regional[''].timeText = window.Messages.strCalendarTime; + $.timepicker.regional[''].hourText = window.Messages.strCalendarHour; + $.timepicker.regional[''].minuteText = window.Messages.strCalendarMinute; + $.timepicker.regional[''].secondText = window.Messages.strCalendarSecond; // eslint-disable-next-line no-underscore-dangle $.extend($.timepicker._defaults, $.timepicker.regional['']); diff --git a/js/src/designer/database.js b/js/src/designer/database.js index f702e7d222..bfd808e969 100644 --- a/js/src/designer/database.js +++ b/js/src/designer/database.js @@ -85,7 +85,7 @@ var DesignerOfflineDB = (function () { }; request.onerror = function () { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); }; }; @@ -97,7 +97,7 @@ var DesignerOfflineDB = (function () { */ designerDB.loadObject = function (table, id, callback) { if (datastore === null) { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); return; } @@ -118,7 +118,7 @@ var DesignerOfflineDB = (function () { */ designerDB.loadAllObjects = function (table, callback) { if (datastore === null) { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); return; } @@ -149,7 +149,7 @@ var DesignerOfflineDB = (function () { */ designerDB.loadFirstObject = function (table, callback) { if (datastore === null) { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); return; } @@ -180,7 +180,7 @@ var DesignerOfflineDB = (function () { */ designerDB.addObject = function (table, obj, callback) { if (datastore === null) { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); return; } @@ -204,7 +204,7 @@ var DesignerOfflineDB = (function () { */ designerDB.deleteObject = function (table, id, callback) { if (datastore === null) { - Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error'); + Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error'); return; } diff --git a/js/src/designer/history.js b/js/src/designer/history.js index 8bf57f4a56..333285b870 100644 --- a/js/src/designer/history.js +++ b/js/src/designer/history.js @@ -93,19 +93,19 @@ DesignerHistory.display = function (init, finit) { } else { str += ''; } - str += '' + Functions.getImage('b_sbrowse', Messages.strColumnName) + '' + + str += '' + Functions.getImage('b_sbrowse', window.Messages.strColumnName) + '' + '' + $('
').text(historyArray[i].getColumnName()).html() + ''; if (historyArray[i].getType() === 'GroupBy' || historyArray[i].getType() === 'OrderBy') { var detailDescGroupBy = $('
').text(DesignerHistory.detail(i)).html(); str += '' + Functions.getImage('s_info', DesignerHistory.detail(i)) + '' + '' + historyArray[i].getType() + '' + - '' + Functions.getImage('b_drop', Messages.strDelete) + ''; + '' + Functions.getImage('b_drop', window.Messages.strDelete) + ''; } else { var detailDesc = $('
').text(DesignerHistory.detail(i)).html(); str += '' + Functions.getImage('s_info', DesignerHistory.detail(i)) + '' + '' + historyArray[i].getType() + '' + - '' + Functions.getImage('b_edit', Messages.strEdit) + '' + - '' + Functions.getImage('b_drop', Messages.strDelete) + ''; + '' + Functions.getImage('b_edit', window.Messages.strEdit) + '' + + '' + Functions.getImage('b_drop', window.Messages.strDelete) + ''; } str += ''; i++; diff --git a/js/src/designer/move.js b/js/src/designer/move.js index 062e181f48..eed110e997 100644 --- a/js/src/designer/move.js +++ b/js/src/designer/move.js @@ -586,9 +586,9 @@ DesignerMove.addTableToTablesList = function (index, tableDom) { var dbEncoded = $(tableDom).find('.small_tab_pref').attr('db_url'); var tableEncoded = $(tableDom).find('.small_tab_pref').attr('table_name_url'); var tableIsChecked = $(tableDom).css('display') === 'block' ? 'checked' : ''; - var checkboxStatus = (tableIsChecked === 'checked') ? Messages.strHide : Messages.strShow; + var checkboxStatus = (tableIsChecked === 'checked') ? window.Messages.strHide : window.Messages.strShow; var $newTableLine = $('' + - ' ' + ' '); - $selectDb.append(''); + $selectDb.append(''); var $selectTable = $(''); - $selectTable.append(''); + $selectTable.append(''); $.post('index.php?route=/sql', { 'ajax_request' : true, @@ -662,7 +662,7 @@ DesignerMove.addOtherDbTables = function () { var $form = $('
') .append($selectDb).append($selectTable); - var modal = DesignerMove.displayModal($form, Messages.strAddTables, '#designerGoModal'); + var modal = DesignerMove.displayModal($form, window.Messages.strAddTables, '#designerGoModal'); $('#designerModalGoButton').on('click', function () { var db = $('#add_table_from').val(); var table = $('#add_table').val(); @@ -671,7 +671,7 @@ DesignerMove.addOtherDbTables = function () { var $table = $('[id="' + encodeURIComponent(db) + '.' + encodeURIComponent(table) + '"]'); if ($table.length !== 0) { Functions.ajaxShowMessage( - Functions.sprintf(Messages.strTableAlreadyExists, db + '.' + table), + Functions.sprintf(window.Messages.strTableAlreadyExists, db + '.' + table), undefined, 'error' ); @@ -714,7 +714,7 @@ DesignerMove.addOtherDbTables = function () { $selectTable.html(''); var rows = $(data.message).find('table.table_results.data.ajax').find('td.data'); if (rows.length === 0) { - $selectTable.append(''); + $selectTable.append(''); } rows.each(function () { var val = $(this)[0].innerText; @@ -785,13 +785,13 @@ DesignerMove.save2 = function (callback) { poststr += argsep + 'server=' + server + argsep + 'db=' + encodeURIComponent(db) + argsep + 'selected_page=' + selectedPage; poststr += DesignerMove.getUrlPos(); - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post('index.php?route=/database/designer', poststr, function (data) { if (data.success === false) { Functions.ajaxShowMessage(data.error, false); } else { Functions.ajaxRemoveMessage($msgbox); - Functions.ajaxShowMessage(Messages.strModificationSaved); + Functions.ajaxShowMessage(window.Messages.strModificationSaved); DesignerMove.markSaved(); if (typeof callback !== 'undefined') { callback(); @@ -813,13 +813,13 @@ DesignerMove.submitSaveDialogAndClose = function (callback, modal) { var $form = $('#save_page'); var name = $form.find('input[name="selected_value"]').val().trim(); if (name === '') { - Functions.ajaxShowMessage(Messages.strEnterValidPageName, false); + Functions.ajaxShowMessage(window.Messages.strEnterValidPageName, false); return; } modal.modal('hide'); if (designerTablesEnabled) { - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); Functions.prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize() + DesignerMove.getUrlPos(), function (data) { if (data.success === false) { @@ -859,9 +859,9 @@ DesignerMove.save3 = function (callback) { .append($('').val(db)) .append('') .append('') - .append('
'; }); /** @@ -3165,7 +3165,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca * @var the_form object referring to the export form */ var $form = $('#index_frm'); - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); Functions.prepareForAjaxRequest($form); // User wants to submit the form $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { @@ -3255,7 +3255,7 @@ Functions.showIndexEditDialog = function ($outer) { max: 16, slide: function (event, ui) { $(this).closest('fieldset').find('input[type=submit]').val( - Functions.sprintf(Messages.strAddToIndex, ui.value) + Functions.sprintf(window.Messages.strAddToIndex, ui.value) ); } }); @@ -4054,7 +4054,7 @@ Functions.checkNumberOfFields = function () { $('form').each(function () { var nbInputs = $(this).find(':input').length; if (nbInputs > maxInputVars) { - var warning = Functions.sprintf(Messages.strTooManyInputs, maxInputVars); + var warning = Functions.sprintf(window.Messages.strTooManyInputs, maxInputVars); Functions.ajaxShowMessage(warning); return false; } diff --git a/js/src/gis_data_editor.js b/js/src/gis_data_editor.js index bea935451a..5fc705e239 100644 --- a/js/src/gis_data_editor.js +++ b/js/src/gis_data_editor.js @@ -27,13 +27,13 @@ function closeGISEditor () { function prepareJSVersion () { // Change the text on the submit button $('#gis_editor').find('input[name=\'gis_data[save]\']') - .val(Messages.strCopy) + .val(window.Messages.strCopy) .insertAfter($('#gis_data_textarea')) .before('

'); // Add close and cancel links - $('#gis_data_editor').prepend('' + Messages.strClose + ''); - $(' ' + Messages.strCancel + '') + $('#gis_data_editor').prepend('' + window.Messages.strClose + ''); + $(' ' + window.Messages.strCancel + '') .insertAfter($('input[name=\'gis_data[save]\']')); // Remove the unnecessary text @@ -61,10 +61,10 @@ function prepareJSVersion () { */ function addDataPoint (pointNumber, prefix) { return '
' + - Functions.sprintf(Messages.strPointN, (pointNumber + 1)) + ': ' + - '' + + Functions.sprintf(window.Messages.strPointN, (pointNumber + 1)) + ': ' + + '' + '' + - '' + + '' + ''; } @@ -318,10 +318,10 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { var html = '
'; var noOfPoints; if (type === 'MULTILINESTRING') { - html += Messages.strLineString + ' ' + (noOfLines + 1) + ':'; + html += window.Messages.strLineString + ' ' + (noOfLines + 1) + ':'; noOfPoints = 2; } else { - html += Messages.strInnerRing + ' ' + noOfLines + ':'; + html += window.Messages.strInnerRing + ' ' + noOfLines + ':'; noOfPoints = 4; } html += ''; @@ -329,7 +329,7 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { html += addDataPoint(i, (prefix + '[' + noOfLines + ']')); } html += '+ ' + - Messages.strAddPoint + '
'; + window.Messages.strAddPoint + '
'; $a.before(html); $noOfLinesInput.val(noOfLines + 1); @@ -348,17 +348,17 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { var noOfPolygons = parseInt($noOfPolygonsInput.val(), 10); // Add the new polygon - var html = Messages.strPolygon + ' ' + (noOfPolygons + 1) + ':
'; + var html = window.Messages.strPolygon + ' ' + (noOfPolygons + 1) + ':
'; html += '' + - '
' + Messages.strOuterRing + ':' + + '
' + window.Messages.strOuterRing + ':' + ''; for (var i = 0; i < 4; i++) { html += addDataPoint(i, (prefix + '[' + noOfPolygons + '][0]')); } html += '+ ' + - Messages.strAddPoint + '
' + + window.Messages.strAddPoint + '
' + '+ ' + - Messages.strAddInnerRing + '

'; + window.Messages.strAddInnerRing + '

'; $a.before(html); $noOfPolygonsInput.val(noOfPolygons + 1); @@ -374,13 +374,13 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { var $noOfGeomsInput = $('input[name=\'' + prefix + '[geom_count]' + '\']'); var noOfGeoms = parseInt($noOfGeomsInput.val(), 10); - var html1 = Messages.strGeometry + ' ' + (noOfGeoms + 1) + ':
'; + var html1 = window.Messages.strGeometry + ' ' + (noOfGeoms + 1) + ':
'; var $geomType = $('select[name=\'gis_data[' + (noOfGeoms - 1) + '][gis_type]\']').clone(); $geomType.attr('name', 'gis_data[' + noOfGeoms + '][gis_type]').val('POINT'); - var html2 = '
' + Messages.strPoint + ' :' + - '' + + var html2 = '
' + window.Messages.strPoint + ' :' + + '' + '' + - '' + + '' + '' + '

'; diff --git a/js/src/home.js b/js/src/home.js index 1a7f1cfb66..c084afc949 100644 --- a/js/src/home.js +++ b/js/src/home.js @@ -51,12 +51,12 @@ const GitInfo = { versionInformationMessageLink.rel = 'noopener noreferrer'; const versionInformationMessageLinkText = document.createTextNode(data.version); versionInformationMessageLink.appendChild(versionInformationMessageLinkText); - const prefixMessage = document.createTextNode(Messages.strLatestAvailable + ' '); + const prefixMessage = document.createTextNode(window.Messages.strLatestAvailable + ' '); versionInformationMessage.appendChild(prefixMessage); versionInformationMessage.appendChild(versionInformationMessageLink); if (latest > current) { const message = Functions.sprintf( - Messages.strNewerVersion, + window.Messages.strNewerVersion, Functions.escapeHtml(data.version), Functions.escapeHtml(data.date) ); @@ -80,7 +80,7 @@ const GitInfo = { $('#maincontainer').append($(mainContainerDiv)); } if (latest === current) { - versionInformationMessage = document.createTextNode(' (' + Messages.strUpToDate + ')'); + versionInformationMessage = document.createTextNode(' (' + window.Messages.strUpToDate + ')'); } /* Remove extra whitespace */ const versionInfo = $('#li_pma_version').contents().get(2); diff --git a/js/src/import.js b/js/src/import.js index 70c0e1d603..0e89ca2135 100644 --- a/js/src/import.js +++ b/js/src/import.js @@ -18,7 +18,7 @@ function changePluginOpts () { const importNotification = document.getElementById('import_notification'); importNotification.innerText = ''; if (selectedPluginName === 'csv') { - importNotification.innerHTML = ''; + importNotification.innerHTML = ''; } } @@ -61,9 +61,9 @@ window.AJAX.registerOnload('import.js', function () { $(document).on('submit', '#import_file_form', function () { var radioLocalImport = $('#localFileTab'); var radioImport = $('#uploadFileTab'); - var fileMsg = ''; - var wrongTblNameMsg = ''; - var wrongDBNameMsg = ''; + var fileMsg = ''; + var wrongTblNameMsg = ''; + var wrongDBNameMsg = ''; if (radioLocalImport.length !== 0) { // remote upload. @@ -76,7 +76,7 @@ window.AJAX.registerOnload('import.js', function () { if (radioLocalImport.hasClass('active')) { if ($('#select_local_import_file').length === 0) { - Functions.ajaxShowMessage('', false); + Functions.ajaxShowMessage('', false); return false; } diff --git a/js/src/indexes.js b/js/src/indexes.js index a0852b7da3..55d62684c4 100644 --- a/js/src/indexes.js +++ b/js/src/indexes.js @@ -266,7 +266,7 @@ Indexes.getCompositeIndexList = function (sourceArray, colIndex) { // Html list. var $compositeIndexList = $( '
    ' + - '
    ' + Messages.strCompositeWith + '
    ' + + '
    ' + window.Messages.strCompositeWith + '
    ' + '
' ); @@ -318,7 +318,7 @@ var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) { } else { Functions.ajaxShowMessage( '', false ); @@ -404,7 +404,7 @@ Indexes.showAddIndexDialog = function (sourceArray, arrayIndex, targetColumns, c } }); $('#addIndexModal').modal('show'); - $('#addIndexModalLabel').first().text(Messages.strAddIndex); + $('#addIndexModalLabel').first().text(window.Messages.strAddIndex); $('#addIndexModal').find('.modal-body').first().html(data.message); Functions.checkIndexName('index_frm'); Functions.showHints($div); @@ -439,7 +439,7 @@ Indexes.showAddIndexDialog = function (sourceArray, arrayIndex, targetColumns, c } else { Functions.ajaxShowMessage( '', false ); @@ -468,10 +468,10 @@ var removeIndexOnChangeEvent = function () { Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex) { var $singleColumnRadio = $('' + - ''); + ''); var $compositeIndexRadio = $('' + - ''); + ''); var $dialogContent = $('
'); $dialogContent.append('' + indexChoice.toUpperCase() + ''); @@ -496,7 +496,7 @@ Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex) Functions.ajaxShowMessage( '', false ); @@ -532,7 +532,7 @@ Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex) removeIndexOnChangeEvent(); }); $('#addIndexModal').modal('show'); - $('#addIndexModalLabel').first().text(Messages.strAddIndex); + $('#addIndexModalLabel').first().text(window.Messages.strAddIndex); $('#addIndexModal').find('.modal-body').first().html($dialogContent); $('#composite_index').on('change', function () { if ($(this).is(':checked')) { @@ -590,7 +590,7 @@ Indexes.on = () => function () { var $form = $('#index_frm'); var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'do_save_data=1' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); window.AJAX.source = $form; $.post($form.attr('action'), submitData, window.AJAX.responseHandler); }); @@ -629,7 +629,7 @@ Indexes.on = () => function () { .val(); Functions.confirmPreviewSql(question, $anchor.attr('href'), function (url) { - var $msg = Functions.ajaxShowMessage(Messages.strDroppingPrimaryKeyIndex, false); + var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingPrimaryKeyIndex, false); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); $.post(url, params, function (data) { if (typeof data !== 'undefined' && data.success === true) { @@ -660,7 +660,7 @@ Indexes.on = () => function () { Navigation.reload(); window.CommonActions.refreshMain('index.php?route=/table/structure'); } else { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false); } }); // end $.post() }); @@ -684,11 +684,11 @@ Indexes.on = () => function () { return; } url = $(this).closest('form').serialize(); - title = Messages.strAddIndex; + title = window.Messages.strAddIndex; } else { // Edit index url = $(this).find('a').getPostData(); - title = Messages.strEditIndex; + title = window.Messages.strEditIndex; } url += window.CommonParams.get('arg_separator') + 'ajax_request=true'; Functions.indexEditorDialog(url, title, function (data) { @@ -704,7 +704,7 @@ Indexes.on = () => function () { $(document).on('click', '#table_index tbody tr td.rename_index.ajax', function (event) { event.preventDefault(); var url = $(this).find('a').getPostData(); - var title = Messages.strRenameIndex; + var title = window.Messages.strRenameIndex; url += window.CommonParams.get('arg_separator') + 'ajax_request=true'; Functions.indexRenameDialog(url, title, function (data) { window.CommonParams.set('db', data.params.db); diff --git a/js/src/jqplot/plugins/jqplot.byteFormatter.js b/js/src/jqplot/plugins/jqplot.byteFormatter.js index fc757706a2..6196961ef2 100644 --- a/js/src/jqplot/plugins/jqplot.byteFormatter.js +++ b/js/src/jqplot/plugins/jqplot.byteFormatter.js @@ -9,13 +9,13 @@ var val = value; var i = index; var units = [ - Messages.strB, - Messages.strKiB, - Messages.strMiB, - Messages.strGiB, - Messages.strTiB, - Messages.strPiB, - Messages.strEiB + window.Messages.strB, + window.Messages.strKiB, + window.Messages.strMiB, + window.Messages.strGiB, + window.Messages.strTiB, + window.Messages.strPiB, + window.Messages.strEiB ]; while (val >= 1024 && i <= 6) { val /= 1024; diff --git a/js/src/makegrid.js b/js/src/makegrid.js index 4b6de341a7..c09ade4a10 100644 --- a/js/src/makegrid.js +++ b/js/src/makegrid.js @@ -1497,7 +1497,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid if ($(g.cEdit).find('.edit_box').val().match(/^(0x)?[a-f0-9]*$/i) !== null) { thisFieldParams[fieldName] = $(g.cEdit).find('.edit_box').val(); } else { - var hexError = ''; + var hexError = ''; Functions.ajaxShowMessage(hexError, false); thisFieldParams[fieldName] = Functions.getCellValue(g.currentEditCell); } @@ -1617,7 +1617,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid $(g.cPointer).css('visibility', 'hidden'); // set visibility to hidden instead of calling hide() to force browsers to cache the image in cPointer class // assign column reordering hint - g.reorderHint = Messages.strColOrderHint; + g.reorderHint = window.Messages.strColOrderHint; // get data columns in the first row of the table var $firstRowCols = $(g.t).find('tr').first().find('th.draggable'); @@ -1662,9 +1662,9 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid e.preventDefault(); var res = Functions.copyToClipboard($(this).data('column')); if (res) { - Functions.ajaxShowMessage(Messages.strCopyColumnSuccess, false, 'success'); + Functions.ajaxShowMessage(window.Messages.strCopyColumnSuccess, false, 'success'); } else { - Functions.ajaxShowMessage(Messages.strCopyColumnFailure, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strCopyColumnFailure, false, 'error'); } }); $(g.t).find('th.draggable a') @@ -1704,7 +1704,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid $(g.cList).hide(); // assign column visibility related hints - g.showAllColText = Messages.strShowAllCol; + g.showAllColText = window.Messages.strShowAllCol; // get data columns in the first row of the table var $firstRowCols = $(g.t).find('tr').first().find('th.draggable'); @@ -1730,7 +1730,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid Functions.tooltip( $colVisibTh, 'th', - Messages.strColVisibHint + window.Messages.strColVisibHint ); // create column visibility drop-down arrow(s) @@ -2022,10 +2022,10 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid $(g.cEditTextarea).hide(); // assign cell editing hint - g.cellEditHint = Messages.strCellEditHint; - g.saveCellWarning = Messages.strSaveCellWarning; - g.alertNonUnique = Messages.strAlertNonUnique; - g.gotoLinkText = Messages.strGoToLink; + g.cellEditHint = window.Messages.strCellEditHint; + g.saveCellWarning = window.Messages.strSaveCellWarning; + g.alertNonUnique = window.Messages.strAlertNonUnique; + g.gotoLinkText = window.Messages.strGoToLink; // initialize cell editing configuration g.saveCellsAtOnce = $(g.o).find('.save_cells_at_once').val(); @@ -2166,7 +2166,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid // todo update the original length after a grid edit $(t).find('td.data.truncated:not(:has(span))') .wrapInner(function () { - return ''; }); @@ -2201,10 +2201,10 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid g.tableCreateTime = $(g.o).find('.table_create_time').val(); // assign the hints - g.sortHint = Messages.strSortHint; - g.strMultiSortHint = Messages.strMultiSortHint; - g.markHint = Messages.strColMarkHint; - g.copyHint = Messages.strColNameCopyHint; + g.sortHint = window.Messages.strSortHint; + g.strMultiSortHint = window.Messages.strMultiSortHint; + g.markHint = window.Messages.strColMarkHint; + g.copyHint = window.Messages.strColNameCopyHint; // assign common hidden inputs var $commonHiddenInputs = $(g.o).find('div.common_hidden_inputs'); diff --git a/js/src/menu_resizer.js b/js/src/menu_resizer.js index 116f506c2c..1708b74537 100644 --- a/js/src/menu_resizer.js +++ b/js/src/menu_resizer.js @@ -38,7 +38,7 @@ 'data-bs-toggle': 'dropdown', 'aria-haspopup': 'true', 'aria-expanded': 'false' - }).text(Messages.strMore); + }).text(window.Messages.strMore); var img = $container.find('li img'); if (img.length) { diff --git a/js/src/modules/console.js b/js/src/modules/console.js index afc959ed0a..9995fffb9d 100644 --- a/js/src/modules/console.js +++ b/js/src/modules/console.js @@ -2,7 +2,7 @@ import $ from 'jquery'; import CodeMirror from 'codemirror'; import { Config } from './console/config.js'; -/* global Functions, Messages, Navigation */ +/* global Functions, Navigation */ /** * Console object @@ -889,7 +889,7 @@ var ConsoleMessages = { $targetMessage.find('.action.requery').on('click', function () { var query = $(this).parent().siblings('.query').text(); var $message = $(this).closest('.message'); - if (confirm(Messages.strConsoleRequeryConfirm + '\n' + + if (confirm(window.Messages.strConsoleRequeryConfirm + '\n' + (query.length < 100 ? query : query.slice(0, 100) + '...')) ) { Console.execute(query, { db: $message.attr('targetdb'), table: $message.attr('targettable') }); @@ -911,7 +911,7 @@ var ConsoleMessages = { }); $targetMessage.find('.action.delete_bookmark').on('click', function () { var $message = $(this).closest('.message'); - if (confirm(Messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) { + if (confirm(window.Messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) { $.post('index.php?route=/import', { 'server': window.CommonParams.get('server'), @@ -1079,7 +1079,7 @@ var ConsoleBookmarks = { $('#pma_bookmarks').find('.card.add [name=submit]').on('click', function () { if ($('#pma_bookmarks').find('.card.add [name=label]').val().length === 0 || ConsoleInput.getText('bookmark').length === 0) { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return; } $(this).prop('disabled', true); @@ -1205,7 +1205,7 @@ var ConsoleDebug = { $('
') .text( Functions.sprintf( - Messages.strConsoleDebugArgsSummary, + window.Messages.strConsoleDebugArgsSummary, dbgStep.args.length ) ) @@ -1268,12 +1268,12 @@ var ConsoleDebug = { $('
') .append( '' + - Messages.strConsoleDebugShowArgs + + window.Messages.strConsoleDebugShowArgs + ' ' ) .append( '' + - Messages.strConsoleDebugHideArgs + + window.Messages.strConsoleDebugHideArgs + ' ' ) ); @@ -1341,7 +1341,7 @@ var ConsoleDebug = { .text((parseInt(i) + 1) + '.') .append( $('').text( - Messages.strConsoleDebugTimeTaken + + window.Messages.strConsoleDebugTimeTaken + ' ' + queryInfo[i].time + 's' + ' (' + ((queryInfo[i].time * 100) / totalTime).toFixed(3) + '%)' ) @@ -1386,7 +1386,7 @@ var ConsoleDebug = { } if (debugJson === false) { $('#debug_console').find('.debug>.welcome').text( - Messages.strConsoleDebugError + window.Messages.strConsoleDebugError ); return; } @@ -1418,7 +1418,7 @@ var ConsoleDebug = { $('#debug_console').find('.debug>.welcome').append( $('').text( Functions.sprintf( - Messages.strConsoleDebugSummary, + window.Messages.strConsoleDebugSummary, totalUnique, totalExec, totalTime diff --git a/js/src/navigation.js b/js/src/navigation.js index d37a34fa5e..c7550521ea 100644 --- a/js/src/navigation.js +++ b/js/src/navigation.js @@ -389,8 +389,8 @@ Navigation.onload = () => function () { $img .removeClass('ic_s_unlink') .addClass('ic_s_link') - .attr('alt', Messages.linkWithMain) - .attr('title', Messages.linkWithMain); + .attr('alt', window.Messages.linkWithMain) + .attr('title', window.Messages.linkWithMain); $('#pma_navigation_tree') .removeClass('synced') .find('li.selected') @@ -399,8 +399,8 @@ Navigation.onload = () => function () { $img .removeClass('ic_s_link') .addClass('ic_s_unlink') - .attr('alt', Messages.unlinkWithMain) - .attr('title', Messages.unlinkWithMain); + .attr('alt', window.Messages.unlinkWithMain) + .attr('title', window.Messages.unlinkWithMain); $('#pma_navigation_tree').addClass('synced'); Navigation.showCurrent(); } @@ -1102,18 +1102,18 @@ Navigation.ResizeHandler = function () { $collapser .css(this.left, pos + resizerWidth) .html(this.getSymbol(pos)) - .prop('title', Messages.strShowPanel); + .prop('title', window.Messages.strShowPanel); } else if (windowWidth > 768) { $collapser .css(this.left, pos) .html(this.getSymbol(pos)) - .prop('title', Messages.strHidePanel); + .prop('title', window.Messages.strHidePanel); $('#pma_navigation_resizer').css({ 'width': '3px' }); } else { $collapser .css(this.left, windowWidth - 22) .html(this.getSymbol(100)) - .prop('title', Messages.strHidePanel); + .prop('title', window.Messages.strHidePanel); $('#pma_navigation').width(windowWidth); $('body').css('margin-' + this.left, '0px'); $('#pma_navigation_resizer').css({ 'width': '0px' }); diff --git a/js/src/normalization.js b/js/src/normalization.js index afb953f9f3..ee9eff3cfb 100644 --- a/js/src/normalization.js +++ b/js/src/normalization.js @@ -46,7 +46,7 @@ function goTo3NFStep1 (newTables) { 'tables': tables, 'step': '3.1' }, function (data) { - $('#page_content').find('h3').html(Messages.str3NFNormalization); + $('#page_content').find('h3').html(window.Messages.str3NFNormalization); $('#mainContent').find('legend').html(data.legendText); $('#mainContent').find('h4').html(data.headText); $('#mainContent').find('p').html(data.subText); @@ -64,7 +64,7 @@ function goTo3NFStep1 (newTables) { $('') .attr({ type: 'button', - value: Messages.strDone, + value: window.Messages.strDone, class: 'btn btn-primary' }) .on('click', function () { @@ -86,7 +86,7 @@ function goTo2NFStep1 () { 'server': window.CommonParams.get('server'), 'step': '2.1' }, function (data) { - $('#page_content h3').html(Messages.str2NFNormalization); + $('#page_content h3').html(window.Messages.str2NFNormalization); $('#mainContent legend').html(data.legendText); $('#mainContent h4').html(data.headText); $('#mainContent p').html(data.subText); @@ -96,7 +96,7 @@ function goTo2NFStep1 () { $('') .attr({ type: 'submit', - value: Messages.strDone, + value: window.Messages.strDone, class: 'btn btn-primary' }) .on('click', function () { @@ -105,7 +105,7 @@ function goTo2NFStep1 () { .appendTo('.tblFooters'); } else { if (normalizeto === '3nf') { - $('#mainContent #newCols').html(Messages.strToNextStep); + $('#mainContent #newCols').html(window.Messages.strToNextStep); setTimeout(function () { goTo3NFStep1([window.CommonParams.get('table')]); }, 3000); @@ -119,9 +119,9 @@ function goToFinish1NF () { goTo2NFStep1(); return true; } - $('#mainContent legend').html(Messages.strEndStep); + $('#mainContent legend').html(window.Messages.strEndStep); $('#mainContent h4').html( - '

' + Functions.sprintf(Messages.strFinishMsg, Functions.escapeHtml(window.CommonParams.get('table'))) + '

' + '

' + Functions.sprintf(window.Messages.strFinishMsg, Functions.escapeHtml(window.CommonParams.get('table'))) + '

' ); $('#mainContent p').html(''); $('#mainContent #extra').html(''); @@ -194,8 +194,8 @@ function goToStep2 (extra) { $('.tblFooters').html(''); if (data.hasPrimaryKey === '1') { if (extra === 'goToStep3') { - $('#mainContent h4').html(Messages.strPrimaryKeyAdded); - $('#mainContent p').html(Messages.strToNextStep); + $('#mainContent h4').html(window.Messages.strPrimaryKeyAdded); + $('#mainContent p').html(window.Messages.strToNextStep); } if (extra === 'goToFinish1NF') { goToFinish1NF(); @@ -298,9 +298,9 @@ var backup = ''; function goTo2NFStep2 (pd, primaryKey) { $('#newCols').html(''); - $('#mainContent legend').html(Messages.strStep + ' 2.2 ' + Messages.strConfirmPd); - $('#mainContent h4').html(Messages.strSelectedPd); - $('#mainContent p').html(Messages.strPdHintNote); + $('#mainContent legend').html(window.Messages.strStep + ' 2.2 ' + window.Messages.strConfirmPd); + $('#mainContent h4').html(window.Messages.strSelectedPd); + $('#mainContent p').html(window.Messages.strPdHintNote); var extra = '
'; var pdFound = false; for (var dependson in pd) { @@ -310,7 +310,7 @@ function goTo2NFStep2 (pd, primaryKey) { } } if (!pdFound) { - extra += '

' + Messages.strNoPdSelected + '

'; + extra += '

' + window.Messages.strNoPdSelected + '

'; extra += '
'; } else { extra += '
'; @@ -336,7 +336,7 @@ function goTo2NFStep2 (pd, primaryKey) { }); } $('#mainContent #extra').html(extra); - $('.tblFooters').html(''); + $('.tblFooters').html(''); $('#goTo2NFFinish').on('click', function () { goTo2NFFinish(pd); }); @@ -344,9 +344,9 @@ function goTo2NFStep2 (pd, primaryKey) { function goTo3NFStep2 (pd, tablesTds) { $('#newCols').html(''); - $('#mainContent legend').html(Messages.strStep + ' 3.2 ' + Messages.strConfirmTd); - $('#mainContent h4').html(Messages.strSelectedTd); - $('#mainContent p').html(Messages.strPdHintNote); + $('#mainContent legend').html(window.Messages.strStep + ' 3.2 ' + window.Messages.strConfirmTd); + $('#mainContent h4').html(window.Messages.strSelectedTd); + $('#mainContent p').html(window.Messages.strPdHintNote); var extra = '
'; var pdFound = false; for (var table in tablesTds) { @@ -359,7 +359,7 @@ function goTo3NFStep2 (pd, tablesTds) { } } if (!pdFound) { - extra += '

' + Messages.strNoTdSelected + '

'; + extra += '

' + window.Messages.strNoTdSelected + '

'; extra += '
'; } else { extra += '
'; @@ -386,7 +386,7 @@ function goTo3NFStep2 (pd, tablesTds) { }); } $('#mainContent #extra').html(extra); - $('.tblFooters').html(''); + $('.tblFooters').html(''); $('#goTo3NFFinish').on('click', function () { if (!pdFound) { goTo3NFFinish([]); @@ -533,7 +533,7 @@ window.AJAX.registerOnload('normalization.js', function () { .attr({ type: 'submit', id: 'saveSplit', - value: Messages.strSave, + value: window.Messages.strSave, class: 'btn btn-primary' }) .appendTo('.tblFooters'); @@ -542,7 +542,7 @@ window.AJAX.registerOnload('normalization.js', function () { .attr({ type: 'submit', id: 'cancelSplit', - value: Messages.strCancel, + value: window.Messages.strCancel, class: 'btn btn-secondary' }) .on('click', function () { @@ -615,7 +615,7 @@ window.AJAX.registerOnload('normalization.js', function () { .attr({ type: 'submit', id: 'saveNewPrimary', - value: Messages.strSave, + value: window.Messages.strSave, class: 'btn btn-primary' }) .appendTo('.tblFooters'); @@ -623,7 +623,7 @@ window.AJAX.registerOnload('normalization.js', function () { .attr({ type: 'submit', id: 'cancelSplit', - value: Messages.strCancel, + value: window.Messages.strCancel, class: 'btn btn-secondary' }) .on('click', function () { @@ -644,8 +644,8 @@ window.AJAX.registerOnload('normalization.js', function () { datastring += argsep + 'field_key[0]=primary_0' + argsep + 'ajax_request=1' + argsep + 'do_save_data=1' + argsep + 'field_where=last'; $.post('index.php?route=/table/add-field', datastring, function (data) { if (data.success === true) { - $('#mainContent h4').html(Messages.strPrimaryKeyAdded); - $('#mainContent p').html(Messages.strToNextStep); + $('#mainContent h4').html(window.Messages.strPrimaryKeyAdded); + $('#mainContent p').html(window.Messages.strToNextStep); $('#mainContent #extra').html(''); $('#mainContent #newCols').html(''); $('.tblFooters').html(''); @@ -691,16 +691,16 @@ window.AJAX.registerOnload('normalization.js', function () { if (repeatingCols !== '') { var newColName = $('#extra input[type=checkbox]:checked').first().val(); repeatingCols = repeatingCols.slice(0, -2); - var confirmStr = Functions.sprintf(Messages.strMoveRepeatingGroup, Functions.escapeHtml(repeatingCols), Functions.escapeHtml(window.CommonParams.get('table'))); - confirmStr += '' + - '( ' + Functions.escapeHtml(primaryKey.toString()) + ', )' + + var confirmStr = Functions.sprintf(window.Messages.strMoveRepeatingGroup, Functions.escapeHtml(repeatingCols), Functions.escapeHtml(window.CommonParams.get('table'))); + confirmStr += '' + + '( ' + Functions.escapeHtml(primaryKey.toString()) + ', )' + ''; $('#newCols').html(confirmStr); $('') .attr({ type: 'submit', - value: Messages.strCancel, + value: window.Messages.strCancel, class: 'btn btn-secondary' }) .on('click', function () { @@ -711,7 +711,7 @@ window.AJAX.registerOnload('normalization.js', function () { $('') .attr({ type: 'submit', - value: Messages.strGo, + value: window.Messages.strGo, class: 'btn btn-primary' }) .on('click', function () { @@ -732,7 +732,7 @@ window.AJAX.registerOnload('normalization.js', function () { 'index': { 'Key_name':'PRIMARY' }, 'ajax_request': true }; - var title = Messages.strAddPrimaryKey; + var title = window.Messages.strAddPrimaryKey; Functions.indexEditorDialog(url, title, function () { // on success $('.sqlqueryresults').remove(); @@ -747,19 +747,19 @@ window.AJAX.registerOnload('normalization.js', function () { }); $('#mainContent').on('click', '#showPossiblePd', function () { if ($(this).hasClass('hideList')) { - $(this).html('+ ' + Messages.strShowPossiblePd); + $(this).html('+ ' + window.Messages.strShowPossiblePd); $(this).removeClass('hideList'); $('#newCols').slideToggle('slow'); return false; } if ($('#newCols').html() !== '') { - $('#showPossiblePd').html('- ' + Messages.strHidePd); + $('#showPossiblePd').html('- ' + window.Messages.strHidePd); $('#showPossiblePd').addClass('hideList'); $('#newCols').slideToggle('slow'); return false; } $('#newCols').insertAfter('#mainContent h4'); - $('#newCols').html('
' + Messages.strLoading + '
' + Messages.strWaitForPd + '
'); + $('#newCols').html('
' + window.Messages.strLoading + '
' + window.Messages.strWaitForPd + '
'); $.post( 'index.php?route=/normalization', { @@ -769,7 +769,7 @@ window.AJAX.registerOnload('normalization.js', function () { 'server': window.CommonParams.get('server'), 'findPdl': true }, function (data) { - $('#showPossiblePd').html('- ' + Messages.strHidePd); + $('#showPossiblePd').html('- ' + window.Messages.strHidePd); $('#showPossiblePd').addClass('hideList'); $('#newCols').html(data.message); }); diff --git a/js/src/replication.js b/js/src/replication.js index 16a9bc6861..e14b28e242 100644 --- a/js/src/replication.js +++ b/js/src/replication.js @@ -81,7 +81,7 @@ window.AJAX.registerOnload('replication.js', function () { $('#reset_replica').on('click', function (e) { e.preventDefault(); var $anchor = $(this); - var question = Messages.strResetReplicaWarning; + var question = window.Messages.strResetReplicaWarning; $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $anchor; diff --git a/js/src/server/databases.js b/js/src/server/databases.js index 21cdce87fb..7685988255 100644 --- a/js/src/server/databases.js +++ b/js/src/server/databases.js @@ -24,7 +24,7 @@ const DropDatabases = { if (! selectedDbs.length) { Functions.ajaxShowMessage( $('').text( - Messages.strNoDatabasesSelected + window.Messages.strNoDatabasesSelected ), 2000 ); @@ -33,8 +33,8 @@ const DropDatabases = { /** * @var question String containing the question to be asked for confirmation */ - var question = Messages.strDropDatabaseStrongWarning + ' ' + - Functions.sprintf(Messages.strDoYouReally, selectedDbs.join('
')); + var question = window.Messages.strDropDatabaseStrongWarning + ' ' + + Functions.sprintf(window.Messages.strDoYouReally, selectedDbs.join('
')); const modal = $('#dropDatabaseModal'); modal.find('.modal-body').html(question); @@ -43,7 +43,7 @@ const DropDatabases = { const url = 'index.php?route=/server/databases/destroy&' + $(this).serialize(); $('#dropDatabaseModalDropButton').on('click', function () { - Functions.ajaxShowMessage(Messages.strProcessingRequest, false); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest, false); var parts = url.split('?'); var params = Functions.getJsConfirmCommonParam(this, parts[1]); @@ -92,12 +92,12 @@ const CreateDatabase = { var newDbNameInput = $form.find('input[name=new_db]'); if (newDbNameInput.val() === '') { newDbNameInput.trigger('focus'); - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); return; } // end remove - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); Functions.prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize(), function (data) { diff --git a/js/src/server/privileges.js b/js/src/server/privileges.js index 4522ef4065..2482e50e14 100644 --- a/js/src/server/privileges.js +++ b/js/src/server/privileges.js @@ -109,14 +109,14 @@ const AccountLocking = { } if (isLocked) { - const lockIcon = Functions.getImage('s_lock', Messages.strLock, {}).toString(); - button.innerHTML = '' + lockIcon + ' ' + Messages.strLock + ''; - button.title = Messages.strLockAccount; + const lockIcon = Functions.getImage('s_lock', window.Messages.strLock, {}).toString(); + button.innerHTML = '' + lockIcon + ' ' + window.Messages.strLock + ''; + button.title = window.Messages.strLockAccount; button.dataset.isLocked = 'false'; } else { - const unlockIcon = Functions.getImage('s_unlock', Messages.strUnlock, {}).toString(); - button.innerHTML = '' + unlockIcon + ' ' + Messages.strUnlock + ''; - button.title = Messages.strUnlockAccount; + const unlockIcon = Functions.getImage('s_unlock', window.Messages.strUnlock, {}).toString(); + button.innerHTML = '' + unlockIcon + ' ' + window.Messages.strUnlock + ''; + button.title = window.Messages.strUnlockAccount; button.dataset.isLocked = 'true'; } @@ -223,17 +223,17 @@ const RevokeUser = { var $thisButton = $(this); var $form = $('#usersForm'); - $thisButton.confirm(Messages.strDropUserWarning, $form.attr('action'), function (url) { + $thisButton.confirm(window.Messages.strDropUserWarning, $form.attr('action'), function (url) { var $dropUsersDbCheckbox = $('#dropUsersDbCheckbox'); if ($dropUsersDbCheckbox.is(':checked')) { - var isConfirmed = confirm(Messages.strDropDatabaseStrongWarning + '\n' + Functions.sprintf(Messages.strDoYouReally, 'DROP DATABASE')); + var isConfirmed = confirm(window.Messages.strDropDatabaseStrongWarning + '\n' + Functions.sprintf(window.Messages.strDoYouReally, 'DROP DATABASE')); if (! isConfirmed) { // Uncheck the drop users database checkbox $dropUsersDbCheckbox.prop('checked', false); } } - Functions.ajaxShowMessage(Messages.strRemovingSelectedUsers); + Functions.ajaxShowMessage(window.Messages.strRemovingSelectedUsers); var argsep = window.CommonParams.get('arg_separator'); $.post(url, $form.serialize() + argsep + 'delete=' + $thisButton.val() + argsep + 'ajax_request=true', function (data) { @@ -289,7 +289,7 @@ const ExportPrivileges = { event.preventDefault(); // can't export if no users checked if ($(this.form).find('input:checked').length === 0) { - Functions.ajaxShowMessage(Messages.strNoAccountSelected, 2000, 'success'); + Functions.ajaxShowMessage(window.Messages.strNoAccountSelected, 2000, 'success'); return; } var msgbox = Functions.ajaxShowMessage(); @@ -444,13 +444,13 @@ const CheckAddUser = { const theForm = this; if (theForm.elements.hostname.value === '') { - alert(Messages.strHostEmpty); + alert(window.Messages.strHostEmpty); theForm.elements.hostname.focus(); return false; } if ((theForm.elements.pred_username && theForm.elements.pred_username.value === 'userdefined') && theForm.elements.username.value === '') { - alert(Messages.strUserEmpty); + alert(window.Messages.strUserEmpty); theForm.elements.username.focus(); return false; } diff --git a/js/src/server/status/monitor.js b/js/src/server/status/monitor.js index 936017b288..705d0d72a7 100644 --- a/js/src/server/status/monitor.js +++ b/js/src/server/status/monitor.js @@ -20,13 +20,13 @@ var monitorSettings; function serverResponseError () { var btns = {}; - btns[Messages.strReloadPage] = function () { + btns[window.Messages.strReloadPage] = function () { window.location.reload(); }; - $('#emptyDialog').dialog({ title: Messages.strRefreshFailed }); + $('#emptyDialog').dialog({ title: window.Messages.strRefreshFailed }); $('#emptyDialog').html( Functions.getImage('s_attention') + - Messages.strInvalidResponseExplanation + window.Messages.strInvalidResponseExplanation ); $('#emptyDialog').dialog({ buttons: btns }); } @@ -211,9 +211,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var presetCharts = { // Query cache efficiency 'qce': { - title: Messages.strQueryCacheEfficiency, + title: window.Messages.strQueryCacheEfficiency, series: [{ - label: Messages.strQueryCacheEfficiency + label: window.Messages.strQueryCacheEfficiency }], nodes: [{ dataPoints: [{ type: 'statusvar', name: 'Qcache_hits' }, { type: 'statusvar', name: 'Com_select' }], @@ -223,9 +223,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { }, // Query cache usage 'qcu': { - title: Messages.strQueryCacheUsage, + title: window.Messages.strQueryCacheUsage, series: [{ - label: Messages.strQueryCacheUsed + label: window.Messages.strQueryCacheUsed }], nodes: [{ dataPoints: [{ type: 'statusvar', name: 'Qcache_free_memory' }, { type: 'servervar', name: 'query_cache_size' }], @@ -246,9 +246,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { case 'WINNT': $.extend(presetCharts, { 'cpu': { - title: Messages.strSystemCPUUsage, + title: window.Messages.strSystemCPUUsage, series: [{ - label: Messages.strAverageLoad + label: window.Messages.strAverageLoad }], nodes: [{ dataPoints: [{ type: 'cpu', name: 'loadavg' }] @@ -257,13 +257,13 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { }, 'memory': { - title: Messages.strSystemMemory, + title: window.Messages.strSystemMemory, series: [{ dataType: 'memory', - label: Messages.strUsedMemory, + label: window.Messages.strUsedMemory, fill: true }, { - label: Messages.strFreeMemory, + label: window.Messages.strFreeMemory, fill: true }], nodes: [{ dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024 }, @@ -273,12 +273,12 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { }, 'swap': { - title: Messages.strSystemSwap, + title: window.Messages.strSystemSwap, series: [{ - label: Messages.strUsedSwap, + label: window.Messages.strUsedSwap, fill: true }, { - label: Messages.strFreeSwap, + label: window.Messages.strFreeSwap, fill: true }], nodes: [{ dataPoints: [{ type: 'memory', name: 'SwapUsed' }], valueDivisor: 1024 }, @@ -292,20 +292,20 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { case 'Linux': $.extend(presetCharts, { 'cpu': { - title: Messages.strSystemCPUUsage, + title: window.Messages.strSystemCPUUsage, series: [{ - label: Messages.strAverageLoad + label: window.Messages.strAverageLoad }], nodes: [{ dataPoints: [{ type: 'cpu', name: 'irrelevant' }], transformFn: 'cpu-linux' }], maxYLabel: 0 }, 'memory': { - title: Messages.strSystemMemory, + title: window.Messages.strSystemMemory, series: [ - { label: Messages.strBufferedMemory, fill: true }, - { label: Messages.strUsedMemory, fill: true }, - { label: Messages.strCachedMemory, fill: true }, - { label: Messages.strFreeMemory, fill: true } + { label: window.Messages.strBufferedMemory, fill: true }, + { label: window.Messages.strUsedMemory, fill: true }, + { label: window.Messages.strCachedMemory, fill: true }, + { label: window.Messages.strFreeMemory, fill: true } ], nodes: [ { dataPoints: [{ type: 'memory', name: 'Buffers' }], valueDivisor: 1024 }, @@ -316,11 +316,11 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { maxYLabel: 0 }, 'swap': { - title: Messages.strSystemSwap, + title: window.Messages.strSystemSwap, series: [ - { label: Messages.strCachedSwap, fill: true }, - { label: Messages.strUsedSwap, fill: true }, - { label: Messages.strFreeSwap, fill: true } + { label: window.Messages.strCachedSwap, fill: true }, + { label: window.Messages.strUsedSwap, fill: true }, + { label: window.Messages.strFreeSwap, fill: true } ], nodes: [ { dataPoints: [{ type: 'memory', name: 'SwapCached' }], valueDivisor: 1024 }, @@ -335,9 +335,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { case 'SunOS': $.extend(presetCharts, { 'cpu': { - title: Messages.strSystemCPUUsage, + title: window.Messages.strSystemCPUUsage, series: [{ - label: Messages.strAverageLoad + label: window.Messages.strAverageLoad }], nodes: [{ dataPoints: [{ type: 'cpu', name: 'loadavg' }] @@ -345,10 +345,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { maxYLabel: 0 }, 'memory': { - title: Messages.strSystemMemory, + title: window.Messages.strSystemMemory, series: [ - { label: Messages.strUsedMemory, fill: true }, - { label: Messages.strFreeMemory, fill: true } + { label: window.Messages.strUsedMemory, fill: true }, + { label: window.Messages.strFreeMemory, fill: true } ], nodes: [ { dataPoints: [{ type: 'memory', name: 'MemUsed' }], valueDivisor: 1024 }, @@ -357,10 +357,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { maxYLabel: 0 }, 'swap': { - title: Messages.strSystemSwap, + title: window.Messages.strSystemSwap, series: [ - { label: Messages.strUsedSwap, fill: true }, - { label: Messages.strFreeSwap, fill: true } + { label: window.Messages.strUsedSwap, fill: true }, + { label: window.Messages.strFreeSwap, fill: true } ], nodes: [ { dataPoints: [{ type: 'memory', name: 'SwapUsed' }], valueDivisor: 1024 }, @@ -375,9 +375,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { // Default setting for the chart grid var defaultChartGrid = { 'c0': { - title: Messages.strQuestions, + title: window.Messages.strQuestions, series: [ - { label: Messages.strQuestions } + { label: window.Messages.strQuestions } ], nodes: [ { dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' } @@ -385,10 +385,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { maxYLabel: 0 }, 'c1': { - title: Messages.strChartConnectionsTitle, + title: window.Messages.strChartConnectionsTitle, series: [ - { label: Messages.strConnections }, - { label: Messages.strProcesses } + { label: window.Messages.strConnections }, + { label: window.Messages.strProcesses } ], nodes: [ { dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' }, @@ -397,10 +397,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { maxYLabel: 0 }, 'c2': { - title: Messages.strTraffic, + title: window.Messages.strTraffic, series: [ - { label: Messages.strBytesSent }, - { label: Messages.strBytesReceived } + { label: window.Messages.strBytesSent }, + { label: window.Messages.strBytesReceived } ], nodes: [ { dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }], display: 'differential', valueDivisor: 1024 }, @@ -539,7 +539,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { // each time they add a series // So here we only warn if they didn't add a series yet if (! newChart || ! newChart.nodes || newChart.nodes.length === 0) { - alert(Messages.strAddOneSeriesWarning); + alert(window.Messages.strAddOneSeriesWarning); return; } } @@ -592,7 +592,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('#addChartModal').modal('show'); - $('#seriesPreview').html('' + Messages.strNone + ''); + $('#seriesPreview').html('' + window.Messages.strNone + ''); return false; }); @@ -634,18 +634,18 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('a[href="#importMonitorConfig"]').on('click', function (event) { event.preventDefault(); - $('#emptyDialog').dialog({ title: Messages.strImportDialogTitle }); - $('#emptyDialog').html(Messages.strImportDialogMessage + ':
' + + $('#emptyDialog').dialog({ title: window.Messages.strImportDialogTitle }); + $('#emptyDialog').html(window.Messages.strImportDialogMessage + ':
' + '
'); var dlgBtns = {}; - dlgBtns[Messages.strImport] = function () { + dlgBtns[window.Messages.strImport] = function () { var input = $('#emptyDialog').find('#import_file')[0]; var reader = new FileReader(); reader.onerror = function (event) { - alert(Messages.strFailedParsingConfig + '\n' + event.target.error.code); + alert(window.Messages.strFailedParsingConfig + '\n' + event.target.error.code); }; reader.onload = function (e) { var data = e.target.result; @@ -654,14 +654,14 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { try { json = JSON.parse(data); } catch (err) { - alert(Messages.strFailedParsingConfig); + alert(window.Messages.strFailedParsingConfig); $('#emptyDialog').dialog('close'); return; } // Basic check, is this a monitor config json? if (!json || ! json.monitorCharts || ! json.monitorCharts) { - alert(Messages.strFailedParsingConfig); + alert(window.Messages.strFailedParsingConfig); $('#emptyDialog').dialog('close'); return; } @@ -674,7 +674,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } rebuildGrid(); } catch (err) { - alert(Messages.strFailedBuildingGrid); + alert(window.Messages.strFailedBuildingGrid); // If an exception is thrown, load default again if (window.Config.isStorageSupported('localStorage')) { window.localStorage.removeItem('monitorCharts'); @@ -688,7 +688,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { reader.readAsText(input.files[0]); }; - dlgBtns[Messages.strCancel] = function () { + dlgBtns[window.Messages.strCancel] = function () { $(this).dialog('close'); }; @@ -714,9 +714,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { event.preventDefault(); runtime.redrawCharts = ! runtime.redrawCharts; if (! runtime.redrawCharts) { - $(this).html(Functions.getImage('play') + Messages.strResumeMonitor); + $(this).html(Functions.getImage('play') + window.Messages.strResumeMonitor); } else { - $(this).html(Functions.getImage('pause') + Messages.strPauseMonitor); + $(this).html(Functions.getImage('pause') + window.Messages.strPauseMonitor); if (! runtime.charts) { initGrid(); $('a[href="#settingsPopup"]').show(); @@ -730,7 +730,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var $dialog = $('#monitorInstructionsDialog'); var dlgBtns = {}; - dlgBtns[Messages.strClose] = function () { + dlgBtns[window.Messages.strClose] = function () { $(this).dialog('close'); }; $dialog.dialog({ @@ -762,40 +762,40 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { if (logVars.general_log === 'ON') { if (logVars.slow_query_log === 'ON') { - msg = Messages.strBothLogOn; + msg = window.Messages.strBothLogOn; } else { - msg = Messages.strGenLogOn; + msg = window.Messages.strGenLogOn; } } if (msg.length === 0 && logVars.slow_query_log === 'ON') { - msg = Messages.strSlowLogOn; + msg = window.Messages.strSlowLogOn; } if (msg.length === 0) { icon = Functions.getImage('s_error'); - msg = Messages.strBothLogOff; + msg = window.Messages.strBothLogOff; } - str = '' + Messages.strCurrentSettings + '
'; + str = '' + window.Messages.strCurrentSettings + '
'; str += icon + msg + '
'; if (logVars.log_output !== 'TABLE') { - str += Functions.getImage('s_error') + ' ' + Messages.strLogOutNotTable + '
'; + str += Functions.getImage('s_error') + ' ' + window.Messages.strLogOutNotTable + '
'; } else { - str += Functions.getImage('s_success') + ' ' + Messages.strLogOutIsTable + '
'; + str += Functions.getImage('s_success') + ' ' + window.Messages.strLogOutIsTable + '
'; } if (logVars.slow_query_log === 'ON') { if (logVars.long_query_time > 2) { str += Functions.getImage('s_attention') + ' '; - str += Functions.sprintf(Messages.strSmallerLongQueryTimeAdvice, logVars.long_query_time); + str += Functions.sprintf(window.Messages.strSmallerLongQueryTimeAdvice, logVars.long_query_time); str += '
'; } if (logVars.long_query_time < 2) { str += Functions.getImage('s_success') + ' '; - str += Functions.sprintf(Messages.strLongQueryTimeSet, logVars.long_query_time); + str += Functions.sprintf(window.Messages.strLongQueryTimeSet, logVars.long_query_time); str += '
'; } } @@ -803,9 +803,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { str += '
'; if (isSuperUser) { - str += '

' + Messages.strChangeSettings + ''; + str += '

' + window.Messages.strChangeSettings + ''; str += '
'; - str += Messages.strSettingsAppliedGlobal + '
'; + str += window.Messages.strSettingsAppliedGlobal + '
'; var varValue = 'TABLE'; if (logVars.log_output === 'TABLE') { @@ -813,26 +813,26 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } str += '- '; - str += Functions.sprintf(Messages.strSetLogOutput, varValue); + str += Functions.sprintf(window.Messages.strSetLogOutput, varValue); str += '
'; if (logVars.general_log !== 'ON') { str += '- '; - str += Functions.sprintf(Messages.strEnableVar, 'general_log'); + str += Functions.sprintf(window.Messages.strEnableVar, 'general_log'); str += '
'; } else { str += '- '; - str += Functions.sprintf(Messages.strDisableVar, 'general_log'); + str += Functions.sprintf(window.Messages.strDisableVar, 'general_log'); str += '
'; } if (logVars.slow_query_log !== 'ON') { str += '- '; - str += Functions.sprintf(Messages.strEnableVar, 'slow_query_log'); + str += Functions.sprintf(window.Messages.strEnableVar, 'slow_query_log'); str += '
'; } else { str += '- '; - str += Functions.sprintf(Messages.strDisableVar, 'slow_query_log'); + str += Functions.sprintf(window.Messages.strDisableVar, 'slow_query_log'); str += '
'; } @@ -842,10 +842,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } str += '- '; - str += Functions.sprintf(Messages.setSetLongQueryTime, varValue); + str += Functions.sprintf(window.Messages.setSetLongQueryTime, varValue); str += '
'; } else { - str += Messages.strNoSuperUser + '
'; + str += window.Messages.strNoSuperUser + '
'; } str += '
'; @@ -874,7 +874,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('input[name="chartType"]').on('change', function () { $('#chartVariableSettings').toggle(this.checked && this.value === 'variable'); var title = $('input[name="chartTitle"]').val(); - if (title === Messages.strChartTitle || + if (title === window.Messages.strChartTitle || title === $('label[for="' + $('input[name="chartTitle"]').data('lastRadio') + '"]').text() ) { $('input[name="chartTitle"]') @@ -900,7 +900,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('a[href="#kibDivisor"]').on('click', function (event) { event.preventDefault(); $('input[name="valueDivisor"]').val(1024); - $('input[name="valueUnit"]').val(Messages.strKiB); + $('input[name="valueUnit"]').val(window.Messages.strKiB); $('span.unitInput').toggle(true); $('input[name="useUnit"]').prop('checked', true); return false; @@ -909,7 +909,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('a[href="#mibDivisor"]').on('click', function (event) { event.preventDefault(); $('input[name="valueDivisor"]').val(1024 * 1024); - $('input[name="valueUnit"]').val(Messages.strMiB); + $('input[name="valueUnit"]').val(window.Messages.strMiB); $('span.unitInput').toggle(true); $('input[name="useUnit"]').prop('checked', true); return false; @@ -917,7 +917,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('a[href="#submitClearSeries"]').on('click', function (event) { event.preventDefault(); - $('#seriesPreview').html('' + Messages.strNone + ''); + $('#seriesPreview').html('' + window.Messages.strNone + ''); newChart = null; $('#clearSeriesLink').hide(); }); @@ -956,9 +956,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { serie.unit = $('input[name="valueUnit"]').val(); } - var str = serie.display === 'differential' ? ', ' + Messages.strDifferential : ''; - str += serie.valueDivisor ? (', ' + Functions.sprintf(Messages.strDividedBy, serie.valueDivisor)) : ''; - str += serie.unit ? (', ' + Messages.strUnit + ': ' + serie.unit) : ''; + var str = serie.display === 'differential' ? ', ' + window.Messages.strDifferential : ''; + str += serie.valueDivisor ? (', ' + Functions.sprintf(window.Messages.strDividedBy, serie.valueDivisor)) : ''; + str += serie.unit ? (', ' + window.Messages.strUnit + ': ' + serie.unit) : ''; var newSeries = { label: $('#variableInput').val().replace(/_/g, ' ') @@ -1002,11 +1002,11 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { && typeof window.localStorage.monitorVersion !== 'undefined' && monitorProtocolVersion !== window.localStorage.monitorVersion ) { - $('#emptyDialog').dialog({ title: Messages.strIncompatibleMonitorConfig }); - $('#emptyDialog').html(Messages.strIncompatibleMonitorConfigDescription); + $('#emptyDialog').dialog({ title: window.Messages.strIncompatibleMonitorConfig }); + $('#emptyDialog').html(window.Messages.strIncompatibleMonitorConfigDescription); var dlgBtns = {}; - dlgBtns[Messages.strClose] = function () { + dlgBtns[window.Messages.strClose] = function () { $(this).dialog('close'); }; @@ -1154,25 +1154,25 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } }; - if (settings.title === Messages.strSystemCPUUsage || - settings.title === Messages.strQueryCacheEfficiency + if (settings.title === window.Messages.strSystemCPUUsage || + settings.title === window.Messages.strQueryCacheEfficiency ) { settings.axes.yaxis.tickOptions = { formatString: '%d %%' }; - } else if (settings.title === Messages.strSystemMemory || - settings.title === Messages.strSystemSwap + } else if (settings.title === window.Messages.strSystemMemory || + settings.title === window.Messages.strSystemSwap ) { settings.stackSeries = true; settings.axes.yaxis.tickOptions = { formatter: $.jqplot.byteFormatter(2) // MiB }; - } else if (settings.title === Messages.strTraffic) { + } else if (settings.title === window.Messages.strTraffic) { settings.axes.yaxis.tickOptions = { formatter: $.jqplot.byteFormatter(1) // KiB }; - } else if (settings.title === Messages.strQuestions || - settings.title === Messages.strConnections + } else if (settings.title === window.Messages.strQuestions || + settings.title === window.Messages.strConnections ) { settings.axes.yaxis.tickOptions = { formatter: function (format, val) { @@ -1371,12 +1371,12 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var dlgBtns = { }; - dlgBtns[Messages.strFromSlowLog] = function () { + dlgBtns[window.Messages.strFromSlowLog] = function () { loadLog('slow', min, max); $(this).dialog('close'); }; - dlgBtns[Messages.strFromGeneralLog] = function () { + dlgBtns[window.Messages.strFromGeneralLog] = function () { loadLog('general', min, max); $(this).dialog('close'); }; @@ -1513,8 +1513,8 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { elem.chart.series[j].data.splice(0, elem.chart.series[j].data.length - runtime.gridMaxPoints); } } - if (elem.title === Messages.strSystemMemory || - elem.title === Messages.strSystemSwap + if (elem.title === window.Messages.strSystemMemory || + elem.title === window.Messages.strSystemSwap ) { total += value; } @@ -1528,15 +1528,15 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { (runtime.xmax - tickInterval * 3), (runtime.xmax - tickInterval * 2), (runtime.xmax - tickInterval), runtime.xmax]; - if (elem.title !== Messages.strSystemCPUUsage && - elem.title !== Messages.strQueryCacheEfficiency && - elem.title !== Messages.strSystemMemory && - elem.title !== Messages.strSystemSwap + if (elem.title !== window.Messages.strSystemCPUUsage && + elem.title !== window.Messages.strQueryCacheEfficiency && + elem.title !== window.Messages.strSystemMemory && + elem.title !== window.Messages.strSystemSwap ) { elem.chart.axes.yaxis.max = Math.ceil(elem.maxYLabel * 1.1); elem.chart.axes.yaxis.tickInterval = Math.ceil(elem.maxYLabel * 1.1 / 5); - } else if (elem.title === Messages.strSystemMemory || - elem.title === Messages.strSystemSwap + } else if (elem.title === window.Messages.strSystemMemory || + elem.title === window.Messages.strSystemSwap ) { elem.chart.axes.yaxis.max = Math.ceil(total * 1.1 / 100) * 100; elem.chart.axes.yaxis.tickInterval = Math.ceil(total * 1.1 / 5); @@ -1635,13 +1635,13 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { opts.limitTypes = false; } - $('#emptyDialog').dialog({ title: Messages.strAnalysingLogsTitle }); - $('#emptyDialog').html(Messages.strAnalysingLogs + + $('#emptyDialog').dialog({ title: window.Messages.strAnalysingLogsTitle }); + $('#emptyDialog').html(window.Messages.strAnalysingLogs + ' '); var dlgBtns = {}; - dlgBtns[Messages.strCancelRequest] = function () { + dlgBtns[window.Messages.strCancelRequest] = function () { if (logRequest !== null) { logRequest.abort(); } @@ -1679,10 +1679,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } if (logData.rows.length === 0) { - $('#emptyDialog').dialog({ title: Messages.strNoDataFoundTitle }); - $('#emptyDialog').html('

' + Messages.strNoDataFound + '

'); + $('#emptyDialog').dialog({ title: window.Messages.strNoDataFoundTitle }); + $('#emptyDialog').html('

' + window.Messages.strNoDataFound + '

'); - dlgBtns[Messages.strClose] = function () { + dlgBtns[window.Messages.strClose] = function () { $(this).dialog('close'); }; @@ -1693,8 +1693,8 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { runtime.logDataCols = buildLogTable(logData, opts.removeVariables); /* Show some stats in the dialog */ - $('#emptyDialog').dialog({ title: Messages.strLoadingLogs }); - $('#emptyDialog').html('

' + Messages.strLogDataLoaded + '

'); + $('#emptyDialog').dialog({ title: window.Messages.strLoadingLogs }); + $('#emptyDialog').html('

' + window.Messages.strLogDataLoaded + '

'); $.each(logData.sum, function (key, value) { var newKey = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase(); if (newKey === 'Total') { @@ -1707,15 +1707,15 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { if (logData.numRows > 12) { $('#logTable').prepend( '
' + - ' ' + Messages.strFiltersForLogTable + '' + + ' ' + window.Messages.strFiltersForLogTable + '' + '
' + - ' ' + + ' ' + ' ' + '
' + - ((logData.numRows > 250) ? '
' : '') + + ((logData.numRows > 250) ? '
' : '') + '
' + ' ' + - ' ' + + ' ' + ' ' ); @@ -1731,7 +1731,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } } - dlgBtns[Messages.strJumpToTable] = function () { + dlgBtns[window.Messages.strJumpToTable] = function () { $(this).dialog('close'); $(document).scrollTop($('#logTable').offset().top); }; @@ -1894,8 +1894,8 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { // Display some stats at the bottom of the table $('#logTable').find('table tfoot tr') .html('' + - Messages.strSumRows + ' ' + rowSum + '' + - Messages.strTotal + '' + totalSum + ''); + window.Messages.strSumRows + ' ' + rowSum + '' + + window.Messages.strTotal + '' + totalSum + ''); } } @@ -1974,17 +1974,17 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } $table.append('' + - '' + Messages.strSumRows + - ' ' + data.numRows + '' + Messages.strTotal + + '' + window.Messages.strSumRows + + ' ' + data.numRows + '' + window.Messages.strTotal + '' + data.sum.TOTAL + ''); // Append a tooltip to the count column, if there exist one if ($('#logTable').find('tr').first().find('th').last().text().indexOf('#') > -1) { $('#logTable').find('tr').first().find('th').last().append(' ' + Functions.getImage('b_help', '', { 'class': 'qroupedQueryInfoIcon' })); - var tooltipContent = Messages.strCountColumnExplanation; + var tooltipContent = window.Messages.strCountColumnExplanation; if (groupInserts) { - tooltipContent += '

' + Messages.strMoreCountColumnExplanation + '

'; + tooltipContent += '

' + window.Messages.strMoreCountColumnExplanation + '

'; } Functions.tooltip( @@ -2026,10 +2026,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var profilingChart = null; var dlgBtns = {}; - dlgBtns[Messages.strAnalyzeQuery] = function () { + dlgBtns[window.Messages.strAnalyzeQuery] = function () { profilingChart = loadQueryAnalysis(rowData); }; - dlgBtns[Messages.strClose] = function () { + dlgBtns[window.Messages.strClose] = function () { $(this).dialog('close'); }; @@ -2058,7 +2058,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var profilingChart = null; $('#queryAnalyzerDialog').find('div.placeHolder').html( - Messages.strAnalyzing + ' '); $.post('index.php?route=/server/status/monitor/query', { @@ -2075,7 +2075,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } if (data.error) { if (data.error.indexOf('1146') !== -1 || data.error.indexOf('1046') !== -1) { - data.error = Messages.strServerLogError; + data.error = window.Messages.strServerLogError; } $('#queryAnalyzerDialog').find('div.placeHolder').html(''); return; @@ -2085,7 +2085,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('#queryAnalyzerDialog').find('div.placeHolder') .html('
'); - var explain = '' + Messages.strExplainOutput + ' ' + $('#explain_docu').html(); + var explain = '' + window.Messages.strExplainOutput + ' ' + $('#explain_docu').html(); if (data.explain.length > 1) { explain += ' ('; for (i = 0; i < data.explain.length; i++) { @@ -2116,7 +2116,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { explain += '
'; } - explain += '

' + Messages.strAffectedRows + ' ' + data.affectedRows; + explain += '

' + window.Messages.strAffectedRows + ' ' + data.affectedRows; $('#queryAnalyzerDialog').find('div.placeHolder td.explain').append(explain); @@ -2128,7 +2128,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { if (data.profiling) { var chartData = []; - var numberTable = ''; + var numberTable = '
' + Messages.strStatus + '' + Messages.strTime + '
'; var duration; var otherTime = 0; @@ -2152,15 +2152,15 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } if (otherTime > 0) { - chartData.push([Functions.prettyProfilingNum(otherTime, 2) + ' ' + Messages.strOther, otherTime]); + chartData.push([Functions.prettyProfilingNum(otherTime, 2) + ' ' + window.Messages.strOther, otherTime]); } - numberTable += ''; + numberTable += ''; numberTable += '
' + window.Messages.strStatus + '' + window.Messages.strTime + '
' + Messages.strTotalTime + '' + Functions.prettyProfilingNum(totalTime, 2) + '
' + window.Messages.strTotalTime + '' + Functions.prettyProfilingNum(totalTime, 2) + '
'; $('#queryAnalyzerDialog').find('div.placeHolder td.chart').append( - '' + Messages.strProfilingResults + ' ' + $('#profiling_docu').html() + ' ' + - '(' + Messages.strTable + ', ' + Messages.strChart + ')
' + + '' + window.Messages.strProfilingResults + ' ' + $('#profiling_docu').html() + ' ' + + '(' + window.Messages.strTable + ', ' + window.Messages.strChart + ')
' + numberTable + '

'); $('#queryAnalyzerDialog').find('div.placeHolder a[href="#showNums"]').on('click', function () { diff --git a/js/src/server/status/processes.js b/js/src/server/status/processes.js index fad3522ec1..339eb98e57 100644 --- a/js/src/server/status/processes.js +++ b/js/src/server/status/processes.js @@ -127,10 +127,10 @@ var processList = { */ setRefreshLabel: function () { var img = 'play'; - var label = Messages.strStartRefresh; + var label = window.Messages.strStartRefresh; if (processList.autoRefresh) { img = 'pause'; - label = Messages.strStopRefresh; + label = window.Messages.strStopRefresh; processList.refresh(); } $('a#toggleRefresh').html(Functions.getImage(img) + Functions.escapeHtml(label)); diff --git a/js/src/server/status/sorter.js b/js/src/server/status/sorter.js index 7a60052001..e3d3f960d6 100644 --- a/js/src/server/status/sorter.js +++ b/js/src/server/status/sorter.js @@ -28,8 +28,8 @@ $(function () { }, format: function (s) { var num = jQuery.tablesorter.formatFloat( - s.replace(Messages.strThousandsSeparator, '') - .replace(Messages.strDecimalSeparator, '.') + s.replace(window.Messages.strThousandsSeparator, '') + .replace(window.Messages.strDecimalSeparator, '.') ); var factor = 1; diff --git a/js/src/server/user_groups.js b/js/src/server/user_groups.js index aa1a00eb03..6810b730f9 100644 --- a/js/src/server/user_groups.js +++ b/js/src/server/user_groups.js @@ -20,7 +20,7 @@ window.AJAX.registerOnload('server/user_groups.js', function () { deleteUserGroupModal.on('show.bs.modal', function (event) { const userGroupName = $(event.relatedTarget).data('user-group'); this.querySelector('.modal-body').innerText = Functions.sprintf( - Messages.strDropUserGroupWarning, + window.Messages.strDropUserGroupWarning, Functions.escapeHtml(userGroupName) ); }); diff --git a/js/src/server/variables.js b/js/src/server/variables.js index 9b8391f706..40e98662f2 100644 --- a/js/src/server/variables.js +++ b/js/src/server/variables.js @@ -43,7 +43,7 @@ window.AJAX.registerOnload('server/variables.js', function () { $myEditLink.remove(); // remove edit link $mySaveLink.on('click', function () { - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post('index.php?route=/server/variables/set/' + encodeURIComponent(varName), { 'ajax_request': true, 'server': window.CommonParams.get('server'), @@ -56,7 +56,7 @@ window.AJAX.registerOnload('server/variables.js', function () { Functions.ajaxRemoveMessage($msgbox); } else { if (data.error === '') { - Functions.ajaxShowMessage(Messages.strRequestFailed, false); + Functions.ajaxShowMessage(window.Messages.strRequestFailed, false); } else { Functions.ajaxShowMessage(data.error, false); } diff --git a/js/src/sql.js b/js/src/sql.js index c8543575f8..b399c71058 100644 --- a/js/src/sql.js +++ b/js/src/sql.js @@ -212,7 +212,7 @@ const handleSimulateQueryButton = function () { if (! $simulateDml.length) { $('#button_submit_query').before( '' + 'tabindex="199" class="btn btn-primary" value="' + window.Messages.strSimulateDML + '">' ); } } else { @@ -269,7 +269,7 @@ const insertQuery = function (queryType) { return; } else if (queryType === 'format') { if (window.codeMirrorEditor) { - $('#querymessage').html(Messages.strFormatting + + $('#querymessage').html(window.Messages.strFormatting + ' '); var params = { @@ -307,7 +307,7 @@ const insertQuery = function (queryType) { } else if (window.Cookies.get(key, { path: window.CommonParams.get('rootPath') })) { setQuery(window.Cookies.get(key, { path: window.CommonParams.get('rootPath') })); } else { - Functions.ajaxShowMessage(Messages.strNoAutoSavedQuery); + Functions.ajaxShowMessage(window.Messages.strNoAutoSavedQuery); } return; } @@ -486,7 +486,7 @@ window.AJAX.registerOnload('sql.js', function () { // Delete row from SQL results $(document).on('click', 'a.delete_row.ajax', function (e) { e.preventDefault(); - var question = Functions.sprintf(Messages.strDoYouReally, Functions.escapeHtml($(this).closest('td').find('div').text())); + var question = Functions.sprintf(window.Messages.strDoYouReally, Functions.escapeHtml($(this).closest('td').find('div').text())); var $link = $(this); $link.confirm(question, $link.attr('href'), function (url) { Functions.ajaxShowMessage(); @@ -637,7 +637,7 @@ window.AJAX.registerOnload('sql.js', function () { // do not add this link more than once if (! $('#sqlqueryform').find('button').is('#togglequerybox')) { $('') - .html(Messages.strHideQueryBox) + .html(window.Messages.strHideQueryBox) .appendTo('#sqlqueryform') // initially hidden because at this point, nothing else // appears under the link @@ -647,14 +647,14 @@ window.AJAX.registerOnload('sql.js', function () { $('#togglequerybox').on('click', function () { var $link = $(this); $link.siblings().slideToggle('fast'); - if ($link.text() === Messages.strHideQueryBox) { - $link.text(Messages.strShowQueryBox); + if ($link.text() === window.Messages.strHideQueryBox) { + $link.text(window.Messages.strShowQueryBox); // cheap trick to add a spacer between the menu tabs // and "Show query box"; feel free to improve! $('#togglequerybox_spacer').remove(); $link.before('
'); } else { - $link.text(Messages.strHideQueryBox); + $link.text(window.Messages.strHideQueryBox); } // avoid default click action return false; @@ -707,7 +707,7 @@ window.AJAX.registerOnload('sql.js', function () { $varDiv.empty(); for (var i = 1; i <= varCount; i++) { $varDiv.append($('
')); - $varDiv.append($('')); + $varDiv.append($('')); $varDiv.append($('')); $varDiv.append($('
')); } @@ -926,7 +926,7 @@ window.AJAX.registerOnload('sql.js', function () { if (! $(this).is(':checked')) { // already showing all rows Sql.submitShowAllForm(); } else { - $form.confirm(Messages.strShowAllRowsWarning, $form.attr('action'), function () { + $form.confirm(window.Messages.strShowAllRowsWarning, $form.attr('action'), function () { Sql.submitShowAllForm(); }); } @@ -952,7 +952,7 @@ window.AJAX.registerOnload('sql.js', function () { } if (query.length === 0) { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); $('#sqlquery').trigger('focus'); return false; } @@ -975,9 +975,9 @@ window.AJAX.registerOnload('sql.js', function () { if (response.sql_data) { var len = response.sql_data.length; for (var i = 0; i < len; i++) { - dialogContent += '' + Messages.strSQLQuery + + dialogContent += '' + window.Messages.strSQLQuery + '' + response.sql_data[i].sql_query + - Messages.strMatchedRows + + window.Messages.strMatchedRows + ' ' + response.sql_data[i].matched_rows + '
'; if (i < len - 1) { @@ -1000,7 +1000,7 @@ window.AJAX.registerOnload('sql.js', function () { } }, error: function () { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest); } }); }); @@ -1042,13 +1042,13 @@ window.AJAX.registerOnload('sql.js', function () { var maxRowsCheck = Functions.checkFormElementInRange( this, 'session_max_rows', - Messages.strNotValidRowNumber, + window.Messages.strNotValidRowNumber, 1 ); var posCheck = Functions.checkFormElementInRange( this, 'pos', - Messages.strNotValidRowNumber, + window.Messages.strNotValidRowNumber, 0, unlimNumRows > 0 ? unlimNumRows - 1 : null ); @@ -1126,7 +1126,7 @@ Sql.browseForeignDialog = function ($thisA) { $.post($thisA.attr('href'), params, function (data) { // Creates browse foreign value dialog $dialog = $('
').append(data.message).dialog({ - title: Messages.strBrowseForeignValues, + title: window.Messages.strBrowseForeignValues, width: Math.min($(window).width() - 100, 700), maxHeight: $(window).height() - 100, dialogClass: 'browse_foreign_modal', @@ -1205,9 +1205,9 @@ Sql.checkSavedQuery = function () { if (window.Config.isStorageSupported('localStorage') && typeof window.localStorage.getItem(key) === 'string') { - Functions.ajaxShowMessage(Messages.strPreviousSaveQuery); + Functions.ajaxShowMessage(window.Messages.strPreviousSaveQuery); } else if (window.Cookies.get(key, { path: window.CommonParams.get('rootPath') })) { - Functions.ajaxShowMessage(Messages.strPreviousSaveQuery); + Functions.ajaxShowMessage(window.Messages.strPreviousSaveQuery); } }; diff --git a/js/src/table/change.js b/js/src/table/change.js index 652401752e..d41dc9f759 100644 --- a/js/src/table/change.js +++ b/js/src/table/change.js @@ -179,7 +179,7 @@ function verifyAfterSearchFieldChange (index, searchFormId) { jQuery.validator.addMethod('validationFunctionForMultipleInt', function (value) { return value.match(/^(?:(?:\d\s*)|\s*)+(?:,\s*\d+)*$/i) !== null; }, - Messages.strEnterValidNumber + window.Messages.strEnterValidNumber ); validateMultipleIntField($thisInput, true); } else { @@ -276,7 +276,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) { // To generate the textbox that can take the salt var newSaltBox = '
'; + ' id=salt_' + target.id + ' placeholder=\'' + window.Messages.strEncryptionKey + '\'>'; // If encrypting or decrypting functions that take salt as input is selected append the new textbox for salt if (target.value === 'AES_ENCRYPT' || @@ -321,7 +321,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) { if (target.value === 'HEX' && theType.startsWith('int')) { // Add note when HEX function is selected on a int - var newHexInfo = '

' + Messages.HexConversionInfo + '

'; + var newHexInfo = '

' + window.Messages.HexConversionInfo + '

'; if (!$('#note' + target.id).length) { $thisInput.after(newHexInfo); } @@ -773,7 +773,7 @@ function addNewContinueInsertionFields (event) { if (currRows === 1) { $('') .insertBefore($('table.insertRowTable').last()) - .after(''); + .after(''); } else { /** * @var $last_checkbox Object reference to the last checkbox in #insertForm @@ -828,7 +828,7 @@ function addNewContinueInsertionFields (event) { * of rows. */ var checkLock = jQuery.isEmptyObject(window.AJAX.lockedTargets); - if (checkLock || confirm(Messages.strConfirmRowChange) === true) { + if (checkLock || confirm(window.Messages.strConfirmRowChange) === true) { while (currRows > targetRows) { $('input[id^=insert_ignore]').last() .nextUntil('fieldset') diff --git a/js/src/table/chart.js b/js/src/table/chart.js index 334020161b..c66f6485a0 100644 --- a/js/src/table/chart.js +++ b/js/src/table/chart.js @@ -226,7 +226,7 @@ function onDataSeriesChange () { $('#lineChartTypeRadio').prop('checked', true); currentSettings.type = 'line'; } - yAxisTitle = Messages.strYValues; + yAxisTitle = window.Messages.strYValues; } $('#yAxisLabelInput').val(yAxisTitle); currentSettings.yaxisLabel = yAxisTitle; diff --git a/js/src/table/find_replace.js b/js/src/table/find_replace.js index 51895c0e5a..bdf62a7578 100644 --- a/js/src/table/find_replace.js +++ b/js/src/table/find_replace.js @@ -15,14 +15,14 @@ window.AJAX.registerOnload('table/find_replace.js', function () { .hide(); $('#toggle_find') - .html(Messages.strHideFindNReplaceCriteria) + .html(window.Messages.strHideFindNReplaceCriteria) .on('click', function () { var $link = $(this); $('#find_replace_form').slideToggle(); - if ($link.text() === Messages.strHideFindNReplaceCriteria) { - $link.text(Messages.strShowFindNReplaceCriteria); + if ($link.text() === window.Messages.strHideFindNReplaceCriteria) { + $link.text(window.Messages.strShowFindNReplaceCriteria); } else { - $link.text(Messages.strHideFindNReplaceCriteria); + $link.text(window.Messages.strHideFindNReplaceCriteria); } return false; }); diff --git a/js/src/table/operations.js b/js/src/table/operations.js index a164e59f32..f7ffd0d374 100644 --- a/js/src/table/operations.js +++ b/js/src/table/operations.js @@ -29,14 +29,14 @@ var confirmAndPost = function (linkObject, action) { */ var question = ''; if (action === 'TRUNCATE') { - question += Messages.strTruncateTableStrongWarning + ' '; + question += window.Messages.strTruncateTableStrongWarning + ' '; } else if (action === 'DELETE') { - question += Messages.strDeleteTableStrongWarning + ' '; + question += window.Messages.strDeleteTableStrongWarning + ' '; } - question += Functions.sprintf(Messages.strDoYouReally, linkObject.data('query')); + question += Functions.sprintf(window.Messages.strDoYouReally, linkObject.data('query')); question += Functions.getForeignKeyCheckboxLoader(); linkObject.confirm(question, linkObject.attr('href'), function (url) { - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, linkObject.getPostData()); @@ -131,7 +131,7 @@ window.AJAX.registerOnload('table/operations.js', function () { var $tblCollationField = $form.find('select[name=tbl_collation]'); var collationOrigValue = $('select[name="tbl_collation"] option[selected]').val(); var $changeAllColumnCollationsCheckBox = $('#checkbox_change_all_collations'); - var question = Messages.strChangeAllColumnCollationsWarning; + var question = window.Messages.strChangeAllColumnCollationsWarning; if ($tblNameField.val() !== $tblNameField[0].defaultValue) { // reload page and navigation if the table has been renamed @@ -242,17 +242,17 @@ window.AJAX.registerOnload('table/operations.js', function () { function submitPartitionMaintenance () { var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); window.AJAX.source = $form; $.post($form.attr('action'), submitData, window.AJAX.responseHandler); } if ($('#partitionOperationRadioDrop').is(':checked')) { - $form.confirm(Messages.strDropPartitionWarning, $form.attr('action'), function () { + $form.confirm(window.Messages.strDropPartitionWarning, $form.attr('action'), function () { submitPartitionMaintenance(); }); } else if ($('#partitionOperationRadioTruncate').is(':checked')) { - $form.confirm(Messages.strTruncatePartitionWarning, $form.attr('action'), function () { + $form.confirm(window.Messages.strTruncatePartitionWarning, $form.attr('action'), function () { submitPartitionMaintenance(); }); } else { @@ -266,12 +266,12 @@ window.AJAX.registerOnload('table/operations.js', function () { /** * @var {String} question String containing the question to be asked for confirmation */ - var question = Messages.strDropTableStrongWarning + ' '; - question += Functions.sprintf(Messages.strDoYouReally, $link[0].getAttribute('data-query')); + var question = window.Messages.strDropTableStrongWarning + ' '; + question += Functions.sprintf(window.Messages.strDoYouReally, $link[0].getAttribute('data-query')); question += Functions.getForeignKeyCheckboxLoader(); $(this).confirm(question, $(this).attr('href'), function (url) { - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $link.getPostData()); @@ -300,14 +300,14 @@ window.AJAX.registerOnload('table/operations.js', function () { /** * @var {String} question String containing the question to be asked for confirmation */ - var question = Messages.strDropTableStrongWarning + ' '; + var question = window.Messages.strDropTableStrongWarning + ' '; question += Functions.sprintf( - Messages.strDoYouReally, + window.Messages.strDoYouReally, 'DROP VIEW `' + Functions.escapeHtml(window.CommonParams.get('table') + '`') ); $(this).confirm(question, $(this).attr('href'), function (url) { - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var params = Functions.getJsConfirmCommonParam(this, $link.getPostData()); $.post(url, params, function (data) { if (typeof data !== 'undefined' && data.success === true) { diff --git a/js/src/table/relation.js b/js/src/table/relation.js index 12bbada47b..2ed11b7175 100644 --- a/js/src/table/relation.js +++ b/js/src/table/relation.js @@ -232,10 +232,10 @@ window.AJAX.registerOnload('table/relation.js', function () { .val() ); - var question = Functions.sprintf(Messages.strDoYouReally, dropQuery); + var question = Functions.sprintf(window.Messages.strDoYouReally, dropQuery); $anchor.confirm(question, $anchor.attr('href'), function (url) { - var $msg = Functions.ajaxShowMessage(Messages.strDroppingForeignKey, false); + var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingForeignKey, false); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); $.post(url, params, function (data) { if (data.success === true) { @@ -244,7 +244,7 @@ window.AJAX.registerOnload('table/relation.js', function () { // Do nothing }); } else { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false); } }); // end $.post() }); diff --git a/js/src/table/select.js b/js/src/table/select.js index f15b6a3fea..9c0c09e3ef 100644 --- a/js/src/table/select.js +++ b/js/src/table/select.js @@ -64,14 +64,14 @@ window.AJAX.registerOnload('table/select.js', function () { .hide(); $('#togglesearchformlink') - .html(Messages.strShowSearchCriteria) + .html(window.Messages.strShowSearchCriteria) .on('click', function () { var $link = $(this); $('#tbl_search_form').slideToggle(); - if ($link.text() === Messages.strHideSearchCriteria) { - $link.text(Messages.strShowSearchCriteria); + if ($link.text() === window.Messages.strHideSearchCriteria) { + $link.text(window.Messages.strShowSearchCriteria); } else { - $link.text(Messages.strHideSearchCriteria); + $link.text(window.Messages.strHideSearchCriteria); } // avoid default click action return false; @@ -109,7 +109,7 @@ window.AJAX.registerOnload('table/select.js', function () { // empty previous search results while we are waiting for new results $('#sqlqueryresultsouter').empty(); - var $msgbox = Functions.ajaxShowMessage(Messages.strSearching, false); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strSearching, false); Functions.prepareForAjaxRequest($searchForm); @@ -169,7 +169,7 @@ window.AJAX.registerOnload('table/select.js', function () { .hide(); $('#togglesearchformlink') // always start with the Show message - .text(Messages.strShowSearchCriteria); + .text(window.Messages.strShowSearchCriteria); $('#togglesearchformdiv') // now it's time to show the div containing the link .show(); @@ -311,12 +311,12 @@ window.AJAX.registerOnload('table/select.js', function () { if (response.success) { // Get the column min value. var min = response.column_data.min - ? '(' + Messages.strColumnMin + + ? '(' + window.Messages.strColumnMin + ' ' + response.column_data.min + ')' : ''; // Get the column max value. var max = response.column_data.max - ? '(' + Messages.strColumnMax + + ? '(' + window.Messages.strColumnMax + ' ' + response.column_data.max + ')' : ''; $('#rangeSearchModal').modal('show'); @@ -375,7 +375,7 @@ window.AJAX.registerOnload('table/select.js', function () { } }, error: function () { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest); } }); } diff --git a/js/src/table/structure.js b/js/src/table/structure.js index e7b79e8dd5..a1abff1a8a 100644 --- a/js/src/table/structure.js +++ b/js/src/table/structure.js @@ -74,7 +74,7 @@ window.AJAX.registerOnload('table/structure.js', function () { function submitForm () { - var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { if ($('.sqlqueryresults').length !== 0) { $('.sqlqueryresults').remove(); @@ -154,7 +154,7 @@ window.AJAX.registerOnload('table/structure.js', function () { // If Collation is changed, Warn and Confirm if (checkIfConfirmRequired($form)) { var question = window.sprintf( - Messages.strChangeColumnCollation, 'https://wiki.phpmyadmin.net/pma/Garbled_data' + window.Messages.strChangeColumnCollation, 'https://wiki.phpmyadmin.net/pma/Garbled_data' ); $form.confirm(question, $form.attr('action'), function () { submitForm(); @@ -191,10 +191,10 @@ window.AJAX.registerOnload('table/structure.js', function () { /** * @var question String containing the question to be asked for confirmation */ - var question = Functions.sprintf(Messages.strDoYouReally, 'ALTER TABLE `' + currTableName + '` DROP `' + currColumnName + '`;'); + var question = Functions.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' + currTableName + '` DROP `' + currColumnName + '`;'); var $thisAnchor = $(this); $thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) { - var $msg = Functions.ajaxShowMessage(Messages.strDroppingColumn, false); + var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingColumn, false); var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData()); params += window.CommonParams.get('arg_separator') + 'ajax_page_request=1'; $.post(url, params, function (data) { @@ -234,7 +234,7 @@ window.AJAX.registerOnload('table/structure.js', function () { $('.index_info').replaceWith(data.indexes_list); Navigation.reload(); } else { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false); } }); // end $.post() }); @@ -262,7 +262,7 @@ window.AJAX.registerOnload('table/structure.js', function () { } else if ($this.is('.add_fulltext_anchor')) { addClause = 'ADD FULLTEXT'; } - var question = Functions.sprintf(Messages.strDoYouReally, 'ALTER TABLE `' + + var question = Functions.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' + Functions.escapeHtml(currTableName) + '` ' + addClause + '(`' + Functions.escapeHtml(currColumnName) + '`);'); var $thisAnchor = $(this); @@ -288,7 +288,7 @@ window.AJAX.registerOnload('table/structure.js', function () { } var buttonOptionsError = {}; - buttonOptionsError[Messages.strOK] = function () { + buttonOptionsError[window.Messages.strOK] = function () { $(this).dialog('close').remove(); }; @@ -417,11 +417,11 @@ window.AJAX.registerOnload('table/structure.js', function () { } if ($link.is('#partition_action_DROP')) { - $link.confirm(Messages.strDropPartitionWarning, $link.attr('href'), function (url) { + $link.confirm(window.Messages.strDropPartitionWarning, $link.attr('href'), function (url) { submitPartitionAction(url); }); } else if ($link.is('#partition_action_TRUNCATE')) { - $link.confirm(Messages.strTruncatePartitionWarning, $link.attr('href'), function (url) { + $link.confirm(window.Messages.strTruncatePartitionWarning, $link.attr('href'), function (url) { submitPartitionAction(url); }); } else { @@ -435,7 +435,7 @@ window.AJAX.registerOnload('table/structure.js', function () { $(document).on('click', '#remove_partitioning.ajax', function (e) { e.preventDefault(); var $link = $(this); - var question = Messages.strRemovePartitioningWarning; + var question = window.Messages.strRemovePartitioningWarning; $link.confirm(question, $link.attr('href'), function (url) { var params = Functions.getJsConfirmCommonParam({ 'ajax_request' : true, diff --git a/js/src/table/tracking.js b/js/src/table/tracking.js index 4c7a4f0512..11b5f1a9c2 100644 --- a/js/src/table/tracking.js +++ b/js/src/table/tracking.js @@ -57,7 +57,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val(); if ($button.val() === 'delete_version') { - var question = Messages.strDeleteTrackingVersionMultiple; + var question = window.Messages.strDeleteTrackingVersionMultiple; $button.confirm(question, $form.attr('action'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $form; @@ -76,7 +76,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { $('body').on('click', 'a.delete_version_anchor.ajax', function (e) { e.preventDefault(); var $anchor = $(this); - var question = Messages.strDeleteTrackingVersion; + var question = window.Messages.strDeleteTrackingVersion; $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $anchor; @@ -93,7 +93,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { $('body').on('click', 'a.delete_entry_anchor.ajax', function (e) { e.preventDefault(); var $anchor = $(this); - var question = Messages.strDeletingTrackingEntry; + var question = window.Messages.strDeletingTrackingEntry; $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $anchor; diff --git a/js/src/table/zoom_plot_jqplot.js b/js/src/table/zoom_plot_jqplot.js index a67d9b6807..68be3c395b 100644 --- a/js/src/table/zoom_plot_jqplot.js +++ b/js/src/table/zoom_plot_jqplot.js @@ -16,8 +16,8 @@ function displayHelp () { var modal = $('#helpModal'); modal.modal('show'); - modal.find('.modal-body').first().html(Messages.strDisplayHelp); - $('#helpModalLabel').first().html(Messages.strHelpTitle); + modal.find('.modal-body').first().html(window.Messages.strDisplayHelp); + $('#helpModalLabel').first().html(window.Messages.strHelpTitle); return false; } @@ -247,9 +247,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { **/ $('#inputFormSubmitId').on('click', function () { if ($('#tableid_0').get(0).selectedIndex === 0 || $('#tableid_1').get(0).selectedIndex === 0) { - Functions.ajaxShowMessage(Messages.strInputNull); + Functions.ajaxShowMessage(window.Messages.strInputNull); } else if (xLabel === yLabel) { - Functions.ajaxShowMessage(Messages.strSameInputs); + Functions.ajaxShowMessage(window.Messages.strSameInputs); } }); @@ -263,14 +263,14 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { .hide(); $('#togglesearchformlink') - .html(Messages.strShowSearchCriteria) + .html(window.Messages.strShowSearchCriteria) .on('click', function () { var $link = $(this); $('#zoom_search_form').slideToggle(); - if ($link.text() === Messages.strHideSearchCriteria) { - $link.text(Messages.strShowSearchCriteria); + if ($link.text() === window.Messages.strHideSearchCriteria) { + $link.text(window.Messages.strShowSearchCriteria); } else { - $link.text(Messages.strHideSearchCriteria); + $link.text(window.Messages.strHideSearchCriteria); } // avoid default click action return false; @@ -411,7 +411,7 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { dataPointSave(); }); - $('#dataPointModalLabel').first().html(Messages.strDataPointContent); + $('#dataPointModalLabel').first().html(window.Messages.strDataPointContent); /** * Attach Ajax event handlers for input fields @@ -437,7 +437,7 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { .slideToggle() .hide(); $('#togglesearchformlink') - .text(Messages.strShowSearchCriteria); + .text(window.Messages.strShowSearchCriteria); $('#togglesearchformdiv').show(); var selectedRow; var series = []; diff --git a/js/src/u2f.js b/js/src/u2f.js index b80decc70c..ef0bb803eb 100644 --- a/js/src/u2f.js +++ b/js/src/u2f.js @@ -11,19 +11,19 @@ window.AJAX.registerOnload('u2f.js', function () { if (data.errorCode && data.errorCode !== 0) { switch (data.errorCode) { case 5: - Functions.ajaxShowMessage(Messages.strU2FTimeout, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error'); break; case 4: - Functions.ajaxShowMessage(Messages.strU2FErrorRegister, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FErrorRegister, false, 'error'); break; case 3: - Functions.ajaxShowMessage(Messages.strU2FInvalidClient, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error'); break; case 2: - Functions.ajaxShowMessage(Messages.strU2FBadRequest, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error'); break; default: - Functions.ajaxShowMessage(Messages.strU2FUnknown, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error'); break; } return; @@ -48,19 +48,19 @@ window.AJAX.registerOnload('u2f.js', function () { if (data.errorCode && data.errorCode !== 0) { switch (data.errorCode) { case 5: - Functions.ajaxShowMessage(Messages.strU2FTimeout, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error'); break; case 4: - Functions.ajaxShowMessage(Messages.strU2FErrorAuthenticate, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FErrorAuthenticate, false, 'error'); break; case 3: - Functions.ajaxShowMessage(Messages.strU2FInvalidClient, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error'); break; case 2: - Functions.ajaxShowMessage(Messages.strU2FBadRequest, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error'); break; default: - Functions.ajaxShowMessage(Messages.strU2FUnknown, false, 'error'); + Functions.ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error'); break; } return; diff --git a/js/src/validator-messages.js b/js/src/validator-messages.js index 7a26a3b8eb..c231ccd195 100644 --- a/js/src/validator-messages.js +++ b/js/src/validator-messages.js @@ -1,25 +1,25 @@ // eslint-disable-next-line no-unused-vars function extendingValidatorMessages () { $.extend($.validator.messages, { - required: Messages.strValidatorRequired, - remote: Messages.strValidatorRemote, - email: Messages.strValidatorEmail, - url: Messages.strValidatorUrl, - date: Messages.strValidatorDate, - dateISO: Messages.strValidatorDateIso, - number: Messages.strValidatorNumber, - creditcard: Messages.strValidatorCreditCard, - digits: Messages.strValidatorDigits, - equalTo: Messages.strValidatorEqualTo, - maxlength: $.validator.format(Messages.strValidatorMaxLength), - minlength: $.validator.format(Messages.strValidatorMinLength), - rangelength: $.validator.format(Messages.strValidatorRangeLength), - range: $.validator.format(Messages.strValidatorRange), - max: $.validator.format(Messages.strValidatorMax), - min: $.validator.format(Messages.strValidatorMin), - validationFunctionForDateTime: $.validator.format(Messages.strValidationFunctionForDateTime), - validationFunctionForHex: $.validator.format(Messages.strValidationFunctionForHex), - validationFunctionForMd5: $.validator.format(Messages.strValidationFunctionForMd5), - validationFunctionForAesDesEncrypt: $.validator.format(Messages.strValidationFunctionForAesDesEncrypt), + required: window.Messages.strValidatorRequired, + remote: window.Messages.strValidatorRemote, + email: window.Messages.strValidatorEmail, + url: window.Messages.strValidatorUrl, + date: window.Messages.strValidatorDate, + dateISO: window.Messages.strValidatorDateIso, + number: window.Messages.strValidatorNumber, + creditcard: window.Messages.strValidatorCreditCard, + digits: window.Messages.strValidatorDigits, + equalTo: window.Messages.strValidatorEqualTo, + maxlength: $.validator.format(window.Messages.strValidatorMaxLength), + minlength: $.validator.format(window.Messages.strValidatorMinLength), + rangelength: $.validator.format(window.Messages.strValidatorRangeLength), + range: $.validator.format(window.Messages.strValidatorRange), + max: $.validator.format(window.Messages.strValidatorMax), + min: $.validator.format(window.Messages.strValidatorMin), + validationFunctionForDateTime: $.validator.format(window.Messages.strValidationFunctionForDateTime), + validationFunctionForHex: $.validator.format(window.Messages.strValidationFunctionForHex), + validationFunctionForMd5: $.validator.format(window.Messages.strValidationFunctionForMd5), + validationFunctionForAesDesEncrypt: $.validator.format(window.Messages.strValidationFunctionForAesDesEncrypt), }); } diff --git a/libraries/classes/Controllers/JavaScriptMessagesController.php b/libraries/classes/Controllers/JavaScriptMessagesController.php index 2d4eeb6ad7..952b7671aa 100644 --- a/libraries/classes/Controllers/JavaScriptMessagesController.php +++ b/libraries/classes/Controllers/JavaScriptMessagesController.php @@ -31,7 +31,7 @@ final class JavaScriptMessagesController return; } - echo 'var Messages = ' . $messages . ';'; + echo 'window.Messages = ' . $messages . ';'; } /** diff --git a/libraries/classes/ErrorHandler.php b/libraries/classes/ErrorHandler.php index df25ee0cc6..07b0eed485 100644 --- a/libraries/classes/ErrorHandler.php +++ b/libraries/classes/ErrorHandler.php @@ -598,7 +598,7 @@ class ErrorHandler // send the error reports asynchronously & without asking user $jsCode .= '$("#pma_report_errors_form").submit();' . 'Functions.ajaxShowMessage( - Messages.phpErrorsBeingSubmitted, false + window.Messages.phpErrorsBeingSubmitted, false );'; // js code to appropriate focusing, $jsCode .= '$("html, body").animate({ @@ -609,7 +609,7 @@ class ErrorHandler //ask user whether to submit errors or not. if (! $response->isAjax()) { // js code to show appropriate msgs, event binding & focusing. - $jsCode = 'Functions.ajaxShowMessage(Messages.phpErrorsFound);' + $jsCode = 'Functions.ajaxShowMessage(window.Messages.phpErrorsFound);' . '$("#pma_ignore_errors_popup").on("click", function() { Functions.ignorePhpErrors() });' diff --git a/templates/config/form_display/display.twig b/templates/config/form_display/display.twig index 9d427e7d1b..a121a72870 100644 --- a/templates/config/form_display/display.twig +++ b/templates/config/form_display/display.twig @@ -60,7 +60,7 @@ window.configInlineParams.push(function () { {{ js_array|join(';\n')|raw }}; - $.extend(Messages, { + $.extend(window.Messages, { 'error_nan_p': '{{ 'Not a positive number!'|trans|e('js') }}', 'error_nan_nneg': '{{ 'Not a non-negative number!'|trans|e('js') }}', 'error_incorrect_port': '{{ 'Not a valid port number!'|trans|e('js') }}', diff --git a/templates/import/javascript.twig b/templates/import/javascript.twig index 4b3a03cbb6..56ef1a8292 100644 --- a/templates/import/javascript.twig +++ b/templates/import/javascript.twig @@ -66,10 +66,10 @@ $( function() { var statustext = Functions.sprintf( "{{ statustext_str|raw }}", Functions.formatBytes( - complete, 1, Messages.strDecimalSeparator + complete, 1, window.Messages.strDecimalSeparator ), Functions.formatBytes( - total, 1, Messages.strDecimalSeparator + total, 1, window.Messages.strDecimalSeparator ) ); @@ -87,7 +87,7 @@ $( function() { var seconds = parseInt(((total - complete) / complete) * used_time / 1000); var speed = Functions.sprintf( "{{ second_str|raw }}", - Functions.formatBytes(complete / used_time * 1000, 1, Messages.strDecimalSeparator) + Functions.formatBytes(complete / used_time * 1000, 1, window.Messages.strDecimalSeparator) ); var minutes = parseInt(seconds / 60); diff --git a/templates/preferences/manage/main.twig b/templates/preferences/manage/main.twig index 9783950598..ebe6a4a6b8 100644 --- a/templates/preferences/manage/main.twig +++ b/templates/preferences/manage/main.twig @@ -1,6 +1,6 @@ {{ error|raw }}
diff --git a/test/classes/Controllers/JavaScriptMessagesControllerTest.php b/test/classes/Controllers/JavaScriptMessagesControllerTest.php index b8d3f2cd88..49097f0c2b 100644 --- a/test/classes/Controllers/JavaScriptMessagesControllerTest.php +++ b/test/classes/Controllers/JavaScriptMessagesControllerTest.php @@ -27,10 +27,10 @@ class JavaScriptMessagesControllerTest extends TestCase ob_end_clean(); $this->assertIsString($actual); - $this->assertStringStartsWith('var Messages = {', $actual); + $this->assertStringStartsWith('window.Messages = {', $actual); $this->assertStringEndsWith('};', $actual); - $json = substr($actual, strlen('var Messages = '), -1); + $json = substr($actual, strlen('window.Messages = '), -1); $array = json_decode($json, true); $this->assertIsArray($array); diff --git a/test/classes/ErrorReportTest.php b/test/classes/ErrorReportTest.php index 19373305fc..b10a6712f2 100644 --- a/test/classes/ErrorReportTest.php +++ b/test/classes/ErrorReportTest.php @@ -217,7 +217,7 @@ class ErrorReportTest extends AbstractTestCase ' if (response.success) {', ' // Get the column min value.', ' var min = response.column_data.min', - ' ? \'(\' + Messages.strColumnMin +', + ' ? \'(\' + window.Messages.strColumnMin +', ' this.completion.cm.removeKeyMap(this.keyMap);', ' \' \' + response.column_data.min + \')\'', ' : \'\';', -- cgit v1.2.3