Add option to prepopulate vacation addresses on form init (#1490030)
| | |
| | | - Add option to prepopulate vacation addresses on form init (#1490030) |
| | | - Add option to define default vacation interval |
| | | - Fix missing position idicator in Larry skin when dragging a filter |
| | | - Fix incorrect filter data after filter delete (#1490356) |
| | |
| | | // to define interval in seconds here (as a string), e.g. "3600s". |
| | | $config['managesieve_vacation_interval'] = 0; |
| | | |
| | | // Some servers require vacation :addresses to be filled with all |
| | | // user addresses (aliases). This option enables automatic filling |
| | | // of these on initial vacation form creation. |
| | | $config['managesieve_vacation_addresses_init'] = false; |
| | | |
| | | // Supported methods of notify extension. Default: 'mailto' |
| | | $config['managesieve_notify_methods'] = array('mailto'); |
| | |
| | | |
| | | $this->rc->output->command('managesieve_actionfill', $content, $id, $aid); |
| | | } |
| | | else if ($action == 'addresses') { |
| | | $aid = rcube_utils::get_input_value('_aid', rcube_utils::INPUT_POST); |
| | | |
| | | $this->rc->output->command('managesieve_vacation_addresses_update', $aid, $this->user_emails()); |
| | | } |
| | | |
| | | $this->rc->output->send(); |
| | | } |
| | |
| | | |
| | | // 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(); |
| | | |
| | | $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 />' |
| | | .'<textarea name="_action_reason['.$id.']" id="action_reason' .$id. '" ' |
| | |
| | | .'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'subject', 'action_subject') .' />'; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' |
| | | . $this->list_input($id, 'action_addresses', $action['addresses'], true, |
| | | $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30); |
| | | . $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 .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' |
| | | .'<input type="text" name="_action_interval['.$id.']" id="action_interval'.$id.'" ' |
| | | .'value="' .rcube::Q(rcube_sieve_vacation::vacation_interval($action), 'strict', false) . '" size="2" ' |
| | |
| | | |
| | | $this->headers += $headers; |
| | | } |
| | | |
| | | /** |
| | | * Get all e-mail addresses of the user |
| | | */ |
| | | protected function user_emails() |
| | | { |
| | | $addresses = $this->rc->user->list_emails(); |
| | | |
| | | foreach ($addresses as $idx => $email) { |
| | | $addresses[$idx] = $email['email']; |
| | | } |
| | | |
| | | $addresses = array_unique($addresses); |
| | | sort($addresses); |
| | | |
| | | return $addresses; |
| | | } |
| | | } |
| | |
| | | 'noclose' => true |
| | | ) + $attrib); |
| | | |
| | | $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); |
| | | $addresses = !$auto_addr || count($this->vacation) > 1 ? (array) $this->vacation['addresses'] : $this->user_emails(); |
| | | |
| | | // form elements |
| | | $subject = new html_inputfield(array('name' => 'vacation_subject', 'id' => 'vacation_subject', 'size' => 50)); |
| | | $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", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>'; |
| | | . rcube::Q(implode("\n", $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( |
| | | 'type' => 'button', |
| | | 'href' => '#', |
| | | 'class' => 'button', |
| | | 'onclick' => rcmail_output::JS_OBJECT_NAME . '.managesieve_vacation_addresses()' |
| | | )); |
| | | |
| | | $status->add($this->plugin->gettext('vacation.on'), 'on'); |
| | | $status->add($this->plugin->gettext('vacation.off'), 'off'); |
| | |
| | | $table = new html_table(array('cols' => 2)); |
| | | |
| | | $table->add('title', html::label('vacation_addresses', $this->plugin->gettext('vacation.addresses'))); |
| | | $table->add(null, $addresses); |
| | | $table->add(null, $addresses . $addresses_link->show($this->plugin->gettext('filladdresses'))); |
| | | $table->add('title', html::label('vacation_interval', $this->plugin->gettext('vacation.interval'))); |
| | | $table->add(null, $interval_txt); |
| | | |
| | |
| | | $labels['del'] = 'Delete'; |
| | | $labels['sender'] = 'Sender'; |
| | | $labels['recipient'] = 'Recipient'; |
| | | $labels['vacationaddr'] = 'My additional e-mail address(es):'; |
| | | $labels['vacationaddr'] = 'My e-mail addresses:'; |
| | | $labels['vacationdays'] = 'How often send messages (in days):'; |
| | | $labels['vacationinterval'] = 'How often send messages:'; |
| | | $labels['vacationreason'] = 'Message body (vacation reason):'; |
| | |
| | | $labels['vacation.status'] = 'Status'; |
| | | $labels['vacation.on'] = 'On'; |
| | | $labels['vacation.off'] = 'Off'; |
| | | $labels['vacation.addresses'] = 'My additional addresses'; |
| | | $labels['vacation.addresses'] = 'My e-mail addresses'; |
| | | $labels['vacation.interval'] = 'Reply interval'; |
| | | $labels['vacation.after'] = 'Put vacation rule after'; |
| | | $labels['vacation.saving'] = 'Saving data...'; |
| | |
| | | $labels['vacation.discard'] = 'Discard'; |
| | | $labels['vacation.redirect'] = 'Redirect to'; |
| | | $labels['vacation.copy'] = 'Send copy to'; |
| | | $labels['filladdresses'] = 'Fill with all my addresses'; |
| | | $labels['arialabelfiltersetactions'] = 'Filter set actions'; |
| | | $labels['arialabelfilteractions'] = 'Filter actions'; |
| | | $labels['arialabelfilterform'] = 'Filter properties'; |
| | |
| | | } |
| | | }; |
| | | |
| | | // update vacation addresses field with user identities |
| | | rcube_webmail.prototype.managesieve_vacation_addresses = function(id) |
| | | { |
| | | var lock = this.set_busy(true, 'loading'); |
| | | this.http_post('plugin.managesieve-action', {_act: 'addresses', _aid: id}, lock); |
| | | }; |
| | | |
| | | // update vacation addresses field with user identities |
| | | rcube_webmail.prototype.managesieve_vacation_addresses_update = function(id, addresses) |
| | | { |
| | | var field = $('#vacation_addresses,#action_addresses' + (id || '')); |
| | | smart_field_reset(field.get(0), addresses); |
| | | }; |
| | | |
| | | function rule_header_select(id) |
| | | { |
| | | var obj = document.getElementById('header' + id), |
| | |
| | | return elem; |
| | | } |
| | | |
| | | // Reset and fill the smart list input with new data |
| | | function smart_field_reset(field, data) |
| | | { |
| | | var id = field.id + '_list', |
| | | list = data.length ? data : ['']; |
| | | area = $('#' + id); |
| | | |
| | | area.empty(); |
| | | |
| | | // add input rows |
| | | $.each(list, function(i, v) { |
| | | area.append(smart_field_row(v, field.name, i, $(field).data('size'))); |
| | | }); |
| | | } |
| | | |
| | | // Register onmouse(leave/enter) events for tips on specified form element |
| | | rcube_webmail.prototype.managesieve_tip_register = function(tips) |
| | | { |
| | |
| | | min-width: 65px; |
| | | } |
| | | |
| | | td.rowtargets div a |
| | | { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | html.mozilla #filter-form select |
| | | { |
| | | padding-top: 3px; |
| | |
| | | display: inline-block; |
| | | max-height: 67px; |
| | | overflow-y: auto; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | td.rowtargets > span.listarea |
| | |
| | | vertical-align: top; |
| | | border: 0; |
| | | } |
| | | |
| | | #vacationform input.button { |
| | | margin-left: 10px; |
| | | } |
| | |
| | | min-width: 70px; |
| | | } |
| | | |
| | | td.rowtargets div a { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | input.disabled, input.disabled:hover |
| | | { |
| | | color: #999999; |
| | |
| | | /* revert larry style button */ |
| | | #filter-form input.button |
| | | { |
| | | padding: inherit; |
| | | padding: 4px 12px; |
| | | } |
| | | |
| | | fieldset |
| | |
| | | display: inline-block; |
| | | max-height: 59px; |
| | | overflow-y: auto; |
| | | vertical-align: middle; |
| | | } |
| | | |
| | | td.rowtargets > span.listarea |
| | |
| | | #vacationform td.vacation { |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | #vacationform input.button { |
| | | margin-left: 10px; |
| | | } |