Files
modoboa/static/js/utils.js
T
Antoine Nguyen 99888a861b wip: limits and new reseller profile
We add an intermediate role : Reseller. It is somewhere between a super administrator and a domain administrator. A reseller can create objects (a limited or not amount) and then define permissions on those objects:

* Create a domain admins,
* Assign limits to those admins,
* ...

see #105
2012-01-12 16:49:09 +01:00

34 lines
878 B
JavaScript

/*
* Collection of functions that are accessible to every page.
*/
/*
* Simple function that redirect ajax requests to the login page if
* the status code received with a response is equal to 278.
*/
function ajax_login_redirect() {
if (this.status != 278) {
return;
}
var params = "?next=" + window.location.pathname;
window.location.href =
this.xhr.getResponseHeader("Location").replace(/\?.*$/, params);
}
/*
* Simple wrapper around Request.JSON. We just ensure that
* redirections are correctly catched. (on session timeout for
* example)
*/
Request.JSON.mdb = new Class({
Extends: Request.JSON,
options: {
onComplete: ajax_login_redirect,
onFailure: function(xhr) {
$(document.body).setStyle("overflow", "auto");
$(document.body).set("html", xhr.responseText);
}
}
});