From 9c38c58e1e60c5d6d793eaa35692c8d80ece2d58 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 20 Apr 2015 05:47:38 -0400 Subject: Add option to prepopulate vacation addresses on form init (#1490030) --- .../lib/Roundcube/rcube_sieve_engine.php | 33 ++++++++++++++++++++-- .../lib/Roundcube/rcube_sieve_vacation.php | 13 +++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) (limited to 'plugins/managesieve/lib') diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index b8af0373d..46237340d 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -441,6 +441,11 @@ class rcube_sieve_engine $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(); } @@ -1769,7 +1774,10 @@ class rcube_sieve_engine . "\n"; // vacation - $vsec = in_array('vacation-seconds', $this->exts); + $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 .= '
'; $out .= ''. rcube::Q($this->plugin->gettext('vacationreason')) .'
' .''; + . rcube::Q(implode("\n", $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( + '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'); @@ -461,7 +470,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine $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); -- cgit v1.2.3