Пример #1
0
 /**
  * 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, Q($this->gettext($type))), 'content' => $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 gen_form()
 {
     list($form_start, $form_end) = get_form_tags(null, 'plugin.changepasswd_AD.save');
     // return the complete form as table
     $out = $form_start;
     $table = new html_table(array('cols' => 2));
     // show old password field
     $field_id = 'rcmfd_curpwd';
     $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('curpasswd'))));
     $table->add(null, $input_curpasswd->show());
     // show new password field
     $field_id = 'rcmfd_newpwd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show new password confirm field
     $field_id = 'rcmfd_cnfpwd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id));
     $table->add('title', html::label($field_id, Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $out .= $table->show();
     $out .= $form_end;
     return $out;
 }
 public static function row($label, $control, $help = null)
 {
     if (!empty($help)) {
         $help = html::span('help-block', $help);
     } else {
         $help = '';
     }
     return html::div('control-group', html::label('control-label', $label) . html::div('controls', $control . $help));
 }
 function settings_blocks($args)
 {
     if ($args['section'] == 'server') {
         $use_subscriptions = rcmail::get_instance()->config->get('use_subscriptions');
         $field_id = 'rcmfd_use_subscriptions';
         $checkbox = new html_checkbox(array('name' => '_use_subscriptions', 'id' => $field_id, 'value' => 1));
         $args['blocks']['main']['options']['use_subscriptions'] = array('title' => html::label($field_id, rcube::Q($this->gettext('useimapsubscriptions'))), 'content' => $checkbox->show($use_subscriptions ? 1 : 0));
     }
     return $args;
 }
Пример #6
0
 function prefs_list($args)
 {
     if ($args['section'] == 'compose') {
         $this->add_texts('localization/');
         $reminder = rcube::get_instance()->config->get('attachment_reminder');
         $field_id = 'rcmfd_attachment_reminder';
         $checkbox = new html_checkbox(array('name' => '_attachment_reminder', 'id' => $field_id, 'value' => 1));
         $args['blocks']['main']['options']['attachment_reminder'] = array('title' => html::label($field_id, rcube::Q($this->gettext('reminderoption'))), 'content' => $checkbox->show($reminder ? 1 : 0));
     }
     return $args;
 }
 function preferences_list($args)
 {
     if ($args['section'] == 'server') {
         $protectimus_authentication_enabled = $this->rcmail->config->get('protectimus_authentication_enabled', $this->rcmail->config->get('protectimus_authentication_enabled_by_default_for_user'));
         $field_id = 'protectimus_authentication_enabled';
         $checkbox = new html_checkbox(array('name' => '_protectimus_authentication_enabled', 'id' => $field_id, 'value' => 1));
         $args['blocks']['protectimus']['name'] = 'Protectimus';
         $args['blocks']['protectimus']['options']['protectimus_authentication_enabled'] = array('title' => html::label($field_id, $this->gettext('use_2fa')), 'content' => $checkbox->show($protectimus_authentication_enabled ? 1 : 0));
     }
     return $args;
 }
Пример #8
0
 public static function item($attrs, $template = '')
 {
     $description = array_take('description', $attrs);
     $label = array_take('label', $attrs);
     $str = empty($template) ? form::template() : $template;
     $str = str_replace('{$field:label}', html::label($label, $attrs['name']), $str);
     $str = str_replace('{$field:required}', form::required($attrs['valid']), $str);
     $str = str_replace('{$field:description}', form::description($description), $str);
     $str = str_replace('{$field:controller}', form::field($attrs), $str);
     return $str;
 }
Пример #9
0
 public function forward_form()
 {
     $table = new html_table(array('cols' => 2));
     $field_id = 'forwardforwards';
     $text_forwardforwards = new html_textarea(array('name' => '_forwardforwards', 'id' => $field_id, 'spellcheck' => 1, 'rows' => 6, 'cols' => 40));
     $table->add('title', html::label($field_id, Q($this->gettext('forwardforwards'))));
     $table->add(null, $text_forwardforwards->show($this->obj->get_forward_forwards()));
     $field_id = 'forwardkeepcopies';
     $input_forwardkeepcopies = new html_checkbox(array('name' => '_forwardkeepcopies', 'id' => $field_id, 'value' => 1));
     $table->add('title', html::label($field_id, Q($this->gettext('forwardkeepcopies'))));
     $table->add(null, $input_forwardkeepcopies->show($this->obj->is_forward_keepcopies() === true || $this->obj->is_forward_keepcopies() == "1" || $this->obj->is_forward_keepcopies() == "t" || $this->obj->is_forward_keepcopies() == "y" || $this->obj->is_forward_keepcopies() == "yes" ? 1 : 0));
     $out = html::div(array('class' => "box"), html::div(array('id' => "prefs-title", 'class' => 'boxtitle'), $this->gettext('forward')) . html::div(array('class' => "boxcontent"), $table->show() . html::p(null, $this->rc->output->button(array('command' => 'plugin.forward-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $this->rc->output->add_gui_object('forwardform', 'forward-form');
     return $this->rc->output->form_tag(array('id' => 'forward-form', 'name' => 'forward-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.forward-save'), $out);
 }
Пример #10
0
 function preferences_list($args)
 {
     if ($args['section'] == 'jabber') {
         $jabber_username = $this->rc->config->get('jabber_username');
         $jabber_domain = $this->rc->config->get('jabber_domain', 'jappix.com');
         $jabber_enc = $this->rc->config->get('jabber_enc');
         if ((!$jabber_username || !$jabber_enc || !$jabber_domain) && $this->rc->config->get('jappix_register_url')) {
             $field_id = 'rcmfd_register';
             $args['blocks']['jabber']['options']['jappix_register'] = array('title' => html::label($field_id, @$this->gettext('requirement')), 'content' => html::tag('a', array('href' => $this->rc->config->get('jappix_register_url'), 'target' => '_blank'), $this->gettext('clickhere')) . ' ' . $this->gettext('registeraccount'));
         }
         $jappix_enabled = $this->rc->config->get('jappix_enabled', 0);
         $field_id = 'rcmfd_enabled';
         $checkbox = new html_checkbox(array('name' => '_jappix_enabled', 'value' => 1, 'id' => $field_id, 'onclick' => "if(\$(this).prop('checked') == false || \$('input[name=\\'_jabber_username\\']').val() != ''){ \$('.mainaction').hide(); document.forms.form.submit(); };"));
         $args['blocks']['jabber']['options']['jappix_enabled'] = array('title' => html::label($field_id, Q($this->gettext('enabled'))), 'content' => $checkbox->show($jappix_enabled ? 1 : 0));
         $field_id_user = '******';
         $input_user = new html_inputfield(array('name' => '_jabber_username', 'id' => $field_id_user, 'size' => 25));
         if ($jabber_domain == '%d') {
             $jabber_domain = end(explode('@', $this->rc->user->data['username']));
         }
         $field_id_domain = 'rcmfd_domain';
         $input_domain = new html_inputfield(array('name' => '_jabber_domain', 'id' => $field_id_domain, 'size' => 25));
         $args['blocks']['jabber']['options']['jabber_username'] = array('title' => html::label($field_id, Q($this->gettext('jappixUsername'))), 'content' => $input_user->show($jabber_username) . ' @ ' . $input_domain->show($jabber_domain));
         $field_id = 'rcmfd_enc';
         $input = new html_passwordfield(array('name' => '_jabber_password', 'id' => $field_id, 'size' => 25, 'placeholder' => $jabber_enc ? $this->gettext('passwordisset') : $this->gettext('pleaseenterpassword')));
         $args['blocks']['jabber']['options']['jabber_password'] = array('title' => html::label($field_id, Q($this->gettext('jappixPassword'))), 'content' => $input->show());
         $jappix_full = $this->rc->config->get('jappix_full', 1);
         $field_id = 'rcmfd_use_full';
         $checkbox = new html_checkbox(array('name' => '_jappix_full', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.\$('.button-jappix4roundcube').show(); } else { parent.\$('.button-jappix4roundcube').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_full'] = array('title' => html::label($field_id, Q($this->gettext('usefulljappix'))), 'content' => $checkbox->show($jappix_full ? 1 : 0));
         $jappix_mini = $this->rc->config->get('jappix_mini', 1);
         $field_id = 'rcmfd_use_mini';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_position').show(); } else { parent.parent.\$('.jm_position').hide(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini'] = array('title' => html::label($field_id, Q($this->gettext('useminijappix'))), 'content' => $checkbox->show($jappix_mini ? 1 : 0));
         $jappix_mini_autologon = $this->rc->config->get('jappix_mini_autologon', 1);
         $field_id = 'rcmfd_use_mini_autologon';
         $checkbox = new html_checkbox(array('name' => '_jappix_mini_autologon', 'value' => 1, 'id' => $field_id, 'onclick' => "if(this.checked){ parent.parent.\$('.jm_pane').trigger('click'); } else { if(parent.parent.JappixMini) parent.parent.JappixMini.disconnect(); }; \$('.mainaction').hide(); document.forms.form.submit();"));
         $args['blocks']['jabber']['options']['jappix_mini_autologon'] = array('title' => html::label($field_id, Q($this->gettext('minijappixautologon'))), 'content' => $checkbox->show($jappix_mini_autologon ? 1 : 0));
         /*
         $field_id = 'rcmfd_use_manager';
         $args['blocks']['jabber']['options']['jabber_manager'] = array(
           'title' => html::label($field_id, Q($this->gettext('manager'))),
           'content' => '<a target=\'_blank\' href=\''.$this->rc->config->get('jappix_url').'/?m=manager\'>'.Q($this->gettext('manager')).'</a>',
         );
         */
     }
     return $args;
 }
 function preferences_list($params)
 {
     $rcmail = rcmail::get_instance();
     if ($params['section'] == 'addressbook') {
         $params['blocks'][$this->id]['name'] = $this->abook_name;
         $field_id = 'rc_use_plugin';
         $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('use') . $this->abook_name), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_use_plugin)));
         $field_id = 'rc_google_autosync';
         $checkbox = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('autosync')), 'content' => $checkbox->show($rcmail->config->get(google_func::$settings_key_auto_sync)));
         $field_id = 'rc_google_authcode';
         $input_auth = new html_inputfield(array('name' => $field_id, 'id' => $field_id, 'size' => 45));
         $params['blocks'][$this->id]['options'][$field_id] = array('title' => html::label($field_id, $this->gettext('authcode')), 'content' => $input_auth->show($rcmail->config->get(google_func::$settings_key_auth_code)));
         $params['blocks'][$this->id]['options']['link'] = array('title' => html::span('', ''), 'content' => html::a(array('href' => google_func::get_client()->createAuthUrl(), 'target' => '_blank'), $this->gettext('authcodelink')));
     }
     return $params;
 }
