2017-09-15 09:05:51 +02:00
|
|
|
$(document).ready(function() {
|
2018-07-29 00:38:22 +02:00
|
|
|
$(".goto_checkbox").click(function( event ) {
|
|
|
|
$("form[data-id='editalias'] .goto_checkbox").not(this).prop('checked', false);
|
|
|
|
if ($("form[data-id='editalias'] .goto_checkbox:checked").length > 0) {
|
2017-09-15 09:05:51 +02:00
|
|
|
$('#textarea_alias_goto').prop('disabled', true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#textarea_alias_goto").removeAttr('disabled');
|
|
|
|
}
|
|
|
|
});
|
2018-08-03 20:31:33 +02:00
|
|
|
$("#disable_sender_check").click(function( event ) {
|
|
|
|
if ($("form[data-id='editmailbox'] #disable_sender_check:checked").length > 0) {
|
|
|
|
$('#sender_acl').prop('disabled', true);
|
|
|
|
$('#sender_acl').selectpicker('refresh');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#sender_acl').prop('disabled', false);
|
|
|
|
$('#sender_acl').selectpicker('refresh');
|
|
|
|
}
|
|
|
|
});
|
2018-07-29 00:38:22 +02:00
|
|
|
if ($("form[data-id='editalias'] .goto_checkbox:checked").length > 0) {
|
|
|
|
$('#textarea_alias_goto').prop('disabled', true);
|
|
|
|
}
|
2017-11-03 20:37:24 +01:00
|
|
|
$("#script_data").numberedtextarea({allowTabChar: true});
|
2017-09-15 09:05:51 +02:00
|
|
|
});
|
2018-05-06 21:51:00 +02:00
|
|
|
if ($("#multiple_bookings_select").val() == "custom") {
|
|
|
|
$("#multiple_bookings_custom_div").show();
|
|
|
|
$("#multiple_bookings").val($("#multiple_bookings_custom").val());
|
|
|
|
}
|
|
|
|
$("#multiple_bookings_select").change(function() {
|
|
|
|
$("#multiple_bookings").val($("#multiple_bookings_select").val());
|
|
|
|
if ($("#multiple_bookings").val() == "custom") {
|
|
|
|
$("#multiple_bookings_custom_div").show();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#multiple_bookings_custom_div").hide();
|
|
|
|
}
|
|
|
|
});
|
2018-08-03 20:31:33 +02:00
|
|
|
if ($("#sender_acl option[value='\*']:selected").length > 0){
|
|
|
|
$("#sender_acl_disabled").show();
|
|
|
|
}
|
|
|
|
$('#sender_acl').change(function() {
|
|
|
|
if ($("#sender_acl option[value='\*']:selected").length > 0){
|
|
|
|
$("#sender_acl_disabled").show();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#sender_acl_disabled").hide();
|
|
|
|
}
|
|
|
|
});
|
2018-05-06 21:51:00 +02:00
|
|
|
$("#multiple_bookings_custom").bind("change keypress keyup blur", function() {
|
|
|
|
$("#multiple_bookings").val($("#multiple_bookings_custom").val());
|
|
|
|
});
|
2017-05-23 09:36:59 +02:00
|
|
|
jQuery(function($){
|
|
|
|
// http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
function draw_wl_policy_domain_table() {
|
|
|
|
ft_wl_policy_mailbox_table = FooTable.init('#wl_policy_domain_table', {
|
|
|
|
"columns": [
|
|
|
|
{"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
|
|
|
|
{"name":"prefid","style":{"maxWidth":"40px","width":"40px"},"title":"ID","filterable": false,"sortable": false},
|
2018-09-09 21:17:59 +02:00
|
|
|
{"sorted": true,"name":"value","title":lang_user.spamfilter_table_rule},
|
2017-05-23 09:36:59 +02:00
|
|
|
{"name":"object","title":"Scope"}
|
|
|
|
],
|
2018-09-09 21:17:59 +02:00
|
|
|
"empty": lang_user.empty,
|
2017-05-23 09:36:59 +02:00
|
|
|
"rows": $.ajax({
|
|
|
|
dataType: 'json',
|
|
|
|
url: '/api/v1/get/policy_wl_domain/' + table_for_domain,
|
|
|
|
jsonp: false,
|
|
|
|
error: function () {
|
|
|
|
console.log('Cannot draw mailbox policy wl table');
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
|
|
$.each(data, function (i, item) {
|
|
|
|
if (!validateEmail(item.object)) {
|
|
|
|
item.chkbox = '<input type="checkbox" data-id="policy_wl_domain" name="multi_select" value="' + item.prefid + '" />';
|
|
|
|
}
|
|
|
|
else {
|
2018-09-09 21:17:59 +02:00
|
|
|
item.chkbox = '<input type="checkbox" disabled title="' + lang_user.spamfilter_table_domain_policy + '" />';
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
"paging": {
|
|
|
|
"enabled": true,
|
|
|
|
"limit": 5,
|
|
|
|
"size": pagination_size
|
|
|
|
},
|
|
|
|
"sorting": {
|
|
|
|
"enabled": true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function draw_bl_policy_domain_table() {
|
|
|
|
ft_bl_policy_mailbox_table = FooTable.init('#bl_policy_domain_table', {
|
|
|
|
"columns": [
|
|
|
|
{"name":"chkbox","title":"","style":{"maxWidth":"40px","width":"40px"},"filterable": false,"sortable": false,"type":"html"},
|
|
|
|
{"name":"prefid","style":{"maxWidth":"40px","width":"40px"},"title":"ID","filterable": false,"sortable": false},
|
2018-09-09 21:17:59 +02:00
|
|
|
{"sorted": true,"name":"value","title":lang_user.spamfilter_table_rule},
|
2017-05-23 09:36:59 +02:00
|
|
|
{"name":"object","title":"Scope"}
|
|
|
|
],
|
2018-09-09 21:17:59 +02:00
|
|
|
"empty": lang_user.empty,
|
2017-05-23 09:36:59 +02:00
|
|
|
"rows": $.ajax({
|
|
|
|
dataType: 'json',
|
|
|
|
url: '/api/v1/get/policy_bl_domain/' + table_for_domain,
|
|
|
|
jsonp: false,
|
|
|
|
error: function () {
|
|
|
|
console.log('Cannot draw mailbox policy bl table');
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
|
|
$.each(data, function (i, item) {
|
|
|
|
if (!validateEmail(item.object)) {
|
|
|
|
item.chkbox = '<input type="checkbox" data-id="policy_bl_domain" name="multi_select" value="' + item.prefid + '" />';
|
|
|
|
}
|
|
|
|
else {
|
2018-09-09 21:17:59 +02:00
|
|
|
item.chkbox = '<input type="checkbox" disabled tooltip="' + lang_user.spamfilter_table_domain_policy + '" />';
|
2017-05-23 09:36:59 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
"paging": {
|
|
|
|
"enabled": true,
|
|
|
|
"limit": 5,
|
|
|
|
"size": pagination_size
|
|
|
|
},
|
|
|
|
"sorting": {
|
|
|
|
"enabled": true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
draw_wl_policy_domain_table();
|
|
|
|
draw_bl_policy_domain_table();
|
|
|
|
});
|