/**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_utils::idn_to_utf8($identity['email']), 'disabled' => in_array($identities_level, array(1, 3, 4)))));
         $table->add('title', $this->gettext('organization'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'], 'disabled' => $identities_level == 4)));
         $table->add('title', $this->gettext('signature'));
         $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature']));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::tag('form', array('id' => 'newuserdialog', 'action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::p('hint', rcube::Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save'))))));
         $title = rcube::JQ($this->gettext('identitydialogtitle'));
         $script = "\n\$('#newuserdialog').show()\n  .dialog({modal:true, resizable:false, closeOnEscape:false, width:450, title:'{$title}'})\n  .submit(function() {\n    var i, request = {}, form = \$(this).serializeArray();\n    for (i in form)\n      request[form[i].name] = form[i].value;\n\n      rcmail.http_post('plugin.newusersave', request, true);\n      return false;\n  });\n\n\$('input[name=_name]').focus();\nrcube_webmail.prototype.new_user_dialog_close = function() { \$('#newuserdialog').dialog('close'); }\n";
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script($script, 'docready');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
 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;
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-areas-table';
     $this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'), get_string('showstandard', 'tag') . $OUTPUT->help_icon('showstandard', 'tag'));
     $this->data = array();
     $this->rowclasses = array();
     $tagareas = core_tag_area::get_areas();
     $tagcollections = core_tag_collection::get_collections_menu(true);
     $tagcollectionsall = core_tag_collection::get_collections_menu();
     $standardchoices = array(core_tag_tag::BOTH_STANDARD_AND_NOT => get_string('standardsuggest', 'tag'), core_tag_tag::STANDARD_ONLY => get_string('standardforce', 'tag'), core_tag_tag::HIDE_STANDARD => get_string('standardhide', 'tag'));
     foreach ($tagareas as $itemtype => $it) {
         foreach ($it as $component => $record) {
             $areaname = core_tag_area::display_name($record->component, $record->itemtype);
             $tmpl = new \core_tag\output\tagareaenabled($record);
             $enabled = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $tmpl = new \core_tag\output\tagareacollection($record);
             $collectionselect = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $tmpl = new \core_tag\output\tagareashowstandard($record);
             $showstandardselect = $OUTPUT->render_from_template('core/inplace_editable', $tmpl->export_for_template($OUTPUT));
             $this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect, $showstandardselect);
             $this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
         }
     }
 }
Esempio n. 4
0
 /**
  * Constructor
  *
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-areas-table';
     $this->head = array(get_string('tagareaname', 'core_tag'), get_string('component', 'tag'), get_string('tagareaenabled', 'core_tag'), get_string('tagcollection', 'tag'));
     $this->data = array();
     $this->rowclasses = array();
     $tagareas = core_tag_area::get_areas();
     $tagcollections = core_tag_collection::get_collections_menu(true);
     $tagcollectionsall = core_tag_collection::get_collections_menu();
     foreach ($tagareas as $itemtype => $it) {
         foreach ($it as $component => $record) {
             $areaname = core_tag_area::display_name($record->component, $record->itemtype);
             $baseurl = new moodle_url($pageurl, array('ta' => $record->id, 'sesskey' => sesskey()));
             if ($record->enabled) {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areadisable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/hide', get_string('disable')));
             } else {
                 $enableurl = new moodle_url($baseurl, array('action' => 'areaenable'));
                 $enabled = html_writer::link($enableurl, $OUTPUT->pix_icon('i/show', get_string('enable')));
             }
             if ($record->enabled && empty($record->locked) && count($tagcollections) > 1) {
                 $changecollurl = new moodle_url($baseurl, array('action' => 'areasetcoll'));
                 $select = new single_select($changecollurl, 'areacollid', $tagcollections, $record->tagcollid, null);
                 $select->set_label(get_string('changetagcoll', 'core_tag', $areaname), array('class' => 'accesshide'));
                 $collectionselect = $OUTPUT->render($select);
             } else {
                 $collectionselect = $tagcollectionsall[$record->tagcollid];
             }
             $this->data[] = array($areaname, $record->component === 'core' || preg_match('/^core_/', $record->component) ? get_string('coresystem') : get_string('pluginname', $record->component), $enabled, $collectionselect);
             $this->rowclasses[] = $record->enabled ? '' : 'dimmed_text';
         }
     }
 }
Esempio n. 5
0
 function gen_form()
 {
     $user = $this->rcmail_inst->user->get_prefs();
     $this->rcmail_inst->output->add_label('ispconfig3_forward.invalidaddress', 'ispconfig3_forward.forwardingempty');
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $this->soap->logout($session_id);
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $this->rcmail_inst->output->set_env('framed', TRUE);
     $out .= '<fieldset><legend>' . $this->gettext('acc_forward') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     $input_forwardingaddress = new html_inputfield(array('name' => '_forwardingaddress', 'id' => 'forwardingaddress', 'value' => $forward[1], 'maxlength' => 320, 'size' => 40));
     $table->add('title', rep_specialchars_output($this->gettext('forwardingaddress')));
     $table->add('', $input_forwardingaddress->show($mail_user[0]['cc']));
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
Esempio n. 6
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog'] && $p['template'] == 'mail') {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_name', 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_email', 'value' => rcube_idn_to_utf8($identity['email']), 'disabled' => $identities_level == 1 || $identities_level == 3)));
         $table->add('title', $this->gettext('organization'));
         $table->add(null, html::tag('input', array('type' => 'text', 'name' => '_organization', 'value' => $identity['organization'])));
         $table->add('title', $this->gettext('signature'));
         $table->add(null, html::tag('textarea', array('name' => '_signature', 'rows' => '3'), $identity['signature']));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => 'newuseroverlay'), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => 'post'), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => 'formbuttons'), html::tag('input', array('type' => 'submit', 'class' => 'button mainaction', 'value' => $this->gettext('save')))))));
         // disable keyboard events for messages list (#1486726)
         $rcmail->output->add_script("rcmail.message_list.key_press = function(){};\n         rcmail.message_list.key_down = function(){};\n         \$('input[name=_name]').focus();\n        ", 'docready');
         $this->include_stylesheet('newuserdialog.css');
     }
 }
 /**
  * Call parent construct and then build table
  * @param tool_mergeusers_renderer $renderer
  */
 public function __construct($renderer)
 {
     global $SESSION;
     $this->renderer = $renderer;
     // Call parent constructor
     parent::__construct();
     if (!empty($SESSION->mut)) {
         if (!empty($SESSION->mut->olduser)) {
             $this->olduser = $SESSION->mut->olduser;
         }
         if (!empty($SESSION->mut->newuser)) {
             $this->newuser = $SESSION->mut->newuser;
         }
     }
     $this->buildtable();
 }
