mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11279] Clearer AJAX errors
Display clearer AJAX errors rather than generic error PHPBB3-11279
This commit is contained in:
parent
778658f787
commit
a9c9448ebb
4 changed files with 19 additions and 4 deletions
|
@ -18,7 +18,7 @@
|
||||||
{DEBUG_OUTPUT}
|
{DEBUG_OUTPUT}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}">
|
||||||
<div id="darken"> </div>
|
<div id="darken"> </div>
|
||||||
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -252,9 +252,21 @@ phpbb.ajaxify = function(options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function errorHandler() {
|
/**
|
||||||
|
* Handler for AJAX errors
|
||||||
|
*/
|
||||||
|
function errorHandler(jqXHR, textStatus, errorThrown) {
|
||||||
phpbb.clearLoadingTimeout();
|
phpbb.clearLoadingTimeout();
|
||||||
phpbb.alert(dark.attr('data-ajax-error-title'), dark.attr('data-ajax-error-text'));
|
var errorText = false;
|
||||||
|
if (typeof errorThrown === 'string' && errorThrown.length > 0) {
|
||||||
|
errorText = errorThrown;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
errorText = dark.attr('data-ajax-error-text-' + textStatus);
|
||||||
|
if (typeof errorText !== 'string' || !errorText.length)
|
||||||
|
errorText = dark.attr('data-ajax-error-text');
|
||||||
|
}
|
||||||
|
phpbb.alert(dark.attr('data-ajax-error-title'), errorText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -70,6 +70,9 @@ $lang = array_merge($lang, array(
|
||||||
'AIM' => 'AIM',
|
'AIM' => 'AIM',
|
||||||
'AJAX_ERROR_TITLE' => 'AJAX error',
|
'AJAX_ERROR_TITLE' => 'AJAX error',
|
||||||
'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.',
|
'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.',
|
||||||
|
'AJAX_ERROR_TEXT_ABORT' => 'User aborted request.',
|
||||||
|
'AJAX_ERROR_TEXT_TIMEOUT' => 'Your request timed out; please try again.',
|
||||||
|
'AJAX_ERROR_TEXT_PARSERERROR' => 'Something went wrong with the request and the server returned an invalid reply.',
|
||||||
'ALLOWED' => 'Allowed',
|
'ALLOWED' => 'Allowed',
|
||||||
'ALL_FILES' => 'All files',
|
'ALL_FILES' => 'All files',
|
||||||
'ALL_FORUMS' => 'All forums',
|
'ALL_FORUMS' => 'All forums',
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
|
<!-- IF U_ACP --><br /><strong><a href="{U_ACP}">{L_ACP}</a></strong><!-- ENDIF -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}">
|
<div id="darkenwrapper" data-ajax-error-title="{L_AJAX_ERROR_TITLE}" data-ajax-error-text="{L_AJAX_ERROR_TEXT}" data-ajax-error-text-abort="{L_AJAX_ERROR_TEXT_ABORT}" data-ajax-error-text-timeout="{L_AJAX_ERROR_TEXT_TIMEOUT}" data-ajax-error-text-parsererror="{L_AJAX_ERROR_TEXT_PARSERERROR}">
|
||||||
<div id="darken"> </div>
|
<div id="darken"> </div>
|
||||||
<div class="phpbb_alert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
<div class="phpbb_alert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue