From 9f64e4feacdc8cbbe2dd6711c946cb173c1f8a93 Mon Sep 17 00:00:00 2001 From: alec Date: Sat, 20 Nov 2010 17:59:50 +0000 Subject: - Apply forgotten changes for form errors handling - Fix handling of scripts with CRLF line separator git-svn-id: https://svn.roundcube.net/trunk@4241 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/managesieve/Changelog | 2 ++ plugins/managesieve/lib/rcube_sieve.php | 4 +-- plugins/managesieve/managesieve.php | 35 ++++++++++------------- plugins/managesieve/skins/default/managesieve.css | 13 +++------ 4 files changed, 23 insertions(+), 31 deletions(-) (limited to 'plugins') diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 01194e423..61d198ce6 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,4 +1,6 @@ - Added support for SASL proxy authentication (#1486691) +- Fixed parsing of scripts with \r\n line separator +- Apply forgotten changes for form errors handling * version 2.10 [2010-10-10] ----------------------------------------------------------- diff --git a/plugins/managesieve/lib/rcube_sieve.php b/plugins/managesieve/lib/rcube_sieve.php index cec86a1db..ba43f1093 100644 --- a/plugins/managesieve/lib/rcube_sieve.php +++ b/plugins/managesieve/lib/rcube_sieve.php @@ -344,7 +344,7 @@ class rcube_sieve $name = array(); // Squirrelmail (Avelsieve) - if ($tokens = preg_split('/(#START_SIEVE_RULE.*END_SIEVE_RULE)\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { + if ($tokens = preg_split('/(#START_SIEVE_RULE.*END_SIEVE_RULE)\r?\n/', $script, -1, PREG_SPLIT_DELIM_CAPTURE)) { foreach($tokens as $token) { if (preg_match('/^#START_SIEVE_RULE.*/', $token, $matches)) { $name[$i] = "unnamed rule ".($i+1); @@ -743,7 +743,7 @@ class rcube_sieve_script if (in_array('vacation', $this->supported)) $patterns[] = '^\s*vacation\s+(.*?[^\\\]);'; - $pattern = '/(' . implode('$)|(', $patterns) . '$)/ms'; + $pattern = '/(' . implode('\s*$)|(', $patterns) . '$\s*)/ms'; // parse actions body if (preg_match_all($pattern, $content, $mm, PREG_SET_ORDER)) { diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 8fb8242bc..5de839da6 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -684,20 +684,17 @@ class managesieve extends rcube_plugin $copy = get_input_value('_copy', RCUBE_INPUT_POST); $selected = get_input_value('_from', RCUBE_INPUT_POST); - $table = new html_table(array('cols' => 2)); - // filter set name input $input_name = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30, 'class' => ($this->errors['name'] ? 'error' : ''))); - $table->add('title', sprintf('', - '_name', Q($this->gettext('filtersetname')))); - $table->add(null, $input_name->show($name)); + $out .= sprintf(' %s

', + '_name', Q($this->gettext('filtersetname')), $input_name->show($name)); - $from ='
'; - $from .= '" . $this->gettext('filters') . ":\n"; + $out .= ''; - $from .= sprintf(' ', 'from_none', Q($this->gettext('none'))); + $out .= sprintf(' ', 'from_none', Q($this->gettext('none'))); // filters set list $list = $this->sieve->get_scripts(); @@ -711,26 +708,21 @@ class managesieve extends rcube_plugin foreach ($list as $set) $select->add($set . ($set == $active ? ' ('.$this->gettext('active').')' : ''), $set); - $from .= '
'; - $from .= sprintf(' ', 'from_set', Q($this->gettext('fromset'))); - $from .= $select->show($copy); + $out .= sprintf(' ', 'from_set', Q($this->gettext('fromset'))); + $out .= $select->show($copy); } // script upload box $upload = new html_inputfield(array('name' => '_file', 'id' => '_file', 'size' => 30, 'type' => 'file', 'class' => ($this->errors['name'] ? 'error' : ''))); - $from .= '
'; - $from .= sprintf(' ', 'from_file', Q($this->gettext('fromfile'))); - $from .= $upload->show(); - $from .= '
'; - - $table->add('title', ''); - $table->add(null, $from); - - $out .= $table->show(); + $out .= sprintf(' ', 'from_file', Q($this->gettext('fromfile'))); + $out .= $upload->show(); + $out .= ''; $this->rc->output->add_gui_object('sieveform', 'filtersetform'); @@ -763,6 +755,9 @@ class managesieve extends rcube_plugin $input_name = new html_inputfield(array('name' => '_name', 'id' => $field_id, 'size' => 30, 'class' => ($this->errors['name'] ? 'error' : ''))); + if ($this->errors['name']) + $this->add_tip($field_id, $this->errors['name'], true); + if (isset($scr)) $input_name = $input_name->show($scr['name']); else diff --git a/plugins/managesieve/skins/default/managesieve.css b/plugins/managesieve/skins/default/managesieve.css index 633d72e3a..675c5d0dc 100644 --- a/plugins/managesieve/skins/default/managesieve.css +++ b/plugins/managesieve/skins/default/managesieve.css @@ -177,11 +177,6 @@ body.iframe padding: 20px 10px 10px 10px; } -fieldset -{ - background-color: white; -} - legend, label { color: #666666; @@ -199,14 +194,14 @@ div.rulerow, div.actionrow width: auto; padding: 2px; white-space: nowrap; - border: 1px solid white; + border: 1px solid #F2F2F2; } div.rulerow:hover, div.actionrow:hover { padding: 2px; white-space: nowrap; - background: #F6F6F6; + background: #F9F9F9; border: 1px solid silver; } @@ -280,12 +275,12 @@ span.label float: right; } -div .itemlist +.itemlist { line-height: 25px; } -div .itemlist input +.itemlist input { vertical-align: middle; } -- cgit v1.2.3