Esempio n. 8
0
 /**
  * Constructor
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-collections-table';
     $this->head = array(get_string('name'), get_string('component', 'tag'), get_string('tagareas', 'tag'), get_string('searchable', 'tag') . $OUTPUT->help_icon('searchable', 'tag'), '');
     $this->data = array();
     $tagcolls = core_tag_collection::get_collections();
     $idx = 0;
     foreach ($tagcolls as $tagcoll) {
         $actions = '';
         $name = core_tag_collection::display_name($tagcoll);
         $url = new moodle_url($pageurl, array('sesskey' => sesskey(), 'tc' => $tagcoll->id));
         if (!$tagcoll->isdefault) {
             // Move up.
             if ($idx > 1) {
                 $url->param('action', 'collmoveup');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')), null, array('class' => 'action-icon action_moveup'));
             }
             // Move down.
             if ($idx < count($tagcolls) - 1) {
                 $url->param('action', 'collmovedown');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')), null, array('class' => 'action-icon action_movedown'));
             }
         }
         if (!$tagcoll->isdefault && empty($tagcoll->component)) {
             // Delete.
             $url->param('action', 'colldelete');
             $actions .= $OUTPUT->action_icon('#', new pix_icon('t/delete', get_string('delete')), null, array('data-url' => $url->out(false), 'data-collname' => $name, 'class' => 'action-icon action_delete'));
         }
         $component = '';
         if ($tagcoll->component) {
             $component = $tagcoll->component === 'core' || preg_match('/^core_/', $tagcoll->component) ? get_string('coresystem') : get_string('pluginname', $tagcoll->component);
         }
         $allareas = core_tag_collection::get_areas_names(null, false);
         $validareas = core_tag_collection::get_areas_names($tagcoll->id);
         $areaslist = array_map(function ($key) use($allareas, $validareas) {
             return "<li data-areaid=\"{$key}\" " . (array_key_exists($key, $validareas) ? "" : "style=\"display:none;\"") . ">{$allareas[$key]}</li>";
         }, array_keys($allareas));
         $displayname = new \core_tag\output\tagcollname($tagcoll);
         $searchable = new \core_tag\output\tagcollsearchable($tagcoll);
         $this->data[] = array($displayname->render($OUTPUT), $component, "<ul data-collectionid=\"{$tagcoll->id}\">" . join('', $areaslist) . '</ul>', $searchable->render($OUTPUT), $actions);
         $idx++;
     }
 }
Esempio n. 9
0
 /**
  * Constructor
  * @param string|moodle_url $pageurl
  */
 public function __construct($pageurl)
 {
     global $OUTPUT;
     parent::__construct();
     $this->attributes['class'] = 'generaltable tag-collections-table';
     $this->head = array(get_string('name'), get_string('component', 'tag'), get_string('tagareas', 'tag'), get_string('searchable', 'tag') . $OUTPUT->help_icon('searchable', 'tag'), '');
     $this->data = array();
     $tagcolls = core_tag_collection::get_collections();
     $idx = 0;
     foreach ($tagcolls as $tagcoll) {
         $actions = '';
         $name = core_tag_collection::display_name($tagcoll);
         $url = new moodle_url($pageurl, array('sesskey' => sesskey(), 'tc' => $tagcoll->id));
         if (!$tagcoll->isdefault) {
             // Move up.
             if ($idx > 1) {
                 $url->param('action', 'collmoveup');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/up', get_string('moveup')));
             }
             // Move down.
             if ($idx < count($tagcolls) - 1) {
                 $url->param('action', 'collmovedown');
                 $actions .= $OUTPUT->action_icon($url, new pix_icon('t/down', get_string('movedown')));
             }
         }
         if (empty($tagcoll->component)) {
             // Edit.
             $url->param('action', 'colledit');
             $actions .= $OUTPUT->action_icon($url, new pix_icon('t/edit', get_string('edittagcoll', 'tag', $name)));
         }
         if (!$tagcoll->isdefault && empty($tagcoll->component)) {
             // Delete.
             $url->param('action', 'colldelete');
             $actions .= $OUTPUT->action_icon($url, new pix_icon('t/delete', get_string('delete')));
         }
         $manageurl = new moodle_url('/tag/manage.php', array('tc' => $tagcoll->id));
         $component = '';
         if ($tagcoll->component) {
             $component = $tagcoll->component === 'core' || preg_match('/^core_/', $tagcoll->component) ? get_string('coresystem') : get_string('pluginname', $tagcoll->component);
         }
         $this->data[] = array(html_writer::link($manageurl, $name), $component, join(', ', core_tag_collection::get_areas_names($tagcoll->id)), $tagcoll->searchable ? get_string('yes') : '-', $actions);
         $idx++;
     }
 }
Esempio n. 10
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);
 }
Esempio n. 11
0
 function password_form()
 {
     $rcmail = rcmail::get_instance();
     $this->load_config();
     // add some labels to client
     $rcmail->output->add_label('imscp_pw_changer.nopassword', 'imscp_pw_changer.passwordinconsistency');
     $rcmail->output->set_env('product_name', $rcmail->config->get('product_name'));
     $table = new html_table(array('cols' => 2));
     // 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.imscp_pw_changer-save', 'type' => 'input', 'class' => 'button mainaction', 'label' => 'save')))));
     $rcmail->output->add_gui_object('passform', 'imscp_pw_changer-form');
     return $rcmail->output->form_tag(array('id' => 'imscp_pw_changer-form', 'name' => 'imscp_pw_changer-form', 'method' => 'post', 'action' => './?_task=settings&_action=plugin.imscp_pw_changer-save'), $out);
 }
