public function forward_form() { $table = new html_table(array('cols' => 2)); $field_id = 'forwardforwards'; $text_forwardforwards = new html_textarea(array('name' => '_forwardforwards', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40)); $table->add('title', html::label($field_id, Q($this->gettext('forwardforwards')))); $table->add(null, $text_forwardforwards->show($this->obj->get_forward_forwards())); $field_id = 'forwardkeepcopies'; $input_forwardkeepcopies = new html_checkbox(array('name' => '_forwardkeepcopies', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('forwardkeepcopies')))); $table->add(null, $input_forwardkeepcopies->show($this->obj->is_forward_keepcopies() === true || $this->obj->is_forward_keepcopies() == "1" || $this->obj->is_forward_keepcopies() == "t" || $this->obj->is_forward_keepcopies() == "y" || $this->obj->is_forward_keepcopies() == "yes" ? 1 : 0)); $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('forward')) . html::div(array('class' => "boxcontent"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.forward-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $this->rc->output->add_gui_object('forwardform', 'forward-form'); return $this->rc->output->form_tag(array('id' => 'forward-form', 'name' => 'forward-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.forward-save'), $out); }
function preferences_list($p) { try { //You must set a block or the section will not be displayed if ($p['section'] == 'server') { $this->loadData(); // ================================================================ //Auto reply $p['blocks'][ARBLOCK]['name'] = $this->gettext('autoreply'); $ctrl_id = 'ztp_ar_enabled'; $ctrl = new html_checkbox(array('name' => '_ar_enabled', 'id' => $ctrl_id, 'value' => 1)); $p['blocks'][ARBLOCK]['options']['ar_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_enabled'))), 'content' => $ctrl->show($this->ar_enabled)); $ctrl_id = 'ztp_ar_subject'; $ctrl = new html_inputfield(array('type' => 'text', 'name' => '_ar_subject', 'id' => $ctrl_id)); $p['blocks'][ARBLOCK]['options']['ar_subject'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_subject'))), 'content' => $ctrl->show($this->ar_subject)); $ctrl_id = 'ztp_ar_body'; $ctrl = new html_textarea(array('name' => '_ar_body', 'id' => $ctrl_id, 'rows' => 5, 'cols' => 50)); $p['blocks'][ARBLOCK]['options']['ar_body'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_body'))), 'content' => $ctrl->show($this->ar_body)); $ctrl_id = 'ztp_ar_ae_enabled'; $ctrl = new html_checkbox(array('name' => '_ar_ae_enabled', 'id' => $ctrl_id, 'value' => 1)); $ctrl2_id = 'ztp_ar_ae_date'; $ctrl2 = new html_inputfield(array('name' => '_ar_ae_date', 'id' => $ctrl2_id)); $p['blocks'][ARBLOCK]['options']['ar_ae_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_ae_enabled'))), 'content' => $ctrl->show($this->ar_ae_enabled) . " " . $ctrl2->show($this->ar_ae_date)); // ================================================================ //Forwarder $p['blocks'][FWBLOCK]['name'] = $this->gettext('forwarder'); $ctrl_id = 'ztp_fw_enabled'; $ctrl = new html_checkbox(array('name' => '_fw_enabled', 'id' => $ctrl_id, 'value' => 1)); $p['blocks'][FWBLOCK]['options']['fw_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_enabled'))), 'content' => $ctrl->show($this->fw_enabled)); $ctrl_id = 'ztp_fw_address'; $ctrl = new html_inputfield(array('name' => '_fw_address', 'id' => $ctrl_id)); $p['blocks'][FWBLOCK]['options']['fw_address'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_address'))), 'content' => $ctrl->show($this->fw_address)); $ctrl_id = 'ztp_fw_keeporiginal'; $ctrl = new html_checkbox(array('name' => '_fw_keeporiginal', 'id' => $ctrl_id, 'value' => 1)); $p['blocks'][FWBLOCK]['options']['fw_keeporiginal'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_keeporiginal'))), 'content' => $ctrl->show($this->fw_keeporiginal)); } } catch (Exception $e) { $p['abort'] = true; $p['result'] = false; $p['message'] = $e->getMessage(); } return $p; }
/** * Independent vacation form */ public function vacation_form($attrib) { // check supported extensions $date_extension = in_array('date', $this->exts); $regex_extension = in_array('regex', $this->exts); $seconds_extension = in_array('vacation-seconds', $this->exts); // build FORM tag $form_id = $attrib['id'] ?: 'form'; $out = $this->rc->output->request_form(array('id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.managesieve-vacation', 'noclose' => true) + $attrib); $from_addr = $this->rc->config->get('managesieve_vacation_from_init'); $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); 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)); $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>'; $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'); $action->add($this->plugin->gettext('vacation.keep'), 'keep'); $action->add($this->plugin->gettext('vacation.discard'), 'discard'); $action->add($this->plugin->gettext('vacation.redirect'), 'redirect'); if (in_array('copy', $this->exts)) { $action->add($this->plugin->gettext('vacation.copy'), 'copy'); } if ($this->rc->config->get('managesieve_vacation') != 2 && count($this->vacation['list'])) { $after = new html_select(array('name' => 'vacation_after', 'id' => 'vacation_after')); $after->add('', ''); foreach ($this->vacation['list'] as $idx => $rule) { $after->add($rule, $idx); } } $interval_txt = $interval->show(self::vacation_interval($this->vacation)); if ($seconds_extension) { $interval_select = new html_select(array('name' => 'vacation_interval_type')); $interval_select->add($this->plugin->gettext('days'), 'days'); $interval_select->add($this->plugin->gettext('seconds'), 'seconds'); $interval_txt .= ' ' . $interval_select->show(isset($this->vacation['seconds']) ? 'seconds' : 'days'); } else { $interval_txt .= ' ' . $this->plugin->gettext('days'); } if ($date_extension || $regex_extension) { $date_from = new html_inputfield(array('name' => 'vacation_datefrom', 'id' => 'vacation_datefrom', 'class' => 'datepicker', 'size' => 12)); $date_to = new html_inputfield(array('name' => 'vacation_dateto', 'id' => 'vacation_dateto', 'class' => 'datepicker', 'size' => 12)); $date_format = $this->rc->config->get('date_format', 'Y-m-d'); } if ($date_extension) { $time_from = new html_inputfield(array('name' => 'vacation_timefrom', 'id' => 'vacation_timefrom', 'size' => 6)); $time_to = new html_inputfield(array('name' => 'vacation_timeto', 'id' => 'vacation_timeto', 'size' => 6)); $time_format = $this->rc->config->get('time_format', 'H:i'); $date_value = array(); foreach ((array) $this->vacation['tests'] as $test) { if ($test['test'] == 'currentdate') { $idx = $test['type'] == 'value-ge' ? 'from' : 'to'; if ($test['part'] == 'date') { $date_value[$idx]['date'] = $test['arg']; } else { if ($test['part'] == 'iso8601') { $date_value[$idx]['datetime'] = $test['arg']; } } } } foreach ($date_value as $idx => $value) { $date = $value['datetime'] ?: $value['date']; $date_value[$idx] = $this->rc->format_date($date, $date_format, false); if (!empty($value['datetime'])) { $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, true); } } } else { if ($regex_extension) { // Sieve 'date' extension not available, read start/end from RegEx based rules instead if ($date_tests = self::parse_regexp_tests($this->vacation['tests'])) { $date_value['from'] = $this->rc->format_date($date_tests['from'], $date_format, false); $date_value['to'] = $this->rc->format_date($date_tests['to'], $date_format, false); } } } // force domain selection in redirect email input $domains = (array) $this->rc->config->get('managesieve_domains'); $redirect = $this->vacation['action'] == 'redirect' || $this->vacation['action'] == 'copy'; if (!empty($domains)) { sort($domains); $domain_select = new html_select(array('name' => 'action_domain', 'id' => 'action_domain')); $domain_select->add(array_combine($domains, $domains)); if ($redirect && $this->vacation['target']) { $parts = explode('@', $this->vacation['target']); if (!empty($parts)) { $this->vacation['domain'] = array_pop($parts); $this->vacation['target'] = implode('@', $parts); } } } // redirect target $action_target = ' <span id="action_target_span" style="display:' . ($redirect ? 'inline' : 'none') . '">' . '<input type="text" name="action_target" id="action_target"' . ' value="' . ($redirect ? rcube::Q($this->vacation['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . '/>' . (!empty($domains) ? ' @ ' . $domain_select->show($this->vacation['domain']) : '') . '</span>'; // Message tab $table = new html_table(array('cols' => 2)); $table->add('title', html::label('vacation_subject', $this->plugin->gettext('vacation.subject'))); $table->add(null, $subject->show($this->vacation['subject'])); $table->add('title', html::label('vacation_reason', $this->plugin->gettext('vacation.body'))); $table->add(null, $reason->show($this->vacation['reason'])); if ($date_extension || $regex_extension) { $table->add('title', html::label('vacation_datefrom', $this->plugin->gettext('vacation.start'))); $table->add(null, $date_from->show($date_value['from']) . ($time_from ? ' ' . $time_from->show($date_value['time_from']) : '')); $table->add('title', html::label('vacation_dateto', $this->plugin->gettext('vacation.end'))); $table->add(null, $date_to->show($date_value['to']) . ($time_to ? ' ' . $time_to->show($date_value['time_to']) : '')); } $table->add('title', html::label('vacation_status', $this->plugin->gettext('vacation.status'))); $table->add(null, $status->show(!isset($this->vacation['disabled']) || $this->vacation['disabled'] ? 'off' : 'on')); $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.reply')) . $table->show($attrib)); // Advanced tab $table = new html_table(array('cols' => 2)); $table->add('title', html::label('vacation_from', $this->plugin->gettext('vacation.from'))); $table->add(null, $from->show($this->vacation['from'])); $table->add('title', html::label('vacation_addresses', $this->plugin->gettext('vacation.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); if ($after) { $table->add('title', html::label('vacation_after', $this->plugin->gettext('vacation.after'))); $table->add(null, $after->show($this->vacation['idx'] - 1)); } $table->add('title', html::label('vacation_action', $this->plugin->gettext('vacation.action'))); $table->add('vacation', $action->show($this->vacation['action']) . $action_target); $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.advanced')) . $table->show($attrib)); $out .= '</form>'; $this->rc->output->add_gui_object('sieveform', $form_id); if ($time_format) { $this->rc->output->set_env('time_format', $time_format); } return $out; }
/** * */ function attendees_form($attrib = array()) { $input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 30)); $textarea = new html_textarea(array('name' => 'comment', 'id' => 'edit-attendees-comment', 'rows' => 4, 'cols' => 55, 'title' => $this->cal->gettext('itipcommenttitle'))); return html::div($attrib, html::div(null, $input->show() . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-add', 'value' => $this->cal->gettext('addattendee'))) . " " . html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-schedule', 'value' => $this->cal->gettext('scheduletime') . '...'))) . html::p('attendees-commentbox', html::label(null, $this->cal->gettext('itipcomment') . $textarea->show()))); }
<form action="index.php" method="post"> <input type="hidden" name="_step" value="2" /> <?php // also load the default config to fill in the fields $RCI->load_defaults(); // register these boolean fields $RCI->bool_config_props = array('ip_check' => 1, 'enable_caching' => 1, 'enable_spellcheck' => 1, 'auto_create_user' => 1, 'smtp_log' => 1, 'prefer_html' => 1, 'preview_pane' => 1, 'debug_level' => 1); // allow the current user to get to the next step $_SESSION['allowinstaller'] = true; if (!empty($_POST['submit'])) { echo '<p class="notice">Copy or download the following configurations and save them in two files'; echo ' (names above the text box) within the <tt>' . RCMAIL_CONFIG_DIR . '</tt> directory of your Roundcube installation.<br/>'; echo ' Make sure that there are no characters outside the <tt><?php ?></tt> brackets when saving the files.</p>'; $textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile")); echo '<div><em>main.inc.php (<a href="index.php?_getfile=main">download</a>)</em></div>'; echo $textbox->show($_SESSION['main.inc.php'] = $RCI->create_config('main')); echo '<div style="margin-top:1em"><em>db.inc.php (<a href="index.php?_getfile=db">download</a>)</em></div>'; echo $textbox->show($_SESSION['db.inc.php'] = $RCI->create_config('db')); echo '<p class="hint">Of course there are more options to configure. Have a look at the config files or visit <a href="http://trac.roundcube.net/wiki/Howto_Config">Howto_Config</a> to find out.</p>'; echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>'; // echo '<style type="text/css"> .configblock { display:none } </style>'; echo "\n<hr style='margin-bottom:1.6em' />\n"; } ?> <fieldset> <legend>General configuration</legend> <dl class="configblock"> <dt class="propname">product_name</dt> <dd>
protected function _vacation_table($ext, $rowid, $defaults, $display, $help_icon) { $rcmail = rcube::get_instance(); // begin vacation action $vacs_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'vacation' ? '' : 'display: none;')); $to_addresses = ""; $vacto_arr = explode(",", $defaults['vacto']); $field_id_vacfrom = 'rcmfd_sievevacfrom_' . $rowid; $field_id_vacto = 'rcmfd_sievevacto_' . $rowid; if (count($this->identities)) { $select_id = new html_select(array('id' => $field_id_vacfrom, 'name' => "_vacfrom[]", 'class' => 'short', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.enable_sig(this);')); if ($this->show_vacfrom && in_array('variables', $ext)) { $select_id->add($this->gettext('autodetect'), "auto"); } elseif (!$this->show_vacfrom) { $select_id->add($this->gettext('autodetect'), ""); } foreach ($this->identities as $sql_arr) { // find currently selected from address if ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == rcmail::Q($sql_arr['from']['string'])) { $defaults['vacfrom'] = $sql_arr['identity_id']; } elseif ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == $sql_arr['from']['mailto']) { $defaults['vacfrom'] = $sql_arr['identity_id']; } $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']); $ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id']; if ($this->force_vacto) { $curaddress = $sql_arr['email']; $defaults['vacto'] .= (!empty($defaults['vacto']) ? ',' : '') . $sql_arr['email']; } else { $curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : ""; } $input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox')); $to_addresses .= $input_address->show($curaddress) . " " . html::label($ffield_id, rcmail::Q($sql_arr['email'])) . "<br />"; } } // deduplicate vacto list $tmparr = explode(",", $defaults['vacto']); $tmparr = array_unique($tmparr); $defaults['vacto'] = implode(",", $tmparr); if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) { $vacfrom_input = $select_id->show($defaults['vacfrom']); $input_vacto = new html_hiddenfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'value' => $defaults['vacto'])); $vacto_input = $to_addresses . $input_vacto->show(); $vac_help = $this->gettext('vactoexp'); } else { $input_vacfrom = new html_inputfield(array('id' => $field_id_vacfrom, 'name' => '_vacfrom[]')); $vacfrom_input = $input_vacfrom->show($defaults['vacfrom']); $input_vacto = new html_inputfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'class' => 'short')); $vacto_input = $input_vacto->show($defaults['vacto']); $vac_help = $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv'); } // from param $vacs_table->set_row_attribs(array('class' => $this->show_vacfrom ? 'advanced' : 'disabled', 'style' => $display['vacfrom'])); $vacs_table->add(null, html::label($field_id_vacfrom, rcmail::Q($this->gettext('from')))); $vacs_table->add(null, $vacfrom_input); $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' ')); $vacs_table->add(null, $sig_button); // to param $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(array('style' => 'vertical-align: top;'), html::label($field_id_vacto, rcmail::Q($this->gettext('sieveto')))); $vacs_table->add(null, $vacto_input); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(array('style' => 'vertical-align: top;'), $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $vac_help); $field_id = 'rcmfd_sievevacperiod_' . $rowid; $input_period = new html_inputfield(array('id' => $field_id, 'name' => '_period[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('period')))); $vacs_table->add(null, $input_period->show($defaults['period'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . (in_array('vacation-seconds', $ext) ? $vacs_table->size() + 1 : $vacs_table->size()) . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); if (in_array('vacation-seconds', $ext)) { $input_periodtype = new html_radiobutton(array('id' => $field_id . '_days', 'name' => '_period_radio_' . $rowid, 'value' => 'days', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show = $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_days', rcmail::Q($this->gettext('days'))); $input_periodtype = new html_radiobutton(array('id' => $field_id . '_seconds', 'name' => '_period_radio_' . $rowid, 'value' => 'seconds', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show .= ' ' . $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_seconds', rcmail::Q($this->gettext('seconds'))); $input_periodtype = new html_hiddenfield(array('id' => 'rcmfd_sievevacperiodtype_' . $rowid, 'name' => '_periodtype[]')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, ' '); $vacs_table->add(null, $period_type_show . $input_periodtype->show($defaults['periodtype'])); $vacs_table->add(null, ' '); } $vacs_table->set_row_attribs(array('style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vacperiodexp')); $field_id = 'rcmfd_sievevachandle_' . $rowid; $input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => $this->show_vachandle ? 'advanced' : 'disabled', 'style' => $display['vachandle'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievevachandle')))); $vacs_table->add(null, $input_handle->show($defaults['handle'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vachandleexp')); $field_id = 'rcmfd_sievevacsubject_' . $rowid; $input_subject = new html_inputfield(array('id' => $field_id, 'name' => '_subject[]')); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('subject')))); $vacs_table->add(array('colspan' => 2), $input_subject->show($defaults['subject'])); if (in_array('variables', $ext)) { $field_id = 'rcmfd_sievevacsubject_orig_' . $rowid; $input_origsubject = new html_checkbox(array('id' => $field_id, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_osubj(this, ' . $rowid . ')', 'class' => 'checkbox')); $input_vacosubj = new html_hiddenfield(array('id' => 'rcmfd_sievevactoh_' . $rowid, 'name' => '_orig_subject[]', 'value' => $defaults['origsubject'])); $vacs_table->add(null, ' '); $vacs_table->add(array('colspan' => 2), $input_origsubject->show($defaults['origsubject']) . " " . html::label($field_id, rcmail::Q($this->gettext('sieveorigsubj'))) . $input_vacosubj->show()); } $field_id = 'rcmfd_sievevacmag_' . $rowid; $input_msg = new html_textarea(array('id' => $field_id, 'name' => '_msg[]', 'rows' => '8', 'cols' => '40', 'class' => $defaults['htmlmsg'] == 1 ? 'mce_editor' : '', 'is_escaped' => $defaults['htmlmsg'] == 1 ? true : null)); $input_html = new html_checkbox(array('id' => 'rcmfd_sievevachtmlcb_' . $rowid, 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_html(this, ' . $rowid . ', \'' . $field_id . '\');', 'value' => '1', 'class' => 'checkbox')); $input_htmlhd = new html_hiddenfield(array('id' => 'rcmfd_sievevachtmlhd_' . $rowid, 'name' => '_htmlmsg[]', 'value' => $defaults['htmlmsg'])); $vacs_table->add('msg', html::label($field_id, rcmail::Q($this->gettext('message')))); $vacs_table->add(array('colspan' => 2), $input_msg->show($defaults['msg']) . html::tag('div', in_array('htmleditor', $rcmail->config->get('dont_override')) ? array('style' => 'display: none;') : null, $input_html->show($defaults['htmlmsg']) . " " . html::label('rcmfd_sievevachtmlcb_' . $rowid, rcmail::Q($this->gettext('htmlmessage')))) . $input_htmlhd->show()); $field_id = 'rcmfd_sievecharset_' . $rowid; $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('charset')))); $vacs_table->add(array('colspan' => 2), $rcmail->output->charset_selector(array('id' => $field_id, 'name' => '_vaccharset[]', 'selected' => $defaults['charset']))); $input_advopts = new html_checkbox(array('id' => 'vadvopts' . $rowid, 'name' => '_vadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $vacs_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('vadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['vacadv'] == '' ? 1 : 0)); return $vacs_table; }
function veximaccountadmin_form() { $rcmail = rcmail::get_instance(); $this->_load_config(); // add labels to client - to be used in JS alerts $rcmail->output->add_label('veximaccountadmin.enterallpassfields', 'veximaccountadmin.passwordinconsistency', 'veximaccountadmin.autoresponderlong', 'veximaccountadmin.autoresponderlongnum', 'veximaccountadmin.autoresponderlongmax', 'veximaccountadmin.headerblockdelete', 'veximaccountadmin.headerblockdeleteall', 'veximaccountadmin.headerblockexists', 'veximaccountadmin.headerblockentervalue'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $settings = $this->_get_configuration(); $on_avscan = $settings['on_avscan']; $on_spamassassin = $settings['on_spamassassin']; $sa_tag = $settings['sa_tag']; $sa_refuse = $settings['sa_refuse']; $spam_drop = $settings['spam_drop']; $on_vacation = $settings['on_vacation']; $vacation = $settings['vacation']; $on_forward = $settings['on_forward']; $forward = $settings['forward']; $unseen = $settings['unseen']; $maxmsgsize = $settings['maxmsgsize']; $user_id = $settings['user_id']; $domain_id = $settings['domain_id']; $domain_settings = $this->_get_domain_configuration($domain_id); $default_sa_tag = $domain_settings['sa_tag']; $default_sa_refuse = $domain_settings['sa_refuse']; $default_maxmsgsize = $domain_settings['maxmsgsize']; $active_domain = $domain_settings['domain']; $rcmail->output->set_env('vacation_maxlength', $this->config['vexim_vacation_maxlength']); $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n"; if ($this->config['show_admin_link'] == true and $settings['admin'] == true) { $out .= '<p class="adminlink">'; $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vexim_url'] . '" target="_blank">', '</a>'); $out .= "</p>\n"; } // ===================================================================================================== // Password $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'curpasswd'; $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), ''); $field_id = 'newpasswd'; $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), ''); $field_id = 'confpasswd'; $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), ''); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Spam/Virus $out .= '<fieldset><legend>' . $this->gettext('spamvirus') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_avscan'; $input_virusenabled = new html_checkbox(array('name' => 'on_avscan', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('virusenabled')), $input_virusenabled->show($on_avscan ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('virusenabledexplanation') . '</span>'); $field_id = 'on_spamassassin'; $input_spamenabled = new html_checkbox(array('name' => 'on_spamassassin', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($on_spamassassin ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('spamenabledexplanation') . '</span>'); $field_id = 'sa_tag'; $input_spamscoretag = new html_select(array('name' => 'sa_tag', 'id' => $field_id, 'class' => 'select')); $decPlaces = 0; $found_number = false; for ($i = 1; $i <= 20; $i = $i + 1) { $i = number_format($i, $decPlaces); $input_spamscoretag->add($i, $i); if ($sa_tag == $i) { $found_number = true; } } for ($i = 25; $i <= 100; $i = $i + 5) { $i = number_format($i, $decPlaces); $input_spamscoretag->add($i, $i); if ($sa_tag == $i) { $found_number = true; } } // If the value from database cannot be choosed among the list we present, // add it to the end of the list. This may happen because Vexim lets the // user write in a number in a textbox. if (!$found_number) { $input_spamscoretag->add($sa_tag, $sa_tag); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscoretag')), $input_spamscoretag->show($sa_tag), '<br /><span class="vexim-explanation">' . $this->gettext('spamscoretagexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_tag . '.</span></span>'); $field_id = 'sa_refuse'; $input_spamscorerefuse = new html_select(array('name' => 'sa_refuse', 'id' => $field_id, 'class' => 'select')); $found_number = false; for ($i = 1; $i <= 20; $i = $i + 1) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } for ($i = 25; $i <= 200; $i = $i + 5) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } for ($i = 300; $i <= 900; $i = $i + 100) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } $i = number_format(999, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } // If the value from database cannot be choosed among the list we present, // add it to the end of the list. This may happen because Vexim lets the // user write in a number in a textbox. if (!$found_number) { $input_spamscorerefuse->add($sa_refuse, $sa_refuse); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_refuse), '<br /><span class="vexim-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>'); $spammoveexplanation = '<br /><span class="vexim-explanation">' . str_replace("%italicstart", "<i>", str_replace("%italicend", "</i>", $this->gettext('spammoveexplanation_part1'))); if ($this->config['parsefolders_script']) { $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part2'); } $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part3'); $field_id = 'spam_drop'; $input_spammove = new html_checkbox(array('name' => 'spam_drop', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spammove')), $input_spammove->show($spam_drop ? 1 : 0), $spammoveexplanation); $out .= '</table>'; if ($this->config['parsefolders_script'] and $this->config['parsefolders_script_show_tip']) { $out .= '<p class="vexim-explanation">' . str_replace('%italicstart', '<i>', str_replace('%italicend', '</i>', $this->gettext('spamtip'))) . '</p>'; } $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Autoresponder $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_vacation'; $input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), ''); $field_id = 'vacation'; $input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Forward $out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_forward'; $input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0)); $field_id = 'forward'; $input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward)); $field_id = 'unseen'; $input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0)); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Header blocks (based on code from Philip Weir's sauserprefs plugin // http://roundcube.net/plugins/sauserprefs) $out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>'; $table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3)); $field_id = 'rcmfd_headerblockrule'; $input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id)); $input_headerblockrule->add($this->gettext('headerfrom'), 'From'); $input_headerblockrule->add($this->gettext('headerto'), 'To'); $input_headerblockrule->add($this->gettext('headersubject'), 'Subject'); $input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer'); $field_id = 'rcmfd_headerblockvalue'; $input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;')); $field_id = 'rcmbtn_add_address'; $button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;')); $table->add(null, $input_headerblockrule->show()); $table->add(null, $input_headerblockvalue->show()); $table->add(array('align' => 'right'), $button_addaddress); $delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall')); $table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all); $table->add_row(); $address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $address_table->add_header(array('width' => '120px'), $this->gettext('field')); $address_table->add_header(null, $this->gettext('value')); $address_table->add_header(array('width' => '40px'), ' '); $this->_address_row($address_table, null, null, $attrib); // Get the header rules from DB. Should probably be put in a function. $this->_load_config(); $this->_db_connect('r'); $sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t FROM blocklists\r\n\t\t WHERE user_id = '{$user_id}'\r\n\t\t AND domain_id = '{$domain_id}'\r\n\t\t ORDER BY block_id;"); if ($sql_result && $this->db->num_rows($sql_result) > 0) { $norules = 'display: none;'; } $address_table->set_row_attribs(array('style' => $norules)); $address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules'))); $address_table->add_row(); $this->api->output->set_env('address_rule_count', $this->db->num_rows()); while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { $field = $sql_arr['blockhdr']; $value = $sql_arr['blockval']; $this->_address_row($address_table, $field, $value, $attrib); } $table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show())); $table->add_row(); if ($table->size()) { $out .= $table->show(); } $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Parameters $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'maxmsgsize'; $input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4)); if ($default_maxmsgsize == 0) { $default_maxmsgsize = $this->gettext('unlimited'); } else { $default_maxmsgsize = $default_maxmsgsize . ' kb'; } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); $rcmail->output->add_gui_object('veximform', 'veximaccountadminform'); $out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out); $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom)); return $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 vboxadm_form() { $rcmail = rcmail::get_instance(); $this->_load_config(); // add labels to client - to be used in JS alerts $rcmail->output->add_label('vboxadm.enterallpassfields', 'vboxadm.passwordinconsistency', 'vboxadm.autoresponderlong', 'vboxadm.autoresponderlongnum', 'vboxadm.autoresponderlongmax'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $settings = $this->_get_configuration(); $sa_active = $settings['sa_active']; $sa_kill_score = $settings['sa_kill_score']; $is_on_vacation = $settings['is_on_vacation']; $vacation_subj = $settings['vacation_subj']; $vacation_msg = $settings['vacation_msg']; $vacation_start = $settings['vacation_start']; $vacation_end = $settings['vacation_end']; $max_msg_size_mb = $settings['max_msg_size'] / (1024 * 1024); $user_id = $settings['id']; $domain_id = $settings['domain_id']; $alias_active = $settings['alias_active']; $alias_goto = $settings['alias_goto']; $domain_settings = $this->_get_domain_configuration($domain_id); $active_domain = $domain_settings['name']; $rcmail->output->set_env('vacation_maxlength', $this->config['vboxadm_vacation_maxlength']); $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n"; if ($this->config['show_admin_link'] == true && ($settings['is_domainadmin'] == true || $settings['is_siteadmin'])) { $out .= '<p class="adminlink">'; $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vboxadm_url'] . '" target="_blank">', '</a>'); $out .= "</p>\n"; } // ===================================================================================================== // SpamAssassin $out .= '<fieldset><legend>' . $this->gettext('spam') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'sa_active'; $input_spamenabled = new html_checkbox(array('name' => 'sa_active', 'id' => $field_id, 'value' => 1)); // $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($sa_active ? 1 : 0), '<br /><span class="vboxadm-explanation">' . $this->gettext('spamenabledexplanation') . '</span>'); $field_id = 'sa_kill_score'; $input_spamscorerefuse = new html_inputfield(array('name' => 'sa_kill_score', 'id' => $field_id, 'maxlength' => 8, 'size' => 8)); // $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $out .= sprintf("<th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_kill_score), '<br /><span class="vboxadm-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Autoresponder $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table><tr><td>'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'is_on_vacation'; $input_autoresponderenabled = new html_checkbox(array('name' => 'is_on_vacation', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($is_on_vacation ? 1 : 0), ''); $field_id = 'vacation_start'; $input_vacation_start = new html_inputfield(array('name' => 'vacation_start', 'id' => $field_id, 'maxlength' => 10, 'class' => 'text-long')); if ($vacation_start == '0000-00-00') { $vacation_start = ''; } else { $vacation_start = preg_replace('/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/', '$3.$2.$1', $vacation_start); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderstartdate')), $input_vacation_start->show($vacation_start), ''); $field_id = 'vacation_end'; $input_vacation_end = new html_inputfield(array('name' => 'vacation_end', 'id' => $field_id, 'maxlength' => 10, 'class' => 'text-long')); if ($vacation_end == '0000-00-00') { $vacation_end = ''; } else { $vacation_end = preg_replace('/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)$/', '$3.$2.$1', $vacation_end); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenddate')), $input_vacation_end->show($vacation_end), ''); $field_id = 'vacation_subj'; $input_vacation_subj = new html_inputfield(array('name' => 'vacation_subj', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondersubject')), $input_vacation_subj->show($vacation_subj), '<br /><span class="vboxadm-explanation">' . $this->gettext('autorespondersubjectexplanation') . '.</span>'); $out .= '</table></td>'; $out .= '<td><table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'vacation_msg'; $input_vacation_msg = new html_textarea(array('name' => 'vacation_msg', 'id' => $field_id, 'class' => 'textarea')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_vacation_msg->show($vacation_msg), '<br /><span class="vboxadm-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>'); $out .= '</table></td></tr></table>'; $out .= '</div></fieldset>' . "\n\n"; // ============================================================ // Parameters $out .= '<table><tr><td>'; $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'max_msg_size'; $input_messagesize = new html_inputfield(array('name' => 'max_msg_size', 'id' => $field_id, 'maxlength' => 16, 'class' => 'text-long')); if ($default_maxmsgsize == 0) { $default_maxmsgsize = $this->gettext('unlimited'); } else { $default_maxmsgsize = $default_maxmsgsize . ' MB'; } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($max_msg_size_mb), '<br /><span class="vboxadm-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ============================================================ // Aliases if ($this->config['user_managed_aliases']) { // user can edit aliases for his mail address $out .= '<fieldset><legend>' . $this->gettext('aliases') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<span class="vboxadm-explanation">' . $this->gettext('aliasesexplanation') . '</span>'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'alias_active'; $input_alias_active = new html_checkbox(array('name' => 'alias_active', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('aliasesenabled')), $input_alias_active->show($alias_active ? 1 : 0), ''); $field_id = 'alias_goto'; $input_alias_goto = new html_inputfield(array('name' => 'alias_goto', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('aliasaddresses')), $input_alias_goto->show($alias_goto), ''); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; } // ============================================================ $out .= '</td><td>'; // ===================================================================================================== // Password change $out .= '<fieldset><legend>' . $this->gettext('passwordchange') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'newpasswd'; $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), ''); $field_id = 'confpasswd'; $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), ''); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ============================================================ $out .= '</td></tr></table>'; // ===================================================================================================== // Password $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('passwordexplanation') . '</p>'; $out .= '<table class="vboxadm-settings" cellpadding="0" cellspacing="0">'; $field_id = 'curpasswd'; $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), ''); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ============================================================ $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.vboxadm-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); $rcmail->output->add_gui_object('vboxadmform', 'vboxadmform'); $out = $rcmail->output->form_tag(array('id' => 'vboxadmform', 'class' => 'scroller', 'name' => 'vboxadmform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vboxadm-save'), $out); $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom)); return $out; }
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); }
private function _action_row($ext, $actions_table, $rowid, $action, $attrib, $example) { $rcmail = rcube::get_instance(); $help_icon = html::img(array('src' => $attrib['helpicon'], 'alt' => $this->gettext('messagehelp'), 'border' => 0)); // set default field display $display = array('vacadv' => $action['type'] != 'vacation' && $this->force_vacto ? '' : 'display: none;', 'vacfrom' => $this->show_vacfrom ? $display['vacadv'] : 'display: none;', 'vachandle' => $this->show_vachandle ? $display['vacadv'] : 'display: none;', 'noteadv' => 'display: none;', 'eheadadv' => 'display: none;'); // setup allowed actions $allowed_actions = array(); $config_actions = $rcmail->config->get('sieverules_allowed_actions', array()); if (in_array('fileinto', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) { $allowed_actions['fileinto'] = $this->gettext('messagemoveto'); } if (in_array('fileinto', $ext) && in_array('copy', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) { $allowed_actions['fileinto_copy'] = $this->gettext('messagecopyto'); } if (in_array('vacation', $ext) && ($config_actions['vacation'] || $action['type'] == 'vacation')) { $allowed_actions['vacation'] = $this->gettext('messagevacation'); } if (in_array('reject', $ext) && ($config_actions['reject'] || $action['type'] == 'reject')) { $allowed_actions['reject'] = $this->gettext('messagereject'); } elseif (in_array('ereject', $ext) && ($config_actions['reject'] || $action['type'] == 'ereject')) { $allowed_actions['ereject'] = $this->gettext('messagereject'); } if (in_array('imap4flags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imap4flags')) { $allowed_actions['imap4flags'] = $this->gettext('messageimapflags'); } elseif (in_array('imapflags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imapflags')) { $allowed_actions['imapflags'] = $this->gettext('messageimapflags'); } if (in_array('notify', $ext) && ($config_actions['notify'] || $action['type'] == 'notify')) { $allowed_actions['notify'] = $this->gettext('messagenotify'); } elseif (in_array('enotify', $ext) && ($config_actions['notify'] || $action['type'] == 'enotify')) { $allowed_actions['enotify'] = $this->gettext('messagenotify'); } if (in_array('editheader', $ext) && ($config_actions['editheaderadd'] || $action['type'] == 'editheaderadd')) { $allowed_actions['editheaderadd'] = $this->gettext('addheader'); } if (in_array('editheader', $ext) && ($config_actions['editheaderrem'] || $action['type'] == 'editheaderrem')) { $allowed_actions['editheaderrem'] = $this->gettext('removeheader'); } if ($config_actions['redirect'] || $action['type'] == 'redirect') { $allowed_actions['redirect'] = $this->gettext('messageredirect'); } if (in_array('copy', $ext) && ($config_actions['redirect'] || $action['type'] == 'redirect_copy')) { $allowed_actions['redirect_copy'] = $this->gettext('messageredirectcopy'); } if ($config_actions['keep'] || $action['type'] == 'keep') { $allowed_actions['keep'] = $this->gettext('messagekeep'); } if ($config_actions['discard'] || $action['type'] == 'discard') { $allowed_actions['discard'] = $this->gettext('messagediscard'); } if ($config_actions['stop'] || $action['type'] == 'stop') { $allowed_actions['stop'] = $this->gettext('messagestop'); } // set the default values reset($allowed_actions); $defaults = array('method' => key($allowed_actions), 'folder' => 'INBOX', 'reject' => '', 'vacto' => null, 'address' => '', 'period' => '', 'periodtype' => '', 'handle' => '', 'subject' => '', 'origsubject' => '', 'msg' => '', 'charset' => RCUBE_CHARSET, 'flags' => '', 'nfrom' => '', 'nimpt' => '', 'nmethod' => '', 'noptions' => '', 'nmsg' => ''); // set default identity for use in vacation action $identity = $rcmail->user->get_identity(); if ($this->show_vacfrom) { $defaults['vacfrom'] = in_array('variables', $ext) ? 'auto' : $identity['email']; } else { $defaults['vacfrom'] = null; } // apply current action values if ($action['type'] == 'fileinto' || $action['type'] == 'fileinto_copy') { $defaults['method'] = $action['type']; $defaults['folder'] = $action['target']; if ($rcmail->config->get('sieverules_folder_encoding')) { $defaults['folder'] = rcube_charset::convert($defaults['folder'], $rcmail->config->get('sieverules_folder_encoding'), 'UTF7-IMAP'); } if ($rcmail->config->get('sieverules_folder_delimiter')) { $defaults['folder'] = str_replace($rcmail->config->get('sieverules_folder_delimiter'), $rcmail->storage->get_hierarchy_delimiter(), $defaults['folder']); } $defaults['folder'] = $rcmail->config->get('sieverules_include_imap_root', true) ? $defaults['folder'] : $rcmail->storage->mod_folder($defaults['folder'], 'IN'); } elseif ($action['type'] == 'reject' || $action['type'] == 'ereject') { $defaults['method'] = $action['type']; $defaults['reject'] = $action['target']; } elseif ($action['type'] == 'vacation') { $defaults['method'] = 'vacation'; if (isset($action['seconds'])) { $defaults['period'] = $action['seconds']; $defaults['periodtype'] = 'seconds'; } else { $defaults['period'] = $action['days']; $defaults['periodtype'] = 'days'; } $defaults['vacfromdefault'] = $defaults['vacfrom']; $defaults['vacfrom'] = $action['from']; $defaults['vacto'] = $action['addresses']; $defaults['handle'] = $action['handle']; $defaults['subject'] = $action['subject']; $defaults['origsubject'] = $action['origsubject']; $defaults['msg'] = $action['msg']; $defaults['htmlmsg'] = $action['htmlmsg'] ? '1' : ''; $defaults['charset'] = $action['charset']; if ($defaults['htmlmsg'] == '1' && $rcmail->config->get('htmleditor') == '0') { $h2t = new rcube_html2text($defaults['msg'], false, true, 0); $defaults['msg'] = $h2t->get_text(); $defaults['htmlmsg'] = ''; } elseif ($defaults['htmlmsg'] == '' && $rcmail->config->get('htmleditor') == '1') { $defaults['msg'] = $defaults['msg']; $defaults['msg'] = nl2br($defaults['msg']); $defaults['htmlmsg'] = '1'; } if (!$example) { $this->force_vacto = false; } // check advanced enabled if (!empty($defaults['vacfrom']) && $defaults['vacfrom'] != $defaults['vacfromdefault'] || !empty($defaults['vacto']) || !empty($defaults['handle']) || !empty($defaults['period']) || $defaults['charset'] != RCUBE_CHARSET || $this->force_vacto) { $display['vacadv'] = ''; $display['vacfrom'] = $this->show_vacfrom ? '' : 'display: none;'; $display['vachandle'] = $this->show_vachandle ? '' : 'display: none;'; } } elseif ($action['type'] == 'redirect' || $action['type'] == 'redirect_copy') { $defaults['method'] = $action['type']; $defaults['address'] = $action['target']; } elseif ($action['type'] == 'imapflags' || $action['type'] == 'imap4flags') { $defaults['method'] = $action['type']; $defaults['flags'] = $action['target']; } elseif ($action['type'] == 'notify' || $action['type'] == 'enotify') { $defaults['method'] = $action['type']; $defaults['nfrom'] = $action['from']; $defaults['nimpt'] = $action['importance']; $defaults['nmethod'] = $action['method']; $defaults['noptions'] = $action['options']; $defaults['nmsg'] = $action['msg']; // check advanced enabled if (!empty($defaults['nfrom']) || !empty($defaults['nimpt'])) { $display['noteadv'] = ''; } } elseif ($action['type'] == 'editheaderadd' || $action['type'] == 'editheaderrem') { $defaults['method'] = $action['type']; $defaults['headername'] = $action['name']; $defaults['headerval'] = $action['value']; $defaults['headerindex'] = $action['index']; $defaults['headerop'] = $action['operator']; if ($action['type'] == 'editheaderrem' && (!empty($defaults['headerindex']) || !empty($defaults['headerval']))) { $display['eheadadv'] = ''; } } elseif ($action['type'] == 'discard' || $action['type'] == 'keep' || $action['type'] == 'stop') { $defaults['method'] = $action['type']; } // hide the "template" row if (!isset($action)) { $actions_table->set_row_attribs(array('style' => 'display: none;')); } // action type select box $select_action = new html_select(array('name' => "_act[]", 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sieverules_action_select(this)')); foreach ($allowed_actions as $value => $text) { $select_action->add($text, $value); } // add action type to UI $actions_table->add('action', $select_action->show($defaults['method'])); // begin vacation action $vacs_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'vacation' ? '' : 'display: none;')); $to_addresses = ""; $vacto_arr = explode(",", $defaults['vacto']); $field_id_vacfrom = 'rcmfd_sievevacfrom_' . $rowid; $field_id_vacto = 'rcmfd_sievevacto_' . $rowid; if (count($this->identities)) { $select_id = new html_select(array('id' => $field_id_vacfrom, 'name' => "_vacfrom[]", 'class' => 'short', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.enable_sig(this);')); if ($this->show_vacfrom && in_array('variables', $ext)) { $select_id->add($this->gettext('autodetect'), "auto"); } elseif (!$this->show_vacfrom) { $select_id->add($this->gettext('autodetect'), ""); } foreach ($this->identities as $sql_arr) { // find currently selected from address if ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == rcmail::Q($sql_arr['from']['string'])) { $defaults['vacfrom'] = $sql_arr['identity_id']; } elseif ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == $sql_arr['from']['mailto']) { $defaults['vacfrom'] = $sql_arr['identity_id']; } $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']); $ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id']; if ($this->force_vacto) { $curaddress = $sql_arr['email']; $defaults['vacto'] .= (!empty($defaults['vacto']) ? ',' : '') . $sql_arr['email']; } else { $curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : ""; } $input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox')); $to_addresses .= $input_address->show($curaddress) . " " . html::label($ffield_id, rcmail::Q($sql_arr['email'])) . "<br />"; } } // deduplicate vacto list $tmparr = explode(",", $defaults['vacto']); $tmparr = array_unique($tmparr); $defaults['vacto'] = implode(",", $tmparr); if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) { $vacfrom_input = $select_id->show($defaults['vacfrom']); $input_vacto = new html_hiddenfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'value' => $defaults['vacto'])); $vacto_input = $to_addresses . $input_vacto->show(); $vac_help = $this->gettext('vactoexp'); } else { $input_vacfrom = new html_inputfield(array('id' => $field_id_vacfrom, 'name' => '_vacfrom[]')); $vacfrom_input = $input_vacfrom->show($defaults['vacfrom']); $input_vacto = new html_inputfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'class' => 'short')); $vacto_input = $input_vacto->show($defaults['vacto']); $vac_help = $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv'); } // from param $vacs_table->set_row_attribs(array('class' => $this->show_vacfrom ? 'advanced' : 'disabled', 'style' => $display['vacfrom'])); $vacs_table->add(null, html::label($field_id_vacfrom, rcmail::Q($this->gettext('from')))); $vacs_table->add(null, $vacfrom_input); $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' ')); $vacs_table->add(null, $sig_button); // to param $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(array('style' => 'vertical-align: top;'), html::label($field_id_vacto, rcmail::Q($this->gettext('sieveto')))); $vacs_table->add(null, $vacto_input); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(array('style' => 'vertical-align: top;'), $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $vac_help); $field_id = 'rcmfd_sievevacperiod_' . $rowid; $input_period = new html_inputfield(array('id' => $field_id, 'name' => '_period[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('period')))); $vacs_table->add(null, $input_period->show($defaults['period'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . (in_array('vacation-seconds', $ext) ? $vacs_table->size() + 1 : $vacs_table->size()) . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); if (in_array('vacation-seconds', $ext)) { $input_periodtype = new html_radiobutton(array('id' => $field_id . '_days', 'name' => '_period_radio_' . $rowid, 'value' => 'days', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show = $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_days', rcmail::Q($this->gettext('days'))); $input_periodtype = new html_radiobutton(array('id' => $field_id . '_seconds', 'name' => '_period_radio_' . $rowid, 'value' => 'seconds', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show .= ' ' . $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_seconds', rcmail::Q($this->gettext('seconds'))); $input_periodtype = new html_hiddenfield(array('id' => 'rcmfd_sievevacperiodtype_' . $rowid, 'name' => '_periodtype[]')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, ' '); $vacs_table->add(null, $period_type_show . $input_periodtype->show($defaults['periodtype'])); $vacs_table->add(null, ' '); } $vacs_table->set_row_attribs(array('style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vacperiodexp')); $field_id = 'rcmfd_sievevachandle_' . $rowid; $input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => $this->show_vachandle ? 'advanced' : 'disabled', 'style' => $display['vachandle'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievevachandle')))); $vacs_table->add(null, $input_handle->show($defaults['handle'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vachandleexp')); $field_id = 'rcmfd_sievevacsubject_' . $rowid; $input_subject = new html_inputfield(array('id' => $field_id, 'name' => '_subject[]')); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('subject')))); $vacs_table->add(array('colspan' => 2), $input_subject->show($defaults['subject'])); if (in_array('variables', $ext)) { $field_id = 'rcmfd_sievevacsubject_orig_' . $rowid; $input_origsubject = new html_checkbox(array('id' => $field_id, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_osubj(this, ' . $rowid . ')', 'class' => 'checkbox')); $input_vacosubj = new html_hiddenfield(array('id' => 'rcmfd_sievevactoh_' . $rowid, 'name' => '_orig_subject[]', 'value' => $defaults['origsubject'])); $vacs_table->add(null, ' '); $vacs_table->add(array('colspan' => 2), $input_origsubject->show($defaults['origsubject']) . " " . html::label($field_id, rcmail::Q($this->gettext('sieveorigsubj'))) . $input_vacosubj->show()); } $field_id = 'rcmfd_sievevacmag_' . $rowid; $input_msg = new html_textarea(array('id' => $field_id, 'name' => '_msg[]', 'rows' => '8', 'cols' => '40', 'class' => $defaults['htmlmsg'] == 1 ? 'mce_editor' : '', 'is_escaped' => $defaults['htmlmsg'] == 1 ? true : null)); $input_html = new html_checkbox(array('id' => 'rcmfd_sievevachtmlcb_' . $rowid, 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_html(this, ' . $rowid . ', \'' . $field_id . '\');', 'value' => '1', 'class' => 'checkbox')); $input_htmlhd = new html_hiddenfield(array('id' => 'rcmfd_sievevachtmlhd_' . $rowid, 'name' => '_htmlmsg[]', 'value' => $defaults['htmlmsg'])); $vacs_table->add('msg', html::label($field_id, rcmail::Q($this->gettext('message')))); $vacs_table->add(array('colspan' => 2), $input_msg->show($defaults['msg']) . html::tag('div', in_array('htmleditor', $rcmail->config->get('dont_override')) ? array('style' => 'display: none;') : null, $input_html->show($defaults['htmlmsg']) . " " . html::label('rcmfd_sievevachtml_' . $rowid, rcmail::Q($this->gettext('htmlmessage')))) . $input_htmlhd->show()); $field_id = 'rcmfd_sievecharset_' . $rowid; $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('charset')))); $vacs_table->add(array('colspan' => 2), $rcmail->output->charset_selector(array('id' => $field_id, 'name' => '_vaccharset[]', 'selected' => $defaults['charset']))); $input_advopts = new html_checkbox(array('id' => 'vadvopts' . $rowid, 'name' => '_vadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $vacs_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('vadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['vacadv'] == '' ? 1 : 0)); // begin notify action $notify_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'notify' || $defaults['method'] == 'enotify' ? '' : 'display: none;')); if (count($this->identities)) { $field_id = 'rcmfd_sievenotifyfrom_' . $rowid; $select_id = new html_select(array('id' => $field_id, 'name' => "_nfrom[]")); $select_id->add($this->gettext('autodetect'), ""); foreach ($this->identities as $sql_arr) { // find currently selected from address if ($defaults['nfrom'] != '' && $defaults['nfrom'] == rcmail::Q($sql_arr['from']['string'])) { $defaults['nfrom'] = $sql_arr['identity_id']; } elseif ($defaults['nfrom'] != '' && $defaults['nfrom'] == $sql_arr['from']['mailto']) { $defaults['nfrom'] = $sql_arr['identity_id']; } $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']); } $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['noteadv'])); $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievefrom')))); $notify_table->add(array('colspan' => 2), $select_id->show($defaults['nfrom'])); } $field_id = 'rcmfd_nmethod_' . $rowid; $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_nmethod[]')); $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('method')))); $notify_table->add(array('colspan' => 2), $input_method->show($defaults['nmethod'])); $field_id = 'rcmfd_noption_' . $rowid; $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_noption[]')); $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('options')))); $notify_table->add(array('colspan' => 2), $input_method->show($defaults['noptions'])); $notify_table->set_row_attribs(array('style' => 'display: none;')); $notify_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('nmethodexp')); $field_id = 'rcmfd_nimpt_' . $rowid; $input_importance = new html_radiobutton(array('id' => $field_id . '_none', 'name' => '_notify_radio_' . $rowid, 'value' => 'none', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio')); $importance_show = $input_importance->show($defaults['nimpt']) . " " . html::label($field_id . '_none', rcmail::Q($this->gettext('importancen'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_1', 'name' => '_notify_radio_' . $rowid, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio')); $importance_show .= ' ' . $input_importance->show($defaults['nimpt']) . " " . html::label($field_id . '_1', rcmail::Q($this->gettext('importance1'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_2', 'name' => '_notify_radio_' . $rowid, 'value' => '2', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio')); $importance_show .= ' ' . $input_importance->show($defaults['nimpt']) . " " . html::label($field_id . '_2', rcmail::Q($this->gettext('importance2'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_3', 'name' => '_notify_radio_' . $rowid, 'value' => '3', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'class' => 'radio')); $importance_show .= ' ' . $input_importance->show($defaults['nimpt']) . " " . html::label($field_id . '_3', rcmail::Q($this->gettext('importance3'))); $input_importance = new html_hiddenfield(array('id' => 'rcmfd_sievenimpt_' . $rowid, 'name' => '_nimpt[]')); $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['noteadv'])); $notify_table->add(null, rcmail::Q($this->gettext('flag'))); $notify_table->add(array('colspan' => 2), $importance_show . $input_importance->show($defaults['nimpt'])); $field_id = 'rcmfd_nmsg_' . $rowid; $input_msg = new html_inputfield(array('id' => $field_id, 'name' => '_nmsg[]')); $notify_table->add(null, html::label($field_id, rcmail::Q($this->gettext('message')))); $notify_table->add(array('colspan' => 2), $input_msg->show($defaults['nmsg'])); if (in_array('enotify', $ext)) { $input_advopts = new html_checkbox(array('id' => 'nadvopts' . $rowid, 'name' => '_nadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $notify_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('nadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['noteadv'] == '' ? 1 : 0)); } // begin editheader action $headers_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 2, 'style' => $defaults['method'] == 'editheaderadd' || $defaults['method'] == 'editheaderrem' ? '' : 'display: none;')); $field_id = 'rcmfd_eheadname_' . $rowid; $input_header = new html_inputfield(array('id' => $field_id, 'name' => '_eheadname[]')); $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headername')))); $headers_table->add(null, $input_header->show($defaults['headername'])); $field_id = 'rcmfd_eheadindex_' . $rowid; $select_index = new html_select(array('id' => $field_id, 'name' => "_eheadindex[]")); $select_index->add($this->gettext('headerdelall'), ""); $select_index->add("1", "1"); $select_index->add("2", "2"); $select_index->add("3", "3"); $select_index->add("4", "4"); $select_index->add("5", "5"); $select_index->add($this->gettext('last'), "last"); $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv'])); $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headerindex')))); $headers_table->add(null, $select_index->show($defaults['headerindex'])); $field_id = 'rcmfd_eheadopp_' . $rowid; $select_match = new html_select(array('id' => $field_id, 'name' => "_eheadopp[]")); $select_match->add($this->gettext('filteris'), ""); $select_match->add($this->gettext('filtercontains'), "contains"); $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv'])); $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('operator')))); $headers_table->add(null, $select_match->show($defaults['headerop'])); $field_id = 'rcmfd_eheadval_' . $rowid; $input_header = new html_inputfield(array('id' => $field_id, 'name' => '_eheadval[]')); if ($defaults['method'] == 'editheaderrem') { $headers_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['eheadadv'])); } $headers_table->add(null, html::label($field_id, rcmail::Q($this->gettext('headervalue')))); $headers_table->add(null, $input_header->show($defaults['headerval'])); if ($defaults['method'] == 'editheaderrem') { $headers_table->set_row_attribs(array('style' => 'display: none;')); } $field_id = 'rcmfd_eheadaddlast_' . $rowid; $input_index = new html_checkbox(array('id' => $field_id, 'value' => 'last', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_eheadlast(this);', 'name' => '_eheadaddlast[]', 'class' => 'checkbox')); $headers_table->add(null, ' '); $headers_table->add(null, $input_index->show($defaults['headerindex']) . " " . html::label($field_id, rcmail::Q($this->gettext('headerappend')))); if ($defaults['method'] == 'editheaderadd') { $headers_table->set_row_attribs(array('style' => 'display: none;')); } $input_advopts = new html_checkbox(array('id' => 'hadvopts' . $rowid, 'name' => '_hadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $headers_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('nadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['eheadadv'] == '' ? 1 : 0)); // begin fileinto action $mbox_name = $rcmail->storage->get_folder(); $input_folderlist = new html_select(array('name' => '_folder[]', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sieverules_select_folder(this);', 'style' => $defaults['method'] == 'fileinto' || $defaults['method'] == 'fileinto_copy' ? '' : 'display: none;', 'is_escaped' => true)); $rcmail->render_folder_tree_select($this->mailboxes, $mbox_name, 100, $input_folderlist, false); $show_customfolder = 'display: none;'; if ($rcmail->config->get('sieverules_fileinto_options', 0) == 2 && !$rcmail->storage->folder_exists($defaults['folder'])) { $customfolder = rcube_charset::convert($rcmail->storage->mod_folder($defaults['folder']), 'UTF7-IMAP'); $defaults['folder'] = '@@newfolder'; $show_customfolder = ''; } $input_customfolder = new html_inputfield(array('name' => '_customfolder[]')); $otherfolders = html::span(array('id' => 'customfolder_rowid', 'style' => $show_customfolder), '<br />' . $input_customfolder->show($customfolder)); // begin redirect action $input_address = new html_inputfield(array('name' => '_redirect[]', 'style' => $defaults['method'] == 'redirect' || $defaults['method'] == 'redirect_copy' ? '' : 'display: none;')); // begin reject action $input_reject = new html_textarea(array('name' => '_reject[]', 'rows' => '5', 'cols' => '40', 'style' => $defaults['method'] == 'reject' || $defaults['method'] == 'ereject' ? '' : 'display: none;')); // begin imapflags action $input_imapflags = new html_select(array('name' => '_imapflags[]', 'style' => $defaults['method'] == 'imapflags' || $defaults['method'] == 'imap4flags' ? '' : 'display: none;')); foreach ($this->flags as $name => $val) { $input_imapflags->add($this->gettext($name), $val); } // add actions to UI $actions_table->add('folder', $input_folderlist->show($defaults['folder']) . $otherfolders . $input_address->show($defaults['address']) . $vacs_table->show() . $notify_table->show() . $input_imapflags->show($defaults['flags']) . $input_reject->show($defaults['reject']) . $headers_table->show()); // add add/delete buttons to UI (if enabled) $add_button = $this->api->output->button(array('command' => 'plugin.sieverules.add_action', 'type' => 'link', 'class' => 'add', 'title' => 'sieverules.addsieveact', 'content' => ' ')); $delete_button = $this->api->output->button(array('command' => 'plugin.sieverules.del_action', 'type' => 'link', 'class' => 'delete', 'classact' => 'delete_act', 'title' => 'sieverules.deletesieveact', 'content' => ' ')); if ($rcmail->config->get('sieverules_multiple_actions')) { $actions_table->add('control', $add_button . $delete_button); } else { $actions_table->add('control', " "); } return $actions_table; }
private function _action_row($ext, $actions_table, $rowid, $action, $attrib, $example) { $rcmail = rcmail::get_instance(); static $a_mailboxes; $imgclass = null; if (!isset($action)) { $actions_table->set_row_attribs(array('style' => 'display: none;')); $imgclass = 'nohtc'; } $help_icon = html::img(array('src' => $attrib['helpicon'], 'alt' => $this->gettext('messagehelp'), 'border' => 0)); $vacadvstyle = $action['type'] != 'vacation' && $this->force_vacto ? '' : 'display: none;'; $vacadvstyle_from = $this->show_vacfrom ? $vacadvstyle : 'display: none;'; $vacadvstyle_handle = $this->show_vachandle ? $vacadvstyle : 'display: none;'; $vacadvclass_from = $this->show_vacfrom ? 'advanced' : 'disabled'; $vacadvclass_handle = $this->show_vachandle ? 'advanced' : 'disabled'; $vacshowadv = $action['type'] != 'vacation' && $this->force_vacto ? '1' : ''; $noteadvstyle = 'display: none;'; $noteshowadv = ''; // setup allowed actions $allowed_actions = array(); $config_actions = $rcmail->config->get('sieverules_allowed_actions', array()); if (in_array('fileinto', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) { $allowed_actions['fileinto'] = $this->gettext('messagemoveto'); } if (in_array('fileinto', $ext) && in_array('copy', $ext) && ($config_actions['fileinto'] || $action['type'] == 'fileinto')) { $allowed_actions['fileinto_copy'] = $this->gettext('messagecopyto'); } if (in_array('vacation', $ext) && ($config_actions['vacation'] || $action['type'] == 'vacation')) { $allowed_actions['vacation'] = $this->gettext('messagevacation'); } if (in_array('reject', $ext) && ($config_actions['reject'] || $action['type'] == 'reject')) { $allowed_actions['reject'] = $this->gettext('messagereject'); } elseif (in_array('ereject', $ext) && ($config_actions['reject'] || $action['type'] == 'ereject')) { $allowed_actions['ereject'] = $this->gettext('messagereject'); } if (in_array('imapflags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imapflags')) { $allowed_actions['imapflags'] = $this->gettext('messageimapflags'); } elseif (in_array('imap4flags', $ext) && ($config_actions['imapflags'] || $action['type'] == 'imap4flags')) { $allowed_actions['imap4flags'] = $this->gettext('messageimapflags'); } if (in_array('notify', $ext) && ($config_actions['notify'] || $action['type'] == 'notify')) { $allowed_actions['notify'] = $this->gettext('messagenotify'); } elseif (in_array('enotify', $ext) && ($config_actions['notify'] || $action['type'] == 'enotify')) { $allowed_actions['enotify'] = $this->gettext('messagenotify'); } if ($config_actions['redirect'] || $action['type'] == 'redirect') { $allowed_actions['redirect'] = $this->gettext('messageredirect'); } if (in_array('copy', $ext) && ($config_actions['redirect'] || $action['type'] == 'redirect_copy')) { $allowed_actions['redirect_copy'] = $this->gettext('messageredirectcopy'); } if ($config_actions['keep'] || $action['type'] == 'keep') { $allowed_actions['keep'] = $this->gettext('messagekeep'); } if ($config_actions['discard'] || $action['type'] == 'discard') { $allowed_actions['discard'] = $this->gettext('messagediscard'); } if ($config_actions['stop'] || $action['type'] == 'stop') { $allowed_actions['stop'] = $this->gettext('messagestop'); } // set the default action reset($allowed_actions); $method = key($allowed_actions); $folder = 'INBOX'; $reject = ''; $identity = $rcmail->user->get_identity(); if ($this->show_vacfrom) { $vacfrom = in_array('variables', $ext) ? 'auto' : $identity['email']; } else { $vacfrom = null; } $vacto = null; $address = ''; $days = ''; $handle = ''; $subject = ''; $origsubject = ''; $msg = ''; $charset = RCMAIL_CHARSET; $flags = ''; $nfrom = ''; $nimpt = ''; $nmethod = ''; $noptions = ''; $nmsg = ''; if ($action['type'] == 'fileinto' || $action['type'] == 'fileinto_copy') { $method = $action['type']; $folder = $rcmail->config->get('sieverules_include_imap_root', true) ? $action['target'] : $rcmail->imap->mod_mailbox($action['target']); if ($rcmail->config->get('sieverules_folder_delimiter', false)) { $folder = str_replace($rcmail->imap->get_hierarchy_delimiter(), $rcmail->config->get('sieverules_folder_delimiter'), $folder); } } elseif ($action['type'] == 'reject' || $action['type'] == 'ereject') { $method = $action['type']; $reject = htmlspecialchars($action['target']); } elseif ($action['type'] == 'vacation') { $method = 'vacation'; $days = $action['days']; $vacfrom_default = $vacfrom; $vacfrom = $action['from']; $vacto = $action['addresses']; $handle = htmlspecialchars($action['handle']); $subject = htmlspecialchars($action['subject']); $origsubject = $action['origsubject']; $msg = $action['msg']; $htmlmsg = $action['htmlmsg'] ? '1' : ''; $charset = $action['charset']; if (!$example) { $this->force_vacto = false; } // check advanced enabled if (!empty($vacfrom) && $vacfrom != $vacfrom_default || !empty($vacto) || !empty($handle) || $charset != RCMAIL_CHARSET || $this->force_vacto) { $vacadvstyle = ''; $vacadvstyle_from = $this->show_vacfrom ? '' : 'display: none;'; $vacadvstyle_handle = $this->show_vachandle ? '' : 'display: none;'; $vacshowadv = '1'; } } elseif ($action['type'] == 'redirect' || $action['type'] == 'redirect_copy') { $method = $action['type']; $address = $action['target']; } elseif ($action['type'] == 'imapflags' || $action['type'] == 'imap4flags') { $method = $action['type']; $flags = $action['target']; } elseif ($action['type'] == 'notify' || $action['type'] == 'enotify') { $method = $action['type']; $nfrom = htmlspecialchars($action['from']); $nimpt = htmlspecialchars($action['importance']); $nmethod = $action['method']; $noptions = $action['options']; $nmsg = $action['msg']; // check advanced enabled if (!empty($nfrom) || !empty($nimpt)) { $noteadvstyle = ''; $noteshowadv = '1'; } } elseif ($action['type'] == 'discard' || $action['type'] == 'keep' || $action['type'] == 'stop') { $method = $action['type']; } $select_action = new html_select(array('name' => "_act[]", 'onchange' => JS_OBJECT_NAME . '.sieverules_action_select(this)')); foreach ($allowed_actions as $value => $text) { $select_action->add(Q($text), $value); } $actions_table->add('action', $select_action->show($method)); $vacs_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $method == 'vacation' ? '' : 'display: none;')); $to_addresses = ""; $vacto_arr = explode(",", $vacto); $user_identities = $rcmail->user->list_identities(); if (count($user_identities)) { $field_id = 'rcmfd_sievevacfrom_' . $rowid; $select_id = new html_select(array('id' => $field_id, 'name' => "_vacfrom[]", 'class' => 'short', 'onchange' => JS_OBJECT_NAME . '.enable_sig(this);')); if ($this->show_vacfrom && in_array('variables', $ext)) { $select_id->add(Q($this->gettext('autodetect')), "auto"); } elseif (!$this->show_vacfrom) { $select_id->add(Q($this->gettext('autodetect')), ""); } foreach ($user_identities as $sql_arr) { $select_id->add($sql_arr['email'], $sql_arr['email']); $ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id']; if ($this->force_vacto) { $curaddress = $sql_arr['email']; $vacto .= (!empty($vacto) ? ',' : '') . $sql_arr['email']; } else { $curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : ""; } $input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox')); $to_addresses .= $input_address->show($curaddress) . " " . html::label($ffield_id, Q($sql_arr['email'])) . "<br />"; } } if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) { $vacs_table->set_row_attribs(array('class' => $vacadvclass_from, 'style' => $vacadvstyle_from)); $vacs_table->add(null, html::label($field_id, Q($this->gettext('from')))); $vacs_table->add(null, $select_id->show($vacfrom)); $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' ')); $vacs_table->add(null, $sig_button); $field_id = 'rcmfd_sievevacto_' . $rowid; $input_vacto = new html_hiddenfield(array('id' => $field_id, 'name' => '_vacto[]', 'value' => $vacto)); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $vacadvstyle)); $vacs_table->add(array('style' => 'vertical-align: top;'), Q($this->gettext('sieveto'))); $vacs_table->add(null, $to_addresses . $input_vacto->show()); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(array('style' => 'vertical-align: top;'), $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vactoexp')); $vacs_table->add_row(); } else { $field_id = 'rcmfd_sievevacfrom_' . $rowid; $input_vacfrom = new html_inputfield(array('id' => $field_id, 'name' => '_vacfrom[]')); $vacs_table->set_row_attribs(array('class' => $vacadvclass_from, 'style' => $vacadvstyle_from)); $vacs_table->add(null, html::label($field_id, Q($this->gettext('from')))); $vacs_table->add(null, $input_vacfrom->show($vacfrom)); $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' ')); $vacs_table->add(null, $sig_button); $field_id = 'rcmfd_sievevacto_' . $rowid; $input_vacto = new html_inputfield(array('id' => $field_id, 'name' => '_vacto[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $vacadvstyle)); $vacs_table->add(null, html::label($field_id, Q($this->gettext('sieveto')))); $vacs_table->add(null, $input_vacto->show($vacto)); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv')); $vacs_table->add_row(); } $field_id = 'rcmfd_sievevacdays_' . $rowid; $input_day = new html_inputfield(array('id' => $field_id, 'name' => '_day[]', 'class' => 'short')); $vacs_table->add(null, html::label($field_id, Q($this->gettext('days')))); $vacs_table->add(null, $input_day->show($days)); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vacdaysexp')); $vacs_table->add_row(); $field_id = 'rcmfd_sievevachandle_' . $rowid; $input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => $vacadvclass_handle, 'style' => $vacadvstyle_handle)); $vacs_table->add(null, html::label($field_id, Q($this->gettext('sievevachandle')))); $vacs_table->add(null, $input_handle->show($handle)); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('vachandleexp')); $vacs_table->add_row(); $field_id = 'rcmfd_sievevacsubject_' . $rowid; $input_subject = new html_inputfield(array('id' => $field_id, 'name' => '_subject[]')); $vacs_table->add(null, html::label($field_id, Q($this->gettext('subject')))); $vacs_table->add(array('colspan' => 2), $input_subject->show($subject)); $vacs_table->add_row(); if (in_array('variables', $ext)) { $field_id = 'rcmfd_sievevacsubject_orig_' . $rowid; $input_origsubject = new html_checkbox(array('id' => $field_id, 'value' => '1', 'onclick' => JS_OBJECT_NAME . '.sieverules_toggle_vac_osubj(this, ' . $rowid . ')', 'class' => 'checkbox')); $input_vacosubj = new html_hiddenfield(array('id' => 'rcmfd_sievevactoh_' . $rowid, 'name' => '_orig_subject[]', 'value' => $origsubject)); $vacs_table->add(null, ' '); $vacs_table->add(array('colspan' => 2), $input_origsubject->show($origsubject) . " " . html::label($field_id, Q($this->gettext('sieveorigsubj'))) . $input_vacosubj->show()); $vacs_table->add_row(); } $field_id = 'rcmfd_sievevacmag_' . $rowid; $input_msg = new html_textarea(array('id' => $field_id, 'name' => '_msg[]', 'rows' => '8', 'cols' => '40', 'class' => $htmlmsg == 1 ? 'mce_editor' : '')); $input_html = new html_checkbox(array('onclick' => JS_OBJECT_NAME . '.sieverules_toggle_vac_html(this, ' . $rowid . ', \'' . $field_id . '\');', 'value' => '1', 'class' => 'checkbox')); $input_htmlhd = new html_hiddenfield(array('id' => 'rcmfd_sievevachtmlhd_' . $rowid, 'name' => '_htmlmsg[]', 'value' => $htmlmsg)); $vacs_table->add('msg', html::label($field_id, Q($this->gettext('message')))); $vacs_table->add(array('colspan' => 2), $input_msg->show($msg) . html::tag('div', null, $input_html->show($htmlmsg) . " " . html::label('rcmfd_sievevachtml_' . $rowid, Q($this->gettext('htmlmessage'))) . $input_htmlhd->show())); $vacs_table->add_row(); $field_id = 'rcmfd_sievecharset_' . $rowid; $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $vacadvstyle)); $vacs_table->add(null, html::label($field_id, Q($this->gettext('charset')))); $vacs_table->add(array('colspan' => 2), $this->_charset_selector(array('id' => $field_id, 'name' => '_charset[]'), $charset)); $vacs_table->add_row(); $input_advopts = new html_checkbox(array('id' => 'vadvopts' . $rowid, 'name' => '_vadv_opts[]', 'onclick' => JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $vacs_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('vadvopts' . $rowid, Q($this->gettext('advancedoptions'))) . $input_advopts->show($vacshowadv)); $notify_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $method == 'notify' || $method == 'enotify' ? '' : 'display: none;')); $user_identities = $rcmail->user->list_identities(); if (count($user_identities)) { $field_id = 'rcmfd_sievenotifyfrom_' . $rowid; $select_id = new html_select(array('id' => $field_id, 'name' => "_nfrom[]")); $select_id->add(Q($this->gettext('autodetect')), ""); foreach ($user_identities as $sql_arr) { $select_id->add($sql_arr['email'], $sql_arr['email']); } $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $noteadvstyle)); $notify_table->add(null, html::label($field_id, Q($this->gettext('sievefrom')))); $notify_table->add(array('colspan' => 2), $select_id->show($nfrom)); $notify_table->add_row(); } $field_id = 'rcmfd_nmethod_' . $rowid; $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_nmethod[]')); $notify_table->add(null, html::label($field_id, Q($this->gettext('method')))); $notify_table->add(array('colspan' => 2), $input_method->show($nmethod)); $notify_table->add_row(); $field_id = 'rcmfd_noption_' . $rowid; $input_method = new html_inputfield(array('id' => $field_id, 'name' => '_noption[]')); $notify_table->add(null, html::label($field_id, Q($this->gettext('options')))); $notify_table->add(array('colspan' => 2), $input_method->show($noptions)); $notify_table->add_row(); $notify_table->set_row_attribs(array('style' => 'display: none;')); $notify_table->add(array('colspan' => 3, 'class' => 'vacdaysexp'), $this->gettext('nmethodexp')); $notify_table->add_row(); $field_id = 'rcmfd_nimpt_' . $rowid; $input_importance = new html_radiobutton(array('id' => $field_id . '_none', 'name' => '_notify_radio_' . $rowid, 'value' => 'none', 'onclick' => JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'style' => 'width:15px;')); $importance_show = $input_importance->show($nimpt) . " " . html::label($field_id . '_none', Q($this->gettext('importancen'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_1', 'name' => '_notify_radio_' . $rowid, 'value' => '1', 'onclick' => JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'style' => 'width:15px;')); $importance_show .= ' ' . $input_importance->show($nimpt) . " " . html::label($field_id . '_1', Q($this->gettext('importance1'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_2', 'name' => '_notify_radio_' . $rowid, 'value' => '2', 'onclick' => JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'style' => 'width:15px;')); $importance_show .= ' ' . $input_importance->show($nimpt) . " " . html::label($field_id . '_2', Q($this->gettext('importance2'))); $input_importance = new html_radiobutton(array('id' => $field_id . '_3', 'name' => '_notify_radio_' . $rowid, 'value' => '3', 'onclick' => JS_OBJECT_NAME . '.sieverules_notify_impt(this, ' . $rowid . ')', 'style' => 'width:15px;')); $importance_show .= ' ' . $input_importance->show($nimpt) . " " . html::label($field_id . '_3', Q($this->gettext('importance3'))); $input_importance = new html_hiddenfield(array('id' => 'rcmfd_sievenimpt_' . $rowid, 'name' => '_nimpt[]')); $notify_table->set_row_attribs(array('class' => 'advanced', 'style' => $noteadvstyle)); $notify_table->add(null, Q($this->gettext('flag'))); $notify_table->add(array('colspan' => 2), $importance_show . $input_importance->show($nimpt)); $notify_table->add_row(); $field_id = 'rcmfd_nmsg_' . $rowid; $input_msg = new html_inputfield(array('id' => $field_id, 'name' => '_nmsg[]')); $notify_table->add(null, html::label($field_id, Q($this->gettext('message')))); $notify_table->add(array('colspan' => 2), $input_msg->show($nmsg)); $notify_table->add_row(); if (in_array('enotify', $ext)) { $input_advopts = new html_checkbox(array('id' => 'nadvopts' . $rowid, 'name' => '_nadv_opts[]', 'onclick' => JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'style' => 'width:15px;')); $notify_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('nadvopts' . $rowid, Q($this->gettext('advancedoptions'))) . $input_advopts->show($noteshowadv)); } // get mailbox list $mbox_name = $rcmail->imap->get_mailbox_name(); // build the folders tree if (empty($a_mailboxes)) { // get mailbox list if ($rcmail->config->get('sieverules_fileinto_options', 0) > 0) { $a_folders = $rcmail->imap->list_unsubscribed(); } else { $a_folders = $rcmail->imap->list_mailboxes(); } $delimiter = $rcmail->imap->get_hierarchy_delimiter(); $a_mailboxes = array(); foreach ($a_folders as $ifolder) { if ($rcmail->config->get('sieverules_folder_encoding')) { $ifolder = $this->_mbox_encode($ifolder, $rcmail->config->get('sieverules_folder_encoding')); } if ($rcmail->config->get('sieverules_folder_delimiter', false)) { rcmail_build_folder_tree($a_mailboxes, str_replace($delimiter, $rcmail->config->get('sieverules_folder_delimiter'), $ifolder), $rcmail->config->get('sieverules_folder_delimiter')); } else { rcmail_build_folder_tree($a_mailboxes, $ifolder, $delimiter); } } if ($rcmail->config->get('sieverules_fileinto_options', 0) == 2 && in_array('mailbox', $ext)) { array_push($a_mailboxes, array('id' => '@@newfolder', 'name' => $this->gettext('createfolder'), 'virtual' => '', 'folders' => array())); } } $input_folderlist = new html_select(array('name' => '_folder[]', 'onchange' => JS_OBJECT_NAME . '.sieverules_select_folder(this);', 'style' => $method == 'fileinto' || $method == 'fileinto_copy' ? '' : 'display: none;')); rcmail_render_folder_tree_select($a_mailboxes, $mbox_name, 100, $input_folderlist, false); $show_customfolder = 'display: none;'; if ($rcmail->config->get('sieverules_fileinto_options', 0) == 2 && !$rcmail->imap->mailbox_exists($folder)) { $customfolder = $rcmail->imap->mod_mailbox($folder); $folder = '@@newfolder'; $show_customfolder = ''; } $input_customfolder = new html_inputfield(array('name' => '_customfolder[]')); $otherfolders = html::span(array('id' => 'customfolder_rowid', 'style' => $show_customfolder), '<br />' . $input_customfolder->show($customfolder)); $input_address = new html_inputfield(array('name' => '_redirect[]', 'style' => $method == 'redirect' || $method == 'redirect_copy' ? '' : 'display: none;')); $input_reject = new html_textarea(array('name' => '_reject[]', 'rows' => '5', 'cols' => '40', 'style' => $method == 'reject' || $method == 'ereject' ? '' : 'display: none;')); $input_imapflags = new html_select(array('name' => '_imapflags[]', 'style' => $method == 'imapflags' || $method == 'imap4flags' ? '' : 'display: none;')); foreach ($this->flags as $name => $val) { $input_imapflags->add(Q($this->gettext($name)), Q($val)); } $actions_table->add('folder', $input_folderlist->show($folder) . $otherfolders . $input_address->show($address) . $vacs_table->show() . $notify_table->show() . $input_imapflags->show($flags) . $input_reject->show($reject)); $add_button = $this->api->output->button(array('command' => 'plugin.sieverules.add_action', 'type' => 'link', 'class' => 'add', 'title' => 'sieverules.addsieveact', 'content' => ' ')); $delete_button = $this->api->output->button(array('command' => 'plugin.sieverules.del_action', 'type' => 'link', 'class' => 'delete', 'classact' => 'delete_act', 'title' => 'sieverules.deletesieveact', 'content' => ' ')); if ($rcmail->config->get('sieverules_multiple_actions')) { $actions_table->add('control', $delete_button . $add_button); } else { $actions_table->add('control', " "); } return $actions_table; }
function filterset_editraw($attrib) { $script_name = isset($_GET['_set']) ? $_GET['_set'] : $_POST['_set']; $script = $this->sieve->get_script($script_name); $script_post = $_POST['rawsetcontent']; $out = '<form name="filtersetrawform" action="./" method="post" enctype="multipart/form-data">' . "\n"; $hiddenfields = new html_hiddenfield(); $hiddenfields->add(array('name' => '_task', 'value' => $this->rc->task)); $hiddenfields->add(array('name' => '_action', 'value' => 'plugin.managesieve-saveraw')); $hiddenfields->add(array('name' => '_set', 'value' => $script_name)); $hiddenfields->add(array('name' => '_seteditraw', 'value' => 1)); $hiddenfields->add(array('name' => '_framed', 'value' => $_POST['_framed'] || $_GET['_framed'] ? 1 : 0)); $out .= $hiddenfields->show(); $txtarea = new html_textarea(array('id' => 'rawfiltersettxt', 'name' => 'rawsetcontent', 'rows' => '15')); $out .= $txtarea->show($script_post !== null ? $script_post : ($script !== false ? rtrim($script) : '')); $this->rc->output->add_gui_object('sievesetrawform', 'filtersetrawform'); $this->plugin->include_stylesheet('codemirror/lib/codemirror.css'); $this->plugin->include_script('codemirror/lib/codemirror.js'); $this->plugin->include_script('codemirror/addon/selection/active-line.js'); $this->plugin->include_script('codemirror/mode/sieve/sieve.js'); if ($script === false) { $this->rc->output->show_message('managesieve.filterunknownerror', 'error'); } return $out; }
function gen_form() { try { $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass')); $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username'])); $this->soap->logout($session_id); } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $mail_user[0]['autoresponder']; if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } if ($mail_user[0]['autoresponder_start_date'] == '0000-00-00 00:00:00') { $dt = new DateTime('@' . time()); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_start_date'] = $dt->format('Y-m-d H:i'); } else { $mail_user[0]['autoresponder_start_date'] = strtotime($mail_user[0]['autoresponder_start_date']); $dt = new DateTime('@' . $mail_user[0]['autoresponder_start_date']); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_start_date'] = $dt->format('Y-m-d H:i'); } if ($mail_user[0]['autoresponder_end_date'] == '0000-00-00 00:00:00') { $dt = new DateTime('@' . (time() + 86400)); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_end_date'] = $dt->format('Y-m-d H:i'); } else { $mail_user[0]['autoresponder_end_date'] = strtotime($mail_user[0]['autoresponder_end_date']); $dt = new DateTime('@' . $mail_user[0]['autoresponder_end_date']); $dt->setTimeZone(new DateTimeZone($this->rcmail_inst->config->get('timezone'))); $mail_user[0]['autoresponder_end_date'] = $dt->format('Y-m-d H:i'); } $this->rcmail_inst->output->set_env('framed', true); $out = '<fieldset><legend>' . $this->gettext('acc_autoreply') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_autoreplysubject = new html_inputfield(array('name' => '_autoreplysubject', 'id' => 'autoreplysubject', 'size' => 40)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('subject'))); $table->add('', $input_autoreplysubject->show($mail_user[0]['autoresponder_subject'])); $input_autoreplybody = new html_textarea(array('name' => '_autoreplybody', 'id' => 'autoreplybody', 'cols' => 48, 'rows' => 15)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplymessage'))); $table->add('', $input_autoreplybody->show($mail_user[0]['autoresponder_text'])); $input_autoreplystarton = new html_inputfield(array('name' => '_autoreplystarton', 'id' => 'autoreplystarton', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplystarton'))); $table->add('', $input_autoreplystarton->show($mail_user[0]['autoresponder_start_date'])); $input_autoreplyendby = new html_inputfield(array('name' => '_autoreplyendby', 'id' => 'autoreplyendby', 'size' => 20)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplyendby'))); $table->add('', $input_autoreplyendby->show($mail_user[0]['autoresponder_end_date'])); $input_autoreplyenabled = new html_checkbox(array('name' => '_autoreplyenabled', 'id' => 'autoreplyenabled', 'value' => 1)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('autoreplyenabled'))); $table->add('', $input_autoreplyenabled->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
/** * Hook: prepare the new sections HTML for the settings page. */ function user_preferences($args) { $RCMAIL = rcmail::get_instance(); if ($args['section'] == 'vacation' && $RCMAIL->config->get('qmailadmin_allow_vacation')) { $config = $RCMAIL->config->all(); $blocks = array('main' => array('name' => Q(rcube_label('mainoptions')))); // Vacation enabled? $field_id = 'vacation_enabled'; $input_vacation_enabled = new html_checkbox(array('name' => '_vacation_enabled', 'id' => $field_id, 'value' => 1)); $blocks['main']['options']['vacation_enabled'] = array('title' => html::label($field_id, rcube::Q($this->gettext('autoresponderenabled'))), 'content' => $input_vacation_enabled->show($config['vacation_enabled'] ? 1 : 0)); // Vacation message subject $field_id = 'vacation_subject'; $input_vacation_subject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => '80')); $blocks['main']['options']['vacation_subject'] = array('title' => html::label($field_id, rcube::Q($this->gettext('subject'))), 'content' => $input_vacation_subject->show($config['vacation_subject'])); // Vacation message $field_id = 'vacation_message'; $input_vacation_message = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'cols' => 80, 'rows' => 15)); $blocks['main']['options']['vacation_message'] = array('title' => html::label($field_id, rcube::Q($this->gettext('message'))), 'content' => $input_vacation_message->show($config['vacation_message'])); $args['blocks'] = $blocks; } else { if ($args['section'] == 'password' && $RCMAIL->config->get('qmailadmin_allow_password')) { $blocks = array('main' => array('name' => Q(rcube_label('mainoptions'))), 'explanation' => array('name' => Q($this->gettext('qmail_password_explanation')))); // Old password $field_id = 'password_old'; $input_password_old = new html_passwordfield(array('name' => '_password_old', 'id' => $field_id, 'size' => '20')); $blocks['main']['options']['password_old'] = array('title' => html::label($field_id, rcube::Q($this->gettext('oldpassword'))), 'content' => $input_password_old->show()); // New password 1 $field_id = 'password_new1'; $input_password_new1 = new html_passwordfield(array('name' => '_password_new1', 'id' => $field_id, 'size' => '20')); $blocks['main']['options']['password_new1'] = array('title' => html::label($field_id, rcube::Q($this->gettext('newpassword'))), 'content' => $input_password_new1->show()); // New password 2 $field_id = 'password_new2'; $input_password_new2 = new html_passwordfield(array('name' => '_password_new2', 'id' => $field_id, 'size' => '20')); $blocks['main']['options']['password_new2'] = array('title' => html::label($field_id, rcube::Q($this->gettext('newpassword2'))), 'content' => $input_password_new2->show()); // Password requisites explanation $blocks['explanation']['options']['password_explanation1'] = array('title' => html::label('password_explanation1', rcube::Q($this->gettext('password_explanation1a')) . ' ' . $RCMAIL->config->get('qmailadmin_password_min_length') . ' ' . rcube::Q($this->gettext('password_explanation1b')) . ' ' . $RCMAIL->config->get('qmailadmin_password_max_length') . ' ' . rcube::Q($this->gettext('password_explanation1c') . '. ')), 'content' => ''); if ($RCMAIL->config->get('qmailadmin_password_lower_need') || $RCMAIL->config->get('qmailadmin_password_upper_need') || $RCMAIL->config->get('qmailadmin_password_number_need') || $RCMAIL->config->get('qmailadmin_password_special_need')) { $blocks['explanation']['options']['password_explanation2'] = array('title' => html::label('password_explanation2', rcube::Q($this->gettext('password_explanation2'))), 'content' => ''); } if (!$RCMAIL->config->get('qmailadmin_password_lower_need') && !$RCMAIL->config->get('qmailadmin_password_upper_need')) { $blocks['explanation']['options']['password_explanation3'] = array('title' => html::label('password_explanation3', '* ' . rcube::Q($this->gettext('password_explanation3')) . '; '), 'content' => ''); } if ($RCMAIL->config->get('qmailadmin_password_lower_need')) { $blocks['explanation']['options']['password_explanation4'] = array('title' => html::label('password_explanation4', '* ' . rcube::Q($this->gettext('password_explanation4')) . '; '), 'content' => ''); } if ($RCMAIL->config->get('qmailadmin_password_upper_need')) { $blocks['explanation']['options']['password_explanation5'] = array('title' => html::label('password_explanation5', '* ' . rcube::Q($this->gettext('password_explanation5')) . '; '), 'content' => ''); } if ($RCMAIL->config->get('qmailadmin_password_number_need')) { $blocks['explanation']['options']['password_explanation6'] = array('title' => html::label('password_explanation6', '* ' . rcube::Q($this->gettext('password_explanation6')) . '; '), 'content' => ''); } if ($RCMAIL->config->get('qmailadmin_password_special_need')) { $blocks['explanation']['options']['password_explanation7'] = array('title' => html::label('password_explanation7', '* ' . rcube::Q($this->gettext('password_explanation7')) . ' "' . $RCMAIL->config->get('qmailadmin_password_special_chars') . '"; '), 'content' => ''); } $args['blocks'] = $blocks; } } return $args; }
if ($RCI->save_configfile($_SESSION['config'])) { echo '<p class="notice">The config file was saved successfully into <tt>' . RCMAIL_CONFIG_DIR . '</tt> directory of your Roundcube installation.'; if ($RCI->legacy_config) { echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.'; } echo '</p>'; } else { echo '<p class="notice">Copy or download the following configuration and save it'; echo ' as <tt><b>config.inc.php</b></tt> within the <tt>' . RCUBE_CONFIG_DIR . '</tt> directory of your Roundcube installation.<br/>'; echo ' Make sure that there are no characters outside the <tt><?php ?></tt> brackets when saving the file.'; echo ' <input type="button" onclick="location.href=\'index.php?_getconfig=1\'" value="Download" />'; if ($RCI->legacy_config) { echo '<br/><br/>Afterwards, please <b>remove</b> the old configuration files <tt>main.inc.php</tt> and <tt>db.inc.php</tt> from the config directory.'; } echo '</p>'; $textbox = new html_textarea(array('rows' => 16, 'cols' => 60, 'class' => "configfile")); echo $textbox->show($_SESSION['config']); } echo '<p class="hint">Of course there are more options to configure. Have a look at the defaults.inc.php file or visit <a href="http://trac.roundcube.net/wiki/Howto_Config" target="_blank">Howto_Config</a> to find out.</p>'; echo '<p><input type="button" onclick="location.href=\'./index.php?_step=3\'" value="CONTINUE" /></p>'; // echo '<style type="text/css"> .configblock { display:none } </style>'; echo "\n<hr style='margin-bottom:1.6em' />\n"; } ?> <fieldset> <legend>General configuration</legend> <dl class="configblock"> <dt class="propname">product_name</dt> <dd>
/** * Independent vacation form */ public function vacation_form($attrib) { // check supported extensions $date_extension = in_array('date', $this->exts); $seconds_extension = in_array('vacation-seconds', $this->exts); // build FORM tag $form_id = !empty($attrib['id']) ? $attrib['id'] : 'form'; $out = $this->rc->output->request_form(array('id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.managesieve-vacation', 'noclose' => true) + $attrib); // form elements $subject = new html_inputfield(array('name' => 'vacation_subject', 'size' => 50)); $reason = new html_textarea(array('name' => 'vacation_reason', 'cols' => 60, 'rows' => 8)); $interval = new html_inputfield(array('name' => 'vacation_interval', 'size' => 5)); $addresses = '<textarea name="vacation_addresses" data-type="list" data-size="30" style="display: none">' . rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>'; $status = new html_select(array('name' => 'vacation_status')); $status->add($this->plugin->gettext('vacation.on'), 'on'); $status->add($this->plugin->gettext('vacation.off'), 'off'); if ($this->rc->config->get('managesieve_vacation') != 2 && count($this->vacation['list'])) { $after = new html_select(array('name' => 'vacation_after')); $after->add('', ''); foreach ($this->vacation['list'] as $idx => $rule) { $after->add($rule, $idx); } } $interval_txt = $interval->show(isset($this->vacation['seconds']) ? $this->vacation['seconds'] : $this->vacation['days']); if ($seconds_extension) { $interval_select = new html_select(array('name' => 'vacation_interval_type')); $interval_select->add($this->plugin->gettext('days'), 'days'); $interval_select->add($this->plugin->gettext('seconds'), 'seconds'); $interval_txt .= ' ' . $interval_select->show(isset($this->vacation['seconds']) ? 'seconds' : 'days'); } else { $interval_txt .= ' ' . $this->plugin->gettext('days'); } if ($date_extension) { $date_from = new html_inputfield(array('name' => 'vacation_datefrom', 'class' => 'datepicker', 'size' => 12)); $date_to = new html_inputfield(array('name' => 'vacation_dateto', 'class' => 'datepicker', 'size' => 12)); $date_format = $this->rc->config->get('date_format', 'Y-m-d'); foreach ((array) $this->vacation['tests'] as $test) { if ($test['test'] == 'currentdate' && $test['part'] == 'date') { $date = $this->rc->format_date($test['arg'], $date_format, false); $date_value[$test['type'] == 'value-ge' ? 'from' : 'to'] = $date; } } } // Message tab $table = new html_table(array('cols' => 2)); $table->add('title', html::label('vacation_subject', $this->plugin->gettext('vacation.subject'))); $table->add(null, $subject->show($this->vacation['subject'])); $table->add('title', html::label('vacation_reason', $this->plugin->gettext('vacation.body'))); $table->add(null, $reason->show($this->vacation['reason'])); if ($date_extension) { $table->add('title', html::label('vacation_datefrom', $this->plugin->gettext('vacation.dates'))); $table->add(null, $this->plugin->gettext('vacation.from') . ' ' . $date_from->show($date_value['from']) . ' ' . $this->plugin->gettext('vacation.to') . ' ' . $date_to->show($date_value['to'])); } $table->add('title', html::label('vacation_status', $this->plugin->gettext('vacation.status'))); $table->add(null, $status->show(!isset($this->vacation['disabled']) || $this->vacation['disabled'] ? 'off' : 'on')); $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.reply')) . $table->show($attrib)); // Advanced tab $table = new html_table(array('cols' => 2)); $table->add('title', $this->plugin->gettext('vacation.addresses')); $table->add(null, $addresses); $table->add('title', $this->plugin->gettext('vacation.interval')); $table->add(null, $interval_txt); if ($after) { $table->add('title', $this->plugin->gettext('vacation.after')); $table->add(null, $after->show($this->vacation['idx'] - 1)); } $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.advanced')) . $table->show($attrib)); $out .= '</form>'; $this->rc->output->add_gui_object('sieveform', $form_id); return $out; }
function pfadmin_autoresponder_form() { $rcmail = rcmail::get_instance(); // add some labels to client $rcmail->output->add_label('pfadmin_autoresponder.autoresponder', 'pfadmin_autoresponder.dateformatinconsistency', 'pfadmin_autoresponder.dateformat', 'pfadmin_autoresponder.entervalidmonth', 'pfadmin_autoresponder.entervalidday', 'pfadmin_autoresponder.enterfordigityear', 'pfadmin_autoresponder.entervaliddate', 'pfadmin_autoresponder.dateinpast', 'pfadmin_autoresponder.subjectempty', 'pfadmin_autoresponder.and'); $rcmail->output->add_script("var settings_account=true;"); $settings = $this->_get(); $enabled = $settings['active']; $subject = $settings['subject']; $body = $settings['body']; $date = $settings['activeuntil']; $datefrom = $settings['activefrom']; $date = str_replace("-", "/", substr($date, 0, 10)); $datefrom = str_replace("-", "/", substr($datefrom, 0, 10)); if ($date == "0000/00/00") { $date = ""; } if ($datefrom == "0000/00/00") { $datefrom = ""; } $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); // allow the following attributes to be added to the <table> tag $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); // return the complete edit form as table $table = new html_table(array('cols' => 2)); // show autoresponder properties $field_id = 'autoresponder_subject'; $input_autorespondersubject = new html_textarea(array('name' => '_autorespondersubject', 'id' => $field_id, 'cols' => 48, 'rows' => 2)); $table->add('title', html::label($field_id, rep_specialchars_output($this->gettext('subject')))); $table->add(null, $input_autorespondersubject->show($subject)); $field_id = 'autoresponderbody'; $input_autoresponderbody = new html_textarea(array('name' => '_autoresponderbody', 'id' => $field_id, 'cols' => 48, 'rows' => 15)); $table->add('title', html::label($field_id, rep_specialchars_output($this->gettext('autorespondermessage')))); $table->add(null, $input_autoresponderbody->show($body)); $field_id = 'autoresponderdatefrom'; $input_autoresponderdatefrom = new html_inputfield(array('name' => '_autoresponderdatefrom', 'id' => $field_id, 'value' => $date, 'maxlength' => 10, 'size' => 10)); $table->add('title', html::label($field_id, rep_specialchars_output($this->gettext('autoresponderdatefrom')))); $table->add(null, $input_autoresponderdatefrom->show($datefrom) . " " . $this->gettext('dateformat')); $field_id = 'autoresponderdate'; $input_autoresponderdate = new html_inputfield(array('name' => '_autoresponderdate', 'id' => $field_id, 'value' => $date, 'maxlength' => 10, 'size' => 10)); $table->add('title', html::label($field_id, rep_specialchars_output($this->gettext('autoresponderdate')))); $table->add(null, $input_autoresponderdate->show($date) . " " . $this->gettext('dateformat')); $field_id = 'autoresponderenabled'; $input_autoresponderenabled = new html_checkbox(array('name' => '_autoresponderenabled', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, rep_specialchars_output($this->gettext('autoresponderenabled')))); $table->add(null, $input_autoresponderenabled->show($enabled)); $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('autoresponder')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.pfadmin_autoresponder-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))))); $rcmail->output->add_gui_object('autoresponderform', 'autoresponder-form'); return $rcmail->output->form_tag(array('id' => 'autoresponderform', 'name' => 'autoresponderform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.pfadmin_autoresponder-save'), $out); }