diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-06-22 21:04:03 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-06-22 21:04:03 +0300 |
commit | 7403cffab41b7deff6f755d2312e2a81356fec0d (patch) | |
tree | 49b4af9c25654069fb23a0ef3c9c9354fdf77b08 | |
parent | 3b99d77d5e281081bc793568f00dc75ba34f8562 (diff) |
Assign CommonParams and CommonActions to the window object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
40 files changed, 345 insertions, 348 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index ef2476ca38..f7e634c01a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,8 +17,6 @@ "globals": { "bootstrap": "readonly", "CodeMirror": "readonly", - "CommonActions": "readonly", - "CommonParams": "readonly", "Cookies": "readonly", "Functions": "readonly", "Messages": "readonly", diff --git a/js/src/ajax.js b/js/src/ajax.js index aad74855eb..35cb626f02 100644 --- a/js/src/ajax.js +++ b/js/src/ajax.js @@ -24,7 +24,7 @@ window.AJAX = { // eslint-disable-next-line valid-jsdoc /** * @var {Function} callback Callback to execute after a successful request - * Used by CommonActions from common.js + * Used by window.CommonActions from common.js */ callback: function () {}, /** @@ -296,7 +296,7 @@ window.AJAX = { $('html, body').animate({ scrollTop: 0 }, 'fast'); var url = isLink ? href : $(this).attr('action'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var params = 'ajax_request=true' + argsep + 'ajax_page_request=true'; var dataPost = window.AJAX.source.getPostData(); if (! isLink) { @@ -362,7 +362,7 @@ window.AJAX = { } Functions.ajaxRemoveMessage(window.AJAX.$msgbox); - CommonParams.set('token', data.new_token); + window.CommonParams.set('token', data.new_token); window.AJAX.scriptHandler.load([]); @@ -417,7 +417,7 @@ window.AJAX = { if (typeof data.success !== 'undefined' && data.success) { // reload page if user trying to login has changed - if (CommonParams.get('user') !== data.params.user) { + if (window.CommonParams.get('user') !== data.params.user) { window.location = 'index.php'; Functions.ajaxShowMessage(Messages.strLoading, false); window.AJAX.active = false; @@ -544,7 +544,7 @@ window.AJAX = { $('#selflink').find('> a').attr('href', data.selflink); } if (data.params) { - CommonParams.setAll(data.params); + window.CommonParams.setAll(data.params); } if (data.scripts) { window.AJAX.scriptHandler.load(data.scripts); @@ -677,10 +677,10 @@ window.AJAX = { // Clear loaded scripts if they are from another version of phpMyAdmin. // Depends on common params being set before loading scripts in responseHandler if (self.scriptsVersion === null) { - self.scriptsVersion = CommonParams.get('version'); - } else if (self.scriptsVersion !== CommonParams.get('version')) { + self.scriptsVersion = window.CommonParams.get('version'); + } else if (self.scriptsVersion !== window.CommonParams.get('version')) { self.scripts = []; - self.scriptsVersion = CommonParams.get('version'); + self.scriptsVersion = window.CommonParams.get('version'); } self.scriptsCompleted = false; self.scriptsToBeFired = []; @@ -747,7 +747,7 @@ window.AJAX = { script.type = 'text/javascript'; var file = name.indexOf('vendor/') !== -1 ? name : 'dist/' + name; - script.src = 'js/' + file + '?' + 'v=' + encodeURIComponent(CommonParams.get('version')); + script.src = 'js/' + file + '?' + 'v=' + encodeURIComponent(window.CommonParams.get('version')); script.async = false; script.onload = function () { self.done(name, callback); @@ -870,7 +870,7 @@ $(function () { var state = event.originalEvent.state; if (state && state.menu) { window.AJAX.$msgbox = Functions.ajaxShowMessage(); - var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true'; + var params = 'ajax_request=true' + window.CommonParams.get('arg_separator') + 'ajax_page_request=true'; var url = state.url || location.href; $.get(url, params, window.AJAX.responseHandler); // TODO: Check if sometimes menu is not retrieved from server, diff --git a/js/src/codemirror/addon/lint/sql-lint.js b/js/src/codemirror/addon/lint/sql-lint.js index 542a979bda..673d5aac34 100644 --- a/js/src/codemirror/addon/lint/sql-lint.js +++ b/js/src/codemirror/addon/lint/sql-lint.js @@ -31,7 +31,7 @@ CodeMirror.sqlLint = function (text, updateLinting, options, cm) { dataType: 'json', data: { 'sql_query': text, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'options': options.lintOptions, 'no_history': true, }, diff --git a/js/src/common.js b/js/src/common.js index 233e8284d7..4cccc26138 100644 --- a/js/src/common.js +++ b/js/src/common.js @@ -11,7 +11,7 @@ $(function () { * * @test-module CommonParams */ -var CommonParams = (function () { +window.CommonParams = (function () { /** * @var {Object} params An associative array of key value pairs * @access private @@ -87,7 +87,7 @@ var CommonParams = (function () { getUrlQuery: function (separator) { var sep = (typeof separator !== 'undefined') ? separator : '?'; var common = this.get('common_query'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); if (typeof common === 'string' && common.length > 0) { // If the last char is the separator, do not add it // Else add it @@ -112,8 +112,7 @@ var CommonParams = (function () { * The content for this is normally loaded from Header.php or * Response.php and executed by ajax.js */ -// eslint-disable-next-line no-unused-vars -var CommonActions = { +window.CommonActions = { /** * Saves the database name when it's changed * and reloads the query window, if necessary @@ -123,8 +122,8 @@ var CommonActions = { * @return {void} */ setDb: function (newDb) { - if (newDb !== CommonParams.get('db')) { - CommonParams.setAll({ 'db': newDb, 'table': '' }); + if (newDb !== window.CommonParams.get('db')) { + window.CommonParams.setAll({ 'db': newDb, 'table': '' }); } }, /** @@ -135,11 +134,11 @@ var CommonActions = { * @return {void} */ openDb: function (newDb) { - CommonParams + window.CommonParams .set('db', newDb) .set('table', ''); this.refreshMain( - CommonParams.get('opendb_url') + window.CommonParams.get('opendb_url') ); }, /** @@ -158,9 +157,9 @@ var CommonActions = { newUrl = newUrl.substring(0, newUrl.indexOf('?')); } if (newUrl.indexOf('?') !== -1) { - newUrl += CommonParams.getUrlQuery(CommonParams.get('arg_separator')); + newUrl += window.CommonParams.getUrlQuery(window.CommonParams.get('arg_separator')); } else { - newUrl += CommonParams.getUrlQuery('?'); + newUrl += window.CommonParams.getUrlQuery('?'); } $('<a></a>', { href: newUrl }) .appendTo('body') diff --git a/js/src/config.js b/js/src/config.js index a1e3ff6940..49d05a913e 100644 --- a/js/src/config.js +++ b/js/src/config.js @@ -769,7 +769,7 @@ function savePrefsToLocalStorage (form) { type: 'POST', data: { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'submit_get_json': true }, success: function (data) { @@ -821,7 +821,7 @@ function offerPrefsAutoimport () { if ($a.attr('href') === '#no') { $cnt.remove(); $.post('index.php', { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'prefs_autoload': 'hide' }, null, 'html'); return; @@ -829,7 +829,7 @@ function offerPrefsAutoimport () { $cnt.remove(); localStorage.clear(); $.post('index.php', { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'prefs_autoload': 'hide' }, null, 'html'); return; diff --git a/js/src/database/central_columns.js b/js/src/database/central_columns.js index f9551e93cc..b5e2bae98d 100644 --- a/js/src/database/central_columns.js +++ b/js/src/database/central_columns.js @@ -63,8 +63,8 @@ window.AJAX.registerOnload('database/central_columns.js', function () { Functions.ajaxShowMessage(Messages.strRadioUnchecked); return false; } - var argsep = CommonParams.get('arg_separator'); - var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server'); + var argsep = window.CommonParams.get('arg_separator'); + var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(window.CommonParams.get('db')) + argsep + 'server=' + window.CommonParams.get('server'); Functions.ajaxShowMessage(); window.AJAX.source = $(this); $.post('index.php?route=/database/central-columns', editColumnData, window.AJAX.responseHandler); @@ -72,8 +72,8 @@ window.AJAX.registerOnload('database/central_columns.js', function () { $('#multi_edit_central_columns').on('submit', function (event) { event.preventDefault(); event.stopPropagation(); - var argsep = CommonParams.get('arg_separator'); - var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server'); + var argsep = window.CommonParams.get('arg_separator'); + var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(window.CommonParams.get('db')) + argsep + 'server=' + window.CommonParams.get('server'); Functions.ajaxShowMessage(); window.AJAX.source = $(this); $.post('index.php?route=/database/central-columns', multiColumnEditData, window.AJAX.responseHandler); @@ -153,7 +153,7 @@ window.AJAX.registerOnload('database/central_columns.js', function () { $.ajax({ type: 'POST', url: 'index.php?route=/database/central-columns', - data: datastring + CommonParams.get('arg_separator') + 'ajax_request=true', + data: datastring + window.CommonParams.get('arg_separator') + 'ajax_request=true', dataType: 'json', success: function (data) { if (data.message !== '1') { @@ -196,8 +196,8 @@ window.AJAX.registerOnload('database/central_columns.js', function () { var href = 'index.php?route=/database/central-columns/populate'; var params = { 'ajax_request' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), 'selectedTable' : selectValue }; $('#column-select').html('<option value="">' + Messages.strLoading + '</option>'); diff --git a/js/src/database/multi_table_query.js b/js/src/database/multi_table_query.js index c8e3088418..de2ef3c0e6 100644 --- a/js/src/database/multi_table_query.js +++ b/js/src/database/multi_table_query.js @@ -75,7 +75,7 @@ window.AJAX.registerOnload('database/multi_table_query.js', function () { 'db': $('#db_name').val(), 'tables': Object.keys(tableAliases), 'ajax_request': '1', - 'token': CommonParams.get('token') + 'token': window.CommonParams.get('token') }, success: function (response) { foreignKeys = response.foreignKeyConstrains; @@ -127,8 +127,8 @@ window.AJAX.registerOnload('database/multi_table_query.js', function () { 'db': $('#db_name').val(), 'sql_query': query, 'ajax_request': '1', - 'server': CommonParams.get('server'), - 'token': CommonParams.get('token') + 'server': window.CommonParams.get('server'), + 'token': window.CommonParams.get('token') }; $.ajax({ type: 'POST', diff --git a/js/src/database/operations.js b/js/src/database/operations.js index 43b1f56205..0c323711f2 100644 --- a/js/src/database/operations.js +++ b/js/src/database/operations.js @@ -40,7 +40,7 @@ window.AJAX.registerOnload('database/operations.js', function () { return false; } - var oldDbName = CommonParams.get('db'); + var oldDbName = window.CommonParams.get('db'); var newDbName = $('#new_db_name').val(); if (newDbName === oldDbName) { @@ -56,10 +56,10 @@ window.AJAX.registerOnload('database/operations.js', function () { $form.confirm(question, $form.attr('action'), function (url) { Functions.ajaxShowMessage(Messages.strRenamingDatabases, false); - $.post(url, $('#rename_db_form').serialize() + CommonParams.get('arg_separator') + 'is_js_confirmed=1', function (data) { + $.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); - CommonParams.set('db', data.newname); + window.CommonParams.set('db', data.newname); Navigation.reload(function () { $('#pma_navigation_tree') @@ -99,12 +99,12 @@ window.AJAX.registerOnload('database/operations.js', function () { $('.alert-success, .alert-danger').fadeOut(); if (typeof data !== 'undefined' && data.success === true) { if ($('#checkbox_switch').is(':checked')) { - CommonParams.set('db', data.newname); - CommonActions.refreshMain(false, function () { + window.CommonParams.set('db', data.newname); + window.CommonActions.refreshMain(false, function () { Functions.ajaxShowMessage(data.message); }); } else { - CommonParams.set('db', data.db); + window.CommonParams.set('db', data.db); Functions.ajaxShowMessage(data.message); } Navigation.reload(); @@ -151,7 +151,7 @@ window.AJAX.registerOnload('database/operations.js', function () { var question = Messages.strDropDatabaseStrongWarning + ' '; question += Functions.sprintf( Messages.strDoYouReally, - 'DROP DATABASE `' + Functions.escapeHtml(CommonParams.get('db') + '`') + 'DROP DATABASE `' + Functions.escapeHtml(window.CommonParams.get('db') + '`') ); var params = Functions.getJsConfirmCommonParam(this, $link.getPostData()); @@ -161,8 +161,8 @@ window.AJAX.registerOnload('database/operations.js', function () { if (typeof data !== 'undefined' && data.success) { // Database deleted successfully, refresh both the frames Navigation.reload(); - CommonParams.set('db', ''); - CommonActions.refreshMain( + window.CommonParams.set('db', ''); + window.CommonActions.refreshMain( 'index.php?route=/server/databases', function () { Functions.ajaxShowMessage(data.message); diff --git a/js/src/database/search.js b/js/src/database/search.js index d47a8bd960..e23e291f91 100644 --- a/js/src/database/search.js +++ b/js/src/database/search.js @@ -216,7 +216,7 @@ window.AJAX.registerOnload('database/search.js', function () { Functions.prepareForAjaxRequest($form); - var url = $form.serialize() + CommonParams.get('arg_separator') + 'submit_search=' + $('#buttonGo').val(); + var url = $form.serialize() + window.CommonParams.get('arg_separator') + 'submit_search=' + $('#buttonGo').val(); $.post($form.attr('action'), url, function (data) { if (typeof data !== 'undefined' && data.success === true) { // found results diff --git a/js/src/database/structure.js b/js/src/database/structure.js index b060888a69..2634f32db7 100644 --- a/js/src/database/structure.js +++ b/js/src/database/structure.js @@ -198,7 +198,7 @@ window.AJAX.registerOnload('database/structure.js', function () { $('#makeConsistentWithCentralListModal').modal('show').on('shown.bs.modal', function () { $('#makeConsistentWithCentralListContinue').on('click', function () { const $form = $('#tablesForm'); - const argSep = CommonParams.get('arg_separator'); + const argSep = window.CommonParams.get('arg_separator'); const data = $form.serialize() + argSep + 'ajax_request=true' + argSep + 'ajax_page_request=true'; Functions.ajaxShowMessage(); @@ -293,7 +293,7 @@ window.AJAX.registerOnload('database/structure.js', function () { } var $form = $(this).parents('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; Functions.ajaxShowMessage(); diff --git a/js/src/database/tracking.js b/js/src/database/tracking.js index 8db279d6c9..e1a75bef81 100644 --- a/js/src/database/tracking.js +++ b/js/src/database/tracking.js @@ -43,7 +43,7 @@ window.AJAX.registerOnload('database/tracking.js', function () { e.preventDefault(); var $button = $(this); var $form = $button.parent('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val(); if ($button.val() === 'delete_tracking') { @@ -67,7 +67,7 @@ window.AJAX.registerOnload('database/tracking.js', function () { e.preventDefault(); var $button = $(this); var $form = $button.parent('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val(); Functions.ajaxShowMessage(); window.AJAX.source = $form; @@ -84,7 +84,7 @@ window.AJAX.registerOnload('database/tracking.js', function () { $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(Messages.strDeletingTrackingData); window.AJAX.source = $anchor; - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); params += argSep + 'ajax_page_request=1'; $.post(url, params, window.AJAX.responseHandler); diff --git a/js/src/designer/move.js b/js/src/designer/move.js index b8954cef33..062e181f48 100644 --- a/js/src/designer/move.js +++ b/js/src/designer/move.js @@ -652,7 +652,7 @@ DesignerMove.addOtherDbTables = function () { $.post('index.php?route=/sql', { 'ajax_request' : true, 'sql_query' : 'SHOW databases;', - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { $(data.message).find('table.table_results.data.ajax').find('td.data').each(function () { var val = $(this)[0].innerText; @@ -683,7 +683,7 @@ DesignerMove.addOtherDbTables = function () { 'dialog' : 'add_table', 'db' : db, 'table' : table, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { var $newTableDom = $(data.message); $newTableDom.find('a').first().remove(); @@ -709,7 +709,7 @@ DesignerMove.addOtherDbTables = function () { 'ajax_request' : true, 'sql_query': sqlQuery, 'db' : dbName, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { $selectTable.html(''); var rows = $(data.message).find('table.table_results.data.ajax').find('td.data'); @@ -749,7 +749,7 @@ DesignerMove.getUrlPos = function (forceString) { var key; if (designerTablesEnabled || forceString) { var poststr = ''; - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var i = 1; for (key in jTabs) { poststr += argsep + 't_x[' + i + ']=' + parseInt(document.getElementById(key).style.left, 10); @@ -780,7 +780,7 @@ DesignerMove.getUrlPos = function (forceString) { DesignerMove.save2 = function (callback) { if (designerTablesEnabled) { - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var poststr = 'operation=savePage' + argsep + 'save_page=same' + argsep + 'ajax_request=true'; poststr += argsep + 'server=' + server + argsep + 'db=' + encodeURIComponent(db) + argsep + 'selected_page=' + selectedPage; poststr += DesignerMove.getUrlPos(); @@ -1086,7 +1086,7 @@ DesignerMove.promptToSaveCurrentPage = function (callback) { // ------------------------------ EXPORT PAGES --------------------------------------- DesignerMove.exportPages = function () { var $msgbox = Functions.ajaxShowMessage(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post('index.php?route=/database/designer', { 'ajax_request': true, @@ -1130,7 +1130,7 @@ DesignerMove.exportPages = function () { DesignerMove.loadPage = function (page) { if (designerTablesEnabled) { var paramPage = ''; - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); if (page !== null) { paramPage = argsep + 'page=' + page; } @@ -1218,7 +1218,7 @@ DesignerMove.startRelation = function () { // table field DesignerMove.clickField = function (db, T, f, pk) { var pkLocal = parseInt(pk); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); if (onRelation) { if (!clickField) { // .style.display=='none' .style.display = 'none' @@ -1304,7 +1304,7 @@ DesignerMove.clickField = function (db, T, f, pk) { DesignerMove.newRelation = function () { document.getElementById('layer_new_relation').style.display = 'none'; - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); linkRelation += argsep + 'server=' + server + argsep + 'db=' + db + argsep + 'db2=p'; 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'; @@ -1323,14 +1323,14 @@ DesignerMove.newRelation = function () { // -------------------------- create tables ------------------------------------- DesignerMove.startTableNew = function () { - CommonParams.set('table', ''); - CommonActions.refreshMain('index.php?route=/table/create'); + window.CommonParams.set('table', ''); + window.CommonActions.refreshMain('index.php?route=/table/create'); }; DesignerMove.startTabUpd = function (db, table) { - CommonParams.set('db', db); - CommonParams.set('table', table); - CommonActions.refreshMain('index.php?route=/table/structure'); + window.CommonParams.set('db', db); + window.CommonParams.set('table', table); + window.CommonActions.refreshMain('index.php?route=/table/structure'); }; // --------------------------- hide tables -------------------------------------- @@ -1524,14 +1524,14 @@ DesignerMove.canvasClick = function (id, event) { var top = globY - document.getElementById('layer_upd_relation').offsetHeight - 10; document.getElementById('layer_upd_relation').style.top = top + 'px'; document.getElementById('layer_upd_relation').style.display = 'block'; - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); linkRelation = 'T1=' + Key0 + argsep + 'F1=' + Key1 + argsep + 'T2=' + Key2 + argsep + 'F2=' + Key3 + argsep + 'K=' + Key; } }; DesignerMove.updRelation = function () { document.getElementById('layer_upd_relation').style.display = 'none'; - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); linkRelation += argsep + 'server=' + server + argsep + 'db=' + db; linkRelation += argsep + 'operation=removeRelation' + argsep + 'ajax_request=true'; diff --git a/js/src/drag_drop_import.js b/js/src/drag_drop_import.js index 004b4fb560..6e5ad6d841 100644 --- a/js/src/drag_drop_import.js +++ b/js/src/drag_drop_import.js @@ -156,7 +156,7 @@ var DragDropImport = { if (!DragDropImport.hasFiles(event)) { return; } - if (CommonParams.get('db') === '') { + if (window.CommonParams.get('db') === '') { $('.pma_drop_handler').html(Messages.dropImportSelectDB); } else { $('.pma_drop_handler').html(Messages.dropImportDropFiles); @@ -278,8 +278,8 @@ var DragDropImport = { return; } - var dbname = CommonParams.get('db'); - var server = CommonParams.get('server'); + var dbname = window.CommonParams.get('db'); + var server = window.CommonParams.get('server'); // if no database is selected -- no if (dbname !== '') { @@ -322,7 +322,7 @@ var DragDropImport = { fd.append('noplugin', Math.random().toString(36).substring(2, 12)); fd.append('db', dbname); fd.append('server', server); - fd.append('token', CommonParams.get('token')); + fd.append('token', window.CommonParams.get('token')); fd.append('import_type', 'database'); // todo: method to find the value below fd.append('MAX_FILE_SIZE', '4194304'); diff --git a/js/src/error_report.js b/js/src/error_report.js index b515dace17..d8043b3de7 100644 --- a/js/src/error_report.js +++ b/js/src/error_report.js @@ -60,7 +60,7 @@ var ErrorReport = { if (ErrorReport.errorReportData === null) { $.post('index.php?route=/error-report', { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'get_settings': true, 'exception_type': 'js' }, function (data) { @@ -137,7 +137,7 @@ var ErrorReport = { buttonHtml += Messages.strShowReportDetails; buttonHtml += '</button>'; - var settingsUrl = 'index.php?route=/preferences/features&server=' + CommonParams.get('server'); + 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 += '</a>'; @@ -218,7 +218,7 @@ var ErrorReport = { } } var reportData = { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'ajax_request': true, 'exception': exception, 'url': window.location.href, diff --git a/js/src/export.js b/js/src/export.js index 89e4d80142..0ac8ca8367 100644 --- a/js/src/export.js +++ b/js/src/export.js @@ -74,9 +74,9 @@ Export.createTemplate = function (name) { var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), 'exportType': $('input[name="export_type"]').val(), 'templateName': name, 'templateData': JSON.stringify(templateData) @@ -107,9 +107,9 @@ Export.createTemplate = function (name) { Export.loadTemplate = function (id) { var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), 'exportType': $('input[name="export_type"]').val(), 'templateId': id, }; @@ -156,9 +156,9 @@ Export.updateTemplate = function (id) { var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), 'exportType': $('input[name="export_type"]').val(), 'templateId': id, 'templateData': JSON.stringify(templateData) @@ -182,9 +182,9 @@ Export.updateTemplate = function (id) { Export.deleteTemplate = function (id) { var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), 'exportType': $('input[name="export_type"]').val(), 'templateId': id, }; @@ -753,7 +753,7 @@ Export.createAliasModal = function (event) { modal.modal('show'); modal.on('shown.bs.modal', function () { modal.closest('.ui-dialog').find('.ui-button').addClass('btn btn-secondary'); - var db = CommonParams.get('db'); + var db = window.CommonParams.get('db'); if (db) { var option = $('<option></option>'); option.text(db); @@ -762,7 +762,7 @@ Export.createAliasModal = function (event) { } else { var params = { 'ajax_request': true, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }; $.post('index.php?route=/databases', params, function (response) { if (response.success === true) { @@ -868,7 +868,7 @@ window.AJAX.registerOnload('export.js', function () { }); $('#db_alias_select').on('change', function () { Export.aliasToggleRow($(this)); - var table = CommonParams.get('table'); + var table = window.CommonParams.get('table'); if (table) { var option = $('<option></option>'); option.text(table); @@ -878,7 +878,7 @@ window.AJAX.registerOnload('export.js', function () { var database = $(this).val(); var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'db': database, }; var url = 'index.php?route=/tables'; @@ -902,7 +902,7 @@ window.AJAX.registerOnload('export.js', function () { var table = $(this).val(); var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'db': database, 'table': table, }; diff --git a/js/src/functions.js b/js/src/functions.js index b77b2550c6..d86a4d800d 100644 --- a/js/src/functions.js +++ b/js/src/functions.js @@ -98,9 +98,9 @@ var spatialIndexes = []; $.ajaxPrefilter(function (options, originalOptions) { var nocache = new Date().getTime() + '' + Math.floor(Math.random() * 1000000); if (typeof options.data === 'string') { - options.data += '&_nocache=' + nocache + '&token=' + encodeURIComponent(CommonParams.get('token')); + options.data += '&_nocache=' + nocache + '&token=' + encodeURIComponent(window.CommonParams.get('token')); } else if (typeof options.data === 'object') { - options.data = $.extend(originalOptions.data, { '_nocache' : nocache, 'token': CommonParams.get('token') }); + options.data = $.extend(originalOptions.data, { '_nocache' : nocache, 'token': window.CommonParams.get('token') }); } }); @@ -259,7 +259,7 @@ Functions.handleRedirectAndReload = function (data) { if (window.location.href.indexOf('?') === -1) { window.location.href += '?session_expired=1'; } else { - window.location.href += CommonParams.get('arg_separator') + 'session_expired=1'; + window.location.href += window.CommonParams.get('arg_separator') + 'session_expired=1'; } window.location.reload(); } else if (parseInt(data.reload_flag) === 1) { @@ -656,7 +656,7 @@ Functions.confirmLink = function (theLink, theSqlQuery) { var isConfirmed = confirm(Functions.sprintf(Messages.strDoYouReally, theSqlQuery)); if (isConfirmed) { if (typeof(theLink.href) !== 'undefined') { - theLink.href += CommonParams.get('arg_separator') + 'is_js_confirmed=1'; + theLink.href += window.CommonParams.get('arg_separator') + 'is_js_confirmed=1'; } else if (typeof(theLink.form) !== 'undefined') { theLink.form.action += '?is_js_confirmed=1'; } @@ -939,8 +939,8 @@ window.AJAX.registerOnload('functions.js', function () { } var params = { 'ajax_request' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), 'guid': guid, 'access_time': idleSecondsCounter, 'check_timeout': 1 @@ -951,15 +951,15 @@ window.AJAX.registerOnload('functions.js', function () { data: params, success: function (data) { if (data.success) { - if (CommonParams.get('LoginCookieValidity') - idleSecondsCounter < 0) { + if (window.CommonParams.get('LoginCookieValidity') - idleSecondsCounter < 0) { /* There is other active window, let's reset counter */ idleSecondsCounter = 0; } var remaining = Math.min( /* Remaining login validity */ - CommonParams.get('LoginCookieValidity') - idleSecondsCounter, + window.CommonParams.get('LoginCookieValidity') - idleSecondsCounter, /* Remaining time till session GC */ - CommonParams.get('session_gc_maxlifetime') + window.CommonParams.get('session_gc_maxlifetime') ); var interval = 1000; if (remaining > 5) { @@ -981,7 +981,7 @@ window.AJAX.registerOnload('functions.js', function () { }); $('#input_username').trigger('focus'); } else { - CommonParams.set('token', data.new_token); + window.CommonParams.set('token', data.new_token); $('input[name=token]').val(data.new_token); } idleSecondsCounter = 0; @@ -990,11 +990,11 @@ window.AJAX.registerOnload('functions.js', function () { } }); } - if (CommonParams.get('logged_in')) { + if (window.CommonParams.get('logged_in')) { incInterval = window.setInterval(SetIdleTime, 1000); var sessionTimeout = Math.min( - CommonParams.get('LoginCookieValidity'), - CommonParams.get('session_gc_maxlifetime') + window.CommonParams.get('LoginCookieValidity'), + window.CommonParams.get('session_gc_maxlifetime') ); if (isStorageSupported('sessionStorage')) { window.sessionStorage.setItem('guid', guid()); @@ -1169,7 +1169,7 @@ Functions.loadForeignKeyCheckbox = function () { // Load default foreign key check value var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), }; $.get('index.php?route=/sql/get-default-fk-check-value', params, function (data) { var html = '<input type="hidden" name="fk_checks" value="0">' + @@ -1183,7 +1183,7 @@ Functions.loadForeignKeyCheckbox = function () { Functions.getJsConfirmCommonParam = function (elem, parameters) { var $elem = $(elem); var params = parameters; - var sep = CommonParams.get('arg_separator'); + var sep = window.CommonParams.get('arg_separator'); if (params) { // Strip possible leading ? if (params.startsWith('?')) { @@ -1319,8 +1319,8 @@ Functions.codeMirrorAutoCompleteOnInputRead = function (instance) { var params = { 'ajax_request': true, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), 'no_debug': true }; @@ -1340,7 +1340,7 @@ Functions.codeMirrorAutoCompleteOnInputRead = function (instance) { success: function (data) { if (data.success) { var tables = JSON.parse(data.tables); - sqlAutoCompleteDefaultTable = CommonParams.get('table'); + sqlAutoCompleteDefaultTable = window.CommonParams.get('table'); sqlAutoComplete = []; for (var table in tables) { if (tables.hasOwnProperty(table)) { @@ -1748,7 +1748,7 @@ Functions.ajaxRemoveMessage = function ($thisMessageBox) { */ Functions.previewSql = function ($form) { var formUrl = $form.attr('action'); - var sep = CommonParams.get('arg_separator'); + var sep = window.CommonParams.get('arg_separator'); var formData = $form.serialize() + sep + 'do_save_data=1' + sep + 'preview_sql=1' + @@ -2186,7 +2186,7 @@ Functions.sqlPrettyPrint = function (string) { * @return {bool} */ Functions.confirm = function (question, url, callbackFn, openCallback) { - var confirmState = CommonParams.get('confirm'); + var confirmState = window.CommonParams.get('confirm'); if (! confirmState) { // user does not want to confirm if (typeof callbackFn === 'function') { @@ -2296,7 +2296,7 @@ window.AJAX.registerOnload('functions.js', function () { if (Functions.checkReservedWordColumns($form)) { Functions.ajaxShowMessage(Messages.strProcessingRequest); // User wants to submit the form - $.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { + $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { $('#properties_message') .removeClass('alert-danger') @@ -2315,8 +2315,8 @@ window.AJAX.registerOnload('functions.js', function () { var tablesTable = $('#tablesForm').find('tbody').not('#tbl_summary_row'); // this is the first table created in this db if (tablesTable.length === 0) { - CommonActions.refreshMain( - CommonParams.get('opendb_url') + window.CommonActions.refreshMain( + window.CommonParams.get('opendb_url') ); } else { /** @@ -2355,7 +2355,7 @@ window.AJAX.registerOnload('functions.js', function () { // Refresh navigation as a new table has been added Navigation.reload(); // Redirect to table structure page on creation of new table - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var params12 = 'ajax_request=true' + argsep + 'ajax_page_request=true'; var tableStructureUrl = 'index.php?route=/table/structure' + argsep + 'server=' + data.params.server + argsep + 'db=' + data.params.db + argsep + 'token=' + data.params.token + @@ -2590,7 +2590,7 @@ window.AJAX.registerOnload('functions.js', function () { var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); $theForm.append('<input type="hidden" name="ajax_request" value="true">'); - $.post($theForm.attr('action'), $theForm.serialize() + CommonParams.get('arg_separator') + 'change_pw=' + thisValue, function (data) { + $.post($theForm.attr('action'), $theForm.serialize() + window.CommonParams.get('arg_separator') + 'change_pw=' + thisValue, function (data) { if (typeof data === 'undefined' || data.success !== true) { Functions.ajaxShowMessage(data.error, false); return; @@ -2719,8 +2719,8 @@ Functions.validateDefaultValue = function ($nullCheckbox) { * @param {number} offset of the selected column in central list of columns */ Functions.autoPopulate = function (inputId, offset) { - var db = CommonParams.get('db'); - var table = CommonParams.get('table'); + var db = window.CommonParams.get('db'); + var table = window.CommonParams.get('table'); var newInputId = inputId.substring(0, inputId.length - 1); $('#' + newInputId + '1').val(centralColumnList[db + '_' + table][offset].col_name); var colType = centralColumnList[db + '_' + table][offset].col_type.toUpperCase(); @@ -2906,8 +2906,8 @@ window.AJAX.registerOnload('functions.js', function () { $(document).on('click', 'a.central_columns_dialog', function () { var href = 'index.php?route=/database/central-columns'; - var db = CommonParams.get('db'); - var table = CommonParams.get('table'); + var db = window.CommonParams.get('db'); + var table = window.CommonParams.get('table'); var maxRows = $(this).data('maxrows'); var pick = $(this).data('pick'); if (pick !== false) { @@ -2915,9 +2915,9 @@ window.AJAX.registerOnload('functions.js', function () { } var params = { 'ajax_request' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'cur_table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'cur_table' : window.CommonParams.get('table'), 'getColumnList':true }; var colid = $(this).closest('td').find('input').attr('id'); @@ -3149,7 +3149,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca const modalBody = indexDialogPreviewModal.querySelector('.modal-body'); const $form = $('#index_frm'); const formUrl = $form.attr('action'); - const sep = CommonParams.get('arg_separator'); + const sep = window.CommonParams.get('arg_separator'); const formData = $form.serialize() + sep + 'do_save_data=1' + sep + 'preview_sql=1' + @@ -3188,7 +3188,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca Functions.ajaxShowMessage(Messages.strProcessingRequest); Functions.prepareForAjaxRequest($form); // User wants to submit the form - $.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { + $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { var $sqlqueryresults = $('.sqlqueryresults'); if ($sqlqueryresults.length !== 0) { $sqlqueryresults.remove(); @@ -3541,7 +3541,7 @@ window.AJAX.registerOnload('functions.js', function () { 'favoriteTables': (isStorageSupported('localStorage') && typeof window.localStorage.favoriteTables !== 'undefined') ? window.localStorage.favoriteTables : '', - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'no_debug': true }, success: function (data) { @@ -3773,7 +3773,7 @@ window.AJAX.registerOnload('functions.js', function () { $('.logout').on('click', function () { var form = $( '<form method="POST" action="' + $(this).attr('href') + '" class="disableAjax">' + - '<input type="hidden" name="token" value="' + Functions.escapeHtml(CommonParams.get('token')) + '">' + + '<input type="hidden" name="token" value="' + Functions.escapeHtml(window.CommonParams.get('token')) + '">' + '</form>' ); $('body').append(form); @@ -3813,7 +3813,7 @@ window.AJAX.registerOnload('functions.js', function () { Functions.createViewModal = function ($this) { var $msg = Functions.ajaxShowMessage(); - var sep = CommonParams.get('arg_separator'); + var sep = window.CommonParams.get('arg_separator'); var params = Functions.getJsConfirmCommonParam(this, $this.getPostData()); params += sep + 'ajax_dialog=1'; $.post($this.attr('href'), params, function (data) { @@ -4038,7 +4038,7 @@ window.AJAX.registerOnload('functions.js', function () { } var $httpsWarning = $('#js-https-mismatch'); if ($httpsWarning.length) { - if ((window.location.protocol === 'https:') !== CommonParams.get('is_https')) { + if ((window.location.protocol === 'https:') !== window.CommonParams.get('is_https')) { $httpsWarning.show(); } } @@ -4315,7 +4315,7 @@ Functions.configSet = function (key, value) { data: { 'ajax_request': true, key: key, - server: CommonParams.get('server'), + server: window.CommonParams.get('server'), value: serialized, }, success: function (data) { @@ -4361,7 +4361,7 @@ Functions.configGet = function (key, cached, successCallback) { dataType: 'json', data: { 'ajax_request': true, - server: CommonParams.get('server'), + server: window.CommonParams.get('server'), key: key }, success: function (data) { diff --git a/js/src/gis_data_editor.js b/js/src/gis_data_editor.js index 9e2f5b8d31..bea935451a 100644 --- a/js/src/gis_data_editor.js +++ b/js/src/gis_data_editor.js @@ -141,7 +141,7 @@ function loadGISEditor (value, field, type, inputName) { 'input_name' : inputName, 'get_gis_editor' : true, 'ajax_request': true, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { if (typeof data !== 'undefined' && data.success === true) { $gisEditor.html(data.gis_editor); @@ -192,7 +192,7 @@ function insertDataAndClose () { var $form = $('form#gis_data_editor_form'); var inputName = $form.find('input[name=\'input_name\']').val(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post('index.php?route=/gis-data-editor', $form.serialize() + argsep + 'generate=true' + argsep + 'ajax_request=true', function (data) { if (typeof data !== 'undefined' && data.success === true) { $('input[name=\'' + inputName + '\']').val(data.result); @@ -240,7 +240,7 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { */ $(document).on('change', '#gis_editor input[type=\'text\']', function () { var $form = $('form#gis_data_editor_form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post('index.php?route=/gis-data-editor', $form.serialize() + argsep + 'generate=true' + argsep + 'ajax_request=true', function (data) { if (typeof data !== 'undefined' && data.success === true) { $('#gis_data_textarea').val(data.result); @@ -263,7 +263,7 @@ window.AJAX.registerOnload('gis_data_editor.js', function () { var $gisEditor = $('#gis_editor'); var $form = $('form#gis_data_editor_form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post('index.php?route=/gis-data-editor', $form.serialize() + argsep + 'get_gis_editor=true' + argsep + 'ajax_request=true', function (data) { if (typeof data !== 'undefined' && data.success === true) { $gisEditor.html(data.gis_editor); diff --git a/js/src/home.js b/js/src/home.js index 43abd9df1f..1a7f1cfb66 100644 --- a/js/src/home.js +++ b/js/src/home.js @@ -102,7 +102,7 @@ const GitInfo = { $.get( 'index.php?route=/git-revision', { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'ajax_request': true, 'no_debug': true }, @@ -127,7 +127,7 @@ const GitInfo = { url: 'index.php?route=/version-check', method: 'POST', data: { - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, success: GitInfo.currentVersion }); diff --git a/js/src/indexes.js b/js/src/indexes.js index 05683b49c8..f24fc79df0 100644 --- a/js/src/indexes.js +++ b/js/src/indexes.js @@ -346,7 +346,7 @@ Indexes.showAddIndexDialog = function (sourceArray, arrayIndex, targetColumns, c var $table = $('input[name="table"]'); var table = $table.length > 0 ? $table.val() : ''; var postData = { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'db': $('input[name="db"]').val(), 'table': table, 'ajax_request': 1, @@ -594,7 +594,7 @@ window.AJAX.registerOnload('indexes.js', function () { $(document).on('click', '#save_index_frm', function (event) { event.preventDefault(); var $form = $('#index_frm'); - var argsep = CommonParams.get('arg_separator'); + 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); window.AJAX.source = $form; @@ -664,7 +664,7 @@ window.AJAX.registerOnload('indexes.js', function () { Functions.highlightSql($('#page_content')); } Navigation.reload(); - CommonActions.refreshMain('index.php?route=/table/structure'); + window.CommonActions.refreshMain('index.php?route=/table/structure'); } else { Functions.ajaxShowMessage(Messages.strErrorProcessingRequest + ' : ' + data.error, false); } @@ -696,11 +696,11 @@ window.AJAX.registerOnload('indexes.js', function () { url = $(this).find('a').getPostData(); title = Messages.strEditIndex; } - url += CommonParams.get('arg_separator') + 'ajax_request=true'; + url += window.CommonParams.get('arg_separator') + 'ajax_request=true'; Functions.indexEditorDialog(url, title, function (data) { - CommonParams.set('db', data.params.db); - CommonParams.set('table', data.params.table); - CommonActions.refreshMain('index.php?route=/table/structure'); + window.CommonParams.set('db', data.params.db); + window.CommonParams.set('table', data.params.table); + window.CommonActions.refreshMain('index.php?route=/table/structure'); }); }); @@ -711,11 +711,11 @@ window.AJAX.registerOnload('indexes.js', function () { event.preventDefault(); var url = $(this).find('a').getPostData(); var title = Messages.strRenameIndex; - url += CommonParams.get('arg_separator') + 'ajax_request=true'; + url += window.CommonParams.get('arg_separator') + 'ajax_request=true'; Functions.indexRenameDialog(url, title, function (data) { - CommonParams.set('db', data.params.db); - CommonParams.set('table', data.params.table); - CommonActions.refreshMain('index.php?route=/table/structure'); + window.CommonParams.set('db', data.params.db); + window.CommonParams.set('table', data.params.table); + window.CommonActions.refreshMain('index.php?route=/table/structure'); }); }); diff --git a/js/src/makegrid.js b/js/src/makegrid.js index 131541fe9d..8d8f1ffcf2 100644 --- a/js/src/makegrid.js +++ b/js/src/makegrid.js @@ -693,7 +693,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid // Truncates the text. $thisField.removeClass('truncated'); - if (CommonParams.get('pftext') === 'P' && value.length > g.maxTruncatedLen) { + if (window.CommonParams.get('pftext') === 'P' && value.length > g.maxTruncatedLen) { $thisField.addClass('truncated'); value = value.substring(0, g.maxTruncatedLen) + '...'; } @@ -2028,7 +2028,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid // initialize cell editing configuration g.saveCellsAtOnce = $(g.o).find('.save_cells_at_once').val(); - g.maxTruncatedLen = CommonParams.get('LimitChars'); + g.maxTruncatedLen = window.CommonParams.get('LimitChars'); // register events $(g.t).find('td.data.click1') diff --git a/js/src/modules/console.js b/js/src/modules/console.js index db81814f0c..afc959ed0a 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 CommonParams, Functions, Messages, Navigation */ +/* global Functions, Messages, Navigation */ /** * Console object @@ -89,7 +89,7 @@ var Console = { '<input name="token" value="">' + '</form>' ); - Console.$requestForm.children('[name=token]').val(CommonParams.get('token')); + Console.$requestForm.children('[name=token]').val(window.CommonParams.get('token')); Console.$requestForm.on('submit', window.AJAX.requestHandler); // Event binds shouldn't run again @@ -229,7 +229,7 @@ var Console = { return; } Console.$requestForm.children('textarea').val(queryString); - Console.$requestForm.children('[name=server]').attr('value', CommonParams.get('server')); + Console.$requestForm.children('[name=server]').attr('value', window.CommonParams.get('server')); if (options && options.db) { Console.$requestForm.children('[name=db]').val(options.db); if (options.table) { @@ -239,7 +239,7 @@ var Console = { } } else { Console.$requestForm.children('[name=db]').val( - (CommonParams.get('db').length > 0 ? CommonParams.get('db') : '')); + (window.CommonParams.get('db').length > 0 ? window.CommonParams.get('db') : '')); } Console.$requestForm.find('[name=profiling]').remove(); if (options && options.profiling === true) { @@ -914,7 +914,7 @@ var ConsoleMessages = { if (confirm(Messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) { $.post('index.php?route=/import', { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'action_bookmark': 2, 'ajax_request': true, 'id_bookmark': $message.attr('bookmarkid') @@ -1050,7 +1050,7 @@ var ConsoleBookmarks = { $.get('index.php?route=/import', { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'console_bookmark_refresh': 'refresh' }, function (data) { @@ -1088,7 +1088,7 @@ var ConsoleBookmarks = { 'ajax_request': true, 'console_bookmark_add': 'true', 'label': $('#pma_bookmarks').find('.card.add [name=label]').val(), - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'db': $('#pma_bookmarks').find('.card.add [name=targetdb]').val(), 'bookmark_query': ConsoleInput.getText('bookmark'), 'shared': $('#pma_bookmarks').find('.card.add [name=shared]').prop('checked') diff --git a/js/src/multi_column_sort.js b/js/src/multi_column_sort.js index d01a36cd89..c03bd46116 100644 --- a/js/src/multi_column_sort.js +++ b/js/src/multi_column_sort.js @@ -10,7 +10,7 @@ window.AJAX.registerOnload('keyhandler.js', function () { $('th.draggable.column_heading.pointer.marker a').on('click', function (event) { var orderUrlRemove = $(this).parent().find('input[name="url-remove-order"]').val(); var orderUrlAdd = $(this).parent().find('input[name="url-add-order"]').val(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); if (event.ctrlKey || event.altKey) { event.preventDefault(); window.AJAX.source = $(this); diff --git a/js/src/navigation.js b/js/src/navigation.js index 355e3443b2..ecfc4e46ef 100644 --- a/js/src/navigation.js +++ b/js/src/navigation.js @@ -21,8 +21,8 @@ Navigation.treeStateUpdate = function () { // content to be stored exceeds storage capacity try { storage.setItem('navTreePaths', JSON.stringify(Navigation.traverseForPaths())); - storage.setItem('server', CommonParams.get('server')); - storage.setItem('token', CommonParams.get('token')); + storage.setItem('server', window.CommonParams.get('server')); + storage.setItem('token', window.CommonParams.get('token')); } catch (error) { // storage capacity exceeded & old navigation tree // state is no more valid, so remove it @@ -138,7 +138,7 @@ Navigation.loadChildNodes = function (isNode, $expandElem, callback) { var pos2Name = $expandElem.find('span.pos2_nav'); var pathsNav = $expandElem.find('span.paths_nav'); params = { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'aPath': pathsNav.attr('data-apath'), 'vPath': pathsNav.attr('data-vpath'), 'pos': pathsNav.attr('data-pos'), @@ -154,7 +154,7 @@ Navigation.loadChildNodes = function (isNode, $expandElem, callback) { } else { $destination = $('#pma_navigation_tree_content'); params = { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'aPath': $expandElem.attr('data-apath'), 'vPath': $expandElem.attr('data-vpath'), 'pos': $expandElem.attr('data-pos'), @@ -195,7 +195,7 @@ Navigation.loadChildNodes = function (isNode, $expandElem, callback) { if (window.location.href.indexOf('?') === -1) { window.location.href += '?session_expired=1'; } else { - window.location.href += CommonParams.get('arg_separator') + 'session_expired=1'; + window.location.href += window.CommonParams.get('arg_separator') + 'session_expired=1'; } window.location.reload(); } else { @@ -329,7 +329,7 @@ $(function () { $(document).on('change', '#navi_db_select', function () { if (! $(this).val()) { - CommonParams.set('db', ''); + window.CommonParams.set('db', ''); Navigation.reload(); } $(this).closest('form').trigger('submit'); @@ -453,9 +453,9 @@ $(function () { /** Hide navigation tree item */ $(document).on('click', 'a.hideNavItem.ajax', function (event) { event.preventDefault(); - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = $(this).getPostData(); - params += argSep + 'ajax_request=true' + argSep + 'server=' + CommonParams.get('server'); + params += argSep + 'ajax_request=true' + argSep + 'server=' + window.CommonParams.get('server'); $.ajax({ type: 'POST', data: params, @@ -474,7 +474,7 @@ $(function () { $(document).on('click', 'a.showUnhide.ajax', function (event) { event.preventDefault(); var $msg = Functions.ajaxShowMessage(); - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = $(this).getPostData(); params += argSep + 'ajax_request=true'; $.post($(this).attr('href'), params, function (data) { @@ -495,9 +495,9 @@ $(function () { var $hiddenTableCount = $tr.parents('tbody').children().length; var $hideDialogBox = $tr.closest('div.ui-dialog'); var $msg = Functions.ajaxShowMessage(); - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = $(this).getPostData(); - params += argSep + 'ajax_request=true' + argSep + 'server=' + CommonParams.get('server'); + params += argSep + 'ajax_request=true' + argSep + 'server=' + window.CommonParams.get('server'); $.ajax({ type: 'POST', data: params, @@ -538,7 +538,7 @@ $(function () { type: 'POST', data: { 'favoriteTables': hasLocalStorage ? window.localStorage.favoriteTables : '', - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), }, success: function (data) { if (data.changes) { @@ -571,8 +571,8 @@ $(function () { typeof storage.navTreePaths === 'undefined' ) { Navigation.reload(); - } else if (CommonParams.get('server') === storage.server && - CommonParams.get('token') === storage.token + } else if (window.CommonParams.get('server') === storage.server && + window.CommonParams.get('token') === storage.token ) { // Reload the tree to the state before page refresh Navigation.reload(Navigation.filterStateRestore, JSON.parse(storage.navTreePaths)); @@ -669,8 +669,8 @@ Navigation.scrollToView = function ($element, $forceToTop) { * @return {void} */ Navigation.showCurrent = function () { - var db = CommonParams.get('db'); - var table = CommonParams.get('table'); + var db = window.CommonParams.get('db'); + var table = window.CommonParams.get('table'); var autoexpand = $('#pma_navigation_tree').hasClass('autoexpand'); @@ -897,7 +897,7 @@ Navigation.ensureSettings = function (selflink) { if (!$('#pma_navigation_settings').length) { var params = { getNaviSettings: true, - server: CommonParams.get('server'), + server: window.CommonParams.get('server'), }; $.post('index.php?route=/navigation&ajax_request=1', params, function (data) { if (typeof data !== 'undefined' && data.success) { @@ -926,12 +926,12 @@ Navigation.reload = function (callback, paths) { var params = { 'reload': true, 'no_debug': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), }; var pathsLocal = paths || Navigation.traverseForPaths(); $.extend(params, pathsLocal); if ($('#navi_db_select').length) { - params.db = CommonParams.get('db'); + params.db = window.CommonParams.get('db'); requestNaviReload(params); return; } @@ -964,12 +964,12 @@ Navigation.selectCurrentDatabase = function () { return false; } - if (CommonParams.get('db')) { // db selected + if (window.CommonParams.get('db')) { // db selected $naviDbSelect.show(); } - $naviDbSelect.val(CommonParams.get('db')); - return $naviDbSelect.val() === CommonParams.get('db'); + $naviDbSelect.val(window.CommonParams.get('db')); + return $naviDbSelect.val() === window.CommonParams.get('db'); }; /** @@ -988,20 +988,20 @@ Navigation.treePagination = function ($this) { var url = 'index.php?route=/navigation'; var params = 'ajax_request=true'; if ($this[0].tagName === 'A') { - params += CommonParams.get('arg_separator') + $this.getPostData(); + params += window.CommonParams.get('arg_separator') + $this.getPostData(); } else { // tagName === 'SELECT' - params += CommonParams.get('arg_separator') + $this.closest('form').serialize(); + params += window.CommonParams.get('arg_separator') + $this.closest('form').serialize(); } var searchClause = Navigation.FastFilter.getSearchClause(); if (searchClause) { - params += CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent(searchClause); + params += window.CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent(searchClause); } if (isDbSelector) { - params += CommonParams.get('arg_separator') + 'full=true'; + params += window.CommonParams.get('arg_separator') + 'full=true'; } else { var searchClause2 = Navigation.FastFilter.getSearchClause2($this); if (searchClause2) { - params += CommonParams.get('arg_separator') + 'searchClause2=' + encodeURIComponent(searchClause2); + params += window.CommonParams.get('arg_separator') + 'searchClause2=' + encodeURIComponent(searchClause2); } } $.post(url, params, function (data) { @@ -1548,11 +1548,11 @@ Navigation.FastFilter.Filter.prototype.request = function () { if (self.$this.find('> ul > li > form.fast_filter').first().find('input[name=searchClause]').length === 0) { var $input = $('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause'); if ($input.length && $input.val() !== $input[0].defaultValue) { - params += CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent($input.val()); + params += window.CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent($input.val()); } } self.xhr = $.ajax({ - url: 'index.php?route=/navigation&ajax_request=1&server=' + CommonParams.get('server'), + url: 'index.php?route=/navigation&ajax_request=1&server=' + window.CommonParams.get('server'), type: 'post', dataType: 'json', data: params, diff --git a/js/src/normalization.js b/js/src/normalization.js index bb86a0ff8e..b1ccb7131f 100644 --- a/js/src/normalization.js +++ b/js/src/normalization.js @@ -22,9 +22,9 @@ function appendHtmlColumnsList () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'getColumns': true }, function (data) { @@ -38,14 +38,14 @@ function appendHtmlColumnsList () { function goTo3NFStep1 (newTables) { var tables = newTables; if (Object.keys(tables).length === 1) { - tables = [CommonParams.get('table')]; + tables = [window.CommonParams.get('table')]; } $.post( 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'server': window.CommonParams.get('server'), 'tables': tables, 'step': '3.1' }, function (data) { @@ -84,9 +84,9 @@ function goTo2NFStep1 () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'step': '2.1' }, function (data) { $('#page_content h3').html(Messages.str2NFNormalization); @@ -110,7 +110,7 @@ function goTo2NFStep1 () { if (normalizeto === '3nf') { $('#mainContent #newCols').html(Messages.strToNextStep); setTimeout(function () { - goTo3NFStep1([CommonParams.get('table')]); + goTo3NFStep1([window.CommonParams.get('table')]); }, 3000); } } @@ -124,7 +124,7 @@ function goToFinish1NF () { } $('#mainContent legend').html(Messages.strEndStep); $('#mainContent h4').html( - '<h3>' + Functions.sprintf(Messages.strFinishMsg, Functions.escapeHtml(CommonParams.get('table'))) + '</h3>' + '<h3>' + Functions.sprintf(Messages.strFinishMsg, Functions.escapeHtml(window.CommonParams.get('table'))) + '</h3>' ); $('#mainContent p').html(''); $('#mainContent #extra').html(''); @@ -138,9 +138,9 @@ function goToStep4 () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'step4': true }, function (data) { $('#mainContent legend').html(data.legendText); @@ -161,9 +161,9 @@ function goToStep3 () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'step3': true }, function (data) { $('#mainContent legend').html(data.legendText); @@ -185,9 +185,9 @@ function goToStep2 (extra) { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'step2': true }, function (data) { $('#mainContent legend').html(data.legendText); @@ -222,9 +222,9 @@ function goTo2NFFinish (pd) { } var datastring = { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'pd': JSON.stringify(pd), 'newTablesName':JSON.stringify(tables), 'createNewTables2NF':1 }; @@ -269,8 +269,8 @@ function goTo3NFFinish (newTables) { } var datastring = { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'server': window.CommonParams.get('server'), 'newTables':JSON.stringify(newTables), 'createNewTables3NF':1 }; $.ajax({ @@ -319,9 +319,9 @@ function goTo2NFStep2 (pd, primaryKey) { extra += '</div>'; var datastring = { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'pd': JSON.stringify(pd), 'getNewTables2NF':1 }; $.ajax({ @@ -368,9 +368,9 @@ function goTo3NFStep2 (pd, tablesTds) { extra += '</div>'; var datastring = { 'ajax_request': true, - 'db': CommonParams.get('db'), + 'db': window.CommonParams.get('db'), 'tables': JSON.stringify(tablesTds), - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'pd': JSON.stringify(pd), 'getNewTables3NF':1 }; $.ajax({ @@ -461,9 +461,9 @@ function moveRepeatingGroup (repeatingCols) { } var datastring = { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'repeatingColumns': repeatingCols, 'newTable':newTable, 'newColumn':newColumn, @@ -520,9 +520,9 @@ window.AJAX.registerOnload('normalization.js', function () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'splitColumn': true, 'numFields': numField }, @@ -564,7 +564,7 @@ window.AJAX.registerOnload('normalization.js', function () { $('#newCols #field_0_1').trigger('focus'); return false; } - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var datastring = $('#newCols :input').serialize(); datastring += argsep + 'ajax_request=1' + argsep + 'do_save_data=1' + argsep + 'field_where=last'; $.post('index.php?route=/table/add-field', datastring, function (data) { @@ -573,12 +573,12 @@ window.AJAX.registerOnload('normalization.js', function () { 'index.php?route=/sql', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'dropped_column': selectedCol, 'purge' : 1, - 'sql_query': 'ALTER TABLE `' + CommonParams.get('table') + '` DROP `' + selectedCol + '`;', + 'sql_query': 'ALTER TABLE `' + window.CommonParams.get('table') + '` DROP `' + selectedCol + '`;', 'is_js_confirmed': 1 }, function (data) { @@ -603,9 +603,9 @@ window.AJAX.registerOnload('normalization.js', function () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'addNewPrimary': true }, function (data) { @@ -643,7 +643,7 @@ window.AJAX.registerOnload('normalization.js', function () { }); $('.tblFooters').on('click', '#saveNewPrimary', function () { var datastring = $('#newCols :input').serialize(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); 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) { @@ -661,7 +661,7 @@ window.AJAX.registerOnload('normalization.js', function () { }); }); $('#extra').on('click', '#removeRedundant', function () { - var dropQuery = 'ALTER TABLE `' + CommonParams.get('table') + '` '; + var dropQuery = 'ALTER TABLE `' + window.CommonParams.get('table') + '` '; $('#extra input[type=checkbox]:checked').each(function () { dropQuery += 'DROP `' + $(this).val() + '`, '; }); @@ -670,9 +670,9 @@ window.AJAX.registerOnload('normalization.js', function () { 'index.php?route=/sql', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'sql_query': dropQuery, 'is_js_confirmed': 1 }, @@ -694,7 +694,7 @@ 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(CommonParams.get('table'))); + 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) + '">)' + '</ol>'; @@ -727,9 +727,9 @@ window.AJAX.registerOnload('normalization.js', function () { event.preventDefault(); var url = { 'create_index': 1, - 'server': CommonParams.get('server'), - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), + 'server': window.CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), 'added_fields': 1, 'add_fields':1, 'index': { 'Key_name':'PRIMARY' }, @@ -767,9 +767,9 @@ window.AJAX.registerOnload('normalization.js', function () { 'index.php?route=/normalization', { 'ajax_request': true, - 'db': CommonParams.get('db'), - 'table': CommonParams.get('table'), - 'server': CommonParams.get('server'), + 'db': window.CommonParams.get('db'), + 'table': window.CommonParams.get('table'), + 'server': window.CommonParams.get('server'), 'findPdl': true }, function (data) { $('#showPossiblePd').html('- ' + Messages.strHidePd); diff --git a/js/src/server/databases.js b/js/src/server/databases.js index 679da51698..209ad96092 100644 --- a/js/src/server/databases.js +++ b/js/src/server/databases.js @@ -59,7 +59,7 @@ const DropDatabases = { $form.find('tbody').sortTable('.name'); if ($form.find('tbody').find('tr').length === 0) { // user just dropped the last db on this page - CommonActions.refreshMain(); + window.CommonActions.refreshMain(); } Navigation.reload(); } else { @@ -110,7 +110,7 @@ const CreateDatabase = { // make ajax request to load db structure page - taken from ajax.js var dbStructUrl = data.url; dbStructUrl = dbStructUrl.replace(/amp;/ig, ''); - var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true'; + var params = 'ajax_request=true' + window.CommonParams.get('arg_separator') + 'ajax_page_request=true'; $.get(dbStructUrl, params, window.AJAX.responseHandler); } else { Functions.ajaxShowMessage(data.error, false); @@ -123,7 +123,7 @@ function checkPrivilegesForDatabase () { var tableRows = $('.server_databases'); $.each(tableRows, function () { $(this).on('click', function () { - CommonActions.setDb($(this).attr('data')); + window.CommonActions.setDb($(this).attr('data')); }); }); } diff --git a/js/src/server/privileges.js b/js/src/server/privileges.js index 7ab20f6964..bb77bacc57 100644 --- a/js/src/server/privileges.js +++ b/js/src/server/privileges.js @@ -41,7 +41,7 @@ const EditUserGroup = { 'index.php?route=/server/user-groups/edit-form', { 'username': username, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, data => { if (typeof data === 'undefined' || data.success !== true) { @@ -61,7 +61,7 @@ const EditUserGroup = { $.post( 'index.php?route=/server/privileges', - form.serialize() + CommonParams.get('arg_separator') + 'ajax_request=1', + form.serialize() + window.CommonParams.get('arg_separator') + 'ajax_request=1', data => { if (typeof data === 'undefined' || data.success !== true) { Functions.ajaxShowMessage(data.error, false, 'error'); @@ -97,7 +97,7 @@ const AccountLocking = { 'username': button.dataset.userName, 'hostname': button.dataset.hostName, 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), }; $.post(url, params, data => { @@ -136,7 +136,7 @@ const AddUserLoginCheckUsername = { var href = $('form[name=\'usersForm\']').attr('action'); var params = { 'ajax_request' : true, - 'server' : CommonParams.get('server'), + 'server' : window.CommonParams.get('server'), 'validate_username' : true, 'username' : username }; @@ -188,7 +188,7 @@ const ChangePasswordStrength = { handleEvent: function () { var meterObj = $('#change_password_strength_meter'); var meterObjLabel = $('#change_password_strength'); - Functions.checkPasswordStrength($(this).val(), meterObj, meterObjLabel, CommonParams.get('user')); + Functions.checkPasswordStrength($(this).val(), meterObj, meterObjLabel, window.CommonParams.get('user')); } }; @@ -233,7 +233,7 @@ const RevokeUser = { Functions.ajaxShowMessage(Messages.strRemovingSelectedUsers); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post(url, $form.serialize() + argsep + 'delete=' + $thisButton.val() + argsep + 'ajax_request=true', function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); @@ -291,8 +291,8 @@ const ExportPrivileges = { return; } var msgbox = Functions.ajaxShowMessage(); - var argsep = CommonParams.get('arg_separator'); - var serverId = CommonParams.get('server'); + var argsep = window.CommonParams.get('arg_separator'); + var serverId = window.CommonParams.get('server'); var selectedUsers = $('#usersForm input[name*=\'selected_usr\']:checkbox').serialize(); var postStr = selectedUsers + '&submit_mult=export' + argsep + 'ajax_request=true&server=' + serverId; diff --git a/js/src/server/status/monitor.js b/js/src/server/status/monitor.js index a80857e9c1..2f4abc5c0d 100644 --- a/js/src/server/status/monitor.js +++ b/js/src/server/status/monitor.js @@ -744,7 +744,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { var loadLogVars = function (getvars) { var vars = { 'ajax_request': true, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }; if (getvars) { $.extend(vars, getvars); @@ -1424,7 +1424,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { runtime.refreshRequest = $.post('index.php?route=/server/status/monitor/chart', { 'ajax_request': true, 'requiredData': JSON.stringify(runtime.dataList), - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { var chartData; if (typeof data !== 'undefined' && data.success === true) { @@ -1669,7 +1669,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { 'time_end': Math.round(opts.end / 1000), 'removeVariables': opts.removeVariables, 'limitTypes': opts.limitTypes, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { var logData; @@ -2067,7 +2067,7 @@ window.AJAX.registerOnload('server/status/monitor.js', function () { 'ajax_request': true, 'query': codeMirrorEditor ? codeMirrorEditor.getValue() : $('#sqlquery').val(), 'database': db, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (responseData) { var data = responseData; var i; diff --git a/js/src/server/status/processes.js b/js/src/server/status/processes.js index 28e27aa753..fad3522ec1 100644 --- a/js/src/server/status/processes.js +++ b/js/src/server/status/processes.js @@ -45,9 +45,9 @@ var processList = { */ killProcessHandler: function (event) { event.preventDefault(); - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = $(this).getPostData(); - params += argSep + 'ajax_request=1' + argSep + 'server=' + CommonParams.get('server'); + params += argSep + 'ajax_request=1' + argSep + 'server=' + window.CommonParams.get('server'); // Get row element of the process to be killed. var $tr = $(this).closest('tr'); $.post($(this).attr('href'), params, function (data) { @@ -145,7 +145,7 @@ var processList = { */ getUrlParams: function () { var urlParams = { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'ajax_request': true, 'refresh': true, 'full': $('input[name="full"]').val(), diff --git a/js/src/server/variables.js b/js/src/server/variables.js index 02f03bb276..9b8391f706 100644 --- a/js/src/server/variables.js +++ b/js/src/server/variables.js @@ -46,7 +46,7 @@ window.AJAX.registerOnload('server/variables.js', function () { var $msgbox = Functions.ajaxShowMessage(Messages.strProcessingRequest); $.post('index.php?route=/server/variables/set/' + encodeURIComponent(varName), { 'ajax_request': true, - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'varValue': $valueCell.find('input').val() }, function (data) { if (data.success) { @@ -75,7 +75,7 @@ window.AJAX.registerOnload('server/variables.js', function () { $.get('index.php?route=/server/variables/get/' + encodeURIComponent(varName), { 'ajax_request': true, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }, function (data) { if (typeof data !== 'undefined' && data.success === true) { var $links = $('<div></div>') diff --git a/js/src/shortcuts_handler.js b/js/src/shortcuts_handler.js index b4ff6eae77..dfbea63fc2 100644 --- a/js/src/shortcuts_handler.js +++ b/js/src/shortcuts_handler.js @@ -73,14 +73,14 @@ $(function () { window.Console.toggle(); } else if (e.keyCode === keyS) { if (databaseOp === true) { - isTable = CommonParams.get('table'); - isDb = CommonParams.get('db'); + isTable = window.CommonParams.get('table'); + isDb = window.CommonParams.get('db'); if (isDb && ! isTable) { $('.nav-link .ic_b_props').first().trigger('click'); } } else if (tableOp === true) { - isTable = CommonParams.get('table'); - isDb = CommonParams.get('db'); + isTable = window.CommonParams.get('table'); + isDb = window.CommonParams.get('db'); if (isDb && isTable) { $('.nav-link .ic_b_props').first().trigger('click'); } @@ -89,14 +89,14 @@ $(function () { } } else if (e.keyCode === keyF) { if (databaseOp === true) { - isTable = CommonParams.get('table'); - isDb = CommonParams.get('db'); + isTable = window.CommonParams.get('table'); + isDb = window.CommonParams.get('db'); if (isDb && ! isTable) { $('.nav-link .ic_b_search').first().trigger('click'); } } else if (tableOp === true) { - isTable = CommonParams.get('table'); - isDb = CommonParams.get('db'); + isTable = window.CommonParams.get('table'); + isDb = window.CommonParams.get('db'); if (isDb && isTable) { $('.nav-link .ic_b_search').first().trigger('click'); } diff --git a/js/src/sql.js b/js/src/sql.js index d69c6a277c..572ab8c0f8 100644 --- a/js/src/sql.js +++ b/js/src/sql.js @@ -50,7 +50,7 @@ Sql.autoSave = function (query) { if (isStorageSupported('localStorage')) { window.localStorage.setItem(key, query); } else { - Cookies.set(key, query, { path: CommonParams.get('rootPath') }); + Cookies.set(key, query, { path: window.CommonParams.get('rootPath') }); } } }; @@ -73,8 +73,8 @@ Sql.showThisQuery = function (db, table, query) { window.localStorage.showThisQuery = 1; window.localStorage.showThisQueryObject = JSON.stringify(showThisQueryObject); } else { - Cookies.set('showThisQuery', 1, { path: CommonParams.get('rootPath') }); - Cookies.set('showThisQueryObject', JSON.stringify(showThisQueryObject), { path: CommonParams.get('rootPath') }); + Cookies.set('showThisQuery', 1, { path: window.CommonParams.get('rootPath') }); + Cookies.set('showThisQueryObject', JSON.stringify(showThisQueryObject), { path: window.CommonParams.get('rootPath') }); } }; @@ -118,7 +118,7 @@ Sql.autoSaveWithSort = function (query) { if (isStorageSupported('localStorage')) { window.localStorage.setItem('autoSavedSqlSort', query); } else { - Cookies.set('autoSavedSqlSort', query, { path: CommonParams.get('rootPath') }); + Cookies.set('autoSavedSqlSort', query, { path: window.CommonParams.get('rootPath') }); } } }; @@ -132,7 +132,7 @@ Sql.clearAutoSavedSort = function () { if (isStorageSupported('localStorage')) { window.localStorage.removeItem('autoSavedSqlSort'); } else { - Cookies.set('autoSavedSqlSort', '', { path: CommonParams.get('rootPath') }); + Cookies.set('autoSavedSqlSort', '', { path: window.CommonParams.get('rootPath') }); } }; @@ -276,7 +276,7 @@ const insertQuery = function (queryType) { var params = { 'ajax_request': true, 'sql': codeMirrorEditor.getValue(), - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }; $.ajax({ type: 'POST', @@ -305,8 +305,8 @@ const insertQuery = function (queryType) { if (isStorageSupported('localStorage') && typeof window.localStorage.getItem(key) === 'string') { setQuery(window.localStorage.getItem(key)); - } else if (Cookies.get(key, { path: CommonParams.get('rootPath') })) { - setQuery(Cookies.get(key, { path: CommonParams.get('rootPath') })); + } else if (Cookies.get(key, { path: window.CommonParams.get('rootPath') })) { + setQuery(Cookies.get(key, { path: window.CommonParams.get('rootPath') })); } else { Functions.ajaxShowMessage(Messages.strNoAutoSavedQuery); } @@ -477,7 +477,7 @@ window.AJAX.registerOnload('sql.js', function () { Sql.clearAutoSavedSort(); } // If sql query with sort for current table is stored, change sort by key select value - var sortStoredQuery = useLocalStorageValue ? window.localStorage.autoSavedSqlSort : Cookies.get('autoSavedSqlSort', { path: CommonParams.get('rootPath') }); + var sortStoredQuery = useLocalStorageValue ? window.localStorage.autoSavedSqlSort : Cookies.get('autoSavedSqlSort', { path: window.CommonParams.get('rootPath') }); if (typeof sortStoredQuery !== 'undefined' && sortStoredQuery !== $('select[name="sql_query"]').val() && $('select[name="sql_query"] option[value="' + sortStoredQuery + '"]').length !== 0) { $('select[name="sql_query"]').val(sortStoredQuery).trigger('change'); } @@ -491,7 +491,7 @@ window.AJAX.registerOnload('sql.js', function () { var $link = $(this); $link.confirm(question, $link.attr('href'), function (url) { Functions.ajaxShowMessage(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var params = 'ajax_request=1' + argsep + 'is_js_confirmed=1'; var postData = $link.getPostData(); if (postData) { @@ -512,7 +512,7 @@ window.AJAX.registerOnload('sql.js', function () { $(document).on('submit', '.bookmarkQueryForm', function (e) { e.preventDefault(); Functions.ajaxShowMessage(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post($(this).attr('action'), 'ajax_request=1' + argsep + $(this).serialize(), function (data) { if (data.success) { Functions.ajaxShowMessage(data.message); @@ -771,7 +771,7 @@ window.AJAX.registerOnload('sql.js', function () { Functions.prepareForAjaxRequest($form); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post($form.attr('action'), $form.serialize() + argsep + 'ajax_page_request=true', function (data) { if (typeof data !== 'undefined' && data.success === true) { // success happens if the query returns rows or not @@ -810,21 +810,21 @@ window.AJAX.registerOnload('sql.js', function () { } if (data.params) { - CommonParams.setAll(data.params); + window.CommonParams.setAll(data.params); } if (typeof data.ajax_reload !== 'undefined') { if (data.ajax_reload.reload) { if (data.ajax_reload.table_name) { - CommonParams.set('table', data.ajax_reload.table_name); - CommonActions.refreshMain(); + window.CommonParams.set('table', data.ajax_reload.table_name); + window.CommonActions.refreshMain(); } else { Navigation.reload(); } } } else if (typeof data.reload !== 'undefined') { // this happens if a USE or DROP command was typed - CommonActions.setDb(data.db); + window.CommonActions.setDb(data.db); var url; if (data.db) { if (data.table) { @@ -835,7 +835,7 @@ window.AJAX.registerOnload('sql.js', function () { } else { url = 'index.php?route=/server/sql'; } - CommonActions.refreshMain(url, function () { + window.CommonActions.refreshMain(url, function () { $('#sqlqueryresultsouter') .show() .html(data.message); @@ -875,7 +875,7 @@ window.AJAX.registerOnload('sql.js', function () { var $form = $(this); var $msgbox = Functions.ajaxShowMessage(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post($form.attr('action'), $form.serialize() + argsep + 'ajax_request=true', function (data) { Functions.ajaxRemoveMessage($msgbox); var $sqlqueryresults = $form.parents('.sqlqueryresults'); @@ -917,7 +917,7 @@ window.AJAX.registerOnload('sql.js', function () { var $form = $(this).parents('form'); Sql.submitShowAllForm = function () { - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; Functions.ajaxShowMessage(); window.AJAX.source = $form; @@ -963,7 +963,7 @@ window.AJAX.registerOnload('sql.js', function () { type: 'POST', url: 'index.php?route=/import/simulate-dml', data: { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'db': dbName, 'ajax_request': '1', 'sql_query': query, @@ -1014,7 +1014,7 @@ window.AJAX.registerOnload('sql.js', function () { var $button = $(this); var action = $button.val(); var $form = $button.closest('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep; Functions.ajaxShowMessage(); window.AJAX.source = $form; @@ -1121,7 +1121,7 @@ Sql.browseForeignDialog = function ($thisA) { var tableId = '#browse_foreign_table'; var filterId = '#input_foreign_filter'; var $dialog = null; - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = $thisA.getPostData(); params += argSep + 'ajax_request=true'; $.post($thisA.attr('href'), params, function (data) { @@ -1207,7 +1207,7 @@ Sql.checkSavedQuery = function () { if (isStorageSupported('localStorage') && typeof window.localStorage.getItem(key) === 'string') { Functions.ajaxShowMessage(Messages.strPreviousSaveQuery); - } else if (Cookies.get(key, { path: CommonParams.get('rootPath') })) { + } else if (Cookies.get(key, { path: window.CommonParams.get('rootPath') })) { Functions.ajaxShowMessage(Messages.strPreviousSaveQuery); } }; diff --git a/js/src/table/operations.js b/js/src/table/operations.js index 4085befd97..ea8f381c28 100644 --- a/js/src/table/operations.js +++ b/js/src/table/operations.js @@ -69,19 +69,19 @@ window.AJAX.registerOnload('table/operations.js', function () { event.preventDefault(); var $form = $(this); Functions.prepareForAjaxRequest($form); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post($form.attr('action'), $form.serialize() + argsep + 'submit_copy=Go', function (data) { if (typeof data !== 'undefined' && data.success === true) { if ($form.find('input[name=\'switch_to_new\']').prop('checked')) { - CommonParams.set( + window.CommonParams.set( 'db', $form.find('select[name=\'target_db\'],input[name=\'target_db\']').val() ); - CommonParams.set( + window.CommonParams.set( 'table', $form.find('input[name=\'new_name\']').val() ); - CommonActions.refreshMain(false, function () { + window.CommonActions.refreshMain(false, function () { Functions.ajaxShowMessage(data.message); }); } else { @@ -102,12 +102,12 @@ window.AJAX.registerOnload('table/operations.js', function () { event.preventDefault(); var $form = $(this); Functions.prepareForAjaxRequest($form); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); $.post($form.attr('action'), $form.serialize() + argsep + 'submit_move=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { - CommonParams.set('db', data.params.db); - CommonParams.set('table', data.params.table); - CommonActions.refreshMain('index.php?route=/table/sql', function () { + window.CommonParams.set('db', data.params.db); + window.CommonParams.set('table', data.params.table); + window.CommonActions.refreshMain('index.php?route=/table/sql', function () { Functions.ajaxShowMessage(data.message); }); // Refresh navigation when the table is copied @@ -155,8 +155,8 @@ window.AJAX.registerOnload('table/operations.js', function () { function submitOptionsForm () { $.post($form.attr('action'), $form.serialize(), function (data) { if (typeof data !== 'undefined' && data.success === true) { - CommonParams.set('table', data.params.table); - CommonActions.refreshMain(false, function () { + window.CommonParams.set('table', data.params.table); + window.CommonActions.refreshMain(false, function () { $('#page_content').html(data.message); Functions.highlightSql($('#page_content')); }); @@ -185,11 +185,11 @@ window.AJAX.registerOnload('table/operations.js', function () { // variables which stores the common attributes var params = $.param({ 'ajax_request': 1, - 'server': CommonParams.get('server') + 'server': window.CommonParams.get('server') }); var postData = $link.getPostData(); if (postData) { - params += CommonParams.get('arg_separator') + postData; + params += window.CommonParams.get('arg_separator') + postData; } $.post($link.attr('href'), params, function (data) { @@ -238,7 +238,7 @@ window.AJAX.registerOnload('table/operations.js', function () { var $form = $(this); function submitPartitionMaintenance () { - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; Functions.ajaxShowMessage(Messages.strProcessingRequest); window.AJAX.source = $form; @@ -278,9 +278,9 @@ window.AJAX.registerOnload('table/operations.js', function () { Functions.ajaxRemoveMessage($msgbox); // Table deleted successfully, refresh both the frames Navigation.reload(); - CommonParams.set('table', ''); - CommonActions.refreshMain( - CommonParams.get('opendb_url'), + window.CommonParams.set('table', ''); + window.CommonActions.refreshMain( + window.CommonParams.get('opendb_url'), function () { Functions.ajaxShowMessage(data.message); } @@ -301,7 +301,7 @@ window.AJAX.registerOnload('table/operations.js', function () { var question = Messages.strDropTableStrongWarning + ' '; question += Functions.sprintf( Messages.strDoYouReally, - 'DROP VIEW `' + Functions.escapeHtml(CommonParams.get('table') + '`') + 'DROP VIEW `' + Functions.escapeHtml(window.CommonParams.get('table') + '`') ); $(this).confirm(question, $(this).attr('href'), function (url) { @@ -312,9 +312,9 @@ window.AJAX.registerOnload('table/operations.js', function () { Functions.ajaxRemoveMessage($msgbox); // Table deleted successfully, refresh both the frames Navigation.reload(); - CommonParams.set('table', ''); - CommonActions.refreshMain( - CommonParams.get('opendb_url'), + window.CommonParams.set('table', ''); + window.CommonActions.refreshMain( + window.CommonParams.get('opendb_url'), function () { Functions.ajaxShowMessage(data.message); } diff --git a/js/src/table/relation.js b/js/src/table/relation.js index 61b460b64c..12bbada47b 100644 --- a/js/src/table/relation.js +++ b/js/src/table/relation.js @@ -79,7 +79,7 @@ TableRelation.getDropdownValues = function ($dropdown) { var $form = $dropdown.parents('form'); var $db = $form.find('input[name="db"]').val(); var $table = $form.find('input[name="table"]').val(); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var params = 'getDropdownValues=true' + argsep + 'ajax_request=true' + argsep + 'db=' + encodeURIComponent($db) + argsep + 'table=' + encodeURIComponent($table) + @@ -240,7 +240,7 @@ window.AJAX.registerOnload('table/relation.js', function () { $.post(url, params, function (data) { if (data.success === true) { Functions.ajaxRemoveMessage($msg); - CommonActions.refreshMain(false, function () { + window.CommonActions.refreshMain(false, function () { // Do nothing }); } else { diff --git a/js/src/table/select.js b/js/src/table/select.js index 123df75d0c..f15b6a3fea 100644 --- a/js/src/table/select.js +++ b/js/src/table/select.js @@ -299,7 +299,7 @@ window.AJAX.registerOnload('table/select.js', function () { url: 'index.php?route=/table/search', type: 'POST', data: { - 'server': CommonParams.get('server'), + 'server': window.CommonParams.get('server'), 'ajax_request': 1, 'db': $('input[name="db"]').val(), 'table': $('input[name="table"]').val(), diff --git a/js/src/table/structure.js b/js/src/table/structure.js index 1e50a3d389..81e48c24be 100644 --- a/js/src/table/structure.js +++ b/js/src/table/structure.js @@ -25,7 +25,7 @@ * Reload fields table */ function reloadFieldForm () { - $.post($('#fieldsForm').attr('action'), $('#fieldsForm').serialize() + CommonParams.get('arg_separator') + 'ajax_request=true', function (formData) { + $.post($('#fieldsForm').attr('action'), $('#fieldsForm').serialize() + window.CommonParams.get('arg_separator') + 'ajax_request=true', function (formData) { var $tempDiv = $('<div id=\'temp_div\'><div>').append(formData.message); $('#fieldsForm').replaceWith($tempDiv.find('#fieldsForm')); $('#addColumns').replaceWith($tempDiv.find('#addColumns')); @@ -77,7 +77,7 @@ window.AJAX.registerOnload('table/structure.js', function () { function submitForm () { var $msg = Functions.ajaxShowMessage(Messages.strProcessingRequest); - $.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { + $.post($form.attr('action'), $form.serialize() + window.CommonParams.get('arg_separator') + 'do_save_data=1', function (data) { if ($('.sqlqueryresults').length !== 0) { $('.sqlqueryresults').remove(); } else if ($('.error:not(.tab)').length !== 0) { @@ -105,7 +105,7 @@ window.AJAX.registerOnload('table/structure.js', function () { } }); } else { - CommonActions.refreshMain('index.php?route=/table/structure'); + window.CommonActions.refreshMain('index.php?route=/table/structure'); } } else { Functions.ajaxShowMessage(data.error, false); @@ -198,7 +198,7 @@ window.AJAX.registerOnload('table/structure.js', function () { $thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) { var $msg = Functions.ajaxShowMessage(Messages.strDroppingColumn, false); var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData()); - params += CommonParams.get('arg_separator') + 'ajax_page_request=1'; + params += window.CommonParams.get('arg_separator') + 'ajax_page_request=1'; $.post(url, params, function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxRemoveMessage($msg); @@ -274,7 +274,7 @@ window.AJAX.registerOnload('table/structure.js', function () { window.AJAX.source = $this; var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData()); - params += CommonParams.get('arg_separator') + 'ajax_page_request=1'; + params += window.CommonParams.get('arg_separator') + 'ajax_page_request=1'; $.post(url, params, window.AJAX.responseHandler); }); }); // end Add key @@ -338,7 +338,7 @@ window.AJAX.registerOnload('table/structure.js', function () { Functions.ajaxRemoveMessage($msgbox); return; } - $.post($form.prop('action'), serialized + CommonParams.get('arg_separator') + 'ajax_request=true', function (data) { + $.post($form.prop('action'), serialized + window.CommonParams.get('arg_separator') + 'ajax_request=true', function (data) { if (data.success === false) { Functions.ajaxRemoveMessage($msgbox); var errorModal = $('#moveColumnsErrorModal'); @@ -395,7 +395,7 @@ window.AJAX.registerOnload('table/structure.js', function () { $('body').on('click', '#fieldsForm button.mult_submit', function (e) { e.preventDefault(); var $form = $(this).parents('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; Functions.ajaxShowMessage(); diff --git a/js/src/table/tracking.js b/js/src/table/tracking.js index 07b564df69..4c7a4f0512 100644 --- a/js/src/table/tracking.js +++ b/js/src/table/tracking.js @@ -53,7 +53,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { e.preventDefault(); var $button = $(this); var $form = $button.parent('form'); - var argsep = CommonParams.get('arg_separator'); + var argsep = window.CommonParams.get('arg_separator'); var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val(); if ($button.val() === 'delete_version') { @@ -80,7 +80,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $anchor; - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); params += argSep + 'ajax_page_request=1'; $.post(url, params, window.AJAX.responseHandler); @@ -97,7 +97,7 @@ window.AJAX.registerOnload('table/tracking.js', function () { $anchor.confirm(question, $anchor.attr('href'), function (url) { Functions.ajaxShowMessage(); window.AJAX.source = $anchor; - var argSep = CommonParams.get('arg_separator'); + var argSep = window.CommonParams.get('arg_separator'); var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData()); params += argSep + 'ajax_page_request=1'; $.post(url, params, window.AJAX.responseHandler); diff --git a/js/src/table/zoom_plot_jqplot.js b/js/src/table/zoom_plot_jqplot.js index 04aa925578..2e364f68c3 100644 --- a/js/src/table/zoom_plot_jqplot.js +++ b/js/src/table/zoom_plot_jqplot.js @@ -153,9 +153,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { $.post('index.php?route=/table/zoom-search', { 'ajax_request' : true, 'change_tbl_info' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'table' : window.CommonParams.get('table'), 'field' : $('#tableid_0').val(), 'it' : 0 }, function (data) { @@ -178,9 +178,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { $.post('index.php?route=/table/zoom-search', { 'ajax_request' : true, 'change_tbl_info' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'table' : window.CommonParams.get('table'), 'field' : $('#tableid_1').val(), 'it' : 1 }, function (data) { @@ -202,9 +202,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { $.post('index.php?route=/table/zoom-search', { 'ajax_request' : true, 'change_tbl_info' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'table' : window.CommonParams.get('table'), 'field' : $('#tableid_2').val(), 'it' : 2 }, function (data) { @@ -224,9 +224,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { $.post('index.php?route=/table/zoom-search', { 'ajax_request' : true, 'change_tbl_info' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'table' : window.CommonParams.get('table'), 'field' : $('#tableid_3').val(), 'it' : 3 }, function (data) { @@ -355,7 +355,7 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { // Generate SQL query for update if (!isEmpty(newValues)) { - var sqlQuery = 'UPDATE `' + CommonParams.get('table') + '` SET '; + var sqlQuery = 'UPDATE `' + window.CommonParams.get('table') + '` SET '; for (key in newValues) { sqlQuery += '`' + key + '`='; var value = newValues[key]; @@ -390,8 +390,8 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { sqlQuery += ' WHERE ' + Sql.urlDecode(searchedData[searchedDataKey].where_clause); $.post('index.php?route=/sql', { - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), 'ajax_request' : true, 'sql_query' : sqlQuery, 'inline_edit' : false @@ -574,9 +574,9 @@ window.AJAX.registerOnload('table/zoom_plot_jqplot.js', function () { var postParams = { 'ajax_request' : true, 'get_data_row' : true, - 'server' : CommonParams.get('server'), - 'db' : CommonParams.get('db'), - 'table' : CommonParams.get('table'), + 'server' : window.CommonParams.get('server'), + 'db' : window.CommonParams.get('db'), + 'table' : window.CommonParams.get('table'), 'where_clause' : data[3], 'where_clause_sign' : data[5] }; diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index 9901d473b7..afc6f03f63 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -219,7 +219,7 @@ class Header } } - return 'CommonParams.setAll({' . implode(',', $params) . '});'; + return 'window.CommonParams.setAll({' . implode(',', $params) . '});'; } /** diff --git a/templates/server/privileges/change_password.twig b/templates/server/privileges/change_password.twig index 4cc16768d8..0f84f2e386 100644 --- a/templates/server/privileges/change_password.twig +++ b/templates/server/privileges/change_password.twig @@ -24,7 +24,7 @@ <div class="row"> <span class="d-flex align-items-center col-4">{% trans 'Enter:' %}</span> <input type="password" name="pma_pw" id="text_pma_change_pw" size="10" class="textfield col-6" - onkeyup="Functions.checkPasswordStrength($(this).val(), $('#change_password_strength_meter'), meter_obj_label = $('#change_password_strength'), CommonParams.get('user'));" + onkeyup="Functions.checkPasswordStrength($(this).val(), $('#change_password_strength_meter'), meter_obj_label = $('#change_password_strength'), window.CommonParams.get('user'));" onchange="nopass[1].checked = true"> </div> <div class="row mt-2"> diff --git a/test/classes/HeaderTest.php b/test/classes/HeaderTest.php index 057a333ba1..ca556cb89a 100644 --- a/test/classes/HeaderTest.php +++ b/test/classes/HeaderTest.php @@ -100,7 +100,7 @@ class HeaderTest extends AbstractTestCase { $header = new Header(); $this->assertStringContainsString( - 'CommonParams.setAll', + 'window.CommonParams.setAll', $header->getJsParamsCode() ); } |