Esempio n. 12
0
 /**
  * Callback function when HTML page is rendered
  * We'll add an overlay box here.
  */
 function render_page($p)
 {
     if ($_SESSION['plugin.newuserdialog']) {
         $this->add_texts('localization');
         $rcmail = rcmail::get_instance();
         $identity = $rcmail->user->get_identity();
         $identities_level = intval($rcmail->config->get('identities_level', 0));
         // compose user-identity dialog
         $table = new html_table(array('cols' => 2));
         $table->add('title', $this->gettext('name'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_name", 'value' => $identity['name'])));
         $table->add('title', $this->gettext('email'));
         $table->add(null, html::tag('input', array('type' => "text", 'name' => "_email", 'value' => $identity['email'], 'disabled' => $identities_level == 1 || $identities_level == 3)));
         // add overlay input box to html page
         $rcmail->output->add_footer(html::div(array('id' => "newuseroverlay"), html::tag('form', array('action' => $rcmail->url('plugin.newusersave'), 'method' => "post"), html::tag('h3', null, Q($this->gettext('identitydialogtitle'))) . html::p('hint', Q($this->gettext('identitydialoghint'))) . $table->show() . html::p(array('class' => "formbuttons"), html::tag('input', array('type' => "submit", 'class' => "button mainaction", 'value' => $this->gettext('save')))))));
         $this->include_stylesheet('newuserdialog.css');
     }
 }
Esempio n. 13
0
 /**
  * Creates ACL rights table
  *
  * @param array $attrib Template object attributes
  *
  * @return string HTML Content
  */
 private function list_rights($attrib = array())
 {
     // Get ACL for the folder
     $acl = $this->rc->storage->get_acl($this->mbox);
     if (!is_array($acl)) {
         $acl = array();
     }
     // Keep special entries (anyone/anonymous) on top of the list
     if (!empty($this->specials) && !empty($acl)) {
         foreach ($this->specials as $key) {
             if (isset($acl[$key])) {
                 $acl_special[$key] = $acl[$key];
                 unset($acl[$key]);
             }
         }
     }
     // Sort the list by username
     uksort($acl, 'strnatcasecmp');
     if (!empty($acl_special)) {
         $acl = array_merge($acl_special, $acl);
     }
     // Get supported rights and build column names
     $supported = $this->rights_supported();
     // depending on server capability either use 'te' or 'd' for deleting msgs
     $deleteright = implode(array_intersect(str_split('ted'), $supported));
     // Use advanced or simple (grouped) rights
     $advanced = $this->rc->config->get('acl_advanced_mode');
     if ($advanced) {
         $items = array();
         foreach ($supported as $sup) {
             $items[$sup] = $sup;
         }
     } else {
         $items = array('read' => 'lrs', 'write' => 'wi', 'delete' => $deleteright, 'other' => preg_replace('/[lrswi' . $deleteright . ']/', '', implode($supported)));
     }
     // Create the table
     $attrib['noheader'] = true;
     $table = new html_table($attrib);
     // Create table header
     $table->add_header('user', $this->gettext('identifier'));
     foreach (array_keys($items) as $key) {
         $label = $this->gettext('shortacl' . $key);
         $table->add_header(array('class' => 'acl' . $key, 'title' => $label), $label);
     }
     $js_table = array();
     foreach ($acl as $user => $rights) {
         if ($this->rc->storage->conn->user == $user) {
             continue;
         }
         // filter out virtual rights (c or d) the server may return
         $userrights = array_intersect($rights, $supported);
         $userid = rcube_utils::html_identifier($user);
         if (!empty($this->specials) && in_array($user, $this->specials)) {
             $user = $this->gettext($user);
         }
         $table->add_row(array('id' => 'rcmrow' . $userid));
         $table->add('user', rcube::Q($user));
         foreach ($items as $key => $right) {
             $in = $this->acl_compare($userrights, $right);
             switch ($in) {
                 case 2:
                     $class = 'enabled';
                     break;
                 case 1:
                     $class = 'partial';
                     break;
                 default:
                     $class = 'disabled';
                     break;
             }
             $table->add('acl' . $key . ' ' . $class, '');
         }
         $js_table[$userid] = implode($userrights);
     }
     $this->rc->output->set_env('acl', $js_table);
     $this->rc->output->set_env('acl_advanced', $advanced);
     $out = $table->show();
     return $out;
 }
Esempio n. 14
0
 /**
  * Create a HTML table based on the given data
  *
  * @param  array  Named table attributes
  * @param  mixed  Table row data. Either a two-dimensional array or a valid SQL result set
  * @param  array  List of cols to show
  * @param  string Name of the identifier col
  *
  * @return string HTML table code
  */
 public function table_output($attrib, $table_data, $a_show_cols, $id_col)
 {
     $table = new html_table();
     // add table header
     if (!$attrib['noheader']) {
         foreach ($a_show_cols as $col) {
             $table->add_header($col, $this->Q($this->gettext($col)));
         }
     }
     if (!is_array($table_data)) {
         $db = $this->get_dbh();
         while ($table_data && ($sql_arr = $db->fetch_assoc($table_data))) {
             $table->add_row(array('id' => 'rcmrow' . rcube_utils::html_identifier($sql_arr[$id_col])));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q($sql_arr[$col]));
             }
         }
     } else {
         foreach ($table_data as $row_data) {
             $class = !empty($row_data['class']) ? $row_data['class'] : '';
             $rowid = 'rcmrow' . rcube_utils::html_identifier($row_data[$id_col]);
             $table->add_row(array('id' => $rowid, 'class' => $class));
             // format each col
             foreach ($a_show_cols as $col) {
                 $table->add($col, $this->Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col]));
             }
         }
     }
     return $table->show($attrib);
 }
