本文整理汇总了PHP中html_select::add方法的典型用法代码示例。如果您正苦于以下问题:PHP html_select::add方法的具体用法?PHP html_select::add怎么用?PHP html_select::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_select
的用法示例。
在下文中一共展示了html_select::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
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;
}
示例2: array
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;
}
示例3: Q
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;
}
示例4:
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;
}
示例5: array
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;
}
示例6: array
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;
}
示例7: task_itip_status
/**
* 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);
}
示例8: get_edit_field
/**
* Create an edit field for inclusion on a form
*
* @param string col field name
* @param string value field value
* @param array attrib HTML element attributes for field
* @param string type HTML element type (default 'text')
*
* @return string HTML field definition
*/
public static function get_edit_field($col, $value, $attrib, $type = 'text')
{
static $colcounts = array();
$fname = '_' . $col;
$attrib['name'] = $fname . ($attrib['array'] ? '[]' : '');
$attrib['class'] = trim($attrib['class'] . ' ff_' . $col);
if ($type == 'checkbox') {
$attrib['value'] = '1';
$input = new html_checkbox($attrib);
} else {
if ($type == 'textarea') {
$attrib['cols'] = $attrib['size'];
$input = new html_textarea($attrib);
} else {
if ($type == 'select') {
$input = new html_select($attrib);
$input->add('---', '');
$input->add(array_values($attrib['options']), array_keys($attrib['options']));
} else {
if ($attrib['type'] == 'password') {
$input = new html_passwordfield($attrib);
} else {
if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') {
$attrib['type'] = 'text';
}
$input = new html_inputfield($attrib);
}
}
}
}
// use value from post
if (isset($_POST[$fname])) {
$postvalue = self::get_input_value($fname, self::INPUT_POST, true);
$value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
}
$out = $input->show($value);
return $out;
}
示例9: charset_selector
/**
* 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);
}
示例10: isset
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');
//.........这里部分代码省略.........
示例11: mail_messagebody_html
/**
* 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'));
//.........这里部分代码省略.........
示例12: folder_selector
/**
* Return folders list as html_select object
*
* @param array $p Named parameters
*
* @return html_select HTML drop-down object
*/
public function folder_selector($p = array())
{
$p += array('maxlength' => 100, 'realnames' => false, 'is_escaped' => true);
$a_mailboxes = array();
$storage = $this->get_storage();
if (empty($p['folder_name'])) {
$p['folder_name'] = '*';
}
if ($p['unsubscribed']) {
$list = $storage->list_folders('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
} else {
$list = $storage->list_folders_subscribed('', $p['folder_name'], $p['folder_filter'], $p['folder_rights']);
}
$delimiter = $storage->get_hierarchy_delimiter();
foreach ($list as $folder) {
if (empty($p['exceptions']) || !in_array($folder, $p['exceptions'])) {
$this->build_folder_tree($a_mailboxes, $folder, $delimiter);
}
}
$select = new html_select($p);
if ($p['noselection']) {
$select->add(html::quote($p['noselection']), '');
}
$this->render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p);
return $select;
}
示例13: isset
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;
}
示例14:
?>
</td>
</tr>
</tbody>
</table>
<p><input type="submit" name="sendmail" value="Send test mail" /></p>
<h3>Test IMAP config</h3>
<?php
$default_hosts = $RCI->get_hostlist();
if (!empty($default_hosts)) {
$host_field = new html_select(array('name' => '_host', 'id' => 'imaphost'));
$host_field->add($default_hosts);
} else {
$host_field = new html_inputfield(array('name' => '_host', 'id' => 'imaphost'));
}
$user_field = new html_inputfield(array('name' => '_user', 'id' => 'imapuser'));
$pass_field = new html_passwordfield(array('name' => '_pass', 'id' => 'imappass'));
?>
<table>
<tbody>
<tr>
<td><label for="imaphost">Server</label></td>
<td><?php
echo $host_field->show($_POST['_host']);
?>
</td>
示例15: _prefs_block
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'));
//.........这里部分代码省略.........