[Web] Allow to set global sieve filters

This commit is contained in:
andryyy
2020-03-19 12:23:48 +01:00
parent 32ef5508a0
commit e1897b0631
12 changed files with 193 additions and 16 deletions

View File

@@ -146,12 +146,15 @@ $(document).ready(function() {
});
// Disable submit button on script change
$('.textarea-code').on('keyup', function() {
$('#add_filter_btns > #add_sieve_script').attr({"disabled": true});
// Disable all "save" buttons, could be a "related button only" function, todo
$('.add_sieve_script').attr({"disabled": true});
});
// Validate script data
$("#validate_sieve").click(function( event ) {
$(".validate_sieve").click(function( event ) {
event.preventDefault();
var script = $('#script_data').val();
var validation_button = $(this);
// Get script_data textarea content from form the button was clicked in
var script = $('textarea[name="script_data"]', $(this).parents('form:first')).val();
$.ajax({
dataType: 'json',
url: "/inc/ajax/sieve_validation.php",
@@ -161,7 +164,7 @@ $(document).ready(function() {
var response = (data.responseText);
response_obj = JSON.parse(response);
if (response_obj.type == "success") {
$('#add_filter_btns > #add_sieve_script').attr({"disabled": false});
$(validation_button).next().attr({"disabled": false});
}
mailcow_alert_box(response_obj.msg, response_obj.type);
},