Managesieve: Improvements in 'string' test support

pull/321/merge
Aleksander Machniak 8 years ago
parent 23a27cc61e
commit f9fc7e1edf

@ -17,6 +17,7 @@ CHANGELOG Roundcube Webmail
- Indicate that a collapsed thread has flagged children (#5013) - Indicate that a collapsed thread has flagged children (#5013)
- Implemented message/rfc822 attachment preview - Implemented message/rfc822 attachment preview
- Update to jsTimezoneDetect 1.0.6 - Update to jsTimezoneDetect 1.0.6
- Managesieve: Support 'string' test from variables extension [RFC 5229] (#5248)
- Managesieve: Support 'duplicate' extension [RFC 7352] - Managesieve: Support 'duplicate' extension [RFC 7352]
- Managesieve: Unhide advanced rule controls if there are inputs with errors - Managesieve: Unhide advanced rule controls if there are inputs with errors
- Managesieve: Display warning message when filter form contains errors - Managesieve: Display warning message when filter form contains errors

@ -1,5 +1,6 @@
* version 8.7 [2016-] * version 8.7 [2016-07-19]
----------------------------------------------------------- -----------------------------------------------------------
- Support 'string' test from variables extension [RFC 5229] (#5248)
- Support 'duplicate' extension [RFC 7352] - Support 'duplicate' extension [RFC 7352]
- Unhide advanced rule controls if there are inputs with errors - Unhide advanced rule controls if there are inputs with errors
- Display warning message when filter form contains errors - Display warning message when filter form contains errors

@ -1451,14 +1451,14 @@ class rcube_sieve_engine
if (in_array('body', $this->exts)) { if (in_array('body', $this->exts)) {
$select_header->add($this->plugin->gettext('body'), 'body'); $select_header->add($this->plugin->gettext('body'), 'body');
} }
if (in_array('variables', $this->exts)) {
$select_header->add($this->plugin->gettext('string'), 'string');
}
$select_header->add($this->plugin->gettext('size'), 'size'); $select_header->add($this->plugin->gettext('size'), 'size');
if (in_array('date', $this->exts)) { if (in_array('date', $this->exts)) {
$select_header->add($this->plugin->gettext('datetest'), 'date'); $select_header->add($this->plugin->gettext('datetest'), 'date');
$select_header->add($this->plugin->gettext('currdate'), 'currentdate'); $select_header->add($this->plugin->gettext('currdate'), 'currentdate');
} }
if (in_array('variables', $this->exts)) {
$select_header->add($this->plugin->gettext('string'), 'string');
}
if (in_array('duplicate', $this->exts)) { if (in_array('duplicate', $this->exts)) {
$select_header->add($this->plugin->gettext('message'), 'message'); $select_header->add($this->plugin->gettext('message'), 'message');
} }

@ -608,6 +608,7 @@ function rule_header_select(id)
comp = document.getElementById('rule_comp' + id), comp = document.getElementById('rule_comp' + id),
datepart = document.getElementById('rule_date_part' + id), datepart = document.getElementById('rule_date_part' + id),
dateheader = document.getElementById('rule_date_header_div' + id), dateheader = document.getElementById('rule_date_header_div' + id),
rule = $('#rule_op' + id),
h = obj.value; h = obj.value;
if (h == 'size') { if (h == 'size') {
@ -634,11 +635,14 @@ function rule_header_select(id)
if (dateheader) if (dateheader)
dateheader.style.display = h == 'date' ? '' : 'none'; dateheader.style.display = h == 'date' ? '' : 'none';
$('[value="exists"],[value="notexists"]', rule).prop('disabled', h == 'string');
if (!rule.val() || rule.val().match(/^(exists|notexists)$/))
rule.val('contains');
rule_op_select(op, id, h); rule_op_select(op, id, h);
rule_mod_select(id, h); rule_mod_select(id, h);
if (h == '...') obj.style.width = '40px'; obj.style.width = h == '...' ? '40px' : '';
else if (h == 'string') obj.style.width = '90px';
}; };
function rule_op_select(obj, id, header) function rule_op_select(obj, id, header)
@ -904,24 +908,27 @@ function sieve_formattime(hour, minutes)
function sieve_form_init() function sieve_form_init()
{ {
// small resize for header element var form = rcmail.gui_objects.sieveform;
$('select[name="_header[]"]', rcmail.gui_objects.sieveform).each(function() {
if (this.value == '...') this.style.width = '40px';
if (this.value == 'string') this.style.width = '90px';
});
// resize dialog window // resize dialog window
if (rcmail.env.action == 'plugin.managesieve' && rcmail.env.task == 'mail') { if (rcmail.env.action == 'plugin.managesieve' && rcmail.env.task == 'mail') {
parent.rcmail.managesieve_dialog_resize(rcmail.gui_objects.sieveform); parent.rcmail.managesieve_dialog_resize(form);
} }
$('input[type="text"]:first', rcmail.gui_objects.sieveform).focus(); $('input[type="text"]:first', form).focus();
// initialize smart list inputs // initialize smart list inputs
$('textarea[data-type="list"]', rcmail.gui_objects.sieveform).each(function() { $('textarea[data-type="list"]', form).each(function() {
smart_field_init(this); smart_field_init(this);
}); });
// initialize rules form(s)
$('[name="_header[]"]', form).each(function() {
if (/([0-9]+)$/.test(this.id)) {
rule_header_select(RegExp.$1);
}
});
// enable date pickers on date fields // enable date pickers on date fields
if ($.datepicker && rcmail.env.date_format) { if ($.datepicker && rcmail.env.date_format) {
$.datepicker.setDefaults({ $.datepicker.setDefaults({

@ -10,3 +10,15 @@ set :lower "b" "${a}";
set :upperfirst "b" "${a}"; set :upperfirst "b" "${a}";
set :upperfirst :lower "b" "${a}"; set :upperfirst :lower "b" "${a}";
set :quotewildcard "b" "Rock*"; set :quotewildcard "b" "Rock*";
if string :matches " ${state} " "* pending *"
{
set "test1" "*";
}
if string ["aaa","bbb"] ["aaa","bbb"]
{
set "test2" "*";
}
if string :is :comparator "i;octet" "bbb" "bbb"
{
set "test3" "*";
}

Loading…
Cancel
Save