diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 6fc702729..004e1e6d9 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -1266,13 +1266,18 @@ class rcube_sieve_engine $input_name = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30, 'class' => ($this->errors['name'] ? 'error' : ''))); - $out .= sprintf(' %s

', + $out .= sprintf(' %s

', '_name', rcube::Q($this->plugin->gettext('filtersetname')), $input_name->show($name)); $out .="\n
" . $this->plugin->gettext('filters') . ":\n"; - $out .= ''; - $out .= sprintf(' ', 'from_none', rcube::Q($this->plugin->gettext('none'))); + $out .= html::tag('input', array( + 'type' => 'radio', + 'id' => 'from_none', + 'name' => '_from', + 'value' => 'none', + 'checked' => !$selected || $selected == 'none' + )); + $out .= html::label('from_none', rcube::Q($this->plugin->gettext('none'))); // filters set list $list = $this->list_scripts(); @@ -1288,9 +1293,15 @@ class rcube_sieve_engine $select->add($set, $set); } - $out .= '
'; - $out .= sprintf(' ', 'from_set', rcube::Q($this->plugin->gettext('fromset'))); + $out .= '
'; + $out .= html::tag('input', array( + 'type' => 'radio', + 'id' => 'from_set', + 'name' => '_from', + 'value' => 'set', + 'checked' => $selected == 'set', + )); + $out .= html::label('from_set', rcube::Q($this->plugin->gettext('fromset'))); $out .= $select->show($copy); } @@ -1298,9 +1309,15 @@ class rcube_sieve_engine $upload = new html_inputfield(array('name' => '_file', 'id' => '_file', 'size' => 30, 'type' => 'file', 'class' => ($this->errors['file'] ? 'error' : ''))); - $out .= '
'; - $out .= sprintf(' ', 'from_file', rcube::Q($this->plugin->gettext('fromfile'))); + $out .= '
'; + $out .= html::tag('input', array( + 'type' => 'radio', + 'id' => 'from_file', + 'name' => '_from', + 'value' => 'file', + 'checked' => $selected == 'file', + )); + $out .= html::label('from_file', rcube::Q($this->plugin->gettext('fromfile'))); $out .= $upload->show(); $out .= '
'; @@ -1363,7 +1380,7 @@ class rcube_sieve_engine $this->filtersets_list(array('id' => 'sievescriptname'), true)); } - $out .= '

' . rcube::Q($this->plugin->gettext('messagesrules')) . "\n"; + $out .= '

' . rcube::Q($this->plugin->gettext('messagesrules')) . "\n"; // any, allof, anyof radio buttons $field_id = '_allof'; @@ -1375,8 +1392,7 @@ class rcube_sieve_engine else $input_join = $input_join->show(); - $out .= sprintf("%s \n", - $input_join, $field_id, rcube::Q($this->plugin->gettext('filterallof'))); + $out .= $input_join . html::label($field_id, rcube::Q($this->plugin->gettext('filterallof'))); $field_id = '_anyof'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'anyof', @@ -1387,8 +1403,7 @@ class rcube_sieve_engine else $input_join = $input_join->show('anyof'); // default - $out .= sprintf("%s\n", - $input_join, $field_id, rcube::Q($this->plugin->gettext('filteranyof'))); + $out .= $input_join . html::label($field_id, rcube::Q($this->plugin->gettext('filteranyof'))); $field_id = '_any'; $input_join = new html_radiobutton(array('name' => '_join', 'id' => $field_id, 'value' => 'any', @@ -1396,8 +1411,7 @@ class rcube_sieve_engine $input_join = $input_join->show($any ? 'any' : ''); - $out .= sprintf("%s\n", - $input_join, $field_id, rcube::Q($this->plugin->gettext('filterany'))); + $out .= $input_join . html::label($field_id, rcube::Q($this->plugin->gettext('filterany'))); $rows_num = !empty($scr['tests']) ? sizeof($scr['tests']) : 1; @@ -1613,16 +1627,23 @@ class rcube_sieve_engine $tout .= '
'; $tout .= $select_size_op->show($rule['test']=='size' ? $rule['type'] : ''); - $tout .= 'error_class($id, 'test', 'sizetarget', 'rule_size_i') .' /> - - - - '; + $tout .= html::tag('input', array( + 'type' => 'text', + 'name' => '_rule_size_target[]', + 'id' => 'rule_size_i'.$id, + 'value' => $sizetarget, + 'size' => 10, + 'class' => $this->error_class($id, 'test', 'sizetarget', 'rule_size_i'), + )); + foreach (array('', 'K', 'M', 'G') as $unit) { + $tout .= html::label(null, html::tag('input', array( + 'type' => 'radio', + 'name' => '_rule_size_item['.$id.']', + 'value' => $unit, + 'checked' => $sizeitem == $unit, + 'class' => 'radio', + )) . $this->rc->gettext($unit . 'B')); + } $tout .= '
'; // Advanced modifiers (address, envelope) @@ -1664,10 +1685,15 @@ class rcube_sieve_engine $mout .= ''; // Advanced modifiers (body transformations) @@ -1690,9 +1716,14 @@ class rcube_sieve_engine if (in_array('date', $this->exts)) { $mout .= ''; } @@ -1701,12 +1732,22 @@ class rcube_sieve_engine $need_index = in_array($rule['test'], array('header', ', address', 'date')); $mout .= ''; } @@ -1714,25 +1755,37 @@ class rcube_sieve_engine if (in_array('duplicate', $this->exts)) { $need_duplicate = $rule['test'] == 'duplicate'; $mout .= ''; } @@ -1870,19 +1923,26 @@ class rcube_sieve_engine // redirect target $out .= '' - . 'error_class($id, 'action', 'target', 'action_target') .' />' - . (!empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : '') - . ''; + . html::tag('input', array( + 'type' => 'text', + 'name' => '_action_target[' . $id . ']', + 'id' => 'action_target' . $id, + 'value' => $action['type'] == 'redirect' ? $action['target'] : '', + 'size' => !empty($domains) ? 20 : 35, + 'class' => $this->error_class($id, 'action', 'target', 'action_target'), + )); + $out .= !empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : ''; + $out .= ''; // (e)reject target - $out .= '\n"; + $out .= html::tag('textarea', array( + 'name' => '_action_target_area[' . $id . ']', + 'id' => 'action_target_area' . $id, + 'rows' => 3, + 'cols' => 35, + 'class' => $this->error_class($id, 'action', 'targetarea', 'action_target_area'), + 'style' => 'display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none'), + ), (in_array($action['type'], array('reject', 'ereject')) ? rcube::Q($action['target'], 'strict', false) : '')); // vacation $vsec = in_array('vacation-seconds', $this->exts); @@ -1890,32 +1950,57 @@ class rcube_sieve_engine $addresses = isset($action['addresses']) || !$auto_addr ? (array) $action['addresses'] : $this->user_emails(); $out .= '
'; - $out .= ''. rcube::Q($this->plugin->gettext('vacationreason')) .'
' - .'\n"; - $out .= '
' .rcube::Q($this->plugin->gettext('vacationsubject')) . '
' - .'error_class($id, 'action', 'subject', 'action_subject') .' />'; - $out .= '
' .rcube::Q($this->plugin->gettext('vacationfrom')) . '
' - .'error_class($id, 'action', 'from', 'action_from') .' />'; - $out .= '
' .rcube::Q($this->plugin->gettext('vacationaddr')) . '
' - . $this->list_input($id, 'action_addresses', $addresses, true, + $out .= ''. rcube::Q($this->plugin->gettext('vacationreason')) .'
'; + $out .= html::tag('textarea', array( + 'name' => '_action_reason[' . $id . ']', + 'id' => 'action_reason' . $id, + 'rows' => 3, + 'cols' => 35, + 'class' => $this->error_class($id, 'action', 'reason', 'action_reason'), + ), rcube::Q($action['reason'], 'strict', false)); + $out .= '
' .rcube::Q($this->plugin->gettext('vacationsubject')) . '
'; + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_subject[' . $id . ']', + 'id' => 'action_subject' . $id, + 'value' => is_array($action['subject']) ? implode(', ', $action['subject']) : $action['subject'], + 'size' => 35, + 'class' => $this->error_class($id, 'action', 'subject', 'action_subject'), + )); + $out .= '
' .rcube::Q($this->plugin->gettext('vacationfrom')) . '
'; + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_from[' . $id . ']', + 'id' => 'action_from' . $id, + 'value' => $action['from'], + 'size' => 35, + 'class' => $this->error_class($id, 'action', 'from', 'action_from'), + )); + $out .= '
' .rcube::Q($this->plugin->gettext('vacationaddr')) . '
'; + $out .= $this->list_input($id, 'action_addresses', $addresses, true, $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30) . html::a(array('href' => '#', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".managesieve_vacation_addresses($id)"), rcube::Q($this->plugin->gettext('filladdresses'))); - $out .= '
' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '
' - .'error_class($id, 'action', 'interval', 'action_interval') .' />'; + $out .= '
' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '
'; + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_interval[' . $id . ']', + 'id' => 'action_interval' . $id, + 'value' => rcube_sieve_vacation::vacation_interval($action), + 'size' => 2, + 'class' => $this->error_class($id, 'action', 'interval', 'action_interval'), + )); if ($vsec) { - $out .= ' ' - . ' '; + foreach (array('days', 'seconds') as $unit) { + $out .= ' ' . html::label(null, html::tag('input', array( + 'type' => 'radio', + 'name' => '_action_interval_type[' . $id . ']', + 'value' => $unit, + 'checked' => ($unit == 'seconds' && isset($action['seconds']) + || $unit == 'deys' && !isset($action['seconds'])), + 'class' => 'radio', + )) . $this->plugin->gettext($unit)); + } } $out .= '
'; @@ -1929,15 +2014,21 @@ class rcube_sieve_engine ); $flags_target = (array)$action['target']; - $out .= '
error_class($id, 'action', 'flags', 'action_flags') . '>'; + $flout = ''; foreach ($flags as $fidx => $flag) { - $out .= '' + $flout .= html::tag('input', array( + 'type' => 'checkbox', + 'name' => '_action_flags[' .$id .'][]', + 'value' => $flag, + 'checked' => in_array_nocase($flag, $flags_target), + )) . rcube::Q($this->plugin->gettext('flag'.$fidx)) .'
'; } - $out .= '
'; + $out .= html::div(array( + 'id' => 'action_flags' . $id, + 'style' => 'display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none'), + 'class' => $this->error_class($id, 'action', 'flags', 'action_flags'), + ), $flout); // set variable $set_modifiers = array( @@ -1950,21 +2041,29 @@ class rcube_sieve_engine ); $out .= '
'; - $out .= '' .rcube::Q($this->plugin->gettext('setvarname')) . '
' - .'error_class($id, 'action', 'name', 'action_varname') .' />'; - $out .= '
' .rcube::Q($this->plugin->gettext('setvarvalue')) . '
' - .'error_class($id, 'action', 'value', 'action_varvalue') .' />'; - $out .= '
' .rcube::Q($this->plugin->gettext('setvarmodifiers')) . '
'; + foreach (array('name', 'value') as $unit) { + $out .= '' .rcube::Q($this->plugin->gettext('setvar' . $unit)) . '
'; + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_var' . $unit . '[' . $id . ']', + 'id' => 'action_var' . $unit . $id, + 'value' => $action[$unit], + 'size' => 35, + 'class' => $this->error_class($id, 'action', $unit, 'action_var' . $unit), + )); + $out .= '
'; + } + $out .= '' .rcube::Q($this->plugin->gettext('setvarmodifiers')) . ''; foreach ($set_modifiers as $s_m) { $s_m_id = 'action_varmods' . $id . $s_m; - $out .= sprintf('%s
', - $id, $s_m, $s_m_id, - (array_key_exists($s_m, (array)$action) && $action[$s_m] ? ' checked="checked"' : ''), - rcube::Q($this->plugin->gettext('var' . $s_m))); + $out .= '
' . html::tag('input', array( + 'type' => 'checkbox', + 'name' => '_action_varmods[' . $id . '][]', + 'value' => $s_m, + 'id' => $s_m_id, + 'checked' => array_key_exists($s_m, (array)$action) && $action[$s_m], + )) + .rcube::Q($this->plugin->gettext('var' . $s_m)); } $out .= '
'; @@ -2003,25 +2102,39 @@ class rcube_sieve_engine // @TODO: nice UI for mailto: (other methods too) URI parameters $out .= '
'; - $out .= '' .rcube::Q($this->plugin->gettext('notifytarget')) . '
' - . $select_method->show($method) - .'error_class($id, 'action', 'target', 'action_notifytarget') .' />'; - $out .= '
'. rcube::Q($this->plugin->gettext('notifymessage')) .'
' - .'\n"; + $out .= '' .rcube::Q($this->plugin->gettext('notifytarget')) . '
'; + $out .= $select_method->show($method); + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_notifytarget[' . $id . ']', + 'id' => 'action_notifytarget' . $id, + 'value' => $target, + 'size' => 25, + 'class' => $this->error_class($id, 'action', 'target', 'action_notifytarget'), + )); + $out .= '
'. rcube::Q($this->plugin->gettext('notifymessage')) .'
'; + $out .= html::tag('textarea', array( + 'name' => '_action_notifymessage[' . $id . ']', + 'id' => 'action_notifymessage' . $id, + 'rows' => 3, + 'cols' => 35, + 'class' => $this->error_class($id, 'action', 'message', 'action_notifymessage'), + ), rcube::Q($action['message'], 'strict', false)); if (in_array('enotify', $this->exts)) { - $out .= '
' .rcube::Q($this->plugin->gettext('notifyfrom')) . '
' - .'error_class($id, 'action', 'from', 'action_notifyfrom') .' />'; - } - $out .= '
' . rcube::Q($this->plugin->gettext('notifyimportance')) . '
'; + $out .= '
' .rcube::Q($this->plugin->gettext('notifyfrom')) . '
'; + $out .= html::tag('input', array( + 'type' => 'text', + 'name' => '_action_notifyfrom[' . $id . ']', + 'id' => 'action_notifyfrom' . $id, + 'value' => $action['from'], + 'size' => 35, + 'class' => $this->error_class($id, 'action', 'from', 'action_notifyfrom'), + )); + } + $out .= '
' . rcube::Q($this->plugin->gettext('notifyimportance')) . '
'; $out .= $select_importance->show($action['importance'] ? (int) $action['importance'] : 2); $out .= '
' - .'' . rcube::Q($this->plugin->gettext('notifyoptions')) . '
' + .'' . rcube::Q($this->plugin->gettext('notifyoptions')) . '
' .$this->list_input($id, 'action_notifyoption', (array)$action['options'], true, $this->error_class($id, 'action', 'options', 'action_notifyoption'), 30) . '
'; $out .= '
'; @@ -2095,7 +2208,7 @@ class rcube_sieve_engine ($type == 'action' && ($str = $this->errors['actions'][$id][$target])) ) { $this->add_tip($elem_prefix.$id, $str, true); - return ' class="error"'; + return 'error'; } return ''; @@ -2103,16 +2216,18 @@ class rcube_sieve_engine protected function add_tip($id, $str, $error=false) { - if ($error) + if ($error) { $str = html::span('sieve error', $str); + } $this->tips[] = array($id, $str); } protected function print_tips() { - if (empty($this->tips)) + if (empty($this->tips)) { return; + } $script = rcmail_output::JS_OBJECT_NAME.'.managesieve_tip_register('.json_encode($this->tips).');'; $this->rc->output->add_script($script, 'foot'); @@ -2124,11 +2239,15 @@ class rcube_sieve_engine $value = array_map(array('rcube', 'Q'), $value); $value = implode("\n", $value); - return ''; + return html::tag('textarea', array( + 'data-type' => 'list', + 'data-size' => $size, + 'name' => '_' . $name . '['. $id .']', + 'id' => $name.$id, + 'disabled' => !$enabled, + 'class' => $class, + 'style' => 'display:none', + ), $value); } /** diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index 513e8d607..73b9a85d7 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -323,8 +323,12 @@ class html // attributes with no value if (in_array($key, self::$bool_attrib)) { if ($value) { - // @TODO: minimize attribute in non-xhtml mode - $attrib_arr[] = $key . '="' . $key . '"'; + $value = $key; + if (self::$doctype == 'xhtml') { + $value .= '="' . $value . '"'; + } + + $attrib_arr[] = $value; } } else { diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html index a5de02c22..c2e3997fd 100644 --- a/skins/larry/templates/mail.html +++ b/skins/larry/templates/mail.html @@ -131,7 +131,7 @@ - " /> + " /> @@ -204,8 +204,8 @@
    -
  • -
  • +
  • +