Пример #12
0
 function preferences_list($p)
 {
     try {
         //You must set a block or the section will not be displayed
         if ($p['section'] == 'server') {
             $this->loadData();
             // ================================================================
             //Auto reply
             $p['blocks'][ARBLOCK]['name'] = $this->gettext('autoreply');
             $ctrl_id = 'ztp_ar_enabled';
             $ctrl = new html_checkbox(array('name' => '_ar_enabled', 'id' => $ctrl_id, 'value' => 1));
             $p['blocks'][ARBLOCK]['options']['ar_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_enabled'))), 'content' => $ctrl->show($this->ar_enabled));
             $ctrl_id = 'ztp_ar_subject';
             $ctrl = new html_inputfield(array('type' => 'text', 'name' => '_ar_subject', 'id' => $ctrl_id));
             $p['blocks'][ARBLOCK]['options']['ar_subject'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_subject'))), 'content' => $ctrl->show($this->ar_subject));
             $ctrl_id = 'ztp_ar_body';
             $ctrl = new html_textarea(array('name' => '_ar_body', 'id' => $ctrl_id, 'rows' => 5, 'cols' => 50));
             $p['blocks'][ARBLOCK]['options']['ar_body'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_body'))), 'content' => $ctrl->show($this->ar_body));
             $ctrl_id = 'ztp_ar_ae_enabled';
             $ctrl = new html_checkbox(array('name' => '_ar_ae_enabled', 'id' => $ctrl_id, 'value' => 1));
             $ctrl2_id = 'ztp_ar_ae_date';
             $ctrl2 = new html_inputfield(array('name' => '_ar_ae_date', 'id' => $ctrl2_id));
             $p['blocks'][ARBLOCK]['options']['ar_ae_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('ar_ae_enabled'))), 'content' => $ctrl->show($this->ar_ae_enabled) . " " . $ctrl2->show($this->ar_ae_date));
             // ================================================================
             //Forwarder
             $p['blocks'][FWBLOCK]['name'] = $this->gettext('forwarder');
             $ctrl_id = 'ztp_fw_enabled';
             $ctrl = new html_checkbox(array('name' => '_fw_enabled', 'id' => $ctrl_id, 'value' => 1));
             $p['blocks'][FWBLOCK]['options']['fw_enabled'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_enabled'))), 'content' => $ctrl->show($this->fw_enabled));
             $ctrl_id = 'ztp_fw_address';
             $ctrl = new html_inputfield(array('name' => '_fw_address', 'id' => $ctrl_id));
             $p['blocks'][FWBLOCK]['options']['fw_address'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_address'))), 'content' => $ctrl->show($this->fw_address));
             $ctrl_id = 'ztp_fw_keeporiginal';
             $ctrl = new html_checkbox(array('name' => '_fw_keeporiginal', 'id' => $ctrl_id, 'value' => 1));
             $p['blocks'][FWBLOCK]['options']['fw_keeporiginal'] = array('title' => html::label($ctrl_id, Q($this->gettext('fw_keeporiginal'))), 'content' => $ctrl->show($this->fw_keeporiginal));
         }
     } catch (Exception $e) {
         $p['abort'] = true;
         $p['result'] = false;
         $p['message'] = $e->getMessage();
     }
     return $p;
 }
 /**
  * Handler for user preferences form (preferences_list hook)
  */
 public function prefs_list($args)
 {
     if ($args['section'] != 'mailbox') {
         return $args;
     }
     // Load localization and configuration
     $this->add_texts('localization/');
     // Check that configuration is not disabled
     $dont_override = (array) $this->rc->config->get('dont_override', array());
     $key = 'pref_use_infinite_scroll';
     if (!in_array($key, $dont_override)) {
         $config_key = 'use_infinite_scroll';
         $field_id = "_" . $key;
         $is_checked = $this->rc->config->get($config_key, true);
         $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
         $content = $input->show($is_checked);
         $args['blocks']['main']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($key))), 'content' => $content);
     }
     return $args;
 }
