diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-20 17:59:50 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-11-20 17:59:50 +0000 |
| commit | 9f64e4feacdc8cbbe2dd6711c946cb173c1f8a93 (patch) | |
| tree | 7b5b9992df7379b26e2a32b788e3dfb8213e9207 /plugins/managesieve | |
| parent | e3f7337b42af5ccd2e326a9de9c6125e71be8f53 (diff) | |
- 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
Diffstat (limited to 'plugins/managesieve')
| -rw-r--r-- | plugins/managesieve/Changelog | 2 | ||||
| -rw-r--r-- | plugins/managesieve/lib/rcube_sieve.php | 4 | ||||
| -rw-r--r-- | plugins/managesieve/managesieve.php | 35 | ||||
| -rw-r--r-- | plugins/managesieve/skins/default/managesieve.css | 13 |
4 files changed, 23 insertions, 31 deletions
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('<label for="%s"><b>%s:</b></label>', - '_name', Q($this->gettext('filtersetname')))); - $table->add(null, $input_name->show($name)); + $out .= sprintf('<label for="%s"><b>%s:</b></label> %s<br /><br />', + '_name', Q($this->gettext('filtersetname')), $input_name->show($name)); - $from ='<div class="itemlist">'; - $from .= '<input type="radio" id="from_none" name="_from" value="none"' + $out .="\n<fieldset class=\"itemlist\"><legend>" . $this->gettext('filters') . ":</legend>\n"; + $out .= '<input type="radio" id="from_none" name="_from" value="none"' .(!$selected || $selected=='none' ? ' checked="checked"' : '').'></input>'; - $from .= sprintf('<label for="%s">%s</label> ', 'from_none', Q($this->gettext('none'))); + $out .= sprintf('<label for="%s">%s</label> ', '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 .= '<br /><input type="radio" id="from_set" name="_from" value="set"' + $out .= '<br /><input type="radio" id="from_set" name="_from" value="set"' .($selected=='set' ? ' checked="checked"' : '').'></input>'; - $from .= sprintf('<label for="%s">%s:</label> ', 'from_set', Q($this->gettext('fromset'))); - $from .= $select->show($copy); + $out .= sprintf('<label for="%s">%s:</label> ', '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 .= '<br /><input type="radio" id="from_file" name="_from" value="file"' + $out .= '<br /><input type="radio" id="from_file" name="_from" value="file"' .($selected=='file' ? ' checked="checked"' : '').'></input>'; - $from .= sprintf('<label for="%s">%s:</label> ', 'from_file', Q($this->gettext('fromfile'))); - $from .= $upload->show(); - $from .= '</div>'; - - $table->add('title', '<label>'.$this->gettext('filters').':</label>'); - $table->add(null, $from); - - $out .= $table->show(); + $out .= sprintf('<label for="%s">%s:</label> ', 'from_file', Q($this->gettext('fromfile'))); + $out .= $upload->show(); + $out .= '</fieldset>'; $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; } |