Esempio n. 15
0
 function output_individual_question_data($quiz, $question, $reporturl, $quizstats)
 {
     global $CFG, $DB, $QTYPES, $OUTPUT;
     require_once $CFG->dirroot . '/mod/quiz/report/statistics/statistics_question_table.php';
     $this->qtable = new quiz_report_statistics_question_table($question->id);
     $downloadtype = $this->table->is_downloading();
     if (!$this->table->is_downloading()) {
         $datumfromtable = $this->table->format_row($question);
         $questioninfotable = new html_table();
         $questioninfotable->align = array('center', 'center');
         $questioninfotable->width = '60%';
         $questioninfotable->add_class('generaltable titlesleft');
         $questioninfotable->data = array();
         $questioninfotable->data[] = array(get_string('modulename', 'quiz'), $quiz->name);
         $questioninfotable->data[] = array(get_string('questionname', 'quiz_statistics'), $question->name . '&nbsp;' . $datumfromtable['actions']);
         $questioninfotable->data[] = array(get_string('questiontype', 'quiz_statistics'), $datumfromtable['icon'] . '&nbsp;' . get_string($question->qtype, 'quiz') . '&nbsp;' . $datumfromtable['icon']);
         $questioninfotable->data[] = array(get_string('positions', 'quiz_statistics'), $question->_stats->positions);
         $questionstatstable = new html_table();
         $questionstatstable->align = array('center', 'center');
         $questionstatstable->width = '60%';
         $questionstatstable->add_class('generaltable titlesleft');
         unset($datumfromtable['number']);
         unset($datumfromtable['icon']);
         $actions = $datumfromtable['actions'];
         unset($datumfromtable['actions']);
         unset($datumfromtable['name']);
         $labels = array('s' => get_string('attempts', 'quiz_statistics'), 'facility' => get_string('facility', 'quiz_statistics'), 'sd' => get_string('standarddeviationq', 'quiz_statistics'), 'random_guess_score' => get_string('random_guess_score', 'quiz_statistics'), 'intended_weight' => get_string('intended_weight', 'quiz_statistics'), 'effective_weight' => get_string('effective_weight', 'quiz_statistics'), 'discrimination_index' => get_string('discrimination_index', 'quiz_statistics'), 'discriminative_efficiency' => get_string('discriminative_efficiency', 'quiz_statistics'));
         foreach ($datumfromtable as $item => $value) {
             $questionstatstable->data[] = array($labels[$item], $value);
         }
         echo $OUTPUT->heading(get_string('questioninformation', 'quiz_statistics'));
         echo $OUTPUT->table($questioninfotable);
         echo $OUTPUT->box(format_text($question->questiontext, $question->questiontextformat) . $actions, 'boxaligncenter generalbox boxwidthnormal mdl-align');
         echo $OUTPUT->heading(get_string('questionstatistics', 'quiz_statistics'));
         echo $OUTPUT->table($questionstatstable);
     } else {
         $this->qtable->export_class_instance($this->table->export_class_instance());
         $questiontabletitle = !empty($question->number) ? '(' . $question->number . ') ' : '';
         $questiontabletitle .= "\"{$question->name}\"";
         $questiontabletitle = "<em>{$questiontabletitle}</em>";
         if ($downloadtype == 'xhtml') {
             $questiontabletitle = get_string('analysisofresponsesfor', 'quiz_statistics', $questiontabletitle);
         }
         $exportclass =& $this->table->export_class_instance();
         $exportclass->start_table($questiontabletitle);
     }
     if ($QTYPES[$question->qtype]->show_analysis_of_responses()) {
         if (!$this->table->is_downloading()) {
             echo $OUTPUT->heading(get_string('analysisofresponses', 'quiz_statistics'));
         }
         $teacherresponses = $QTYPES[$question->qtype]->get_possible_responses($question);
         $this->qtable->setup($reporturl, $question, count($teacherresponses) > 1);
         if ($this->table->is_downloading()) {
             $exportclass->output_headers($this->qtable->headers);
         }
         $responses = $DB->get_records('quiz_question_response_stats', array('quizstatisticsid' => $quizstats->id, 'questionid' => $question->id), 'credit DESC, subqid ASC, aid ASC, rcount DESC');
         $responses = quiz_report_index_by_keys($responses, array('subqid', 'aid'), false);
         foreach ($responses as $subqid => $response) {
             foreach (array_keys($responses[$subqid]) as $aid) {
                 uasort($responses[$subqid][$aid], array('quiz_statistics_report', 'sort_answers'));
             }
             if (isset($responses[$subqid]['0'])) {
                 $wildcardresponse = new object();
                 $wildcardresponse->answer = '*';
                 $wildcardresponse->credit = 0;
                 $teacherresponses[$subqid][0] = $wildcardresponse;
             }
         }
         $first = true;
         $subq = 0;
         foreach ($teacherresponses as $subqid => $tresponsesforsubq) {
             $subq++;
             $qhaswildcards = $QTYPES[$question->qtype]->has_wildcards_in_responses($question, $subqid);
             if (!$first) {
                 $this->qtable->add_separator();
             }
             uasort($tresponsesforsubq, array('quiz_statistics_report', 'sort_response_details'));
             foreach ($tresponsesforsubq as $aid => $teacherresponse) {
                 $teacherresponserow = new object();
                 $teacherresponserow->response = $teacherresponse->answer;
                 $teacherresponserow->rcount = 0;
                 $teacherresponserow->subq = $subq;
                 $teacherresponserow->credit = $teacherresponse->credit;
                 if (isset($responses[$subqid][$aid])) {
                     $singleanswer = count($responses[$subqid][$aid]) == 1 && $responses[$subqid][$aid][0]->response == $teacherresponserow->response;
                     if (!$singleanswer && $qhaswildcards) {
                         $this->qtable->add_separator();
                     }
                     foreach ($responses[$subqid][$aid] as $response) {
                         $teacherresponserow->rcount += $response->rcount;
                     }
                     if ($aid != 0 || $qhaswildcards) {
                         $this->qtable->add_data_keyed($this->qtable->format_row($teacherresponserow));
                     }
                     if (!$singleanswer) {
                         foreach ($responses[$subqid][$aid] as $response) {
                             if (!$downloadtype || $downloadtype == 'xhtml') {
                                 $indent = '&nbsp;&nbsp;&nbsp;&nbsp;';
                             } else {
                                 $indent = '    ';
                             }
                             $response->response = ($qhaswildcards ? $indent : '') . $response->response;
                             $response->subq = $subq;
                             if (count($responses[$subqid][$aid]) < 2 || $response->rcount > $teacherresponserow->rcount / 10) {
                                 $this->qtable->add_data_keyed($this->qtable->format_row($response));
                             }
                         }
                     }
                 } else {
                     $this->qtable->add_data_keyed($this->qtable->format_row($teacherresponserow));
                 }
             }
             $first = false;
         }
         $this->qtable->finish_output(!$this->table->is_downloading());
     }
     if (!$this->table->is_downloading()) {
         $url = $reporturl->out();
         $text = get_string('backtoquizreport', 'quiz_statistics');
         echo $OUTPUT->box("<a href=\"{$url}\">{$text}</a>", 'boxaligncenter generalbox boxwidthnormal mdl-align');
     }
 }
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<fieldset><legend>' . $this->gettext('policy_entries') . '</legend>' . "\n";
     $spam_table = new html_table(array('id' => 'spam-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 4));
     $spam_table->add_header(array('width' => '220px'), $this->gettext('policy_entries'));
     $spam_table->add_header(array('class' => 'value', 'width' => '150px'), $this->gettext('policy_tag'));
     $spam_table->add_header(array('class' => 'value', 'width' => '150px'), $this->gettext('policy_tag2'));
     $spam_table->add_header(array('class' => 'value', 'width' => '130px'), $this->gettext('policy_kill'));
     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']));
         $policies = $this->soap->mail_policy_get($session_id, array(1 => 1));
         for ($i = 0; $i < count($policies); $i++) {
             $class = $class == 'odd' ? 'even' : 'odd';
             if ($policies[$i]['id'] == $spam_user[0]['policy_id']) {
                 $class = 'selected';
             }
             $spam_table->set_row_attribs(array('class' => $class));
             $this->_spam_row($spam_table, $policies[$i]['policy_name'], $policies[$i]['spam_tag_level'], $policies[$i]['spam_tag2_level'], $policies[$i]['spam_kill_level'], $attrib);
         }
         $this->soap->logout($session_id);
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     if (count($policies) == 0) {
         $spam_table->add(array('colspan' => '4'), rep_specialchars_output($this->gettext('spamnopolicies')));
         $spam_table->set_row_attribs(array('class' => 'odd'));
         $spam_table->add_row();
     }
     $out .= "<div id=\"spam-cont\">" . $spam_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
 function gen_table($attrib)
 {
     $this->rcmail_inst->output->set_env('framed', true);
     $out = '<fieldset><legend>' . $this->gettext('forward_entries') . '</legend>' . "\n";
     $rule_table = new html_table(array('id' => 'rule-table', 'class' => 'records-table', 'cellspacing' => '0', 'cols' => 2));
     $rule_table->add_header("", $this->gettext('forward_entries'));
     $rule_table->add_header(array('width' => '16px'), '');
     try {
         $session_id = $this->soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
         $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
         $this->soap->logout($session_id);
         $forward = explode(",", $mail_user[0]['cc']);
         if (!empty($forward[0])) {
             for ($i = 0; $i < count($forward); $i++) {
                 $class = $class == 'odd' ? 'even' : 'odd';
                 if ($forward[$i] == get_input_value('_forwardingaddress', RCUBE_INPUT_GET)) {
                     $class = 'selected';
                 }
                 $rule_table->set_row_attribs(array('class' => $class, 'id' => 'rule_' . $forward[$i]));
                 $this->_rule_row($rule_table, $forward[$i], $attrib);
             }
         } else {
             $rule_table->add(array('colspan' => '2'), rep_specialchars_output($this->gettext('forwardnomails')));
             $rule_table->set_row_attribs(array('class' => 'odd'));
             $rule_table->add_row();
         }
     } catch (SoapFault $e) {
         $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
     }
     $out .= "<div id=\"rule-cont\">" . $rule_table->show() . "</div>\n";
     $out .= "</fieldset>\n";
     return $out;
 }
Esempio n. 18
0
 function infohtml()
 {
     $rcmail = rcmail::get_instance();
     $user = $rcmail->user;
     $table = new html_table(array('cols' => 2, 'cellpadding' => 3));
     $table->add('title', 'ID');
     $table->add('', Q($user->ID));
     $table->add('title', Q($this->gettext('username')));
     $table->add('', Q($user->data['username']));
     $table->add('title', Q($this->gettext('server')));
     $table->add('', Q($user->data['mail_host']));
     $table->add('title', Q($this->gettext('created')));
     $table->add('', Q($user->data['created']));
     $table->add('title', Q($this->gettext('lastlogin')));
     $table->add('', Q($user->data['last_login']));
     $identity = $user->get_identity();
     $table->add('title', Q($this->gettext('defaultidentity')));
     $table->add('', Q($identity['name'] . ' <' . $identity['email'] . '>'));
     return html::tag('h4', null, Q('Infos for ' . $user->get_username())) . $table->show();
 }
Esempio n. 19
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);
 }