Пример #14
0
 function header_alter_charsets($p)
 {
     if ($msg_uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
         $rcmail = rcmail::get_instance();
         $alter_charset = (array) $rcmail->config->get('alter_charset', array());
         $charset = $this->charset($msg_uid);
         $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         //error_log($charset."\n",3,"/var/log/nginx/checkmail_error.log");
         if ($alias_charset = get_input_value('_alter_charset', RCUBE_INPUT_GET)) {
             $charset = $alter_charset[$alias_charset];
             $url = str_replace('&_alter_charset=' . $alias_charset, '', $url);
         }
         $selector = '';
         foreach ($alter_charset as $key => $value) {
             $selector .= sprintf('<input type="radio" id="r_%s" onclick="window.location.href=\'https://%s&_alter_charset=%s\';" value="%s" %s>', $key, $url, $key, $key, current(array_keys($alter_charset, $charset)) == $key ? 'checked' : '') . html::label($attrib['id'], strtolower($value));
         }
         $p['output']['selectcharset'] = array('title' => rcube_label('charset'), 'value' => strtr($selector, "\r\n", "  "));
     }
     return $p;
 }
Пример #15
0
 function prefs_list($args)
 {
     if ($args['section'] != 'general') {
         return $args;
     }
     $this->load_config();
     $this->add_texts('localization/');
     $dont_override = array_merge((array) $this->rc->config->get('dont_override', array()), (array) $this->rc->config->get('larrymod_dont_override', array()));
     foreach (array('headermini', 'hidelabels', 'hidetoplabels', 'superpreview', 'superpreview_hidefolderslist', 'unselectable') as $type) {
         $key = 'larrymod_' . $type;
         if (!in_array($key, $dont_override)) {
             if (empty($args['blocks']['skin']['name'])) {
                 $args['blocks']['skin'] = array('name' => rcube::Q($this->gettext('skin')));
             }
             $field_id = '_' . $key;
             $input = new html_checkbox(array('name' => $field_id, 'id' => $field_id, 'value' => 1));
             $args['blocks']['skin']['options'][$key] = array('title' => html::label($field_id, rcube::Q($this->gettext($type))), 'content' => $input->show($this->rc->config->get($key, false)));
         }
     }
     return $args;
 }
