mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-26 11:14:23 +01:00
All functions are back. Big refactoring of this module, the last thing that remains is the need of DB optimization for big tables.
172 lines
4.6 KiB
HTML
172 lines
4.6 KiB
HTML
{% extends "common/email_listing.html" %}
|
|
{% load i18n %}
|
|
{% load amextras %}
|
|
{% block css %}
|
|
#searchbox {
|
|
/*float: left;*/ /* Marche pas ici?! obligé de le faire en JS sous FF */
|
|
margin-right: 10px;
|
|
z-index: 2;
|
|
position: relative;
|
|
}
|
|
|
|
#searchbox img {
|
|
float: left;
|
|
margin-top: 4px;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
#searchparams {
|
|
background: white;
|
|
padding: 5px;
|
|
width: 90%;
|
|
border-bottom: 5px solid #CCCCCC;
|
|
border-left: 5px solid #CCCCCC;
|
|
border-right: 5px solid #CCCCCC;
|
|
}
|
|
|
|
thead tr {
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
tr.table-tr-selected {
|
|
background: #ffffcc;
|
|
}
|
|
{% endblock %}
|
|
{% block js %}
|
|
mysubmit = function(event, name) {
|
|
event.stop();
|
|
var selection = new Array();
|
|
$$("tr[class*=table-tr-selected]").each(function(item) {
|
|
selection.push(item.get("id"));
|
|
});
|
|
new Element("input", {
|
|
"type" : "hidden", "name" : "selection", "value" : selection
|
|
}).inject($("listingform"), "top");
|
|
new Element('input', {
|
|
'type' : 'hidden', 'name' : "action", style: "display:none", 'value' : name
|
|
}).inject($("listingform"), "top");
|
|
{% url extensions.amavis_quarantine.main.process as actionurl %}
|
|
$("listingform").set("action", "{{ actionurl }}");
|
|
$("listingform").set("send", {
|
|
onSuccess : function(res) {
|
|
response = JSON.decode(res);
|
|
actioncallback(response);
|
|
}
|
|
});
|
|
$("listingform").send();
|
|
}
|
|
|
|
updatehash = function(evt) {
|
|
evt.stop();
|
|
current_anchor.parse_string(evt.target.get("href"), true).setparams(navparams);
|
|
current_anchor.update();
|
|
}
|
|
|
|
appendhash = function(evt) {
|
|
evt.stop();
|
|
location.hash += evt.target.get("href");
|
|
}
|
|
|
|
updateparams = function(evt) {
|
|
evt.stop();
|
|
current_anchor.updateparams(evt.target.get("href"));
|
|
current_anchor.update();
|
|
}
|
|
|
|
register_callback("_listing", function(resp) {
|
|
updatelisting(resp);
|
|
|
|
tbl = new HtmlTable($("emails"), {
|
|
selectable: true
|
|
});
|
|
if ($("toggleselect")) {
|
|
$("toggleselect").addEvent("click", function(evt) {
|
|
if ($$("tr[class*=table-tr-selected]").length) {
|
|
tbl.selectNone();
|
|
} else {
|
|
tbl.selectAll();
|
|
}
|
|
});
|
|
}
|
|
$$("a[name=release]").addEvent("click", function(event) {
|
|
if (!checkTableSelection("{% trans "Release this selection?" %}")) {
|
|
event.stop();
|
|
return;
|
|
}
|
|
mysubmit(event, "release");
|
|
});
|
|
$$("a[name=delete]").addEvent("click", function(event) {
|
|
if (!checkTableSelection("{% trans "Delete this selection?" %}")) {
|
|
event.stop();
|
|
return;
|
|
}
|
|
mysubmit(event, "delete");
|
|
});
|
|
|
|
var myFx = new Fx.Slide($("searchparams"));
|
|
myFx.hide();
|
|
$("searchopts").addEvent("click", function(event) {
|
|
myFx.cancel();
|
|
myFx.toggle();
|
|
});
|
|
$$("input[name=scriteria]").addEvent("click", function(event) {
|
|
myFx.cancel();
|
|
myFx.toggle();
|
|
});
|
|
$("searchfield").addEvent("change", function(event) {
|
|
var criteria = "";
|
|
$$("input[name=scriteria]:checked").each(function(obj) {
|
|
criteria = obj.value;
|
|
});
|
|
var url = "listing"
|
|
+ "?pattern=" + $("searchfield").value
|
|
+ "&criteria=" + criteria;
|
|
current_anchor.parse_string(url, true).setparams(navparams);
|
|
current_anchor.update();
|
|
});
|
|
$("searchfield").addEvent("click", function(event) {
|
|
$("searchfield").select();
|
|
});
|
|
|
|
$("searchfield").addEvent("blur", function(event) {
|
|
if ($("searchfield").value == "") {
|
|
$("searchfield").set("value", "{% trans "Search..." %}");
|
|
}
|
|
});
|
|
$("searchbox").setStyle("float", "left");
|
|
$$("tr").addEvent("dblclick", viewmail);
|
|
});
|
|
|
|
actioncallback = function(resp) {
|
|
$("listing").set("html", "");
|
|
$("menubar").set("html", "");
|
|
$("navbar").set("html", "");
|
|
if (resp.status == "ok") {
|
|
infobox.show(resp.message, "green", 1);
|
|
} else {
|
|
infobox.show(resp.message, "red", 1);
|
|
}
|
|
current_anchor.parse_string(resp.url, true).setparams(navparams);
|
|
current_anchor.update(1);
|
|
}
|
|
|
|
actionclick = function(evt) {
|
|
evt.stop();
|
|
new Request.JSON({
|
|
url: evt.target.get("href"),
|
|
onSuccess: actioncallback
|
|
}).get();
|
|
}
|
|
|
|
register_callback("viewmail", function(resp) {
|
|
updatelisting(resp);
|
|
$$("a[name=back]").addEvent("click", updatehash);
|
|
$$("a[name=delete]").addEvent("click", actionclick);
|
|
$$("a[name=release]").addEvent("click", actionclick);
|
|
$$("a[name=viewmode]").addEvent("click", updateparams);
|
|
setDivHeight("mailcontent", 5, 0);
|
|
});
|
|
{% endblock %}
|
|
{% block middletitle %}{% trans "Quarantine" %}{% endblock %}
|