public function vacation_form() { $table = new html_table(array('cols' => 2)); $field_id = 'vacationenable'; $input_vacationenable = new html_checkbox(array('name' => '_vacationenable', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationenable')))); $table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() === true || $this->obj->is_vacation_enable() == "1" || $this->obj->is_vacation_enable() == "t" || $this->obj->is_vacation_enable() == "y" || $this->obj->is_vacation_enable() == "yes" ? 1 : 0)); if ($this->rc->config->get('vacation_gui_vacationdate', FALSE)) { $format = $this->rc->config->get('vacation_dateformat', 'm/d/Y'); $this->add_date_field($table, 'vacationstart', $this->obj->get_vacation_start(), $format); $this->add_date_field($table, 'vacationend', $this->obj->get_vacation_end(), $format); } if ($this->rc->config->get('vacation_gui_vacationsubject', FALSE)) { $field_id = 'vacationsubject'; $input_vacationsubject = new html_inputfield(array('name' => '_vacationsubject', 'id' => $field_id, 'size' => 95)); $table->add('title', html::label($field_id, Q($this->gettext('vacationsubject')))); $table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject())); } $field_id = 'vacationmessage'; if ($this->rc->config->get('vacation_gui_vacationmessage_html', FALSE)) { $this->rc->output->add_label('converting', 'editorwarning'); // FIX: use identity mode for minimal functions rcube_html_editor('identity'); $text_vacationmessage = new html_textarea(array('name' => '_vacationmessage', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 12, 'cols' => 70, 'class' => 'mce_editor')); } else { $text_vacationmessage = new html_textarea(array('name' => '_vacationmessage', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 12, 'cols' => 70)); } $table->add('title', html::label($field_id, Q($this->gettext('vacationmessage')))); $table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message())); if ($this->rc->config->get('vacation_gui_vacationkeepcopyininbox', FALSE)) { $field_id = 'keepcopyininbox'; $input_vacationkeepcopyininbox = new html_checkbox(array('name' => '_vacationkeepcopyininbox', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationkeepcopyininbox')))); $table->add(null, $input_vacationkeepcopyininbox->show($this->obj->is_vacation_keep_copy_in_inbox() ? 1 : 0)); } if ($this->rc->config->get('vacation_gui_vacationforwarder', FALSE)) { $field_id = 'vacationforwarder'; $input_vacationforwarder = new html_inputfield(array('name' => '_vacationforwarder', 'id' => $field_id, 'size' => 95)); $table->add('title', html::label($field_id, Q($this->gettext('vacationforwarder')))); $table->add(null, $input_vacationforwarder->show($this->obj->get_vacation_forwarder())); } $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation')) . html::div(array('class' => "boxcontent scroller"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.vacation-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $this->rc->output->add_gui_object('vacationform', 'vacation-form'); return $this->rc->output->form_tag(array('id' => 'vacation-form', 'name' => 'vacation-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation-save'), $out); }
public function vacation_sieve_form() { try { $table = new html_table(array('cols' => 2, 'class' => 'propform')); $format = $this->app->config->get('date_format'); # Options $table->add(array('colspan' => 2, 'class' => 'section-first'), Q($this->gettext('options'))); $table->add_row(); $field_id = 'vacation_enable'; $input_vacationenable = new html_checkbox(array('name' => '_vacation_enable', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationenable')))); $table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() ? 1 : 0)); $field_id = 'vacation_start'; $input_vacationstart = new html_inputfield(array('name' => '_vacation_start', 'id' => $field_id, 'size' => 10)); $table->add('title', html::label($field_id, Q($this->gettext('period')))); $vacStart = $this->obj->get_vacation_start(); $hour_text = array(); $hour_value = array(); $wholeDay = Q($this->gettext('wholeday')); $hour_value[$wholeDay] = ''; $hour_text[$wholeDay] = $wholeDay; $minHour = $this->config['working_hours'][0]; $maxHour = $this->config['working_hours'][1]; foreach (range($minHour, $maxHour) as $tmp_hour) { $hour_text[$tmp_hour] = sprintf("%02d:00", $tmp_hour); $hour_value[$tmp_hour] = $tmp_hour; } unset($tmp_hour); $field_id = 'vacation_starttime'; $input_vacationstarttime = new html_select(array('name' => '_vacation_starttime')); $input_vacationstarttime->add($hour_text, $hour_value); $field_id = 'vacation_endtime'; $input_vacationendtime = new html_select(array('name' => '_vacation_endtime')); $input_vacationendtime->add($hour_text, $hour_value); $field_id = 'vacation_end'; $input_vacationend = new html_inputfield(array('name' => '_vacation_end', 'id' => $field_id, 'size' => 10)); $vacEnd = $this->obj->get_vacation_end(); $periodFields = $this->gettext('vacationfrom') . ' ' . $input_vacationstart->show(date($format, $vacStart)) . ' ' . $input_vacationstarttime->show($hour_text[$this->obj->get_vacation_starttime()]) . ' ' . $this->gettext('vacationto') . ' ' . $input_vacationend->show(date($format, $vacEnd)) . ' ' . $input_vacationendtime->show($hour_text[$this->obj->get_vacation_endtime()]); $table->add(null, $periodFields); $table->add_row(); $field_id = 'every'; $input_every = new html_inputfield(array('name' => '_every', 'id' => $field_id, 'size' => 5)); $table->add('title', html::label($field_id, Q($this->gettext('frequency')))); $table->add(null, $this->gettext('answer_no_more_than_every') . ' ' . $input_every->show($this->obj->get_every()) . ' ' . $this->gettext('vacationdays')); $table->add_row(); $identities = $this->get_identities(); $default_identity = key($identities); $field_id = 'addressed_to'; $input_addressed_to = new html_select(array('name' => '_addressed_to[]', 'id' => $field_id, 'multiple' => true)); $input_addressed_to->add($identities); $addressedTo = $this->obj->get_addressed_to(); $table->add('title', html::label($field_id, Q($this->gettext('addressed_to')))); $table->add(null, $input_addressed_to->show($addressedTo ? $addressedTo : $default_identity)); # Subject field $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('subject'))); $table->add_row(); $field_id = 'vacation_subject'; $input_vacationsubject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => 40)); $table->add('title', html::label($field_id, Q($this->gettext('vacationsubject')))); $table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject())); $table->add_row(); $field_id = '_append_subject'; $input_appendsubject = new html_checkbox(array('name' => '_append_subject', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('append_subject')))); $table->add(null, $input_appendsubject->show($this->obj->get_append_subject() ? 1 : 0)); # Message $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('vacationmessage'))); $table->add_row(); $field_id = 'send_from'; $input_sendfrom = new html_select(array('name' => '_send_from', 'id' => $field_id)); $input_sendfrom->add($identities); $sendFrom = $this->obj->get_send_from(); $table->add('title', html::label($field_id, Q($this->gettext('send_from')))); $table->add(null, $input_sendfrom->show($sendFrom ? $sendFrom : $default_identity)); # Add the HTML Row $table->add_row(); $field_id = 'vacation_message'; if ($this->config['msg_format'] == 'html') { $this->app->output->add_label('converting', 'editorwarning'); rcube_html_editor('identity'); $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40, 'class' => 'mce_editor')); } else { $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40)); } # $table->add('top title', html::label($field_id, Q($this->gettext('vacationmessage')))); $table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message())); # Get the HTML $tableHtml = $table->show(); $submitLine = html::p(null, $this->app->output->button(array('command' => 'plugin.vacation_sieve-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); # First line $boxTitle = html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation')); $out = html::div(array('class' => 'box'), $boxTitle . html::div(array('class' => "boxcontent"), $tableHtml . $submitLine)); $this->app->output->add_gui_object('vacationsieveform', 'vacation_sieve_form'); return $this->app->output->form_tag(array('id' => 'vacation_sieve_form', 'name' => 'vacation_sieve_form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation_sieve-save'), $out); } catch (Exception $exc) { $this->log_error('Fail to build form: ' . $exc->getMessage()); } }
function init_html() { $rcmail = rcmail::get_instance(); // always include all identities when creating vacation messages if ($rcmail->config->get('sieverules_force_vacto')) { $this->force_vacto = $rcmail->config->get('sieverules_force_vacto'); } // include the 'from' option when creating vacation messages if ($rcmail->config->get('sieverules_show_vacfrom')) { $this->show_vacfrom = $rcmail->config->get('sieverules_show_vacfrom'); } // include the 'handle' option when creating vacation messages if ($rcmail->config->get('sieverules_show_vachandle')) { $this->show_vachandle = $rcmail->config->get('sieverules_show_vachandle'); } $this->_startup(); if ($rcmail->config->get('sieverules_multiplerules') && $this->current_ruleset === false) { if ($ruleset = $this->sieve->get_active()) { $this->current_ruleset = $this->sieve->get_active(); } else { $this->current_ruleset = $rcmail->config->get('sieverules_ruleset_name'); $this->_startup(); rcmail_overwrite_action('plugin.sieverules.setup'); $this->action = 'plugin.sieverules.setup'; } } if ($rcmail->config->get('sieverules_multiplerules')) { $_SESSION['sieverules_current_ruleset'] = $this->current_ruleset; } $this->api->output->set_env('ruleset', $this->current_ruleset); if ($rcmail->config->get('sieverules_adveditor') == 2 && get_input_value('_override', RCUBE_INPUT_GET) != '1' && $this->action == 'plugin.sieverules') { rcmail_overwrite_action('plugin.sieverules.advanced'); $this->action = 'plugin.sieverules.advanced'; } $this->api->output->add_handlers(array('sieveruleslist' => array($this, 'gen_list'), 'sieverulesexamplelist' => array($this, 'gen_examples'), 'sieverulessetup' => array($this, 'gen_setup'), 'sieveruleform' => array($this, 'gen_form'), 'advancededitor' => array($this, 'gen_advanced'), 'advswitch' => array($this, 'gen_advswitch'), 'rulelist' => array($this, 'gen_rulelist'), 'sieverulesframe' => array($this, 'sieverules_frame'))); if ($this->action != 'plugin.sieverules.advanced') { $this->api->output->include_script('list.js'); } if (sizeof($this->examples) > 0) { $this->api->output->set_env('examples', 'true'); } if ($this->action == 'plugin.sieverules.add') { $this->api->output->set_pagetitle($this->gettext('newfilter')); $this->api->output->send('sieverules.editsieverule'); } elseif ($this->action == 'plugin.sieverules.edit') { rcube_html_editor('sieverules'); $this->api->output->add_script(sprintf("window.rcmail_editor_settings = %s", json_encode(array('plugins' => 'paste,tabfocus', 'theme_advanced_buttons1' => 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr', 'theme_advanced_buttons2' => 'link,unlink,code,forecolor,fontselect,fontsizeselect'))), 'head'); $this->api->output->set_pagetitle($this->gettext('edititem')); $this->api->output->send('sieverules.editsieverule'); } elseif ($this->action == 'plugin.sieverules.setup') { $this->api->output->set_pagetitle($this->gettext('filters')); $this->api->output->add_script(JS_OBJECT_NAME . ".add_onload('" . JS_OBJECT_NAME . ".sieverules_load_setup()');"); $this->api->output->send('sieverules.sieverules'); } elseif ($this->action == 'plugin.sieverules.advanced') { $this->api->output->set_pagetitle($this->gettext('filters')); $this->api->output->send('sieverules.advancededitor'); } else { $this->api->output->set_pagetitle($this->gettext('filters')); $this->api->output->send('sieverules.sieverules'); } }