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) --- plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php') diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php index 419989e53..2779d2f1b 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php @@ -329,14 +329,23 @@ class rcube_sieve_vacation extends rcube_sieve_engine '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 = ''; + . 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