Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-01-08 05:35:39 +01:00
commit 5f90b3f1df
3 changed files with 29 additions and 6 deletions

View File

@ -16,6 +16,7 @@ phpMyAdmin - ChangeLog
+ rfe #1472 [interface] Break "Edit privileges" with sub-menus
4.1.5.0 (not yet released)
- bug #3780 Allow aborting loading pages
4.1.4.0 (2014-01-07)
- bug #3840 (additional fix) When exporting to gzip format, the data is compressed 2 times

View File

@ -12,6 +12,10 @@ var AJAX = {
* @var object source The object whose event initialized the request
*/
source: null,
/**
* @var object xhr A reference to the ajax request that is currently running
*/
xhr: null,
/**
* @var function Callback to execute after a successful request
* Used by PMA_commonFunctions from common.js
@ -157,11 +161,25 @@ var AJAX = {
event.stopImmediatePropagation();
}
if (AJAX.active === true) {
// Silently bail out, there is already a request in progress.
// TODO: save a reference to the request and cancel the old request
// when the user requests something else. Something like this is
// already implemented in the PMA_fastFilter object in navigation.js
return false;
// Cancel the old request if abortable, when the user requests
// something else. Otherwise silently bail out, as there is already
// a request well in progress.
if (AJAX.xhr) {
//In case of a link request, attempt aborting
AJAX.xhr.abort();
if(AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') {
//If aborted
AJAX.$msgbox = PMA_ajaxShowMessage(PMA_messages.strAbortedRequest);
AJAX.active = false;
AJAX.xhr = null;
} else {
//If can't abort
return false;
}
} else {
//In case submitting a form, don't attempt aborting
return false;
}
}
AJAX.source = $(this);
@ -184,7 +202,8 @@ var AJAX = {
if (isLink) {
AJAX.active = true;
AJAX.$msgbox = PMA_ajaxShowMessage();
$.get(url, params, AJAX.responseHandler);
//Save reference for the new link request
AJAX.xhr = $.get(url, params, AJAX.responseHandler);
} else {
/**
* Manually fire the onsubmit event for the form, if any.
@ -222,6 +241,7 @@ var AJAX = {
if (data._redirect) {
PMA_ajaxShowMessage(data._redirect, false);
AJAX.active = false;
AJAX.xhr = null;
return;
}
@ -311,6 +331,7 @@ var AJAX = {
} else {
PMA_ajaxShowMessage(data.error, false);
AJAX.active = false;
AJAX.xhr = null;
}
},
/**

View File

@ -227,6 +227,7 @@ $js_messages['strCancel'] = __('Cancel');
/* For Ajax Notifications */
$js_messages['strLoading'] = __('Loading…');
$js_messages['strAbortedRequest'] = __('Request Aborted!!');
$js_messages['strProcessingRequest'] = __('Processing Request');
$js_messages['strErrorProcessingRequest'] = __('Error in Processing Request');
$js_messages['strErrorCode'] = __('Error code: %s');