Пример #16
0
 public static function field($attrs)
 {
     if ($attrs['type'] == 'hidden') {
         echo form::control($attrs);
     } else {
         $label = arr::take('label', $attrs);
         $description = arr::take('description', $attrs);
         $str = form::template(form::$template);
         /*
         $str = strstr($str,array(
         	'{$field:label}'=>html::label($label,$attrs['name']),
         	'{$field:required}'=>form::required($attrs['valid']),
         	'{$field:description}'=>form::description($description),
         	'{$field:controller}'=>form::control($attrs),
         ));
         */
         $str = str_replace('{$field:label}', html::label($label, $attrs['name']), $str);
         $str = str_replace('{$field:required}', form::required($attrs['valid']), $str);
         $str = str_replace('{$field:description}', form::description($description), $str);
         $str = str_replace('{$field:controller}', form::control($attrs), $str);
         echo $str;
     }
 }
Пример #17
0
 public static function label(&$attrs, $required = '*')
 {
     $label = arr::take('label', $attrs);
     $label = '<span>' . $label . '</span>';
     if (strpos($attrs['valid'], 'required') !== false) {
         $label = '<span class="field-required">' . $required . '</span>' . $label;
     }
     $label = html::label($label, $attrs['name']);
     return $label;
 }
Пример #18
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, rcube::Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $rules = '';
     $required_length = intval($rcmail->config->get('password_minimum_length'));
     if ($required_length > 0) {
         $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array('name' => 'passwordshort', 'vars' => array('length' => $required_length))));
     }
     if ($rcmail->config->get('password_require_nonalpha')) {
         $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak'));
     }
     if (!empty($rules)) {
         $rules = html::tag('ul', array('id' => 'ruleslist'), $rules);
     }
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . $rules . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
Пример #19
0
 public function label()
 {
     return html::label($this->name, $this->name);
 }
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // Disable autocapitalization on iPad/iPhone (#1488609)
     $attrib['autocapitalize'] = 'off';
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser', 'required' => 'required') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd', 'required' => 'required') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = key($default_host)) !== null) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => is_numeric($host) ? $default_host[$host] : $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show('mail@box'));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     if (rcube_utils::get_boolean($attrib['submit'])) {
         $submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit', 'class' => 'button mainaction', 'value' => $this->app->gettext('login')));
         $out .= html::p('formbuttons', $submit->show());
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     // include script for timezone detection
     $this->include_script('jstz.min.js');
     return $out;
 }
 /**
  * Shows an option in prefrences section to enable or disable the plugin.
  *
  * @param array $args Default hook arguments.
  *
  * @return array
  */
 public function prefs_content($args)
 {
     // ensure we are in the right section
     if ($args['section'] == 'recipienttocontact') {
         $field_id = 'rcmfd_use_recipienttocontact';
         // current status: plugin can be enabled or disabled
         $use_recipienttocontact = $this->rcmail->config->get('use_recipienttocontact');
         // checkbox element to change the status of the plugin
         $checkbox = new html_checkbox(array('name' => '_use_recipienttocontact', 'id' => $field_id, 'value' => 1, 'style' => 'margin-left: -300px'));
         $args['blocks']['recipienttocontact']['name'] = rcube::Q($this->gettext('prefs_title'));
         $args['blocks']['recipienttocontact']['options']['use_subscriptions'] = array('title' => html::label($field_id, rcube::Q($this->gettext('prefs_option'))), 'content' => $checkbox->show($use_recipienttocontact ? 1 : 0));
         $args['blocks']['recipienttocontact']['options']['description'] = array('title' => html::div(null, rcube::Q($this->gettext('prefs_descr'))) . html::br(), 'content' => '');
     }
     return $args;
 }
