diff --git a/CHANGELOG b/CHANGELOG index e1148b229df..40083e3245a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,6 +33,7 @@ CHANGELOG Roundcube Webmail - Indicate that a collapsed thread has flagged children (#5013) - Implemented message/rfc822 attachment preview - Update to jsTimezoneDetect 1.0.6 +- Managesieve: Add option to automatically set vacation :from address (#5428) - Managesieve: Support 'string' test from variables extension [RFC 5229] (#5248) - Managesieve: Support 'duplicate' extension [RFC 7352] - Managesieve: Unhide advanced rule controls if there are inputs with errors diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index deeecc90c79..916c2998f67 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,5 +1,6 @@ - Fix parsing of vacation date-time with non-default date_format (#5372) - Fix regression where js error is thrown if server does not support 'duplicate' extension +- Add option to automatically set vacation :from address (#5428) * version 8.7 [2016-07-19] ----------------------------------------------------------- diff --git a/plugins/managesieve/config.inc.php.dist b/plugins/managesieve/config.inc.php.dist index 835db538c32..5b4586af050 100644 --- a/plugins/managesieve/config.inc.php.dist +++ b/plugins/managesieve/config.inc.php.dist @@ -96,5 +96,9 @@ $config['managesieve_vacation_interval'] = 0; // of these on initial vacation form creation. $config['managesieve_vacation_addresses_init'] = false; +// Sometimes you want to always reply with mail email address +// This option enables automatic filling of :from field on initial vacation form creation. +$config['managesieve_vacation_from_init'] = false; + // Supported methods of notify extension. Default: 'mailto' $config['managesieve_notify_methods'] = array('mailto'); diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 004e1e6d9ba..23dd42d8f24 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -1947,7 +1947,17 @@ function action_div($fid, $id, $div=true) // vacation $vsec = in_array('vacation-seconds', $this->exts); $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); - $addresses = isset($action['addresses']) || !$auto_addr ? (array) $action['addresses'] : $this->user_emails(); + $from_addr = $this->rc->config->get('managesieve_vacation_from_init'); + + if (empty($action)) { + if ($auto_addr) { + $action['addresses'] = $this->user_emails(); + } + if ($from_addr) { + $default_identity = $this->rc->user->list_emails(true); + $action['from'] = $default_identity['email']; + } + } $out .= '
'; $out .= ''. rcube::Q($this->plugin->gettext('vacationreason')) .'
'; @@ -1977,8 +1987,8 @@ function action_div($fid, $id, $div=true) '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) + $out .= $this->list_input($id, 'action_addresses', $action['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')) . '
'; diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php index 874110534cc..bba774490a1 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php @@ -339,8 +339,18 @@ public function vacation_form($attrib) 'noclose' => true ) + $attrib); + $from_addr = $this->rc->config->get('managesieve_vacation_from_init'); $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); - $addresses = !$auto_addr || count($this->vacation) > 1 ? (array) $this->vacation['addresses'] : $this->user_emails(); + + if (count($this->vacation) < 2) { + if ($auto_addr) { + $this->vacation['addresses'] = $this->user_emails(); + } + if ($from_addr) { + $default_identity = $this->rc->user->list_emails(true); + $this->vacation['from'] = $default_identity['email']; + } + } // form elements $from = new html_inputfield(array('name' => 'vacation_from', 'id' => 'vacation_from', 'size' => 50)); @@ -348,7 +358,7 @@ public function vacation_form($attrib) $reason = new html_textarea(array('name' => 'vacation_reason', 'id' => 'vacation_reason', 'cols' => 60, 'rows' => 8)); $interval = new html_inputfield(array('name' => 'vacation_interval', 'id' => 'vacation_interval', 'size' => 5)); $addresses = ''; + . rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . ''; $status = new html_select(array('name' => 'vacation_status', 'id' => 'vacation_status')); $action = new html_select(array('name' => 'vacation_action', 'id' => 'vacation_action', 'onchange' => 'vacation_action_select()')); $addresses_link = new html_inputfield(array( diff --git a/plugins/managesieve/skins/larry/managesieve.css b/plugins/managesieve/skins/larry/managesieve.css index 6cea1593596..2545ca40631 100644 --- a/plugins/managesieve/skins/larry/managesieve.css +++ b/plugins/managesieve/skins/larry/managesieve.css @@ -373,6 +373,7 @@ td.rowtargets > span.listarea border-top: none; } +#vacationform .listelement input, #filter-form .listelement input { border: none; @@ -440,21 +441,6 @@ body.iframe.mail #filter-form max-height: 91px; } -#vacationform .listelement, -#vacationform .listelement .reset { - height: 22px; -} - -#vacationform .listelement .reset { - background-position: -1px 3px; -} - -#vacationform .listelement input { - vertical-align: top; - border: 0; - box-shadow: none; -} - #vacationform td.vacation { white-space: nowrap; }