mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-03 12:14:12 +01:00
wip: #65, adding some information messages everywhere.
This commit is contained in:
+19
-1
@@ -33,7 +33,10 @@ check_anchor = function() {
|
||||
} else {
|
||||
query = current_anchor.serialized.substring(1);
|
||||
}
|
||||
infobox.show(gettext("Loading..."), "gray");
|
||||
infobox.show(gettext("Loading..."), {
|
||||
profile: "gray",
|
||||
spinner: true
|
||||
});
|
||||
new Request.JSON({url: query, noCache : true, onSuccess: function(resp) {
|
||||
callback = ($defined(resp.callback)) ? resp.callback : "default";
|
||||
callbacks[callback](resp);
|
||||
@@ -349,3 +352,18 @@ gethref = function(obj) {
|
||||
|
||||
return url.replace(baseurl, "");
|
||||
}
|
||||
|
||||
saveparams = function(id, message) {
|
||||
$$("input[name=update]").addEvent("click", function(evt) {
|
||||
evt.stop();
|
||||
$(id).set("send", {
|
||||
onSuccess: function(response) {
|
||||
var decode = JSON.decode(response);
|
||||
if (decode.status == "ok") {
|
||||
infobox.notice(message);
|
||||
infobox.hide(1);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
}
|
||||
+20
-12
@@ -56,40 +56,48 @@ var InfoBox = new Class({
|
||||
},
|
||||
|
||||
notice: function(message) {
|
||||
this.setProfile("green");
|
||||
this.setMessage(message);
|
||||
this.show(message, {
|
||||
profile: "green"
|
||||
});
|
||||
},
|
||||
|
||||
error: function(message) {
|
||||
this.setProfile("red");
|
||||
this.setMessage(message);
|
||||
this.show(message, {
|
||||
profile: "red"
|
||||
});
|
||||
},
|
||||
|
||||
warning: function(message) {
|
||||
this.setProfile("yellow");
|
||||
this.setMessage(message);
|
||||
this.show(message, {
|
||||
profile: "yellow"
|
||||
});
|
||||
},
|
||||
|
||||
show: function(message, prof, delay) {
|
||||
show: function(message, arguments) {
|
||||
if ($defined(this.start)) {
|
||||
if ($time() - this.start > this.delay) {
|
||||
$clear(this.showtimer);
|
||||
delete(this.start);
|
||||
delete(this.delay);
|
||||
} else {
|
||||
this.showtimer = this.show.delay(100, this, [message, prof]);
|
||||
this.showtimer = this.show.delay(100, this, [message, arguments]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($defined(message)) {
|
||||
this.setMessage(message);
|
||||
}
|
||||
if ($defined(prof)) {
|
||||
this.setProfile(prof);
|
||||
if ($defined(arguments.profile)) {
|
||||
this.setProfile(arguments.profile);
|
||||
}
|
||||
if ($defined(delay)) {
|
||||
if ($defined(arguments.delay)) {
|
||||
this.start = $time();
|
||||
this.delay = delay * 1000;
|
||||
this.delay = arguments.delay * 1000;
|
||||
}
|
||||
if ($defined(arguments.spinner) && arguments.spinner) {
|
||||
this.spinner.setStyle("display", "block");
|
||||
} else {
|
||||
this.spinner.setStyle("display", "none");
|
||||
}
|
||||
this.box.setStyle("display", "block");
|
||||
},
|
||||
|
||||
@@ -11,4 +11,5 @@ window.addEvent('domready', function() {
|
||||
}
|
||||
}, $('accordion'));
|
||||
|
||||
saveparams("uparams_form", gettext("Preferences saved"));
|
||||
});
|
||||
|
||||
@@ -17,5 +17,5 @@ window.addEvent('domready', function() {
|
||||
toggler.setStyle('color', '#222');
|
||||
}
|
||||
}, $('accordion'));
|
||||
|
||||
saveparams("params_form", gettext("Parameters saved"));
|
||||
});
|
||||
Reference in New Issue
Block a user