Пример #22
0
 /**
  * Generate the form for recurrence settings
  */
 public function recurrence_form($attrib = array())
 {
     switch ($attrib['part']) {
         // frequency selector
         case 'frequency':
             $select = new html_select(array('name' => 'frequency', 'id' => 'edit-recurrence-frequency'));
             $select->add($this->gettext('never'), '');
             $select->add($this->gettext('daily'), 'DAILY');
             $select->add($this->gettext('weekly'), 'WEEKLY');
             $select->add($this->gettext('monthly'), 'MONTHLY');
             $select->add($this->gettext('yearly'), 'YEARLY');
             $select->add($this->gettext('rdate'), 'RDATE');
             $html = html::label('edit-recurrence-frequency', $this->gettext('frequency')) . $select->show('');
             break;
             // daily recurrence
         // daily recurrence
         case 'daily':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-daily'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-daily', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('days')));
             break;
             // weekly recurrence form
         // weekly recurrence form
         case 'weekly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-weekly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-weekly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('weeks')));
             // weekday selection
             $daymap = array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');
             $checkbox = new html_checkbox(array('name' => 'byday', 'class' => 'edit-recurrence-weekly-byday'));
             $first = $this->rc->config->get('calendar_first_day', 1);
             for ($weekdays = '', $j = $first; $j <= $first + 6; $j++) {
                 $d = $j % 7;
                 $weekdays .= html::label(array('class' => 'weekday'), $checkbox->show('', array('value' => strtoupper(substr($daymap[$d], 0, 2)))) . $this->gettext($daymap[$d])) . ' ';
             }
             $html .= html::div($attrib, html::label(null, $this->gettext('bydays')) . $weekdays);
             break;
             // monthly recurrence form
         // monthly recurrence form
         case 'monthly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-monthly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-monthly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('months')));
             $checkbox = new html_checkbox(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday'));
             for ($monthdays = '', $d = 1; $d <= 31; $d++) {
                 $monthdays .= html::label(array('class' => 'monthday'), $checkbox->show('', array('value' => $d)) . $d);
                 $monthdays .= $d % 7 ? ' ' : html::br();
             }
             // rule selectors
             $radio = new html_radiobutton(array('name' => 'repeatmode', 'class' => 'edit-recurrence-monthly-mode'));
             $table = new html_table(array('cols' => 2, 'border' => 0, 'cellpadding' => 0, 'class' => 'formtable'));
             $table->add('label', html::label(null, $radio->show('BYMONTHDAY', array('value' => 'BYMONTHDAY')) . ' ' . $this->gettext('each')));
             $table->add(null, $monthdays);
             $table->add('label', html::label(null, $radio->show('', array('value' => 'BYDAY')) . ' ' . $this->gettext('onevery')));
             $table->add(null, $this->rrule_selectors($attrib['part']));
             $html .= html::div($attrib, $table->show());
             break;
             // annually recurrence form
         // annually recurrence form
         case 'yearly':
             $select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-yearly'));
             $html = html::div($attrib, html::label('edit-recurrence-interval-yearly', $this->gettext('every')) . $select->show(1) . html::span('label-after', $this->gettext('years')));
             // month selector
             $monthmap = array('', 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
             $checkbox = new html_checkbox(array('name' => 'bymonth', 'class' => 'edit-recurrence-yearly-bymonth'));
             for ($months = '', $m = 1; $m <= 12; $m++) {
                 $months .= html::label(array('class' => 'month'), $checkbox->show(null, array('value' => $m)) . $this->gettext($monthmap[$m]));
                 $months .= $m % 4 ? ' ' : html::br();
             }
             $html .= html::div($attrib + array('id' => 'edit-recurrence-yearly-bymonthblock'), $months);
             // day rule selection
             $html .= html::div($attrib, html::label(null, $this->gettext('onevery')) . $this->rrule_selectors($attrib['part'], '---'));
             break;
             // end of recurrence form
         // end of recurrence form
         case 'until':
             $radio = new html_radiobutton(array('name' => 'repeat', 'class' => 'edit-recurrence-until'));
             $select = $this->interval_selector(array('name' => 'times', 'id' => 'edit-recurrence-repeat-times'));
             $input = new html_inputfield(array('name' => 'untildate', 'id' => 'edit-recurrence-enddate', 'size' => "10"));
             $html = html::div('line first', html::label(null, $radio->show('', array('value' => '', 'id' => 'edit-recurrence-repeat-forever')) . ' ' . $this->gettext('forever')));
             $forntimes = $this->gettext(array('name' => 'forntimes', 'vars' => array('nr' => '%s')));
             $html .= html::div('line', $radio->show('', array('value' => 'count', 'id' => 'edit-recurrence-repeat-count', 'aria-label' => sprintf($forntimes, 'N'))) . ' ' . sprintf($forntimes, $select->show(1)));
             $html .= html::div('line', $radio->show('', array('value' => 'until', 'id' => 'edit-recurrence-repeat-until', 'aria-label' => $this->gettext('untilenddate'))) . ' ' . $this->gettext('untildate') . ' ' . $input->show('', array('aria-label' => $this->gettext('untilenddate'))));
             $html = html::div($attrib, html::label(null, ucfirst($this->gettext('recurrencend'))) . $html);
             break;
         case 'rdate':
             $ul = html::tag('ul', array('id' => 'edit-recurrence-rdates'), '');
             $input = new html_inputfield(array('name' => 'rdate', 'id' => 'edit-recurrence-rdate-input', 'size' => "10"));
             $button = new html_inputfield(array('type' => 'button', 'class' => 'button add', 'value' => $this->gettext('addrdate')));
             $html .= html::div($attrib, $ul . html::div('inputform', $input->show() . $button->show()));
             break;
     }
     return $html;
 }
