[Web] Fix sieve validation, fixes #1960

This commit is contained in:
andryyy 2018-10-28 12:46:08 +01:00
parent 9bb3947a10
commit b8b9e6ef57
2 changed files with 3 additions and 3 deletions

View File

@ -145,7 +145,7 @@ $(document).ready(function() {
$("#script_data").numberedtextarea({allowTabChar: true}); $("#script_data").numberedtextarea({allowTabChar: true});
// Disable submit button on script change // Disable submit button on script change
$('#script_data').on('keyup', function() { $('#script_data').on('keyup', function() {
$('#add_filter_btns > #add_item').attr({"disabled": true}); $('#add_filter_btns > #add_sieve_script').attr({"disabled": true});
$('#validation_msg').html('-'); $('#validation_msg').html('-');
}); });
// Validate script data // Validate script data
@ -161,7 +161,7 @@ $(document).ready(function() {
var response = (data.responseText); var response = (data.responseText);
response_obj = JSON.parse(response); response_obj = JSON.parse(response);
if (response_obj.type == "success") { if (response_obj.type == "success") {
$('#add_filter_btns > #add_item').attr({"disabled": false}); $('#add_filter_btns > #add_sieve_script').attr({"disabled": false});
} }
mailcow_alert_box(response_obj.msg, response_obj.type); mailcow_alert_box(response_obj.msg, response_obj.type);
}, },

View File

@ -572,7 +572,7 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10" id="add_filter_btns"> <div class="col-sm-offset-2 col-sm-10" id="add_filter_btns">
<button class="btn btn-default" id="validate_sieve" href="#"><?=$lang['add']['validate'];?></button> <button class="btn btn-default" id="validate_sieve" href="#"><?=$lang['add']['validate'];?></button>
<button class="btn btn-success" data-action="add_item" data-id="add_filter" data-api-url='add/filter' data-api-attr='{}' href="#" disabled><?=$lang['admin']['add'];?></button> <button class="btn btn-success" id="add_sieve_script" data-action="add_item" data-id="add_filter" data-api-url='add/filter' data-api-attr='{}' href="#" disabled><?=$lang['admin']['add'];?></button>
</div> </div>
</div> </div>
</form> </form>