function template_object_identityform($args) { if ($this->rcmail_inst->config->get('identity_limit') === true) { $emails = new html_select(array('name' => '_email', 'id' => 'rcmfd_email', 'class' => 'ff_email')); 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'])); $alias = $this->soap->mail_alias_get($session_id, array('destination' => $mail_user[0]['email'], 'type' => 'alias', 'active' => 'y')); $this->soap->logout($session_id); $emails->add($mail_user[0]['email'], $mail_user[0]['email']); for ($i = 0; $i < count($alias); $i++) { $emails->add($alias[$i]['source'], $alias[$i]['source']); } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } if (version_compare(RCMAIL_VERSION, '0.7.0') <= 0) { preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $args['content'], $test); $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\" \\/>/', $emails->show($test[1]), $args['content']); } else { preg_match('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $args['content'], $test); $args['content'] = preg_replace('/<input type=\\"text\\" size=\\"40\\" id=\\"rcmfd_email\\" name=\\"_email\\" class=\\"ff_email\\" value=\\"(.*)\\">/', $emails->show($test[1]), $args['content']); } } return $args; }
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, 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, Q($this->gettext('onlynew'))), 'content' => $content); $field_id .= '_excluded'; $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id)); $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . '')); $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });"); } return $args; }
function settings_table($args) { if ($args['section'] == 'mailbox') { $a_list_cols = rcmail::get_instance()->config->get('list_cols'); $args['blocks']['roworder']['name'] = Q($this->gettext('roworder', 'msglistcols')); for ($i = 0; $i < 9; $i++) { $field_id = 'rcmfd_list_col' . $i; $select_col = new html_select(array('name' => '_list_cols[]', 'id' => $field_id)); $select_col->add(rcube_label('skip', 'msglistcols'), ''); $select_col->add(rcube_label('subject'), 'subject'); $select_col->add(rcube_label('from'), 'from'); $select_col->add(rcube_label('to'), 'to'); $select_col->add(rcube_label('cc'), 'cc'); $select_col->add(rcube_label('replyto'), 'replyto'); $select_col->add(rcube_label('date'), 'date'); $select_col->add(rcube_label('size'), 'size'); $select_col->add(rcube_label('flagged', 'msglistcols'), 'flag'); $select_col->add(rcube_label('attachment', 'msglistcols'), 'attachment'); $args['blocks']['roworder']['options']['listcol_' . $i]['title'] = Q($this->gettext('list_col_' . $i, 'msglistcols')); if (!empty($a_list_cols[$i])) { $selected = $a_list_cols[$i]; } else { $selected = ""; } $args['blocks']['roworder']['options']['listcol_' . $i]['content'] = $select_col->show($selected); unset($select_col); } } return $args; }
function show_settings($args) { if ($args['section'] == 'mailbox') { $this->add_texts('localization/'); $field_id = 'rcmfd_previewpane_layout'; $select = new html_select(array('name' => '_previewpane_layout', 'id' => $field_id)); $select->add(rcmail::Q($this->gettext('threecol.none')), 'none'); $select->add(rcmail::Q($this->gettext('threecol.below')), 'below'); $select->add(rcmail::Q($this->gettext('threecol.right')), 'right'); // add new option at the top of the list $val = rcube::get_instance()->config->get('preview_pane') ? rcube::get_instance()->config->get('previewpane_layout', 'below') : 'none'; $args['blocks']['main']['options']['preview_pane']['content'] = $select->show($val); } return $args; }
/** * Handler for user preferences form (preferences_list hook) */ function prefs_list($args) { if ($args['section'] != 'mailbox') { return $args; } // Load configuration $this->load_config(); // Load localization and configuration $this->add_texts('localization/'); if (!empty($_REQUEST['_framed'])) { $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.testbody', 'newmail_notifier.desktopunsupported', 'newmail_notifier.desktopenabled', 'newmail_notifier.desktopdisabled'); $this->include_script('newmail_notifier.js'); } // Check that configuration is not disabled $dont_override = (array) $this->rc->config->get('dont_override', array()); foreach (array('basic', 'desktop', 'sound') as $type) { $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1)); $content = $input->show($this->rc->config->get($key)) . ' ' . html::a(array('href' => '#', 'onclick' => 'newmail_notifier_test_' . $type . '()'), $this->gettext('test')); $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($type))), 'content' => $content); } } $type = 'desktop_timeout'; $key = 'newmail_notifier_' . $type; if (!in_array($key, $dont_override)) { $field_id = '_' . $key; $select = new html_select(array('name' => $field_id, 'id' => $field_id)); foreach (array(5, 10, 15, 30, 45, 60) as $sec) { $label = $this->rc->gettext(array('name' => 'afternseconds', 'vars' => array('n' => $sec))); $select->add($label, $sec); } $args['blocks']['new_message']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext('desktoptimeout'))), 'content' => $select->show((int) $this->rc->config->get($key))); } return $args; }
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; }
function veximaccountadmin_form() { $rcmail = rcmail::get_instance(); $this->_load_config(); // add labels to client - to be used in JS alerts $rcmail->output->add_label('veximaccountadmin.enterallpassfields', 'veximaccountadmin.passwordinconsistency', 'veximaccountadmin.autoresponderlong', 'veximaccountadmin.autoresponderlongnum', 'veximaccountadmin.autoresponderlongmax', 'veximaccountadmin.headerblockdelete', 'veximaccountadmin.headerblockdeleteall', 'veximaccountadmin.headerblockexists', 'veximaccountadmin.headerblockentervalue'); $rcmail->output->set_env('product_name', $rcmail->config->get('product_name')); $settings = $this->_get_configuration(); $on_avscan = $settings['on_avscan']; $on_spamassassin = $settings['on_spamassassin']; $sa_tag = $settings['sa_tag']; $sa_refuse = $settings['sa_refuse']; $spam_drop = $settings['spam_drop']; $on_vacation = $settings['on_vacation']; $vacation = $settings['vacation']; $on_forward = $settings['on_forward']; $forward = $settings['forward']; $unseen = $settings['unseen']; $maxmsgsize = $settings['maxmsgsize']; $user_id = $settings['user_id']; $domain_id = $settings['domain_id']; $domain_settings = $this->_get_domain_configuration($domain_id); $default_sa_tag = $domain_settings['sa_tag']; $default_sa_refuse = $domain_settings['sa_refuse']; $default_maxmsgsize = $domain_settings['maxmsgsize']; $active_domain = $domain_settings['domain']; $rcmail->output->set_env('vacation_maxlength', $this->config['vexim_vacation_maxlength']); $out .= '<p class="introtext">' . $this->gettext('introtext') . '</p>' . "\n"; if ($this->config['show_admin_link'] == true and $settings['admin'] == true) { $out .= '<p class="adminlink">'; $out .= sprintf($this->gettext('adminlinktext'), '<a href="' . $this->config['vexim_url'] . '" target="_blank">', '</a>'); $out .= "</p>\n"; } // ===================================================================================================== // Password $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('passwordcurrentexplanation') . '</p>'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'curpasswd'; $input_passwordcurrent = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordcurrent')), $input_passwordcurrent->show(), ''); $field_id = 'newpasswd'; $input_passwordnew = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordnew')), $input_passwordnew->show(), ''); $field_id = 'confpasswd'; $input_passwordconf = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'class' => 'text-long', 'autocomplete' => 'off')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('passwordconfirm')), $input_passwordconf->show(), ''); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Spam/Virus $out .= '<fieldset><legend>' . $this->gettext('spamvirus') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_avscan'; $input_virusenabled = new html_checkbox(array('name' => 'on_avscan', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('virusenabled')), $input_virusenabled->show($on_avscan ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('virusenabledexplanation') . '</span>'); $field_id = 'on_spamassassin'; $input_spamenabled = new html_checkbox(array('name' => 'on_spamassassin', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamenabled')), $input_spamenabled->show($on_spamassassin ? 1 : 0), '<br /><span class="vexim-explanation">' . $this->gettext('spamenabledexplanation') . '</span>'); $field_id = 'sa_tag'; $input_spamscoretag = new html_select(array('name' => 'sa_tag', 'id' => $field_id, 'class' => 'select')); $decPlaces = 0; $found_number = false; for ($i = 1; $i <= 20; $i = $i + 1) { $i = number_format($i, $decPlaces); $input_spamscoretag->add($i, $i); if ($sa_tag == $i) { $found_number = true; } } for ($i = 25; $i <= 100; $i = $i + 5) { $i = number_format($i, $decPlaces); $input_spamscoretag->add($i, $i); if ($sa_tag == $i) { $found_number = true; } } // If the value from database cannot be choosed among the list we present, // add it to the end of the list. This may happen because Vexim lets the // user write in a number in a textbox. if (!$found_number) { $input_spamscoretag->add($sa_tag, $sa_tag); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscoretag')), $input_spamscoretag->show($sa_tag), '<br /><span class="vexim-explanation">' . $this->gettext('spamscoretagexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_tag . '.</span></span>'); $field_id = 'sa_refuse'; $input_spamscorerefuse = new html_select(array('name' => 'sa_refuse', 'id' => $field_id, 'class' => 'select')); $found_number = false; for ($i = 1; $i <= 20; $i = $i + 1) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } for ($i = 25; $i <= 200; $i = $i + 5) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } for ($i = 300; $i <= 900; $i = $i + 100) { $i = number_format($i, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } } $i = number_format(999, $decPlaces); $input_spamscorerefuse->add($i, $i); if ($sa_refuse == $i) { $found_number = true; } // If the value from database cannot be choosed among the list we present, // add it to the end of the list. This may happen because Vexim lets the // user write in a number in a textbox. if (!$found_number) { $input_spamscorerefuse->add($sa_refuse, $sa_refuse); } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spamscorerefuse')), $input_spamscorerefuse->show($sa_refuse), '<br /><span class="vexim-explanation">' . $this->gettext('spamscorerefuseexplanation') . '. <span class="sameline">' . $this->gettext('domaindefault') . ': ' . $default_sa_refuse . '.</span></span>'); $spammoveexplanation = '<br /><span class="vexim-explanation">' . str_replace("%italicstart", "<i>", str_replace("%italicend", "</i>", $this->gettext('spammoveexplanation_part1'))); if ($this->config['parsefolders_script']) { $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part2'); } $spammoveexplanation .= ' ' . $this->gettext('spammoveexplanation_part3'); $field_id = 'spam_drop'; $input_spammove = new html_checkbox(array('name' => 'spam_drop', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('spammove')), $input_spammove->show($spam_drop ? 1 : 0), $spammoveexplanation); $out .= '</table>'; if ($this->config['parsefolders_script'] and $this->config['parsefolders_script_show_tip']) { $out .= '<p class="vexim-explanation">' . str_replace('%italicstart', '<i>', str_replace('%italicend', '</i>', $this->gettext('spamtip'))) . '</p>'; } $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Autoresponder $out .= '<fieldset><legend>' . $this->gettext('autoresponder') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_vacation'; $input_autoresponderenabled = new html_checkbox(array('name' => 'on_vacation', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autoresponderenabled')), $input_autoresponderenabled->show($on_vacation ? 1 : 0), ''); $field_id = 'vacation'; $input_autorespondermessage = new html_textarea(array('name' => 'vacation', 'id' => $field_id, 'class' => 'textarea')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('autorespondermessage')), $input_autorespondermessage->show($vacation), '<br /><span class="vexim-explanation">' . $this->gettext('autorespondermessageexplanation') . '</span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Forward $out .= '<fieldset><legend>' . $this->gettext('forwarding') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'on_forward'; $input_forwardingenabled = new html_checkbox(array('name' => 'on_forward', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingenabled')), $input_forwardingenabled->show($on_forward ? 1 : 0)); $field_id = 'forward'; $input_forwardingaddress = new html_inputfield(array('name' => 'forward', 'id' => $field_id, 'maxlength' => 255, 'class' => 'text-long')); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardingaddress')), $input_forwardingaddress->show($forward)); $field_id = 'unseen'; $input_forwardinglocal = new html_checkbox(array('name' => 'unseen', 'id' => $field_id, 'value' => 1)); $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('forwardinglocal')), $input_forwardinglocal->show($unseen ? 1 : 0)); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Header blocks (based on code from Philip Weir's sauserprefs plugin // http://roundcube.net/plugins/sauserprefs) $out .= '<fieldset><legend>' . $this->gettext('blockbyheader') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<p>' . $this->gettext('blockbyheaderexplanation') . '</p>'; $table = new html_table(array('class' => 'headerblockprefstable', 'cols' => 3)); $field_id = 'rcmfd_headerblockrule'; $input_headerblockrule = new html_select(array('name' => '_headerblockrule', 'id' => $field_id)); $input_headerblockrule->add($this->gettext('headerfrom'), 'From'); $input_headerblockrule->add($this->gettext('headerto'), 'To'); $input_headerblockrule->add($this->gettext('headersubject'), 'Subject'); $input_headerblockrule->add($this->gettext('headerxmailer'), 'X-Mailer'); $field_id = 'rcmfd_headerblockvalue'; $input_headerblockvalue = new html_inputfield(array('name' => '_headerblockvalue', 'id' => $field_id, 'style' => 'width:270px;')); $field_id = 'rcmbtn_add_address'; $button_addaddress = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_add', 'type' => 'input', 'class' => 'button', 'label' => 'veximaccountadmin.addrule', 'style' => 'width: 130px;')); $table->add(null, $input_headerblockrule->show()); $table->add(null, $input_headerblockvalue->show()); $table->add(array('align' => 'right'), $button_addaddress); $delete_all = $this->api->output->button(array('command' => 'plugin.veximaccountadmin.headerblock_delete_all', 'type' => 'link', 'label' => 'veximaccountadmin.deleteall')); $table->add(array('colspan' => 3, 'id' => 'listcontrols'), $delete_all); $table->add_row(); $address_table = new html_table(array('id' => 'headerblock-rules-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 3)); $address_table->add_header(array('width' => '120px'), $this->gettext('field')); $address_table->add_header(null, $this->gettext('value')); $address_table->add_header(array('width' => '40px'), ' '); $this->_address_row($address_table, null, null, $attrib); // Get the header rules from DB. Should probably be put in a function. $this->_load_config(); $this->_db_connect('r'); $sql_result = $this->db->query("SELECT blockhdr, blockval \r\n\t\t FROM blocklists\r\n\t\t WHERE user_id = '{$user_id}'\r\n\t\t AND domain_id = '{$domain_id}'\r\n\t\t ORDER BY block_id;"); if ($sql_result && $this->db->num_rows($sql_result) > 0) { $norules = 'display: none;'; } $address_table->set_row_attribs(array('style' => $norules)); $address_table->add(array('colspan' => '3'), rep_specialchars_output($this->gettext('noaddressrules'))); $address_table->add_row(); $this->api->output->set_env('address_rule_count', $this->db->num_rows()); while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { $field = $sql_arr['blockhdr']; $value = $sql_arr['blockval']; $this->_address_row($address_table, $field, $value, $attrib); } $table->add(array('colspan' => 3), html::div(array('id' => 'headerblock-rules-cont'), $address_table->show())); $table->add_row(); if ($table->size()) { $out .= $table->show(); } $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== // Parameters $out .= '<fieldset><legend>' . $this->gettext('parameters') . '</legend>' . "\n"; $out .= '<div class="fieldset-content">'; $out .= '<table class="vexim-settings" cellpadding="0" cellspacing="0">'; $field_id = 'maxmsgsize'; $input_messagesize = new html_inputfield(array('name' => 'maxmsgsize', 'id' => $field_id, 'maxlength' => 3, 'size' => 4)); if ($default_maxmsgsize == 0) { $default_maxmsgsize = $this->gettext('unlimited'); } else { $default_maxmsgsize = $default_maxmsgsize . ' kb'; } $out .= sprintf("<tr><th><label for=\"%s\">%s</label>:</th><td>%s%s</td></tr>\n", $field_id, rep_specialchars_output($this->gettext('messagesize')), $input_messagesize->show($maxmsgsize), '<br /><span class="vexim-explanation">' . str_replace('%d', $active_domain, str_replace('%m', $default_maxmsgsize, $this->gettext('messagesizeexplanation'))) . '</span>'); $out .= '</table>'; $out .= '</div></fieldset>' . "\n\n"; // ===================================================================================================== $out .= html::p(null, $rcmail->output->button(array('command' => 'plugin.veximaccountadmin-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); $rcmail->output->add_gui_object('veximform', 'veximaccountadminform'); $out = $rcmail->output->form_tag(array('id' => 'veximaccountadminform', 'name' => 'veximaccountadminform', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.veximaccountadmin-save'), $out); $out = html::div(array('class' => 'settingsbox', 'style' => 'margin:0 0 15px 0;'), html::div(array('class' => 'boxtitle'), $this->gettext('accountadministration')) . html::div(array('style' => 'padding:15px'), $outtop . "\n" . $out . "\n" . $outbottom)); return $out; }
/** * 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; }
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; }
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; }
/** * Render a HTML select box for list selection */ function tasklist_select($attrib = array()) { $attrib['name'] = 'list'; $attrib['is_escaped'] = true; $select = new html_select($attrib); foreach ((array) $this->plugin->driver->get_lists() as $id => $prop) { if ($prop['editable']) { $select->add($prop['name'], $id); } } return $select->show(null); }
/** * Add UI element to copy event invitations or updates to the calendar */ public function mail_messagebody_html($p) { // load iCalendar functions (if necessary) if (!empty($this->ics_parts)) { $this->get_ical(); } $html = ''; foreach ($this->ics_parts as $mime_id) { $part = $this->message->mime_parts[$mime_id]; $charset = $part->ctype_parameters['charset'] ? $part->ctype_parameters['charset'] : RCMAIL_CHARSET; $events = $this->ical->import($this->message->get_part_content($mime_id), $charset); $title = $this->gettext('title'); $date = rcube_utils::anytodatetime($this->message->headers->date); // successfully parsed events? if (empty($events)) { continue; } // show a box for every event in the file foreach ($events as $idx => $event) { // Begin mod by Rosali (Google sends the ics inline and attached -> avoid duplicates with same UID - https://issues.kolab.org/show_bug.cgi?id=3585) $uid = $event['uid'] ? $event['uid'] : md5(serialize($event)); if (isset($this->ics_parts_filtered[$uid])) { continue; } $this->ics_parts_filtered[$uid] = 1; // End mod by Rosali if ($event['_type'] != 'event' && $event['_type'] != 'task') { // skip non-event objects (#2928) // Mod by Rosali (don't skip tasks) continue; } // define buttons according to method if ($this->ical->method == 'REPLY') { $driver = $this->get_default_driver(); $existing = $driver->get_event($event['uid']); $calendar_saveto = new html_hiddenfield(array('class' => 'calendar-saveto', 'value' => $existing['calendar'])); // Mod by Rosali (always pass calendar to GUI) if ($calendar_saveto) { $title = $this->gettext('itipreply'); $buttons = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('updateattendeestatus'))) . $calendar_saveto->show(); } } else { if ($this->ical->method == 'REQUEST') { $emails = $this->get_user_emails(); $title = $event['sequence'] > 0 ? $this->gettext('itipupdate') : $this->gettext('itipinvitation'); // add (hidden) buttons and activate them from asyncronous request foreach (array('accepted', 'tentative', 'declined') as $method) { $rsvp_buttons .= html::tag('input', array('type' => 'button', 'class' => "button {$method}", 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this, '{$method}')", 'value' => $this->gettext('itip' . $method))); } $import_button = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar'))); // check my status $status = 'unknown'; foreach ($event['attendees'] as $attendee) { if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) { $status = !empty($attendee['status']) ? strtoupper($attendee['status']) : 'NEEDS-ACTION'; break; } } $dom_id = asciiwords($event['uid'], true); $buttons = html::div(array('id' => 'rsvp-' . $dom_id, 'style' => 'display:none'), $rsvp_buttons); $buttons .= html::div(array('id' => 'import-' . $dom_id, 'style' => 'display:none'), $import_button); $buttons_pre = html::div(array('id' => 'loading-' . $dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading')); $changed = is_object($event['changed']) ? $event['changed'] : $date; $script = json_serialize(array('uid' => $event['uid'], 'changed' => $changed ? $changed->format('U') : 0, 'sequence' => intval($event['sequence']), 'fallback' => $status)); $this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status({$script})", 'docready'); } else { if ($this->ical->method == 'CANCEL') { $title = $this->gettext('itipcancellation'); // create buttons to be activated from async request checking existence of this event in local calendars $button_import = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar'))); $button_remove = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.remove_event_from_mail('" . JQ($event['uid']) . "', '" . JQ($event['title']) . "')", 'value' => $this->gettext('removefromcalendar'))); $dom_id = asciiwords($event['uid'], true); $buttons = html::div(array('id' => 'rsvp-' . $dom_id, 'style' => 'display:none'), $button_remove); $buttons .= html::div(array('id' => 'import-' . $dom_id, 'style' => 'display:none'), $button_import); $buttons_pre = html::div(array('id' => 'loading-' . $dom_id, 'class' => 'rsvp-status loading'), $this->gettext('loading')); $changed = is_object($event['changed']) ? $event['changed'] : $date; $script = json_serialize(array('uid' => $event['uid'], 'changed' => $changed ? $changed->format('U') : 0, 'sequence' => intval($event['sequence']), 'fallback' => 'CANCELLED')); $this->rc->output->add_script("rcube_calendar.fetch_event_rsvp_status({$script})", 'docready'); } else { // get a list of writeable calendars // Begin mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/33) $driver = $this->get_default_driver(); $calendars = $driver->list_calendars(false, true); $calendar_select = new html_select(array('name' => 'calendar', 'class' => 'calendar-saveto', 'is_escaped' => true)); // Mod by Rosali (calendar selector can exist multiple times - can't be referenced by ID) $numcals = 0; foreach ($calendars as $calendar) { $driver = $this->get_driver_by_cal($calendar['calendar_id']); if ($driver->readonly !== true) { $calendar_select->add($calendar['name'], $calendar['id']); $numcals++; } } } } } if ($numcals > 0) { $buttons = html::tag('input', array('type' => 'button', 'class' => 'button', 'onclick' => "rcube_calendar.add_event_from_mail('" . JQ($mime_id . ':' . $idx) . "', this)", 'value' => $this->gettext('importtocalendar'))) . $calendar_select->show($this->rc->config->get('calendar_default_calendar')); } // show event details with buttons if ($buttons) { $html .= html::div('calendar-invitebox', $this->ui->event_details_table($event, $title) . $buttons_pre . html::div('rsvp-buttons', $buttons)); } // Emd mod by Rosli // limit listing if ($idx >= 3) { break; } } } // prepend event boxes to message body if ($html) { $this->ui->init(); $p['content'] = $html . $p['content']; $this->rc->output->add_label('calendar.savingdata', 'calendar.deleteventconfirm', 'calendar.declinedeleteconfirm'); } return $p; }
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. * * @param array Original parameters * @return array Modified parameters */ function preferences_list($p) { if ($p['section'] != 'general') { return $p; } $rcmail = rcube::get_instance(); $no_override = array_flip((array) $rcmail->config->get('dont_override')); if (!isset($no_override['converse_prebind'])) { $p['blocks']['converse'] = array('name' => $this->gettext('prefstitle')); $default = 2; $field_id = 'rcmfd_converse_prebind'; $select = new html_select(array('name' => '_converse_prebind', 'id' => $field_id)); $select->add($this->gettext('never'), 0); if ($this->_config_get('converse_xmpp_bosh_prebind_url', array())) { $select->add($this->gettext('auto'), 1); $default = 1; } if ($this->_config_get('converse_xmpp_enable_always', array(), false)) { $select->add($this->gettext('manual'), 2); } $p['blocks']['converse']['options']['converse_enable'] = array('title' => html::label($field_id, Q($this->gettext('enableprebind'))), 'content' => $select->show($rcmail->config->get('converse_prebind', $default))); } return $p; }
/** * Handler for task/itip-status requests */ public function task_itip_status() { $data = rcube_utils::get_input_value('data', rcube_utils::INPUT_POST, true); // find local copy of the referenced task $existing = $this->driver->get_task($data); $itip = $this->load_itip(); $response = $itip->get_itip_status($data, $existing); // get a list of writeable lists to save new tasks to if (!$existing && $response['action'] == 'rsvp' || $response['action'] == 'import') { $lists = $this->driver->get_lists(); $select = new html_select(array('name' => 'tasklist', 'id' => 'itip-saveto', 'is_escaped' => true)); $select->add('--', ''); foreach ($lists as $list) { if ($list['editable']) { $select->add($list['name'], $list['id']); } } } if ($select) { $default_list = $this->get_default_tasklist($data['sensitivity']); $response['select'] = html::span('folder-select', $this->gettext('saveintasklist') . ' ' . $select->show($default_list['id'])); } $this->rc->output->command('plugin.update_itip_object_status', $response); }
protected function _vacation_table($ext, $rowid, $defaults, $display, $help_icon) { $rcmail = rcube::get_instance(); // begin vacation action $vacs_table = new html_table(array('class' => 'records-table', 'cellspacing' => '0', 'cols' => 3, 'style' => $defaults['method'] == 'vacation' ? '' : 'display: none;')); $to_addresses = ""; $vacto_arr = explode(",", $defaults['vacto']); $field_id_vacfrom = 'rcmfd_sievevacfrom_' . $rowid; $field_id_vacto = 'rcmfd_sievevacto_' . $rowid; if (count($this->identities)) { $select_id = new html_select(array('id' => $field_id_vacfrom, 'name' => "_vacfrom[]", 'class' => 'short', 'onchange' => rcmail_output::JS_OBJECT_NAME . '.enable_sig(this);')); if ($this->show_vacfrom && in_array('variables', $ext)) { $select_id->add($this->gettext('autodetect'), "auto"); } elseif (!$this->show_vacfrom) { $select_id->add($this->gettext('autodetect'), ""); } foreach ($this->identities as $sql_arr) { // find currently selected from address if ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == rcmail::Q($sql_arr['from']['string'])) { $defaults['vacfrom'] = $sql_arr['identity_id']; } elseif ($defaults['vacfrom'] != '' && $defaults['vacfrom'] == $sql_arr['from']['mailto']) { $defaults['vacfrom'] = $sql_arr['identity_id']; } $select_id->add($sql_arr['from']['disp_string'], $sql_arr['identity_id']); $ffield_id = 'rcmfd_vac_' . $rowid . '_' . $sql_arr['identity_id']; if ($this->force_vacto) { $curaddress = $sql_arr['email']; $defaults['vacto'] .= (!empty($defaults['vacto']) ? ',' : '') . $sql_arr['email']; } else { $curaddress = in_array($sql_arr['email'], $vacto_arr) ? $sql_arr['email'] : ""; } $input_address = new html_checkbox(array('id' => $ffield_id, 'name' => '_vacto_check_' . $rowid . '[]', 'value' => $sql_arr['email'], 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_to(this, ' . $rowid . ')', 'class' => 'checkbox')); $to_addresses .= $input_address->show($curaddress) . " " . html::label($ffield_id, rcmail::Q($sql_arr['email'])) . "<br />"; } } // deduplicate vacto list $tmparr = explode(",", $defaults['vacto']); $tmparr = array_unique($tmparr); $defaults['vacto'] = implode(",", $tmparr); if ($rcmail->config->get('sieverules_limit_vacto', true) && strlen($to_addresses) > 0) { $vacfrom_input = $select_id->show($defaults['vacfrom']); $input_vacto = new html_hiddenfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'value' => $defaults['vacto'])); $vacto_input = $to_addresses . $input_vacto->show(); $vac_help = $this->gettext('vactoexp'); } else { $input_vacfrom = new html_inputfield(array('id' => $field_id_vacfrom, 'name' => '_vacfrom[]')); $vacfrom_input = $input_vacfrom->show($defaults['vacfrom']); $input_vacto = new html_inputfield(array('id' => $field_id_vacto, 'name' => '_vacto[]', 'class' => 'short')); $vacto_input = $input_vacto->show($defaults['vacto']); $vac_help = $this->gettext('vactoexp') . '<br /><br />' . $this->gettext('vactoexp_adv'); } // from param $vacs_table->set_row_attribs(array('class' => $this->show_vacfrom ? 'advanced' : 'disabled', 'style' => $display['vacfrom'])); $vacs_table->add(null, html::label($field_id_vacfrom, rcmail::Q($this->gettext('from')))); $vacs_table->add(null, $vacfrom_input); $sig_button = $this->api->output->button(array('command' => 'plugin.sieverules.vacation_sig', 'prop' => $rowid, 'type' => 'link', 'class' => 'vacsig', 'classact' => 'vacsig_act', 'title' => 'insertsignature', 'content' => ' ')); $vacs_table->add(null, $sig_button); // to param $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(array('style' => 'vertical-align: top;'), html::label($field_id_vacto, rcmail::Q($this->gettext('sieveto')))); $vacs_table->add(null, $vacto_input); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(array('style' => 'vertical-align: top;'), $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $vac_help); $field_id = 'rcmfd_sievevacperiod_' . $rowid; $input_period = new html_inputfield(array('id' => $field_id, 'name' => '_period[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('period')))); $vacs_table->add(null, $input_period->show($defaults['period'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . (in_array('vacation-seconds', $ext) ? $vacs_table->size() + 1 : $vacs_table->size()) . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); if (in_array('vacation-seconds', $ext)) { $input_periodtype = new html_radiobutton(array('id' => $field_id . '_days', 'name' => '_period_radio_' . $rowid, 'value' => 'days', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show = $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_days', rcmail::Q($this->gettext('days'))); $input_periodtype = new html_radiobutton(array('id' => $field_id . '_seconds', 'name' => '_period_radio_' . $rowid, 'value' => 'seconds', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_period_type(this, ' . $rowid . ')', 'class' => 'radio')); $period_type_show .= ' ' . $input_periodtype->show($defaults['periodtype']) . " " . html::label($field_id . '_seconds', rcmail::Q($this->gettext('seconds'))); $input_periodtype = new html_hiddenfield(array('id' => 'rcmfd_sievevacperiodtype_' . $rowid, 'name' => '_periodtype[]')); $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, ' '); $vacs_table->add(null, $period_type_show . $input_periodtype->show($defaults['periodtype'])); $vacs_table->add(null, ' '); } $vacs_table->set_row_attribs(array('style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vacperiodexp')); $field_id = 'rcmfd_sievevachandle_' . $rowid; $input_handle = new html_inputfield(array('id' => $field_id, 'name' => '_handle[]', 'class' => 'short')); $vacs_table->set_row_attribs(array('class' => $this->show_vachandle ? 'advanced' : 'disabled', 'style' => $display['vachandle'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('sievevachandle')))); $vacs_table->add(null, $input_handle->show($defaults['handle'])); $help_button = html::a(array('href' => "#", 'onclick' => 'return ' . rcmail_output::JS_OBJECT_NAME . '.sieverules_help(this, ' . $vacs_table->size() . ');', 'title' => $this->gettext('messagehelp')), $help_icon); $vacs_table->add(null, $help_button); $vacs_table->set_row_attribs(array('class' => 'advhelp', 'style' => 'display: none;')); $vacs_table->add(array('colspan' => 3, 'class' => 'helpmsg'), $this->gettext('vachandleexp')); $field_id = 'rcmfd_sievevacsubject_' . $rowid; $input_subject = new html_inputfield(array('id' => $field_id, 'name' => '_subject[]')); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('subject')))); $vacs_table->add(array('colspan' => 2), $input_subject->show($defaults['subject'])); if (in_array('variables', $ext)) { $field_id = 'rcmfd_sievevacsubject_orig_' . $rowid; $input_origsubject = new html_checkbox(array('id' => $field_id, 'value' => '1', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_osubj(this, ' . $rowid . ')', 'class' => 'checkbox')); $input_vacosubj = new html_hiddenfield(array('id' => 'rcmfd_sievevactoh_' . $rowid, 'name' => '_orig_subject[]', 'value' => $defaults['origsubject'])); $vacs_table->add(null, ' '); $vacs_table->add(array('colspan' => 2), $input_origsubject->show($defaults['origsubject']) . " " . html::label($field_id, rcmail::Q($this->gettext('sieveorigsubj'))) . $input_vacosubj->show()); } $field_id = 'rcmfd_sievevacmag_' . $rowid; $input_msg = new html_textarea(array('id' => $field_id, 'name' => '_msg[]', 'rows' => '8', 'cols' => '40', 'class' => $defaults['htmlmsg'] == 1 ? 'mce_editor' : '', 'is_escaped' => $defaults['htmlmsg'] == 1 ? true : null)); $input_html = new html_checkbox(array('id' => 'rcmfd_sievevachtmlcb_' . $rowid, 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_toggle_vac_html(this, ' . $rowid . ', \'' . $field_id . '\');', 'value' => '1', 'class' => 'checkbox')); $input_htmlhd = new html_hiddenfield(array('id' => 'rcmfd_sievevachtmlhd_' . $rowid, 'name' => '_htmlmsg[]', 'value' => $defaults['htmlmsg'])); $vacs_table->add('msg', html::label($field_id, rcmail::Q($this->gettext('message')))); $vacs_table->add(array('colspan' => 2), $input_msg->show($defaults['msg']) . html::tag('div', in_array('htmleditor', $rcmail->config->get('dont_override')) ? array('style' => 'display: none;') : null, $input_html->show($defaults['htmlmsg']) . " " . html::label('rcmfd_sievevachtmlcb_' . $rowid, rcmail::Q($this->gettext('htmlmessage')))) . $input_htmlhd->show()); $field_id = 'rcmfd_sievecharset_' . $rowid; $vacs_table->set_row_attribs(array('class' => 'advanced', 'style' => $display['vacadv'])); $vacs_table->add(null, html::label($field_id, rcmail::Q($this->gettext('charset')))); $vacs_table->add(array('colspan' => 2), $rcmail->output->charset_selector(array('id' => $field_id, 'name' => '_vaccharset[]', 'selected' => $defaults['charset']))); $input_advopts = new html_checkbox(array('id' => 'vadvopts' . $rowid, 'name' => '_vadv_opts[]', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.sieverules_show_adv(this);', 'value' => '1', 'class' => 'checkbox')); $vacs_table->add(array('colspan' => '3', 'style' => 'text-align: right'), html::label('vadvopts' . $rowid, rcmail::Q($this->gettext('advancedoptions'))) . $input_advopts->show($display['vacadv'] == '' ? 1 : 0)); return $vacs_table; }
/** * 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; }
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; }
/** * Handler for preferences_list hook. * Adds options blocks into Enigma settings sections in Preferences. * * @param array Original parameters * * @return array Modified parameters */ function preferences_list($p) { if ($p['section'] != 'enigma') { return $p; } $no_override = array_flip((array) $this->rc->config->get('dont_override')); $p['blocks']['main']['name'] = $this->gettext('mainoptions'); if (!isset($no_override['enigma_encryption'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_encryption'; $input = new html_checkbox(array('name' => '_enigma_encryption', 'id' => $field_id, 'value' => 1)); $p['blocks']['main']['options']['enigma_encryption'] = array('title' => html::label($field_id, $this->gettext('supportencryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_encryption')))); } if (!isset($no_override['enigma_signatures'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_signatures'; $input = new html_checkbox(array('name' => '_enigma_signatures', 'id' => $field_id, 'value' => 1)); $p['blocks']['main']['options']['enigma_signatures'] = array('title' => html::label($field_id, $this->gettext('supportsignatures')), 'content' => $input->show(intval($this->rc->config->get('enigma_signatures')))); } if (!isset($no_override['enigma_decryption'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_decryption'; $input = new html_checkbox(array('name' => '_enigma_decryption', 'id' => $field_id, 'value' => 1)); $p['blocks']['main']['options']['enigma_decryption'] = array('title' => html::label($field_id, $this->gettext('supportdecryption')), 'content' => $input->show(intval($this->rc->config->get('enigma_decryption')))); } if (!isset($no_override['enigma_sign_all'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_sign_all'; $input = new html_checkbox(array('name' => '_enigma_sign_all', 'id' => $field_id, 'value' => 1)); $p['blocks']['main']['options']['enigma_sign_all'] = array('title' => html::label($field_id, $this->gettext('signdefault')), 'content' => $input->show($this->rc->config->get('enigma_sign_all') ? 1 : 0)); } if (!isset($no_override['enigma_encrypt_all'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_encrypt_all'; $input = new html_checkbox(array('name' => '_enigma_encrypt_all', 'id' => $field_id, 'value' => 1)); $p['blocks']['main']['options']['enigma_encrypt_all'] = array('title' => html::label($field_id, $this->gettext('encryptdefault')), 'content' => $input->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0)); } if (!isset($no_override['enigma_password_time'])) { if (!$p['current']) { $p['blocks']['main']['content'] = true; return $p; } $field_id = 'rcmfd_enigma_password_time'; $select = new html_select(array('name' => '_enigma_password_time', 'id' => $field_id)); foreach (array(1, 5, 10, 15, 30) as $m) { $label = $this->gettext(array('name' => 'nminutes', 'vars' => array('m' => $m))); $select->add($label, $m); } $select->add($this->gettext('wholesession'), 0); $p['blocks']['main']['options']['enigma_password_time'] = array('title' => html::label($field_id, $this->gettext('passwordtime')), 'content' => $select->show(intval($this->rc->config->get('enigma_password_time')))); } return $p; }
function prefs_table($args) { global $CURR_SECTION; if ($args['section'] == 'folders') { $this->add_texts('localization'); $rcmail = rcmail::get_instance(); // load folders list when needed if ($CURR_SECTION) { $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30, 'exceptions' => array('INBOX'), 'folder_filter' => 'mail', 'folder_rights' => 'w')); } else { $select = new html_select(); } $args['blocks']['main']['options']['archive_mbox'] = array('title' => $this->gettext('archivefolder'), 'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox"))); } return $args; }
function gen_form() { $policy_name = array(); $policy_id = array(); 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'])); $policy = $this->soap->mail_policy_get($session_id, array(1 => 1)); $policy_sel = $this->soap->mail_policy_get($session_id, array("id" => $spam_user[0]['policy_id'])); $this->soap->logout($session_id); for ($i = 0; $i < count($policy); $i++) { $policy_name[] = $policy[$i]['policy_name']; $policy_id[] = $policy[$i]['id']; } } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $mail_user[0]['move_junk']; if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } $this->rcmail_inst->output->set_env('framed', true); $out .= '<fieldset><legend>' . $this->gettext('junk') . '</legend>' . "\n"; $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_spampolicy_name = new html_select(array('name' => '_spampolicy_name', 'id' => 'spampolicy_name')); $input_spampolicy_name->add($policy_name, $policy_id); $table->add('title', rep_specialchars_output($this->gettext('policy_name'))); $table->add('', $input_spampolicy_name->show($policy_sel[0]['policy_name'])); $input_spammove = new html_checkbox(array('name' => '_spammove', 'id' => 'spammove', 'value' => '1')); $table->add('title', rep_specialchars_output($this->gettext('spammove'))); $table->add('', $input_spammove->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
function action_div($fid, $id, $div = true) { $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id]; $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']); $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : ''; $out .= '<table><tr><td class="rowactions">'; // action select $select_action = new html_select(array('name' => "_action_type[{$id}]", 'id' => 'action_type' . $id, 'onchange' => 'action_type_select(' . $id . ')')); if (in_array('fileinto', $this->exts)) { $select_action->add(Q($this->gettext('messagemoveto')), 'fileinto'); } if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) { $select_action->add(Q($this->gettext('messagecopyto')), 'fileinto_copy'); } $select_action->add(Q($this->gettext('messageredirect')), 'redirect'); if (in_array('copy', $this->exts)) { $select_action->add(Q($this->gettext('messagesendcopy')), 'redirect_copy'); } if (in_array('reject', $this->exts)) { $select_action->add(Q($this->gettext('messagediscard')), 'reject'); } else { if (in_array('ereject', $this->exts)) { $select_action->add(Q($this->gettext('messagediscard')), 'ereject'); } } if (in_array('vacation', $this->exts)) { $select_action->add(Q($this->gettext('messagereply')), 'vacation'); } $select_action->add(Q($this->gettext('messagedelete')), 'discard'); if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { $select_action->add(Q($this->gettext('setflags')), 'setflag'); $select_action->add(Q($this->gettext('addflags')), 'addflag'); $select_action->add(Q($this->gettext('removeflags')), 'removeflag'); } $select_action->add(Q($this->gettext('rulestop')), 'stop'); $select_type = $action['type']; if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) { $select_type .= '_copy'; } $out .= $select_action->show($select_type); $out .= '</td>'; // actions target inputs $out .= '<td class="rowtargets">'; // shared targets $out .= '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '" ' . 'value="' . ($action['type'] == 'redirect' ? Q($action['target'], 'strict', false) : '') . '" size="35" ' . 'style="display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '" ' . $this->error_class($id, 'action', 'target', 'action_target') . ' />'; $out .= '<textarea name="_action_target_area[' . $id . ']" id="action_target_area' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'targetarea', 'action_target_area') . 'style="display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') . '">' . (in_array($action['type'], array('reject', 'ereject')) ? Q($action['target'], 'strict', false) : '') . "</textarea>\n"; // vacation $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . Q($this->gettext('vacationreason')) . '</span><br />' . '<textarea name="_action_reason[' . $id . ']" id="action_reason' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'reason', 'action_reason') . '>' . Q($action['reason'], 'strict', false) . "</textarea>\n"; $out .= '<br /><span class="label">' . Q($this->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />'; $out .= '<br /><span class="label">' . Q($this->gettext('vacationaddresses')) . '</span><br />' . '<input type="text" name="_action_addresses[' . $id . ']" id="action_addr' . $id . '" ' . 'value="' . (is_array($action['addresses']) ? Q(implode(', ', $action['addresses']), 'strict', false) : $action['addresses']) . '" size="35" ' . $this->error_class($id, 'action', 'addresses', 'action_addr') . ' />'; $out .= '<br /><span class="label">' . Q($this->gettext('vacationdays')) . '</span><br />' . '<input type="text" name="_action_days[' . $id . ']" id="action_days' . $id . '" ' . 'value="' . Q($action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'days', 'action_days') . ' />'; $out .= '</div>'; // flags $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft'); $flags_target = (array) $action['target']; $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>'; foreach ($flags as $fidx => $flag) { $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . Q($this->gettext('flag' . $fidx)) . '<br>'; } $out .= '</div>'; // mailbox select if ($action['type'] == 'fileinto') { $mailbox = $this->mod_mailbox($action['target'], 'out'); } else { $mailbox = ''; } $select = rcmail_mailbox_select(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (!isset($action) || $action['type'] == 'fileinto' ? 'inline' : 'none'))); $out .= $select->show($mailbox); $out .= '</td>'; // add/del buttons $out .= '<td class="rowbuttons">'; $out .= '<a href="#" id="actionadd' . $id . '" title="' . Q($this->gettext('add')) . '" onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>'; $out .= '<a href="#" id="actiondel' . $id . '" title="' . Q($this->gettext('del')) . '" onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>'; $out .= '</td>'; $out .= '</tr></table>'; $out .= $div ? "</div>\n" : ''; return $out; }
$mdn_opts = array(0 => 'ask the user', 1 => 'send automatically', 3 => 'send receipt to user contacts, otherwise ask the user', 4 => 'send receipt to user contacts, otherwise ignore', 2 => 'ignore'); $select_mdnreq = new html_select(array('name' => '_mdn_requests', 'id' => "cfgmdnreq")); $select_mdnreq->add(array_values($mdn_opts), array_keys($mdn_opts)); echo $select_mdnreq->show(intval($RCI->getprop('mdn_requests'))); ?> <div>Behavior if a received message requests a message delivery notification (read receipt)</div> </dd> <dt class="propname">mime_param_folding <span class="userconf">*</span></dt> <dd> <?php $select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => "cfgmimeparamfolding")); $select_param_folding->add('Full RFC 2231 (Roundcube, Thunderbird)', '0'); $select_param_folding->add('RFC 2047/2231 (MS Outlook, OE)', '1'); $select_param_folding->add('Full RFC 2047 (deprecated)', '2'); echo $select_param_folding->show(strval($RCI->getprop('mime_param_folding'))); ?> <div>How to encode attachment long/non-ascii names</div> </dd> </dl> <p class="hint"><span class="userconf">*</span> These settings are defaults for the user preferences</p> </fieldset> <fieldset> <legend>Plugins</legend> <dl class="configblock" id="cgfblockdisplay"> <?php
/** * Drop-down menus for recurrence rules like "each last sunday of" */ private function rrule_selectors($part, $noselect = null) { // rule selectors $select_prefix = new html_select(array('name' => 'bydayprefix', 'id' => "edit-recurrence-{$part}-prefix")); if ($noselect) { $select_prefix->add($noselect, ''); } $select_prefix->add(array($this->gettext('first'), $this->gettext('second'), $this->gettext('third'), $this->gettext('fourth'), $this->gettext('last')), array(1, 2, 3, 4, -1)); $select_wday = new html_select(array('name' => 'byday', 'id' => "edit-recurrence-{$part}-byday")); if ($noselect) { $select_wday->add($noselect, ''); } $daymap = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); $first = $this->rc->config->get('calendar_first_day', 1); for ($j = $first; $j <= $first + 6; $j++) { $d = $j % 7; $select_wday->add($this->gettext($daymap[$d]), strtoupper(substr($daymap[$d], 0, 2))); } return $select_prefix->show() . ' ' . $select_wday->show(); }
/** * Template object for key generation form */ function tpl_key_create_form($attrib) { $attrib += array('id' => 'rcmKeyCreateForm'); $table = new html_table(array('cols' => 2)); // get user's identities $identities = $this->rc->user->list_identities(null, true); // Identity $select = new html_select(array('name' => 'identity', 'id' => 'key-ident')); foreach ((array) $identities as $idx => $ident) { $name = empty($ident['name']) ? '<' . $ident['email'] . '>' : $ident['ident']; $select->add($name, $idx); } $table->add('title', html::label('key-name', rcube::Q($this->enigma->gettext('newkeyident')))); $table->add(null, $select->show(0)); // Key size $select = new html_select(array('name' => 'size', 'id' => 'key-size')); $select->add($this->enigma->gettext('key2048'), '2048'); $select->add($this->enigma->gettext('key4096'), '4096'); $table->add('title', html::label('key-size', rcube::Q($this->enigma->gettext('newkeysize')))); $table->add(null, $select->show()); // Password and confirm password $table->add('title', html::label('key-pass', rcube::Q($this->enigma->gettext('newkeypass')))); $table->add(null, rcube_output::get_edit_field('password', '', array('id' => 'key-pass', 'size' => $attrib['size'], 'required' => true), 'password')); $table->add('title', html::label('key-pass-confirm', rcube::Q($this->enigma->gettext('newkeypassconfirm')))); $table->add(null, rcube_output::get_edit_field('password-confirm', '', array('id' => 'key-pass-confirm', 'size' => $attrib['size'], 'required' => true), 'password')); $this->rc->output->add_gui_object('keyform', $attrib['id']); $this->rc->output->add_label('enigma.keygenerating', 'enigma.formerror', 'enigma.passwordsdiffer', 'enigma.keygenerateerror', 'enigma.nonameident', 'enigma.keygennosupport'); return $this->rc->output->form_tag(array(), $table->show($attrib)); }
public function vacation_sieve_form() { try { $table = new html_table(array('cols' => 2, 'class' => 'propform')); $format = $this->app->config->get('date_format'); # Options $table->add(array('colspan' => 2, 'class' => 'section-first'), Q($this->gettext('options'))); $table->add_row(); $field_id = 'vacation_enable'; $input_vacationenable = new html_checkbox(array('name' => '_vacation_enable', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('vacationenable')))); $table->add(null, $input_vacationenable->show($this->obj->is_vacation_enable() ? 1 : 0)); $field_id = 'vacation_start'; $input_vacationstart = new html_inputfield(array('name' => '_vacation_start', 'id' => $field_id, 'size' => 10)); $table->add('title', html::label($field_id, Q($this->gettext('period')))); $vacStart = $this->obj->get_vacation_start(); $hour_text = array(); $hour_value = array(); $wholeDay = Q($this->gettext('wholeday')); $hour_value[$wholeDay] = ''; $hour_text[$wholeDay] = $wholeDay; $minHour = $this->config['working_hours'][0]; $maxHour = $this->config['working_hours'][1]; foreach (range($minHour, $maxHour) as $tmp_hour) { $hour_text[$tmp_hour] = sprintf("%02d:00", $tmp_hour); $hour_value[$tmp_hour] = $tmp_hour; } unset($tmp_hour); $field_id = 'vacation_starttime'; $input_vacationstarttime = new html_select(array('name' => '_vacation_starttime')); $input_vacationstarttime->add($hour_text, $hour_value); $field_id = 'vacation_endtime'; $input_vacationendtime = new html_select(array('name' => '_vacation_endtime')); $input_vacationendtime->add($hour_text, $hour_value); $field_id = 'vacation_end'; $input_vacationend = new html_inputfield(array('name' => '_vacation_end', 'id' => $field_id, 'size' => 10)); $vacEnd = $this->obj->get_vacation_end(); $periodFields = $this->gettext('vacationfrom') . ' ' . $input_vacationstart->show(date($format, $vacStart)) . ' ' . $input_vacationstarttime->show($hour_text[$this->obj->get_vacation_starttime()]) . ' ' . $this->gettext('vacationto') . ' ' . $input_vacationend->show(date($format, $vacEnd)) . ' ' . $input_vacationendtime->show($hour_text[$this->obj->get_vacation_endtime()]); $table->add(null, $periodFields); $table->add_row(); $field_id = 'every'; $input_every = new html_inputfield(array('name' => '_every', 'id' => $field_id, 'size' => 5)); $table->add('title', html::label($field_id, Q($this->gettext('frequency')))); $table->add(null, $this->gettext('answer_no_more_than_every') . ' ' . $input_every->show($this->obj->get_every()) . ' ' . $this->gettext('vacationdays')); $table->add_row(); $identities = $this->get_identities(); $default_identity = key($identities); $field_id = 'addressed_to'; $input_addressed_to = new html_select(array('name' => '_addressed_to[]', 'id' => $field_id, 'multiple' => true)); $input_addressed_to->add($identities); $addressedTo = $this->obj->get_addressed_to(); $table->add('title', html::label($field_id, Q($this->gettext('addressed_to')))); $table->add(null, $input_addressed_to->show($addressedTo ? $addressedTo : $default_identity)); # Subject field $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('subject'))); $table->add_row(); $field_id = 'vacation_subject'; $input_vacationsubject = new html_inputfield(array('name' => '_vacation_subject', 'id' => $field_id, 'size' => 40)); $table->add('title', html::label($field_id, Q($this->gettext('vacationsubject')))); $table->add(null, $input_vacationsubject->show($this->obj->get_vacation_subject())); $table->add_row(); $field_id = '_append_subject'; $input_appendsubject = new html_checkbox(array('name' => '_append_subject', 'id' => $field_id, 'value' => 1)); $table->add('title', html::label($field_id, Q($this->gettext('append_subject')))); $table->add(null, $input_appendsubject->show($this->obj->get_append_subject() ? 1 : 0)); # Message $table->add(array('colspan' => 2, 'class' => 'section'), Q($this->gettext('vacationmessage'))); $table->add_row(); $field_id = 'send_from'; $input_sendfrom = new html_select(array('name' => '_send_from', 'id' => $field_id)); $input_sendfrom->add($identities); $sendFrom = $this->obj->get_send_from(); $table->add('title', html::label($field_id, Q($this->gettext('send_from')))); $table->add(null, $input_sendfrom->show($sendFrom ? $sendFrom : $default_identity)); # Add the HTML Row $table->add_row(); $field_id = 'vacation_message'; if ($this->config['msg_format'] == 'html') { $this->app->output->add_label('converting', 'editorwarning'); rcube_html_editor('identity'); $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40, 'class' => 'mce_editor')); } else { $text_vacationmessage = new html_textarea(array('name' => '_vacation_message', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40)); } # $table->add('top title', html::label($field_id, Q($this->gettext('vacationmessage')))); $table->add(null, $text_vacationmessage->show($this->obj->get_vacation_message())); # Get the HTML $tableHtml = $table->show(); $submitLine = html::p(null, $this->app->output->button(array('command' => 'plugin.vacation_sieve-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save'))); # First line $boxTitle = html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('vacation')); $out = html::div(array('class' => 'box'), $boxTitle . html::div(array('class' => "boxcontent"), $tableHtml . $submitLine)); $this->app->output->add_gui_object('vacationsieveform', 'vacation_sieve_form'); return $this->app->output->form_tag(array('id' => 'vacation_sieve_form', 'name' => 'vacation_sieve_form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.vacation_sieve-save'), $out); } catch (Exception $exc) { $this->log_error('Fail to build form: ' . $exc->getMessage()); } }
function action_div($fid, $id, $div = true) { $action = isset($this->form) ? $this->form['actions'][$id] : $this->script[$fid]['actions'][$id]; $rows_num = isset($this->form) ? sizeof($this->form['actions']) : sizeof($this->script[$fid]['actions']); $out = $div ? '<div class="actionrow" id="actionrow' . $id . '">' . "\n" : ''; $out .= '<table><tr><td class="rowactions">'; // action select $select_action = new html_select(array('name' => "_action_type[{$id}]", 'id' => 'action_type' . $id, 'onchange' => 'action_type_select(' . $id . ')')); if (in_array('fileinto', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagemoveto')), 'fileinto'); } if (in_array('fileinto', $this->exts) && in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagecopyto')), 'fileinto_copy'); } $select_action->add(rcube::Q($this->plugin->gettext('messageredirect')), 'redirect'); if (in_array('copy', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagesendcopy')), 'redirect_copy'); } if (in_array('reject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'reject'); } else { if (in_array('ereject', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagediscard')), 'ereject'); } } if (in_array('vacation', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('messagereply')), 'vacation'); } $select_action->add(rcube::Q($this->plugin->gettext('messagedelete')), 'discard'); if (in_array('imapflags', $this->exts) || in_array('imap4flags', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setflags')), 'setflag'); $select_action->add(rcube::Q($this->plugin->gettext('addflags')), 'addflag'); $select_action->add(rcube::Q($this->plugin->gettext('removeflags')), 'removeflag'); } if (in_array('variables', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('setvariable')), 'set'); } if (in_array('enotify', $this->exts) || in_array('notify', $this->exts)) { $select_action->add(rcube::Q($this->plugin->gettext('notify')), 'notify'); } $select_action->add(rcube::Q($this->plugin->gettext('messagekeep')), 'keep'); $select_action->add(rcube::Q($this->plugin->gettext('rulestop')), 'stop'); $select_type = $action['type']; if (in_array($action['type'], array('fileinto', 'redirect')) && $action['copy']) { $select_type .= '_copy'; } $out .= $select_action->show($select_type); $out .= '</td>'; // actions target inputs $out .= '<td class="rowtargets">'; // force domain selection in redirect email input $domains = (array) $this->rc->config->get('managesieve_domains'); if (!empty($domains)) { sort($domains); $domain_select = new html_select(array('name' => "_action_target_domain[{$id}]", 'id' => 'action_target_domain' . $id)); $domain_select->add(array_combine($domains, $domains)); if ($action['type'] == 'redirect') { $parts = explode('@', $action['target']); if (!empty($parts)) { $action['domain'] = array_pop($parts); $action['target'] = implode('@', $parts); } } } // redirect target $out .= '<span id="redirect_target' . $id . '" style="white-space:nowrap;' . ' display:' . ($action['type'] == 'redirect' ? 'inline' : 'none') . '">' . '<input type="text" name="_action_target[' . $id . ']" id="action_target' . $id . '"' . ' value="' . ($action['type'] == 'redirect' ? rcube::Q($action['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . $this->error_class($id, 'action', 'target', 'action_target') . ' />' . (!empty($domains) ? ' @ ' . $domain_select->show($action['domain']) : '') . '</span>'; // (e)reject target $out .= '<textarea name="_action_target_area[' . $id . ']" id="action_target_area' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'targetarea', 'action_target_area') . 'style="display:' . (in_array($action['type'], array('reject', 'ereject')) ? 'inline' : 'none') . '">' . (in_array($action['type'], array('reject', 'ereject')) ? rcube::Q($action['target'], 'strict', false) : '') . "</textarea>\n"; // vacation $vsec = in_array('vacation-seconds', $this->exts); $out .= '<div id="action_vacation' . $id . '" style="display:' . ($action['type'] == 'vacation' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('vacationreason')) . '</span><br />' . '<textarea name="_action_reason[' . $id . ']" id="action_reason' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'reason', 'action_reason') . '>' . Q($action['reason'], 'strict', false) . "</textarea>\n"; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('vacationsubject')) . '</span><br />' . '<input type="text" name="_action_subject[' . $id . ']" id="action_subject' . $id . '" ' . 'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' . $this->error_class($id, 'action', 'subject', 'action_subject') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' . $this->list_input($id, 'action_addresses', $action['addresses'], true, $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30); $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' . '<input type="text" name="_action_interval[' . $id . ']" id="action_interval' . $id . '" ' . 'value="' . rcube::Q(isset($action['seconds']) ? $action['seconds'] : $action['days'], 'strict', false) . '" size="2" ' . $this->error_class($id, 'action', 'interval', 'action_interval') . ' />'; if ($vsec) { $out .= ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="days"' . (!isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('days') . '</label>' . ' <label><input type="radio" name="_action_interval_type[' . $id . ']" value="seconds"' . (isset($action['seconds']) ? ' checked="checked"' : '') . ' class="radio" />' . $this->plugin->gettext('seconds') . '</label>'; } $out .= '</div>'; // flags $flags = array('read' => '\\Seen', 'answered' => '\\Answered', 'flagged' => '\\Flagged', 'deleted' => '\\Deleted', 'draft' => '\\Draft'); $flags_target = (array) $action['target']; $out .= '<div id="action_flags' . $id . '" style="display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none') . '"' . $this->error_class($id, 'action', 'flags', 'action_flags') . '>'; foreach ($flags as $fidx => $flag) { $out .= '<input type="checkbox" name="_action_flags[' . $id . '][]" value="' . $flag . '"' . (in_array_nocase($flag, $flags_target) ? 'checked="checked"' : '') . ' />' . rcube::Q($this->plugin->gettext('flag' . $fidx)) . '<br>'; } $out .= '</div>'; // set variable $set_modifiers = array('lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length'); $out .= '<div id="action_set' . $id . '" style="display:' . ($action['type'] == 'set' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('setvarname')) . '</span><br />' . '<input type="text" name="_action_varname[' . $id . ']" id="action_varname' . $id . '" ' . 'value="' . rcube::Q($action['name']) . '" size="35" ' . $this->error_class($id, 'action', 'name', 'action_varname') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarvalue')) . '</span><br />' . '<input type="text" name="_action_varvalue[' . $id . ']" id="action_varvalue' . $id . '" ' . 'value="' . rcube::Q($action['value']) . '" size="35" ' . $this->error_class($id, 'action', 'value', 'action_varvalue') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('setvarmodifiers')) . '</span><br />'; foreach ($set_modifiers as $s_m) { $s_m_id = 'action_varmods' . $id . $s_m; $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', $id, $s_m, $s_m_id, array_key_exists($s_m, (array) $action) && $action[$s_m] ? ' checked="checked"' : '', rcube::Q($this->plugin->gettext('var' . $s_m))); } $out .= '</div>'; // notify $notify_methods = (array) $this->rc->config->get('managesieve_notify_methods'); $importance_options = $this->notify_importance_options; if (empty($notify_methods)) { $notify_methods = $this->notify_methods; } list($method, $target) = explode(':', $action['method'], 2); $method = strtolower($method); if ($method && !in_array($method, $notify_methods)) { $notify_methods[] = $method; } $select_method = new html_select(array('name' => "_action_notifymethod[{$id}]", 'id' => "_action_notifymethod{$id}", 'class' => $this->error_class($id, 'action', 'method', 'action_notifymethod'))); foreach ($notify_methods as $m_n) { $select_method->add(rcube::Q($this->rc->text_exists('managesieve.notifymethod' . $m_n) ? $this->plugin->gettext('managesieve.notifymethod' . $m_n) : $m_n), $m_n); } $select_importance = new html_select(array('name' => "_action_notifyimportance[{$id}]", 'id' => "_action_notifyimportance{$id}", 'class' => $this->error_class($id, 'action', 'importance', 'action_notifyimportance'))); foreach ($importance_options as $io_v => $io_n) { $select_importance->add(rcube::Q($this->plugin->gettext($io_n)), $io_v); } // @TODO: nice UI for mailto: (other methods too) URI parameters $out .= '<div id="action_notify' . $id . '" style="display:' . ($action['type'] == 'notify' ? 'inline' : 'none') . '">'; $out .= '<span class="label">' . rcube::Q($this->plugin->gettext('notifytarget')) . '</span><br />' . $select_method->show($method) . '<input type="text" name="_action_notifytarget[' . $id . ']" id="action_notifytarget' . $id . '" ' . 'value="' . rcube::Q($target) . '" size="25" ' . $this->error_class($id, 'action', 'target', 'action_notifytarget') . ' />'; $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifymessage')) . '</span><br />' . '<textarea name="_action_notifymessage[' . $id . ']" id="action_notifymessage' . $id . '" ' . 'rows="3" cols="35" ' . $this->error_class($id, 'action', 'message', 'action_notifymessage') . '>' . rcube::Q($action['message'], 'strict', false) . "</textarea>\n"; if (in_array('enotify', $this->exts)) { $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyfrom')) . '</span><br />' . '<input type="text" name="_action_notifyfrom[' . $id . ']" id="action_notifyfrom' . $id . '" ' . 'value="' . rcube::Q($action['from']) . '" size="35" ' . $this->error_class($id, 'action', 'from', 'action_notifyfrom') . ' />'; } $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext('notifyimportance')) . '</span><br />'; $out .= $select_importance->show($action['importance'] ? (int) $action['importance'] : 2); $out .= '<div id="action_notifyoption_div' . $id . '">' . '<span class="label">' . rcube::Q($this->plugin->gettext('notifyoptions')) . '</span><br />' . $this->list_input($id, 'action_notifyoption', (array) $action['options'], true, $this->error_class($id, 'action', 'options', 'action_notifyoption'), 30) . '</div>'; $out .= '</div>'; // mailbox select if ($action['type'] == 'fileinto') { $mailbox = $this->mod_mailbox($action['target'], 'out'); } else { $mailbox = ''; } $select = $this->rc->folder_selector(array('realnames' => false, 'maxlength' => 100, 'id' => 'action_mailbox' . $id, 'name' => "_action_mailbox[{$id}]", 'style' => 'display:' . (empty($action['type']) || $action['type'] == 'fileinto' ? 'inline' : 'none'))); $out .= $select->show($mailbox); $out .= '</td>'; // add/del buttons $out .= '<td class="rowbuttons">'; $out .= '<a href="#" id="actionadd' . $id . '" title="' . rcube::Q($this->plugin->gettext('add')) . '" onclick="rcmail.managesieve_actionadd(' . $id . ')" class="button add"></a>'; $out .= '<a href="#" id="actiondel' . $id . '" title="' . rcube::Q($this->plugin->gettext('del')) . '" onclick="rcmail.managesieve_actiondel(' . $id . ')" class="button del' . ($rows_num < 2 ? ' disabled' : '') . '"></a>'; $out .= '</td>'; $out .= '</tr></table>'; $out .= $div ? "</div>\n" : ''; return $out; }
function gen_form() { $id = rcube_utils::get_input_value('_id', RCUBE_INPUT_GET); $this->rcmail_inst->output->add_label('ispconfig3_fetchmail.fetchmaildelconfirm'); 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'])); $mail_fetchmail = $this->soap->mail_fetchmail_get($session_id, $id); $this->soap->logout($session_id); } catch (SoapFault $e) { $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error'); } $enabled = $mail_fetchmail['active']; $delete = $mail_fetchmail['source_delete']; if ($mail_fetchmail['destination'] != $mail_user[0]['email']) { $this->rcmail_inst->output->command('display_message', 'Error: ' . $this->gettext('opnotpermitted'), 'error'); $enabled = 'n'; $delete = 'n'; $mail_fetchmail['mailget_id'] = ''; $mail_fetchmail['server_id'] = ''; $mail_fetchmail['type'] = ''; $mail_fetchmail['source_server'] = ''; $mail_fetchmail['source_username'] = ''; $mail_fetchmail['source_delete'] = ''; } } if ($delete == 'y') { $delete = 1; } else { $delete = 0; } if ($enabled == 'y') { $enabled = 1; } else { $enabled = 0; } $this->rcmail_inst->output->set_env('framed', true); $out .= '<fieldset><legend>' . $this->gettext('acc_fetchmail') . '</legend>' . "\n"; $hidden_id = new html_hiddenfield(array('name' => '_id', 'value' => $mail_fetchmail['mailget_id'])); $out .= $hidden_id->show(); $table = new html_table(array('cols' => 2, 'class' => 'propform')); $input_fetchmailtyp = new html_select(array('name' => '_fetchmailtyp', 'id' => 'fetchmailtyp')); $input_fetchmailtyp->add(array('POP3', 'IMAP', 'POP3 SSL', 'IMAP SSL'), array('pop3', 'imap', 'pop3ssl', 'imapssl')); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailtyp'))); $table->add('', $input_fetchmailtyp->show($mail_fetchmail['type'])); $input_fetchmailserver = new html_inputfield(array('name' => '_fetchmailserver', 'id' => 'fetchmailserver', 'maxlength' => 320, 'size' => 40)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailserver'))); $table->add('', $input_fetchmailserver->show($mail_fetchmail['source_server'])); $input_fetchmailuser = new html_inputfield(array('name' => '_fetchmailuser', 'id' => 'fetchmailuser', 'maxlength' => 320, 'size' => 40)); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('username'))); $table->add('', $input_fetchmailuser->show($mail_fetchmail['source_username'])); $input_fetchmailpass = new html_passwordfield(array('name' => '_fetchmailpass', 'id' => 'fetchmailpass', 'maxlength' => 320, 'size' => 40, 'autocomplete' => 'off')); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('password'))); $table->add('', $input_fetchmailpass->show($mail_fetchmail['source_password'])); $input_fetchmaildelete = new html_checkbox(array('name' => '_fetchmaildelete', 'id' => 'fetchmaildelete', 'value' => '1')); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmaildelete'))); $table->add('', $input_fetchmaildelete->show($delete)); $input_fetchmailenabled = new html_checkbox(array('name' => '_fetchmailenabled', 'id' => 'fetchmailenabled', 'value' => '1')); $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('fetchmailenabled'))); $table->add('', $input_fetchmailenabled->show($enabled)); $out .= $table->show(); $out .= "</fieldset>\n"; return $out; }
/** * GUI object 'charsetselector' * * @param array Named parameters for the select tag * @return string HTML code for the gui object */ public function charset_selector($attrib) { // pass the following attributes to the form class $field_attrib = array('name' => '_charset'); foreach ($attrib as $attr => $value) { if (in_array($attr, array('id', 'name', 'class', 'style', 'size', 'tabindex'))) { $field_attrib[$attr] = $value; } } $charsets = array('UTF-8' => 'UTF-8 (' . $this->app->gettext('unicode') . ')', 'US-ASCII' => 'ASCII (' . $this->app->gettext('english') . ')', 'ISO-8859-1' => 'ISO-8859-1 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-2' => 'ISO-8859-2 (' . $this->app->gettext('easterneuropean') . ')', 'ISO-8859-4' => 'ISO-8859-4 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-5' => 'ISO-8859-5 (' . $this->app->gettext('cyrillic') . ')', 'ISO-8859-6' => 'ISO-8859-6 (' . $this->app->gettext('arabic') . ')', 'ISO-8859-7' => 'ISO-8859-7 (' . $this->app->gettext('greek') . ')', 'ISO-8859-8' => 'ISO-8859-8 (' . $this->app->gettext('hebrew') . ')', 'ISO-8859-9' => 'ISO-8859-9 (' . $this->app->gettext('turkish') . ')', 'ISO-8859-10' => 'ISO-8859-10 (' . $this->app->gettext('nordic') . ')', 'ISO-8859-11' => 'ISO-8859-11 (' . $this->app->gettext('thai') . ')', 'ISO-8859-13' => 'ISO-8859-13 (' . $this->app->gettext('baltic') . ')', 'ISO-8859-14' => 'ISO-8859-14 (' . $this->app->gettext('celtic') . ')', 'ISO-8859-15' => 'ISO-8859-15 (' . $this->app->gettext('westerneuropean') . ')', 'ISO-8859-16' => 'ISO-8859-16 (' . $this->app->gettext('southeasterneuropean') . ')', 'WINDOWS-1250' => 'Windows-1250 (' . $this->app->gettext('easterneuropean') . ')', 'WINDOWS-1251' => 'Windows-1251 (' . $this->app->gettext('cyrillic') . ')', 'WINDOWS-1252' => 'Windows-1252 (' . $this->app->gettext('westerneuropean') . ')', 'WINDOWS-1253' => 'Windows-1253 (' . $this->app->gettext('greek') . ')', 'WINDOWS-1254' => 'Windows-1254 (' . $this->app->gettext('turkish') . ')', 'WINDOWS-1255' => 'Windows-1255 (' . $this->app->gettext('hebrew') . ')', 'WINDOWS-1256' => 'Windows-1256 (' . $this->app->gettext('arabic') . ')', 'WINDOWS-1257' => 'Windows-1257 (' . $this->app->gettext('baltic') . ')', 'WINDOWS-1258' => 'Windows-1258 (' . $this->app->gettext('vietnamese') . ')', 'ISO-2022-JP' => 'ISO-2022-JP (' . $this->app->gettext('japanese') . ')', 'ISO-2022-KR' => 'ISO-2022-KR (' . $this->app->gettext('korean') . ')', 'ISO-2022-CN' => 'ISO-2022-CN (' . $this->app->gettext('chinese') . ')', 'EUC-JP' => 'EUC-JP (' . $this->app->gettext('japanese') . ')', 'EUC-KR' => 'EUC-KR (' . $this->app->gettext('korean') . ')', 'EUC-CN' => 'EUC-CN (' . $this->app->gettext('chinese') . ')', 'BIG5' => 'BIG5 (' . $this->app->gettext('chinese') . ')', 'GB2312' => 'GB2312 (' . $this->app->gettext('chinese') . ')'); if (!empty($_POST['_charset'])) { $set = $_POST['_charset']; } else { if (!empty($attrib['selected'])) { $set = $attrib['selected']; } else { $set = $this->get_charset(); } } $set = strtoupper($set); if (!isset($charsets[$set])) { $charsets[$set] = $set; } $select = new html_select($field_attrib); $select->add(array_values($charsets), array_keys($charsets)); return $select->show($set); }
/** * Form to select options for exporting events */ function events_export_form($attrib = array()) { if (!$attrib['id']) { $attrib['id'] = 'rcmExportForm'; } $html .= html::div('form-section', html::label('event-export-calendar', $this->cal->gettext('calendar')) . $this->calendar_select(array('name' => 'calendar', 'id' => 'event-export-calendar'))); $select = new html_select(array('name' => 'range', 'id' => 'event-export-range')); $select->add(array($this->cal->gettext('all'), $this->cal->gettext('onemonthback'), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 2))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 3))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 6))), $this->cal->gettext(array('name' => 'nmonthsback', 'vars' => array('nr' => 12))), $this->cal->gettext('customdate')), array(0, '1', '2', '3', '6', '12', 'custom')); $startdate = new html_inputfield(array('name' => 'start', 'size' => 11, 'id' => 'event-export-startdate')); $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportrange')) . $select->show(0) . html::span(array('style' => 'display:none'), $startdate->show())); $checkbox = new html_checkbox(array('name' => 'attachments', 'id' => 'event-export-attachments', 'value' => 1)); $html .= html::div('form-section', html::label('event-export-range', $this->cal->gettext('exportattachments')) . $checkbox->show(1)); $this->rc->output->add_gui_object('exportform', $attrib['id']); return html::tag('form', array('action' => $this->rc->url(array('task' => 'calendar', 'action' => 'export_events')), 'method' => "post", 'id' => $attrib['id']), $html); }