[Web] Fix require_once to always include document root

[Web] Add system mails (send mails to all mailboxes via LMTP)
[Web] Allow to add more administrators
[Web] Fix domain administrator editing
[Web] Remove some foreign keys
[Web] Remove username from API
[Web] Remove more .php extension from code
[Web] More minor fixes
This commit is contained in:
André
2018-10-11 11:59:23 +02:00
parent 32f7ae1d2e
commit 9f0be1d8a8
37 changed files with 1013 additions and 437 deletions

View File

@@ -35,6 +35,15 @@ 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);
});
function draw_domain_admins() {
ft_domainadmins = FooTable.init('#domainadminstable', {
"columns": [
@@ -63,6 +72,32 @@ jQuery(function($){
"sorting": {"enabled": true}
});
}
function draw_admins() {
ft_admins = FooTable.init('#adminstable', {
"columns": [
{"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
{"sorted": true,"name":"usr","title":lang.username,"style":{"width":"250px"}},
{"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"}},
{"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active},
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"250px","width":"250px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
],
"rows": $.ajax({
dataType: 'json',
url: '/api/v1/get/admin/all',
jsonp: false,
error: function () {
console.log('Cannot draw admin table');
},
success: function (data) {
return process_table_data(data, 'adminstable');
}
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": false},
"sorting": {"enabled": true}
});
}
function draw_fwd_hosts() {
ft_forwardinghoststable = FooTable.init('#forwardinghoststable', {
"columns": [
@@ -141,7 +176,8 @@ jQuery(function($){
});
} else if (table == 'domainadminstable') {
$.each(data, function (i, item) {
item.selected_domains = escapeHtml(item.selected_domains.toString().replace(/,/g, " "));
item.selected_domains = escapeHtml(item.selected_domains);
item.selected_domains = item.selected_domains.toString().replace(/,/g, "<br>");
item.chkbox = '<input type="checkbox" data-id="domain_admins" name="multi_select" value="' + item.username + '" />';
item.action = '<div class="btn-group">' +
'<a href="/edit/domainadmin/' + encodeURI(item.username) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
@@ -149,11 +185,25 @@ jQuery(function($){
'<a href="/index.php?duallogin=' + encodeURIComponent(item.username) + '" class="btn btn-xs btn-success"><span class="glyphicon glyphicon-user"></span> Login</a>' +
'</div>';
});
} else if (table == 'adminstable') {
$.each(data, function (i, item) {
if (admin_username == item.username) {
item.usr = '→ ' + item.username;
} else {
item.usr = item.username;
}
item.chkbox = '<input type="checkbox" data-id="admins" name="multi_select" value="' + item.username + '" />';
item.action = '<div class="btn-group">' +
'<a href="/edit/admin/' + encodeURI(item.username) + '" class="btn btn-xs btn-default"><span class="glyphicon glyphicon-pencil"></span> ' + lang.edit + '</a>' +
'<a href="#" data-action="delete_selected" data-id="single-admin" data-api-url="delete/admin" data-item="' + encodeURI(item.username) + '" class="btn btn-xs btn-danger"><span class="glyphicon glyphicon-trash"></span> ' + lang.remove + '</a>' +
'</div>';
});
}
return data
};
// Initial table drawings
draw_domain_admins();
draw_admins();
draw_fwd_hosts();
draw_relayhosts();
// Relayhost

View File

@@ -81,6 +81,11 @@ $(document).ready(function() {
} else {
api_reload_window = true;
}
if (typeof $(this).data('api-reload-location') !== 'undefined') {
api_reload_location = $(this).data('api-reload-location');
} else {
api_reload_location = '#';
}
// If clicked element #edit_selected is in a form with the same data-id as the button,
// we merge all input fields by {"name":"value"} into api-attr
if ($(this).closest("form").data('id') == id) {
@@ -151,7 +156,11 @@ $(document).ready(function() {
response_obj = JSON.parse(response);
}
if (api_reload_window === true) {
window.location = window.location.href.split("#")[0];
if (api_reload_location != '#') {
window.location.replace(api_reload_location)
} else {
window.location = window.location.href.split("#")[0];
}
}
}
});

View File

@@ -513,7 +513,13 @@ jQuery(function($){
} else if (table == 'general_syslog') {
$.each(data, function (i, item) {
if (item === null) { return true; }
item.message = escapeHtml(item.message);
if (item.message.match("^base64,")) {
item.message = atob(item.message.slice(7));
item.message = item.message.replace(/(?!^)acme-client:/g, '<br>acme-client:')
item.message = item.message.replace(/acme-client:/g, '<b>acme-client:</b>')
} else {
item.message = escapeHtml(item.message);
}
var danger_class = ["emerg", "alert", "crit", "err"];
var warning_class = ["warning", "warn"];
var info_class = ["notice", "info", "debug"];