Пример #23
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     $this->load_config();
     // add some labels to client
     $rcmail->output->add_label('password.nopassword', 'password.nocurpassword', 'password.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     if ($rcmail->config->get('password_confirm_current')) {
         // show current password selection
         $field_id = 'curpasswd';
         $input_curpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
         $table->add('title', html::label($field_id, Q($this->gettext('curpasswd'))));
         $table->add(null, $input_curpasswd->show());
     }
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('newpasswd'))));
     $table->add(null, $input_newpasswd->show());
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 20, 'autocomplete' => 'off'));
     $table->add('title', html::label($field_id, Q($this->gettext('confpasswd'))));
     $table->add(null, $input_confpasswd->show());
     $out = html::div(array('class' => 'box'), html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) . html::div(array('class' => 'boxcontent'), $table->show() . html::p(null, $rcmail->output->button(array('command' => 'plugin.password-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'password-form');
     return $rcmail->output->form_tag(array('id' => 'password-form', 'name' => 'password-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.password-save'), $out);
 }
Пример #24
0
 /**
  * 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)) . ' &mdash; ' . $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) . '&nbsp;' . $category_color->show($color) . '&nbsp;' . $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('') . '&nbsp;' . $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("&nbsp;").append(color).append("&nbsp;").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'])) . '&nbsp;' . 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]) . '&nbsp;' . $select_offset->show($preset[1]));
     }
     return $p;
 }
Пример #25
0
 /**
  * GUI object 'loginform'
  * Returns code for the webmail login form
  *
  * @param array Named parameters
  * @return string HTML code for the gui object
  */
 protected function login_form($attrib)
 {
     $default_host = $this->config->get('default_host');
     $autocomplete = (int) $this->config->get('login_autocomplete');
     $_SESSION['temp'] = true;
     // save original url
     $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
     if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING'])) {
         $url = $_SERVER['QUERY_STRING'];
     }
     // set atocomplete attribute
     $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $host_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
     $pass_attrib = $autocomplete > 1 ? array() : array('autocomplete' => 'off');
     $input_task = new html_hiddenfield(array('name' => '_task', 'value' => 'login'));
     $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login'));
     $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_'));
     $input_dst = new html_hiddenfield(array('name' => '_dstactive', 'id' => 'rcmlogindst', 'value' => '_default_'));
     $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url));
     $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') + $attrib + $user_attrib);
     $input_pass = new html_passwordfield(array('name' => '_pass', 'id' => 'rcmloginpwd') + $attrib + $pass_attrib);
     $input_host = null;
     if (is_array($default_host) && count($default_host) > 1) {
         $input_host = new html_select(array('name' => '_host', 'id' => 'rcmloginhost'));
         foreach ($default_host as $key => $value) {
             if (!is_array($value)) {
                 $input_host->add($value, is_numeric($key) ? $value : $key);
             } else {
                 $input_host = null;
                 break;
             }
         }
     } else {
         if (is_array($default_host) && ($host = array_pop($default_host))) {
             $hide_host = true;
             $input_host = new html_hiddenfield(array('name' => '_host', 'id' => 'rcmloginhost', 'value' => $host) + $attrib);
         } else {
             if (empty($default_host)) {
                 $input_host = new html_inputfield(array('name' => '_host', 'id' => 'rcmloginhost') + $attrib + $host_attrib);
             }
         }
     }
     $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form';
     $this->add_gui_object('loginform', $form_name);
     // create HTML table with two cols
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('rcmloginuser', html::quote($this->app->gettext('username'))));
     $table->add('input', $input_user->show(rcube_utils::get_input_value('_user', rcube_utils::INPUT_GPC)));
     $table->add('title', html::label('rcmloginpwd', html::quote($this->app->gettext('password'))));
     $table->add('input', $input_pass->show());
     // add host selection row
     if (is_object($input_host) && !$hide_host) {
         $table->add('title', html::label('rcmloginhost', html::quote($this->app->gettext('server'))));
         $table->add('input', $input_host->show(rcube_utils::get_input_value('_host', rcube_utils::INPUT_GPC)));
     }
     $out = $input_task->show();
     $out .= $input_action->show();
     $out .= $input_tzone->show();
     $out .= $input_dst->show();
     $out .= $input_url->show();
     $out .= $table->show();
     if ($hide_host) {
         $out .= $input_host->show();
     }
     // surround html output with a form tag
     if (empty($attrib['form'])) {
         $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out);
     }
     return $out;
 }
