Simple hack to catch redirections after an ajax request. It is not a clean and perfect solution but it should address most cases.

fix #181
This commit is contained in:
Antoine Nguyen
2012-01-10 10:40:22 +01:00
parent baec1f740e
commit ba0ed344c5
16 changed files with 74 additions and 21 deletions
@@ -30,7 +30,7 @@ function actioncallback(resp) {
}
function actionclick(evt) {
new Request.JSON({
new Request.JSON.mdb({
url: evt.target.get("href"),
onSuccess: actioncallback
}).get();
+5 -5
View File
@@ -14,7 +14,7 @@ function removefilter(evt) {
if (!confirm(gettext("Remove this filter?"))) {
return;
}
new Request.JSON({
new Request.JSON.mdb({
url: this.get("href"),
onSuccess: function(response) {
if (response.status == "ok") {
@@ -72,7 +72,7 @@ function loadfs(response) {
* (remove, activate)
*/
function send_command(cmd, extracb) {
new Request.JSON({
new Request.JSON.mdb({
url: cmd,
onSuccess: function(response) {
if (response.status == "ko") {
@@ -116,7 +116,7 @@ function savefs(evt) {
if (!check_prereqs(evt, gettext("Save changes?"))) {
return;
}
new Request.JSON({
new Request.JSON.mdb({
url: $("feditor").get("action"),
method: $("feditor").get("method"),
data: $("feditor").toQueryString(),
@@ -177,7 +177,7 @@ function activatefs(evt) {
function toggle_filter_state(event) {
event.stop();
new Request.JSON({
new Request.JSON.mdb({
url: this.get("href"),
onSuccess: function(response) {
if (response.status == "ok") {
@@ -193,7 +193,7 @@ function toggle_filter_state(event) {
function move_filter(event) {
event.stop();
new Request.JSON({
new Request.JSON.mdb({
url: this.get("href"),
onSuccess: function(response) {
$("filters_list").set("html", response.content);
+2 -2
View File
@@ -68,8 +68,8 @@ window.addEvent("domready", function() {
if (p == "") {
return;
}
new Request.JSON({url : url + "?" + p, noCache: true,
onSuccess : getgraph_callback}).get();
new Request.JSON.mdb({url : url + "?" + p, noCache: true,
onSuccess : getgraph_callback}).get();
};
{% if user.is_superuser %}
+3
View File
@@ -691,6 +691,9 @@ def html2plaintext(content):
return plaintext
def get_current_url(request):
if not request.session.has_key("folder"):
return ""
res = "%s?page=%s" % (request.session["folder"], request.session["page"])
for p in ["criteria", "pattern", "order"]:
if p in request.session.keys():
+1 -1
View File
@@ -46,7 +46,7 @@ var FdMenu = new Class({
if (!confirm(gettext("Delete folder?"))) {
return;
}
new Request.JSON({
new Request.JSON.mdb({
url: evt.target.get("href"),
method: "GET",
onSuccess: function(resp) {
+11 -7
View File
@@ -219,13 +219,17 @@ function refreshFolder() {
profile : "gray",
spinner : true
});
new Request.JSON({url: query, noCache : true, onSuccess: function(resp) {
var callback = ($defined(resp.callback)) ? resp.callback : "default";
new Request.JSON.mdb({
url: query,
noCache : true,
onSuccess: function(resp) {
var callback = ($defined(resp.callback)) ? resp.callback : "default";
current_anchor.get_callback(callback)(resp);
infobox.info(gettext("Done"));
infobox.hide(1);
}}).get();
current_anchor.get_callback(callback)(resp);
infobox.info(gettext("Done"));
infobox.hide(1);
}
}).get();
}
/*
@@ -240,7 +244,7 @@ function simple_request(url, params) {
profile: "gray",
spinner: true
});
new Request.JSON({
new Request.JSON.mdb({
url : url,
onSuccess : function(response) {
if (response.status == "ok") {
@@ -6,7 +6,7 @@
<script type="text/javascript">
function del_attachment(evt) {
evt.stop();
new Request.JSON({
new Request.JSON.mdb({
url: this.get("href"),
onSuccess: function(resp) {
this.getParent().dispose();