function prefs_list($args) { if ($args['section'] == 'mailbox') { $RCMAIL = rcmail::get_instance(); $field_id = 'rcmfd_html5_notifier'; $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id)); $select_duration->add($this->gettext('off'), '0'); $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30'); foreach ($times as $time) { $select_duration->add($time . ' ' . $this->gettext('seconds'), $time); } $select_duration->add($this->gettext('durable'), '-1'); $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id)); $select_smbox->add($this->gettext('no_mailbox'), '0'); $select_smbox->add($this->gettext('short_mailbox'), '1'); $select_smbox->add($this->gettext('full_mailbox'), '2'); $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . ''); $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . ''); $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' '; $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser')); $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, rcube::Q($this->gettext('shownotifies'))), 'content' => $content); $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1)); $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false)); $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, rcube::Q($this->gettext('onlynew'))), 'content' => $content); $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id . '_excluded')); $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, rcube::Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . '')); $select_type = new html_select(array('name' => '_html5_notifier_popuptype', 'id' => $field_id . '_popuptype')); $select_type->add($this->gettext('new_tab'), '0'); $select_type->add($this->gettext('new_window'), '1'); $args['blocks']['new_message']['options']['html5_notifier_popuptype'] = array('title' => html::label($field_id, rcube::Q($this->gettext('notifier_popuptype'))), 'content' => $select_type->show($RCMAIL->config->get('html5_notifier_popuptype') . '')); $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });"); } return $args; }
/** * Plugin initialization. */ function init() { $this->version_detect(); $this->rc = rcube::get_instance(); $this->rm = rcmail::get_instance(); $this->add_hook('user_create', array($this, 'user_create')); $this->register_action('plugin.pks_search', array($this, 'hkp_search')); $this->register_action('plugin.hkp_add', array($this, 'hkp_add')); $this->register_action('plugin.pubkey_save', array($this, 'pubkey_save')); if ($this->rc->task == 'mail') { $this->add_hook('render_page', array($this, 'render_page')); // make localization available on the client $this->add_texts('localization/', true); // load js $this->include_script('js/openpgp.min.js'); $this->include_script('js/rc_openpgpjs.crypto.js'); $this->include_script('js/rc_openpgpjs.js'); if (isset($_SESSION["rc_openpgpjs_outdated"])) { $this->include_script('js/outdated.js'); } // load css $this->include_stylesheet($this->local_skin_path() . '/rc_openpgpjs.css'); // add public key attachment related hooks $this->add_hook('message_compose', array($this, 'message_compose')); $this->add_hook('message_sent', array($this, 'unlink_pubkey')); if ($this->api->output->type == 'html') { // add key manager item to message menu $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "icon active", "class" => "icon", "innerclass" => "icon key_manager"); $this->api->add_content(html::tag('li', null, $this->api->output->button($opts)), "messagemenu"); if ($this->rc->action == 'compose') { // add key manager button to compose toolbar $opts = array("command" => "open-key-manager", "label" => "rc_openpgpjs.key_manager", "type" => "link", "classact" => "button active key_manager", "class" => "button key_manager"); $this->api->add_content($this->api->output->button($opts), "toolbar"); // add encrypt and sign checkboxes to composeoptions $encrypt_opts = array('id' => 'openpgpjs_encrypt', 'type' => 'checkbox'); if ($this->rc->config->get('encrypt', false)) { $encrypt_opts['checked'] = 'checked'; } $encrypt = new html_inputfield($encrypt_opts); $this->api->add_content(html::span('composeoption', html::label(null, $encrypt->show() . $this->gettext('encrypt'))), "composeoptions"); $sign_opts = array('id' => 'openpgpjs_sign', 'type' => 'checkbox'); if ($this->rc->config->get('sign', false)) { $sign_opts['checked'] = 'checked'; } $sign = new html_inputfield($sign_opts); $this->api->add_content(html::span('composeoption', html::label(null, $sign->show() . $this->gettext('sign'))), "composeoptions"); } } } elseif ($this->rc->task == 'settings') { // load localization $this->add_texts('localization/', false); // add hooks for OpenPGP settings $this->add_hook('preferences_list', array($this, 'preferences_list')); $this->add_hook('preferences_save', array($this, 'preferences_save')); } }
function prefs_table($args) { if ($args['section'] != 'mailview') { return $args; } $this->add_texts('localization'); $rcmail = rcmail::get_instance(); $limit = (int) $rcmail->config->get('hide_blockquote_limit'); $field_id = 'hide_blockquote_limit'; $input = new html_inputfield(array('name' => '_' . $field_id, 'id' => $field_id, 'size' => 5)); $args['blocks']['main']['options']['hide_blockquote_limit'] = array('title' => $this->gettext('quotelimit'), 'content' => $input->show($limit ?: '')); return $args; }
function preferences_list($args) { if ($args['section'] == 'jabber') { $jabber_username = $this->rc->config->get('jabber_username'); $jabber_domain = $this->rc->config->get('jabber_domain', 'jappix.com'); $jabber_enc = $this->rc->config->get('jabber_enc'); if ((!$jabber_username || !$jabber_enc || !$jabber_domain) && $this->rc->config->get('jappix_register_url')) { $field_id = 'rcmfd_register'; $args['blocks']['jabber']['options']['jappix_register'] = array('title' => html::label($field_id, @$this->gettext('requirement')), 'content' => html::tag('a', array('href' => $this->rc->config->get('jappix_register_url'), 'target' => '_blank'), $this->gettext('clickhere')) . ' ' . $this->gettext('registeraccount')); } $jappix_enabled = $this->rc->config->get('jappix_enabled', 0); $field_id = 'rcmfd_enabled'; $checkbox = new html_checkbox(array('name' => '_jappix_enabled', 'value' => 1, 'id' => $field_id, 'onclick' => "if(\$(this).prop('checked') == false || \$('input[name=\\'_jabber_username\\']').val() != ''){ \$('.mainaction').hide(); document.forms.form.submit(); };")); $args['blocks']['jabber']['options']['jappix_enabled'] = array('title' => html::label($field_id, Q($this->gettext('enabled'))), 'content' => $checkbox->show($jappix_enabled ? 1 : 0)); $field_id_user = '******'; $input_user = new html_inputfield(array('name' => '_jabber_username', 'id' => $field_id_user, 'size' => 25)); if ($jabber_domain == '%d') { $jabber_domain = end(explode('@', $this->rc->user->data['username'])); } $field_id_domain = 'rcmfd_domain'; $input_domain = new html_inputfield(array('name' => '_jabber_domain', 'id' => $field_id_domain, 'size' => 25)); $args['blocks']['jabber']['options']['jabber_username'] = array('title' => html::label($field_id, Q($this->gettext('jappixUsername'))), 'content' => $input_user->show($jabber_username) . ' @ ' . $input_domain->show($jabber_domain)); $field_id = 'rcmfd_enc'; $input = new html_passwordfield(array('name' => '_jabber_password', 'id' => $field_id, 'size' => 25, 'placeholder' => $jabber_enc ? $this->gettext('passwordisset') : $this->gettext('pleaseenterpassword'))); $args['blocks']['jabber']['options']['jabber_password'] = array('title' => html::label($field_id, Q($this->gettext('jappixPassword'))), 'content' => $input->show()); $jappix_full = $this->rc->config->get('jappix_full', 1); $field_id = 'rcmfd_use_full'; $checkbox = new html_checkbox(array('name' => '_jappix_full', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.\$('.button-jappix4roundcube').show(); } else { parent.\$('.button-jappix4roundcube').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();")); $args['blocks']['jabber']['options']['jappix_full'] = array('title' => html::label($field_id, Q($this->gettext('usefulljappix'))), 'content' => $checkbox->show($jappix_full ? 1 : 0)); $jappix_mini = $this->rc->config->get('jappix_mini', 1); $field_id = 'rcmfd_use_mini'; $checkbox = new html_checkbox(array('name' => '_jappix_mini', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_position').show(); } else { parent.parent.\$('.jm_position').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();")); $args['blocks']['jabber']['options']['jappix_mini'] = array('title' => html::label($field_id, Q($this->gettext('useminijappix'))), 'content' => $checkbox->show($jappix_mini ? 1 : 0)); $jappix_mini_autologon = $this->rc->config->get('jappix_mini_autologon', 1); $field_id = 'rcmfd_use_mini_autologon'; $checkbox = new html_checkbox(array('name' => '_jappix_mini_autologon', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_pane').trigger('click'); } else { if(parent.parent.JappixMini) parent.parent.JappixMini.disconnect(); }; \$('.mainaction').hide(); document.forms.form.submit();")); $args['blocks']['jabber']['options']['jappix_mini_autologon'] = array('title' => html::label($field_id, Q($this->gettext('minijappixautologon'))), 'content' => $checkbox->show($jappix_mini_autologon ? 1 : 0)); /* $field_id = 'rcmfd_use_manager'; $args['blocks']['jabber']['options']['jabber_manager'] = array( 'title' => html::label($field_id, Q($this->gettext('manager'))), 'content' => '<a target=\'_blank\' href=\''.$this->rc->config->get('jappix_url').'/?m=manager\'>'.Q($this->gettext('manager')).'</a>', ); */ } return $args; }
function preferences_list($params) { $rcmail = rcmail::get_instance(); if ($params['section'] == 'addressbook') { $params['blocks'][$this->id]['name'] = $this->abook_name; $field_id = 'rc_use_plugin'; $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('use') . $this->abook_name), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_use_plugin))); $field_id = 'rc_google_autosync'; $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('autosync')), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_auto_sync))); $field_id = 'rc_google_authcode'; $input_auth = new html_inputfield(array('name' => $field_id, 'id' => $field_id, 'size' => 45)); $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('authcode')), 'content' => $input_auth->show($rcmail->config->get(google_func::$settings_key_auth_code))); $params['blocks'][$this->id]['options']['link'] = array('title' => html::span('', ''), 'content' => html::a(array('href' => google_func::get_client()->createAuthUrl(), 'target' => '_blank'), $this->gettext('authcodelink'))); } return $params; }
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; }
function gen_form() { $user = $this->rcmail_inst->user->get_prefs(); $this->rcmail_inst->output->add_label('ispconfig3_forward.invalidaddress', 'ispconfig3_forward.forwardingempty'); 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'); } $this->rcmail_inst->output->set_env('framed', TRUE); $out .= '<fieldset><legend>' . $this->gettext('acc_forward') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_forwardingaddress = new html_inputfield(array('name' => '_forwardingaddress', 'id' => 'forwardingaddress', 'value' => $forward[1], 'maxlength' => 320, 'size' => 40)); $table->add('title', rep_specialchars_output($this->gettext('forwardingaddress'))); $table->add('', $input_forwardingaddress->show($mail_user[0]['cc'])); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
function gen_form() { $user = $this->rcmail_inst->user->get_prefs(); $this->rcmail_inst->output->add_label('ispconfig3_forward.invalidaddress', 'ispconfig3_forward.forwardingempty'); $this->rcmail_inst->output->set_env('framed', true); $out .= '<fieldset><legend>' . $this->gettext('acc_forward') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_forwardingaddress = new html_inputfield(array('name' => '_forwardingaddress', 'id' => 'forwardingaddress', 'value' => '', 'maxlength' => 320, 'size' => 40)); $table->add('title', rep_specialchars_output($this->gettext('forwardingaddress'))); $table->add('', $input_forwardingaddress->show()); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
public function prefs_list($args) { if ($args['section'] != 'thunderbird_labels') { return $args; } $this->load_config(); $dont_override = (array) $this->rc->config->get('dont_override', array()); $args['blocks']['tb_label'] = array(); $args['blocks']['tb_label']['name'] = $this->gettext('tb_label_options'); $key = 'tb_label_enable'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1)); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_option'), 'content' => $content); } $key = 'tb_label_enable_shortcuts'; if (!in_array($key, $dont_override)) { $input = new html_checkbox(array('name' => $key, 'id' => $key, 'value' => 1)); $content = $input->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_enable_shortcuts_option'), 'content' => $content); } $key = 'tb_label_style'; if (!in_array($key, $dont_override)) { $select = new html_select(array('name' => $key, 'id' => $key)); $select->add(array($this->gettext('thunderbird'), $this->gettext('bullets')), array('thunderbird', 'bullets')); $content = $select->show($this->rc->config->get($key)); $args['blocks']['tb_label']['options'][$key] = array('title' => $this->gettext('tb_label_style_option'), 'content' => $content); } $key = 'tb_label_custom_labels'; if (!in_array($key, $dont_override) && $this->rc->config->get('tb_label_modify_labels')) { $old = $this->rc->config->get($key); for ($i = 1; $i <= 5; $i++) { $input = new html_inputfield(array('name' => $key . $i, 'id' => $key . $i, 'type' => 'text', 'autocomplete' => 'off', 'value' => $old[$i])); $args['blocks']['tb_label']['options'][$key . $i] = array('title' => $this->gettext('tb_label_label') . " " . $i, 'content' => $input->show()); } } return $args; }
/** * Creates ACL rights form (user part) * * @param array $attrib Template object attributes * * @return string HTML Content */ function templ_user($attrib) { // Create username input $attrib['name'] = 'acluser'; $textfield = new html_inputfield($attrib); $fields['user'] = html::label(array('for' => 'iduser'), $this->gettext('username')) . ' ' . $textfield->show(); // Add special entries if (!empty($this->specials)) { foreach ($this->specials as $key) { $fields[$key] = html::label(array('for' => 'id' . $key), $this->gettext($key)); } } $this->rc->output->set_env('acl_specials', $this->specials); // Create list with radio buttons if (count($fields) > 1) { $ul = ''; $radio = new html_radiobutton(array('name' => 'usertype')); foreach ($fields as $key => $val) { $ul .= html::tag('li', null, $radio->show($key == 'user' ? 'user' : '', array('value' => $key, 'id' => 'id' . $key)) . $val); } $out = html::tag('ul', array('id' => 'usertype', 'class' => $attrib['class']), $ul, html::$common_attrib); } else { $out = $fields['user']; } return $out; }
$pagesize = $RCI->getprop('pagesize'); } $input_pagesize = new html_inputfield(array('name' => '_mail_pagesize', 'size' => 6, 'id' => "cfgmailpagesize")); echo $input_pagesize->show($pagesize); ?> <div>Show up to X items in the mail messages list view.</div> </dd> <dt class="propname">addressbook_pagesize <span class="userconf">*</span></dt> <dd> <?php $pagesize = $RCI->getprop('addressbook_pagesize'); if (!$pagesize) { $pagesize = $RCI->getprop('pagesize'); } $input_pagesize = new html_inputfield(array('name' => '_addressbook_pagesize', 'size' => 6, 'id' => "cfgabookpagesize")); echo $input_pagesize->show($pagesize); ?> <div>Show up to X items in the contacts list view.</div> </dd> <dt class="propname">prefer_html <span class="userconf">*</span></dt> <dd> <?php $check_htmlview = new html_checkbox(array('name' => '_prefer_html', 'id' => "cfghtmlview", 'value' => 1)); echo $check_htmlview->show(intval($RCI->getprop('prefer_html'))); ?> <label for="cfghtmlview">Prefer displaying HTML messages</label><br /> </dd> <dt class="propname">preview_pane <span class="userconf">*</span></dt>
/** * Get HTML code for this object * * @param string $value Value of the checked field * @param array $attrib Additional attributes to override * @return string HTML output */ public function show($value = '', $attrib = null) { // overwrite object attributes if (is_array($attrib)) { $this->attrib = array_merge($this->attrib, $attrib); } // set value attribute $this->attrib['checked'] = (string) $value == (string) $this->attrib['value']; return parent::show(); }
function filterset_form($attrib) { if (!$attrib['id']) { $attrib['id'] = 'rcmfiltersetform'; } $out = '<form name="filtersetform" action="./" method="post" enctype="multipart/form-data">' . "\n"; $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $this->rc->task)); $hiddenfields->add(array('name' => '_action', 'value' => 'plugin.managesieve-save')); $hiddenfields->add(array('name' => '_framed', 'value' => $_POST['_framed'] || $_GET['_framed'] ? 1 : 0)); $hiddenfields->add(array('name' => '_newset', 'value' => 1)); $out .= $hiddenfields->show(); $name = rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST); $copy = rcube_utils::get_input_value('_copy', rcube_utils::INPUT_POST); $selected = rcube_utils::get_input_value('_from', rcube_utils::INPUT_POST); // filter set name input $input_name = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30, 'class' => $this->errors['name'] ? 'error' : '')); $out .= sprintf('<label for="%s"><b>%s:</b></label> %s<br /><br />', '_name', rcube::Q($this->plugin->gettext('filtersetname')), $input_name->show($name)); $out .= "\n<fieldset class=\"itemlist\"><legend>" . $this->plugin->gettext('filters') . ":</legend>\n"; $out .= '<input type="radio" id="from_none" name="_from" value="none"' . (!$selected || $selected == 'none' ? ' checked="checked"' : '') . '></input>'; $out .= sprintf('<label for="%s">%s</label> ', 'from_none', rcube::Q($this->plugin->gettext('none'))); // filters set list $list = $this->list_scripts(); $select = new html_select(array('name' => '_copy', 'id' => '_copy')); if (is_array($list)) { asort($list, SORT_LOCALE_STRING); if (!$copy) { $copy = $_SESSION['managesieve_current']; } foreach ($list as $set) { $select->add($set, $set); } $out .= '<br /><input type="radio" id="from_set" name="_from" value="set"' . ($selected == 'set' ? ' checked="checked"' : '') . '></input>'; $out .= sprintf('<label for="%s">%s:</label> ', 'from_set', rcube::Q($this->plugin->gettext('fromset'))); $out .= $select->show($copy); } // script upload box $upload = new html_inputfield(array('name' => '_file', 'id' => '_file', 'size' => 30, 'type' => 'file', 'class' => $this->errors['file'] ? 'error' : '')); $out .= '<br /><input type="radio" id="from_file" name="_from" value="file"' . ($selected == 'file' ? ' checked="checked"' : '') . '></input>'; $out .= sprintf('<label for="%s">%s:</label> ', 'from_file', rcube::Q($this->plugin->gettext('fromfile'))); $out .= $upload->show(); $out .= '</fieldset>'; $this->rc->output->add_gui_object('sieveform', 'filtersetform'); if ($this->errors['name']) { $this->add_tip('_name', $this->errors['name'], true); } if ($this->errors['file']) { $this->add_tip('_file', $this->errors['file'], true); } $this->print_tips(); return $out; }
</table> <p><input type="submit" name="sendmail" value="Send test mail" /></p> <h3>Test IMAP config</h3> <?php $default_hosts = $RCI->get_hostlist(); if (!empty($default_hosts)) { $host_field = new html_select(array('name' => '_host', 'id' => 'imaphost')); $host_field->add($default_hosts); } else { $host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost')); } $user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser')); $pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass')); ?> <table> <tbody> <tr> <td><label for="imaphost">Server</label></td> <td><?php echo $host_field->show($_POST['_host']); ?> </td> </tr> <tr> <td>Port</td> <td><?php
function preferences_list($args) { if ($args['section'] != 'server' || !$this->is_enabled()) { return $args; } $disabled = $this->disallow_change(); // add checkbox to enable/disable YubiKey auth for the current user $chk_yubikey = new html_checkbox(array('name' => '_yubikey_required', 'id' => 'rcmfd_yubikey_required', 'disabled' => $disabled)); $args['blocks']['main']['options']['yubikey_required'] = array('title' => html::label('rcmfd_yubikey_required', Q($this->gettext('yubikeyrequired'))), 'content' => $chk_yubikey->show(!$this->is_required())); // add inputfield for the YubiKey id $input_yubikey_id = new html_inputfield(array('name' => '_yubikey_id', 'id' => 'rcmfd_yubikey_id', 'size' => 12, 'disabled' => $disabled)); $args['blocks']['main']['options']['yubikey_id'] = array('title' => html::label('rcmfd_yubikey_id', Q($this->gettext('yubikeyid'))), 'content' => $input_yubikey_id->show($this->get('yubikey_id'))); // add inputfield for the YubiKey id2 $input_yubikey_id2 = new html_inputfield(array('name' => '_yubikey_id2', 'id' => 'rcmfd_yubikey_id2', 'size' => 12, 'disabled' => $disabled)); $args['blocks']['main']['options']['yubikey_id2'] = array('title' => html::label('rcmfd_yubikey_id2', Q($this->gettext('yubikeyid2'))), 'content' => $input_yubikey_id2->show($this->get('yubikey_id2'))); // add inputfield for the YubiKey id3 $input_yubikey_id3 = new html_inputfield(array('name' => '_yubikey_id3', 'id' => 'rcmfd_yubikey_id3', 'size' => 12, 'disabled' => $disabled)); $args['blocks']['main']['options']['yubikey_id3'] = array('title' => html::label('rcmfd_yubikey_id3', Q($this->gettext('yubikeyid3'))), 'content' => $input_yubikey_id3->show($this->get('yubikey_id3'))); return $args; }
private function _prefs_block($part, $attrib) { $rcmail = rcube::get_instance(); $no_override = array_flip($rcmail->config->get('sauserprefs_dont_override')); $locale_info = localeconv(); switch ($part) { // General tests case 'general': $out = ''; $data = ''; $table = new html_table(array('class' => 'generalprefstable', 'cols' => 2)); if (!isset($no_override['required_hits'])) { $field_id = 'rcmfd_spamthres'; $input_spamthres = new html_select(array('name' => '_spamthres', 'id' => $field_id)); $input_spamthres->add($this->gettext('defaultscore'), ''); $decPlaces = 0; if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) { $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2; } $score_found = false; for ($i = 1; $i <= 10; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) { $input_spamthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', '')); if (!$score_found && $this->user_prefs['required_hits'] && (double) $this->user_prefs['required_hits'] == (double) $i) { $score_found = true; } } if (!$score_found && $this->user_prefs['required_hits']) { $input_spamthres->add(str_replace('%s', $this->user_prefs['required_hits'], $this->gettext('otherscore')), (double) $this->user_prefs['required_hits']); } $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamthres')))); $table->add(null, $input_spamthres->show(number_format($this->user_prefs['required_hits'], $decPlaces, '.', ''))); $table->add(array('colspan' => 2), rcmail::Q($this->gettext('spamthresexp'))); } if (!isset($no_override['rewrite_header Subject'])) { $field_id = 'rcmfd_spamsubject'; $input_spamsubject = new html_inputfield(array('name' => '_spamsubject', 'id' => $field_id, 'value' => $this->user_prefs['rewrite_header Subject'], 'style' => 'width:200px;')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamsubject')))); $table->add(null, $input_spamsubject->show()); $table->add('title', " "); $table->add(null, rcmail::Q($this->gettext('spamsubjectblank'))); } if ($table->size() > 0) { $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show()); } if (!isset($no_override['ok_languages']) || !isset($no_override['ok_locales'])) { $data = html::p(null, rcmail::Q($this->gettext('spamlangexp'))); $table = new html_table(array('class' => 'langprefstable', 'cols' => 1)); $select_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_all_langs', 'type' => 'link', 'label' => 'all')); $select_none = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_no_langs', 'type' => 'link', 'label' => 'none')); $select_invert = $this->api->output->button(array('command' => 'plugin.sauserprefs.select_invert_langs', 'type' => 'link', 'label' => 'invert')); $table->add(array('id' => 'listcontrols'), $this->gettext('select') . ": " . $select_all . " " . $select_invert . " " . $select_none); $lang_table = new html_table(array('id' => 'spam-langs-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2)); $lang_table->add_header(array('colspan' => 2), $this->gettext('language')); if (!isset($no_override['ok_locales'])) { if ($this->user_prefs['ok_locales'] == "all") { $ok_locales = $this->sa_locales; } else { $ok_locales = explode(" ", $this->user_prefs['ok_locales']); } } else { $ok_locales = array(); } if (!isset($no_override['ok_languages'])) { if ($this->user_prefs['ok_languages'] == "all") { $ok_languages = array_keys($rcmail->config->get('sauserprefs_languages')); } else { $ok_languages = explode(" ", $this->user_prefs['ok_languages']); } } else { $tmp_array = $rcmail->config->get('sauserprefs_languages'); $rcmail->config->set('sauserprefs_languages', array_intersect_key($tmp_array, array_flip($this->sa_locales))); $ok_languages = array(); } $i = 0; $locales_langs = array_merge($ok_locales, $ok_languages); foreach ($rcmail->config->get('sauserprefs_languages') as $lang_code => $name) { if (in_array($lang_code, $locales_langs)) { $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'enabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.enabled', 'content' => ' ')); } else { $button = $this->api->output->button(array('command' => 'plugin.sauserprefs.message_lang', 'prop' => $lang_code, 'type' => 'link', 'class' => 'disabled', 'id' => 'spam_lang_' . $i, 'title' => 'sauserprefs.disabled', 'content' => ' ')); } $input_spamlang = new html_checkbox(array('style' => 'display: none;', 'name' => '_spamlang[]', 'value' => $lang_code)); $lang_table->add('lang', $name); $lang_table->add('tick', $button . $input_spamlang->show(in_array($lang_code, $locales_langs) ? $lang_code : '')); $i++; } $table->add('scroller', html::div(array('id' => 'spam-langs-cont'), $lang_table->show())); $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('langoptions'))) . $data . $table->show()); } break; // Header settings // Header settings case 'headers': $data = html::p(null, rcmail::Q($this->gettext('headersexp'))); $table = new html_table(array('class' => 'headersprefstable', 'cols' => 3)); if (!isset($no_override['fold_headers'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("fold_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamfoldheaders'; $input_spamreport = new html_checkbox(array('name' => '_spamfoldheaders', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('foldheaders')))); $table->add(null, $input_spamreport->show($this->user_prefs['fold_headers'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'fold_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('foldhelp'))); } if (!isset($no_override['add_header all Level'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("level_help");', 'title' => $this->gettext('help')), $help_button); if ($this->user_prefs['remove_header all'] != 'Level') { $enabled = "1"; $char = $this->user_prefs['add_header all Level']; $char = substr($char, 7, 1); } else { $enabled = "0"; $char = "*"; } $field_id = 'rcmfd_spamlevelstars'; $input_spamreport = new html_checkbox(array('name' => '_spamlevelstars', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_level_char(this)')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelstars')))); $table->add(null, $input_spamreport->show($enabled)); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'level_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('levelhelp'))); $field_id = 'rcmfd_spamlevelchar'; $input_spamsubject = new html_inputfield(array('name' => '_spamlevelchar', 'id' => $field_id, 'value' => $char, 'style' => 'width:20px;', 'disabled' => $enabled ? 0 : 1)); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('spamlevelchar')))); $table->add(null, $input_spamsubject->show()); $table->add('help', ' '); } $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show()); break; // Test settings // Test settings case 'tests': $data = html::p(null, rcmail::Q($this->gettext('spamtestssexp'))); $table = new html_table(array('class' => 'testsprefstable', 'cols' => 3)); if (!isset($no_override['use_razor1'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz1_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamuserazor1'; $input_spamtest = new html_checkbox(array('name' => '_spamuserazor1', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor1')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_razor1'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'raz1_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz1help'))); } if (!isset($no_override['use_razor2'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("raz2_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamuserazor2'; $input_spamtest = new html_checkbox(array('name' => '_spamuserazor2', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('userazor2')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_razor2'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'raz2_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('raz2help'))); } if (!isset($no_override['use_pyzor'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("pyz_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamusepyzor'; $input_spamtest = new html_checkbox(array('name' => '_spamusepyzor', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usepyzor')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_pyzor'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'pyz_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('pyzhelp'))); } if (!isset($no_override['use_dcc'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("dcc_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamusedcc'; $input_spamtest = new html_checkbox(array('name' => '_spamusedcc', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usedcc')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_dcc'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'dcc_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('dcchelp'))); } if (!isset($no_override['skip_rbl_checks'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("rbl_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamskiprblchecks'; $enabled = $this->user_prefs['skip_rbl_checks'] == "1" ? "0" : "1"; $input_spamtest = new html_checkbox(array('name' => '_spamskiprblchecks', 'id' => $field_id, 'value' => '1')); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('skiprblchecks')))); $table->add(null, $input_spamtest->show($enabled)); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'rbl_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('rblhelp'))); } $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show()); break; // Bayes settings // Bayes settings case 'bayes': $data = html::p(null, rcmail::Q($this->gettext('bayeshelp'))); $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 3)); if (!isset($no_override['use_bayes'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayes_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spamusebayes'; $input_spamtest = new html_checkbox(array('name' => '_spamusebayes', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes(this)')); if ($rcmail->config->get('sauserprefs_bayes_delete', false)) { $delete_link = " " . html::span(array('id' => 'listcontrols'), $this->api->output->button(array('command' => 'plugin.sauserprefs.purge_bayes', 'type' => 'link', 'label' => 'sauserprefs.purgebayes', 'title' => 'sauserprefs.purgebayesexp'))); } $table->add('title', html::label($field_id, rcmail::Q($this->gettext('usebayes')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes']) . $delete_link); $table->add('help', ' '); $table->set_row_attribs(array('id' => 'bayes_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayeshelp'))); } if (!isset($no_override['use_bayes_rules'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesrules_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spambayesrules'; $input_spamtest = new html_checkbox(array('name' => '_spambayesrules', 'id' => $field_id, 'value' => '1', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1)); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesrules')))); $table->add(null, $input_spamtest->show($this->user_prefs['use_bayes_rules'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'bayesrules_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesruleshlp'))); } if (!isset($no_override['bayes_auto_learn'])) { $help_button = html::img(array('class' => $imgclass, 'src' => $attrib['helpicon'], 'alt' => $this->gettext('sieveruleheaders'), 'border' => 0, 'style' => 'margin-left: 4px;')); $help_button = html::a(array('name' => '_headerhlp', 'href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sauserprefs_help("bayesauto_help");', 'title' => $this->gettext('help')), $help_button); $field_id = 'rcmfd_spambayesautolearn'; $input_spamtest = new html_checkbox(array('name' => '_spambayesautolearn', 'id' => $field_id, 'value' => '1', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.sauserprefs_toggle_bayes_auto(this)', 'disabled' => $this->user_prefs['use_bayes'] ? 0 : 1)); $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesautolearn')))); $table->add(null, $input_spamtest->show($this->user_prefs['bayes_auto_learn'])); $table->add('help', $help_button); $table->set_row_attribs(array('id' => 'bayesauto_help', 'style' => 'display: none;')); $table->add(array('colspan' => '3'), rcmail::Q($this->gettext('bayesautohelp'))); } if ($table->size() > 0) { $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show()); } $table = new html_table(array('class' => 'bayesprefstable', 'cols' => 2)); $data = ""; if (!isset($no_override['bayes_auto_learn_threshold_nonspam'])) { $field_id = 'rcmfd_bayesnonspam'; $input_bayesnthres = new html_select(array('name' => '_bayesnonspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0)); $input_bayesnthres->add($this->gettext('defaultscore'), ''); $decPlaces = 1; //if ($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc') > 0) // $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int)$rcmail->config->get('sauserprefs_score_inc')) - 2; $score_found = false; for ($i = -1; $i <= 1; $i = $i + 0.1) { $input_bayesnthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', '')); if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam'] == (double) $i) { $score_found = true; } } if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_nonspam']) { $input_bayesnthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_nonspam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_nonspam']); } $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesnonspam')))); $table->add(null, $input_bayesnthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_nonspam'], $decPlaces, '.', ''))); $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesnonspamexp'))); } if (!isset($no_override['bayes_auto_learn_threshold_spam'])) { $field_id = 'rcmfd_bayesspam'; $input_bayesthres = new html_select(array('name' => '_bayesspam', 'id' => $field_id, 'disabled' => !$this->user_prefs['bayes_auto_learn'] || !$this->user_prefs['use_bayes'] ? 1 : 0)); $input_bayesthres->add($this->gettext('defaultscore'), ''); $decPlaces = 0; if ($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc') > 0) { $decPlaces = strlen($rcmail->config->get('sauserprefs_score_inc') - (int) $rcmail->config->get('sauserprefs_score_inc')) - 2; } $score_found = false; for ($i = 1; $i <= 20; $i = $i + $rcmail->config->get('sauserprefs_score_inc')) { $input_bayesthres->add(number_format($i, $decPlaces, $locale_info['decimal_point'], ''), number_format($i, $decPlaces, '.', '')); if (!$score_found && $this->user_prefs['bayes_auto_learn_threshold_spam'] && (double) $this->user_prefs['bayes_auto_learn_threshold_spam'] == (double) $i) { $score_found = true; } } if (!$score_found && $this->user_prefs['required_hits']) { $input_bayesthres->add(str_replace('%s', $this->user_prefs['bayes_auto_learn_threshold_spam'], $this->gettext('otherscore')), (double) $this->user_prefs['bayes_auto_learn_threshold_spam']); } $table->add('title', html::label($field_id, rcmail::Q($this->gettext('bayesspam')))); $table->add(null, $input_bayesthres->show(number_format($this->user_prefs['bayes_auto_learn_threshold_spam'], $decPlaces, '.', ''))); $table->add(array('colspan' => '2'), rcmail::Q($this->gettext('bayesspamexp'))); } if ($table->size() > 0) { $out .= html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('bayesautooptions'))) . $table->show()); } break; // Report settings // Report settings case 'report': $data = html::p(null, rcmail::Q($this->gettext('spamreport'))); $table = new html_table(array('class' => 'reportprefstable', 'cols' => 2)); if (!isset($no_override['report_safe'])) { $field_id = 'rcmfd_spamreport'; $input_spamreport0 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_0', 'value' => '0')); $table->add('title', html::label($field_id . '_0', rcmail::Q($this->gettext('spamreport0')))); $table->add(null, $input_spamreport0->show($this->user_prefs['report_safe'])); $input_spamreport1 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_1', 'value' => '1')); $table->add('title', html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1')))); $table->add(null, $input_spamreport1->show($this->user_prefs['report_safe'])); $data .= $input_spamreport1->show($this->user_prefs['report_safe']) . " " . html::label($field_id . '_1', rcmail::Q($this->gettext('spamreport1'))) . "<br />"; $input_spamreport2 = new html_radiobutton(array('name' => '_spamreport', 'id' => $field_id . '_2', 'value' => '2')); $table->add('title', html::label($field_id . '_2', rcmail::Q($this->gettext('spamreport2')))); $table->add(null, $input_spamreport2->show($this->user_prefs['report_safe'])); } $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $table->show()); break; // Address settings // Address settings case 'addresses': $data = html::p(null, rcmail::Q($this->gettext('whitelistexp'))); if ($rcmail->config->get('sauserprefs_whitelist_sync')) { $data .= rcmail::Q($this->gettext('autowhitelist')) . "<br /><br />"; } $table = new html_table(array('class' => 'addressprefstable', 'cols' => 4)); $field_id = 'rcmfd_spamaddressrule'; $input_spamaddressrule = new html_select(array('name' => '_spamaddressrule', 'id' => $field_id)); $input_spamaddressrule->add($this->gettext('whitelist_from'), 'whitelist_from'); $input_spamaddressrule->add($this->gettext('blacklist_from'), 'blacklist_from'); $input_spamaddressrule->add($this->gettext('whitelist_to'), 'whitelist_to'); $field_id = 'rcmfd_spamaddress'; $input_spamaddress = new html_inputfield(array('name' => '_spamaddress', 'id' => $field_id, 'style' => 'width:200px;')); $field_id = 'rcmbtn_add_address'; $button_addaddress = $this->api->output->button(array('command' => 'plugin.sauserprefs.addressrule_add', 'type' => 'input', 'class' => 'button', 'label' => 'sauserprefs.addrule')); $table->add('ruletype', $input_spamaddressrule->show()); $table->add('address', $input_spamaddress->show()); $table->add('action', $button_addaddress); $table->add(null, " "); $import = $this->api->output->button(array('command' => 'plugin.sauserprefs.import_whitelist', 'type' => 'link', 'label' => 'import', 'title' => 'sauserprefs.importfromaddressbook')); $delete_all = $this->api->output->button(array('command' => 'plugin.sauserprefs.whitelist_delete_all', 'type' => 'link', 'label' => 'sauserprefs.deleteall')); $table->add(array('colspan' => 4, 'id' => 'listcontrols'), $import . " " . $delete_all); $address_table = new html_table(array('id' => 'address-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $address_table->add_header('rule', $this->gettext('rule')); $address_table->add_header('email', $this->gettext('email')); $address_table->add_header('control', ' '); $this->_address_row($address_table, null, null, $attrib); if (sizeof($this->user_prefs['addresses']) > 0) { $norules = 'display: none;'; } $address_table->set_row_attribs(array('style' => $norules)); $address_table->add(array('colspan' => '3'), rcube_utils::rep_specialchars_output($this->gettext('noaddressrules'))); $this->api->output->set_env('address_rule_count', sizeof($this->user_prefs['addresses'])); foreach ($this->user_prefs['addresses'] as $address) { $this->_address_row($address_table, $address['field'], $address['value'], $attrib); } $table->add(array('colspan' => 4, 'class' => 'scroller'), html::div(array('id' => 'address-rules-cont'), $address_table->show())); if ($table->size()) { $out = html::tag('fieldset', null, html::tag('legend', null, rcmail::Q($this->gettext('mainoptions'))) . $data . $table->show()); } break; default: $out = ''; } return $out; }
/** * Generate the form for event attachments upload */ function attachments_form($attrib = array()) { // add ID if not given if (!$attrib['id']) { $attrib['id'] = 'rcmtaskuploadform'; } // Get max filesize, enable upload progress bar $max_filesize = rcube_upload_init(); $button = new html_inputfield(array('type' => 'button')); $input = new html_inputfield(array('type' => 'file', 'name' => '_attachments[]', 'multiple' => 'multiple', 'size' => $attrib['attachmentfieldsize'])); return html::div($attrib, html::div(null, $input->show()) . html::div('formbuttons', $button->show(rcube_label('upload'), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".upload_file(this.form)"))) . html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))); }
function gen_form() { $id = get_input_value('_id', RCUBE_INPUT_GET); $this->rcmail_inst->output->add_label('ispconfig3_wblist.wblistdelconfirm'); if ($id != '' || $id != 0) { 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'])); $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email'])); if (get_input_value('_type', RCUBE_INPUT_GET) == "W") { $wblist = $this->soap->mail_spamfilter_whitelist_get($session_id, array('wblist_id' => $id)); $type = "W"; } else { $wblist = $this->soap->mail_spamfilter_blacklist_get($session_id, array('wblist_id' => $id)); $type = "B"; } $this->soap->logout($session_id); } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $wblist[0]['active']; if ($wblist[0]['rid'] != $spam_user[0]['id']) { $this->rcmail_inst->output->command('display_message', 'Error: ' . $this->gettext('opnotpermitted'), 'error'); $enabled = 'n'; $wblist[0]['email'] = ''; $wblist[0]['priority'] = ''; } } else { $wblist[0]['priority'] = '5'; } if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } $this->rcmail_inst->output->set_env('framed', TRUE); $out .= '<fieldset><legend>' . $this->gettext('acc_wblist') . '</legend>' . "\n"; $hidden_id = new html_hiddenfield(array('name' => '_id', 'value' => $wblist[0]['wblist_id'])); $out .= $hidden_id->show(); $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_wblistemail = new html_inputfield(array('name' => '_wblistemail', 'id' => 'wblistaddress', 'size' => 70)); $table->add('title', rep_specialchars_output($this->gettext('email'))); $table->add('', $input_wblistemail->show($wblist[0]['email'])); $input_wblistwb = new html_select(array('name' => '_wblistwb', 'id' => 'wblistwb')); $input_wblistwb->add(array($this->gettext('wblistwhitelist'), $this->gettext('wblistblacklist')), array('W', 'B')); $table->add('title', rep_specialchars_output($this->gettext('wblisttype'))); $table->add('', $input_wblistwb->show($type)); $input_wblistpriority = new html_select(array('name' => '_wblistpriority', 'id' => 'wblistpriority')); $input_wblistpriority->add(array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")); $table->add('title', rep_specialchars_output($this->gettext('wblistpriority'))); $table->add('', $input_wblistpriority->show($wblist[0]['priority'])); $input_wblistenabled = new html_checkbox(array('name' => '_wblistenabled', 'id' => 'wblistenabled', 'value' => '1')); $table->add('title', rep_specialchars_output($this->gettext('wblistenabled'))); $table->add('', $input_wblistenabled->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
function mh_get_form_row($header = 'from', $input = '', $color = '#ffffff', $delete = false) { // header select box $header_select = new html_select(array('name' => '_mh_header[]', 'class' => 'rcmfd_mh_header')); $header_select->add(Q($this->gettext('subject')), 'subject'); $header_select->add(Q($this->gettext('from')), 'from'); $header_select->add(Q($this->gettext('to')), 'to'); $header_select->add(Q($this->gettext('cc')), 'cc'); // input field $input = new html_inputfield(array('name' => '_mh_input[]', 'class' => 'rcmfd_mh_input', 'type' => 'text', 'autocomplete' => 'off', 'value' => $input)); // color box $color = html::tag('input', array('id' => uniqid(), 'name' => '_mh_color[]', 'type' => 'color', 'text' => 'hidden', 'class' => 'mh_color_input', 'value' => $color, 'data-hex' => 'true')); // delete button $button = html::tag('input', array('class' => 'button mh_delete mh_button', 'type' => 'button', 'value' => $this->gettext('mh_delete'), 'title' => $this->gettext('mh_delete_description'))); // add button $add_button = html::tag('input', array('class' => 'button mh_add mh_button', 'type' => 'button', 'value' => $this->gettext('mh_add'), 'title' => $this->gettext('mh_add_description'))); $content = $header_select->show($header) . html::span('mh_matches', Q($this->gettext('mh_matches'))) . $input->show() . html::span('mh_color', Q($this->gettext('mh_color'))) . $color . $button . $add_button; if (rcmail::get_instance()->config->get('request_saver_compress_html', false)) { $content = request_saver::html_compress($content); } return $content; }
/** * Handler for preferences_list hook. * Adds options blocks into Calendar settings sections in Preferences. * * @param array Original parameters * @return array Modified parameters */ function preferences_list($p) { if ($p['section'] != 'calendar') { return $p; } $no_override = array_flip((array) $this->rc->config->get('dont_override')); $p['blocks']['view']['name'] = $this->gettext('mainoptions'); if (!isset($no_override['calendar_default_view'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_default_view'; $select = new html_select(array('name' => '_default_view', 'id' => $field_id)); $select->add($this->gettext('day'), "agendaDay"); $select->add($this->gettext('week'), "agendaWeek"); $select->add($this->gettext('month'), "month"); $select->add($this->gettext('agenda'), "table"); $p['blocks']['view']['options']['default_view'] = array('title' => html::label($field_id, Q($this->gettext('default_view'))), 'content' => $select->show($this->rc->config->get('calendar_default_view', $this->defaults['calendar_default_view']))); } // Begin mod by Rosali (https://issues.kolab.org/show_bug.cgi?id=3481) if (!isset($no_override['calendar_treat_as_allday'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_calendar_treat_as_allday'; $select = new html_select(array('name' => '_treat_as_allday', 'id' => $field_id)); for ($i = 4; $i <= 12; $i++) { $select->add($i, $i); } $p['blocks']['view']['options']['calendar_treat_as_allday'] = array('title' => html::label($field_id, Q($this->gettext('treat_as_allday'))), 'content' => $select->show((int) $this->rc->config->get('calendar_treat_as_allday', 6)) . ' ' . $this->gettext('hours')); } // End mod by Rosali if (!isset($no_override['calendar_timeslots'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_timeslot'; $choices = array('1', '2', '3', '4', '6'); $select = new html_select(array('name' => '_timeslots', 'id' => $field_id)); $select->add($choices); $p['blocks']['view']['options']['timeslots'] = array('title' => html::label($field_id, Q($this->gettext('timeslots'))), 'content' => $select->show(strval($this->rc->config->get('calendar_timeslots', $this->defaults['calendar_timeslots'])))); } if (!isset($no_override['calendar_first_day'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_firstday'; $select = new html_select(array('name' => '_first_day', 'id' => $field_id)); $select->add(rcube_label('sunday'), '0'); $select->add(rcube_label('monday'), '1'); $select->add(rcube_label('tuesday'), '2'); $select->add(rcube_label('wednesday'), '3'); $select->add(rcube_label('thursday'), '4'); $select->add(rcube_label('friday'), '5'); $select->add(rcube_label('saturday'), '6'); $p['blocks']['view']['options']['first_day'] = array('title' => html::label($field_id, Q($this->gettext('first_day'))), 'content' => $select->show(strval($this->rc->config->get('calendar_first_day', $this->defaults['calendar_first_day'])))); } if (!isset($no_override['calendar_first_hour'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $time_format = $this->rc->config->get('time_format', libcalendaring::to_php_date_format($this->rc->config->get('calendar_time_format', $this->defaults['calendar_time_format']))); $select_hours = new html_select(); for ($h = 0; $h < 24; $h++) { $select_hours->add(date($time_format, mktime($h, 0, 0)), $h); } $field_id = 'rcmfd_firsthour'; $p['blocks']['view']['options']['first_hour'] = array('title' => html::label($field_id, Q($this->gettext('first_hour'))), 'content' => $select_hours->show($this->rc->config->get('calendar_first_hour', $this->defaults['calendar_first_hour']), array('name' => '_first_hour', 'id' => $field_id))); } if (!isset($no_override['calendar_work_start'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_workstart'; $p['blocks']['view']['options']['workinghours'] = array('title' => html::label($field_id, Q($this->gettext('workinghours'))), 'content' => $select_hours->show($this->rc->config->get('calendar_work_start', $this->defaults['calendar_work_start']), array('name' => '_work_start', 'id' => $field_id)) . ' — ' . $select_hours->show($this->rc->config->get('calendar_work_end', $this->defaults['calendar_work_end']), array('name' => '_work_end', 'id' => $field_id))); } if (!isset($no_override['calendar_event_coloring'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_coloring'; $select_colors = new html_select(array('name' => '_event_coloring', 'id' => $field_id)); $select_colors->add($this->gettext('coloringmode0'), 0); $select_colors->add($this->gettext('coloringmode1'), 1); $select_colors->add($this->gettext('coloringmode2'), 2); $select_colors->add($this->gettext('coloringmode3'), 3); $p['blocks']['view']['options']['eventcolors'] = array('title' => html::label($field_id . 'value', Q($this->gettext('eventcoloring'))), 'content' => $select_colors->show($this->rc->config->get('calendar_event_coloring', $this->defaults['calendar_event_coloring']))); } if (!isset($no_override['calendar_default_alarm_type'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_alarm'; $select_type = new html_select(array('name' => '_alarm_type', 'id' => $field_id)); $select_type->add($this->gettext('none'), ''); $types = array(); foreach ($this->get_drivers() as $driver) { foreach ($driver->alarm_types as $type) { $types[$type] = $type; } } foreach ($types as $type) { $select_type->add(rcube_label(strtolower("alarm{$type}option"), 'libcalendaring'), $type); } $p['blocks']['view']['options']['alarmtype'] = array('title' => html::label($field_id, Q($this->gettext('defaultalarmtype'))), 'content' => $select_type->show($this->rc->config->get('calendar_default_alarm_type', ''))); } if (!isset($no_override['calendar_default_alarm_offset'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_alarm'; $input_value = new html_inputfield(array('name' => '_alarm_value', 'id' => $field_id . 'value', 'size' => 3)); $select_offset = new html_select(array('name' => '_alarm_offset', 'id' => $field_id . 'offset')); foreach (array('-M', '-H', '-D', '+M', '+H', '+D') as $trigger) { $select_offset->add(rcube_label('trigger' . $trigger, 'libcalendaring'), $trigger); } $preset = libcalendaring::parse_alaram_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); $p['blocks']['view']['options']['alarmoffset'] = array('title' => html::label($field_id . 'value', Q($this->gettext('defaultalarmoffset'))), 'content' => $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1])); } if (!isset($no_override['calendar_default_calendar'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } // default calendar selection $field_id = 'rcmfd_default_calendar'; $select_cal = new html_select(array('name' => '_default_calendar', 'id' => $field_id, 'is_escaped' => true)); // Begin mod by Rosali (avoid duplicates if using common database tables - detect readonly - https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/34) $options = array(); foreach ($this->get_drivers() as $driver) { foreach ((array) $driver->list_calendars(false, true) as $id => $prop) { $options[$id] = array_merge((array) $prop, (array) $options[$id]); if ($prop['default']) { $default_calendar = $id; } } } foreach ($options as $id => $prop) { if ($prop['readonly'] != true) { $select_cal->add($prop['name'], strval($id)); } } // End mod by Rosali $p['blocks']['view']['options']['defaultcalendar'] = array('title' => html::label($field_id . 'value', Q($this->gettext('defaultcalendar'))), 'content' => $select_cal->show($this->rc->config->get('calendar_default_calendar', $default_calendar))); } // category definitions // TODO: Currently uses 'kolab' driver: This should be done for each driver, see preferences_save(). foreach ($this->get_drivers() as $driver) { if (!$driver->nocategories && !isset($no_override['calendar_categories'])) { $p['blocks']['categories']['name'] = $this->gettext('categories'); if (!$p['current']) { $p['blocks']['categories']['content'] = true; return $p; } $categories = (array) $driver->list_categories(); $categories_list = ''; foreach ($categories as $name => $color) { $key = md5($name); $field_class = 'rcmfd_category_' . str_replace(' ', '_', $name); $category_remove = new html_inputfield(array('type' => 'button', 'value' => 'X', 'class' => 'button', 'onclick' => '$(this).parent().remove()', 'title' => $this->gettext('remove_category'))); $category_name = new html_inputfield(array('name' => "_categories[{$key}]", 'class' => $field_class, 'size' => 30, 'disabled' => $driver->categoriesimmutable)); $category_color = new html_inputfield(array('name' => "_colors[{$key}]", 'class' => "{$field_class} colors", 'size' => 6)); $hidden = $driver->categoriesimmutable ? html::tag('input', array('type' => 'hidden', 'name' => "_categories[{$key}]", 'value' => $name)) : ''; $categories_list .= html::div(null, $hidden . $category_name->show($name) . ' ' . $category_color->show($color) . ' ' . $category_remove->show()); } $p['blocks']['categories']['options']['category_' . $name] = array('content' => html::div(array('id' => 'calendarcategories'), $categories_list)); $field_id = 'rcmfd_new_category'; $new_category = new html_inputfield(array('name' => '_new_category', 'id' => $field_id, 'size' => 30)); $add_category = new html_inputfield(array('type' => 'button', 'class' => 'button', 'value' => $this->gettext('add_category'), 'onclick' => "rcube_calendar_add_category()")); $p['blocks']['categories']['options']['categories'] = array('content' => $new_category->show('') . ' ' . $add_category->show()); $this->rc->output->add_script('function rcube_calendar_add_category(){ var name = $("#rcmfd_new_category").val(); if (name.length) { var input = $("<input>").attr("type", "text").attr("name", "_categories[]").attr("size", 30).val(name); var color = $("<input>").attr("type", "text").attr("name", "_colors[]").attr("size", 6).addClass("colors").val("000000"); var button = $("<input>").attr("type", "button").attr("value", "X").addClass("button").click(function(){ $(this).parent().remove() }); $("<div>").append(input).append(" ").append(color).append(" ").append(button).appendTo("#calendarcategories"); color.miniColors({ colorValues:(rcmail.env.mscolors || []) }); $("#rcmfd_new_category").val(""); } }'); $this->rc->output->add_script('$("#rcmfd_new_category").keypress(function(event){ if (event.which == 13) { rcube_calendar_add_category(); event.preventDefault(); } }); ', 'docready'); // include color picker $this->rc->output->add_header(html::tag('script', array('type' => 'text/javascript', 'src' => 'plugins/libgpl/calendar/lib/js/jquery.miniColors.min.js'))); $this->include_stylesheet($this->local_skin_path() . '/jquery.miniColors.css'); $this->rc->output->set_env('mscolors', $driver->get_color_values()); $this->rc->output->add_script('$("input.colors").miniColors({ colorValues:rcmail.env.mscolors })', 'docready'); } } return $p; }
/** * Template object for key import (upload) form */ function tpl_key_import_form($attrib) { $attrib += array('id' => 'rcmKeyImportForm'); $upload = new html_inputfield(array('type' => 'file', 'name' => '_file', 'id' => 'rcmimportfile', 'size' => 30)); $form = html::p(null, rcube::Q($this->enigma->gettext('keyimporttext'), 'show') . html::br() . html::br() . $upload->show()); $this->rc->output->add_label('selectimportfile', 'importwait'); $this->rc->output->add_gui_object('importform', $attrib['id']); $out = $this->rc->output->form_tag(array('action' => $this->rc->url(array('action' => $this->rc->action, 'a' => 'import')), 'method' => 'post', 'enctype' => 'multipart/form-data') + $attrib, $form); return $out; }
/** * Template object for key import (upload) form */ function tpl_key_import_form($attrib) { $attrib += array('id' => 'rcmKeyImportForm'); $upload = new html_inputfield(array('type' => 'file', 'name' => '_file', 'id' => 'rcmimportfile', 'size' => 30)); $search = new html_inputfield(array('type' => 'text', 'name' => '_search', 'id' => 'rcmimportsearch', 'size' => 30)); $upload_button = new html_inputfield(array('type' => 'button', 'value' => $this->rc->gettext('import'), 'class' => 'button', 'onclick' => "return rcmail.command('plugin.enigma-import','',this,event)")); $search_button = new html_inputfield(array('type' => 'button', 'value' => $this->rc->gettext('search'), 'class' => 'button', 'onclick' => "return rcmail.command('plugin.enigma-import-search','',this,event)")); $upload_form = html::div(null, rcube::Q($this->enigma->gettext('keyimporttext'), 'show') . html::br() . html::br() . $upload->show() . html::br() . html::br() . $upload_button->show()); $search_form = html::div(null, rcube::Q($this->enigma->gettext('keyimportsearchtext'), 'show') . html::br() . html::br() . $search->show() . html::br() . html::br() . $search_button->show()); $form = html::tag('fieldset', '', html::tag('legend', null, $this->enigma->gettext('keyimportlabel')) . $upload_form) . html::tag('fieldset', '', html::tag('legend', null, $this->enigma->gettext('keyimportsearchlabel')) . $search_form); $this->rc->output->add_label('selectimportfile', 'importwait', 'nopubkeyfor', 'nopubkeyforsender', 'encryptnoattachments', 'encryptedsendialog', 'searchpubkeyservers', 'importpubkeys', 'encryptpubkeysfound', 'search', 'close', 'import', 'keyid', 'keylength', 'keyexpired', 'keyrevoked', 'keyimportsuccess', 'keyservererror'); $this->rc->output->add_gui_object('importform', $attrib['id']); $this->rc->output->include_script('publickey.js'); $out = $this->rc->output->form_tag(array('action' => $this->rc->url(array('action' => $this->rc->action, 'a' => 'import')), 'method' => 'post', 'enctype' => 'multipart/form-data') + $attrib, $form); return $out; }
/** * Handler for preferences_list hook. * Adds options blocks into Calendar settings sections in Preferences. * * @param array Original parameters * @return array Modified parameters */ function preferences_list($p) { if ($p['section'] != 'calendar') { return $p; } $no_override = array_flip((array) $this->rc->config->get('dont_override')); $p['blocks']['view']['name'] = $this->gettext('mainoptions'); if (!isset($no_override['calendar_default_view'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_default_view'; $select = new html_select(array('name' => '_default_view', 'id' => $field_id)); $select->add($this->gettext('day'), "agendaDay"); $select->add($this->gettext('week'), "agendaWeek"); $select->add($this->gettext('month'), "month"); $select->add($this->gettext('agenda'), "table"); $p['blocks']['view']['options']['default_view'] = array('title' => html::label($field_id, rcube::Q($this->gettext('default_view'))), 'content' => $select->show($this->rc->config->get('calendar_default_view', $this->defaults['calendar_default_view']))); } if (!isset($no_override['calendar_timeslots'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_timeslot'; $choices = array('1', '2', '3', '4', '6'); $select = new html_select(array('name' => '_timeslots', 'id' => $field_id)); $select->add($choices); $p['blocks']['view']['options']['timeslots'] = array('title' => html::label($field_id, rcube::Q($this->gettext('timeslots'))), 'content' => $select->show(strval($this->rc->config->get('calendar_timeslots', $this->defaults['calendar_timeslots'])))); } if (!isset($no_override['calendar_first_day'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_firstday'; $select = new html_select(array('name' => '_first_day', 'id' => $field_id)); $select->add($this->gettext('sunday'), '0'); $select->add($this->gettext('monday'), '1'); $select->add($this->gettext('tuesday'), '2'); $select->add($this->gettext('wednesday'), '3'); $select->add($this->gettext('thursday'), '4'); $select->add($this->gettext('friday'), '5'); $select->add($this->gettext('saturday'), '6'); $p['blocks']['view']['options']['first_day'] = array('title' => html::label($field_id, rcube::Q($this->gettext('first_day'))), 'content' => $select->show(strval($this->rc->config->get('calendar_first_day', $this->defaults['calendar_first_day'])))); } if (!isset($no_override['calendar_first_hour'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $time_format = $this->rc->config->get('time_format', libcalendaring::to_php_date_format($this->rc->config->get('calendar_time_format', $this->defaults['calendar_time_format']))); $select_hours = new html_select(); for ($h = 0; $h < 24; $h++) { $select_hours->add(date($time_format, mktime($h, 0, 0)), $h); } $field_id = 'rcmfd_firsthour'; $p['blocks']['view']['options']['first_hour'] = array('title' => html::label($field_id, rcube::Q($this->gettext('first_hour'))), 'content' => $select_hours->show($this->rc->config->get('calendar_first_hour', $this->defaults['calendar_first_hour']), array('name' => '_first_hour', 'id' => $field_id))); } if (!isset($no_override['calendar_work_start'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_workstart'; $p['blocks']['view']['options']['workinghours'] = array('title' => html::label($field_id, rcube::Q($this->gettext('workinghours'))), 'content' => $select_hours->show($this->rc->config->get('calendar_work_start', $this->defaults['calendar_work_start']), array('name' => '_work_start', 'id' => $field_id)) . ' — ' . $select_hours->show($this->rc->config->get('calendar_work_end', $this->defaults['calendar_work_end']), array('name' => '_work_end', 'id' => $field_id))); } if (!isset($no_override['calendar_event_coloring'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $field_id = 'rcmfd_coloring'; $select_colors = new html_select(array('name' => '_event_coloring', 'id' => $field_id)); $select_colors->add($this->gettext('coloringmode0'), 0); $select_colors->add($this->gettext('coloringmode1'), 1); $select_colors->add($this->gettext('coloringmode2'), 2); $select_colors->add($this->gettext('coloringmode3'), 3); $p['blocks']['view']['options']['eventcolors'] = array('title' => html::label($field_id . 'value', rcube::Q($this->gettext('eventcoloring'))), 'content' => $select_colors->show($this->rc->config->get('calendar_event_coloring', $this->defaults['calendar_event_coloring']))); } // loading driver is expensive, don't do it if not needed $this->load_driver(); if (!isset($no_override['calendar_default_alarm_type']) || !isset($no_override['calendar_default_alarm_offset'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } $alarm_type = $alarm_offset = ''; if (!isset($no_override['calendar_default_alarm_type'])) { $field_id = 'rcmfd_alarm'; $select_type = new html_select(array('name' => '_alarm_type', 'id' => $field_id)); $select_type->add($this->gettext('none'), ''); foreach ($this->driver->alarm_types as $type) { $select_type->add($this->rc->gettext(strtolower("alarm{$type}option"), 'libcalendaring'), $type); } $alarm_type = $select_type->show($this->rc->config->get('calendar_default_alarm_type', '')); } if (!isset($no_override['calendar_default_alarm_offset'])) { $field_id = 'rcmfd_alarm'; $input_value = new html_inputfield(array('name' => '_alarm_value', 'id' => $field_id . 'value', 'size' => 3)); $select_offset = new html_select(array('name' => '_alarm_offset', 'id' => $field_id . 'offset')); foreach (array('-M', '-H', '-D', '+M', '+H', '+D') as $trigger) { $select_offset->add($this->rc->gettext('trigger' . $trigger, 'libcalendaring'), $trigger); } $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_default_alarm_offset', '-15M')); $alarm_offset = $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1]); } $p['blocks']['view']['options']['alarmtype'] = array('title' => html::label($field_id, rcube::Q($this->gettext('defaultalarmtype'))), 'content' => $alarm_type . ' ' . $alarm_offset); } if (!isset($no_override['calendar_default_calendar'])) { if (!$p['current']) { $p['blocks']['view']['content'] = true; return $p; } // default calendar selection $field_id = 'rcmfd_default_calendar'; $select_cal = new html_select(array('name' => '_default_calendar', 'id' => $field_id, 'is_escaped' => true)); foreach ((array) $this->driver->list_calendars(calendar_driver::FILTER_PERSONAL) as $id => $prop) { $select_cal->add($prop['name'], strval($id)); if ($prop['default']) { $default_calendar = $id; } } $p['blocks']['view']['options']['defaultcalendar'] = array('title' => html::label($field_id . 'value', rcube::Q($this->gettext('defaultcalendar'))), 'content' => $select_cal->show($this->rc->config->get('calendar_default_calendar', $default_calendar))); } $p['blocks']['itip']['name'] = $this->gettext('itipoptions'); // Invitations handling if (!isset($no_override['calendar_itip_after_action'])) { if (!$p['current']) { $p['blocks']['itip']['content'] = true; return $p; } $field_id = 'rcmfd_after_action'; $select = new html_select(array('name' => '_after_action', 'id' => $field_id, 'onchange' => "\$('#{$field_id}_select')[this.value == 4 ? 'show' : 'hide']()")); $select->add($this->gettext('afternothing'), ''); $select->add($this->gettext('aftertrash'), 1); $select->add($this->gettext('afterdelete'), 2); $select->add($this->gettext('afterflagdeleted'), 3); $select->add($this->gettext('aftermoveto'), 4); $val = $this->rc->config->get('calendar_itip_after_action', $this->defaults['calendar_itip_after_action']); if ($val !== null && $val !== '' && !is_int($val)) { $folder = $val; $val = 4; } $folders = $this->rc->folder_selector(array('id' => $field_id . '_select', 'name' => '_after_action_folder', 'maxlength' => 30, 'folder_filter' => 'mail', 'folder_rights' => 'w', 'style' => $val !== 4 ? 'display:none' : '')); $p['blocks']['itip']['options']['after_action'] = array('title' => html::label($field_id, rcube::Q($this->gettext('afteraction'))), 'content' => $select->show($val) . $folders->show($folder)); } // category definitions if (!$this->driver->nocategories && !isset($no_override['calendar_categories'])) { $p['blocks']['categories']['name'] = $this->gettext('categories'); if (!$p['current']) { $p['blocks']['categories']['content'] = true; return $p; } $categories = (array) $this->driver->list_categories(); $categories_list = ''; foreach ($categories as $name => $color) { $key = md5($name); $field_class = 'rcmfd_category_' . str_replace(' ', '_', $name); $category_remove = new html_inputfield(array('type' => 'button', 'value' => 'X', 'class' => 'button', 'onclick' => '$(this).parent().remove()', 'title' => $this->gettext('remove_category'))); $category_name = new html_inputfield(array('name' => "_categories[{$key}]", 'class' => $field_class, 'size' => 30, 'disabled' => $this->driver->categoriesimmutable)); $category_color = new html_inputfield(array('name' => "_colors[{$key}]", 'class' => "{$field_class} colors", 'size' => 6)); $hidden = $this->driver->categoriesimmutable ? html::tag('input', array('type' => 'hidden', 'name' => "_categories[{$key}]", 'value' => $name)) : ''; $categories_list .= html::div(null, $hidden . $category_name->show($name) . ' ' . $category_color->show($color) . ' ' . $category_remove->show()); } $p['blocks']['categories']['options']['category_' . $name] = array('content' => html::div(array('id' => 'calendarcategories'), $categories_list)); $field_id = 'rcmfd_new_category'; $new_category = new html_inputfield(array('name' => '_new_category', 'id' => $field_id, 'size' => 30)); $add_category = new html_inputfield(array('type' => 'button', 'class' => 'button', 'value' => $this->gettext('add_category'), 'onclick' => "rcube_calendar_add_category()")); $p['blocks']['categories']['options']['categories'] = array('content' => $new_category->show('') . ' ' . $add_category->show()); $this->rc->output->add_script('function rcube_calendar_add_category(){ var name = $("#rcmfd_new_category").val(); if (name.length) { var input = $("<input>").attr("type", "text").attr("name", "_categories[]").attr("size", 30).val(name); var color = $("<input>").attr("type", "text").attr("name", "_colors[]").attr("size", 6).addClass("colors").val("000000"); var button = $("<input>").attr("type", "button").attr("value", "X").addClass("button").click(function(){ $(this).parent().remove() }); $("<div>").append(input).append(" ").append(color).append(" ").append(button).appendTo("#calendarcategories"); color.miniColors({ colorValues:(rcmail.env.mscolors || []) }); $("#rcmfd_new_category").val(""); } }'); $this->rc->output->add_script('$("#rcmfd_new_category").keypress(function(event){ if (event.which == 13) { rcube_calendar_add_category(); event.preventDefault(); } }); ', 'docready'); // load miniColors js/css files jqueryui::miniColors(); } // virtual birthdays calendar if (!isset($no_override['calendar_contact_birthdays'])) { $p['blocks']['birthdays']['name'] = $this->gettext('birthdayscalendar'); if (!$p['current']) { $p['blocks']['birthdays']['content'] = true; return $p; } $field_id = 'rcmfd_contact_birthdays'; $input = new html_checkbox(array('name' => '_contact_birthdays', 'id' => $field_id, 'value' => 1, 'onclick' => '$(".calendar_birthday_props").prop("disabled",!this.checked)')); $p['blocks']['birthdays']['options']['contact_birthdays'] = array('title' => html::label($field_id, $this->gettext('displaybirthdayscalendar')), 'content' => $input->show($this->rc->config->get('calendar_contact_birthdays') ? 1 : 0)); $input_attrib = array('class' => 'calendar_birthday_props', 'disabled' => !$this->rc->config->get('calendar_contact_birthdays')); $sources = array(); $checkbox = new html_checkbox(array('name' => '_birthday_adressbooks[]') + $input_attrib); foreach ($this->rc->get_address_sources(false, true) as $source) { $active = in_array($source['id'], (array) $this->rc->config->get('calendar_birthday_adressbooks', array())) ? $source['id'] : ''; $sources[] = html::label(null, $checkbox->show($active, array('value' => $source['id'])) . ' ' . rcube::Q($source['realname'] ?: $source['name'])); } $p['blocks']['birthdays']['options']['birthday_adressbooks'] = array('title' => rcube::Q($this->gettext('birthdayscalendarsources')), 'content' => join(html::br(), $sources)); $field_id = 'rcmfd_birthdays_alarm'; $select_type = new html_select(array('name' => '_birthdays_alarm_type', 'id' => $field_id) + $input_attrib); $select_type->add($this->gettext('none'), ''); foreach ($this->driver->alarm_types as $type) { $select_type->add($this->rc->gettext(strtolower("alarm{$type}option"), 'libcalendaring'), $type); } $input_value = new html_inputfield(array('name' => '_birthdays_alarm_value', 'id' => $field_id . 'value', 'size' => 3) + $input_attrib); $select_offset = new html_select(array('name' => '_birthdays_alarm_offset', 'id' => $field_id . 'offset') + $input_attrib); foreach (array('-M', '-H', '-D') as $trigger) { $select_offset->add($this->rc->gettext('trigger' . $trigger, 'libcalendaring'), $trigger); } $preset = libcalendaring::parse_alarm_value($this->rc->config->get('calendar_birthdays_alarm_offset', '-1D')); $p['blocks']['birthdays']['options']['birthdays_alarmoffset'] = array('title' => html::label($field_id . 'value', rcube::Q($this->gettext('showalarms'))), 'content' => $select_type->show($this->rc->config->get('calendar_birthdays_alarm_type', '')) . ' ' . $input_value->show($preset[0]) . ' ' . $select_offset->show($preset[1])); } return $p; }
function render_box($p) { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); if (!$attrib['id']) { $attrib['id'] = 'bounce-box'; $attrib['class'] = 'popupmenu'; } $button = new html_inputfield(array('type' => 'button')); $submit = new html_inputfield(array('type' => 'submit')); $table = new html_table(array('cols' => 2, 'id' => 'form')); $table->add('title', html::label('_to', Q(rcube_label('to')))); $table->add('editfield', html::tag('textarea', array('spellcheck' => 'false', 'id' => '_to', 'name' => '_to', 'cols' => '50', 'rows' => '2', 'tabindex' => '2', 'class' => 'editfield', 'onclick' => 'select_field(this)'))); $table->set_row_attribs(array('id' => 'compose-cc')); $table->add('title', html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.hide_header_form(\'cc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . ' ' . html::label('_cc', Q(rcube_label('cc')))); $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_cc', 'name' => '_cc', 'cols' => '50', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)'))); $table->set_row_attribs(array('id' => 'compose-bcc')); $table->add('title', html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.hide_header_form(\'bcc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . ' ' . html::label('_bcc', Q(rcube_label('bcc')))); $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_bcc', 'cols' => '50', 'name' => '_bcc', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)'))); $table->add(null, null); $table->add(formlinks, html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.show_header_form(\'cc\')', 'id' => 'cc-link'), Q(rcube_label('addcc'))) . '<span class="separator">|</span>' . html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.show_header_form(\'bcc\')', 'id' => 'bcc-link'), Q(rcube_label('addbcc')))); $target_url = $_SERVER['REQUEST_URI']; $rcmail->output->add_footer(html::div($attrib, $rcmail->output->form_tag(array('name' => 'bounceform', 'method' => 'post', 'action' => './', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => "hidden", 'name' => '_action', 'value' => 'bounce')) . html::div('bounce-title', Q($this->gettext('bouncemessage'))) . html::div('bounce-body', $table->show() . html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "\$('#{$attrib['id']}').hide()")) . ' ' . $button->show(Q($this->gettext('bounce')), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('plugin.bounce.send', this.bounceform)"))))))); $rcmail->output->add_label('norecipientwarning'); $rcmail->output->add_gui_object('bouncebox', $attrib['id']); $rcmail->output->add_gui_object('bounceform', 'bounceform'); $this->include_stylesheet('bounce.css'); $rcmail->output->set_env('autocomplete_min_length', $rcmail->config->get('autocomplete_min_length')); $rcmail->output->add_gui_object('messageform', 'bounceform'); }
/** * Generate the form for recurrence settings */ public function recurrence_form($attrib = array()) { switch ($attrib['part']) { // frequency selector case 'frequency': $select = new html_select(array('name' => 'frequency', 'id' => 'edit-recurrence-frequency')); $select->add($this->gettext('never'), ''); $select->add($this->gettext('daily'), 'DAILY'); $select->add($this->gettext('weekly'), 'WEEKLY'); $select->add($this->gettext('monthly'), 'MONTHLY'); $select->add($this->gettext('yearly'), 'YEARLY'); $select->add($this->gettext('rdate'), 'RDATE'); $html = html::label('edit-recurrence-frequency', $this->gettext('frequency')) . $select->show(''); break; // daily recurrence // daily recurrence case 'daily': $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-daily')); $html = html::div($attrib, html::label('edit-recurrence-interval-daily', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('days'))); break; // weekly recurrence form // weekly recurrence form case 'weekly': $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-weekly')); $html = html::div($attrib, html::label('edit-recurrence-interval-weekly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('weeks'))); // weekday selection $daymap = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'); $checkbox = new html_checkbox(array('name' => 'byday', 'class' => 'edit-recurrence-weekly-byday')); $first = $this->rc->config->get('calendar_first_day', 1); for ($weekdays = '', $j = $first; $j <= $first + 6; $j++) { $d = $j % 7; $weekdays .= html::label(array('class' => 'weekday'), $checkbox->show('', array('value' => strtoupper(substr($daymap[$d], 0, 2)))) . $this->gettext($daymap[$d])) . ' '; } $html .= html::div($attrib, html::label(null, $this->gettext('bydays')) . $weekdays); break; // monthly recurrence form // monthly recurrence form case 'monthly': $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-monthly')); $html = html::div($attrib, html::label('edit-recurrence-interval-monthly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('months'))); $checkbox = new html_checkbox(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday')); for ($monthdays = '', $d = 1; $d <= 31; $d++) { $monthdays .= html::label(array('class' => 'monthday'), $checkbox->show('', array('value' => $d)) . $d); $monthdays .= $d % 7 ? ' ' : html::br(); } // rule selectors $radio = new html_radiobutton(array('name' => 'repeatmode', 'class' => 'edit-recurrence-monthly-mode')); $table = new html_table(array('cols' => 2, 'border' => 0, 'cellpadding' => 0, 'class' => 'formtable')); $table->add('label', html::label(null, $radio->show('BYMONTHDAY', array('value' => 'BYMONTHDAY')) . ' ' . $this->gettext('each'))); $table->add(null, $monthdays); $table->add('label', html::label(null, $radio->show('', array('value' => 'BYDAY')) . ' ' . $this->gettext('onevery'))); $table->add(null, $this->rrule_selectors($attrib['part'])); $html .= html::div($attrib, $table->show()); break; // annually recurrence form // annually recurrence form case 'yearly': $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-yearly')); $html = html::div($attrib, html::label('edit-recurrence-interval-yearly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('years'))); // month selector $monthmap = array('', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); $checkbox = new html_checkbox(array('name' => 'bymonth', 'class' => 'edit-recurrence-yearly-bymonth')); for ($months = '', $m = 1; $m <= 12; $m++) { $months .= html::label(array('class' => 'month'), $checkbox->show(null, array('value' => $m)) . $this->gettext($monthmap[$m])); $months .= $m % 4 ? ' ' : html::br(); } $html .= html::div($attrib + array('id' => 'edit-recurrence-yearly-bymonthblock'), $months); // day rule selection $html .= html::div($attrib, html::label(null, $this->gettext('onevery')) . $this->rrule_selectors($attrib['part'], '---')); break; // end of recurrence form // end of recurrence form case 'until': $radio = new html_radiobutton(array('name' => 'repeat', 'class' => 'edit-recurrence-until')); $select = $this->interval_selector(array('name' => 'times', 'id' => 'edit-recurrence-repeat-times')); $input = new html_inputfield(array('name' => 'untildate', 'id' => 'edit-recurrence-enddate', 'size' => "10")); $html = html::div('line first', html::label(null, $radio->show('', array('value' => '', 'id' => 'edit-recurrence-repeat-forever')) . ' ' . $this->gettext('forever'))); $forntimes = $this->gettext(array('name' => 'forntimes', 'vars' => array('nr' => '%s'))); $html .= html::div('line', $radio->show('', array('value' => 'count', 'id' => 'edit-recurrence-repeat-count', 'aria-label' => sprintf($forntimes, 'N'))) . ' ' . sprintf($forntimes, $select->show(1))); $html .= html::div('line', $radio->show('', array('value' => 'until', 'id' => 'edit-recurrence-repeat-until', 'aria-label' => $this->gettext('untilenddate'))) . ' ' . $this->gettext('untildate') . ' ' . $input->show('', array('aria-label' => $this->gettext('untilenddate')))); $html = html::div($attrib, html::label(null, ucfirst($this->gettext('recurrencend'))) . $html); break; case 'rdate': $ul = html::tag('ul', array('id' => 'edit-recurrence-rdates'), ''); $input = new html_inputfield(array('name' => 'rdate', 'id' => 'edit-recurrence-rdate-input', 'size' => "10")); $button = new html_inputfield(array('type' => 'button', 'class' => 'button add', 'value' => $this->gettext('addrdate'))); $html .= html::div($attrib, $ul . html::div('inputform', $input->show() . $button->show())); break; } return $html; }
/** * GUI object 'searchform' for the resource finder dialog * * @param array Named parameters * @return string HTML code for the gui object */ function resources_search_form($attrib) { $attrib += array('command' => 'search-resource', 'id' => 'rcmcalresqsearchbox', 'autocomplete' => 'off'); $attrib['name'] = '_q'; $input_q = new html_inputfield($attrib); $out = $input_q->show(); // add form tag around text field $out = $this->rc->output->form_tag(array('name' => "rcmcalresoursqsearchform", 'onsubmit' => rcmail_output::JS_OBJECT_NAME . ".command('" . $attrib['command'] . "'); return false", 'style' => "display:inline"), $out); return $out; }
/** * GUI object 'searchform' * Returns code for search function * * @param array Named parameters * @return string HTML code for the gui object */ protected function search_form($attrib) { // add some labels to client $this->add_label('searching'); $attrib['name'] = '_q'; if (empty($attrib['id'])) { $attrib['id'] = 'rcmqsearchbox'; } if ($attrib['type'] == 'search' && !$this->browser->khtml) { unset($attrib['type'], $attrib['results']); } $input_q = new html_inputfield($attrib); $out = $input_q->show(); $this->add_gui_object('qsearchbox', $attrib['id']); // add form tag around text field if (empty($attrib['form'])) { $out = $this->form_tag(array('name' => "rcmqsearchform", 'onsubmit' => self::JS_OBJECT_NAME . ".command('search'); return false", 'style' => "display:inline"), $out); } return $out; }
function accounts_form_content($email = "", $username = "", $password = "", $server = "", $port = "", $useSSL = 'none', $leave_a_copy = true, $provider = "", $default_folder = "", $show_import_old_messages_option = true) { $rcmail = rcmail::get_instance(); $this->include_script('pop3fetcher_providers.js'); // 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 $user = $rcmail->user->data['username']; if ($_SESSION['global_alias']) { $user = $_SESSION['global_alias']; } if ($email != "") { $out .= '<fieldset><legend>' . $email . ' ::: ' . $user . '</legend>' . "\n"; } else { $out .= '<fieldset>' . "\n"; } $out .= '<br />' . "\n"; $out .= '<table' . $attrib_str . ">\n"; //<script type=\"text/javascript\">console.log(providers['gmail.com']);</script> $field_id = 'pop3fetcher_email'; $input_pop3fetcher_email = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_email', 'id' => $field_id, 'size' => 30)); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_email')), $input_pop3fetcher_email->show($email)); $field_id = 'pop3fetcher_username'; $input_pop3fetcher_username = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_username', 'id' => $field_id, 'size' => 30)); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_username')), $input_pop3fetcher_username->show($username)); $field_id = 'pop3fetcher_password'; $input_pop3fetcher_password = new html_passwordfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_password', 'id' => $field_id, 'size' => 30)); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_password')), $input_pop3fetcher_password->show($password)); $field_id = 'pop3fetcher_provider'; $input_pop3fetcher_provider = new html_select(array('name' => '_pop3fetcher_provider', 'id' => $field_id)); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_provider')), $input_pop3fetcher_provider->show()); $field_id = 'pop3fetcher_serveraddress'; $input_pop3fetcher_serveraddress = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serveraddress', 'id' => $field_id, 'size' => 30)); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serveraddress')), $input_pop3fetcher_serveraddress->show($server)); $field_id = 'pop3fetcher_serverport'; $input_pop3fetcher_serverport = new html_inputfield(array('autocomplete' => 'off', 'name' => '_pop3fetcher_serverport', 'id' => $field_id, 'size' => 10)); $field_id2 = 'pop3fetcher_ssl'; $input_pop3fetcher_ssl = new html_select(array('name' => '_pop3fetcher_ssl', 'id' => $field_id2)); $input_pop3fetcher_ssl->add('none', ''); $input_pop3fetcher_ssl->add('tls', 'tls'); $input_pop3fetcher_ssl->add('ssl', 'ssl'); $input_pop3fetcher_ssl->add('sslv2', 'sslv2'); $input_pop3fetcher_ssl->add('sslv3', 'sslv3'); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_serverport')), $input_pop3fetcher_serverport->show($port), $field_id2, rep_specialchars_output($this->gettext('account_usessl')), $input_pop3fetcher_ssl->show($useSSL)); $field_id = 'pop3fetcher_leaveacopy'; $input_pop3fetcher_leaveacopy = new html_checkbox(array('name' => '_pop3fetcher_leaveacopy', 'id' => $field_id)); $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_leaveacopy')), $input_pop3fetcher_leaveacopy->show($leave_a_copy ? false : true)); // QUESTA COSA E' STRANA MA FUNZIONA... // SET TARGET DEFAULT FOLDER $field_id = 'pop3fetcher_defaultfolder'; $this->rcmail->imap_connect(); // get mailbox list $a_folders = $rcmail->imap->list_folders(); $delimiter = $rcmail->imap->get_hierarchy_delimiter(); $a_mailboxes = array(); $custom_folder_name = $this->config["root_folder_path"] . $delimiter . str_replace($delimiter, "_", $email); $found = false; foreach ($a_folders as $ifolder) { if ($ifolder == $custom_folder_name) { $found = true; } rcmail_build_folder_tree($a_mailboxes, $ifolder, $delimiter); } $input_folderlist = new html_select(array('name' => '_pop3fetcher_defaultfolder', 'id' => $field_id)); rcmail_render_folder_tree_select($a_mailboxes, $field_id, 100, $input_folderlist, false); if (!$found && $default_folder != "" && $default_folder != $custom_folder_name) { $input_folderlist->add(str_replace($delimiter, "_", $email), "#AUTO_FOLDER#"); } //$input_folderlist->add('create new folder', 'create_new_folder'); $out .= sprintf("<tr><td valign=\"middle\" class=\"title\"><label for=\"%s\">%s</label>:</td><td colspan=\"3\">%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_default_folder')), $input_folderlist->show($default_folder)); $field_id = 'pop3fetcher_testconnection'; $input_pop3fetcher_testconnection = new html_checkbox(array('name' => '_pop3fetcher_testconnection', 'id' => $field_id)); $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('test_connection_on_save')), $input_pop3fetcher_testconnection->show(false)); // QUESTA COSA E' STRANA MA FUNZIONA... if ($show_import_old_messages_option) { $field_id = 'pop3fetcher_import_old_messages'; $input_pop3fetcher_import_old_messages = new html_checkbox(array('name' => '_pop3fetcher_import_old_messages', 'id' => $field_id)); $out .= sprintf("<tr><td valign=\"middle\" colspan=\"3\" class=\"title\"><label for=\"%s\">%s</label>:</td><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('account_import_old_messages')), $input_pop3fetcher_import_old_messages->show(true)); // QUESTA COSA E' STRANA MA FUNZIONA... } $out .= "\n</table>"; $out .= '<br />' . "\n"; $out .= "</fieldset>\n"; $out .= "<script type='text/javascript'>\n\t\t\t\tvar delimiter = '" . $delimiter . "';\n\t\t\t\tvar root_folder_path = '" . $this->config["root_folder_path"] . "';\n\t\t\t\tload_pop3_providers('" . $provider . "');\n\t\t\t\t\$('#pop3fetcher_email').keyup(\n\t\t\t\t\tfunction(){update_default_folder_name(\$(this).val());}\n\t\t\t\t);\n\t\t\t</script>"; return $out; }
/** * Create an edit field for inclusion on a form * * @param string col field name * @param string value field value * @param array attrib HTML element attributes for field * @param string type HTML element type (default 'text') * * @return string HTML field definition */ public static function get_edit_field($col, $value, $attrib, $type = 'text') { static $colcounts = array(); $fname = '_' . $col; $attrib['name'] = $fname . ($attrib['array'] ? '[]' : ''); $attrib['class'] = trim($attrib['class'] . ' ff_' . $col); if ($type == 'checkbox') { $attrib['value'] = '1'; $input = new html_checkbox($attrib); } else { if ($type == 'textarea') { $attrib['cols'] = $attrib['size']; $input = new html_textarea($attrib); } else { if ($type == 'select') { $input = new html_select($attrib); $input->add('---', ''); $input->add(array_values($attrib['options']), array_keys($attrib['options'])); } else { if ($attrib['type'] == 'password') { $input = new html_passwordfield($attrib); } else { if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') { $attrib['type'] = 'text'; } $input = new html_inputfield($attrib); } } } } // use value from post if (isset($_POST[$fname])) { $postvalue = self::get_input_value($fname, self::INPUT_POST, true); $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue; } $out = $input->show($value); return $out; }
/** * 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; }