mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-26 11:14:23 +01:00
see #97
* Added domain aliases delete, * Permissions are not implemented yet. see #103 * New generic create and remove buttons, * New javascript confirmation module, * Fixed a lot of problems about objects relations removal, * Simpler interface (no more dropdown menus), * Multiple removal support.
This commit is contained in:
@@ -104,31 +104,6 @@ td.even {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
/* Dialog box */
|
||||
#dlg-buttons {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#dlg-iconbox {
|
||||
float: left;
|
||||
margin-top: 20px;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
#dlg-textbox {
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
margin-top: 10px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#dlg-buttons input {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
/* Mootools tooltips */
|
||||
.tip {
|
||||
color: #fff;
|
||||
|
||||
+54
-1
@@ -290,15 +290,22 @@ th.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
th.center, td.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td {
|
||||
border-bottom: 1px solid #C8D6E8;
|
||||
/*padding: 5px;*/
|
||||
}
|
||||
|
||||
tr.table-tr-selected {
|
||||
background: #ffffcc;
|
||||
}
|
||||
|
||||
input {
|
||||
border: 1px solid #cccccc;
|
||||
color: inherit;
|
||||
/*background-color: #e9e9e9;*/
|
||||
background-color: #eee;
|
||||
padding: 2px;
|
||||
}
|
||||
@@ -389,3 +396,49 @@ div.row label {
|
||||
display: inline;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.separator {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
/* Custom confirmation box */
|
||||
#dlg-buttons {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
#dlg-iconbox {
|
||||
float: left;
|
||||
margin-top: 20px;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
#dlg-textbox {
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
margin-top: 10px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
#dlg-textbox input {
|
||||
float: left;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#dlg-textbox label {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#dlg-buttons {
|
||||
position: absolute;
|
||||
bottom: 15px;
|
||||
}
|
||||
|
||||
#dlg-buttons input {
|
||||
width: 90px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
+1
-39
@@ -193,7 +193,6 @@ parse_menubar = function(id) {
|
||||
});
|
||||
|
||||
myFx.wrapper.setStyles({
|
||||
/*"clear" : "both",*/
|
||||
"position" : "absolute"
|
||||
});
|
||||
myFx.hide();
|
||||
@@ -235,43 +234,6 @@ get_iframe_body = function(id) {
|
||||
return (data);
|
||||
};
|
||||
|
||||
confirmation = function(question, action, callback) {
|
||||
SqueezeBox.initialize({
|
||||
size: {x: 350, y: 140},
|
||||
handler: 'iframe',
|
||||
onClose: function(content) {
|
||||
var ibody = get_iframe_body(this.asset);
|
||||
var elt = ibody.getElement("input[name=result]");
|
||||
|
||||
if (elt.get("value") == "ok") {
|
||||
var params = "";
|
||||
if (typeof callback != "undefined") {
|
||||
params = callback(ibody);
|
||||
}
|
||||
new Request.JSON({
|
||||
method: "get",
|
||||
url: action.get("href"),
|
||||
onSuccess: function(res) {
|
||||
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);
|
||||
};
|
||||
|
||||
setDivHeight = function(id, extrah, modulo) {
|
||||
var contentsize = $(document.body).getSize().y
|
||||
- $("topmenubar").getSize().y
|
||||
@@ -286,7 +248,7 @@ setDivHeight = function(id, extrah, modulo) {
|
||||
};
|
||||
|
||||
bindRows = function(rooturl, page) {
|
||||
$$("tr").addEvent("click", function(event) {
|
||||
$$("tr").addEvent("dblclick", function(event) {
|
||||
if (event.target.parentNode.id) {
|
||||
var url = rooturl + "?domid=" + event.target.parentNode.id;
|
||||
if (page != "") {
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
var Confirmation = new Class({
|
||||
Implements: [Options, Events],
|
||||
options: {
|
||||
checkboxes: []
|
||||
},
|
||||
|
||||
build_checkboxes: function() {
|
||||
var result = "";
|
||||
var cbhash = new Hash(this.options.checkboxes);
|
||||
|
||||
cbhash.each(function(value, key, hash) {
|
||||
result += "<input type='checkbox' name='" + key + "' value='' />";
|
||||
result += "<label>" + value + "</label>";
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
initialize: function(url, urlparams, question, options) {
|
||||
this.setOptions(options);
|
||||
Confirmation.url = url;
|
||||
Confirmation.urlparams = urlparams;
|
||||
|
||||
var content = new Element("div", {id: "confirmbox"});
|
||||
var icondiv = new Element("div", {
|
||||
id: "dlg-iconbox",
|
||||
html: "<img src='/static/pics/dialog-warning.png' alt='Warning' />"
|
||||
}).inject(content);
|
||||
|
||||
this.textdiv = new Element("div", {
|
||||
id: "dlg-textbox",
|
||||
html: "<b>" + question + "</b>"
|
||||
+ "<p>" + this.build_checkboxes() + "</p>"
|
||||
}).inject(content);
|
||||
|
||||
var buttonsdiv = new Element("div", {
|
||||
id: "dlg-buttons"
|
||||
}).inject(content);
|
||||
new Element("input", {type: "button", name: "ok", id: "ok", value: "Ok"})
|
||||
.addEvent("click", this.ok_handler)
|
||||
.inject(buttonsdiv);
|
||||
new Element("input", {type: "button", name: "cancel", value: "Cancel"})
|
||||
.addEvent("click", this.cancel_handler)
|
||||
.inject(buttonsdiv);
|
||||
|
||||
new Element("input", {type: "hidden", name: "result", id: "result", value: "cancel"})
|
||||
.inject(content);
|
||||
|
||||
SqueezeBox.initialize({
|
||||
size: {x: 350, y: 140},
|
||||
handler: "adopt",
|
||||
onClose: this.close_handler
|
||||
});
|
||||
SqueezeBox.open(content);
|
||||
},
|
||||
|
||||
close_handler: function(content) {
|
||||
var result = $("confirmbox").getElement("input[name=result]");
|
||||
if (result.get("value") != "ok") {
|
||||
return;
|
||||
}
|
||||
|
||||
var params = Confirmation.urlparams;
|
||||
$$("input[type=checkbox]:checked").each(function(item) {
|
||||
if (params != "") {
|
||||
params += "&";
|
||||
}
|
||||
params += item.get("name") + "=true";
|
||||
});
|
||||
new Request.JSON({
|
||||
method: "get",
|
||||
url: Confirmation.url,
|
||||
onSuccess: function(res) {
|
||||
if (res.status == "ok") {
|
||||
window.location.reload();
|
||||
} else {
|
||||
infobox.error(res.error);
|
||||
infobox.hide(2);
|
||||
}
|
||||
}
|
||||
}).send(params);
|
||||
},
|
||||
|
||||
ok_handler: function(evt) {
|
||||
$("result").value = "ok";
|
||||
parent.SqueezeBox.close();
|
||||
},
|
||||
|
||||
cancel_handler: function(evt) {
|
||||
parent.SqueezeBox.close();
|
||||
}
|
||||
});
|
||||
+4
-27
@@ -1,4 +1,3 @@
|
||||
|
||||
window.addEvent('domready', function() {
|
||||
var handlers = new Array();
|
||||
|
||||
@@ -19,28 +18,12 @@ window.addEvent('domready', function() {
|
||||
event.stop();
|
||||
});
|
||||
|
||||
if ($$("a[name=deleteMb]"))
|
||||
$$("a[name=deleteMb]").addEvent('click', function(event) {
|
||||
event.stop();
|
||||
confirmation(gettext("Delete this mailbox?"), this, function(body) {
|
||||
var result = "";
|
||||
body.getElements("input[type=checkbox]:checked").each(function(obj) {
|
||||
if (result != "") {
|
||||
result += "&";
|
||||
}
|
||||
result += obj.name + "=true";
|
||||
});
|
||||
return result;
|
||||
});
|
||||
});
|
||||
|
||||
if ($$("a[name=deleteAlias]"))
|
||||
$$("a[name=deleteAlias]").addEvent('click', function(event) {
|
||||
if (!confirm(gettext("Delete this alias?")))
|
||||
event.stop();
|
||||
});
|
||||
|
||||
|
||||
$(document.body).addEvent('click', function(event) {
|
||||
var target = event.target;
|
||||
if (target.get('tag') == 'a') {
|
||||
@@ -68,18 +51,12 @@ window.addEvent('domready', function() {
|
||||
}
|
||||
});
|
||||
setDivHeight("content", 20, 0);
|
||||
|
||||
objtable = new HtmlTable($("objects_table"), {
|
||||
selectable: true
|
||||
});
|
||||
});
|
||||
|
||||
newdom = function() {
|
||||
form = $("form[name=newdom]");
|
||||
var params = obj.toQueryString();
|
||||
form.set('send', {
|
||||
onSuccess: function(response) {
|
||||
SqueezeBox.loadModal(obj.action + '?' + params);
|
||||
}
|
||||
}).send();
|
||||
};
|
||||
|
||||
loadPage = function(url, destination, callback) {
|
||||
destination = (destination == null) ? "page" : destination;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user