Merge pull request #17950 from MauricioFauth/ajax-messages
Extract Functions.ajaxShowMessage() into ajax-messages.js
This commit is contained in:
commit
ce5ce76a8d
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview events handling from central columns page
|
||||
@ -54,10 +54,10 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
event.preventDefault();
|
||||
var multiDeleteColumns = $('.checkall:checkbox:checked').serialize();
|
||||
if (multiDeleteColumns === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strRadioUnchecked);
|
||||
ajaxShowMessage(window.Messages.strRadioUnchecked);
|
||||
return false;
|
||||
}
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
$('#del_col_name').val(multiDeleteColumns);
|
||||
$('#del_form').trigger('submit');
|
||||
});
|
||||
@ -65,12 +65,12 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
event.preventDefault();
|
||||
var editColumnList = $('.checkall:checkbox:checked').serialize();
|
||||
if (editColumnList === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strRadioUnchecked);
|
||||
ajaxShowMessage(window.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');
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', editColumnData, AJAX.responseHandler);
|
||||
});
|
||||
@ -79,7 +79,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
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');
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', multiColumnEditData, AJAX.responseHandler);
|
||||
});
|
||||
@ -162,7 +162,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
if (data.message !== '1') {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' +
|
||||
data.message +
|
||||
'</div>',
|
||||
@ -186,7 +186,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('#tableslistcontainer').find('.checkall').show();
|
||||
},
|
||||
error: function () {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' +
|
||||
window.Messages.strErrorProcessingRequest +
|
||||
'</div>',
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
AJAX.registerTeardown('database/events.js', function () {
|
||||
$(document).off('click', 'a.ajax.add_anchor, a.ajax.edit_anchor');
|
||||
@ -57,7 +58,7 @@ const DatabaseEvents = {
|
||||
},
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
success: true,
|
||||
@ -94,11 +95,11 @@ const DatabaseEvents = {
|
||||
} else {
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, showExport);
|
||||
}
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
|
||||
function showExport (data) {
|
||||
if (data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var buttonOptions Object containing options
|
||||
* for jQueryUI dialog buttons
|
||||
@ -132,7 +133,7 @@ const DatabaseEvents = {
|
||||
var $elm = $ajaxDialog.find('textarea');
|
||||
Functions.getSqlEditor($elm);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
} // end showExport()
|
||||
}, // end exportDialog()
|
||||
@ -154,11 +155,11 @@ const DatabaseEvents = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success === true) {
|
||||
// We have successfully fetched the editor form
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var buttonOptions Object containing options
|
||||
* for jQueryUI dialog buttons
|
||||
@ -187,14 +188,14 @@ const DatabaseEvents = {
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
$msg = Functions.ajaxShowMessage(
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Item created successfully
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Functions.slidingMessage(data.message);
|
||||
that.$ajaxDialog.dialog('close');
|
||||
// If we are in 'edit' mode, we must
|
||||
@ -285,7 +286,7 @@ const DatabaseEvents = {
|
||||
}
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
} // end "if (that.validate())"
|
||||
@ -343,7 +344,7 @@ const DatabaseEvents = {
|
||||
linterOptions.eventEditor = true;
|
||||
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
},
|
||||
@ -365,7 +366,7 @@ const DatabaseEvents = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success === true) {
|
||||
@ -409,12 +410,12 @@ const DatabaseEvents = {
|
||||
});
|
||||
}
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// Show the query that we just executed
|
||||
Functions.slidingMessage(data.sql_query);
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -427,7 +428,7 @@ const DatabaseEvents = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
@ -486,13 +487,13 @@ const DatabaseEvents = {
|
||||
if (returnCount === count) {
|
||||
if (success) {
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('#rteListForm_checkall').prop({ checked: false, indeterminate: false });
|
||||
}
|
||||
Navigation.reload();
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
success = false;
|
||||
if (returnCount === count) {
|
||||
Navigation.reload();
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview function used in QBE for DB
|
||||
@ -61,7 +62,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
}
|
||||
});
|
||||
if (Object.keys(tableAliases).length === 0) {
|
||||
Functions.ajaxShowMessage('Nothing selected', false, 'error');
|
||||
ajaxShowMessage('Nothing selected', false, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -120,7 +121,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
var query = editor.getDoc().getValue();
|
||||
// Verifying that the query is not empty
|
||||
if (query === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strEmptyQuery, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strEmptyQuery, false, 'error');
|
||||
return;
|
||||
}
|
||||
var data = {
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview function used in server privilege pages
|
||||
@ -39,7 +40,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
event.preventDefault();
|
||||
|
||||
if (Functions.emptyCheckTheField(this, 'newname')) {
|
||||
Functions.ajaxShowMessage(window.Messages.strFormEmpty, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strFormEmpty, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -47,7 +48,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
var newDbName = $('#new_db_name').val();
|
||||
|
||||
if (newDbName === oldDbName) {
|
||||
Functions.ajaxShowMessage(window.Messages.strDatabaseRenameToSameName, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strDatabaseRenameToSameName, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -58,10 +59,10 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
|
||||
$form.confirm(question, $form.attr('action'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strRenamingDatabases, false);
|
||||
ajaxShowMessage(window.Messages.strRenamingDatabases, false);
|
||||
$.post(url, $('#rename_db_form').serialize() + CommonParams.get('arg_separator') + 'is_js_confirmed=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
CommonParams.set('db', data.newname);
|
||||
|
||||
Navigation.reload(function () {
|
||||
@ -77,7 +78,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -90,11 +91,11 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
event.preventDefault();
|
||||
|
||||
if (Functions.emptyCheckTheField(this, 'newname')) {
|
||||
Functions.ajaxShowMessage(window.Messages.strFormEmpty, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strFormEmpty, false, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage(window.Messages.strCopyingDatabase, false);
|
||||
ajaxShowMessage(window.Messages.strCopyingDatabase, false);
|
||||
var $form = $(this);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
@ -104,15 +105,15 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
if ($('#checkbox_switch').is(':checked')) {
|
||||
CommonParams.set('db', data.newname);
|
||||
CommonActions.refreshMain(false, function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
});
|
||||
} else {
|
||||
CommonParams.set('db', data.db);
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end copy database
|
||||
@ -132,12 +133,12 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
Functions.ajaxShowMessage(window.Messages.strChangingCharset);
|
||||
ajaxShowMessage(window.Messages.strChangingCharset);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}); // end change charset
|
||||
@ -159,7 +160,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
var params = Functions.getJsConfirmCommonParam(this, $link.getPostData());
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
// Database deleted successfully, refresh both the frames
|
||||
@ -168,11 +169,11 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
CommonActions.refreshMain(
|
||||
'index.php?route=/server/databases',
|
||||
function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
AJAX.registerTeardown('database/routines.js', function () {
|
||||
$(document).off('click', 'a.ajax.add_anchor');
|
||||
@ -67,7 +68,7 @@ const DatabaseRoutines = {
|
||||
},
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
success: true,
|
||||
@ -82,7 +83,7 @@ const DatabaseRoutines = {
|
||||
|
||||
// No routine is exportable (due to privilege issues)
|
||||
if (count === 0) {
|
||||
Functions.ajaxShowMessage(window.Messages.NoExportable);
|
||||
ajaxShowMessage(window.Messages.NoExportable);
|
||||
}
|
||||
var p = $.when();
|
||||
exportAnchors.each(function () {
|
||||
@ -109,11 +110,11 @@ const DatabaseRoutines = {
|
||||
} else {
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, showExport);
|
||||
}
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
|
||||
function showExport (data) {
|
||||
if (data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var buttonOptions Object containing options
|
||||
* for jQueryUI dialog buttons
|
||||
@ -147,7 +148,7 @@ const DatabaseRoutines = {
|
||||
var $elm = $ajaxDialog.find('textarea');
|
||||
Functions.getSqlEditor($elm);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
} // end showExport()
|
||||
}, // end exportDialog()
|
||||
@ -169,7 +170,7 @@ const DatabaseRoutines = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success === true) {
|
||||
var buttonOptions = {
|
||||
@ -183,7 +184,7 @@ const DatabaseRoutines = {
|
||||
},
|
||||
};
|
||||
// We have successfully fetched the editor form
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// Now define the function that is called when
|
||||
// the user presses the "Go" button
|
||||
buttonOptions[window.Messages.strGo].click = function () {
|
||||
@ -198,14 +199,14 @@ const DatabaseRoutines = {
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
$msg = Functions.ajaxShowMessage(
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Item created successfully
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Functions.slidingMessage(data.message);
|
||||
that.$ajaxDialog.dialog('close');
|
||||
|
||||
@ -298,7 +299,7 @@ const DatabaseRoutines = {
|
||||
}
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
} // end "if (that.validate())"
|
||||
@ -360,7 +361,7 @@ const DatabaseRoutines = {
|
||||
// Execute item-specific code
|
||||
that.postDialogShow(data);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
},
|
||||
@ -382,7 +383,7 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success === true) {
|
||||
@ -426,12 +427,12 @@ const DatabaseRoutines = {
|
||||
});
|
||||
}
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// Show the query that we just executed
|
||||
Functions.slidingMessage(data.sql_query);
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -444,7 +445,7 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
@ -503,13 +504,13 @@ const DatabaseRoutines = {
|
||||
if (returnCount === count) {
|
||||
if (success) {
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('#rteListForm_checkall').prop({ checked: false, indeterminate: false });
|
||||
}
|
||||
Navigation.reload();
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
success = false;
|
||||
if (returnCount === count) {
|
||||
Navigation.reload();
|
||||
@ -768,11 +769,11 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
var params = Functions.getJsConfirmCommonParam($this[0], $this.getPostData());
|
||||
$.post($this.attr('href'), params, function (data) {
|
||||
if (data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// If 'data.dialog' is true we show a dialog with a form
|
||||
// to get the input parameters for routine, otherwise
|
||||
// we just show the results of the query
|
||||
@ -794,17 +795,17 @@ const DatabaseRoutines = {
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
$msg = Functions.ajaxShowMessage(
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
$.post('index.php?route=/database/routines', data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Routine executed successfully
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Functions.slidingMessage(data.message);
|
||||
$ajaxDialog.dialog('close');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -843,19 +844,19 @@ const DatabaseRoutines = {
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $(this).serialize();
|
||||
$msg = Functions.ajaxShowMessage(
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
var url = $(this).attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Routine executed successfully
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Functions.slidingMessage(data.message);
|
||||
$('form.rte_form').off('keyup');
|
||||
$ajaxDialog.remove();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -865,7 +866,7 @@ const DatabaseRoutines = {
|
||||
Functions.slidingMessage(data.message);
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* JavaScript functions used on Database Search page
|
||||
@ -120,7 +121,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$(document).on('click', 'a.browse_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the delete criteria */
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strBrowsing, false);
|
||||
var $msg = ajaxShowMessage(window.Messages.strBrowsing, false);
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Load the browse results to the page */
|
||||
@ -138,7 +139,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
$('#browse-results').html(data.message);
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('.table_results').each(function () {
|
||||
window.makeGrid(this, true, true, true, true);
|
||||
});
|
||||
@ -149,7 +150,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -169,7 +170,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$(this).data('table-name')
|
||||
);
|
||||
if (confirm(msg)) {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strDeleting, false);
|
||||
var $msg = ajaxShowMessage(window.Messages.strDeleting, false);
|
||||
/** Load the deleted option to the page*/
|
||||
$('#sqlqueryform').html('');
|
||||
var params = {
|
||||
@ -181,7 +182,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data === 'undefined' || ! data.success) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -197,7 +198,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
.animate({
|
||||
scrollTop: $('#browse-results').offset().top
|
||||
}, 1000);
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -208,10 +209,10 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$(document).on('submit', '#db_search_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
if ($('#criteriaTables :selected').length === 0) {
|
||||
Functions.ajaxShowMessage(window.Messages.strNoTableSelected);
|
||||
ajaxShowMessage(window.Messages.strNoTableSelected);
|
||||
return;
|
||||
}
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strSearching, false);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
// jQuery object to reuse
|
||||
var $form = $(this);
|
||||
|
||||
@ -247,7 +248,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$('#searchresults').html(data.error).show();
|
||||
}
|
||||
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import tooltip from '../modules/tooltip.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview functions used on the database structure page
|
||||
@ -180,11 +181,11 @@ DatabaseStructure.fetchRealRowCount = function ($target) {
|
||||
// Adjust the 'Sum' displayed at the bottom.
|
||||
DatabaseStructure.adjustTotals();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorRealRowCount);
|
||||
ajaxShowMessage(window.Messages.strErrorRealRowCount);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorRealRowCount);
|
||||
ajaxShowMessage(window.Messages.strErrorRealRowCount);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -207,7 +208,7 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
const data = $form.serialize() + argSep + 'ajax_request=true' + argSep + 'ajax_page_request=true';
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
|
||||
$.post(
|
||||
@ -302,7 +303,7 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
|
||||
$.post(url, data, AJAX.responseHandler);
|
||||
@ -332,20 +333,20 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
Functions.getForeignKeyCheckboxLoader();
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
// Adjust table statistics
|
||||
var $tr = $thisAnchor.closest('tr');
|
||||
$tr.find('.tbl_rows').text('0');
|
||||
$tr.find('.tbl_size, .tbl_overhead').text('-');
|
||||
DatabaseStructure.adjustTotals();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
@ -386,19 +387,19 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
question += Functions.getForeignKeyCheckboxLoader();
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
$currRow.hide('medium').remove();
|
||||
DatabaseStructure.adjustTotals();
|
||||
Navigation.reload();
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down the page
|
||||
@ -54,12 +55,12 @@ AJAX.registerOnload('database/tracking.js', function () {
|
||||
if ($button.val() === 'delete_tracking') {
|
||||
var question = window.Messages.strDeleteTrackingDataMultiple;
|
||||
$button.confirm(question, $form.attr('action'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strDeletingTrackingData);
|
||||
ajaxShowMessage(window.Messages.strDeletingTrackingData);
|
||||
AJAX.source = $form;
|
||||
$.post(url, submitData, AJAX.responseHandler);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
}
|
||||
@ -74,7 +75,7 @@ AJAX.registerOnload('database/tracking.js', function () {
|
||||
var $form = $button.parent('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
});
|
||||
@ -87,7 +88,7 @@ AJAX.registerOnload('database/tracking.js', function () {
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strDeleteTrackingData;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strDeletingTrackingData);
|
||||
ajaxShowMessage(window.Messages.strDeletingTrackingData);
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
AJAX.registerTeardown('database/triggers.js', function () {
|
||||
$(document).off('click', 'a.ajax.add_anchor, a.ajax.edit_anchor');
|
||||
@ -66,7 +67,7 @@ const DatabaseTriggers = {
|
||||
}, // end validateCustom()
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
success: true,
|
||||
@ -103,11 +104,11 @@ const DatabaseTriggers = {
|
||||
} else {
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, showExport);
|
||||
}
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
|
||||
function showExport (data) {
|
||||
if (data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
/**
|
||||
* @var buttonOptions Object containing options
|
||||
* for jQueryUI dialog buttons
|
||||
@ -141,7 +142,7 @@ const DatabaseTriggers = {
|
||||
var $elm = $ajaxDialog.find('textarea');
|
||||
Functions.getSqlEditor($elm);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
} // end showExport()
|
||||
}, // end exportDialog()
|
||||
@ -163,7 +164,7 @@ const DatabaseTriggers = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success === true) {
|
||||
var buttonOptions = {
|
||||
@ -177,7 +178,7 @@ const DatabaseTriggers = {
|
||||
},
|
||||
};
|
||||
// We have successfully fetched the editor form
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// Now define the function that is called when
|
||||
// the user presses the "Go" button
|
||||
buttonOptions[window.Messages.strGo].click = function () {
|
||||
@ -192,14 +193,14 @@ const DatabaseTriggers = {
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
$msg = Functions.ajaxShowMessage(
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success === true) {
|
||||
// Item created successfully
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Functions.slidingMessage(data.message);
|
||||
that.$ajaxDialog.dialog('close');
|
||||
// If we are in 'edit' mode, we must
|
||||
@ -290,7 +291,7 @@ const DatabaseTriggers = {
|
||||
}
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
} // end "if (that.validate())"
|
||||
@ -348,7 +349,7 @@ const DatabaseTriggers = {
|
||||
linterOptions.triggerEditor = true;
|
||||
that.syntaxHiglighter = Functions.getSqlEditor($elm, {}, 'both', linterOptions);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.get()
|
||||
},
|
||||
@ -370,7 +371,7 @@ const DatabaseTriggers = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success === true) {
|
||||
@ -414,12 +415,12 @@ const DatabaseTriggers = {
|
||||
});
|
||||
}
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
// Show the query that we just executed
|
||||
Functions.slidingMessage(data.sql_query);
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -432,7 +433,7 @@ const DatabaseTriggers = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
@ -491,13 +492,13 @@ const DatabaseTriggers = {
|
||||
if (returnCount === count) {
|
||||
if (success) {
|
||||
// Get rid of the "Loading" message
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('#rteListForm_checkall').prop({ checked: false, indeterminate: false });
|
||||
}
|
||||
Navigation.reload();
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
success = false;
|
||||
if (returnCount === count) {
|
||||
Navigation.reload();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
var designerTables = [
|
||||
{
|
||||
@ -86,7 +86,7 @@ var DesignerOfflineDB = (function () {
|
||||
};
|
||||
|
||||
request.onerror = function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
};
|
||||
};
|
||||
|
||||
@ -98,7 +98,7 @@ var DesignerOfflineDB = (function () {
|
||||
*/
|
||||
designerDB.loadObject = function (table, id, callback) {
|
||||
if (datastore === null) {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ var DesignerOfflineDB = (function () {
|
||||
*/
|
||||
designerDB.loadAllObjects = function (table, callback) {
|
||||
if (datastore === null) {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ var DesignerOfflineDB = (function () {
|
||||
*/
|
||||
designerDB.loadFirstObject = function (table, callback) {
|
||||
if (datastore === null) {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ var DesignerOfflineDB = (function () {
|
||||
*/
|
||||
designerDB.addObject = function (table, obj, callback) {
|
||||
if (datastore === null) {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ var DesignerOfflineDB = (function () {
|
||||
*/
|
||||
designerDB.deleteObject = function (table, id, callback) {
|
||||
if (datastore === null) {
|
||||
Functions.ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @package PhpMyAdmin-Designer
|
||||
@ -675,7 +676,7 @@ DesignerMove.addOtherDbTables = function () {
|
||||
// Check if table already imported or not.
|
||||
var $table = $('[id="' + encodeURIComponent(db) + '.' + encodeURIComponent(table) + '"]');
|
||||
if ($table.length !== 0) {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
window.sprintf(window.Messages.strTableAlreadyExists, db + '.' + table),
|
||||
undefined,
|
||||
'error'
|
||||
@ -792,13 +793,13 @@ DesignerMove.save2 = function (callback) {
|
||||
poststr += argsep + 'server=' + window.server + argsep + 'db=' + encodeURIComponent(window.db) + argsep + 'selected_page=' + window.selectedPage;
|
||||
poststr += DesignerMove.getUrlPos();
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/database/designer', poststr, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
Functions.ajaxShowMessage(window.Messages.strModificationSaved);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
ajaxShowMessage(window.Messages.strModificationSaved);
|
||||
DesignerMove.markSaved();
|
||||
if (typeof callback !== 'undefined') {
|
||||
callback();
|
||||
@ -820,19 +821,19 @@ DesignerMove.submitSaveDialogAndClose = function (callback, modal) {
|
||||
var $form = $('#save_page');
|
||||
var name = $form.find('input[name="selected_value"]').val().trim();
|
||||
if (name === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strEnterValidPageName, false);
|
||||
ajaxShowMessage(window.Messages.strEnterValidPageName, false);
|
||||
return;
|
||||
}
|
||||
modal.modal('hide');
|
||||
|
||||
if (window.designerTablesEnabled) {
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize() + DesignerMove.getUrlPos(), function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
DesignerMove.markSaved();
|
||||
if (data.id) {
|
||||
window.selectedPage = data.id;
|
||||
@ -886,7 +887,7 @@ DesignerMove.save3 = function (callback) {
|
||||
// ------------------------------ EDIT PAGES ------------------------------------------
|
||||
DesignerMove.editPages = function () {
|
||||
DesignerMove.promptToSaveCurrentPage(function () {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post('index.php?route=/database/designer', {
|
||||
'ajax_request': true,
|
||||
'server': window.server,
|
||||
@ -894,9 +895,9 @@ DesignerMove.editPages = function () {
|
||||
'dialog': 'edit'
|
||||
}, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
|
||||
if (! window.designerTablesEnabled) {
|
||||
DesignerPage.createPageList(window.db, function (options) {
|
||||
@ -908,7 +909,7 @@ DesignerMove.editPages = function () {
|
||||
var $form = $('#edit_delete_pages');
|
||||
var selected = $form.find('select[name="selected_page"]').val();
|
||||
if (selected === '0') {
|
||||
Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -923,7 +924,7 @@ DesignerMove.editPages = function () {
|
||||
|
||||
// ----------------------------- DELETE PAGES ---------------------------------------
|
||||
DesignerMove.deletePages = function () {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post('index.php?route=/database/designer', {
|
||||
'ajax_request': true,
|
||||
'server': window.server,
|
||||
@ -931,9 +932,9 @@ DesignerMove.deletePages = function () {
|
||||
'dialog': 'delete'
|
||||
}, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
|
||||
if (! window.designerTablesEnabled) {
|
||||
DesignerPage.createPageList(window.db, function (options) {
|
||||
@ -946,37 +947,37 @@ DesignerMove.deletePages = function () {
|
||||
var $form = $('#edit_delete_pages');
|
||||
var selected = $form.find('select[name="selected_page"]').val();
|
||||
if (selected === '0') {
|
||||
Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
return;
|
||||
}
|
||||
|
||||
var $messageBox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $messageBox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var deletingCurrentPage = parseInt(selected) === window.selectedPage;
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
|
||||
if (window.designerTablesEnabled) {
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($messageBox);
|
||||
ajaxRemoveMessage($messageBox);
|
||||
if (deletingCurrentPage) {
|
||||
DesignerMove.loadPage(null);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strSuccessfulPageDelete);
|
||||
ajaxShowMessage(window.Messages.strSuccessfulPageDelete);
|
||||
}
|
||||
}
|
||||
}); // end $.post()
|
||||
} else {
|
||||
DesignerPage.deletePage(selected, function (success) {
|
||||
if (! success) {
|
||||
Functions.ajaxShowMessage('Error', false);
|
||||
ajaxShowMessage('Error', false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($messageBox);
|
||||
ajaxRemoveMessage($messageBox);
|
||||
if (deletingCurrentPage) {
|
||||
DesignerMove.loadPage(null);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strSuccessfulPageDelete);
|
||||
ajaxShowMessage(window.Messages.strSuccessfulPageDelete);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -991,7 +992,7 @@ DesignerMove.deletePages = function () {
|
||||
|
||||
// ------------------------------ SAVE AS PAGES ---------------------------------------
|
||||
DesignerMove.saveAs = function () {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post('index.php?route=/database/designer', {
|
||||
'ajax_request': true,
|
||||
'server': window.server,
|
||||
@ -999,9 +1000,9 @@ DesignerMove.saveAs = function () {
|
||||
'dialog': 'save_as'
|
||||
}, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
|
||||
if (! window.designerTablesEnabled) {
|
||||
DesignerPage.createPageList(window.db, function (options) {
|
||||
@ -1019,26 +1020,26 @@ DesignerMove.saveAs = function () {
|
||||
|
||||
if (choice === 'same') {
|
||||
if ($selectedPage.val() === '0') {
|
||||
Functions.ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
ajaxShowMessage(window.Messages.strSelectPage, 2000);
|
||||
return;
|
||||
}
|
||||
name = $selectedPage.find('option:selected').text();
|
||||
} else if (choice === 'new') {
|
||||
if (selectedValue === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strEnterValidPageName, 2000);
|
||||
ajaxShowMessage(window.Messages.strEnterValidPageName, 2000);
|
||||
return;
|
||||
}
|
||||
name = selectedValue;
|
||||
}
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
if (window.designerTablesEnabled) {
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize() + DesignerMove.getUrlPos(), function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
DesignerMove.markSaved();
|
||||
if (data.id) {
|
||||
window.selectedPage = data.id;
|
||||
@ -1050,7 +1051,7 @@ DesignerMove.saveAs = function () {
|
||||
if (choice === 'same') {
|
||||
var selectedPageId = $selectedPage.find('option:selected').val();
|
||||
DesignerPage.saveToSelectedPage(window.db, selectedPageId, name, DesignerMove.getUrlPos(), function (page) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
DesignerMove.markSaved();
|
||||
if (page.pgNr) {
|
||||
window.selectedPage = page.pgNr;
|
||||
@ -1059,7 +1060,7 @@ DesignerMove.saveAs = function () {
|
||||
});
|
||||
} else if (choice === 'new') {
|
||||
DesignerPage.saveToNewPage(window.db, name, DesignerMove.getUrlPos(), function (page) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
DesignerMove.markSaved();
|
||||
if (page.pgNr) {
|
||||
window.selectedPage = page.pgNr;
|
||||
@ -1099,7 +1100,7 @@ DesignerMove.promptToSaveCurrentPage = function (callback) {
|
||||
|
||||
// ------------------------------ EXPORT PAGES ---------------------------------------
|
||||
DesignerMove.exportPages = function () {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
|
||||
$.post('index.php?route=/database/designer', {
|
||||
@ -1110,9 +1111,9 @@ DesignerMove.exportPages = function () {
|
||||
'selected_page': window.selectedPage
|
||||
}, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
|
||||
var $form = $(data.message);
|
||||
if (! window.designerTablesEnabled) {
|
||||
@ -1204,7 +1205,7 @@ DesignerMove.saveValueInConfig = function (indexSent, valueSent) {
|
||||
},
|
||||
function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -1296,7 +1297,7 @@ DesignerMove.clickField = function (db, T, f, pk) {
|
||||
document.getElementById('designer_hint').style.display = 'none';
|
||||
document.getElementById('display_field_button').className = 'M_butt';
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/database/designer',
|
||||
{
|
||||
'operation': 'setDisplayField',
|
||||
@ -1308,10 +1309,10 @@ DesignerMove.clickField = function (db, T, f, pk) {
|
||||
},
|
||||
function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
Functions.ajaxShowMessage(window.Messages.strModificationSaved);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
ajaxShowMessage(window.Messages.strModificationSaved);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -1324,13 +1325,13 @@ DesignerMove.newRelation = function () {
|
||||
linkRelation += argsep + 'on_delete=' + document.getElementById('on_delete').value + argsep + 'on_update=' + document.getElementById('on_update').value;
|
||||
linkRelation += argsep + 'operation=addNewRelation' + argsep + 'ajax_request=true';
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/database/designer', linkRelation, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
ajaxShowMessage(data.message);
|
||||
DesignerMove.loadPage(window.selectedPage);
|
||||
}
|
||||
}); // end $.post()
|
||||
@ -1550,13 +1551,13 @@ DesignerMove.updRelation = function () {
|
||||
linkRelation += argsep + 'server=' + window.server + argsep + 'db=' + window.db;
|
||||
linkRelation += argsep + 'operation=removeRelation' + argsep + 'ajax_request=true';
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/database/designer', linkRelation, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
ajaxShowMessage(data.message);
|
||||
DesignerMove.loadPage(window.selectedPage);
|
||||
}
|
||||
}); // end $.post()
|
||||
@ -1913,7 +1914,7 @@ DesignerMove.addObject = function (dbName, tableName, colName, dbTableNameUrl) {
|
||||
var init = historyArray.length;
|
||||
if (rel.value !== '--') {
|
||||
if (document.getElementById('Query').value === '') {
|
||||
Functions.ajaxShowMessage(window.sprintf(window.Messages.strQueryEmpty));
|
||||
ajaxShowMessage(window.sprintf(window.Messages.strQueryEmpty));
|
||||
return;
|
||||
}
|
||||
p = document.getElementById('Query');
|
||||
@ -1956,7 +1957,7 @@ DesignerMove.addObject = function (dbName, tableName, colName, dbTableNameUrl) {
|
||||
sum = sum + 1;
|
||||
// make orderby
|
||||
}
|
||||
Functions.ajaxShowMessage(window.sprintf(window.Messages.strObjectsCreated, sum));
|
||||
ajaxShowMessage(window.sprintf(window.Messages.strObjectsCreated, sum));
|
||||
// output sum new objects created
|
||||
var existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = DesignerHistory.display(init, historyArray.length);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/* global DesignerOfflineDB */ // js/designer/database.js
|
||||
/* global DesignerMove */ // js/designer/move.js
|
||||
@ -151,7 +152,7 @@ DesignerPage.loadHtmlForPage = function (pageId) {
|
||||
DesignerMove.markSaved();
|
||||
if (tableMissing === true) {
|
||||
DesignerMove.markUnsaved();
|
||||
Functions.ajaxShowMessage(window.Messages.strSavedPageTableMissing);
|
||||
ajaxShowMessage(window.Messages.strSavedPageTableMissing);
|
||||
}
|
||||
window.selectedPage = page.pgNr;
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* general function, usually for data manipulation pages
|
||||
@ -29,7 +30,7 @@ var ErrorReport = {
|
||||
*/
|
||||
errorDataHandler: function (data, exception) {
|
||||
if (data.success !== true) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
if (data.report_setting === 'ask') {
|
||||
@ -43,9 +44,9 @@ var ErrorReport = {
|
||||
$.post('index.php?route=/error-report', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
// in the case of an error, show the error message returned.
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.message, false);
|
||||
ajaxShowMessage(data.message, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -91,9 +92,9 @@ var ErrorReport = {
|
||||
});
|
||||
$.post('index.php?route=/error-report', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.message, 3000);
|
||||
ajaxShowMessage(data.message, 3000);
|
||||
}
|
||||
});
|
||||
$('#errorReportModal').modal('hide');
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import highlightSql from './modules/sql-highlight.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Functions used in the export tab
|
||||
@ -88,7 +89,7 @@ Export.createTemplate = function (name) {
|
||||
'templateData': JSON.stringify(templateData)
|
||||
};
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
$.post('index.php?route=/export/template/create', params, function (response) {
|
||||
if (response.success === true) {
|
||||
$('#templateName').val('');
|
||||
@ -98,9 +99,9 @@ Export.createTemplate = function (name) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
Functions.ajaxShowMessage(window.Messages.strTemplateCreated);
|
||||
ajaxShowMessage(window.Messages.strTemplateCreated);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -120,7 +121,7 @@ Export.loadTemplate = function (id) {
|
||||
'templateId': id,
|
||||
};
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
$.post('index.php?route=/export/template/load', params, function (response) {
|
||||
if (response.success === true) {
|
||||
var $form = $('form[name="dump"]');
|
||||
@ -145,9 +146,9 @@ Export.loadTemplate = function (id) {
|
||||
}
|
||||
});
|
||||
$('input[name="template_id"]').val(id);
|
||||
Functions.ajaxShowMessage(window.Messages.strTemplateLoaded);
|
||||
ajaxShowMessage(window.Messages.strTemplateLoaded);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -170,12 +171,12 @@ Export.updateTemplate = function (id) {
|
||||
'templateData': JSON.stringify(templateData)
|
||||
};
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
$.post('index.php?route=/export/template/update', params, function (response) {
|
||||
if (response.success === true) {
|
||||
Functions.ajaxShowMessage(window.Messages.strTemplateUpdated);
|
||||
ajaxShowMessage(window.Messages.strTemplateUpdated);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -195,13 +196,13 @@ Export.deleteTemplate = function (id) {
|
||||
'templateId': id,
|
||||
};
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
$.post('index.php?route=/export/template/delete', params, function (response) {
|
||||
if (response.success === true) {
|
||||
$('#template').find('option[value="' + id + '"]').remove();
|
||||
Functions.ajaxShowMessage(window.Messages.strTemplateDeleted);
|
||||
ajaxShowMessage(window.Messages.strTemplateDeleted);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -765,7 +766,7 @@ Export.checkTimeOut = function (timeLimit) {
|
||||
timeOut = setTimeout(function () {
|
||||
$.get('index.php?route=/export/check-time-out', { 'ajax_request': true }, function (data) {
|
||||
if (data.message === 'timeout') {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' +
|
||||
window.Messages.strTimeOutError +
|
||||
'</div>',
|
||||
@ -809,7 +810,7 @@ Export.createAliasModal = function (event) {
|
||||
$('#db_alias_select').append(option);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -927,7 +928,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
$('#table_alias_select').append(option);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -952,7 +953,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
$('#column_alias_select').append(option);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error, false);
|
||||
ajaxShowMessage(response.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview functions used in GIS data editor
|
||||
@ -153,7 +153,7 @@ function loadGISEditor (value, field, type, inputName) {
|
||||
initGISEditorVisualization();
|
||||
prepareJSVersion();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
@ -205,7 +205,7 @@ function insertDataAndClose () {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('input[name=\'' + inputName + '\']').val(data.result);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json');
|
||||
closeGISEditor();
|
||||
@ -259,7 +259,7 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
eval(data.openLayers);
|
||||
initGISEditorVisualization();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
@ -278,7 +278,7 @@ AJAX.registerOnload('gis_data_editor.js', function () {
|
||||
initGISEditorVisualization();
|
||||
prepareJSVersion();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json');
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { Navigation } from './modules/navigation.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/* global themeImagePath */ // templates/javascript/variables.twig
|
||||
|
||||
@ -79,19 +80,19 @@ AJAX.registerOnload('import.js', function () {
|
||||
|
||||
if (radioImport.hasClass('active') && $('#input_import_file').val() === '') {
|
||||
$('#input_import_file').trigger('focus');
|
||||
Functions.ajaxShowMessage(fileMsg, false);
|
||||
ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radioLocalImport.hasClass('active')) {
|
||||
if ($('#select_local_import_file').length === 0) {
|
||||
Functions.ajaxShowMessage('<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strNoImportFile + ' </div>', false);
|
||||
ajaxShowMessage('<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strNoImportFile + ' </div>', false);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($('#select_local_import_file').val() === '') {
|
||||
$('#select_local_import_file').trigger('focus');
|
||||
Functions.ajaxShowMessage(fileMsg, false);
|
||||
ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -99,20 +100,20 @@ AJAX.registerOnload('import.js', function () {
|
||||
// local upload.
|
||||
if ($('#input_import_file').val() === '') {
|
||||
$('#input_import_file').trigger('focus');
|
||||
Functions.ajaxShowMessage(fileMsg, false);
|
||||
ajaxShowMessage(fileMsg, false);
|
||||
return false;
|
||||
}
|
||||
if ($('#text_csv_new_tbl_name').length > 0) {
|
||||
var newTblName = $('#text_csv_new_tbl_name').val();
|
||||
if (newTblName.length > 0 && newTblName.trim().length === 0) {
|
||||
Functions.ajaxShowMessage(wrongTblNameMsg, false);
|
||||
ajaxShowMessage(wrongTblNameMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($('#text_csv_new_db_name').length > 0) {
|
||||
var newDBName = $('#text_csv_new_db_name').val();
|
||||
if (newDBName.length > 0 && newDBName.trim().length === 0) {
|
||||
Functions.ajaxShowMessage(wrongDBNameMsg, false);
|
||||
ajaxShowMessage(wrongDBNameMsg, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import tooltip from './modules/tooltip.js';
|
||||
import highlightSql from './modules/sql-highlight.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/* global Sql */
|
||||
/* global firstDayOfCalendar */ // templates/javascript/variables.twig
|
||||
@ -410,7 +411,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
var $tempDiv = $(document.createElement('div'));
|
||||
$tempDiv.html(data.error);
|
||||
$tempDiv.addClass('alert alert-danger');
|
||||
Functions.ajaxShowMessage($tempDiv, false);
|
||||
ajaxShowMessage($tempDiv, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -967,7 +968,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
g.lastXHR = $.post('index.php?route=/sql/get-enum-values', postParams, function (data) {
|
||||
g.lastXHR = null;
|
||||
if (typeof data === 'object' && data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, undefined, 'error');
|
||||
ajaxShowMessage(data.error, undefined, 'error');
|
||||
return;
|
||||
}
|
||||
$editArea.removeClass('edit_area_loading');
|
||||
@ -1009,7 +1010,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
g.lastXHR = $.post('index.php?route=/sql/get-set-values', postParams, function (data) {
|
||||
g.lastXHR = null;
|
||||
if (typeof data === 'object' && data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error, undefined, 'error');
|
||||
ajaxShowMessage(data.error, undefined, 'error');
|
||||
return;
|
||||
}
|
||||
$editArea.removeClass('edit_area_loading');
|
||||
@ -1069,7 +1070,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
$td.data('original_data', data.value);
|
||||
$(g.cEdit).find('.edit_box').val(data.value);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}
|
||||
@ -1373,7 +1374,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
}
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if (typeof options === 'undefined' || ! options.move) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
|
||||
// update where_clause related data in each edited row
|
||||
@ -1442,7 +1443,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
|
||||
g.isCellEdited = false;
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
if (! g.saveCellsAtOnce) {
|
||||
$(g.t).find('.to_be_saved')
|
||||
.removeClass('to_be_saved');
|
||||
@ -1512,7 +1513,7 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
thisFieldParams[fieldName] = $(g.cEdit).find('.edit_box').val();
|
||||
} else {
|
||||
var hexError = '<div class="alert alert-danger" role="alert">' + window.Messages.strEnterValidHex + '</div>';
|
||||
Functions.ajaxShowMessage(hexError, false);
|
||||
ajaxShowMessage(hexError, false);
|
||||
thisFieldParams[fieldName] = Functions.getCellValue(g.currentEditCell);
|
||||
}
|
||||
} else {
|
||||
@ -1676,9 +1677,9 @@ window.makeGrid = function (t, enableResize, enableReorder, enableVisib, enableG
|
||||
e.preventDefault();
|
||||
var res = Functions.copyToClipboard($(this).data('column'));
|
||||
if (res) {
|
||||
Functions.ajaxShowMessage(window.Messages.strCopyColumnSuccess, false, 'success');
|
||||
ajaxShowMessage(window.Messages.strCopyColumnSuccess, false, 'success');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strCopyColumnFailure, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strCopyColumnFailure, false, 'error');
|
||||
}
|
||||
});
|
||||
$(g.t).find('th.draggable a')
|
||||
|
||||
166
js/src/modules/ajax-message.js
Normal file
166
js/src/modules/ajax-message.js
Normal file
@ -0,0 +1,166 @@
|
||||
import $ from 'jquery';
|
||||
import tooltip from './tooltip.js';
|
||||
import highlightSql from './sql-highlight.js';
|
||||
|
||||
/**
|
||||
* Number of AJAX messages shown since page load.
|
||||
* @type {number}
|
||||
*/
|
||||
let ajaxMessageCount = 0;
|
||||
|
||||
/**
|
||||
* Show a message on the top of the page for an Ajax request
|
||||
*
|
||||
* Sample usage:
|
||||
*
|
||||
* 1) var $msg = ajaxShowMessage();
|
||||
* This will show a message that reads "Loading...". Such a message will not
|
||||
* disappear automatically and cannot be dismissed by the user. To remove this
|
||||
* message either the ajaxRemoveMessage($msg) function must be called or
|
||||
* another message must be show with ajaxShowMessage() function.
|
||||
*
|
||||
* 2) var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
* This is a special case. The behaviour is same as above,
|
||||
* just with a different message
|
||||
*
|
||||
* 3) var $msg = ajaxShowMessage('The operation was successful');
|
||||
* This will show a message that will disappear automatically and it can also
|
||||
* be dismissed by the user.
|
||||
*
|
||||
* 4) var $msg = ajaxShowMessage('Some error', false);
|
||||
* This will show a message that will not disappear automatically, but it
|
||||
* can be dismissed by the user after they have finished reading it.
|
||||
*
|
||||
* @param {string|null} message string containing the message to be shown.
|
||||
* optional, defaults to 'Loading...'
|
||||
* @param {any} timeout number of milliseconds for the message to be visible
|
||||
* optional, defaults to 5000. If set to 'false', the
|
||||
* notification will never disappear
|
||||
* @param {string|null} type string to dictate the type of message shown.
|
||||
* optional, defaults to normal notification.
|
||||
* If set to 'error', the notification will show message
|
||||
* with red background.
|
||||
* If set to 'success', the notification will show with
|
||||
* a green background.
|
||||
* @return {JQuery<Element>} jQuery Element that holds the message div
|
||||
* this object can be passed to ajaxRemoveMessage()
|
||||
* to remove the notification
|
||||
*/
|
||||
const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
var msg = message;
|
||||
var newTimeOut = timeout;
|
||||
/**
|
||||
* @var self_closing Whether the notification will automatically disappear
|
||||
*/
|
||||
var selfClosing = true;
|
||||
/**
|
||||
* @var dismissable Whether the user will be able to remove
|
||||
* the notification by clicking on it
|
||||
*/
|
||||
var dismissable = true;
|
||||
// Handle the case when a empty data.message is passed.
|
||||
// We don't want the empty message
|
||||
if (msg === '') {
|
||||
return true;
|
||||
} else if (! msg) {
|
||||
// If the message is undefined, show the default
|
||||
msg = window.Messages.strLoading;
|
||||
dismissable = false;
|
||||
selfClosing = false;
|
||||
} else if (msg === window.Messages.strProcessingRequest) {
|
||||
// This is another case where the message should not disappear
|
||||
dismissable = false;
|
||||
selfClosing = false;
|
||||
}
|
||||
// Figure out whether (or after how long) to remove the notification
|
||||
if (newTimeOut === undefined || newTimeOut === null) {
|
||||
newTimeOut = 5000;
|
||||
} else if (newTimeOut === false) {
|
||||
selfClosing = false;
|
||||
}
|
||||
// Determine type of message, add styling as required
|
||||
if (type === 'error') {
|
||||
msg = '<div class="alert alert-danger" role="alert">' + msg + '</div>';
|
||||
} else if (type === 'success') {
|
||||
msg = '<div class="alert alert-success" role="alert">' + msg + '</div>';
|
||||
}
|
||||
// Create a parent element for the AJAX messages, if necessary
|
||||
if ($('#loading_parent').length === 0) {
|
||||
$('<div id="loading_parent"></div>')
|
||||
.prependTo('#page_content');
|
||||
}
|
||||
// Update message count to create distinct message elements every time
|
||||
ajaxMessageCount++;
|
||||
// Remove all old messages, if any
|
||||
$('span.ajax_notification[id^=ajax_message_num]').remove();
|
||||
/**
|
||||
* @var $retval a jQuery object containing the reference
|
||||
* to the created AJAX message
|
||||
*/
|
||||
var $retval = $(
|
||||
'<span class="ajax_notification" id="ajax_message_num_' +
|
||||
ajaxMessageCount +
|
||||
'"></span>'
|
||||
)
|
||||
.hide()
|
||||
.appendTo('#loading_parent')
|
||||
.html(msg)
|
||||
.show();
|
||||
// If the notification is self-closing we should create a callback to remove it
|
||||
if (selfClosing) {
|
||||
$retval
|
||||
.delay(newTimeOut)
|
||||
.fadeOut('medium', function () {
|
||||
if ($(this).is(':data(tooltip)')) {
|
||||
$(this).uiTooltip('destroy');
|
||||
}
|
||||
// Remove the notification
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
// If the notification is dismissable we need to add the relevant class to it
|
||||
// and add a tooltip so that the users know that it can be removed
|
||||
if (dismissable) {
|
||||
$retval.addClass('dismissable').css('cursor', 'pointer');
|
||||
/**
|
||||
* Add a tooltip to the notification to let the user know that they
|
||||
* can dismiss the ajax notification by clicking on it.
|
||||
*/
|
||||
tooltip($retval, 'span', window.Messages.strDismiss);
|
||||
}
|
||||
// Hide spinner if this is not a loading message
|
||||
if (msg !== window.Messages.strLoading) {
|
||||
$retval.css('background-image', 'none');
|
||||
}
|
||||
highlightSql($retval);
|
||||
|
||||
return $retval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the message shown for an Ajax operation when it's completed
|
||||
*
|
||||
* @param {JQuery} $thisMessageBox Element that holds the notification
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
const ajaxRemoveMessage = function ($thisMessageBox) {
|
||||
if ($thisMessageBox !== undefined && $thisMessageBox instanceof $) {
|
||||
$thisMessageBox
|
||||
.stop(true, true)
|
||||
.fadeOut('medium');
|
||||
if ($thisMessageBox.is(':data(tooltip)')) {
|
||||
$thisMessageBox.uiTooltip('destroy');
|
||||
} else {
|
||||
$thisMessageBox.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
window.getAjaxMessageCount = () => ajaxMessageCount;
|
||||
window.ajaxShowMessage = ajaxShowMessage;
|
||||
|
||||
export { ajaxShowMessage, ajaxRemoveMessage };
|
||||
@ -3,6 +3,7 @@ import { Functions } from './functions.js';
|
||||
import { Navigation } from './navigation.js';
|
||||
import { CommonParams } from './common.js';
|
||||
import highlightSql from './sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.js';
|
||||
|
||||
/**
|
||||
* This object handles ajax requests for pages. It also
|
||||
@ -40,7 +41,7 @@ const AJAX = {
|
||||
debug: false,
|
||||
/**
|
||||
* @var {object} $msgbox A reference to a jQuery object that links to a message
|
||||
* box that is generated by Functions.ajaxShowMessage()
|
||||
* box that is generated by ajaxShowMessage()
|
||||
*/
|
||||
$msgbox: null,
|
||||
/**
|
||||
@ -284,7 +285,7 @@ const AJAX = {
|
||||
AJAX.xhr.abort();
|
||||
if (AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') {
|
||||
// If aborted
|
||||
AJAX.$msgbox = Functions.ajaxShowMessage(window.Messages.strAbortedRequest);
|
||||
AJAX.$msgbox = ajaxShowMessage(window.Messages.strAbortedRequest);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
previousLinkAborted = true;
|
||||
@ -320,7 +321,7 @@ const AJAX = {
|
||||
|
||||
if (isLink) {
|
||||
AJAX.active = true;
|
||||
AJAX.$msgbox = Functions.ajaxShowMessage();
|
||||
AJAX.$msgbox = ajaxShowMessage();
|
||||
// Save reference for the new link request
|
||||
AJAX.xhr = $.get(url, params, AJAX.responseHandler);
|
||||
var state = {
|
||||
@ -344,7 +345,7 @@ const AJAX = {
|
||||
// or if it returns a value that evaluates to true
|
||||
if (typeof onsubmit !== 'function' || onsubmit.apply(this, [event])) {
|
||||
AJAX.active = true;
|
||||
AJAX.$msgbox = Functions.ajaxShowMessage();
|
||||
AJAX.$msgbox = ajaxShowMessage();
|
||||
if ($(this).attr('id') === 'login_form') {
|
||||
$.post(url, params, AJAX.loginResponseHandler);
|
||||
} else {
|
||||
@ -367,7 +368,7 @@ const AJAX = {
|
||||
if (typeof data === 'undefined' || data === null) {
|
||||
return;
|
||||
}
|
||||
Functions.ajaxRemoveMessage(AJAX.$msgbox);
|
||||
ajaxRemoveMessage(AJAX.$msgbox);
|
||||
|
||||
CommonParams.set('token', data.new_token);
|
||||
|
||||
@ -403,7 +404,7 @@ const AJAX = {
|
||||
data.stopErrorReportLoop !== '1'
|
||||
) {
|
||||
$('#pma_report_errors_form').trigger('submit');
|
||||
Functions.ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false);
|
||||
ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false);
|
||||
$('html, body').animate({ scrollTop: $(document).height() }, 'slow');
|
||||
} else if (data.promptPhpErrors) {
|
||||
// otherwise just prompt user if it is set so.
|
||||
@ -413,7 +414,7 @@ const AJAX = {
|
||||
}
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage(msg, false);
|
||||
ajaxShowMessage(msg, false);
|
||||
// bind for php error reporting forms (popup)
|
||||
$('#pma_ignore_errors_popup').on('click', function () {
|
||||
Functions.ignorePhpErrors();
|
||||
@ -426,7 +427,7 @@ const AJAX = {
|
||||
// reload page if user trying to login has changed
|
||||
if (CommonParams.get('user') !== data.params.user) {
|
||||
window.location = 'index.php';
|
||||
Functions.ajaxShowMessage(window.Messages.strLoading, false);
|
||||
ajaxShowMessage(window.Messages.strLoading, false);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
return;
|
||||
@ -446,7 +447,7 @@ const AJAX = {
|
||||
} else if (typeof data.logged_in !== 'undefined' && data.logged_in === 0) {
|
||||
$('#modalOverlay').replaceWith(data.error);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
Functions.handleRedirectAndReload(data);
|
||||
@ -475,18 +476,18 @@ const AJAX = {
|
||||
}
|
||||
// Can be a string when an error occurred and only HTML was returned.
|
||||
if (typeof data === 'string') {
|
||||
Functions.ajaxRemoveMessage(AJAX.$msgbox);
|
||||
Functions.ajaxShowMessage($(data).text(), false, 'error');
|
||||
ajaxRemoveMessage(AJAX.$msgbox);
|
||||
ajaxShowMessage($(data).text(), false, 'error');
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
return;
|
||||
}
|
||||
if (typeof data.success !== 'undefined' && data.success) {
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
Functions.ajaxRemoveMessage(AJAX.$msgbox);
|
||||
ajaxRemoveMessage(AJAX.$msgbox);
|
||||
|
||||
if (data.redirect) {
|
||||
Functions.ajaxShowMessage(data.redirect, false);
|
||||
ajaxShowMessage(data.redirect, false);
|
||||
AJAX.active = false;
|
||||
AJAX.xhr = null;
|
||||
return;
|
||||
@ -586,7 +587,7 @@ const AJAX = {
|
||||
data.stopErrorReportLoop !== '1'
|
||||
) {
|
||||
$('#pma_report_errors_form').trigger('submit');
|
||||
Functions.ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false);
|
||||
ajaxShowMessage(window.Messages.phpErrorsBeingSubmitted, false);
|
||||
$('html, body').animate({ scrollTop: $(document).height() }, 'slow');
|
||||
} else if (data.promptPhpErrors) {
|
||||
// otherwise just prompt user if it is set so.
|
||||
@ -595,7 +596,7 @@ const AJAX = {
|
||||
$('html, body').animate({ scrollTop: $(document).height() }, 'slow');
|
||||
}
|
||||
}
|
||||
Functions.ajaxShowMessage(msg, false);
|
||||
ajaxShowMessage(msg, false);
|
||||
// bind for php error reporting forms (popup)
|
||||
$('#pma_ignore_errors_popup').on('click', function () {
|
||||
Functions.ignorePhpErrors();
|
||||
@ -611,8 +612,8 @@ const AJAX = {
|
||||
};
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
Functions.ajaxRemoveMessage(AJAX.$msgbox);
|
||||
ajaxShowMessage(data.error, false);
|
||||
ajaxRemoveMessage(AJAX.$msgbox);
|
||||
var $ajaxError = $('<div></div>');
|
||||
$ajaxError.attr({ 'id': 'ajaxError' });
|
||||
$('#page_content').append($ajaxError);
|
||||
@ -878,7 +879,7 @@ const AJAX = {
|
||||
}
|
||||
var state = event.originalEvent.state;
|
||||
if (state && state.menu) {
|
||||
AJAX.$msgbox = Functions.ajaxShowMessage();
|
||||
AJAX.$msgbox = ajaxShowMessage();
|
||||
var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
var url = state.url || location.href;
|
||||
$.get(url, params, AJAX.responseHandler);
|
||||
@ -912,7 +913,7 @@ const AJAX = {
|
||||
'isErrorResponse' in request.responseJSON &&
|
||||
request.responseJSON.isErrorResponse
|
||||
) {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' +
|
||||
Functions.escapeHtml(request.responseJSON.error) +
|
||||
'</div>',
|
||||
@ -931,7 +932,7 @@ const AJAX = {
|
||||
if (state === 'rejected' || state === 'timeout') {
|
||||
details += '<div>' + Functions.escapeHtml(window.Messages.strErrorConnection) + '</div>';
|
||||
}
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' +
|
||||
window.Messages.strErrorProcessingRequest +
|
||||
details +
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { Functions } from './functions.js';
|
||||
import { CommonParams } from './common.js';
|
||||
import { ajaxShowMessage } from './ajax-message.js';
|
||||
|
||||
/**
|
||||
* Functions used in configuration forms and on user preferences pages
|
||||
@ -30,7 +31,7 @@ Config.isStorageSupported = (type, warn = false) => {
|
||||
} catch (error) {
|
||||
// Not supported
|
||||
if (warn) {
|
||||
Functions.ajaxShowMessage(window.Messages.strNoLocalStorage, false);
|
||||
ajaxShowMessage(window.Messages.strNoLocalStorage, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -668,7 +669,7 @@ function savePrefsToLocalStorage (form) {
|
||||
$form.hide('fast');
|
||||
$form.prev('.click-hide-message').show('fast');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
},
|
||||
complete: function () {
|
||||
|
||||
@ -6,6 +6,7 @@ import { Indexes } from './indexes.js';
|
||||
import { Config } from './config.js';
|
||||
import tooltip from './tooltip.js';
|
||||
import highlightSql from './sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.js';
|
||||
|
||||
/* global ChartType, ColumnType, DataTable, JQPlotChartFactory */ // js/chart.js
|
||||
/* global DatabaseStructure */ // js/database/structure.js
|
||||
@ -18,12 +19,6 @@ import highlightSql from './sql-highlight.js';
|
||||
const Functions = {};
|
||||
window.Functions = Functions;
|
||||
|
||||
/**
|
||||
* Number of AJAX messages shown since page load.
|
||||
* @type {number}
|
||||
*/
|
||||
let ajaxMessageCount = 0;
|
||||
|
||||
/**
|
||||
* Object containing CodeMirror editor of the query editor in SQL tab.
|
||||
* @type {(object|boolean|null)}
|
||||
@ -106,13 +101,6 @@ Functions.addNoCacheToAjaxRequests = () => function (options, originalOptions) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {number}
|
||||
*/
|
||||
Functions.getAjaxMessageCount = function () {
|
||||
return ajaxMessageCount;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a date/time picker to an element
|
||||
*
|
||||
@ -1428,155 +1416,6 @@ Functions.updateCode = function ($base, htmlValue, rawValue) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Show a message on the top of the page for an Ajax request
|
||||
*
|
||||
* Sample usage:
|
||||
*
|
||||
* 1) var $msg = Functions.ajaxShowMessage();
|
||||
* This will show a message that reads "Loading...". Such a message will not
|
||||
* disappear automatically and cannot be dismissed by the user. To remove this
|
||||
* message either the Functions.ajaxRemoveMessage($msg) function must be called or
|
||||
* another message must be show with Functions.ajaxShowMessage() function.
|
||||
*
|
||||
* 2) var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
* This is a special case. The behaviour is same as above,
|
||||
* just with a different message
|
||||
*
|
||||
* 3) var $msg = Functions.ajaxShowMessage('The operation was successful');
|
||||
* This will show a message that will disappear automatically and it can also
|
||||
* be dismissed by the user.
|
||||
*
|
||||
* 4) var $msg = Functions.ajaxShowMessage('Some error', false);
|
||||
* This will show a message that will not disappear automatically, but it
|
||||
* can be dismissed by the user after they have finished reading it.
|
||||
*
|
||||
* @param {string|null} message string containing the message to be shown.
|
||||
* optional, defaults to 'Loading...'
|
||||
* @param {any} timeout number of milliseconds for the message to be visible
|
||||
* optional, defaults to 5000. If set to 'false', the
|
||||
* notification will never disappear
|
||||
* @param {string|null} type string to dictate the type of message shown.
|
||||
* optional, defaults to normal notification.
|
||||
* If set to 'error', the notification will show message
|
||||
* with red background.
|
||||
* If set to 'success', the notification will show with
|
||||
* a green background.
|
||||
* @return {JQuery<Element>} jQuery Element that holds the message div
|
||||
* this object can be passed to Functions.ajaxRemoveMessage()
|
||||
* to remove the notification
|
||||
*/
|
||||
Functions.ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
var msg = message;
|
||||
var newTimeOut = timeout;
|
||||
/**
|
||||
* @var self_closing Whether the notification will automatically disappear
|
||||
*/
|
||||
var selfClosing = true;
|
||||
/**
|
||||
* @var dismissable Whether the user will be able to remove
|
||||
* the notification by clicking on it
|
||||
*/
|
||||
var dismissable = true;
|
||||
// Handle the case when a empty data.message is passed.
|
||||
// We don't want the empty message
|
||||
if (msg === '') {
|
||||
return true;
|
||||
} else if (! msg) {
|
||||
// If the message is undefined, show the default
|
||||
msg = window.Messages.strLoading;
|
||||
dismissable = false;
|
||||
selfClosing = false;
|
||||
} else if (msg === window.Messages.strProcessingRequest) {
|
||||
// This is another case where the message should not disappear
|
||||
dismissable = false;
|
||||
selfClosing = false;
|
||||
}
|
||||
// Figure out whether (or after how long) to remove the notification
|
||||
if (newTimeOut === undefined || newTimeOut === null) {
|
||||
newTimeOut = 5000;
|
||||
} else if (newTimeOut === false) {
|
||||
selfClosing = false;
|
||||
}
|
||||
// Determine type of message, add styling as required
|
||||
if (type === 'error') {
|
||||
msg = '<div class="alert alert-danger" role="alert">' + msg + '</div>';
|
||||
} else if (type === 'success') {
|
||||
msg = '<div class="alert alert-success" role="alert">' + msg + '</div>';
|
||||
}
|
||||
// Create a parent element for the AJAX messages, if necessary
|
||||
if ($('#loading_parent').length === 0) {
|
||||
$('<div id="loading_parent"></div>')
|
||||
.prependTo('#page_content');
|
||||
}
|
||||
// Update message count to create distinct message elements every time
|
||||
ajaxMessageCount++;
|
||||
// Remove all old messages, if any
|
||||
$('span.ajax_notification[id^=ajax_message_num]').remove();
|
||||
/**
|
||||
* @var $retval a jQuery object containing the reference
|
||||
* to the created AJAX message
|
||||
*/
|
||||
var $retval = $(
|
||||
'<span class="ajax_notification" id="ajax_message_num_' +
|
||||
ajaxMessageCount +
|
||||
'"></span>'
|
||||
)
|
||||
.hide()
|
||||
.appendTo('#loading_parent')
|
||||
.html(msg)
|
||||
.show();
|
||||
// If the notification is self-closing we should create a callback to remove it
|
||||
if (selfClosing) {
|
||||
$retval
|
||||
.delay(newTimeOut)
|
||||
.fadeOut('medium', function () {
|
||||
if ($(this).is(':data(tooltip)')) {
|
||||
$(this).uiTooltip('destroy');
|
||||
}
|
||||
// Remove the notification
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
// If the notification is dismissable we need to add the relevant class to it
|
||||
// and add a tooltip so that the users know that it can be removed
|
||||
if (dismissable) {
|
||||
$retval.addClass('dismissable').css('cursor', 'pointer');
|
||||
/**
|
||||
* Add a tooltip to the notification to let the user know that they
|
||||
* can dismiss the ajax notification by clicking on it.
|
||||
*/
|
||||
tooltip($retval, 'span', window.Messages.strDismiss);
|
||||
}
|
||||
// Hide spinner if this is not a loading message
|
||||
if (msg !== window.Messages.strLoading) {
|
||||
$retval.css('background-image', 'none');
|
||||
}
|
||||
highlightSql($retval);
|
||||
|
||||
return $retval;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the message shown for an Ajax operation when it's completed
|
||||
*
|
||||
* @param {JQuery} $thisMessageBox Element that holds the notification
|
||||
*
|
||||
* @return {void}
|
||||
*/
|
||||
Functions.ajaxRemoveMessage = function ($thisMessageBox) {
|
||||
if ($thisMessageBox !== undefined && $thisMessageBox instanceof $) {
|
||||
$thisMessageBox
|
||||
.stop(true, true)
|
||||
.fadeOut('medium');
|
||||
if ($thisMessageBox.is(':data(tooltip)')) {
|
||||
$thisMessageBox.uiTooltip('destroy');
|
||||
} else {
|
||||
$thisMessageBox.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Requests SQL for previewing before executing.
|
||||
*
|
||||
@ -1591,13 +1430,13 @@ Functions.previewSql = function ($form) {
|
||||
sep + 'do_save_data=1' +
|
||||
sep + 'preview_sql=1' +
|
||||
sep + 'ajax_request=1';
|
||||
var $messageBox = Functions.ajaxShowMessage();
|
||||
var $messageBox = ajaxShowMessage();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: formUrl,
|
||||
data: formData,
|
||||
success: function (response) {
|
||||
Functions.ajaxRemoveMessage($messageBox);
|
||||
ajaxRemoveMessage($messageBox);
|
||||
if (response.success) {
|
||||
$('#previewSqlModal').modal('show');
|
||||
$('#previewSqlModal').find('.modal-body').first().html(response.sql_data);
|
||||
@ -1606,11 +1445,11 @@ Functions.previewSql = function ($form) {
|
||||
highlightSql($('#previewSqlModal'));
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.message);
|
||||
ajaxShowMessage(response.message);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -1672,7 +1511,7 @@ Functions.checkReservedWordColumns = function ($form) {
|
||||
Functions.dismissNotifications = () => function () {
|
||||
/**
|
||||
* Allows the user to dismiss a notification
|
||||
* created with Functions.ajaxShowMessage()
|
||||
* created with ajaxShowMessage()
|
||||
*/
|
||||
var holdStarter = null;
|
||||
$(document).on('mousedown', 'span.ajax_notification.dismissable', function () {
|
||||
@ -1684,7 +1523,7 @@ Functions.dismissNotifications = () => function () {
|
||||
$(document).on('mouseup', 'span.ajax_notification.dismissable', function (event) {
|
||||
if (holdStarter && event.which === 1) {
|
||||
clearTimeout(holdStarter);
|
||||
Functions.ajaxRemoveMessage($(this));
|
||||
ajaxRemoveMessage($(this));
|
||||
}
|
||||
});
|
||||
/**
|
||||
@ -2140,14 +1979,14 @@ Functions.onloadCreateTableEvents = function () {
|
||||
if (Functions.checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) {
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
if (Functions.checkReservedWordColumns($form)) {
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
// User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#properties_message')
|
||||
.removeClass('alert-danger')
|
||||
.html('');
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
// Only if the create table dialog (distinct panel) exists
|
||||
var $createTableDialog = $('#create_table_dialog');
|
||||
if ($createTableDialog.length > 0) {
|
||||
@ -2208,7 +2047,7 @@ Functions.onloadCreateTableEvents = function () {
|
||||
argsep + 'goto=' + encodeURIComponent('index.php?route=/database/structure') + argsep + 'table=' + data.params.table + '';
|
||||
$.get(tableStructureUrl, params12, AJAX.responseHandler);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert">' + data.error + '</div>',
|
||||
false
|
||||
);
|
||||
@ -2230,7 +2069,7 @@ Functions.onloadCreateTableEvents = function () {
|
||||
*/
|
||||
var $form = $('form.create_table_form.ajax');
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
|
||||
// User wants to add more fields to the table
|
||||
@ -2241,9 +2080,9 @@ Functions.onloadCreateTableEvents = function () {
|
||||
highlightSql($pageContent);
|
||||
Functions.verifyColumnsProperties();
|
||||
Functions.hideShowConnection($('.create_table_form select[name=tbl_storage_engine]'));
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
}); // end $.post()
|
||||
}
|
||||
@ -2412,7 +2251,7 @@ Functions.onloadChangePasswordEvents = function () {
|
||||
$(document).on('click', '#change_password_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
|
||||
$('#changePasswordGoButton').on('click', function () {
|
||||
event.preventDefault();
|
||||
@ -2433,12 +2272,12 @@ Functions.onloadChangePasswordEvents = function () {
|
||||
*/
|
||||
var thisValue = $(this).val();
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.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) {
|
||||
if (typeof data === 'undefined' || data.success !== true) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2447,14 +2286,14 @@ Functions.onloadChangePasswordEvents = function () {
|
||||
highlightSql($pageContent);
|
||||
$('#change_password_dialog').hide().remove();
|
||||
$('#edit_user_dialog').dialog('close').remove();
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
}); // end $.post()
|
||||
$('#changePasswordModal').modal('hide');
|
||||
});
|
||||
|
||||
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (typeof data === 'undefined' || ! data.success) {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2470,7 +2309,7 @@ Functions.onloadChangePasswordEvents = function () {
|
||||
.find('table.table').unwrap().addClass('m-3')
|
||||
.find('input#text_pma_pw').trigger('focus');
|
||||
$('#fieldset_change_password_footer').hide();
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
Functions.displayPasswordGenerateButton();
|
||||
$('#change_password_form').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
@ -3035,7 +2874,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca
|
||||
* @var the_form object referring to the export form
|
||||
*/
|
||||
var $form = $('#index_frm');
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.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) {
|
||||
@ -3044,7 +2883,7 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca
|
||||
$sqlqueryresults.remove();
|
||||
}
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
highlightSql($('.result_query'));
|
||||
$('.result_query .alert').remove();
|
||||
/* Reload the field form*/
|
||||
@ -3073,18 +2912,18 @@ Functions.indexDialogModal = function (routeUrl, url, title, callbackSuccess, ca
|
||||
if (callbackFailure) {
|
||||
callbackFailure();
|
||||
}
|
||||
Functions.ajaxShowMessage($error, false);
|
||||
ajaxShowMessage($error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post(routeUrl, url, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === false) {
|
||||
// in the case of an error, show the error message returned.
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
// Show dialog if the request was successful
|
||||
modal.modal('show');
|
||||
modal.find('.modal-body').first().html(data.message);
|
||||
@ -3264,7 +3103,7 @@ Functions.toggleButton = function ($obj) {
|
||||
} else {
|
||||
$(this).addClass('isActive');
|
||||
}
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
var $container = $(this);
|
||||
var callback = $('span.callback', this).text();
|
||||
var operator;
|
||||
@ -3295,7 +3134,7 @@ Functions.toggleButton = function ($obj) {
|
||||
var parts = url.split('?');
|
||||
$.post(parts[0], parts[1] + '&ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$container
|
||||
.removeClass(removeClass)
|
||||
.addClass(addClass)
|
||||
@ -3305,7 +3144,7 @@ Functions.toggleButton = function ($obj) {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(callback);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
$container.removeClass('isActive');
|
||||
}
|
||||
});
|
||||
@ -3644,26 +3483,26 @@ Functions.onloadCreateView = function () {
|
||||
};
|
||||
|
||||
Functions.createViewModal = function ($this) {
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
var sep = CommonParams.get('arg_separator');
|
||||
var params = Functions.getJsConfirmCommonParam(this, $this.getPostData());
|
||||
params += sep + 'ajax_dialog=1';
|
||||
$.post($this.attr('href'), params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('#createViewModalGoButton').on('click', function () {
|
||||
if (typeof window.CodeMirror !== 'undefined') {
|
||||
window.codeMirrorEditor.save();
|
||||
}
|
||||
$msg = Functions.ajaxShowMessage();
|
||||
$msg = ajaxShowMessage();
|
||||
$.post('index.php?route=/view/create', $('#createViewModal').find('form').serialize(), function (data) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#createViewModal').modal('hide');
|
||||
$('.result_query').html(data.message);
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -3676,7 +3515,7 @@ Functions.createViewModal = function ($this) {
|
||||
});
|
||||
$('#createViewModal').modal('show');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -3921,7 +3760,7 @@ Functions.checkNumberOfFields = function () {
|
||||
var nbInputs = $(this).find(':input').length;
|
||||
if (nbInputs > maxInputVars) {
|
||||
var warning = window.sprintf(window.Messages.strTooManyInputs, maxInputVars);
|
||||
Functions.ajaxShowMessage(warning);
|
||||
ajaxShowMessage(warning);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -4155,7 +3994,7 @@ Functions.configSet = function (key, value) {
|
||||
if (data.success !== true) {
|
||||
// Try to find a message to display
|
||||
if (data.error || data.message || false) {
|
||||
Functions.ajaxShowMessage(data.error || data.message);
|
||||
ajaxShowMessage(data.error || data.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4199,7 +4038,7 @@ Functions.configGet = function (key, cached, successCallback, failureCallback) {
|
||||
if (data.success !== true) {
|
||||
// Try to find a message to display
|
||||
if (data.error || data.message || false) {
|
||||
Functions.ajaxShowMessage(data.error || data.message);
|
||||
ajaxShowMessage(data.error || data.message);
|
||||
}
|
||||
|
||||
// Call the callback if it is defined
|
||||
|
||||
@ -4,6 +4,7 @@ import { Functions } from './functions.js';
|
||||
import { Navigation } from './navigation.js';
|
||||
import { CommonActions, CommonParams } from './common.js';
|
||||
import highlightSql from './sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview function used for index manipulation pages
|
||||
@ -318,7 +319,7 @@ var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) {
|
||||
colIndex
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt=""' +
|
||||
' class="icon ic_s_error"> ' + window.Messages.strMissingColumn +
|
||||
' </div>', false
|
||||
@ -384,13 +385,13 @@ Indexes.showAddIndexDialog = function (sourceArray, arrayIndex, targetColumns, c
|
||||
$('#addIndexModalCloseButton').on('click', function () {
|
||||
$('#addIndexModal').modal('hide');
|
||||
});
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post('index.php?route=/table/indexes', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
// in the case of an error, show the error message returned.
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var $div = $('<div></div>');
|
||||
if (showDialogLocal) {
|
||||
// Show dialog if the request was successful
|
||||
@ -439,7 +440,7 @@ Indexes.showAddIndexDialog = function (sourceArray, arrayIndex, targetColumns, c
|
||||
colIndex
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt=""' +
|
||||
' class="icon ic_s_error"> ' + window.Messages.strMissingColumn +
|
||||
' </div>', false
|
||||
@ -495,7 +496,7 @@ Indexes.indexTypeSelectionDialog = function (sourceArray, indexChoice, colIndex)
|
||||
if ($('#composite_index').is(':checked')) {
|
||||
if ($('input[name="composite_with"]').length !== 0 && $('input[name="composite_with"]:checked').length === 0
|
||||
) {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title=""' +
|
||||
' alt="" class="icon ic_s_error"> ' +
|
||||
window.Messages.strFormEmpty +
|
||||
@ -592,7 +593,7 @@ Indexes.on = () => function () {
|
||||
var $form = $('#index_frm');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'do_save_data=1' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
});
|
||||
@ -631,11 +632,11 @@ Indexes.on = () => function () {
|
||||
.val();
|
||||
|
||||
Functions.confirmPreviewSql(question, $anchor.attr('href'), function (url) {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingPrimaryKeyIndex, false);
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingPrimaryKeyIndex, false);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
var $tableRef = $rowsToHide.closest('table');
|
||||
if ($rowsToHide.length === $tableRef.find('tbody > tr').length) {
|
||||
// We are about to remove all rows from the table
|
||||
@ -662,7 +663,7 @@ Indexes.on = () => function () {
|
||||
Navigation.reload();
|
||||
CommonActions.refreshMain('index.php?route=/table/structure');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import { Functions } from './functions.js';
|
||||
import { CommonParams } from './common.js';
|
||||
import { Config } from './config.js';
|
||||
import tooltip from './tooltip.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.js';
|
||||
|
||||
/**
|
||||
* function used in or for navigation panel
|
||||
@ -206,7 +207,7 @@ Navigation.loadChildNodes = function (isNode, $expandElem, callback) {
|
||||
$throbber.hide();
|
||||
var $icon = $expandElem.find('img.ic_b_plus');
|
||||
$icon.show();
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -467,7 +468,7 @@ Navigation.onload = () => function () {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -476,17 +477,17 @@ Navigation.onload = () => function () {
|
||||
/** Display a dialog to choose hidden navigation items to show */
|
||||
$(document).on('click', 'a.showUnhide.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true';
|
||||
$.post($(this).attr('href'), params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
$('#unhideNavItemModal').modal('show');
|
||||
$('#unhideNavItemModal').find('.modal-body').first().html(data.message);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -497,7 +498,7 @@ Navigation.onload = () => function () {
|
||||
var $tr = $(this).parents('tr');
|
||||
var $hiddenTableCount = $tr.parents('tbody').children().length;
|
||||
var $hideDialogBox = $tr.closest('div.ui-dialog');
|
||||
var $msg = Functions.ajaxShowMessage();
|
||||
var $msg = ajaxShowMessage();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true' + argSep + 'server=' + CommonParams.get('server');
|
||||
@ -506,7 +507,7 @@ Navigation.onload = () => function () {
|
||||
data: params,
|
||||
url: $(this).attr('href'),
|
||||
success: function (data) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$tr.remove();
|
||||
if ($hiddenTableCount === 1) {
|
||||
@ -514,7 +515,7 @@ Navigation.onload = () => function () {
|
||||
}
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -553,7 +554,7 @@ Navigation.onload = () => function () {
|
||||
window.localStorage.favoriteTables = data.favoriteTables;
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -628,7 +629,7 @@ Navigation.expandTreeNode = function ($expandElem, callback) {
|
||||
}
|
||||
Navigation.showFullName($destination);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
$icon.show();
|
||||
$throbber.remove();
|
||||
@ -905,7 +906,7 @@ Navigation.ensureSettings = function (selflink) {
|
||||
Config.setupValidation();
|
||||
$('#pma_navigation_settings').find('form').attr('action', selflink);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -950,7 +951,7 @@ Navigation.reload = function (callback, paths) {
|
||||
}
|
||||
Navigation.treeStateUpdate();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -982,7 +983,7 @@ Navigation.selectCurrentDatabase = function () {
|
||||
* @return {void}
|
||||
*/
|
||||
Navigation.treePagination = function ($this) {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
|
||||
var url = 'index.php?route=/navigation';
|
||||
var params = 'ajax_request=true';
|
||||
@ -1005,7 +1006,7 @@ Navigation.treePagination = function ($this) {
|
||||
}
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var val;
|
||||
if (isDbSelector) {
|
||||
val = Navigation.FastFilter.getSearchClause();
|
||||
@ -1035,7 +1036,7 @@ Navigation.treePagination = function ($this) {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
Functions.handleRedirectAndReload(data);
|
||||
}
|
||||
Navigation.treeStateUpdate();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview Implements the shiftkey + click remove column
|
||||
@ -19,13 +19,13 @@ AJAX.registerOnload('multi_column_sort.js', function () {
|
||||
if (event.ctrlKey || event.altKey) {
|
||||
event.preventDefault();
|
||||
AJAX.source = $(this);
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
orderUrlRemove += argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
$.post('index.php?route=/sql', orderUrlRemove, AJAX.responseHandler);
|
||||
} else if (event.shiftKey) {
|
||||
event.preventDefault();
|
||||
AJAX.source = $(this);
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
orderUrlAdd += argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
$.post('index.php?route=/sql', orderUrlAdd, AJAX.responseHandler);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { CommonParams } from './modules/common.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview events handling from normalization page
|
||||
@ -244,11 +245,11 @@ function goTo2NFFinish (pd) {
|
||||
$('#mainContent #extra').html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.extra, false);
|
||||
ajaxShowMessage(data.extra, false);
|
||||
}
|
||||
$('#pma_navigation_reload').trigger('click');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -284,11 +285,11 @@ function goTo3NFFinish (newTables) {
|
||||
$('#mainContent #extra').html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.extra, false);
|
||||
ajaxShowMessage(data.extra, false);
|
||||
}
|
||||
$('#pma_navigation_reload').trigger('click');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -330,7 +331,7 @@ function goTo2NFStep2 (pd, primaryKey) {
|
||||
if (data.success === true) {
|
||||
extra += data.message;
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -380,7 +381,7 @@ function goTo3NFStep2 (pd, tablesTds) {
|
||||
if (data.success === true) {
|
||||
extra += dataParsed.html;
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -477,10 +478,10 @@ function moveRepeatingGroup (repeatingCols) {
|
||||
if (data.queryError === false) {
|
||||
goToStep3();
|
||||
}
|
||||
Functions.ajaxShowMessage(data.message, false);
|
||||
ajaxShowMessage(data.message, false);
|
||||
$('#pma_navigation_reload').trigger('click');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -585,13 +586,13 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
$('#newCols').html('');
|
||||
$('.tblFooters').html('');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
selectedCol = '';
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -632,7 +633,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
})
|
||||
.appendTo('.tblFooters');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -653,7 +654,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
goToStep3();
|
||||
}, 2000);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -677,7 +678,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
if (data.success === true) {
|
||||
goToStep2('goToFinish1NF');
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview Javascript functions used in server replication page
|
||||
@ -85,7 +86,7 @@ AJAX.registerOnload('replication.js', function () {
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strResetReplicaWarning;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var params = Functions.getJsConfirmCommonParam({
|
||||
'ajax_page_request': true,
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
||||
@ -26,7 +27,7 @@ const DropDatabases = {
|
||||
selectedDbs[selectedDbs.length] = 'DROP DATABASE `' + Functions.escapeHtml($(this).val()) + '`;';
|
||||
});
|
||||
if (! selectedDbs.length) {
|
||||
Functions.ajaxShowMessage(
|
||||
ajaxShowMessage(
|
||||
$('<div class="alert alert-warning" role="alert"></div>').text(
|
||||
window.Messages.strNoDatabasesSelected
|
||||
),
|
||||
@ -47,14 +48,14 @@ const DropDatabases = {
|
||||
const url = 'index.php?route=/server/databases/destroy&' + $(this).serialize();
|
||||
|
||||
$('#dropDatabaseModalDropButton').on('click', function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest, false);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest, false);
|
||||
|
||||
var parts = url.split('?');
|
||||
var params = Functions.getJsConfirmCommonParam(this, parts[1]);
|
||||
|
||||
$.post(parts[0], params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
|
||||
var $rowsToRemove = $form.find('tr.removeMe');
|
||||
var $databasesCount = $('#filter-rows-count');
|
||||
@ -70,7 +71,7 @@ const DropDatabases = {
|
||||
Navigation.reload();
|
||||
} else {
|
||||
$form.find('tr.removeMe').removeClass('removeMe');
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
|
||||
@ -101,12 +102,12 @@ const CreateDatabase = {
|
||||
}
|
||||
// end remove
|
||||
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
|
||||
var $databasesCountObject = $('#filter-rows-count');
|
||||
var databasesCount = parseInt($databasesCountObject.text(), 10) + 1;
|
||||
@ -119,7 +120,7 @@ const CreateDatabase = {
|
||||
var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
$.get(dbStructUrl, params, AJAX.responseHandler);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Export privileges modal handler
|
||||
@ -22,13 +23,13 @@ function exportPrivilegesModalHandler (data, msgbox) {
|
||||
modal.on('shown.bs.modal', function () {
|
||||
modal.find('.modal-body').first().html(data.message);
|
||||
$('#exportPrivilegesModalLabel').first().html(data.title);
|
||||
Functions.ajaxRemoveMessage(msgbox);
|
||||
ajaxRemoveMessage(msgbox);
|
||||
// Attach syntax highlighted editor to export dialog
|
||||
Functions.getSqlEditor(modal.find('textarea'));
|
||||
});
|
||||
return;
|
||||
}
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +52,7 @@ const EditUserGroup = {
|
||||
},
|
||||
data => {
|
||||
if (typeof data === 'undefined' || data.success !== true) {
|
||||
Functions.ajaxShowMessage(data.error, false, 'error');
|
||||
ajaxShowMessage(data.error, false, 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -70,7 +71,7 @@ const EditUserGroup = {
|
||||
form.serialize() + CommonParams.get('arg_separator') + 'ajax_request=1',
|
||||
data => {
|
||||
if (typeof data === 'undefined' || data.success !== true) {
|
||||
Functions.ajaxShowMessage(data.error, false, 'error');
|
||||
ajaxShowMessage(data.error, false, 'error');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -108,7 +109,7 @@ const AccountLocking = {
|
||||
|
||||
$.post(url, params, data => {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ const AccountLocking = {
|
||||
button.dataset.isLocked = 'true';
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -237,12 +238,12 @@ const RevokeUser = {
|
||||
}
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage(window.Messages.strRemovingSelectedUsers);
|
||||
ajaxShowMessage(window.Messages.strRemovingSelectedUsers);
|
||||
|
||||
var argsep = 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);
|
||||
ajaxShowMessage(data.message);
|
||||
// Refresh navigation, if we dropped some databases with the name
|
||||
// that is the same as the username of the deleted user
|
||||
if ($('#dropUsersDbCheckbox:checked').length) {
|
||||
@ -275,7 +276,7 @@ const RevokeUser = {
|
||||
$(Functions.checkboxesSel).trigger('change');
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -293,10 +294,10 @@ const ExportPrivileges = {
|
||||
event.preventDefault();
|
||||
// can't export if no users checked
|
||||
if ($(this.form).find('input:checked').length === 0) {
|
||||
Functions.ajaxShowMessage(window.Messages.strNoAccountSelected, 2000, 'success');
|
||||
ajaxShowMessage(window.Messages.strNoAccountSelected, 2000, 'success');
|
||||
return;
|
||||
}
|
||||
var msgbox = Functions.ajaxShowMessage();
|
||||
var msgbox = ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var serverId = CommonParams.get('server');
|
||||
var selectedUsers = $('#usersForm input[name*=\'selected_usr\']:checkbox').serialize();
|
||||
@ -317,7 +318,7 @@ const ExportUser = {
|
||||
*/
|
||||
handleEvent: function (event) {
|
||||
event.preventDefault();
|
||||
var msgbox = Functions.ajaxShowMessage();
|
||||
var msgbox = ajaxShowMessage();
|
||||
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {
|
||||
exportPrivilegesModalHandler(data, msgbox);
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../../modules/ajax.js';
|
||||
import { Functions } from '../../modules/functions.js';
|
||||
import { CommonParams } from '../../modules/common.js';
|
||||
import highlightSql from '../../modules/sql-highlight.js';
|
||||
import { ajaxShowMessage } from '../../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Server Status Processes
|
||||
@ -72,10 +73,10 @@ var processList = {
|
||||
}
|
||||
});
|
||||
// Show process killed message
|
||||
Functions.ajaxShowMessage(data.message, false);
|
||||
ajaxShowMessage(data.message, false);
|
||||
} else {
|
||||
// Show process error message
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json');
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview Javascript functions used in server variables page
|
||||
@ -40,13 +40,13 @@ AJAX.registerOnload('server/variables.js', function () {
|
||||
|
||||
var $mySaveLink = $saveLink.clone().css('display', 'inline-block');
|
||||
var $myCancelLink = $cancelLink.clone().css('display', 'inline-block');
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $myEditLink = $cell.find('a.editLink');
|
||||
$cell.addClass('edit'); // variable is being edited
|
||||
$myEditLink.remove(); // remove edit link
|
||||
|
||||
$mySaveLink.on('click', function () {
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/server/variables/set/' + encodeURIComponent(varName), {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
@ -56,12 +56,12 @@ AJAX.registerOnload('server/variables.js', function () {
|
||||
$valueCell
|
||||
.html(data.variable)
|
||||
.data('content', data.variable);
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
if (data.error === '') {
|
||||
Functions.ajaxShowMessage(window.Messages.strRequestFailed, false);
|
||||
ajaxShowMessage(window.Messages.strRequestFailed, false);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
$valueCell.html($valueCell.data('content'));
|
||||
}
|
||||
@ -108,10 +108,10 @@ AJAX.registerOnload('server/variables.js', function () {
|
||||
$myCancelLink.trigger('click');
|
||||
}
|
||||
});
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
$cell.removeClass('edit').html($myEditLink);
|
||||
Functions.ajaxShowMessage(data.error);
|
||||
ajaxShowMessage(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import { Navigation } from './modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from './modules/common.js';
|
||||
import { Config } from './modules/config.js';
|
||||
import highlightSql from './modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview functions used wherever an sql query form is used
|
||||
@ -311,7 +312,7 @@ const insertQuery = function (queryType) {
|
||||
} else if (window.Cookies.get(key, { path: CommonParams.get('rootPath') })) {
|
||||
setQuery(window.Cookies.get(key, { path: CommonParams.get('rootPath') }));
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strNoAutoSavedQuery);
|
||||
ajaxShowMessage(window.Messages.strNoAutoSavedQuery);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -493,7 +494,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, Functions.escapeHtml($(this).closest('td').find('div').text()));
|
||||
var $link = $(this);
|
||||
$link.confirm(question, $link.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var params = 'ajax_request=1' + argsep + 'is_js_confirmed=1';
|
||||
var postData = $link.getPostData();
|
||||
@ -502,10 +503,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
$link.closest('tr').remove();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -514,13 +515,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// Ajaxification for 'Bookmark this SQL query'
|
||||
$(document).on('submit', '.bookmarkQueryForm', function (e) {
|
||||
e.preventDefault();
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
$.post($(this).attr('action'), 'ajax_request=1' + argsep + $(this).serialize(), function (data) {
|
||||
if (data.success) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -751,7 +752,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
/**
|
||||
* Ajax Event handler for 'SQL Query Submit'
|
||||
*
|
||||
* @see Functions.ajaxShowMessage()
|
||||
* @see ajaxShowMessage()
|
||||
* @memberOf jQuery
|
||||
* @name sqlqueryform_submit
|
||||
*/
|
||||
@ -769,7 +770,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// remove any div containing a previous error message
|
||||
$('.alert-danger').remove();
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $sqlqueryresultsouter = $('#sqlqueryresultsouter');
|
||||
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
@ -863,7 +864,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
.html(data.error);
|
||||
$('html, body').animate({ scrollTop: $(document).height() }, 200);
|
||||
}
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
}); // end $.post()
|
||||
}); // end SQL Query submit
|
||||
|
||||
@ -877,10 +878,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
var $form = $(this);
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
$.post($form.attr('action'), $form.serialize() + argsep + 'ajax_request=true', function (data) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var $sqlqueryresults = $form.parents('.sqlqueryresults');
|
||||
$sqlqueryresults
|
||||
.html(data.message)
|
||||
@ -923,7 +924,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
Sql.submitShowAllForm = function () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
};
|
||||
@ -962,7 +963,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/import/simulate-dml',
|
||||
@ -974,7 +975,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
'sql_delimiter': delimiter
|
||||
},
|
||||
success: function (response) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (response.success) {
|
||||
var dialogContent = '<div class="preview_sql">';
|
||||
if (response.sql_data) {
|
||||
@ -1001,11 +1002,11 @@ AJAX.registerOnload('sql.js', function () {
|
||||
highlightSql(modal);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error);
|
||||
ajaxShowMessage(response.error);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -1020,7 +1021,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
var $form = $button.closest('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep;
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
|
||||
var url;
|
||||
@ -1213,9 +1214,9 @@ Sql.checkSavedQuery = function () {
|
||||
|
||||
if (Config.isStorageSupported('localStorage') &&
|
||||
typeof window.localStorage.getItem(key) === 'string') {
|
||||
Functions.ajaxShowMessage(window.Messages.strPreviousSaveQuery);
|
||||
ajaxShowMessage(window.Messages.strPreviousSaveQuery);
|
||||
} else if (window.Cookies.get(key, { path: CommonParams.get('rootPath') })) {
|
||||
Functions.ajaxShowMessage(window.Messages.strPreviousSaveQuery);
|
||||
ajaxShowMessage(window.Messages.strPreviousSaveQuery);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/* global ColumnType, DataTable, JQPlotChartFactory */ // js/chart.js
|
||||
|
||||
@ -177,7 +178,7 @@ function drawChart () {
|
||||
$('#saveChart').attr('href', currentChart.toImageString());
|
||||
}
|
||||
} catch (err) {
|
||||
Functions.ajaxShowMessage(err.message, false);
|
||||
ajaxShowMessage(err.message, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,7 +372,7 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
Functions.prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' &&
|
||||
@ -379,9 +380,9 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
typeof data.chartData !== 'undefined') {
|
||||
chartData = JSON.parse(data.chartData);
|
||||
drawChart();
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}, 'json'); // end $.post()
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
@ -35,9 +36,9 @@ AJAX.registerOnload('table/find_replace.js', function () {
|
||||
e.preventDefault();
|
||||
var findReplaceForm = $('#find_replace_form');
|
||||
Functions.prepareForAjaxRequest(findReplaceForm);
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.post(findReplaceForm.attr('action'), findReplaceForm.serialize(), function (data) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (data.success === true) {
|
||||
$('#toggle_find_div').show();
|
||||
$('#toggle_find').trigger('click');
|
||||
|
||||
@ -4,6 +4,7 @@ import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down a page
|
||||
@ -41,7 +42,7 @@ var confirmAndPost = function (linkObject, action) {
|
||||
question += window.sprintf(window.Messages.strDoYouReally, linkObject.data('query'));
|
||||
question += Functions.getForeignKeyCheckboxLoader();
|
||||
linkObject.confirm(question, linkObject.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = Functions.getJsConfirmCommonParam(this, linkObject.getPostData());
|
||||
|
||||
@ -53,12 +54,12 @@ var confirmAndPost = function (linkObject, action) {
|
||||
$('.result_query').remove();
|
||||
}
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
$('<div class="sqlqueryresults ajax"></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.sql_query);
|
||||
highlightSql($('#page_content'));
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
@ -89,15 +90,15 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$form.find('input[name=\'new_name\']').val()
|
||||
);
|
||||
CommonActions.refreshMain(false, function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
// Refresh navigation when the table is copied
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});// end of copyTable ajax submit
|
||||
@ -115,12 +116,12 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
CommonParams.set('db', data.params.db);
|
||||
CommonParams.set('table', data.params.table);
|
||||
CommonActions.refreshMain('index.php?route=/table/sql', function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
});
|
||||
// Refresh navigation when the table is copied
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -170,7 +171,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
// Refresh navigation when the table is renamed
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -206,7 +207,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
|
||||
var $tempDiv;
|
||||
if (typeof data !== 'undefined' && data.success === true && data.sql_query !== undefined) {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.sql_query);
|
||||
highlightSql($('#page_content'));
|
||||
@ -215,7 +216,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$tempDiv = $('<div id=\'temp_div\'></div>');
|
||||
$tempDiv.html(data.message);
|
||||
var $success = $tempDiv.find('.result_query .alert-success');
|
||||
Functions.ajaxShowMessage($success);
|
||||
ajaxShowMessage($success);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.message);
|
||||
highlightSql($('#page_content'));
|
||||
@ -232,7 +233,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$error = $tempDiv;
|
||||
}
|
||||
|
||||
Functions.ajaxShowMessage($error, false);
|
||||
ajaxShowMessage($error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});// end of table maintenance ajax click
|
||||
@ -248,7 +249,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
function submitPartitionMaintenance () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
}
|
||||
@ -277,24 +278,24 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
question += Functions.getForeignKeyCheckboxLoader();
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = Functions.getJsConfirmCommonParam(this, $link.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
// Table deleted successfully, refresh both the frames
|
||||
Navigation.reload();
|
||||
CommonParams.set('table', '');
|
||||
CommonActions.refreshMain(
|
||||
CommonParams.get('opendb_url'),
|
||||
function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
}, Functions.loadForeignKeyCheckbox);
|
||||
@ -313,22 +314,22 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
);
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $link.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
// Table deleted successfully, refresh both the frames
|
||||
Navigation.reload();
|
||||
CommonParams.set('table', '');
|
||||
CommonActions.refreshMain(
|
||||
CommonParams.get('opendb_url'),
|
||||
function () {
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* for table relation
|
||||
@ -80,7 +81,7 @@ TableRelation.getDropdownValues = function ($dropdown) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $form = $dropdown.parents('form');
|
||||
var $db = $form.find('input[name="db"]').val();
|
||||
var $table = $form.find('input[name="table"]').val();
|
||||
@ -103,7 +104,7 @@ TableRelation.getDropdownValues = function ($dropdown) {
|
||||
data: params,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
// if the changed dropdown is a database selector
|
||||
if (foreignTable === null) {
|
||||
@ -122,7 +123,7 @@ TableRelation.getDropdownValues = function ($dropdown) {
|
||||
TableRelation.setDropdownValues($columnDd.slice(1), data.columns);
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -240,16 +241,16 @@ AJAX.registerOnload('table/relation.js', function () {
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, dropQuery);
|
||||
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingForeignKey, false);
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingForeignKey, false);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
CommonActions.refreshMain(false, function () {
|
||||
// Do nothing
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview JavaScript functions used on /table/search
|
||||
@ -112,7 +113,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
|
||||
// empty previous search results while we are waiting for new results
|
||||
$('#sqlqueryresultsouter').empty();
|
||||
var $msgbox = Functions.ajaxShowMessage(window.Messages.strSearching, false);
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
|
||||
Functions.prepareForAjaxRequest($searchForm);
|
||||
|
||||
@ -158,7 +159,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
}
|
||||
|
||||
$.post($searchForm.attr('action'), values, function (data) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if (typeof data.sql_query !== 'undefined') { // zero rows
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
@ -297,7 +298,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
var operator = $(this).val();
|
||||
|
||||
if ((operator === 'BETWEEN' || operator === 'NOT BETWEEN') && dataType) {
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
$.ajax({
|
||||
url: 'index.php?route=/table/search',
|
||||
type: 'POST',
|
||||
@ -310,7 +311,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
'range_search': 1
|
||||
},
|
||||
success: function (response) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (response.success) {
|
||||
// Get the column min value.
|
||||
var min = response.column_data.min
|
||||
@ -374,11 +375,11 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
$('#rangeSearchModal').modal('hide');
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage(response.error);
|
||||
ajaxShowMessage(response.error);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import { Functions } from '../modules/functions.js';
|
||||
import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* @fileoverview functions used on the table structure page
|
||||
@ -77,7 +78,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
|
||||
|
||||
function submitForm () {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) {
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
@ -96,7 +97,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
reloadFieldForm();
|
||||
}
|
||||
$form.remove();
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
Navigation.reload();
|
||||
if (typeof data.structure_refresh_route === 'string') {
|
||||
// Fetch the table structure right after adding a new column
|
||||
@ -109,7 +110,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
CommonActions.refreshMain('index.php?route=/table/structure');
|
||||
}
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
}
|
||||
@ -197,12 +198,12 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' + currTableName + '` DROP `' + currColumnName + '`;');
|
||||
var $thisAnchor = $(this);
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
var $msg = Functions.ajaxShowMessage(window.Messages.strDroppingColumn, false);
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingColumn, false);
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
params += CommonParams.get('arg_separator') + 'ajax_page_request=1';
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Functions.ajaxRemoveMessage($msg);
|
||||
ajaxRemoveMessage($msg);
|
||||
if ($('.result_query').length) {
|
||||
$('.result_query').remove();
|
||||
}
|
||||
@ -237,7 +238,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$('.index_info').replaceWith(data.indexes_list);
|
||||
Navigation.reload();
|
||||
} else {
|
||||
Functions.ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
ajaxShowMessage(window.Messages.strErrorProcessingRequest + ' : ' + data.error, false);
|
||||
}
|
||||
}); // end $.post()
|
||||
});
|
||||
@ -271,7 +272,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
var $thisAnchor = $(this);
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $this;
|
||||
|
||||
var params = Functions.getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
@ -355,19 +356,19 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$('#designerModalGoButton').off('click');// Unregister previous modals
|
||||
$('#designerModalGoButton').on('click', function () {
|
||||
event.preventDefault();
|
||||
var $msgbox = Functions.ajaxShowMessage();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $this = $('#moveColumnsModal');
|
||||
var $form = $this.find('form');
|
||||
var serialized = $form.serialize();
|
||||
// check if any columns were moved at all
|
||||
$('#moveColumnsModal').modal('hide');
|
||||
if (serialized === $form.data('serialized-unmoved')) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
return;
|
||||
}
|
||||
$.post($form.prop('action'), serialized + CommonParams.get('arg_separator') + 'ajax_request=true', function (data) {
|
||||
if (data.success === false) {
|
||||
Functions.ajaxRemoveMessage($msgbox);
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var errorModal = $('#moveColumnsErrorModal');
|
||||
errorModal.modal('show');
|
||||
errorModal.find('.modal-body').first().html(data.error);
|
||||
@ -395,7 +396,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
.removeClass('odd even')
|
||||
.addClass($row.index() % 2 === 0 ? 'odd' : 'even');
|
||||
}
|
||||
Functions.ajaxShowMessage(data.message);
|
||||
ajaxShowMessage(data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -410,7 +411,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
|
||||
$.post(this.formAction, submitData, AJAX.responseHandler);
|
||||
@ -425,7 +426,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
|
||||
function submitPartitionAction (url) {
|
||||
var params = 'ajax_request=true&ajax_page_request=true&' + $link.getPostData();
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $link;
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
}
|
||||
@ -455,7 +456,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
'ajax_request': true,
|
||||
'ajax_page_request': true
|
||||
}, $link.getPostData());
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $link;
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ import $ from 'jquery';
|
||||
import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
/**
|
||||
* Unbind all event handlers before tearing down the page
|
||||
@ -64,12 +65,12 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
if ($button.val() === 'delete_version') {
|
||||
var question = window.Messages.strDeleteTrackingVersionMultiple;
|
||||
$button.confirm(question, $form.attr('action'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post(url, submitData, AJAX.responseHandler);
|
||||
});
|
||||
} else {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
}
|
||||
@ -83,7 +84,7 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strDeleteTrackingVersion;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
@ -100,7 +101,7 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strDeletingTrackingEntry;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
Functions.ajaxShowMessage();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = Functions.getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
|
||||
@ -3,6 +3,7 @@ import { AJAX } from '../modules/ajax.js';
|
||||
import { Functions } from '../modules/functions.js';
|
||||
import { CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
|
||||
// TODO: change the axis
|
||||
/**
|
||||
@ -250,9 +251,9 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
**/
|
||||
$('#inputFormSubmitId').on('click', function () {
|
||||
if ($('#tableid_0').get(0).selectedIndex === 0 || $('#tableid_1').get(0).selectedIndex === 0) {
|
||||
Functions.ajaxShowMessage(window.Messages.strInputNull);
|
||||
ajaxShowMessage(window.Messages.strInputNull);
|
||||
} else if (xLabel === yLabel) {
|
||||
Functions.ajaxShowMessage(window.Messages.strSameInputs);
|
||||
ajaxShowMessage(window.Messages.strSameInputs);
|
||||
}
|
||||
});
|
||||
|
||||
@ -404,7 +405,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
highlightSql($('#sqlqueryresultsouter'));
|
||||
} else {
|
||||
Functions.ajaxShowMessage(data.error, false);
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
}); // End $.post
|
||||
}// End database update
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import { AJAX } from './modules/ajax.js';
|
||||
import { Functions } from './modules/functions.js';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.js';
|
||||
|
||||
AJAX.registerOnload('u2f.js', function () {
|
||||
var $inputReg = $('#u2f_registration_response');
|
||||
@ -15,19 +15,19 @@ AJAX.registerOnload('u2f.js', function () {
|
||||
if (data.errorCode && data.errorCode !== 0) {
|
||||
switch (data.errorCode) {
|
||||
case 5:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error');
|
||||
break;
|
||||
case 4:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FErrorRegister, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FErrorRegister, false, 'error');
|
||||
break;
|
||||
case 3:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error');
|
||||
break;
|
||||
case 2:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error');
|
||||
break;
|
||||
default:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error');
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@ -52,19 +52,19 @@ AJAX.registerOnload('u2f.js', function () {
|
||||
if (data.errorCode && data.errorCode !== 0) {
|
||||
switch (data.errorCode) {
|
||||
case 5:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FTimeout, false, 'error');
|
||||
break;
|
||||
case 4:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FErrorAuthenticate, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FErrorAuthenticate, false, 'error');
|
||||
break;
|
||||
case 3:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FInvalidClient, false, 'error');
|
||||
break;
|
||||
case 2:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FBadRequest, false, 'error');
|
||||
break;
|
||||
default:
|
||||
Functions.ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error');
|
||||
ajaxShowMessage(window.Messages.strU2FUnknown, false, 'error');
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
@ -127,7 +127,7 @@ class ErrorReportController extends AbstractController
|
||||
$this->response->addJSON('errSubmitMsg', $msg);
|
||||
}
|
||||
} elseif ($exceptionType === 'php') {
|
||||
$jsCode = 'Functions.ajaxShowMessage(\'<div class="alert alert-danger" role="alert">'
|
||||
$jsCode = 'window.ajaxShowMessage(\'<div class="alert alert-danger" role="alert">'
|
||||
. $msg
|
||||
. '</div>\', false);';
|
||||
$this->response->getFooterScripts()->addCode($jsCode);
|
||||
|
||||
@ -600,7 +600,7 @@ class ErrorHandler
|
||||
} else {
|
||||
// send the error reports asynchronously & without asking user
|
||||
$jsCode .= '$("#pma_report_errors_form").submit();'
|
||||
. 'Functions.ajaxShowMessage(
|
||||
. 'window.ajaxShowMessage(
|
||||
window.Messages.phpErrorsBeingSubmitted, false
|
||||
);';
|
||||
// js code to appropriate focusing,
|
||||
@ -612,7 +612,7 @@ class ErrorHandler
|
||||
//ask user whether to submit errors or not.
|
||||
if (! $response->isAjax()) {
|
||||
// js code to show appropriate msgs, event binding & focusing.
|
||||
$jsCode = 'Functions.ajaxShowMessage(window.Messages.phpErrorsFound);'
|
||||
$jsCode = 'window.ajaxShowMessage(window.Messages.phpErrorsFound);'
|
||||
. '$("#pma_ignore_errors_popup").on("click", function() {
|
||||
Functions.ignorePhpErrors()
|
||||
});'
|
||||
|
||||
@ -1099,7 +1099,7 @@ JS;
|
||||
public function waitAjaxMessage(): void
|
||||
{
|
||||
/* Get current message count */
|
||||
$ajax_message_count = $this->webDriver->executeScript('return Functions.getAjaxMessageCount();');
|
||||
$ajax_message_count = $this->webDriver->executeScript('return window.getAjaxMessageCount();');
|
||||
/* Ensure the popup is gone */
|
||||
$this->waitForElementNotPresent('id', 'ajax_message_num_' . $ajax_message_count);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user