Пример #26
0
 /**
  * Init compose UI (add task button and the menu)
  */
 private function compose_ui()
 {
     $this->add_css();
     // Options menu button
     $this->enigma->add_button(array('type' => 'link', 'command' => 'plugin.enigma', 'onclick' => "rcmail.command('menu-open', 'enigmamenu', event.target, event)", 'class' => 'button enigma', 'title' => 'encryptionoptions', 'label' => 'encryption', 'domain' => $this->enigma->ID, 'width' => 32, 'height' => 32), 'toolbar');
     $menu = new html_table(array('cols' => 2));
     $chbox = new html_checkbox(array('value' => 1));
     $menu->add(null, html::label(array('for' => 'enigmasignopt'), rcube::Q($this->enigma->gettext('signmsg'))));
     $menu->add(null, $chbox->show($this->rc->config->get('enigma_sign_all') ? 1 : 0, array('name' => '_enigma_sign', 'id' => 'enigmasignopt')));
     $menu->add(null, html::label(array('for' => 'enigmaencryptopt'), rcube::Q($this->enigma->gettext('encryptmsg'))));
     $menu->add(null, $chbox->show($this->rc->config->get('enigma_encrypt_all') ? 1 : 0, array('name' => '_enigma_encrypt', 'id' => 'enigmaencryptopt')));
     $menu = html::div(array('id' => 'enigmamenu', 'class' => 'popupmenu'), $menu->show());
     // Options menu contents
     $this->rc->output->add_footer($menu);
 }
 function preferences_list($args)
 {
     if ($args['section'] != 'server' || !$this->is_enabled()) {
         return $args;
     }
     $disabled = $this->disallow_change();
     // add checkbox to enable/disable YubiKey auth for the current user
     $chk_yubikey = new html_checkbox(array('name' => '_yubikey_required', 'id' => 'rcmfd_yubikey_required', 'disabled' => $disabled));
     $args['blocks']['main']['options']['yubikey_required'] = array('title' => html::label('rcmfd_yubikey_required', Q($this->gettext('yubikeyrequired'))), 'content' => $chk_yubikey->show(!$this->is_required()));
     // add inputfield for the YubiKey id
     $input_yubikey_id = new html_inputfield(array('name' => '_yubikey_id', 'id' => 'rcmfd_yubikey_id', 'size' => 12, 'disabled' => $disabled));
     $args['blocks']['main']['options']['yubikey_id'] = array('title' => html::label('rcmfd_yubikey_id', Q($this->gettext('yubikeyid'))), 'content' => $input_yubikey_id->show($this->get('yubikey_id')));
     // add inputfield for the YubiKey id2
     $input_yubikey_id2 = new html_inputfield(array('name' => '_yubikey_id2', 'id' => 'rcmfd_yubikey_id2', 'size' => 12, 'disabled' => $disabled));
     $args['blocks']['main']['options']['yubikey_id2'] = array('title' => html::label('rcmfd_yubikey_id2', Q($this->gettext('yubikeyid2'))), 'content' => $input_yubikey_id2->show($this->get('yubikey_id2')));
     // add inputfield for the YubiKey id3
     $input_yubikey_id3 = new html_inputfield(array('name' => '_yubikey_id3', 'id' => 'rcmfd_yubikey_id3', 'size' => 12, 'disabled' => $disabled));
     $args['blocks']['main']['options']['yubikey_id3'] = array('title' => html::label('rcmfd_yubikey_id3', Q($this->gettext('yubikeyid3'))), 'content' => $input_yubikey_id3->show($this->get('yubikey_id3')));
     return $args;
 }
