Managesieve: Add option to automatically set vacation :from address (#5428)

pull/5335/merge
Aleksander Machniak 8 years ago
parent c1c0a0d815
commit 46f45a3970

@ -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

@ -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]
-----------------------------------------------------------

@ -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');

@ -1947,7 +1947,17 @@ class rcube_sieve_engine
// 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 .= '<div id="action_vacation' .$id.'" style="display:' .($action['type']=='vacation' ? 'inline' : 'none') .'">';
$out .= '<span class="label">'. rcube::Q($this->plugin->gettext('vacationreason')) .'</span><br>';
@ -1977,8 +1987,8 @@ class rcube_sieve_engine
'class' => $this->error_class($id, 'action', 'from', 'action_from'),
));
$out .= '<br><span class="label">' .rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br>';
$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 .= '<br><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br>';

@ -339,8 +339,18 @@ class rcube_sieve_vacation extends rcube_sieve_engine
'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 @@ class rcube_sieve_vacation extends rcube_sieve_engine
$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 = '<textarea name="vacation_addresses" id="vacation_addresses" data-type="list" data-size="30" style="display: none">'
. rcube::Q(implode("\n", $addresses), 'strict', false) . '</textarea>';
. rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>';
$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(

@ -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;
}

Loading…
Cancel
Save