diff options
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 += '<div>' + Functions.escapeHtml(Functions.sprintf(Messages.strErrorCode, request.status)) + '</div>'; + details += '<div>' + Functions.escapeHtml(Functions.sprintf(window.Messages.strErrorCode, request.status)) + '</div>'; } - details += '<div>' + Functions.escapeHtml(Functions.sprintf(Messages.strErrorText, request.statusText + ' (' + state + ')')) + '</div>'; + details += '<div>' + Functions.escapeHtml(Functions.sprintf(window.Messages.strErrorText, request.statusText + ' (' + state + ')')) + '</div>'; if (state === 'rejected' || state === 'timeout') { - details += '<div>' + Functions.escapeHtml(Messages.strErrorConnection) + '</div>'; + details += '<div>' + Functions.escapeHtml(window.Messages.strErrorConnection) + '</div>'; } Functions.ajaxShowMessage( '<div class="alert alert-danger" role="alert">' + - Messages.strErrorProcessingRequest + + window.Messages.strErrorProcessingRequest + details + '</div>', 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( '<div class="alert alert-danger" role="alert">' + - Messages.strErrorProcessingRequest + + window.Messages.strErrorProcessingRequest + '</div>', false ); @@ -200,7 +200,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { 'db' : window.CommonParams.get('db'), 'selectedTable' : selectValue }; - $('#column-select').html('<option value="">' + Messages.strLoading + '</option>'); + $('#column-select').html('<option value="">' + window.Messages.strLoading + '</option>'); 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 += '<img src="' + themeImagePath + 'designer/and_icon.png" onclick="DesignerHistory.andOr(' + i + ')" title="AND"></td>'; } - str += '<td style="padding-left: 5px;" class="text-end">' + Functions.getImage('b_sbrowse', Messages.strColumnName) + '</td>' + + str += '<td style="padding-left: 5px;" class="text-end">' + Functions.getImage('b_sbrowse', window.Messages.strColumnName) + '</td>' + '<td width="175" style="padding-left: 5px">' + $('<div/>').text(historyArray[i].getColumnName()).html() + '<td>'; if (historyArray[i].getType() === 'GroupBy' || historyArray[i].getType() === 'OrderBy') { var detailDescGroupBy = $('<div/>').text(DesignerHistory.detail(i)).html(); str += '<td class="text-center">' + Functions.getImage('s_info', DesignerHistory.detail(i)) + '</td>' + '<td title="' + detailDescGroupBy + '">' + historyArray[i].getType() + '</td>' + - '<td onclick=DesignerHistory.historyDelete(' + i + ')>' + Functions.getImage('b_drop', Messages.strDelete) + '</td>'; + '<td onclick=DesignerHistory.historyDelete(' + i + ')>' + Functions.getImage('b_drop', window.Messages.strDelete) + '</td>'; } else { var detailDesc = $('<div/>').text(DesignerHistory.detail(i)).html(); str += '<td class="text-center">' + Functions.getImage('s_info', DesignerHistory.detail(i)) + '</td>' + '<td title="' + detailDesc + '">' + historyArray[i].getType() + '</td>' + - '<td onclick=DesignerHistory.historyEdit(' + i + ')>' + Functions.getImage('b_edit', Messages.strEdit) + '</td>' + - '<td onclick=DesignerHistory.historyDelete(' + i + ')>' + Functions.getImage('b_drop', Messages.strDelete) + '</td>'; + '<td onclick=DesignerHistory.historyEdit(' + i + ')>' + Functions.getImage('b_edit', window.Messages.strEdit) + '</td>' + + '<td onclick=DesignerHistory.historyDelete(' + i + ')>' + Functions.getImage('b_drop', window.Messages.strDelete) + '</td>'; } str += '</tr></thead>'; 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 = $('<tr>' + - ' <td title="' + Messages.strStructure + '"' + + ' <td title="' + window.Messages.strStructure + '"' + ' width="1px"' + ' class="L_butt2_1">' + ' <img alt=""' + @@ -618,7 +618,7 @@ DesignerMove.addTableToTablesList = function (index, tableDom) { }); $($newTableLine).find('.scroll_tab_checkbox').on('click', function () { $(this).attr('title', function (i, currentvalue) { - return currentvalue === Messages.strHide ? Messages.strShow : Messages.strHide; + return currentvalue === window.Messages.strHide ? window.Messages.strShow : window.Messages.strHide; }); DesignerMove.visibleTab(this,$(this).val()); }); @@ -644,10 +644,10 @@ DesignerMove.displayModal = function (form, heading, type) { DesignerMove.addOtherDbTables = function () { var $selectDb = $('<select id="add_table_from"></select>'); - $selectDb.append('<option value="">' + Messages.strNone + '</option>'); + $selectDb.append('<option value="">' + window.Messages.strNone + '</option>'); var $selectTable = $('<select id="add_table"></select>'); - $selectTable.append('<option value="">' + Messages.strNone + '</option>'); + $selectTable.append('<option value="">' + window.Messages.strNone + '</option>'); $.post('index.php?route=/sql', { 'ajax_request' : true, @@ -662,7 +662,7 @@ DesignerMove.addOtherDbTables = function () { var $form = $('<form action="" class="ajax"></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('<option value="">' + Messages.strNone + '</option>'); + $selectTable.append('<option value="">' + window.Messages.strNone + '</option>'); } 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($('<input type="hidden" name="db" />').val(db)) .append('<input type="hidden" name="operation" value="savePage">') .append('<input type="hidden" name="save_page" value="new">') - .append('<label for="selected_value">' + Messages.strPageName + + .append('<label for="selected_value">' + window.Messages.strPageName + '</label>:<input type="text" name="selected_value">'); - var modal = DesignerMove.displayModal($form, Messages.strSavePage, '#designerGoModal'); + var modal = DesignerMove.displayModal($form, window.Messages.strSavePage, '#designerGoModal'); $form.on('submit', function (e) { e.preventDefault(); DesignerMove.submitSaveDialogAndClose(callback, modal); @@ -894,12 +894,12 @@ DesignerMove.editPages = function () { $('#selected_page').append(options); }); } - var modal = DesignerMove.displayModal(data.message, Messages.strOpenPage, '#designerGoModal'); + var modal = DesignerMove.displayModal(data.message, window.Messages.strOpenPage, '#designerGoModal'); $('#designerModalGoButton').on('click', function () { var $form = $('#edit_delete_pages'); var selected = $form.find('select[name="selected_page"]').val(); if (selected === '0') { - Functions.ajaxShowMessage(Messages.strSelectPage, 2000); + Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000); return; } modal.modal('hide'); @@ -930,16 +930,16 @@ DesignerMove.deletePages = function () { }); } - var modal = DesignerMove.displayModal(data.message, Messages.strDeletePage, '#designerGoModal'); + var modal = DesignerMove.displayModal(data.message, window.Messages.strDeletePage, '#designerGoModal'); $('#designerModalGoButton').on('click', function () { var $form = $('#edit_delete_pages'); var selected = $form.find('select[name="selected_page"]').val(); if (selected === '0') { - Functions.ajaxShowMessage(Messages.strSelectPage, 2000); + Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000); return; } - var $messageBox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $messageBox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); var deletingCurrentPage = parseInt(selected) === selectedPage; Functions.prepareForAjaxRequest($form); @@ -952,7 +952,7 @@ DesignerMove.deletePages = function () { if (deletingCurrentPage) { DesignerMove.loadPage(null); } else { - Functions.ajaxShowMessage(Messages.strSuccessfulPageDelete); + Functions.ajaxShowMessage(window.Messages.strSuccessfulPageDelete); } } }); // end $.post() @@ -965,7 +965,7 @@ DesignerMove.deletePages = function () { if (deletingCurrentPage) { DesignerMove.loadPage(null); } else { - Functions.ajaxShowMessage(Messages.strSuccessfulPageDelete); + Functions.ajaxShowMessage(window.Messages.strSuccessfulPageDelete); } } }); @@ -996,7 +996,7 @@ DesignerMove.saveAs = function () { }); } - var modal = DesignerMove.displayModal(data.message, Messages.strSavePageAs, '#designerGoModal'); + var modal = DesignerMove.displayModal(data.message, window.Messages.strSavePageAs, '#designerGoModal'); $('#designerModalGoButton').on('click', function () { var $form = $('#save_as_pages'); var selectedValue = $form.find('input[name="selected_value"]').val().trim(); @@ -1006,19 +1006,19 @@ DesignerMove.saveAs = function () { if (choice === 'same') { if ($selectedPage.val() === '0') { - Functions.ajaxShowMessage(Messages.strSelectPage, 2000); + Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000); return; } name = $selectedPage.find('option:selected').text(); } else if (choice === 'new') { if (selectedValue === '') { - Functions.ajaxShowMessage(Messages.strEnterValidPageName, 2000); + Functions.ajaxShowMessage(window.Messages.strEnterValidPageName, 2000); return; } name = selectedValue; } - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); if (designerTablesEnabled) { Functions.prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize() + DesignerMove.getUrlPos(), function (data) { @@ -1068,8 +1068,8 @@ DesignerMove.saveAs = function () { DesignerMove.promptToSaveCurrentPage = function (callback) { if (change === 1 || selectedPage === -1) { - var modal = DesignerMove.displayModal('<div>' + Messages.strLeavingPage + '</div>', - Messages.strSavePage, '#designerPromptModal'); + var modal = DesignerMove.displayModal('<div>' + window.Messages.strLeavingPage + '</div>', + window.Messages.strSavePage, '#designerPromptModal'); $('#designerModalYesButton').on('click', function () { modal.modal('hide'); DesignerMove.save3(callback); @@ -1118,7 +1118,7 @@ DesignerMove.exportPages = function () { $form.find('#' + format + '_options').show(); }).trigger('change'); - var modal = DesignerMove.displayModal($form, Messages.strExportRelationalSchema, '#designerGoModal'); + var modal = DesignerMove.displayModal($form, window.Messages.strExportRelationalSchema, '#designerGoModal'); $('#designerModalGoButton').on('click', function () { $('#id_export_pages').trigger('submit'); modal.modal('hide'); @@ -1203,7 +1203,7 @@ DesignerMove.startRelation = function () { if (!onRelation) { document.getElementById('foreign_relation').style.display = ''; onRelation = 1; - document.getElementById('designer_hint').innerHTML = Messages.strSelectReferencedKey; + document.getElementById('designer_hint').innerHTML = window.Messages.strSelectReferencedKey; document.getElementById('designer_hint').style.display = 'block'; document.getElementById('rel_button').className = 'M_butt_Selected_down'; } else { @@ -1223,7 +1223,7 @@ DesignerMove.clickField = function (db, T, f, pk) { if (!clickField) { // .style.display=='none' .style.display = 'none' if (!pkLocal) { - alert(Messages.strPleaseSelectPrimaryOrUniqueKey); + alert(window.Messages.strPleaseSelectPrimaryOrUniqueKey); return;// 0; }// PK if (jTabs[db + '.' + T] !== 1) { @@ -1231,7 +1231,7 @@ DesignerMove.clickField = function (db, T, f, pk) { } clickField = 1; linkRelation = 'DB1=' + db + argsep + 'T1=' + T + argsep + 'F1=' + f; - document.getElementById('designer_hint').innerHTML = Messages.strSelectForeignKey; + document.getElementById('designer_hint').innerHTML = window.Messages.strSelectForeignKey; } else { DesignerMove.startRelation(); // hidden hint... if (jTabs[db + '.' + T] !== 1 || !pkLocal) { @@ -1281,7 +1281,7 @@ DesignerMove.clickField = function (db, T, f, pk) { document.getElementById('designer_hint').style.display = 'none'; document.getElementById('display_field_button').className = 'M_butt'; - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post('index.php?route=/database/designer', { 'operation': 'setDisplayField', @@ -1296,7 +1296,7 @@ DesignerMove.clickField = function (db, T, f, pk) { Functions.ajaxShowMessage(data.error, false); } else { Functions.ajaxRemoveMessage($msgbox); - Functions.ajaxShowMessage(Messages.strModificationSaved); + Functions.ajaxShowMessage(window.Messages.strModificationSaved); } }); } @@ -1309,7 +1309,7 @@ DesignerMove.newRelation = function () { linkRelation += argsep + 'on_delete=' + document.getElementById('on_delete').value + argsep + 'on_update=' + document.getElementById('on_update').value; linkRelation += argsep + 'operation=addNewRelation' + argsep + 'ajax_request=true'; - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post('index.php?route=/database/designer', linkRelation, function (data) { if (data.success === false) { Functions.ajaxShowMessage(data.error, false); @@ -1535,7 +1535,7 @@ DesignerMove.updRelation = function () { linkRelation += argsep + 'server=' + server + argsep + 'db=' + db; linkRelation += argsep + 'operation=removeRelation' + argsep + 'ajax_request=true'; - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $.post('index.php?route=/database/designer', linkRelation, function (data) { if (data.success === false) { Functions.ajaxShowMessage(data.error, false); @@ -1715,7 +1715,7 @@ DesignerMove.startDisplayField = function () { } if (!onDisplayField) { onDisplayField = 1; - document.getElementById('designer_hint').innerHTML = Messages.strChangeDisplay; + document.getElementById('designer_hint').innerHTML = window.Messages.strChangeDisplay; document.getElementById('designer_hint').style.display = 'block'; document.getElementById('display_field_button').className = 'M_butt_Selected_down';// '#FFEE99';gray #AAAAAA @@ -1898,7 +1898,7 @@ DesignerMove.addObject = function (dbName, tableName, colName, dbTableNameUrl) { var init = historyArray.length; if (rel.value !== '--') { if (document.getElementById('Query').value === '') { - Functions.ajaxShowMessage(Functions.sprintf(Messages.strQueryEmpty)); + Functions.ajaxShowMessage(Functions.sprintf(window.Messages.strQueryEmpty)); return; } p = document.getElementById('Query'); @@ -1941,7 +1941,7 @@ DesignerMove.addObject = function (dbName, tableName, colName, dbTableNameUrl) { sum = sum + 1; // make orderby } - Functions.ajaxShowMessage(Functions.sprintf(Messages.strObjectsCreated, sum)); + Functions.ajaxShowMessage(Functions.sprintf(window.Messages.strObjectsCreated, sum)); // output sum new objects created var existingDiv = document.getElementById('ab'); existingDiv.innerHTML = DesignerHistory.display(init, historyArray.length); diff --git a/js/src/designer/page.js b/js/src/designer/page.js index a1c1220f46..b4424b79e3 100644 --- a/js/src/designer/page.js +++ b/js/src/designer/page.js @@ -123,7 +123,7 @@ DesignerPage.showNewPageTables = function (check) { } } selectedPage = -1; - $('#page_name').text(Messages.strUntitled); + $('#page_name').text(window.Messages.strUntitled); DesignerMove.markUnsaved(); }; @@ -149,7 +149,7 @@ DesignerPage.loadHtmlForPage = function (pageId) { DesignerMove.markSaved(); if (tableMissing === true) { DesignerMove.markUnsaved(); - Functions.ajaxShowMessage(Messages.strSavedPageTableMissing); + Functions.ajaxShowMessage(window.Messages.strSavedPageTableMissing); } selectedPage = page.pgNr; }); diff --git a/js/src/drag_drop_import.js b/js/src/drag_drop_import.js index 6e5ad6d841..f782c35193 100644 --- a/js/src/drag_drop_import.js +++ b/js/src/drag_drop_import.js @@ -109,7 +109,7 @@ var DragDropImport = { $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize').html('<span hash="' + hash + '" class="pma_drop_file_status" task="cancel">' + - Messages.dropImportMessageCancel + '</span>'); + window.Messages.dropImportMessageCancel + '</span>'); // -- add event listener to this link to abort upload operation $('.pma_sql_import_status div li[data-hash="' + hash + @@ -117,10 +117,10 @@ var DragDropImport = { .on('click', function () { if ($(this).attr('task') === 'cancel') { jqXHR.abort(); - $(this).html('<span>' + Messages.dropImportMessageAborted + '</span>'); + $(this).html('<span>' + window.Messages.dropImportMessageAborted + '</span>'); DragDropImport.importFinished(hash, true, false); } else if ($(this).children('span').html() === - Messages.dropImportMessageFailed) { + window.Messages.dropImportMessageFailed) { // -- view information var $this = $(this); $.each(DragDropImport.importStatus, @@ -129,7 +129,7 @@ var DragDropImport = { $('.pma_drop_result:visible').remove(); var filename = $this.parent('span').attr('data-filename'); $('body').append('<div class="pma_drop_result"><h2>' + - Messages.dropImportImportResultHeader + ' - ' + + window.Messages.dropImportImportResultHeader + ' - ' + filename + '<span class="close">x</span></h2>' + value.message + '</div>'); $('.pma_drop_result').draggable(); // to make this dialog draggable } @@ -157,9 +157,9 @@ var DragDropImport = { return; } if (window.CommonParams.get('db') === '') { - $('.pma_drop_handler').html(Messages.dropImportSelectDB); + $('.pma_drop_handler').html(window.Messages.dropImportSelectDB); } else { - $('.pma_drop_handler').html(Messages.dropImportDropFiles); + $('.pma_drop_handler').html(window.Messages.dropImportDropFiles); } $('.pma_drop_handler').fadeIn(); }, @@ -217,7 +217,7 @@ var DragDropImport = { var $dropHandler = $('.pma_drop_handler'); $dropHandler.clearQueue().stop(); $dropHandler.fadeOut(); - $dropHandler.html(Messages.dropImportDropFiles); + $dropHandler.html(window.Messages.dropImportDropFiles); }, /** * Called when upload has finished @@ -237,11 +237,11 @@ var DragDropImport = { if (status) { $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize span.pma_drop_file_status') - .html('<span>' + Messages.dropImportMessageSuccess + '</a>'); + .html('<span>' + window.Messages.dropImportMessageSuccess + '</a>'); } else { $('.pma_sql_import_status div li[data-hash="' + hash + '"] span.filesize span.pma_drop_file_status') - .html('<span class="underline">' + Messages.dropImportMessageFailed + + .html('<span class="underline">' + window.Messages.dropImportMessageFailed + '</a>'); icon = 'icon ic_s_error'; } diff --git a/js/src/error_report.js b/js/src/error_report.js index d91c8f108e..8174862d72 100644 --- a/js/src/error_report.js +++ b/js/src/error_report.js @@ -126,21 +126,21 @@ var ErrorReport = { var $div = $( '<div class="alert alert-danger" role="alert" id="error_notification_' + key + '"></div>' ).append( - Functions.getImage('s_error') + Messages.strErrorOccurred + Functions.getImage('s_error') + window.Messages.strErrorOccurred ); var $buttons = $('<div class="float-end"></div>'); var buttonHtml = '<button class="btn btn-primary" id="show_error_report_' + key + '">'; - buttonHtml += Messages.strShowReportDetails; + buttonHtml += window.Messages.strShowReportDetails; buttonHtml += '</button>'; var settingsUrl = 'index.php?route=/preferences/features&server=' + window.CommonParams.get('server'); buttonHtml += '<a class="ajax" href="' + settingsUrl + '">'; - buttonHtml += Functions.getImage('s_cog', Messages.strChangeReportSettings); + buttonHtml += Functions.getImage('s_cog', window.Messages.strChangeReportSettings); buttonHtml += '</a>'; buttonHtml += '<a href="#" id="ignore_error_' + key + '" data-notification-id="' + key + '">'; - buttonHtml += Functions.getImage('b_close', Messages.strIgnore); + buttonHtml += Functions.getImage('b_close', window.Messages.strIgnore); buttonHtml += '</a>'; $buttons.html(buttonHtml); diff --git a/js/src/export.js b/js/src/export.js index 0ac8ca8367..85b2880561 100644 --- a/js/src/export.js +++ b/js/src/export.js @@ -92,7 +92,7 @@ Export.createTemplate = function (name) { $(this).prop('selected', true); } }); - Functions.ajaxShowMessage(Messages.strTemplateCreated); + Functions.ajaxShowMessage(window.Messages.strTemplateCreated); } else { Functions.ajaxShowMessage(response.error, false); } @@ -139,7 +139,7 @@ Export.loadTemplate = function (id) { } }); $('input[name="template_id"]').val(id); - Functions.ajaxShowMessage(Messages.strTemplateLoaded); + Functions.ajaxShowMessage(window.Messages.strTemplateLoaded); } else { Functions.ajaxShowMessage(response.error, false); } @@ -167,7 +167,7 @@ Export.updateTemplate = function (id) { Functions.ajaxShowMessage(); $.post('index.php?route=/export/template/update', params, function (response) { if (response.success === true) { - Functions.ajaxShowMessage(Messages.strTemplateUpdated); + Functions.ajaxShowMessage(window.Messages.strTemplateUpdated); } else { Functions.ajaxShowMessage(response.error, false); } @@ -193,7 +193,7 @@ Export.deleteTemplate = function (id) { $.post('index.php?route=/export/template/delete', params, function (response) { if (response.success === true) { $('#template').find('option[value="' + id + '"]').remove(); - Functions.ajaxShowMessage(Messages.strTemplateDeleted); + Functions.ajaxShowMessage(window.Messages.strTemplateDeleted); } else { Functions.ajaxShowMessage(response.error, false); } @@ -233,7 +233,7 @@ window.AJAX.registerOnload('export.js', function () { var modal = $('#showSqlQueryModal'); modal.modal('show'); modal.on('shown.bs.modal', function () { - $('#showSqlQueryModalLabel').first().html(Messages.strQuery); + $('#showSqlQueryModalLabel').first().html(window.Messages.strQuery); Functions.highlightSql(modal); }); }); @@ -731,7 +731,7 @@ Export.checkTimeOut = function (timeLimit) { if (data.message === 'timeout') { Functions.ajaxShowMessage( '<div class="alert alert-danger" role="alert">' + - Messages.strTimeOutError + + window.Messages.strTimeOutError + '</div>', false ); @@ -927,7 +927,7 @@ window.AJAX.registerOnload('export.js', function () { e.preventDefault(); var db = $('#db_alias_select').val(); Export.addAlias( - Messages.strAliasDatabase, + window.Messages.strAliasDatabase, db, 'aliases[' + db + '][alias]', $('#db_alias_name').val() @@ -939,7 +939,7 @@ window.AJAX.registerOnload('export.js', function () { var db = $('#db_alias_select').val(); var table = $('#table_alias_select').val(); Export.addAlias( - Messages.strAliasTable, + window.Messages.strAliasTable, db + '.' + table, 'aliases[' + db + '][tables][' + table + '][alias]', $('#table_alias_name').val() @@ -952,7 +952,7 @@ window.AJAX.registerOnload('export.js', function () { var table = $('#table_alias_select').val(); var column = $('#column_alias_select').val(); Export.addAlias( - Messages.strAliasColumn, + window.Messages.strAliasColumn, db + '.' + table + '.' + column, 'aliases[' + db + '][tables][' + table + '][colums][' + column + ']', $('#column_alias_name').val() diff --git a/js/src/functions.js b/js/src/functions.js index cc515049d7..26105ad463 100644 --- a/js/src/functions.js +++ b/js/src/functions.js @@ -192,7 +192,7 @@ Functions.addDatepicker = function ($thisElement, type, options) { if (type === 'time') { $thisElement.timepicker($.extend(defaultOptions, options)); // Add a tip regarding entering MySQL allowed-values for TIME data-type - Functions.tooltip($thisElement, 'input', Messages.strMysqlAllowedValuesTipTime); + Functions.tooltip($thisElement, 'input', window.Messages.strMysqlAllowedValuesTipTime); } else { $thisElement.datetimepicker($.extend(defaultOptions, options)); } @@ -236,9 +236,9 @@ Functions.addDateTimePicker = function () { // Add a tip regarding entering MySQL allowed-values // for TIME and DATE data-type if ($(this).hasClass('timefield')) { - Functions.tooltip($(this), 'input', Messages.strMysqlAllowedValuesTipTime); + Functions.tooltip($(this), 'input', window.Messages.strMysqlAllowedValuesTipTime); } else if ($(this).hasClass('datefield')) { - Functions.tooltip($(this), 'input', Messages.strMysqlAllowedValuesTipDate); + Functions.tooltip($(this), 'input', window.Messages.strMysqlAllowedValuesTipDate); } }); } @@ -531,19 +531,19 @@ Functions.checkPasswordStrength = function (value, meterObject, meterObjectLabel meterObject.val(strength); switch (strength) { case 0: - meterObjectLabel.html(Messages.strExtrWeak); + meterObjectLabel.html(window.Messages.strExtrWeak); break; case 1: - meterObjectLabel.html(Messages.strVeryWeak); + meterObjectLabel.html(window.Messages.strVeryWeak); break; case 2: - meterObjectLabel.html(Messages.strWeak); + meterObjectLabel.html(window.Messages.strWeak); break; case 3: - meterObjectLabel.html(Messages.strGood); + meterObjectLabel.html(window.Messages.strGood); break; case 4: - meterObjectLabel.html(Messages.strStrong); + meterObjectLabel.html(window.Messages.strStrong); } }; @@ -602,13 +602,13 @@ Functions.suggestPassword = function (passwordForm) { */ Functions.displayPasswordGenerateButton = function () { var generatePwdRow = $('<tr></tr>').addClass('align-middle'); - $('<td></td>').html(Messages.strGeneratePassword).appendTo(generatePwdRow); + $('<td></td>').html(window.Messages.strGeneratePassword).appendTo(generatePwdRow); var pwdCell = $('<td colspan="2"></td>').addClass('row').appendTo(generatePwdRow); pwdCell.append('<div class="d-flex align-items-center col-4"></div>'); var pwdButton = $('<input>') - .attr({ type: 'button', id: 'button_generate_password', value: Messages.strGenerate }) + .attr({ type: 'button', id: 'button_generate_password', value: window.Messages.strGenerate }) .addClass('btn btn-secondary button') .on('click', function () { Functions.suggestPassword(this.form); @@ -626,7 +626,7 @@ Functions.displayPasswordGenerateButton = function () { var generatePwdDiv = $('<div></div>').addClass('item'); $('<label></label>').attr({ for: 'button_generate_password' }) - .html(Messages.strGeneratePassword + ':') + .html(window.Messages.strGeneratePassword + ':') .appendTo(generatePwdDiv); var optionsSpan = $('<span></span>').addClass('options') .appendTo(generatePwdDiv); @@ -650,11 +650,11 @@ Functions.displayPasswordGenerateButton = function () { Functions.confirmLink = function (theLink, theSqlQuery) { // Confirmation is not required in the configuration file // or browser is Opera (crappy js implementation) - if (Messages.strDoYouReally === '' || typeof (window.opera) !== 'undefined') { + if (window.Messages.strDoYouReally === '' || typeof (window.opera) !== 'undefined') { return true; } - var isConfirmed = confirm(Functions.sprintf(Messages.strDoYouReally, theSqlQuery)); + var isConfirmed = confirm(Functions.sprintf(window.Messages.strDoYouReally, theSqlQuery)); if (isConfirmed) { if (typeof (theLink.href) !== 'undefined') { theLink.href += window.CommonParams.get('arg_separator') + 'is_js_confirmed=1'; @@ -680,7 +680,7 @@ Functions.confirmLink = function (theLink, theSqlQuery) { */ Functions.confirmQuery = function (theForm1, sqlQuery1) { // Confirmation is not required in the configuration file - if (Messages.strDoYouReally === '') { + if (window.Messages.strDoYouReally === '') { return true; } @@ -708,7 +708,7 @@ Functions.confirmQuery = function (theForm1, sqlQuery1) { } else { message = sqlQuery1; } - var isConfirmed = confirm(Functions.sprintf(Messages.strDoYouReally, message)); + var isConfirmed = confirm(Functions.sprintf(window.Messages.strDoYouReally, message)); // statement is confirmed -> update the // "is_js_confirmed" form field so the confirm test won't be // run on the server side and allows to submit the form @@ -759,7 +759,7 @@ Functions.checkSqlQuery = function (theForm) { if (sqlQuery.replace(spaceRegExp, '') !== '') { result = Functions.confirmQuery(theForm, sqlQuery); } else { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); } if (window.codeMirrorEditor) { @@ -811,7 +811,7 @@ Functions.checkFormElementInRange = function (theForm, theFieldName, message, mi if (isNaN(val)) { theField.select(); - alert(Messages.strEnterValidNumber); + alert(window.Messages.strEnterValidNumber); theField.focus(); return false; } else if (val < min || val > max) { @@ -847,7 +847,7 @@ Functions.checkTableEditForm = function (theForm, fieldsCnt) { elm3 = $('#field_' + i + '_1'); if (isNaN(val) && elm3.val() !== '') { elm2.select(); - alert(Messages.strEnterValidLength); + alert(window.Messages.strEnterValidLength); elm2.focus(); return false; } @@ -862,7 +862,7 @@ Functions.checkTableEditForm = function (theForm, fieldsCnt) { } if (atLeastOneField === 0) { var theField = theForm.elements.field_0_1; - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); theField.focus(); return false; } @@ -870,7 +870,7 @@ Functions.checkTableEditForm = function (theForm, fieldsCnt) { // at least this section is under jQuery var $input = $('input.textfield[name=\'table\']'); if ($input.val() === '') { - alert(Messages.strFormEmpty); + alert(window.Messages.strFormEmpty); $input.trigger('focus'); return false; } @@ -1113,7 +1113,7 @@ Functions.updateQueryParameters = function () { } }); } else { - $('#parametersDiv').text(Messages.strNoParam); + $('#parametersDiv').text(window.Messages.strNoParam); return; } @@ -1161,7 +1161,7 @@ Functions.loadForeignKeyCheckbox = function () { var html = '<input type="hidden" name="fk_checks" value="0">' + '<input type="checkbox" name="fk_checks" id="fk_checks"' + (data.default_fk_check_value ? ' checked="checked"' : '') + '>' + - '<label for="fk_checks">' + Messages.strForeignKeyCheck + '</label>'; + '<label for="fk_checks">' + window.Messages.strForeignKeyCheck + '</label>'; $('.load-default-fk-check-value').replaceWith(html); }); }; @@ -1225,8 +1225,8 @@ Functions.onloadSqlQueryEditEvents = function () { var newContent = '<textarea name="sql_query_edit" id="sql_query_edit">' + Functions.escapeHtml(sqlQuery) + '</textarea>\n'; newContent += Functions.getForeignKeyCheckboxLoader(); - newContent += '<input type="submit" id="sql_query_edit_save" class="btn btn-secondary button btnSave" value="' + Messages.strGo + '">\n'; - newContent += '<input type="button" id="sql_query_edit_discard" class="btn btn-secondary button btnDiscard" value="' + Messages.strCancel + '">\n'; + newContent += '<input type="submit" id="sql_query_edit_save" class="btn btn-secondary button btnSave" value="' + window.Messages.strGo + '">\n'; + newContent += '<input type="button" id="sql_query_edit_discard" class="btn btn-secondary button btnDiscard" value="' + window.Messages.strCancel + '">\n'; var $editorArea = $('div#inline_editor'); if ($editorArea.length === 0) { $editorArea = $('<div id="inline_editor_outer"></div>'); @@ -1574,7 +1574,7 @@ Functions.updateCode = function ($base, htmlValue, rawValue) { * message either the Functions.ajaxRemoveMessage($msg) function must be called or * another message must be show with Functions.ajaxShowMessage() function. * - * 2) var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); + * 2) var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); * This is a special case. The behaviour is same as above, * just with a different message * @@ -1619,10 +1619,10 @@ Functions.ajaxShowMessage = function (message = null, timeout = null, type = nul return true; } else if (! msg) { // If the message is undefined, show the default - msg = Messages.strLoading; + msg = window.Messages.strLoading; dismissable = false; selfClosing = false; - } else if (msg === Messages.strProcessingRequest) { + } else if (msg === window.Messages.strProcessingRequest) { // This is another case where the message should not disappear dismissable = false; selfClosing = false; @@ -1684,11 +1684,11 @@ Functions.ajaxShowMessage = function (message = null, timeout = null, type = nul Functions.tooltip( $retval, 'span', - Messages.strDismiss + window.Messages.strDismiss ); } // Hide spinner if this is not a loading message - if (msg !== Messages.strLoading) { + if (msg !== window.Messages.strLoading) { $retval.css('background-image', 'none'); } Functions.highlightSql($retval); @@ -1740,7 +1740,7 @@ Functions.previewSql = function ($form) { if (response.success) { $('#previewSqlModal').modal('show'); $('#previewSqlModal').find('.modal-body').first().html(response.sql_data); - $('#previewSqlModalLabel').first().html(Messages.strPreviewSQL); + $('#previewSqlModalLabel').first().html(window.Messages.strPreviewSQL); $('#previewSqlModal').on('shown.bs.modal', function () { Functions.highlightSql($('#previewSqlModal')); }); @@ -1749,7 +1749,7 @@ Functions.previewSql = function ($form) { } }, error: function () { - Functions.ajaxShowMessage(Messages.strErrorProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest); } }); }; @@ -1771,7 +1771,7 @@ Functions.previewSql = function ($form) { */ Functions.confirmPreviewSql = function (sqlData, url, callback) { $('#previewSqlConfirmModal').modal('show'); - $('#previewSqlConfirmModalLabel').first().html(Messages.strPreviewSQL); + $('#previewSqlConfirmModalLabel').first().html(window.Messages.strPreviewSQL); $('#previewSqlConfirmCode').first().text(sqlData); $('#previewSqlConfirmModal').on('shown.bs.modal', function () { Functions.highlightSql($('#previewSqlConfirmModal')); @@ -1875,9 +1875,9 @@ Functions.dismissNotifications = () => function () { event.preventDefault(); var res = Functions.copyToClipboard($(this).attr('data-text')); if (res) { - $(this).after('<span id=\'copyStatus\'> (' + Messages.strCopyQueryButtonSuccess + ')</span>'); + $(this).after('<span id=\'copyStatus\'> (' + window.Messages.strCopyQueryButtonSuccess + ')</span>'); } else { - $(this).after('<span id=\'copyStatus\'> (' + Messages.strCopyQueryButtonFailure + ')</span>'); + $(this).after('<span id=\'copyStatus\'> (' + window.Messages.strCopyQueryButtonFailure + ')</span>'); } setTimeout(function () { $('#copyStatus').remove(); @@ -2181,7 +2181,7 @@ Functions.confirm = function (question, url, callbackFn, openCallback) { return true; } } - if (Messages.strDoYouReally === '') { + if (window.Messages.strDoYouReally === '') { return true; } @@ -2278,7 +2278,7 @@ Functions.onloadCreateTableEvents = function () { if (Functions.checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) { Functions.prepareForAjaxRequest($form); if (Functions.checkReservedWordColumns($form)) { - Functions.ajaxShowMessage(Messages.strProcessingRequest); + Functions.ajaxShowMessage(window.Messages.strProcessingRequest); // User wants to submit the form $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { @@ -2368,7 +2368,7 @@ Functions.onloadCreateTableEvents = function () { */ var $form = $('form.create_table_form.ajax'); - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); Functions.prepareForAjaxRequest($form); // User wants to add more fields to the table @@ -2439,8 +2439,8 @@ Functions.onloadCreateTableEvents = function () { /** * Validates the password field in a form * - * @see Messages.strPasswordEmpty - * @see Messages.strPasswordNotSame + * @see window.Messages.strPasswordEmpty + * @see window.Messages.strPasswordNotSame * @param {object} $theForm The form to be validated * @return {boolean} */ @@ -2460,9 +2460,9 @@ Functions.checkPassword = function ($theForm) { var alertMessage = false; if ($password.val() === '') { - alertMessage = Messages.strPasswordEmpty; + alertMessage = window.Messages.strPasswordEmpty; } else if ($password.val() !== $passwordRepeat.val()) { - alertMessage = Messages.strPasswordNotSame; + alertMessage = window.Messages.strPasswordNotSame; } if (alertMessage) { @@ -2571,7 +2571,7 @@ Functions.onloadChangePasswordEvents = function () { */ var thisValue = $(this).val(); - var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); + var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest); $theForm.append('<input type="hidden" name="ajax_request" value="true">'); $.post($theForm.attr('action'), $theForm.serialize() + window.CommonParams.get('arg_separator') + 'change_pw=' + thisValue, function (data) { @@ -2767,9 +2767,9 @@ Functions.onloadEnumSetEditor = function () { var i; // And use it to make up a title for the page if (colname.length < 1) { - title = Messages.enum_newColumnVals; + title = window.Messages.enum_newColumnVals; } else { - title = Messages.enum_columnVals.replace( + title = window.Messages.enum_columnVals.replace( /%s/, '"' + Functions.escapeHtml(decodeURIComponent(colname)) + '"' ); @@ -2835,14 +2835,14 @@ Functions.onloadEnumSetEditor = function () { '<fieldset class="pma-fieldset">' + '<legend>' + title + '</legend>' + '<p>' + Functions.getImage('s_notice') + - Messages.enum_hint + '</p>' + + window.Messages.enum_hint + '</p>' + '<table class="table table-borderless values">' + fields + '</table>' + '</fieldset><fieldset class="pma-fieldset tblFooters">' + '<table class="table table-borderless add"><tr><td>' + '<div class=\'slider\'></div>' + '</td><td>' + '<form><div><input type=\'submit\' class=\'add_value btn btn-primary\' value=\'' + - Functions.sprintf(Messages.enum_addValue, 1) + + Functions.sprintf(window.Messages.enum_addValue, 1) + '\'></div></form>' + '</td></tr></table>' + '<input type=\'hidden\' value=\'' + // So we know which column's data is being edited @@ -2881,7 +2881,7 @@ Functions.onloadEnumSetEditor = function () { max: 9, slide: function (event, ui) { $(this).closest('table').find('input[type=submit]').val( - Functions.sprintf(Messages.enum_addValue, ui.value) + Functions.sprintf(window.Messages.enum_addValue, ui.value) ); } }); @@ -2938,20 +2938,20 @@ Functions.onloadEnumSetEditor = function () { '</div></td>'; if (pick) { fields += '<td><input class="btn btn-secondary pick w-100" type="submit" value="' + - Messages.pickColumn + '" onclick="Functions.autoPopulate(\'' + colid + '\',' + i + ')"></td>'; + window.Messages.pickColumn + '" onclick="Functions.autoPopulate(\'' + colid + '\',' + i + ')"></td>'; } fields += '</tr>'; } var resultPointer = i; - var searchIn = '<input type="text" class="filter_rows" placeholder="' + Messages.searchList + '">'; + var searchIn = '<input type="text" class="filter_rows" placeholder="' + window.Messages.searchList + '">'; if (fields === '') { - fields = Functions.sprintf(Messages.strEmptyCentralList, '\'' + Functions.escapeHtml(db) + '\''); + fields = Functions.sprintf(window.Messages.strEmptyCentralList, '\'' + Functions.escapeHtml(db) + '\''); searchIn = ''; } var seeMore = ''; if (listSize > maxRows) { seeMore = '<fieldset class="pma-fieldset tblFooters text-center fw-bold">' + - '<a href=\'#\' id=\'seeMore\'>' + Messages.seeMore + '</a></fieldset>'; + '<a href=\'#\' id=\'seeMore\'>' + window.Messages.seeMore + '</a></fieldset>'; } var centralColumnsDialog = '<div class=\'max_height_400\'>' + '<fieldset class="pma-fieldset">' + @@ -2973,7 +2973,7 @@ Functions.onloadEnumSetEditor = function () { minWidth: width, maxHeight: 450, modal: true, - title: Messages.pickColumnTitle, + title: window.Messages.pickColumnTitle, buttons: buttonOptions, open: function () { $('#col_list').on('click', '.pick', function () { @@ -3001,7 +3001,7 @@ Functions.onloadEnumSetEditor = function () { '</div></td>'; if (pick) { fields += '<td><input class="btn btn-secondary pick w-100" type="submit" value="' + - Messages.pickColumn + '" onclick="Functions.autoPopulate(\'' + colid + '\',' + i + ')"></td>'; + window.Messages.pickColumn + '" onclick="Functions.autoPopulate(\'' + colid + '\',' + i + ')"></td>'; } fields += '</tr>'; } @@ -3139,7 +3139,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca data: formData, success: response => { if (! response.success) { - modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + Messages.strErrorProcessingRequest + '</div>'; + modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + window.Messages.strErrorProcessingRequest + '</div>'; return; } @@ -3147,13 +3147,13 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca Functions.highlightSql($('#indexDialogPreviewModal')); }, error: () => { - modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + Messages.strErrorProcessingRequest + '</div>'; + modalBody.innerHTML = '<div class="alert alert-danger" role="alert">' + window.Messages.strErrorProcessingRequest + '</div>'; } }); }); indexDialogPreviewModal.addEventListener('hidden.bs.modal', () => { indexDialogPreviewModal.querySelector('.modal-body').innerHTML = '<div class="spinner-border" role="status">' + - '<span class="visually-hidden">' + Messages.strLoading + '</span></div>'; + '<span class="visually-hidden">' + window.Messages.strLoading + '</span></div>'; }); /** @@ -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('<br><br>'); // Add close and cancel links - $('#gis_data_editor').prepend('<a class="close_gis_editor" href="#">' + Messages.strClose + '</a>'); - $('<a class="cancel_gis_editor" href="#"> ' + Messages.strCancel + '</a>') + $('#gis_data_editor').prepend('<a class="close_gis_editor" href="#">' + window.Messages.strClose + '</a>'); + $('<a class="cancel_gis_editor" href="#"> ' + window.Messages.strCancel + '</a>') .insertAfter($('input[name=\'gis_data[save]\']')); // Remove the unnecessary text @@ -61,10 +61,10 @@ function prepareJSVersion () { */ function addDataPoint (pointNumber, prefix) { return '<br>' + - Functions.sprintf(Messages.strPointN, (pointNumber + 1)) + ': ' + - '<label for="x">' + Messages.strX + '</label>' + + Functions.sprintf(window.Messages.strPointN, (pointNumber + 1)) + ': ' + + '<label for="x">' + window.Messages.strX + '</label>' + '<input type="text" name="' + prefix + '[' + pointNumber + '][x]" value="">' + - '<label for="y">' + Messages.strY + '</label>' + + '<label for="y">' + window.Messages.strY + '</label>' + '<input type="text" name="' + prefix + '[' + pointNumber + '][y]" value="">'; } @@ -318,10 +318,10 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { var html = '<br>'; 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 += '<input type="hidden" name="' + prefix + '[' + noOfLines + '][no_of_points]" value="' + noOfPoints + '">'; @@ -329,7 +329,7 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { html += addDataPoint(i, (prefix + '[' + noOfLines + ']')); } html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfLines + '][add_point]" href="#">+ ' + - Messages.strAddPoint + '</a><br>'; + window.Messages.strAddPoint + '</a><br>'; $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) + ':<br>'; + var html = window.Messages.strPolygon + ' ' + (noOfPolygons + 1) + ':<br>'; html += '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][no_of_lines]" value="1">' + - '<br>' + Messages.strOuterRing + ':' + + '<br>' + window.Messages.strOuterRing + ':' + '<input type="hidden" name="' + prefix + '[' + noOfPolygons + '][0][no_of_points]" value="4">'; for (var i = 0; i < 4; i++) { html += addDataPoint(i, (prefix + '[' + noOfPolygons + '][0]')); } html += '<a class="addPoint addJs" name="' + prefix + '[' + noOfPolygons + '][0][add_point]" href="#">+ ' + - Messages.strAddPoint + '</a><br>' + + window.Messages.strAddPoint + '</a><br>' + '<a class="addLine addJs" name="' + prefix + '[' + noOfPolygons + '][add_line]" href="#">+ ' + - Messages.strAddInnerRing + '</a><br><br>'; + window.Messages.strAddInnerRing + '</a><br><br>'; $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) + ':<br>'; + var html1 = window.Messages.strGeometry + ' ' + (noOfGeoms + 1) + ':<br>'; var $geomType = $('select[name=\'gis_data[' + (noOfGeoms - 1) + '][gis_type]\']').clone(); $geomType.attr('name', 'gis_data[' + noOfGeoms + '][gis_type]').val('POINT'); - var html2 = '<br>' + Messages.strPoint + ' :' + - '<label for="x"> ' + Messages.strX + ' </label>' + + var html2 = '<br>' + window.Messages.strPoint + ' :' + + '<label for="x"> ' + window.Messages.strX + ' </label>' + '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][x]" value="">' + - '<label for="y"> ' + Messages.strY + ' </label>' + + '<label for="y"> ' + window.Messages.strY + ' </label>' + '<input type="text" name="gis_data[' + noOfGeoms + '][POINT][y]" value="">' + '<br><br>'; 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 = '<div class="alert alert-info mb-0 mt-3" role="alert">' + Messages.strImportCSV + '</div>'; + importNotification.innerHTML = '<div class="alert alert-info mb-0 mt-3" role="alert">' + window.Messages.strImportCSV + '</div>'; } } @@ -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 = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + Messages.strImportDialogMessage + '</div>'; - var wrongTblNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + Messages.strTableNameDialogMessage + '</div>'; - var wrongDBNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + Messages.strDBNameDialogMessage + '</div>'; + var fileMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strImportDialogMessage + '</div>'; + var wrongTblNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strTableNameDialogMessage + '</div>'; + var wrongDBNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strDBNameDialogMessage + '</div>'; 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('<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + Messages.strNoImportFile + ' </div>', false); + Functions.ajaxShowMessage('<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strNoImportFile + ' </div>', 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 = $( '<ul id="composite_index_list">' + - '<div>' + Messages.strCompositeWith + '</div>' + + '<div>' + window.Messages.strCompositeWith + '</div>' + '</ul>' ); @@ -318,7 +318,7 @@ var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) { } else { Functions.ajaxShowMessage( '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt=""' + - ' class="icon ic_s_error"> ' + Messages.strMissingColumn + + ' class="icon ic_s_error"> ' + window.Messages.strMissingColumn + ' </div>', 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( '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt=""' + - ' class="icon ic_s_error"> ' + Messages.strMissingColumn + + ' class="icon ic_s_error"> ' + window.Messages.strMissingColumn + ' </div>', false ); @@ -468,10 +468,10 @@ var removeIndexOnChangeEvent = function () { Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex) { var $singleColumnRadio = $('<input type="radio" id="single_column" name="index_choice"' + ' checked="checked">' + - '<label for="single_column">' + Messages.strCreateSingleColumnIndex + '</label>'); + '<label for="single_column">' + window.Messages.strCreateSingleColumnIndex + '</label>'); var $compositeIndexRadio = $('<input type="radio" id="composite_index"' + ' name="index_choice">' + - '<label for="composite_index">' + Messages.strCreateCompositeIndex + '</label>'); + '<label for="composite_index">' + window.Messages.strCreateCompositeIndex + '</label>'); var $dialogContent = $('<fieldset class="pma-fieldset" id="advance_index_creator"></fieldset>'); $dialogContent.append('<legend>' + indexChoice.toUpperCase() + '</legend>'); @@ -496,7 +496,7 @@ Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex) Functions.ajaxShowMessage( '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title=""' + ' alt="" class="icon ic_s_error"> ' + - Messages.strFormEmpty + + window.Messages.strFormEmpty + ' </div>', 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 = '<div class="alert alert-danger" role="alert">' + Messages.strEnterValidHex + '</div>'; + var hexError = '<div class="alert alert-danger" role="alert">' + window.Messages.strEnterValidHex + '</div>'; 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 '<span title="' + Messages.strOriginalLength + ' ' + + return '<span title="' + window.Messages.strOriginalLength + ' ' + $(this).data('originallength') + '"></span>'; }); @@ -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 = { $('<div class="message welcome">') .text( Functions.sprintf( - Messages.strConsoleDebugArgsSummary, + window.Messages.strConsoleDebugArgsSummary, dbgStep.args.length ) ) @@ -1268,12 +1268,12 @@ var ConsoleDebug = { $('<div class="action_content">') .append( '<span class="action dbg_show_args">' + - Messages.strConsoleDebugShowArgs + + window.Messages.strConsoleDebugShowArgs + '</span> ' ) .append( '<span class="action dbg_hide_args">' + - Messages.strConsoleDebugHideArgs + + window.Messages.strConsoleDebugHideArgs + '</span> ' ) ); @@ -1341,7 +1341,7 @@ var ConsoleDebug = { .text((parseInt(i) + 1) + '.') .append( $('<span class="time">').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( $('<span class="debug_summary">').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) { $('<input>') .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 () { $('<input>') .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( - '<h3>' + Functions.sprintf(Messages.strFinishMsg, Functions.escapeHtml(window.CommonParams.get('table'))) + '</h3>' + '<h3>' + Functions.sprintf(window.Messages.strFinishMsg, Functions.escapeHtml(window.CommonParams.get('table'))) + '</h3>' ); $('#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 = '<div class="dependencies_box">'; var pdFound = false; for (var dependson in pd) { @@ -310,7 +310,7 @@ function goTo2NFStep2 (pd, primaryKey) { } } if (!pdFound) { - extra += '<p class="d-block m-1">' + Messages.strNoPdSelected + '</p>'; + extra += '<p class="d-block m-1">' + window.Messages.strNoPdSelected + '</p>'; extra += '</div>'; } else { extra += '</div>'; @@ -336,7 +336,7 @@ function goTo2NFStep2 (pd, primaryKey) { }); } $('#mainContent #extra').html(extra); - $('.tblFooters').html('<input type="button" class="btn btn-primary" value="' + Messages.strBack + '" id="backEditPd"><input type="button" class="btn btn-primary" id="goTo2NFFinish" value="' + Messages.strGo + '">'); + $('.tblFooters').html('<input type="button" class="btn btn-primary" value="' + window.Messages.strBack + '" id="backEditPd"><input type="button" class="btn btn-primary" id="goTo2NFFinish" value="' + window.Messages.strGo + '">'); $('#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 = '<div class="dependencies_box">'; var pdFound = false; for (var table in tablesTds) { @@ -359,7 +359,7 @@ function goTo3NFStep2 (pd, tablesTds) { } } if (!pdFound) { - extra += '<p class="d-block m-1">' + Messages.strNoTdSelected + '</p>'; + extra += '<p class="d-block m-1">' + window.Messages.strNoTdSelected + '</p>'; extra += '</div>'; } else { extra += '</div>'; @@ -386,7 +386,7 @@ function goTo3NFStep2 (pd, tablesTds) { }); } $('#mainContent #extra').html(extra); - $('.tblFooters').html('<input type="button" class="btn btn-primary" value="' + Messages.strBack + '" id="backEditPd"><input type="button" class="btn btn-primary" id="goTo3NFFinish" value="' + Messages.strGo + '">'); + $('.tblFooters').html('<input type="button" class="btn btn-primary" value="' + window.Messages.strBack + '" id="backEditPd"><input type="button" class="btn btn-primary" id="goTo3NFFinish" value="' + window.Messages.strGo + '">'); $('#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 += '<input type="text" name="repeatGroupTable" placeholder="' + Messages.strNewTablePlaceholder + '">' + - '( ' + Functions.escapeHtml(primaryKey.toString()) + ', <input type="text" name="repeatGroupColumn" placeholder="' + Messages.strNewColumnPlaceholder + '" value="' + Functions.escapeHtml(newColName) + '">)' + + var confirmStr = Functions.sprintf(window.Messages.strMoveRepeatingGroup, Functions.escapeHtml(repeatingCols), Functions.escapeHtml(window.CommonParams.get('table'))); + confirmStr += '<input type="text" name="repeatGroupTable" placeholder="' + window.Messages.strNewTablePlaceholder + '">' + + '( ' + Functions.escapeHtml(primaryKey.toString()) + ', <input type="text" name="repeatGroupColumn" placeholder="' + window.Messages.strNewColumnPlaceholder + '" value="' + Functions.escapeHtml(newColName) + '">)' + '</ol>'; $('#newCols').html(confirmStr); $('<input>') .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 () { $('<input>') .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('<div class="text-center">' + Messages.strLoading + '<br>' + Messages.strWaitForPd + '</div>'); + $('#newCols').html('<div class="text-center">' + window.Messages.strLoading + '<br>' + window.Messages.strWaitForPd + '</div>'); $.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( $('<div class="alert alert-warning" role="alert"></div>').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('<br>')); + var question = window.Messages.strDropDatabaseStrongWarning + ' ' + + Functions.sprintf(window.Messages.strDoYouReally, selectedDbs.join('<br>')); 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 = '<span class="text-nowrap">' + lockIcon + ' ' + Messages.strLock + '</span>'; - button.title = Messages.strLockAccount; + const lockIcon = Functions.getImage('s_lock', window.Messages.strLock, {}).toString(); + button.innerHTML = '<span class="text-nowrap">' + lockIcon + ' ' + window.Messages.strLock + '</span>'; + button.title = window.Messages.strLockAccount; button.dataset.isLocked = 'false'; } else { - const unlockIcon = Functions.getImage('s_unlock', Messages.strUnlock, {}).toString(); - button.innerHTML = '<span class="text-nowrap">' + unlockIcon + ' ' + Messages.strUnlock + '</span>'; - button.title = Messages.strUnlockAccount; + const unlockIcon = Functions.getImage('s_unlock', window.Messages.strUnlock, {}).toString(); + button.innerHTML = '<span class="text-nowrap">' + unlockIcon + ' ' + window.Messages.strUnlock + '</span>'; + 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('<i>' + Messages.strNone + '</i>'); + $('#seriesPreview').html('<i>' + window.Messages.strNone + '</i>'); 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 + ':<br><form>' + + $('#emptyDialog').dialog({ title: window.Messages.strImportDialogTitle }); + $('#emptyDialog').html(window.Messages.strImportDialogMessage + ':<br><form>' + '<input type="file" name="file" id="import_file"> </form>'); 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 = '<b>' + Messages.strCurrentSettings + '</b><br><div class="smallIndent">'; + str = '<b>' + window.Messages.strCurrentSettings + '</b><br><div class="smallIndent">'; str += icon + msg + '<br>'; if (logVars.log_output !== 'TABLE') { - str += Functions.getImage('s_error') + ' ' + Messages.strLogOutNotTable + '<br>'; + str += Functions.getImage('s_error') + ' ' + window.Messages.strLogOutNotTable + '<br>'; } else { - str += Functions.getImage('s_success') + ' ' + Messages.strLogOutIsTable + '<br>'; + str += Functions.getImage('s_success') + ' ' + window.Messages.strLogOutIsTable + '<br>'; } 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 += '<br>'; } 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 += '<br>'; } } @@ -803,9 +803,9 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { str += '</div>'; if (isSuperUser) { - str += '<p></p><b>' + Messages.strChangeSettings + '</b>'; + str += '<p></p><b>' + window.Messages.strChangeSettings + '</b>'; str += '<div class="smallIndent">'; - str += Messages.strSettingsAppliedGlobal + '<br>'; + str += window.Messages.strSettingsAppliedGlobal + '<br>'; var varValue = 'TABLE'; if (logVars.log_output === 'TABLE') { @@ -813,26 +813,26 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } str += '- <a class="set" href="#log_output-' + varValue + '">'; - str += Functions.sprintf(Messages.strSetLogOutput, varValue); + str += Functions.sprintf(window.Messages.strSetLogOutput, varValue); str += ' </a><br>'; if (logVars.general_log !== 'ON') { str += '- <a class="set" href="#general_log-ON">'; - str += Functions.sprintf(Messages.strEnableVar, 'general_log'); + str += Functions.sprintf(window.Messages.strEnableVar, 'general_log'); str += ' </a><br>'; } else { str += '- <a class="set" href="#general_log-OFF">'; - str += Functions.sprintf(Messages.strDisableVar, 'general_log'); + str += Functions.sprintf(window.Messages.strDisableVar, 'general_log'); str += ' </a><br>'; } if (logVars.slow_query_log !== 'ON') { str += '- <a class="set" href="#slow_query_log-ON">'; - str += Functions.sprintf(Messages.strEnableVar, 'slow_query_log'); + str += Functions.sprintf(window.Messages.strEnableVar, 'slow_query_log'); str += ' </a><br>'; } else { str += '- <a class="set" href="#slow_query_log-OFF">'; - str += Functions.sprintf(Messages.strDisableVar, 'slow_query_log'); + str += Functions.sprintf(window.Messages.strDisableVar, 'slow_query_log'); str += ' </a><br>'; } @@ -842,10 +842,10 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } str += '- <a class="set" href="#long_query_time-' + varValue + '">'; - str += Functions.sprintf(Messages.setSetLongQueryTime, varValue); + str += Functions.sprintf(window.Messages.setSetLongQueryTime, varValue); str += ' </a><br>'; } else { - str += Messages.strNoSuperUser + '<br>'; + str += window.Messages.strNoSuperUser + '<br>'; } str += '</div>'; @@ -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('<i>' + Messages.strNone + '</i>'); + $('#seriesPreview').html('<i>' + window.Messages.strNone + '</i>'); 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 + ' <img class="ajaxIcon" src="' + themeImagePath + 'ajax_clock_small.gif" alt="">'); 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('<p>' + Messages.strNoDataFound + '</p>'); + $('#emptyDialog').dialog({ title: window.Messages.strNoDataFoundTitle }); + $('#emptyDialog').html('<p>' + window.Messages.strNoDataFound + '</p>'); - 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('<p>' + Messages.strLogDataLoaded + '</p>'); + $('#emptyDialog').dialog({ title: window.Messages.strLoadingLogs }); + $('#emptyDialog').html('<p>' + window.Messages.strLogDataLoaded + '</p>'); $.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( '<fieldset class="pma-fieldset" id="logDataFilter">' + - ' <legend>' + Messages.strFiltersForLogTable + '</legend>' + + ' <legend>' + window.Messages.strFiltersForLogTable + '</legend>' + ' <div class="formelement">' + - ' <label for="filterQueryText">' + Messages.strFilterByWordRegexp + '</label>' + + ' <label for="filterQueryText">' + window.Messages.strFilterByWordRegexp + '</label>' + ' <input name="filterQueryText" type="text" id="filterQueryText">' + ' </div>' + - ((logData.numRows > 250) ? ' <div class="formelement"><button class="btn btn-secondary" name="startFilterQueryText" id="startFilterQueryText">' + Messages.strFilter + '</button></div>' : '') + + ((logData.numRows > 250) ? ' <div class="formelement"><button class="btn btn-secondary" name="startFilterQueryText" id="startFilterQueryText">' + window.Messages.strFilter + '</button></div>' : '') + ' <div class="formelement">' + ' <input type="checkbox" id="noWHEREData" name="noWHEREData" value="1"> ' + - ' <label for="noWHEREData"> ' + Messages.strIgnoreWhereAndGroup + '</label>' + + ' <label for="noWHEREData"> ' + window.Messages.strIgnoreWhereAndGroup + '</label>' + ' </div' + '</fieldset>' ); @@ -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('<th colspan="' + (runtime.logDataCols.length - 1) + '">' + - Messages.strSumRows + ' ' + rowSum + '<span class="float-end">' + - Messages.strTotal + '</span></th><th class="text-end">' + totalSum + '</th>'); + window.Messages.strSumRows + ' ' + rowSum + '<span class="float-end">' + + window.Messages.strTotal + '</span></th><th class="text-end">' + totalSum + '</th>'); } } @@ -1974,17 +1974,17 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { } $table.append('<tfoot>' + - '<tr><th colspan="' + (cols.length - 1) + '">' + Messages.strSumRows + - ' ' + data.numRows + '<span class="float-end">' + Messages.strTotal + + '<tr><th colspan="' + (cols.length - 1) + '">' + window.Messages.strSumRows + + ' ' + data.numRows + '<span class="float-end">' + window.Messages.strTotal + '</span></th><th class="text-end">' + data.sum.TOTAL + '</th></tr></tfoot>'); // 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 += '<p>' + Messages.strMoreCountColumnExplanation + '</p>'; + tooltipContent += '<p>' + window.Messages.strMoreCountColumnExplanation + '</p>'; } 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 + ' <img class="ajaxIcon" src="' + + window.Messages.strAnalyzing + ' <img class="ajaxIcon" src="' + themeImagePath + 'ajax_clock_small.gif" alt="">'); $.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('<div class="alert alert-danger" role="alert">' + data.error + '</div>'); return; @@ -2085,7 +2085,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { $('#queryAnalyzerDialog').find('div.placeHolder') .html('<table class="table table-borderless"><tr><td class="explain"></td><td class="chart"></td></tr></table>'); - var explain = '<b>' + Messages.strExplainOutput + '</b> ' + $('#explain_docu').html(); + var explain = '<b>' + window.Messages.strExplainOutput + '</b> ' + $('#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 += '</div>'; } - explain += '<p><b>' + Messages.strAffectedRows + '</b> ' + data.affectedRows; + explain += '<p><b>' + window.Messages.strAffectedRows + '</b> ' + 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 = '<table class="table table-sm table-striped table-hover w-auto queryNums"><thead><tr><th>' + Messages.strStatus + '</th><th>' + Messages.strTime + '</th></tr></thead><tbody>'; + var numberTable = '<table class="table table-sm table-striped table-hover w-auto queryNums"><thead><tr><th>' + window.Messages.strStatus + '</th><th>' + window.Messages.strTime + '</th></tr></thead><tbody>'; 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 += '<tr><td><b>' + Messages.strTotalTime + '</b></td><td>' + Functions.prettyProfilingNum(totalTime, 2) + '</td></tr>'; + numberTable += '<tr><td><b>' + window.Messages.strTotalTime + '</b></td><td>' + Functions.prettyProfilingNum(totalTime, 2) + '</td></tr>'; numberTable += '</tbody></table>'; $('#queryAnalyzerDialog').find('div.placeHolder td.chart').append( - '<b>' + Messages.strProfilingResults + ' ' + $('#profiling_docu').html() + '</b> ' + - '(<a href="#showNums">' + Messages.strTable + '</a>, <a href="#showChart">' + Messages.strChart + '</a>)<br>' + + '<b>' + window.Messages.strProfilingResults + ' ' + $('#profiling_docu').html() + '</b> ' + + '(<a href="#showNums">' + window.Messages.strTable + '</a>, <a href="#showChart">' + window.Messages.strChart + '</a>)<br>' + numberTable + ' <div id="queryProfiling"></div>'); $('#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( '<input type="button" id="simulate_dml"' + - 'tabindex="199" class="btn btn-primary" value="' + Messages.strSimulateDML + '">' + '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 + ' <img class="ajaxIcon" src="' + themeImagePath + 'ajax_clock_small.gif" alt="">'); 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')) { $('<button class="btn btn-secondary" id="togglequerybox"></button>') - .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('<br id="togglequerybox_spacer">'); } 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($('<div class="mb-3">')); - $varDiv.append($('<label for="bookmarkVariable' + i + '">' + Functions.sprintf(Messages.strBookmarkVariable, i) + '</label>')); + $varDiv.append($('<label for="bookmarkVariable' + i + '">' + Functions.sprintf(window.Messages.strBookmarkVariable, i) + '</label>')); $varDiv.append($('<input class="form-control" type="text" size="10" name="bookmark_variable[' + i + ']" id="bookmarkVariable' + i + '">')); $varDiv.append($('</div>')); } @@ -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 += '<strong>' + Messages.strSQLQuery + + dialogContent += '<strong>' + window.Messages.strSQLQuery + '</strong>' + response.sql_data[i].sql_query + - Messages.strMatchedRows + + window.Messages.strMatchedRows + ' <a href="' + response.sql_data[i].matched_rows_url + '">' + response.sql_data[i].matched_rows + '</a><br>'; 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 = $('<div>').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 = '<br><input type=text name=salt[multi_edit][' + multiEdit + '][' + urlField + ']' + - ' id=salt_' + target.id + ' placeholder=\'' + Messages.strEncryptionKey + '\'>'; + ' 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 = '<br><p id="note' + target.id + '">' + Messages.HexConversionInfo + '</p>'; + var newHexInfo = '<br><p id="note' + target.id + '">' + window.Messages.HexConversionInfo + '</p>'; if (!$('#note' + target.id).length) { $thisInput.after(newHexInfo); } @@ -773,7 +773,7 @@ function addNewContinueInsertionFields (event) { if (currRows === 1) { $('<input id="insert_ignore_1" type="checkbox" name="insert_ignore_1" checked="checked">') .insertBefore($('table.insertRowTable').last()) - .after('<label for="insert_ignore_1">' + Messages.strIgnore + '</label>'); + .after('<label for="insert_ignore_1">' + window.Messages.strIgnore + '</label>'); } 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 }} <script type="text/javascript"> - {{ get_js_value("Messages.strSavedOn", 'Saved on: @DATE@'|trans) }} + {{ get_js_value("window.Messages.strSavedOn", 'Saved on: @DATE@'|trans) }} </script> <div class="row"> <div id="maincontainer" class="container-fluid"> 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 + \')\'', ' : \'\';', |