Пример #28
0
 /**
  * Creates ACL rights form (user part)
  *
  * @param array $attrib Template object attributes
  *
  * @return string HTML Content
  */
 function templ_user($attrib)
 {
     // Create username input
     $attrib['name'] = 'acluser';
     $textfield = new html_inputfield($attrib);
     $fields['user'] = html::label(array('for' => 'iduser'), $this->gettext('username')) . ' ' . $textfield->show();
     // Add special entries
     if (!empty($this->specials)) {
         foreach ($this->specials as $key) {
             $fields[$key] = html::label(array('for' => 'id' . $key), $this->gettext($key));
         }
     }
     $this->rc->output->set_env('acl_specials', $this->specials);
     // Create list with radio buttons
     if (count($fields) > 1) {
         $ul = '';
         $radio = new html_radiobutton(array('name' => 'usertype'));
         foreach ($fields as $key => $val) {
             $ul .= html::tag('li', null, $radio->show($key == 'user' ? 'user' : '', array('value' => $key, 'id' => 'id' . $key)) . $val);
         }
         $out = html::tag('ul', array('id' => 'usertype', 'class' => $attrib['class']), $ul, html::$common_attrib);
     } else {
         $out = $fields['user'];
     }
     return $out;
 }
Пример #29
0
 /**
  * Handler for preferences_list hook.
  * Adds options blocks into Compose settings sections in Preferences.
  *
  * @param array Original parameters
  * @return array Modified parameters
  */
 function preferences_list($p)
 {
     if (!get_input_value('_framed', RCUBE_INPUT_GPC) && $args['section'] == 'openpgp_prefs') {
         $p['blocks'][$args['section']]['options'] = array('title' => '', 'content' => html::tag('div', array('id' => 'pm_dummy'), ''));
         return $p;
     }
     if ($p['section'] == 'openpgp_prefs') {
         $p['blocks']['openpgp']['name'] = $this->gettext('openpgp_options');
         if (!isset($no_override['openpgp_enabled'])) {
             $field_id = 'rcmfd_openpgp_enabled';
             $enabled = new html_checkbox(array('name' => '_encEnabled', 'id' => $field_id, 'value' => 1, 'onchange' => "\$('#rcmfd_auto_attach_key').prop('disabled', !(this.checked)); " . "\$('#rcmfd_warn_unencrypted').prop('disabled', !(this.checked)); " . "\$('#rcmfd_encrypt').prop('disabled', !(this.checked)); " . "\$('#rcmfd_sign').prop('disabled', !(this.checked))"));
             $p['blocks']['openpgp']['options']['enabled'] = array('title' => html::label($field_id, Q($this->gettext('openpgp_enabled'))), 'content' => $enabled->show($this->is_enabled()));
         }
         /* Warn on encrypted checkbox */
         $field_id = 'rcmfd_warn_unencrypted';
         $warn = new html_checkbox(array('name' => '_warn', 'id' => $field_id, 'value' => 1, 'disabled' => !$this->is_enabled()));
         $p['blocks']['openpgp']['options']['warn'] = array('title' => html::label($field_id, Q($this->gettext('warn_on_unencrypted'))), 'content' => $warn->show($this->rc->config->get('warn_on_unencrypted', false) ? 1 : 0));
         /* Auto attach checkbox */
         $field_id = 'rcmfd_auto_attach_key';
         $attach = new html_checkbox(array('name' => '_attachKey', 'id' => $field_id, 'value' => 1, 'disabled' => !$this->is_enabled()));
         $p['blocks']['openpgp']['options']['attachKey'] = array('title' => html::label($field_id, Q($this->gettext('always_attachKey'))), 'content' => $attach->show($this->rc->config->get('attachKey', false) ? 1 : 0));
         /* Encrypt default checkbox */
         $field_id = 'rcmfd_encrypt';
         $encrypt = new html_checkbox(array('name' => '_encrypt', 'id' => $field_id, 'value' => 1, 'disabled' => !$this->is_enabled()));
         $p['blocks']['openpgp']['options']['encrypt'] = array('title' => html::label($field_id, Q($this->gettext('always_encrypt'))), 'content' => $encrypt->show($this->rc->config->get('encrypt', false) ? 1 : 0));
         /* Sign default checkbox */
         $field_id = 'rcmfd_sign';
         $sign = new html_checkbox(array('name' => '_sign', 'id' => $field_id, 'value' => 1, 'disabled' => !$this->is_enabled()));
         $p['blocks']['openpgp']['options']['sign'] = array('title' => html::label($field_id, Q($this->gettext('always_sign'))), 'content' => $sign->show($this->rc->config->get('sign', false) ? 1 : 0));
     }
     return $p;
 }
Пример #30
0
 /**
  * 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;
 }