Add basic 403 handling to table.js
This commit is contained in:
parent
fb3d83cc40
commit
7f5e41c885
2 changed files with 16 additions and 21 deletions
|
@ -542,6 +542,18 @@ var AIRTIME = (function(AIRTIME) {
|
|||
}
|
||||
};
|
||||
|
||||
mod.handleAjaxError = function (r) {
|
||||
// If the request was denied due to permissioning
|
||||
if (r.status === 403) {
|
||||
// Hide the processing div
|
||||
var wrapper = $("#library_display_wrapper");
|
||||
wrapper.find(".dt-process-rel").hide();
|
||||
wrapper.find('.empty_placeholder_text').text($.i18n._("You don't have permission to view the library."));
|
||||
wrapper.find('.empty_placeholder').show();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
libraryInit = function() {
|
||||
|
||||
$libContent = $("#library_content");
|
||||
|
@ -706,7 +718,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": fnCallback,
|
||||
"error": handleAjaxError
|
||||
"error": mod.handleAjaxError
|
||||
}).done(function (data) {
|
||||
var filterMessage = $libContent.find('.filter-message');
|
||||
if (data.iTotalRecords > data.iTotalDisplayRecords) {
|
||||
|
@ -904,17 +916,6 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
}
|
||||
|
||||
function handleAjaxError(r) {
|
||||
// If the request was denied due to permissioning
|
||||
if (r.status === 403) {
|
||||
// Hide the processing div
|
||||
$("#library_display_wrapper").find(".dt-process-rel").hide();
|
||||
$('.empty_placeholder_text').text($.i18n._("You don't have permission to view the library."));
|
||||
|
||||
$('.empty_placeholder').show();
|
||||
}
|
||||
}
|
||||
|
||||
var selected = $("a[href$='"+location.hash+"']"), table;
|
||||
if (selected.parent().data("selection-id") == AIRTIME.library.MediaTypeIntegerEnum.PODCAST) {
|
||||
table = mod.DataTableTypeEnum.PODCAST;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue