diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-06-11 13:46:18 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-06-11 13:46:18 +0200 |
commit | a1679cb650d62bac957419d287c72ca59d800d5c (patch) | |
tree | ee86807fbb94f1ac976e95e0d9b7ae5351cd802b /plugins | |
parent | b41c1d94985e4b47e6de8de98f013e9169bc80a8 (diff) |
Use list input field for custom headers list
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/managesieve/managesieve.js | 2 | ||||
-rw-r--r-- | plugins/managesieve/managesieve.php | 26 | ||||
-rw-r--r-- | plugins/managesieve/skins/classic/managesieve.css | 6 | ||||
-rw-r--r-- | plugins/managesieve/skins/larry/managesieve.css | 6 |
4 files changed, 24 insertions, 16 deletions
diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index 299d4c3c2..a1f31bb25 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -575,7 +575,7 @@ function rule_header_select(id) var obj = document.getElementById('header' + id), size = document.getElementById('rule_size' + id), op = document.getElementById('rule_op' + id), - header = document.getElementById('custom_header' + 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); diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index c7d5911e7..63ca97a70 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -765,7 +765,7 @@ class managesieve extends rcube_plugin } } else { - $cust_header = $headers = $this->strip_value($cust_headers[$idx]); + $cust_header = $headers = $this->strip_value(array_shift($cust_headers)); $mod = $this->strip_value($mods[$idx]); $mod_type = $this->strip_value($mod_types[$idx]); @@ -774,8 +774,6 @@ class managesieve extends rcube_plugin $type = preg_replace('/^not/', '', $operator); if ($header == '...') { - $headers = preg_split('/[\s,]+/', $cust_header, -1, PREG_SPLIT_NO_EMPTY); - if (!count($headers)) $this->errors['tests'][$i]['header'] = $this->gettext('cannotbeempty'); else { @@ -1336,22 +1334,20 @@ class managesieve extends rcube_plugin $aout .= $select_header->show(); if (isset($rule['test']) && in_array($rule['test'], array('header', 'address', 'envelope'))) { - if (is_array($rule['arg1'])) - $custom = implode(', ', $rule['arg1']); - else if (!in_array($rule['arg1'], $this->headers)) - $custom = $rule['arg1']; + $custom = (array) $rule['arg1']; + if (count($custom) == 1 && isset($this->headers[strtolower($custom[0])])) { + unset($custom); + } } else if (isset($rule['test']) && $rule['test'] == 'exists') { - if (is_array($rule['arg'])) - $custom = implode(', ', $rule['arg']); - else if (!in_array($rule['arg'], $this->headers)) - $custom = $rule['arg']; + $custom = (array) $rule['arg']; + if (count($custom) == 1 && isset($this->headers[strtolower($custom[0])])) { + unset($custom); + } } - $tout = '<div id="custom_header' .$id. '" style="display:' .(isset($custom) ? 'inline' : 'none'). '"> - <input type="text" name="_custom_header[]" id="custom_header_i'.$id.'" ' - . $this->error_class($id, 'test', 'header', 'custom_header_i') - .' value="' .rcube::Q($custom). '" size="15" /> </div>' . "\n"; + $tout = $this->list_input($id, 'custom_header', $custom, isset($custom), + $this->error_class($id, 'test', 'header', 'custom_header'), 15) . "\n"; // matching type select (operator) $select_op = new html_select(array('name' => "_rule_op[]", 'id' => 'rule_op'.$id, diff --git a/plugins/managesieve/skins/classic/managesieve.css b/plugins/managesieve/skins/classic/managesieve.css index fe5650863..1f112b956 100644 --- a/plugins/managesieve/skins/classic/managesieve.css +++ b/plugins/managesieve/skins/classic/managesieve.css @@ -332,6 +332,12 @@ a.button.disabled overflow-y: auto; } +td.rowtargets > span.listarea +{ + vertical-align: top; + margin-top: 2px; +} + .listelement { display: block; diff --git a/plugins/managesieve/skins/larry/managesieve.css b/plugins/managesieve/skins/larry/managesieve.css index 7d28f79c7..a618502d2 100644 --- a/plugins/managesieve/skins/larry/managesieve.css +++ b/plugins/managesieve/skins/larry/managesieve.css @@ -335,6 +335,12 @@ fieldset overflow-y: auto; } +td.rowtargets > span.listarea +{ + vertical-align: top; + margin-top: 2px; +} + .listelement { display: block; |