summaryrefslogtreecommitdiff
path: root/plugins/managesieve/managesieve.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/managesieve/managesieve.js')
-rw-r--r--plugins/managesieve/managesieve.js73
1 files changed, 44 insertions, 29 deletions
diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js
index a1f31bb25..5201284fa 100644
--- a/plugins/managesieve/managesieve.js
+++ b/plugins/managesieve/managesieve.js
@@ -263,7 +263,7 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o)
var i, row = $('#rcmrow'+this.managesieve_rowid(o.id));
if (o.name)
- $('td', row).html(o.name);
+ $('td', row).text(o.name);
if (o.disabled)
row.addClass('disabled');
else
@@ -278,7 +278,7 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o)
var list = this.filters_list,
row = $('<tr><td class="name"></td></tr>');
- $('td', row).html(o.name);
+ $('td', row).text(o.name);
row.attr('id', 'rcmrow'+o.id);
if (o.disabled)
row.addClass('disabled');
@@ -302,7 +302,7 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o)
tr = document.createElement('TR');
td = document.createElement('TD');
- td.innerHTML = el.name;
+ $(td).text(el.name);
td.className = 'name';
tr.id = 'rcmrow' + el.id;
if (el['class'])
@@ -351,7 +351,7 @@ rcube_webmail.prototype.managesieve_updatelist = function(action, o)
list = this.filtersets_list,
row = $('<tr class="disabled"><td class="name"></td></tr>');
- $('td', row).html(o.name);
+ $('td', row).text(o.name);
row.attr('id', 'rcmrow'+id);
this.env.filtersets[id] = o.name;
@@ -578,35 +578,42 @@ function rule_header_select(id)
header = document.getElementById('custom_header' + id + '_list'),
mod = document.getElementById('rule_mod' + id),
trans = document.getElementById('rule_trans' + id),
- comp = document.getElementById('rule_comp' + id);
+ comp = document.getElementById('rule_comp' + id),
+ datepart = document.getElementById('rule_date_part' + id),
+ dateheader = document.getElementById('rule_date_header_div' + id),
+ h = obj.value;
- if (obj.value == 'size') {
+ if (h == 'size') {
size.style.display = 'inline';
- op.style.display = 'none';
- header.style.display = 'none';
- mod.style.display = 'none';
- trans.style.display = 'none';
- comp.style.display = 'none';
+ $.each([op, header, mod, trans, comp], function() { this.style.display = 'none'; });
}
else {
- header.style.display = obj.value != '...' ? 'none' : 'inline-block';
+ header.style.display = h != '...' ? 'none' : 'inline-block';
size.style.display = 'none';
op.style.display = 'inline';
comp.style.display = '';
- mod.style.display = obj.value == 'body' ? 'none' : 'block';
- trans.style.display = obj.value == 'body' ? 'block' : 'none';
+ mod.style.display = h == 'body' || h == 'currentdate' || h == 'date' ? 'none' : 'block';
+ trans.style.display = h == 'body' ? 'block' : 'none';
}
- rule_op_select(op, id, obj.value);
- obj.style.width = obj.value == '...' ? '40px' : '';
+ if (datepart)
+ datepart.style.display = h == 'currentdate' || h == 'date' ? 'inline' : 'none';
+ if (dateheader)
+ dateheader.style.display = h == 'date' ? '' : 'none';
+
+ rule_op_select(op, id, h);
+ rule_mod_select(id, h);
+ obj.style.width = h == '...' ? '40px' : '';
};
function rule_op_select(obj, id, header)
{
- var target = document.getElementById('rule_target' + id + '_list'),
- style = obj.value == 'exists' || obj.value == 'notexists' || header == 'size' ? 'none' : 'inline-block';
+ var target = document.getElementById('rule_target' + id + '_list');
+
+ if (!header)
+ header = document.getElementById('header' + id).value;
- target.style.display = style;
+ target.style.display = obj.value == 'exists' || obj.value == 'notexists' || header == 'size' ? 'none' : 'inline-block';
};
function rule_trans_select(id)
@@ -617,12 +624,19 @@ function rule_trans_select(id)
target.style.display = obj.value != 'content' ? 'none' : 'inline';
};
-function rule_mod_select(id)
+function rule_mod_select(id, header)
{
var obj = document.getElementById('rule_mod_op' + id),
- target = document.getElementById('rule_mod_type' + id);
+ target = document.getElementById('rule_mod_type' + id),
+ index = document.getElementById('rule_index_div' + id);
+
+ if (!header)
+ header = document.getElementById('header' + id).value;
target.style.display = obj.value != 'address' && obj.value != 'envelope' ? 'none' : 'inline';
+
+ if (index)
+ index.style.display = header != 'body' && header != 'currentdate' && header != 'size' && obj.value != 'envelope' ? '' : 'none';
};
function rule_join_radio(value)
@@ -646,8 +660,9 @@ function rule_adv_switch(id, elem)
function action_type_select(id)
{
+console.log(id);
var obj = document.getElementById('action_type' + id),
- enabled = {},
+ v = obj.value, enabled = {},
elems = {
mailbox: document.getElementById('action_mailbox' + id),
target: document.getElementById('action_target' + id),
@@ -658,25 +673,25 @@ function action_type_select(id)
notify: document.getElementById('action_notify' + id)
};
- if (obj.value == 'fileinto' || obj.value == 'fileinto_copy') {
+ if (v == 'fileinto' || v == 'fileinto_copy') {
enabled.mailbox = 1;
}
- else if (obj.value == 'redirect' || obj.value == 'redirect_copy') {
+ else if (v == 'redirect' || v == 'redirect_copy') {
enabled.target = 1;
}
- else if (obj.value.match(/^reject|ereject$/)) {
+ else if (v.match(/^reject|ereject$/)) {
enabled.target_area = 1;
}
- else if (obj.value.match(/^(add|set|remove)flag$/)) {
+ else if (v.match(/^(add|set|remove)flag$/)) {
enabled.flags = 1;
}
- else if (obj.value == 'vacation') {
+ else if (v == 'vacation') {
enabled.vacation = 1;
}
- else if (obj.value == 'set') {
+ else if (v == 'set') {
enabled.set = 1;
}
- else if (obj.value == 'notify') {
+ else if (v == 'notify') {
enabled.notify = 1;
}