Esempio n. 20
0
$strpages = get_string('modulenameplural', 'page');
$strweek = get_string('week');
$strtopic = get_string('topic');
$strname = get_string('name');
$strintro = get_string('moduleintro');
$strlastmodified = get_string('lastmodified');
$PAGE->set_url('mod/page/index.php', array('id' => $course->id));
$PAGE->set_title($course->shortname . ': ' . $strpages);
$PAGE->set_heading($course->fullname);
$navlinks = array(array('name' => $strpages, 'link' => '', 'type' => 'activityinstance'));
echo $OUTPUT->header(build_navigation($navlinks), navmenu($course));
if (!($pages = get_all_instances_in_course('page', $course))) {
    notice(get_string('thereareno', 'moodle', $strpages), "{$CFG->wwwroot}/course/view.php?id={$course->id}");
    exit;
}
$table = new html_table();
$table->set_classes(array('generaltable', 'mod_index'));
if ($course->format == 'weeks') {
    $table->head = array($strweek, $strname, $strintro);
    $table->align = array('center', 'left', 'left');
} else {
    if ($course->format == 'topics') {
        $table->head = array($strtopic, $strname, $strintro);
        $table->align = array('center', 'left', 'left');
    } else {
        $table->head = array($strlastmodified, $strname, $strintro);
        $table->align = array('left', 'left', 'left');
    }
}
$modinfo = get_fast_modinfo($course);
$currentsection = '';
Esempio n. 21
0
 /**
  *
  */
 public function attachment_header($attrib = array())
 {
     $rcmail = rcmail::get_instance();
     $dl_link = strtolower($attrib['downloadlink']) == 'true';
     $dl_url = $this->rc->url(array('_frame' => null, '_download' => 1) + $_GET);
     $table = new html_table(array('cols' => $dl_link ? 3 : 2));
     if (!empty($this->attachment['name'])) {
         $table->add('title', rcube::Q($this->rc->gettext('filename')));
         $table->add('header', rcube::Q($this->attachment['name']));
         if ($dl_link) {
             $table->add('download-link', html::a($dl_url, rcube::Q($this->rc->gettext('download'))));
         }
     }
     if (!empty($this->attachment['mimetype'])) {
         $table->add('title', rcube::Q($this->rc->gettext('type')));
         $table->add('header', rcube::Q($this->attachment['mimetype']));
     }
     if (!empty($this->attachment['size'])) {
         $table->add('title', rcube::Q($this->rc->gettext('filesize')));
         $table->add('header', rcube::Q($this->rc->show_bytes($this->attachment['size'])));
     }
     $this->rc->output->set_env('attachment_download_url', $dl_url);
     return $table->show($attrib);
 }
