Changeset 4071 in subversion
- Timestamp:
- Oct 10, 2010 12:01:31 PM (3 years ago)
- Location:
- trunk/plugins/managesieve
- Files:
-
- 4 edited
-
Changelog (modified) (1 diff)
-
managesieve.js (modified) (2 diffs)
-
managesieve.php (modified) (11 diffs)
-
skins/default/managesieve.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/managesieve/Changelog
r4068 r4071 1 * version 2.10 [2010-10-10] 2 ----------------------------------------------------------- 1 3 - Fixed import from Avelsieve 2 4 - Use localized size units (#1486976) 3 5 - Added support for relational operators and i;ascii-numeric comparator 6 - Added popups with form errors 4 7 5 8 * version 2.9 [2010-08-02] -
trunk/plugins/managesieve/managesieve.js
r3593 r4071 35 35 } 36 36 37 // Create layer for form tips 38 if (!rcmail.env.framed) { 39 rcmail.env.ms_tip_layer = $('<div id="managesieve-tip" class="popupmenu"></div>'); 40 rcmail.env.ms_tip_layer.appendTo(document.body); 41 } 42 37 43 if (rcmail.gui_objects.filterslist) { 38 44 var p = rcmail; … … 473 479 }; 474 480 481 // Register onmouse(leave/enter) events for tips on specified form element 482 rcube_webmail.prototype.managesieve_tip_register = function(tips) 483 { 484 for (var n in tips) { 485 $('#'+tips[n][0]) 486 .bind('mouseenter', {str: tips[n][1]}, 487 function(e) { 488 var offset = $(this).offset(), 489 tip = rcmail.env.framed ? parent.rcmail.env.ms_tip_layer : rcmail.env.ms_tip_layer, 490 left = offset.left, 491 top = offset.top - 12; 492 493 if (rcmail.env.framed) { 494 offset = $(parent.document.getElementById('filter-box')).offset(); 495 top += offset.top; 496 left += offset.left; 497 } 498 499 tip.html(e.data.str) 500 top -= tip.height(); 501 502 tip.css({left: left, top: top}).show(); 503 }) 504 .bind('mouseleave', 505 function(e) { 506 var tip = parent.rcmail && parent.rcmail.env.ms_tip_layer ? 507 parent.rcmail.env.ms_tip_layer : rcmail.env.ms_tip_layer; 508 tip.hide(); 509 }); 510 } 511 }; -
trunk/plugins/managesieve/managesieve.php
r4068 r4071 8 8 * with server using managesieve protocol. Adds Filters tab in Settings. 9 9 * 10 * @version 2. 910 * @version 2.10 11 11 * @author Aleksander 'A.L.E.C' Machniak <alec@alec.pl> 12 12 * … … 24 24 private $errors; 25 25 private $form; 26 private $tips = array(); 26 27 private $script = array(); 27 28 private $exts = array(); … … 422 423 $this->form['tests'][$i]['arg'] = $sizetarget.$sizeitem; 423 424 424 if (!preg_match('/^[0-9]+(K|M|G)*$/i', $sizetarget)) 425 $this->errors['tests'][$i]['sizetarget'] = $this->gettext('wrongformat'); 425 if ($sizetarget == '') 426 $this->errors['tests'][$i]['sizetarget'] = $this->gettext('cannotbeempty'); 427 else if (!preg_match('/^[0-9]+(K|M|G)*$/i', $sizetarget)) 428 $this->errors['tests'][$i]['sizetarget'] = $this->gettext('forbiddenchars'); 426 429 break; 427 430 case '...': … … 824 827 $out .= "</fieldset>\n"; 825 828 829 $this->print_tips(); 830 826 831 if ($scr['disabled']) { 827 832 $this->rc->output->set_env('rule_disabled', true); … … 878 883 879 884 $out .= '<div id="custom_header' .$id. '" style="display:' .(isset($custom) ? 'inline' : 'none'). '"> 880 <input type="text" name="_custom_header[]" '. $this->error_class($id, 'test', 'header') 885 <input type="text" name="_custom_header[]" id="custom_header_i'.$id.'" ' 886 . $this->error_class($id, 'test', 'header', 'custom_header_i') 881 887 .' value="' .Q($custom). '" size="20" /> </div>' . "\n"; 882 888 … … 927 933 928 934 $out .= '<input type="text" name="_rule_target[]" id="rule_target' .$id. '" 929 value="' .Q($target). '" size="20" ' . $this->error_class($id, 'test', 'target' )935 value="' .Q($target). '" size="20" ' . $this->error_class($id, 'test', 'target', 'rule_target') 930 936 . ' style="display:' . ($rule['test']!='size' && $rule['test'] != 'exists' ? 'inline' : 'none') . '" />'."\n"; 931 937 … … 936 942 $out .= '<div id="rule_size' .$id. '" style="display:' . ($rule['test']=='size' ? 'inline' : 'none') .'">'; 937 943 $out .= $select_size_op->show($rule['test']=='size' ? $rule['type'] : ''); 938 $out .= '<input type="text" name="_rule_size_target[]" value="'.$sizetarget.'" size="10" '939 . $this->error_class($id, 'test', 'sizetarget' ) .' />944 $out .= '<input type="text" name="_rule_size_target[]" id="rule_size_i'.$id.'" value="'.$sizetarget.'" size="10" ' 945 . $this->error_class($id, 'test', 'sizetarget', 'rule_size_i') .' /> 940 946 <input type="radio" name="_rule_size_item['.$id.']" value=""' 941 947 . (!$sizeitem ? ' checked="checked"' : '') .' class="radio" />'.rcube_label('B').' … … 1005 1011 .'value="' .($action['type']=='redirect' ? Q($action['target'], 'strict', false) : ''). '" size="40" ' 1006 1012 .'style="display:' .($action['type']=='redirect' ? 'inline' : 'none') .'" ' 1007 . $this->error_class($id, 'action', 'target' ) .' />';1013 . $this->error_class($id, 'action', 'target', 'action_target') .' />'; 1008 1014 $out .= '<textarea name="_action_target_area[]" id="action_target_area' .$id. '" ' 1009 .'rows="3" cols="40" '. $this->error_class($id, 'action', 'targetarea' )1015 .'rows="3" cols="40" '. $this->error_class($id, 'action', 'targetarea', 'action_target_area') 1010 1016 .'style="display:' .(in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') .'">' 1011 1017 . (in_array($action['type'], array('reject', 'ereject')) ? Q($action['target'], 'strict', false) : '') … … 1016 1022 $out .= '<span class="label">'. Q($this->gettext('vacationreason')) .'</span><br />' 1017 1023 .'<textarea name="_action_reason[]" id="action_reason' .$id. '" ' 1018 .'rows="3" cols="40" '. $this->error_class($id, 'action', 'reason' ) . '>'1024 .'rows="3" cols="40" '. $this->error_class($id, 'action', 'reason', 'action_reason') . '>' 1019 1025 . Q($action['reason'], 'strict', false) . "</textarea>\n"; 1020 1026 $out .= '<br /><span class="label">' .Q($this->gettext('vacationaddresses')) . '</span><br />' 1021 .'<input type="text" name="_action_addresses[]" '1027 .'<input type="text" name="_action_addresses[]" id="action_addr'.$id.'" ' 1022 1028 .'value="' . (is_array($action['addresses']) ? Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="40" ' 1023 . $this->error_class($id, 'action', 'addresses' ) .' />';1029 . $this->error_class($id, 'action', 'addresses', 'action_addr') .' />'; 1024 1030 $out .= '<br /><span class="label">' . Q($this->gettext('vacationdays')) . '</span><br />' 1025 .'<input type="text" name="_action_days[]" '1031 .'<input type="text" name="_action_days[]" id="action_days'.$id.'" ' 1026 1032 .'value="' .Q($action['days'], 'strict', false) . '" size="2" ' 1027 . $this->error_class($id, 'action', 'days' ) .' />';1033 . $this->error_class($id, 'action', 'days', 'action_days') .' />'; 1028 1034 $out .= '</div>'; 1029 1035 … … 1100 1106 } 1101 1107 1102 private function error_class($id, $type, $target, $ name_only=false)1108 private function error_class($id, $type, $target, $elem_prefix='') 1103 1109 { 1104 1110 // TODO: tooltips 1105 if ($type == 'test' && isset($this->errors['tests'][$id][$target])) 1106 return ($name_only ? 'error' : ' class="error"'); 1107 else if ($type == 'action' && isset($this->errors['actions'][$id][$target])) 1108 return ($name_only ? 'error' : ' class="error"'); 1111 if (($type == 'test' && ($str = $this->errors['tests'][$id][$target])) || 1112 ($type == 'action' && ($str = $this->errors['actions'][$id][$target])) 1113 ) { 1114 $this->add_tip($elem_prefix.$id, $str, true); 1115 return ' class="error"'; 1116 } 1109 1117 1110 1118 return ''; … … 1115 1123 return rcube_charset_convert($text, 'UTF7-IMAP', $encoding); 1116 1124 } 1125 1126 private function add_tip($id, $str, $error=false) 1127 { 1128 if ($error) 1129 $str = html::span('sieve error', $str); 1130 1131 $this->tips[] = array($id, $str); 1132 } 1133 1134 private function print_tips() 1135 { 1136 if (empty($this->tips)) 1137 return; 1138 1139 $script = JS_OBJECT_NAME.'.managesieve_tip_register('.json_encode($this->tips).');'; 1140 $this->rc->output->add_script($script, 'foot'); 1141 } 1142 1117 1143 } -
trunk/plugins/managesieve/skins/default/managesieve.css
r3989 r4071 290 290 vertical-align: middle; 291 291 } 292 293 span.sieve.error 294 { 295 color: red; 296 } 297 298 #managesieve-tip 299 { 300 width: 200px; 301 }
Note: See TracChangeset
for help on using the changeset viewer.
