Added more controls on forms validation.

see #65

Added messages for CRUD operations on domains/mailboxes/aliases.
This commit is contained in:
tonio
2010-11-29 22:52:02 +01:00
parent 5d425c8cbe
commit 5ea3c71c9b
8 changed files with 138 additions and 95 deletions
+14 -3
View File
@@ -244,20 +244,31 @@ confirmation = function(question, action, callback) {
var elt = ibody.getElement("input[name=result]");
if (elt.get("value") == "ok") {
params = "";
var params = "";
if (typeof callback != "undefined") {
params = callback(ibody);
}
new Request({
new Request.JSON({
method: "get",
url: action.get("href"),
onSuccess: function(res) {
window.location.reload();
if (res.status == "ok") {
window.location.reload();
} else {
infobox.error(res.error);
infobox.hide(2);
}
}
}).send(params);
}
}
});
/* FIXME: avoid using a hard coded address like this, maybe it
could be fixed by creating a new class for "confirmation" and
create one instance for each section/page using it (I mean
directly inside the html template) */
SqueezeBox.open("/modoboa/userprefs/confirm/?question=" + question);
};
+4 -4
View File
@@ -23,7 +23,7 @@ window.addEvent('domready', function() {
$$("a[name=deleteMb]").addEvent('click', function(event) {
event.stop();
confirmation(gettext("Delete this mailbox?"), this, function(body) {
result = "";
var result = "";
body.getElements("input[type=checkbox]:checked").each(function(obj) {
if (result != "") {
result += "&";
@@ -42,9 +42,9 @@ window.addEvent('domready', function() {
$(document.body).addEvent('click', function(event) {
target = event.target;
var target = event.target;
if (target.get('tag') == 'a') {
name = target.get('name');
var name = target.get('name');
if (name == 'undefined')
return;
if (typeof(handlers[name]) != 'undefined') {
@@ -81,7 +81,7 @@ newdom = function() {
};
loadPage = function(url, destination, callback) {
var destination = (destination == null) ? "page" : destination;
destination = (destination == null) ? "page" : destination;
if (callback)
new Request({url: url, method: "get", onSuccess: callback}).send();