Esempio n. 22
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);
 }
Esempio n. 23
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;
 }
Esempio n. 24
0
 function render_box($p)
 {
     $this->add_texts('localization');
     $rcmail = rcmail::get_instance();
     if (!$attrib['id']) {
         $attrib['id'] = 'bounce-box';
         $attrib['class'] = 'popupmenu';
     }
     $button = new html_inputfield(array('type' => 'button'));
     $submit = new html_inputfield(array('type' => 'submit'));
     $table = new html_table(array('cols' => 2, 'id' => 'form'));
     $table->add('title', html::label('_to', Q(rcube_label('to'))));
     $table->add('editfield', html::tag('textarea', array('spellcheck' => 'false', 'id' => '_to', 'name' => '_to', 'cols' => '50', 'rows' => '2', 'tabindex' => '2', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-cc'));
     $table->add('title', html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.hide_header_form(\'cc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_cc', Q(rcube_label('cc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_cc', 'name' => '_cc', 'cols' => '50', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->set_row_attribs(array('id' => 'compose-bcc'));
     $table->add('title', html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.hide_header_form(\'bcc\')'), html::img(array('src' => $rcmail->config->get('skin_path') . '/images/icons/minus.gif', 'title' => rcube_label('delete'), 'alt' => rcube_label('delete')))) . '&nbsp;' . html::label('_bcc', Q(rcube_label('bcc'))));
     $table->add(null, html::tag('textarea', array('spellcheck' => 'false', 'id' => '_bcc', 'cols' => '50', 'name' => '_bcc', 'rows' => '2', 'value' => '', 'class' => 'editfield', 'onclick' => 'select_field(this)')));
     $table->add(null, null);
     $table->add(formlinks, html::a(array('href' => '#cc', 'onclick' => 'return rcmail_ui.show_header_form(\'cc\')', 'id' => 'cc-link'), Q(rcube_label('addcc'))) . '<span class="separator">|</span>' . html::a(array('href' => '#bcc', 'onclick' => 'return rcmail_ui.show_header_form(\'bcc\')', 'id' => 'bcc-link'), Q(rcube_label('addbcc'))));
     $target_url = $_SERVER['REQUEST_URI'];
     $rcmail->output->add_footer(html::div($attrib, $rcmail->output->form_tag(array('name' => 'bounceform', 'method' => 'post', 'action' => './', 'enctype' => 'multipart/form-data'), html::tag('input', array('type' => "hidden", 'name' => '_action', 'value' => 'bounce')) . html::div('bounce-title', Q($this->gettext('bouncemessage'))) . html::div('bounce-body', $table->show() . html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "\$('#{$attrib['id']}').hide()")) . ' ' . $button->show(Q($this->gettext('bounce')), array('class' => 'button mainaction', 'onclick' => JS_OBJECT_NAME . ".command('plugin.bounce.send', this.bounceform)")))))));
     $rcmail->output->add_label('norecipientwarning');
     $rcmail->output->add_gui_object('bouncebox', $attrib['id']);
     $rcmail->output->add_gui_object('bounceform', 'bounceform');
     $this->include_stylesheet('bounce.css');
     $rcmail->output->set_env('autocomplete_min_length', $rcmail->config->get('autocomplete_min_length'));
     $rcmail->output->add_gui_object('messageform', 'bounceform');
 }
 /**
  * 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;
 }
Esempio n. 26
0
 /**
  * Table oultine for event changelog display
  */
 function event_changelog_table($attrib = array())
 {
     $table = new html_table(array('cols' => 5, 'border' => 0, 'cellspacing' => 0));
     $table->add_header('diff', '');
     $table->add_header('revision', $this->cal->gettext('revision'));
     $table->add_header('date', $this->cal->gettext('date'));
     $table->add_header('user', $this->cal->gettext('user'));
     $table->add_header('operation', $this->cal->gettext('operation'));
     $table->add_header('actions', '&nbsp;');
     return $table->show($attrib);
 }
Esempio n. 27
0
 public function quota_content($attrib = null, $folder = null)
 {
     $quota = $this->storage->get_quota($folder);
     $quota = $this->plugins->exec_hook('quota', $quota);
     $quota_result = (array) $quota;
     $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
     $quota_result['folder'] = $folder !== null && $folder !== '' ? $folder : 'INBOX';
     if ($quota['total'] > 0) {
         if (!isset($quota['percent'])) {
             $quota_result['percent'] = min(100, round($quota['used'] / max(1, $quota['total']) * 100));
         }
         $title = sprintf('%s / %s (%.0f%%)', $this->show_bytes($quota['used'] * 1024), $this->show_bytes($quota['total'] * 1024), $quota_result['percent']);
         $quota_result['title'] = $title;
         if ($attrib['width']) {
             $quota_result['width'] = $attrib['width'];
         }
         if ($attrib['height']) {
             $quota_result['height'] = $attrib['height'];
         }
         // build a table of quota types/roots info
         if (($root_cnt = count($quota_result['all'])) > 1 || count($quota_result['all'][key($quota_result['all'])]) > 1) {
             $table = new html_table(array('cols' => 3, 'class' => 'quota-info'));
             $table->add_header(null, self::Q($this->gettext('quotatype')));
             $table->add_header(null, self::Q($this->gettext('quotatotal')));
             $table->add_header(null, self::Q($this->gettext('quotaused')));
             foreach ($quota_result['all'] as $root => $data) {
                 if ($root_cnt > 1 && $root) {
                     $table->add(array('colspan' => 3, 'class' => 'root'), self::Q($root));
                 }
                 if ($storage = $data['storage']) {
                     $percent = min(100, round($storage['used'] / max(1, $storage['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotastorage')));
                     $table->add(null, $this->show_bytes($storage['total'] * 1024));
                     $table->add(null, sprintf('%s (%.0f%%)', $this->show_bytes($storage['used'] * 1024), $percent));
                 }
                 if ($message = $data['message']) {
                     $percent = min(100, round($message['used'] / max(1, $message['total']) * 100));
                     $table->add('name', self::Q($this->gettext('quotamessage')));
                     $table->add(null, intval($message['total']));
                     $table->add(null, sprintf('%d (%.0f%%)', $message['used'], $percent));
                 }
             }
             $quota_result['table'] = $table->show();
         }
     } else {
         $unlimited = $this->config->get('quota_zero_as_unlimited');
         $quota_result['title'] = $this->gettext($unlimited ? 'unlimited' : 'unknown');
         $quota_result['percent'] = 0;
     }
     // cleanup
     unset($quota_result['abort']);
     if (empty($quota_result['table'])) {
         unset($quota_result['all']);
     }
     return $quota_result;
 }
Esempio n. 28
0
 /**
  * Helper function used in calendar_form_content(). Creates a part of the form.
  */
 private function get_form_part($form)
 {
     $content = '';
     if (is_array($form['content']) && !empty($form['content'])) {
         $table = new html_table(array('cols' => 2));
         foreach ($form['content'] as $col => $colprop) {
             $label = !empty($colprop['label']) ? $colprop['label'] : $this->cal->gettext($col);
             $table->add('title', html::label($colprop['id'], rcube::Q($label)));
             $table->add(null, $colprop['value']);
         }
         $content = $table->show();
     } else {
         $content = $form['content'];
     }
     return $content;
 }
 function gen_form()
 {
     $confirm = $this->rcmail_inst->config->get('password_confirm_current');
     $pwl = $this->rcmail_inst->config->get('password_min_length');
     if (!empty($pwl)) {
         $pwl = max(6, $pwl);
     } else {
         $pwl = 6;
     }
     $this->rcmail_inst->output->add_label('ispconfig3_pass.nopassword', 'ispconfig3_pass.nocurpassword', 'ispconfig3_pass.passwordinconsistency', 'ispconfig3_pass.changepasswd', 'ispconfig3_pass.passwordminlength');
     $this->rcmail_inst->output->add_script('var pw_min_length =' . $pwl . ';');
     $this->rcmail_inst->output->set_env('framed', true);
     $out .= '<fieldset><legend>' . $this->gettext('password') . '</legend>' . "\n";
     $table = new html_table(array('cols' => 2, 'class' => 'propform'));
     if ($confirm) {
         $input_newpasswd = new html_passwordfield(array('name' => '_curpasswd', 'id' => 'curpasswd', 'size' => 20));
         $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('curpasswd')));
         $table->add('', $input_newpasswd->show());
     }
     $input_newpasswd = new html_passwordfield(array('name' => '_newpasswd', 'id' => 'newpasswd', 'size' => 20));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('newpasswd')));
     $table->add('', $input_newpasswd->show() . '<div id="pass-check">');
     $input_confpasswd = new html_passwordfield(array('name' => '_confpasswd', 'id' => 'confpasswd', 'size' => 20));
     $table->add('title', rcube_utils::rep_specialchars_output($this->gettext('confpasswd')));
     $table->add('', $input_confpasswd->show());
     $out .= $table->show();
     $out .= "</fieldset>\n";
     return $out;
 }
 /**
  * Independent vacation form
  */
 public function vacation_form($attrib)
 {
     // check supported extensions
     $date_extension = in_array('date', $this->exts);
     $regex_extension = in_array('regex', $this->exts);
     $seconds_extension = in_array('vacation-seconds', $this->exts);
     // build FORM tag
     $form_id = $attrib['id'] ?: 'form';
     $out = $this->rc->output->request_form(array('id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.managesieve-vacation', 'noclose' => true) + $attrib);
     $from_addr = $this->rc->config->get('managesieve_vacation_from_init');
     $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init');
     if (count($this->vacation) < 2) {
         if ($auto_addr) {
             $this->vacation['addresses'] = $this->user_emails();
         }
         if ($from_addr) {
             $default_identity = $this->rc->user->list_emails(true);
             $this->vacation['from'] = $default_identity['email'];
         }
     }
     // form elements
     $from = new html_inputfield(array('name' => 'vacation_from', 'id' => 'vacation_from', 'size' => 50));
     $subject = new html_inputfield(array('name' => 'vacation_subject', 'id' => 'vacation_subject', 'size' => 50));
     $reason = new html_textarea(array('name' => 'vacation_reason', 'id' => 'vacation_reason', 'cols' => 60, 'rows' => 8));
     $interval = new html_inputfield(array('name' => 'vacation_interval', 'id' => 'vacation_interval', 'size' => 5));
     $addresses = '<textarea name="vacation_addresses" id="vacation_addresses" data-type="list" data-size="30" style="display: none">' . rcube::Q(implode("\n", (array) $this->vacation['addresses']), 'strict', false) . '</textarea>';
     $status = new html_select(array('name' => 'vacation_status', 'id' => 'vacation_status'));
     $action = new html_select(array('name' => 'vacation_action', 'id' => 'vacation_action', 'onchange' => 'vacation_action_select()'));
     $addresses_link = new html_inputfield(array('type' => 'button', 'href' => '#', 'class' => 'button', 'onclick' => rcmail_output::JS_OBJECT_NAME . '.managesieve_vacation_addresses()'));
     $status->add($this->plugin->gettext('vacation.on'), 'on');
     $status->add($this->plugin->gettext('vacation.off'), 'off');
     $action->add($this->plugin->gettext('vacation.keep'), 'keep');
     $action->add($this->plugin->gettext('vacation.discard'), 'discard');
     $action->add($this->plugin->gettext('vacation.redirect'), 'redirect');
     if (in_array('copy', $this->exts)) {
         $action->add($this->plugin->gettext('vacation.copy'), 'copy');
     }
     if ($this->rc->config->get('managesieve_vacation') != 2 && count($this->vacation['list'])) {
         $after = new html_select(array('name' => 'vacation_after', 'id' => 'vacation_after'));
         $after->add('', '');
         foreach ($this->vacation['list'] as $idx => $rule) {
             $after->add($rule, $idx);
         }
     }
     $interval_txt = $interval->show(self::vacation_interval($this->vacation));
     if ($seconds_extension) {
         $interval_select = new html_select(array('name' => 'vacation_interval_type'));
         $interval_select->add($this->plugin->gettext('days'), 'days');
         $interval_select->add($this->plugin->gettext('seconds'), 'seconds');
         $interval_txt .= '&nbsp;' . $interval_select->show(isset($this->vacation['seconds']) ? 'seconds' : 'days');
     } else {
         $interval_txt .= '&nbsp;' . $this->plugin->gettext('days');
     }
     if ($date_extension || $regex_extension) {
         $date_from = new html_inputfield(array('name' => 'vacation_datefrom', 'id' => 'vacation_datefrom', 'class' => 'datepicker', 'size' => 12));
         $date_to = new html_inputfield(array('name' => 'vacation_dateto', 'id' => 'vacation_dateto', 'class' => 'datepicker', 'size' => 12));
         $date_format = $this->rc->config->get('date_format', 'Y-m-d');
     }
     if ($date_extension) {
         $time_from = new html_inputfield(array('name' => 'vacation_timefrom', 'id' => 'vacation_timefrom', 'size' => 6));
         $time_to = new html_inputfield(array('name' => 'vacation_timeto', 'id' => 'vacation_timeto', 'size' => 6));
         $time_format = $this->rc->config->get('time_format', 'H:i');
         $date_value = array();
         foreach ((array) $this->vacation['tests'] as $test) {
             if ($test['test'] == 'currentdate') {
                 $idx = $test['type'] == 'value-ge' ? 'from' : 'to';
                 if ($test['part'] == 'date') {
                     $date_value[$idx]['date'] = $test['arg'];
                 } else {
                     if ($test['part'] == 'iso8601') {
                         $date_value[$idx]['datetime'] = $test['arg'];
                     }
                 }
             }
         }
         foreach ($date_value as $idx => $value) {
             $date = $value['datetime'] ?: $value['date'];
             $date_value[$idx] = $this->rc->format_date($date, $date_format, false);
             if (!empty($value['datetime'])) {
                 $date_value['time_' . $idx] = $this->rc->format_date($date, $time_format, true);
             }
         }
     } else {
         if ($regex_extension) {
             // Sieve 'date' extension not available, read start/end from RegEx based rules instead
             if ($date_tests = self::parse_regexp_tests($this->vacation['tests'])) {
                 $date_value['from'] = $this->rc->format_date($date_tests['from'], $date_format, false);
                 $date_value['to'] = $this->rc->format_date($date_tests['to'], $date_format, false);
             }
         }
     }
     // force domain selection in redirect email input
     $domains = (array) $this->rc->config->get('managesieve_domains');
     $redirect = $this->vacation['action'] == 'redirect' || $this->vacation['action'] == 'copy';
     if (!empty($domains)) {
         sort($domains);
         $domain_select = new html_select(array('name' => 'action_domain', 'id' => 'action_domain'));
         $domain_select->add(array_combine($domains, $domains));
         if ($redirect && $this->vacation['target']) {
             $parts = explode('@', $this->vacation['target']);
             if (!empty($parts)) {
                 $this->vacation['domain'] = array_pop($parts);
                 $this->vacation['target'] = implode('@', $parts);
             }
         }
     }
     // redirect target
     $action_target = ' <span id="action_target_span" style="display:' . ($redirect ? 'inline' : 'none') . '">' . '<input type="text" name="action_target" id="action_target"' . ' value="' . ($redirect ? rcube::Q($this->vacation['target'], 'strict', false) : '') . '"' . (!empty($domains) ? ' size="20"' : ' size="35"') . '/>' . (!empty($domains) ? ' @ ' . $domain_select->show($this->vacation['domain']) : '') . '</span>';
     // Message tab
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('vacation_subject', $this->plugin->gettext('vacation.subject')));
     $table->add(null, $subject->show($this->vacation['subject']));
     $table->add('title', html::label('vacation_reason', $this->plugin->gettext('vacation.body')));
     $table->add(null, $reason->show($this->vacation['reason']));
     if ($date_extension || $regex_extension) {
         $table->add('title', html::label('vacation_datefrom', $this->plugin->gettext('vacation.start')));
         $table->add(null, $date_from->show($date_value['from']) . ($time_from ? ' ' . $time_from->show($date_value['time_from']) : ''));
         $table->add('title', html::label('vacation_dateto', $this->plugin->gettext('vacation.end')));
         $table->add(null, $date_to->show($date_value['to']) . ($time_to ? ' ' . $time_to->show($date_value['time_to']) : ''));
     }
     $table->add('title', html::label('vacation_status', $this->plugin->gettext('vacation.status')));
     $table->add(null, $status->show(!isset($this->vacation['disabled']) || $this->vacation['disabled'] ? 'off' : 'on'));
     $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.reply')) . $table->show($attrib));
     // Advanced tab
     $table = new html_table(array('cols' => 2));
     $table->add('title', html::label('vacation_from', $this->plugin->gettext('vacation.from')));
     $table->add(null, $from->show($this->vacation['from']));
     $table->add('title', html::label('vacation_addresses', $this->plugin->gettext('vacation.addresses')));
     $table->add(null, $addresses . $addresses_link->show($this->plugin->gettext('filladdresses')));
     $table->add('title', html::label('vacation_interval', $this->plugin->gettext('vacation.interval')));
     $table->add(null, $interval_txt);
     if ($after) {
         $table->add('title', html::label('vacation_after', $this->plugin->gettext('vacation.after')));
         $table->add(null, $after->show($this->vacation['idx'] - 1));
     }
     $table->add('title', html::label('vacation_action', $this->plugin->gettext('vacation.action')));
     $table->add('vacation', $action->show($this->vacation['action']) . $action_target);
     $out .= html::tag('fieldset', $class, html::tag('legend', null, $this->plugin->gettext('vacation.advanced')) . $table->show($attrib));
     $out .= '</form>';
     $this->rc->output->add_gui_object('sieveform', $form_id);
     if ($time_format) {
         $this->rc->output->set_env('time_format', $time_format);
     }
     return $out;
 }