2017-05-23 09:36:59 +02:00
|
|
|
$(document).ready(function() {
|
2020-03-01 11:21:23 +01:00
|
|
|
mass_action = false;
|
2020-02-21 09:21:03 +01:00
|
|
|
function validateEmail(email) {
|
|
|
|
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);
|
|
|
|
}
|
2020-04-16 21:58:30 +02:00
|
|
|
function validateRegex(e){var t=e.split("/"),n=e,r="";t.length>1&&(n=t[1],r=t[2]);try{return new RegExp(n,r),!0}catch(e){return!1}}
|
2018-01-11 22:40:43 +01:00
|
|
|
function is_active(elem) {
|
|
|
|
if ($(elem).data('submitted') == '1') {
|
|
|
|
return true;
|
|
|
|
} else {
|
2018-08-13 23:20:40 +02:00
|
|
|
var parent_btn_grp = $(elem).parentsUntil(".btn-group").parent();
|
|
|
|
if (parent_btn_grp.hasClass('btn-group')) {
|
2018-09-09 21:17:59 +02:00
|
|
|
parent_btn_grp.replaceWith('<button class="btn btn-default btn-sm" disabled>' + lang_footer.loading + '</a>');
|
2018-08-13 23:20:40 +02:00
|
|
|
}
|
2018-09-09 21:17:59 +02:00
|
|
|
$(elem).text(lang_footer.loading);
|
2018-01-11 22:40:43 +01:00
|
|
|
$(elem).attr('data-submitted', '1');
|
|
|
|
function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which || e.keyCode) == 82) e.preventDefault(); };
|
|
|
|
$(document).on("keydown", disableF5);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2017-05-23 22:23:46 +02:00
|
|
|
$.fn.serializeObject = function() {
|
|
|
|
var o = {};
|
|
|
|
var a = this.serializeArray();
|
|
|
|
$.each(a, function() {
|
|
|
|
if (o[this.name]) {
|
|
|
|
if (!o[this.name].push) {
|
|
|
|
o[this.name] = [o[this.name]];
|
|
|
|
}
|
|
|
|
o[this.name].push(this.value || '');
|
|
|
|
} else {
|
|
|
|
o[this.name] = this.value || '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return o;
|
|
|
|
};
|
2017-10-21 10:07:06 +02:00
|
|
|
// Collect values of input fields with name "multi_select" and same data-id to js array multi_data[data-id]
|
2017-05-23 09:36:59 +02:00
|
|
|
var multi_data = [];
|
2020-03-01 11:21:23 +01:00
|
|
|
$(document).on('change', 'input[name=multi_select]:checkbox', function(e) {
|
|
|
|
if(mass_action === true) {
|
|
|
|
multi_data = [];
|
|
|
|
mass_action = false;
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
if ($(this).is(':checked') && $(this).data('id')) {
|
|
|
|
var id = $(this).data('id');
|
|
|
|
if (typeof multi_data[id] == "undefined") {
|
|
|
|
multi_data[id] = [];
|
|
|
|
}
|
|
|
|
multi_data[id].push($(this).val());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
var id = $(this).data('id');
|
2020-03-01 11:21:23 +01:00
|
|
|
if (typeof multi_data[id] !== "undefined") {
|
|
|
|
multi_data[id].splice($.inArray($(this).val(), multi_data[id]),1);
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Select checkbox by click on parent tr
|
|
|
|
$(document).on('click', 'tbody>tr', function(e) {
|
2017-05-29 21:51:06 +02:00
|
|
|
if(e.target.tagName.toLowerCase() === 'button') {
|
2017-05-23 09:36:59 +02:00
|
|
|
e.stopPropagation();
|
2017-05-29 21:51:06 +02:00
|
|
|
}
|
|
|
|
else if(e.target.tagName.toLowerCase() === 'a') {
|
|
|
|
e.stopPropagation();
|
|
|
|
}
|
|
|
|
else if (e.target.type == "checkbox") {
|
|
|
|
e.stopPropagation();
|
|
|
|
}
|
|
|
|
else {
|
2017-05-23 09:36:59 +02:00
|
|
|
var checkbox = $(this).find(':checkbox');
|
|
|
|
checkbox.trigger('click');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Select or deselect all checkboxes with same data-id
|
|
|
|
$(document).on('click', '#toggle_multi_select_all', function(e) {
|
2020-03-01 11:21:23 +01:00
|
|
|
mass_action = true
|
2017-05-23 09:36:59 +02:00
|
|
|
e.preventDefault();
|
|
|
|
id = $(this).data("id");
|
|
|
|
var all_checkboxes = $("input[data-id=" + id + "]:enabled");
|
|
|
|
all_checkboxes.prop("checked", !all_checkboxes.prop("checked")).change();
|
|
|
|
});
|
|
|
|
|
|
|
|
// General API edit actions
|
[Docker API] Use TLS encryption for communication with "on-the-fly" created key paris (non-exposed)
[Docker API] Create pipe to pass Rspamd UI worker password
[Dovecot] Pull Spamassassin ruleset to be read by Rspamd (MANY THANKS to Peer Heinlein!)
[Dovecot] Garbage collector for deleted maildirs (set keep time via MAILDIR_GC_TIME which defaults to 1440 minutes)
[Web] Flush memcached after mailbox item changes, fixes #1808
[Web] Fix duplicate IDs, fixes #1792
[Compose] Use SQL sockets
[PHP-FPM] Update APCu and Redis libs
[Dovecot] Encrypt maildir with global key pair in crypt-vol-1 (BACKUP!), also fixes #1791
[Web] Fix deletion of spam aliases
[Helper] Add "crypt" to backup script
[Helper] Override file for external SQL socket (not supported!)
[Compose] New images for Rspamd, PHP-FPM, SOGo, Dovecot, Docker API, Watchdog, ACME, Postfix
2018-09-29 22:01:23 +02:00
|
|
|
$(document).on('click', "[data-action='edit_selected']", function(e) {
|
2017-05-23 09:36:59 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var id = $(this).data('id');
|
|
|
|
var api_url = $(this).data('api-url');
|
|
|
|
var api_attr = $(this).data('api-attr');
|
2017-11-03 20:37:24 +01:00
|
|
|
if (typeof $(this).data('api-reload-window') !== 'undefined') {
|
|
|
|
api_reload_window = $(this).data('api-reload-window');
|
|
|
|
} else {
|
|
|
|
api_reload_window = true;
|
|
|
|
}
|
2018-10-11 11:59:23 +02:00
|
|
|
if (typeof $(this).data('api-reload-location') !== 'undefined') {
|
|
|
|
api_reload_location = $(this).data('api-reload-location');
|
|
|
|
} else {
|
|
|
|
api_reload_location = '#';
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
// 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) {
|
2018-07-27 22:19:59 +02:00
|
|
|
var invalid = false;
|
2017-07-16 11:03:28 +02:00
|
|
|
$(this).closest("form").find('select, textarea, input').each(function() {
|
|
|
|
if ($(this).prop('required')) {
|
2017-09-16 13:17:37 +02:00
|
|
|
if (!$(this).val() && $(this).prop('disabled') === false) {
|
2018-07-27 22:19:59 +02:00
|
|
|
invalid = true;
|
2020-10-23 20:23:54 +02:00
|
|
|
if ($(this).is("select")) {
|
|
|
|
$(this).selectpicker('setStyle', 'btn-input-missing', 'add');
|
|
|
|
}
|
2017-07-16 11:03:28 +02:00
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
2020-10-23 20:23:54 +02:00
|
|
|
if ($(this).is("select")) {
|
|
|
|
$(this).selectpicker('setStyle', 'btn-input-missing', 'remove');
|
|
|
|
}
|
2017-07-16 11:03:28 +02:00
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
2020-02-26 13:58:41 +01:00
|
|
|
if ($(this).val() && $(this).attr("type") == 'email') {
|
2020-02-21 09:21:03 +01:00
|
|
|
if (!validateEmail($(this).val())) {
|
2020-01-10 20:49:07 +01:00
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
2017-11-08 11:07:32 +01:00
|
|
|
if ($(this).attr("max")) {
|
2018-01-12 08:30:54 +01:00
|
|
|
if (Number($(this).val()) > Number($(this).attr("max"))) {
|
2017-11-08 11:07:32 +01:00
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
if ($(this).attr("min")) {
|
2018-01-12 08:30:54 +01:00
|
|
|
if (Number($(this).val()) < Number($(this).attr("min"))) {
|
2017-11-08 11:07:32 +01:00
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-16 21:58:30 +02:00
|
|
|
if ($(this).val() && $(this).attr("regex")) {
|
|
|
|
var regex_content = $(this).val();
|
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
if(!validateRegex(regex_content)) {
|
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
if(!regex_content.startsWith('/') || !/\/[ims]?$/.test(regex_content)){
|
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
2017-07-16 11:03:28 +02:00
|
|
|
});
|
2018-07-27 22:19:59 +02:00
|
|
|
if (!invalid) {
|
2017-07-16 11:03:28 +02:00
|
|
|
var attr_to_merge = $(this).closest("form").serializeObject();
|
|
|
|
var api_attr = $.extend(api_attr, attr_to_merge)
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
2017-12-09 13:17:15 +01:00
|
|
|
// alert(JSON.stringify(api_attr));
|
2017-05-23 09:36:59 +02:00
|
|
|
// If clicked element #edit_selected has data-item attribute, it is added to "items"
|
|
|
|
if (typeof $(this).data('item') !== 'undefined') {
|
|
|
|
var id = $(this).data('id');
|
|
|
|
if (typeof multi_data[id] == "undefined") {
|
|
|
|
multi_data[id] = [];
|
|
|
|
}
|
2018-06-25 22:32:46 +02:00
|
|
|
multi_data[id].splice($.inArray($(this).data('item'), multi_data[id]), 1);
|
2017-05-23 09:36:59 +02:00
|
|
|
multi_data[id].push($(this).data('item'));
|
|
|
|
}
|
|
|
|
if (typeof multi_data[id] == "undefined") return;
|
|
|
|
api_items = multi_data[id];
|
2018-02-09 22:45:04 +01:00
|
|
|
for (var i in api_items) {
|
|
|
|
api_items[i] = decodeURIComponent(api_items[i]);
|
|
|
|
}
|
2017-07-16 11:03:28 +02:00
|
|
|
// alert(JSON.stringify(api_attr));
|
2017-05-23 09:36:59 +02:00
|
|
|
if (Object.keys(api_items).length !== 0) {
|
2018-01-11 22:40:43 +01:00
|
|
|
if (is_active($(this))) { return false; }
|
2017-05-23 09:36:59 +02:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
dataType: "json",
|
2017-05-26 23:02:04 +02:00
|
|
|
data: {
|
|
|
|
"items": JSON.stringify(api_items),
|
|
|
|
"attr": JSON.stringify(api_attr),
|
|
|
|
"csrf_token": csrf_token
|
|
|
|
},
|
2017-05-23 09:36:59 +02:00
|
|
|
url: '/api/v1/' + api_url,
|
|
|
|
jsonp: false,
|
2017-05-26 23:02:04 +02:00
|
|
|
complete: function(data) {
|
2017-10-21 10:07:06 +02:00
|
|
|
var response = (data.responseText);
|
2017-12-09 13:17:15 +01:00
|
|
|
if (typeof response !== 'undefined' && response.length !== 0) {
|
|
|
|
response_obj = JSON.parse(response);
|
|
|
|
}
|
2017-11-03 20:37:24 +01:00
|
|
|
if (api_reload_window === true) {
|
2018-10-11 11:59:23 +02:00
|
|
|
if (api_reload_location != '#') {
|
|
|
|
window.location.replace(api_reload_location)
|
|
|
|
} else {
|
|
|
|
window.location = window.location.href.split("#")[0];
|
|
|
|
}
|
2017-11-03 20:37:24 +01:00
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// General API add actions
|
[Docker API] Use TLS encryption for communication with "on-the-fly" created key paris (non-exposed)
[Docker API] Create pipe to pass Rspamd UI worker password
[Dovecot] Pull Spamassassin ruleset to be read by Rspamd (MANY THANKS to Peer Heinlein!)
[Dovecot] Garbage collector for deleted maildirs (set keep time via MAILDIR_GC_TIME which defaults to 1440 minutes)
[Web] Flush memcached after mailbox item changes, fixes #1808
[Web] Fix duplicate IDs, fixes #1792
[Compose] Use SQL sockets
[PHP-FPM] Update APCu and Redis libs
[Dovecot] Encrypt maildir with global key pair in crypt-vol-1 (BACKUP!), also fixes #1791
[Web] Fix deletion of spam aliases
[Helper] Add "crypt" to backup script
[Helper] Override file for external SQL socket (not supported!)
[Compose] New images for Rspamd, PHP-FPM, SOGo, Dovecot, Docker API, Watchdog, ACME, Postfix
2018-09-29 22:01:23 +02:00
|
|
|
$(document).on('click', "[data-action='add_item']", function(e) {
|
2017-05-23 09:36:59 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var id = $(this).data('id');
|
|
|
|
var api_url = $(this).data('api-url');
|
|
|
|
var api_attr = $(this).data('api-attr');
|
2017-12-09 13:17:15 +01:00
|
|
|
if (typeof $(this).data('api-reload-window') !== 'undefined') {
|
|
|
|
api_reload_window = $(this).data('api-reload-window');
|
|
|
|
} else {
|
|
|
|
api_reload_window = true;
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
// If clicked button 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) {
|
2017-11-08 11:07:32 +01:00
|
|
|
var invalid = false;
|
2017-05-26 23:02:04 +02:00
|
|
|
$(this).closest("form").find('select, textarea, input').each(function() {
|
|
|
|
if ($(this).prop('required')) {
|
2017-09-16 13:17:37 +02:00
|
|
|
if (!$(this).val() && $(this).prop('disabled') === false) {
|
2017-11-08 11:07:32 +01:00
|
|
|
invalid = true;
|
2020-10-23 20:23:54 +02:00
|
|
|
if ($(this).is("select")) {
|
|
|
|
$(this).selectpicker('setStyle', 'btn-input-missing', 'add');
|
|
|
|
}
|
2017-05-26 23:02:04 +02:00
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
2020-10-23 20:23:54 +02:00
|
|
|
if ($(this).is("select")) {
|
|
|
|
$(this).selectpicker('setStyle', 'btn-input-missing', 'remove');
|
|
|
|
}
|
2017-05-26 23:02:04 +02:00
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
2020-01-10 20:49:07 +01:00
|
|
|
if ($(this).attr("type") == 'email') {
|
|
|
|
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
|
|
if (!emailReg.test($(this).val())) {
|
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
2017-11-08 11:07:32 +01:00
|
|
|
if ($(this).attr("max")) {
|
2018-01-12 08:30:54 +01:00
|
|
|
if (Number($(this).val()) > Number($(this).attr("max"))) {
|
2017-11-08 11:07:32 +01:00
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
if ($(this).attr("min")) {
|
2018-01-12 08:30:54 +01:00
|
|
|
if (Number($(this).val()) < Number($(this).attr("min"))) {
|
2017-11-08 11:07:32 +01:00
|
|
|
invalid = true;
|
|
|
|
$(this).addClass('inputMissingAttr');
|
|
|
|
} else {
|
|
|
|
$(this).removeClass('inputMissingAttr');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-05-26 23:02:04 +02:00
|
|
|
});
|
2017-11-08 11:07:32 +01:00
|
|
|
if (!invalid) {
|
2017-05-26 23:02:04 +02:00
|
|
|
var attr_to_merge = $(this).closest("form").serializeObject();
|
|
|
|
var api_attr = $.extend(api_attr, attr_to_merge)
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
2018-01-11 22:40:43 +01:00
|
|
|
if (is_active($(this))) { return false; }
|
2017-07-29 10:32:17 +02:00
|
|
|
// alert(JSON.stringify(api_attr));
|
2017-05-23 09:36:59 +02:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
dataType: "json",
|
2017-05-26 23:02:04 +02:00
|
|
|
data: {
|
|
|
|
"attr": JSON.stringify(api_attr),
|
|
|
|
"csrf_token": csrf_token
|
|
|
|
},
|
2017-05-23 09:36:59 +02:00
|
|
|
url: '/api/v1/' + api_url,
|
|
|
|
jsonp: false,
|
2017-05-26 23:02:04 +02:00
|
|
|
complete: function(data) {
|
2017-12-09 13:17:15 +01:00
|
|
|
var response = (data.responseText);
|
|
|
|
if (typeof response !== 'undefined' && response.length !== 0) {
|
|
|
|
response_obj = JSON.parse(response);
|
2018-08-13 23:20:40 +02:00
|
|
|
unset = true;
|
|
|
|
$.each(response_obj, function(i, v) {
|
|
|
|
if (v.type == "danger") {
|
|
|
|
unset = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (unset === true) {
|
|
|
|
unset = null;
|
2020-02-06 07:03:03 +01:00
|
|
|
// Keep form data for sync jobs
|
|
|
|
if (id != "add_syncjob") {
|
|
|
|
$('form').formcache('clear');
|
|
|
|
$('form').formcache('destroy');
|
|
|
|
var i = localStorage.length;
|
|
|
|
while(i--) {
|
|
|
|
var key = localStorage.key(i);
|
|
|
|
if(/formcache/.test(key)) {
|
|
|
|
localStorage.removeItem(key);
|
|
|
|
}
|
|
|
|
}
|
2018-08-13 23:20:40 +02:00
|
|
|
}
|
2017-12-09 13:17:15 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
var add_modal = $('.modal.in').attr('id');
|
|
|
|
localStorage.setItem("add_modal", add_modal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (api_reload_window === true) {
|
|
|
|
window.location = window.location.href.split("#")[0];
|
|
|
|
}
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2017-05-26 23:02:04 +02:00
|
|
|
|
2017-05-23 09:36:59 +02:00
|
|
|
// General API delete actions
|
[Docker API] Use TLS encryption for communication with "on-the-fly" created key paris (non-exposed)
[Docker API] Create pipe to pass Rspamd UI worker password
[Dovecot] Pull Spamassassin ruleset to be read by Rspamd (MANY THANKS to Peer Heinlein!)
[Dovecot] Garbage collector for deleted maildirs (set keep time via MAILDIR_GC_TIME which defaults to 1440 minutes)
[Web] Flush memcached after mailbox item changes, fixes #1808
[Web] Fix duplicate IDs, fixes #1792
[Compose] Use SQL sockets
[PHP-FPM] Update APCu and Redis libs
[Dovecot] Encrypt maildir with global key pair in crypt-vol-1 (BACKUP!), also fixes #1791
[Web] Fix deletion of spam aliases
[Helper] Add "crypt" to backup script
[Helper] Override file for external SQL socket (not supported!)
[Compose] New images for Rspamd, PHP-FPM, SOGo, Dovecot, Docker API, Watchdog, ACME, Postfix
2018-09-29 22:01:23 +02:00
|
|
|
$(document).on('click', "[data-action='delete_selected']", function(e) {
|
2017-05-23 09:36:59 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var id = $(this).data('id');
|
|
|
|
// If clicked element #delete_selected has data-item attribute, it is added to "items"
|
|
|
|
if (typeof $(this).data('item') !== 'undefined') {
|
|
|
|
var id = $(this).data('id');
|
|
|
|
if (typeof multi_data[id] == "undefined") {
|
|
|
|
multi_data[id] = [];
|
|
|
|
}
|
2017-05-26 23:02:04 +02:00
|
|
|
multi_data[id].splice($.inArray($(this).data('item'), multi_data[id]), 1);
|
2017-05-23 09:36:59 +02:00
|
|
|
multi_data[id].push($(this).data('item'));
|
|
|
|
}
|
|
|
|
if (typeof $(this).data('text') !== 'undefined') {
|
|
|
|
$("#DeleteText").empty();
|
|
|
|
$("#DeleteText").text($(this).data('text'));
|
|
|
|
}
|
|
|
|
if (typeof multi_data[id] == "undefined" || multi_data[id] == "") return;
|
|
|
|
data_array = multi_data[id];
|
|
|
|
api_url = $(this).data('api-url');
|
2017-05-26 23:02:04 +02:00
|
|
|
$(document).on('show.bs.modal', '#ConfirmDeleteModal', function() {
|
2017-05-23 22:23:46 +02:00
|
|
|
$("#ItemsToDelete").empty();
|
|
|
|
for (var i in data_array) {
|
2018-02-09 22:45:04 +01:00
|
|
|
data_array[i] = decodeURIComponent(data_array[i]);
|
2017-05-23 22:23:46 +02:00
|
|
|
$("#ItemsToDelete").append("<li>" + data_array[i] + "</li>");
|
|
|
|
}
|
|
|
|
})
|
2022-06-06 20:38:24 +02:00
|
|
|
$('#ConfirmDeleteModal').modal('show')
|
2017-05-26 23:02:04 +02:00
|
|
|
.one('click', '#IsConfirmed', function(e) {
|
[Docker API] Use TLS encryption for communication with "on-the-fly" created key paris (non-exposed)
[Docker API] Create pipe to pass Rspamd UI worker password
[Dovecot] Pull Spamassassin ruleset to be read by Rspamd (MANY THANKS to Peer Heinlein!)
[Dovecot] Garbage collector for deleted maildirs (set keep time via MAILDIR_GC_TIME which defaults to 1440 minutes)
[Web] Flush memcached after mailbox item changes, fixes #1808
[Web] Fix duplicate IDs, fixes #1792
[Compose] Use SQL sockets
[PHP-FPM] Update APCu and Redis libs
[Dovecot] Encrypt maildir with global key pair in crypt-vol-1 (BACKUP!), also fixes #1791
[Web] Fix deletion of spam aliases
[Helper] Add "crypt" to backup script
[Helper] Override file for external SQL socket (not supported!)
[Compose] New images for Rspamd, PHP-FPM, SOGo, Dovecot, Docker API, Watchdog, ACME, Postfix
2018-09-29 22:01:23 +02:00
|
|
|
if (is_active($('#IsConfirmed'))) { return false; }
|
2017-05-26 23:02:04 +02:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
dataType: "json",
|
|
|
|
cache: false,
|
|
|
|
data: {
|
|
|
|
"items": JSON.stringify(data_array),
|
|
|
|
"csrf_token": csrf_token
|
|
|
|
},
|
|
|
|
url: '/api/v1/' + api_url,
|
|
|
|
jsonp: false,
|
|
|
|
complete: function(data) {
|
|
|
|
window.location = window.location.href.split("#")[0];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.one('click', '#isCanceled', function(e) {
|
|
|
|
// Remove event handler to allow to close modal and restart dialog without multiple submits
|
|
|
|
$('#ConfirmDeleteModal').off();
|
|
|
|
$('#ConfirmDeleteModal').modal('hide');
|
2017-05-23 22:23:46 +02:00
|
|
|
});
|
2017-05-23 09:36:59 +02:00
|
|
|
});
|
2019-01-29 00:20:39 +01:00
|
|
|
});
|