mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-14 09:14:16 +01:00
see #98
Added more controls on forms validation. see #65 Added messages for CRUD operations on domains/mailboxes/aliases.
This commit is contained in:
+14
-3
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user