[Web] Queue manager for Postfix
[Web] Add sogo_access mail attribute [Web] Allow to wipe SOGo profiles
This commit is contained in:
@@ -5,18 +5,6 @@ jQuery(function($){
|
||||
var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};
|
||||
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
||||
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
||||
$("#import_dkim_legend").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#import_dkim_arrow').toggleClass("animation");
|
||||
});
|
||||
$("#duplicate_dkim_legend").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#duplicate_dkim_arrow').toggleClass("animation");
|
||||
});
|
||||
$("#api_legend").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$('#api_arrow').toggleClass("animation");
|
||||
});
|
||||
$("#rspamd_preset_1").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
$("form[data-id=rsetting]").find("#adminRspamdSettingsDesc").val(lang.rsettings_preset_1);
|
||||
@@ -35,15 +23,40 @@ jQuery(function($){
|
||||
});
|
||||
$('#dkim_add_domains').val(domains);
|
||||
});
|
||||
$("#mass_exclude").change(function(){
|
||||
$("#mass_include").selectpicker('deselectAll');
|
||||
});
|
||||
$("#mass_include").change(function(){
|
||||
$("#mass_exclude").selectpicker('deselectAll');
|
||||
});
|
||||
$("#mass_disarm").click(function() {
|
||||
$("#mass_send").attr("disabled", !this.checked);
|
||||
$("#import_dkim_legend").on('click', function(e) { e.preventDefault(); $('#import_dkim_arrow').toggleClass("animation"); });
|
||||
$("#duplicate_dkim_legend").on('click', function(e) { e.preventDefault(); $('#duplicate_dkim_arrow').toggleClass("animation"); });
|
||||
$("#api_legend").on('click', function(e) { e.preventDefault(); $('#api_arrow').toggleClass("animation"); });
|
||||
$("#mass_exclude").change(function(){ $("#mass_include").selectpicker('deselectAll'); });
|
||||
$("#mass_include").change(function(){ $("#mass_exclude").selectpicker('deselectAll'); });
|
||||
$("#mass_disarm").click(function() { $("#mass_send").attr("disabled", !this.checked); });
|
||||
$("#super_delete").click(function() { return confirm(lang.queue_ays); });
|
||||
$(".refresh_table").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var table_name = $(this).data('table');
|
||||
$('#' + table_name).find("tr.footable-empty").remove();
|
||||
draw_table = $(this).data('draw');
|
||||
eval(draw_table + '()');
|
||||
});
|
||||
if (localStorage.getItem("current_page") === null) {
|
||||
var current_page = {};
|
||||
} else {
|
||||
var current_page = JSON.parse(localStorage.getItem('current_page'));
|
||||
}
|
||||
function table_admin_ready(ft, name) {
|
||||
heading = ft.$el.parents('.tab-pane').find('.panel-heading')
|
||||
var ft_paging = ft.use(FooTable.Paging)
|
||||
$(heading).children('.table-lines').text(function(){
|
||||
return ft_paging.totalRows;
|
||||
})
|
||||
if (current_page[name]) {
|
||||
ft_paging.goto(parseInt(current_page[name]))
|
||||
}
|
||||
}
|
||||
function paging_admin_after(ft, name) {
|
||||
var ft_paging = ft.use(FooTable.Paging)
|
||||
current_page[name] = ft_paging.current;
|
||||
localStorage.setItem('current_page', JSON.stringify(current_page));
|
||||
}
|
||||
function draw_domain_admins() {
|
||||
ft_domainadmins = FooTable.init('#domainadminstable', {
|
||||
"columns": [
|
||||
@@ -150,6 +163,43 @@ jQuery(function($){
|
||||
"sorting": {"enabled": true}
|
||||
});
|
||||
}
|
||||
function draw_queue() {
|
||||
ft_queuetable = FooTable.init('#queuetable', {
|
||||
"columns": [
|
||||
{"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
|
||||
{"name":"queue_id","type":"text","title":"QID","style":{"width":"50px"}},
|
||||
{"name":"queue_name","type":"text","title":"Queue","style":{"width":"120px"}},
|
||||
{"name":"arrival_time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.arrival_time,"style":{"width":"170px"}},
|
||||
{"name":"message_size","style":{"whiteSpace":"nowrap"},"title":lang.message_size,"formatter": function(value){
|
||||
return humanFileSize(value);
|
||||
}},
|
||||
{"name":"sender","title":lang.sender, "type": "text","breakpoints":"xs sm"},
|
||||
{"name":"recipients","title":lang.recipients, "type": "text","breakpoints":"xs sm"},
|
||||
],
|
||||
"rows": $.ajax({
|
||||
dataType: 'json',
|
||||
url: '/api/v1/get/mailq',
|
||||
jsonp: false,
|
||||
error: function () {
|
||||
console.log('Cannot draw forwarding hosts table');
|
||||
},
|
||||
success: function (data) {
|
||||
return process_table_data(data, 'queuetable');
|
||||
}
|
||||
}),
|
||||
"empty": lang.empty,
|
||||
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
|
||||
"sorting": {"enabled": true},
|
||||
"on": {
|
||||
"ready.ft.table": function(e, ft){
|
||||
table_admin_ready(ft, 'queuetable');
|
||||
},
|
||||
"after.ft.paging": function(e, ft){
|
||||
paging_admin_after(ft, 'queuetable');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function process_table_data(data, table) {
|
||||
if (table == 'relayhoststable') {
|
||||
@@ -161,6 +211,11 @@ jQuery(function($){
|
||||
'</div>';
|
||||
item.chkbox = '<input type="checkbox" data-id="rlyhosts" name="multi_select" value="' + item.id + '" />';
|
||||
});
|
||||
} else if (table == 'queuetable') {
|
||||
$.each(data, function (i, item) {
|
||||
item.chkbox = '<input type="checkbox" data-id="mailqitems" name="multi_select" value="' + item.queue_id + '" />';
|
||||
item.recipients = JSON.stringify(item.recipients);
|
||||
});
|
||||
} else if (table == 'forwardinghoststable') {
|
||||
$.each(data, function (i, item) {
|
||||
item.action = '<div class="btn-group">' +
|
||||
@@ -206,6 +261,7 @@ jQuery(function($){
|
||||
draw_admins();
|
||||
draw_fwd_hosts();
|
||||
draw_relayhosts();
|
||||
draw_queue();
|
||||
// Relayhost
|
||||
$('#testRelayhostModal').on('show.bs.modal', function (e) {
|
||||
$('#test_relayhost_result').text("-");
|
||||
@@ -225,9 +281,9 @@ jQuery(function($){
|
||||
dataType: 'text',
|
||||
data: $('#test_relayhost_form').serialize(),
|
||||
complete: function (data) {
|
||||
$('#test_relayhost_result').html(data.responseText);
|
||||
$('#test_relayhost').prop("disabled",false);
|
||||
$('#test_relayhost').text(prev);
|
||||
$('#test_relayhost_result').html(data.responseText);
|
||||
$('#test_relayhost').prop("disabled",false);
|
||||
$('#test_relayhost').text(prev);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
@@ -58,7 +58,6 @@ $(document).ready(function() {
|
||||
$(this.$domain).closest("select").selectpicker();
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-fill domain quota when adding new domain
|
||||
auto_fill_quota = function(domain) {
|
||||
$.get("/api/v1/get/domain/" + domain, function(data){
|
||||
@@ -80,7 +79,6 @@ $(document).ready(function() {
|
||||
auto_fill_quota($('#addSelectDomain').val());
|
||||
});
|
||||
auto_fill_quota($('#addSelectDomain').val());
|
||||
|
||||
$(".generate_password").click(function( event ) {
|
||||
event.preventDefault();
|
||||
$('[data-hibp]').trigger('input');
|
||||
@@ -90,7 +88,6 @@ $(document).ready(function() {
|
||||
$(this).closest("form").find("input[name='password']").val(random_passwd);
|
||||
$(this).closest("form").find("input[name='password2']").val(random_passwd);
|
||||
});
|
||||
|
||||
$(".goto_checkbox").click(function( event ) {
|
||||
$("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false);
|
||||
if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) {
|
||||
@@ -108,7 +105,6 @@ $(document).ready(function() {
|
||||
$("#textarea_alias_goto").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
// Log modal
|
||||
$('#syncjobLogModal').on('show.bs.modal', function(e) {
|
||||
var syncjob_id = $(e.relatedTarget).data('syncjob-id');
|
||||
@@ -124,7 +120,6 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Log modal
|
||||
$('#dnsInfoModal').on('show.bs.modal', function(e) {
|
||||
var domain = $(e.relatedTarget).data('domain');
|
||||
@@ -141,13 +136,11 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Sieve data modal
|
||||
$('#sieveDataModal').on('show.bs.modal', function(e) {
|
||||
var sieveScript = $(e.relatedTarget).data('sieve-script');
|
||||
$(e.currentTarget).find('#sieveDataText').html('<pre style="font-size:14px;line-height:1.1">' + sieveScript + '</pre>');
|
||||
});
|
||||
|
||||
// Set line numbers for textarea
|
||||
$("#script_data").numberedtextarea({allowTabChar: true});
|
||||
// Disable submit button on script change
|
||||
@@ -155,7 +148,6 @@ $(document).ready(function() {
|
||||
$('#add_filter_btns > #add_item').attr({"disabled": true});
|
||||
$('#validation_msg').html('-');
|
||||
});
|
||||
|
||||
// Validate script data
|
||||
$("#validate_sieve").click(function( event ) {
|
||||
event.preventDefault();
|
||||
@@ -185,21 +177,8 @@ $(document).ready(function() {
|
||||
});
|
||||
jQuery(function($){
|
||||
// http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
|
||||
var entityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
function escapeHtml(string) {
|
||||
return String(string).replace(/[&<>"'`=\/]/g, function (s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};
|
||||
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
||||
if (localStorage.getItem("current_page") === null) {
|
||||
var current_page = {};
|
||||
} else {
|
||||
@@ -210,23 +189,7 @@ jQuery(function($){
|
||||
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(email);
|
||||
}
|
||||
// Calculation human readable file sizes
|
||||
function humanFileSize(bytes) {
|
||||
if(Math.abs(bytes) < 1024) {
|
||||
return bytes + ' B';
|
||||
}
|
||||
var units = ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
|
||||
var u = -1;
|
||||
do {
|
||||
bytes /= 1024;
|
||||
++u;
|
||||
} while(Math.abs(bytes) >= 1024 && u < units.length - 1);
|
||||
return bytes.toFixed(1)+' '+units[u];
|
||||
}
|
||||
function unix_time_format(tm) {
|
||||
var date = new Date(tm ? tm * 1000 : 0);
|
||||
return date.toLocaleString();
|
||||
}
|
||||
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
||||
$(".refresh_table").on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var table_name = $(this).data('table');
|
||||
@@ -241,7 +204,7 @@ jQuery(function($){
|
||||
.removeAttr("href")
|
||||
.attr("title", "Dual login cannot be used twice")
|
||||
.tooltip();
|
||||
}
|
||||
}
|
||||
heading = ft.$el.parents('.tab-pane').find('.panel-heading')
|
||||
var ft_paging = ft.use(FooTable.Paging)
|
||||
$(heading).children('.table-lines').text(function(){
|
||||
|
Reference in New Issue
Block a user