Exemplo n.º 1
0
 /**
  * output appropriate html
  */
 function html()
 {
     print $this->locale_xhtml('intro');
     $form = new Doku_Form(array('id' => 'start'));
     $form->addHidden("page", $_REQUEST['page']);
     $form->addHidden("fn", "start");
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('start_btn')));
     $form->addElement('<p>' . $this->getLang('start_desc') . '</p>');
     html_form('', $form);
     $form = new Doku_Form(array('id' => 'stop'));
     $form->addHidden("page", $_REQUEST['page']);
     $form->addHidden("fn", "stop");
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('stop_btn')));
     $form->addElement('<p>' . $this->getLang('stop_desc') . '</p>');
     html_form('', $form);
     $form = new Doku_Form(array('id' => 'lock'));
     $form->addHidden("page", $_REQUEST['page']);
     $form->addHidden("fn", "lock");
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('lock_btn')));
     $form->addElement('<p>' . $this->getLang('lock_desc') . '</p>');
     html_form('', $form);
     $form = new Doku_Form(array('id' => 'unlock'));
     $form->addHidden("page", $_REQUEST['page']);
     $form->addHidden("fn", "unlock");
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('unlock_btn')));
     $form->addElement('<p>' . $this->getLang('unlock_desc') . '</p>');
     html_form('', $form);
 }
 function _render($act)
 {
     global $ID;
     $form = new Doku_Form(array('id' => 'forcessllogin1', 'action' => 'https://' . $this->host() . DOKU_BASE . DOKU_SCRIPT, 'method' => 'get'));
     $form->addHidden('id', $ID);
     $form->addHidden('do', $act);
     if ($this->getConf('cert')) {
         if (strpos($this->getLang('certinfo'), '{{name}}') !== false) {
             $form->addElement('<p>' . str_replace('{{name}}', $this->getConf('cert'), $this->getLang('certinfo')) . '</p>' . NL);
         } else {
             $form->addElement('<p>' . $this->getLang('certinfo') . " " . $this->getConf('cert') . '</p>' . NL);
         }
     }
     if ($this->getConf('ca')) {
         if (strpos($this->getLang('ca'), '{{name}}') !== false) {
             $form->addElement('<p>' . str_replace('{{name}}', $this->getConf('ca'), $this->getLang('cainfo')) . '</p>' . NL);
         } else {
             $form->addElement('<p>' . $this->getLang('cainfo') . " <a href='" . $this->getConf('ca') . "'>" . $this->getConf('ca') . "</a></p>" . NL);
         }
     }
     $form->addElement(form_makeButton('submit', '', $this->getLang('submit'), array('accesskey' => 'h', 'title' => $this->getLang('submittitle'), id => 'focus__this')));
     $form->printForm();
     $form = new Doku_Form(array('id' => 'forcessllogin2', 'method' => 'get'));
     $form->addElement(form_makeButton('submit', '', $this->getLang('cancel'), array('accesskey' => 'c', 'title' => $this->getLang('canceltitle'))));
     $form->printForm();
 }
Exemplo n.º 3
0
 /**
  * Builds a select box with all available templates
  *  (unless excluded in 'excludeTemplates')
  *  or show only two templates for mobile switcher: standard plus mobile template
  *
  * @author Anika Henke <*****@*****.**>
  */
 public function showTemplateSwitcher()
 {
     global $conf;
     global $ID;
     global $ACT;
     if ($ACT != 'show') {
         return;
     }
     $mobileSwitch = $this->getConf('mobileSwitch');
     $mobileTpl = $this->getConf('mobileTemplate');
     if ($mobileSwitch && $mobileTpl) {
         // templates for mobile switcher
         $templates = array($mobileTpl => $this->getLang('switchMobile'), $this->origTpl => $this->getLang('switchFull'));
     } else {
         // all templates (minus excluded templates)
         $excludeTemplates = array_map('trim', explode(",", $this->getConf('excludeTemplates')));
         $templates = array_diff($this->getTemplates(), $excludeTemplates);
     }
     $form = new Doku_Form(array('id' => 'tpl__switcher', 'title' => $this->getLang('switchTpl'), 'action' => wl($ID)));
     $form->addHidden('act', 'select');
     $form->addElement(form_makeListboxField('tpl', $templates, $conf['template'], $this->getLang('template'), '', '', array('class' => 'quickselect')));
     $form->addElement(form_makeButton('submit', '', $this->getLang('switch'), array('name' => 'switch')));
     $out = '<div class="plugin_loadskin">';
     $out .= $form->getForm();
     $out .= '</div>';
     return $out;
 }
Exemplo n.º 4
0
 protected function override_html_register()
 {
     global $lang;
     global $conf;
     global $INPUT;
     $base_attrs = array('size' => 50, 'required' => 'required');
     $email_attrs = $base_attrs + array('type' => 'email', 'class' => 'edit');
     print $this->override_locale_xhtml('register');
     print '<div class="centeralign">' . NL;
     $form = new Doku_Form(array('id' => 'dw__register'));
     $form->startFieldset($lang['btn_register']);
     $form->addHidden('do', 'register');
     $form->addHidden('save', '1');
     $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs));
     if (!$conf['autopasswd']) {
         $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs));
         $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs));
     }
     $form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs));
     $form->addElement(form_makeField('email', 'email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs));
     $form->addElement(form_makeButton('submit', '', $lang['btn_register']));
     $form->endFieldset();
     html_form('register', $form);
     print '</div>' . NL;
 }
Exemplo n.º 5
0
 function _edit_form(&$event, $param)
 {
     $preview = $event->data->findElementById('edbtn__preview');
     if ($preview) {
         $event->data->insertElement($preview + 1, form_makeButton('submit', 'changes', $this->getLang('changes'), array('id' => 'edbtn__changes')));
     }
 }
Exemplo n.º 6
0
 public function html()
 {
     global $ID;
     echo $this->locale_xhtml('tree');
     echo '<noscript><div class="error">' . $this->getLang('noscript') . '</div></noscript>';
     echo '<div id="plugin_move__tree">';
     echo '<div class="tree_root tree_pages">';
     echo '<h3>' . $this->getLang('move_pages') . '</h3>';
     $this->htmlTree(self::TYPE_PAGES);
     echo '</div>';
     echo '<div class="tree_root tree_media">';
     echo '<h3>' . $this->getLang('move_media') . '</h3>';
     $this->htmlTree(self::TYPE_MEDIA);
     echo '</div>';
     /** @var helper_plugin_move_plan $plan */
     $plan = plugin_load('helper', 'move_plan');
     echo '<div class="controls">';
     if ($plan->isCommited()) {
         echo '<div class="error">' . $this->getLang('moveinprogress') . '</div>';
     } else {
         $form = new Doku_Form(array('action' => wl($ID), 'id' => 'plugin_move__tree_execute'));
         $form->addHidden('id', $ID);
         $form->addHidden('page', 'move_main');
         $form->addHidden('json', '');
         $form->addElement(form_makeCheckboxField('autoskip', '1', $this->getLang('autoskip'), '', '', $this->getConf('autoskip') ? array('checked' => 'checked') : array()));
         $form->addElement('<br />');
         $form->addElement(form_makeCheckboxField('autorewrite', '1', $this->getLang('autorewrite'), '', '', $this->getConf('autorewrite') ? array('checked' => 'checked') : array()));
         $form->addElement('<br />');
         $form->addElement('<br />');
         $form->addElement(form_makeButton('submit', 'admin', $this->getLang('btn_start')));
         $form->printForm();
     }
     echo '</div>';
     echo '</div>';
 }
Exemplo n.º 7
0
 function html()
 {
     echo $this->locale_xhtml('intro_clean');
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'data_clean');
     $form->addHidden('data_go', 'go');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit_clean')));
     $form->printForm();
 }
Exemplo n.º 8
0
 public function xhtml($editor_id, $do)
 {
     $controls = '<div>';
     if (!$this->read_only) {
         $form = new Doku_Form(array('class' => 'editor_edit_form', 'editor' => $editor_id));
         $form->addElement(form_makeButton('submit', '', 'edit'));
         $controls .= $form->getForm();
         $controls .= '<div class="editor_save_controls">';
         $form = new Doku_Form(array('class' => 'editor_save_form', 'editor' => $editor_id));
         $form->addElement(form_makeButton('submit', 'savecontent', 'save'));
         $controls .= $form->getForm() . cancel_button() . '</div>';
     }
     return $controls . $this->editor_xhtml($editor_id, $do) . '</div>';
 }
 function render($params, $form)
 {
     if (!syntax_plugin_bureaucracy_field_submit::$captcha_displayed) {
         syntax_plugin_bureaucracy_field_submit::$captcha_displayed = true;
         $helper = null;
         if (@is_dir(DOKU_PLUGIN . 'captcha')) {
             $helper = plugin_load('helper', 'captcha');
         }
         if (!is_null($helper) && $helper->isEnabled()) {
             $form->addElement($helper->getHTML());
         }
     }
     $this->tpl = form_makeButton('submit', '', '@@LABEL|' . $this->getLang('submit') . '@@');
     parent::render($params, $form);
 }
Exemplo n.º 10
0
 /**
  * Create output
  */
 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (!$data || $mode != 'xhtml') {
         return;
     }
     $id = $data['id'];
     $from = $data['from'];
     $to = $data['to'];
     $form = new Doku_Form(array('id' => "slice_{$from_to}", "class" => "wiki_slice_form"));
     $form->addHidden('from', $from);
     $form->addHidden('to', $to);
     $form->addHidden('id', $id);
     $form->addElement(form_makeButton('submit', '', "Slice {$from}--{$to}"));
     $renderer->doc .= $form->getForm();
 }
Exemplo n.º 11
0
function action_button($button_name, $action = '', $hidden = NULL)
{
    global $ID;
    $form = new Doku_Form('Form_' . $button_name);
    if (!$action) {
        $action = $button_name;
    }
    $form->addHidden('do', $action);
    if (is_array($hidden)) {
        foreach ($hidden as $key => $value) {
            $form->addHidden($key, $value);
        }
    }
    $form->addElement(form_makeButton('submit', '', $button_name));
    return $form->getForm();
}
Exemplo n.º 12
0
 /**
  * Output HTML form
  */
 function html()
 {
     global $INPUT;
     global $conf;
     echo $this->locale_xhtml('intro');
     if (!$conf['mailfrom']) {
         msg($this->getLang('nofrom'), -1);
     }
     $form = new Doku_Form(array());
     $form->startFieldset('Testmail');
     $form->addHidden('send', 1);
     $form->addElement(form_makeField('text', 'to', $INPUT->str('to'), 'To:', '', 'block'));
     $form->addElement(form_makeField('text', 'cc', $INPUT->str('cc'), 'Cc:', '', 'block'));
     $form->addElement(form_makeField('text', 'bcc', $INPUT->str('bcc'), 'Bcc:', '', 'block'));
     $form->addElement(form_makeButton('submit', '', 'Send Email'));
     $form->printForm();
 }
Exemplo n.º 13
0
 /**
  * Render the field as XHTML
  *
  * @params array     $params Additional HTML specific parameters
  * @params Doku_Form $form   The target Doku_Form object
  * @params int       $formid unique identifier of the form which contains this field
  */
 public function renderfield($params, Doku_Form $form, $formid)
 {
     if (!isset(helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid])) {
         helper_plugin_bureaucracy_fieldsubmit::$captcha_displayed[$formid] = true;
         /** @var helper_plugin_captcha $helper */
         $helper = null;
         if (@is_dir(DOKU_PLUGIN . 'captcha')) {
             $helper = plugin_load('helper', 'captcha');
         }
         if (!is_null($helper) && $helper->isEnabled()) {
             $form->addElement($helper->getHTML());
         }
     }
     $attr = array();
     if (isset($this->opt['id'])) {
         $attr['id'] = $this->opt['id'];
     }
     $this->tpl = form_makeButton('submit', '', '@@DISPLAY|' . $this->getLang('submit') . '@@', $attr);
     parent::renderfield($params, $form, $formid);
 }
Exemplo n.º 14
0
 protected function getBackupForm()
 {
     $form = new \Doku_Form(['id' => 'mybackup_form']);
     $form->startFieldset('Folders to Backup');
     foreach (Backup::allowedDirectories() as $dir => $desc) {
         $form->addElement(form_makeCheckboxField('dirs[]', $dir, "<b>{$dir}</b> {$desc}", null, null, ['checked' => 'checked']));
     }
     $form->endFieldset();
     $form->startFieldset('Options');
     $form->addElement('<b>Logging Output</b>');
     $form->addElement(form_makeCheckboxField('verbose', 1, 'verbose (it can be very long)'));
     $form->addElement('<br /><b>Archive Format</b>');
     foreach (Backup::supportedFormats() as $ext => $enabled) {
         $disabled = $enabled ? [] : ['disabled' => 'disabled'];
         $selected = $ext != 'zip' ? [] : ['checked' => 'checked'];
         $form->addElement(form_makeRadioField('archive_format', $ext, strtoupper($ext), 'archive_format', '', array_merge([], $selected, $disabled)));
     }
     $form->endFieldset();
     $form->addElement('<br />');
     //$form->addElement(form_makeButton('button', null, 'check size'));
     $form->addElement(form_makeButton('submit', null, 'backup now'));
     return $form;
 }
Exemplo n.º 15
0
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <*****@*****.**>
 * @author Andreas Gohr <*****@*****.**>
 */
function html_resendpwd()
{
    global $lang;
    global $conf;
    global $INPUT;
    $token = preg_replace('/[^a-f0-9]+/', '', $INPUT->str('pwauth'));
    if (!$conf['autopasswd'] && $token) {
        print p_locale_xhtml('resetpwd');
        print '<div class="centeralign">' . NL;
        $form = new Doku_Form(array('id' => 'dw__resendpwd'));
        $form->startFieldset($lang['btn_resendpwd']);
        $form->addHidden('token', $token);
        $form->addHidden('do', 'resendpwd');
        $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size' => '50')));
        $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size' => '50')));
        $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
        $form->endFieldset();
        html_form('resendpwd', $form);
        print '</div>' . NL;
    } else {
        print p_locale_xhtml('resendpwd');
        print '<div class="centeralign">' . NL;
        $form = new Doku_Form(array('id' => 'dw__resendpwd'));
        $form->startFieldset($lang['resendpwd']);
        $form->addHidden('do', 'resendpwd');
        $form->addHidden('save', '1');
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block'));
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeTag('br'));
        $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
        $form->endFieldset();
        html_form('resendpwd', $form);
        print '</div>' . NL;
    }
}
Exemplo n.º 16
0
 /**
  * output appropriate html
  */
 public function html()
 {
     global $lang;
     $helper = $this->loadHelper('loadskin', true);
     print '<div id="plugin__loadskin">';
     print $this->locale_xhtml('intro');
     $form = new Doku_Form(array());
     $form->startFieldSet('Add rule');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'admin');
     $form->addHidden('page', 'loadskin');
     $form->addHidden('act', 'add');
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeTextField('pattern', '', $this->getLang('pattern')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeListboxField('tpl', $helper->getTemplates(), '', $this->getLang('template')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
     $form->endFieldSet();
     $form->printForm();
     if (@file_exists($this->config)) {
         $data = unserialize(io_readFile($this->config, false));
         if (!empty($data)) {
             echo '<table class="inline">' . DOKU_LF;
             echo '  <tr>' . DOKU_LF;
             echo '    <th>' . $this->getLang('pattern') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('template') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('action') . '</th>' . DOKU_LF;
             echo '  </tr>' . DOKU_LF;
             foreach ($data as $key => $value) {
                 echo '  <tr>' . DOKU_LF;
                 echo '    <td>' . $key . '</td>' . DOKU_LF;
                 echo '    <td>' . $value . '</td>' . DOKU_LF;
                 echo '    <td>' . DOKU_LF;
                 $form = new Doku_Form(array());
                 $form->addHidden('do', 'admin');
                 $form->addHidden('page', 'loadskin');
                 $form->addHidden('act', 'del');
                 $form->addHidden('id', $ID);
                 $form->addHidden('pattern', $key);
                 $form->addElement(form_makeButton('submit', '', $lang['btn_delete']));
                 $form->printForm();
                 echo '    </td>' . DOKU_LF;
                 echo '  </tr>' . DOKU_LF;
             }
             echo '</table>' . DOKU_LF;
         }
     }
     print '</div>';
 }
Exemplo n.º 17
0
 public function __construct($parent, $file, $read_only)
 {
     parent::__construct($parent, 'Recipe');
     $editor = Projects_Editor_Manager::manager()->editor('', $file->code(), $file->highlight());
     $editor->read_only = $read_only;
     $maker = $this->newElement('div', array(), 'Maker: ');
     $this->root->appendChild($maker);
     if (auth_quickaclcheck($file->id()) >= DOKU_EDIT) {
         $makers = Projects_Maker_Manager::manager()->maker($file);
         if (count($makers) > 1) {
             $select = $this->newElement('select', array('id' => 'PROJECTS_maker', 'name' => 'maker'));
             $maker->appendChild($select);
             foreach ($makers as $m) {
                 $prop = array('value' => $m->name());
                 if ($m->name() == $file->maker()) {
                     $prop['selected'] = 1;
                 }
                 $opt = $this->newElement('option', $prop, $m->name());
                 $select->appendChild($opt);
             }
             $controls = $this->newElement('span', array('id' => 'maker_controls', 'maker' => $file->maker()));
             $maker->appendChild($controls);
             $form = new Doku_Form(array('id' => 'maker_select_form'));
             $form->addElement(form_makeButton('submit', 'set_maker', 'update', array('id' => 'set_maker')));
             $controls->appendChild($this->loadElement($form->getForm()));
             $controls->appendChild($this->loadElement(cancel_button()));
         } else {
             $m = $makers ? $makers[0]->name() : 'none';
             $maker->appendChild($this->newText($m));
         }
     } else {
         $maker->appendChild($this->newText('Maker: ' . $file->maker()));
     }
     $content = $editor->xhtml('recipe', 'savecontent');
     $this->root->appendChild($this->loadElement("<div>{$content}</div>"));
 }
Exemplo n.º 18
0
    /**
     * show the move and/or rename a page form
     *
     * @author  Michael Hamann <*****@*****.**>
     * @author  Gary Owen <*****@*****.**>
     */
    function printForm() {
        global $ID;

        $ns = getNS($ID);

        $ns_select_data = $this->build_namespace_select_content($ns);

        $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
        $form->addHidden('page', $this->getPluginName());
        $form->addHidden('id', $ID);
        $form->addHidden('move_type', 'page');
        $form->startFieldset($this->getLang('movepage'));
        $form->addElement(form_makeMenuField('ns_for_page', $ns_select_data, $this->opts['ns_for_page'], $this->getLang('targetns'), '', 'block'));
        $form->addElement(form_makeTextField('newns', $this->opts['newns'], $this->getLang('newtargetns'), '', 'block'));
        $form->addElement(form_makeTextField('newname', $this->opts['newname'], $this->getLang('newname'), '', 'block'));
        $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
        $form->endFieldset();
        $form->printForm();

        if ($this->ns_opts !== false) {
            ptln('<fieldset>');
            ptln('<legend>');
            ptln($this->getLang('movens'));
            ptln('</legend>');
            ptln('<p>');
            ptln(sprintf($this->getLang('ns_move_in_progress'), $this->ns_opts['num_pages'], $this->ns_opts['num_media'], ':'.hsc($this->ns_opts['ns']), ':'.hsc($this->ns_opts['newns'])));
            ptln('</p>');
            ptln($this->helper->getNSMoveButton('continue'));
            ptln($this->helper->getNSMoveButton('abort'));
            ptln('</fieldset>');
        } else {
            $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'move__form'));
            $form->addHidden('page', $this->getPluginName());
            $form->addHidden('id', $ID);
            $form->addHidden('move_type', 'namespace');
            $form->startFieldset($this->getLang('movens'));
            $form->addElement(form_makeMenuField('targetns', $ns_select_data, $this->opts['targetns'], $this->getLang('targetns'), '', 'block'));
            $form->addElement(form_makeTextField('newnsname', $this->opts['newnsname'], $this->getLang('newnsname'), '', 'block'));
            $form->addElement(form_makeMenuField('contenttomove', array('pages' => $this->getLang('move_pages'), 'media' => $this->getLang('move_media'), 'both' => $this->getLang('move_media_and_pages')), $this->opts['contenttomove'], $this->getLang('content_to_move'), '', 'block'));
            $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
            $form->endFieldset();
            $form->printForm();
        }
    }
Exemplo n.º 19
0
 /**
  * output appropriate html
  */
 function html()
 {
     global $ID;
     ptln('<h1>' . $this->getLang('menu') . '</h1>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', $this->edit ? 'edit' : 'add');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     $form->startFieldset($this->getLang($this->edit ? 'edituser' : 'adduser'));
     if ($this->edit) {
         $form->addElement(form_makeField('text', 'user', $this->data['user'], $this->getLang('user'), '', '', array('disabled' => 'disabled')));
         $form->addHidden('uid', $this->data['user']);
         $form->addElement('<br />');
     } else {
         $form->addElement(form_makeField('text', 'uid', '', $this->getLang('user')));
         $form->addElement('<br />');
     }
     $form->addElement(form_makeField('text', 'grp', $this->edit ? implode(', ', $this->data['grp']) : '', $this->getLang('grp')));
     $form->addElement('<br />');
     $form->addElement(form_makeButton('submit', '', $this->getLang($this->edit ? 'change' : 'add')));
     $form->endFieldset();
     $form->printForm();
     ptln('<table class="inline" id="vg__show">');
     ptln('  <tr>');
     ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
     ptln('    <th class="grp">' . hsc($this->getLang('grps')) . '</th>');
     ptln('    <th> </th>');
     ptln('  </tr>');
     foreach ($this->users as $user => $grps) {
         //$userdata=$this->_auth->getUserData($user);
         ptln('  <tr>');
         ptln('    <td>' . hsc($user) . (isset($userdata['name']) ? hsc(' (' . $userdata['name'] . ')') : '') . '</td>');
         ptln('    <td>' . hsc(implode(', ', $grps)) . '</td>');
         ptln('    <td class="act">');
         ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
         ptln(' &bull; ');
         ptln('      <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'del', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>');
         ptln('    </td>');
         ptln('  </tr>');
     }
     ptln('</table>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', $this->editgroup ? 'editgroup' : 'addgroup');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     if ($this->editgroup) {
         $form->startFieldset($this->getLang('editgroup'));
         $form->addElement(form_makeField('text', 'group', $this->data['group'], $this->getLang('grp'), '', '', array('disabled' => 'disabled')));
         $form->addElement('<br />');
         $form->addHidden('uid', $this->data['group']);
         $form->addElement(form_makeField('text', 'users', implode(', ', $this->data['users']), $this->getLang('users')));
         $form->addElement('<br />');
     } else {
         $form->startFieldset($this->getLang('addgroup'));
         $form->addElement(form_makeField('text', 'uid', '', $this->getLang('grp')));
         $form->addElement('<br />');
         $form->addElement(form_makeField('text', 'users', '', $this->getLang('users')));
         $form->addElement('<br />');
     }
     $form->addElement(form_makeButton('submit', '', $this->getLang($this->editgroup ? 'change' : 'add')));
     $form->endFieldset();
     $form->printForm();
     ptln('<table class="inline" id="vg__show">');
     ptln('  <tr>');
     ptln('    <th class="grp">' . hsc($this->getLang('grps')) . '</th>');
     ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
     ptln('    <th class="act"> </th>');
     ptln('  </tr>');
     foreach ($this->groups as $group => $users) {
         ptln('  <tr>');
         ptln('    <td>' . hsc($group) . '</td>');
         ptln('    <td>' . hsc(implode(', ', $users)) . '</td>');
         ptln('    <td class="act">');
         ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'editgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
         ptln(' &bull; ');
         ptln('      <a class="vg_del" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'delgroup', 'uid' => $group, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('del')) . '</a>');
         ptln('    </td>');
         ptln('  </tr>');
     }
     ptln('</table>');
     $form = new Doku_Form(array('id' => 'vg', 'action' => wl($ID)));
     $form->addHidden('cmd', 'search');
     $form->addHidden('sectok', getSecurityToken());
     $form->addHidden('page', $this->getPluginName());
     $form->addHidden('do', 'admin');
     $form->startFieldset($this->getLang('searchuser'));
     $form->addElement(form_makeField('text', 'uid', '', $this->getLang('searchname')));
     $form->addElement(form_makeButton('submit', '', $this->getLang('search')));
     $form->printForm();
     if (!empty($this->_auth_userlist)) {
         ptln('<table class="inline" id="vg__show">');
         ptln('  <tr>');
         ptln('    <th class="user">' . hsc($this->getLang('users')) . '</th>');
         ptln('    <th class="act"> </th>');
         ptln('  </tr>');
         foreach ($this->_auth_userlist as $user => $userinfo) {
             ptln('  <tr>');
             ptln('    <td>' . hsc($user . ' (' . $userinfo['name'] . ')') . '</td>');
             ptln('    <td class="act">');
             ptln('      <a class="vg_edit" href="' . wl($ID, array('do' => 'admin', 'page' => $this->getPluginName(), 'cmd' => 'edit', 'uid' => $user, 'sectok' => getSecurityToken())) . '">' . hsc($this->getLang('edit')) . '</a>');
             ptln('    </td>');
             ptln('  </tr>');
         }
         ptln('</table>');
     }
 }
Exemplo n.º 20
0
 function test_close_fieldset()
 {
     $form = new Doku_Form(array('id' => 'dw__testform', 'action' => '/test'));
     $form->startFieldset('Test');
     $form->addHidden('summary', 'changes &c');
     $form->addElement(form_makeTextField('t', 'v', 'Text', 'text__id', 'block'));
     $form->addElement(form_makeCheckboxField('r', '1', 'Check', 'check__id', 'simple'));
     $form->addElement(form_makeButton('submit', 'save', 'Save', array('accesskey' => 's')));
     $form->addElement(form_makeButton('submit', 'cancel', 'Cancel'));
     ob_start();
     $form->printForm();
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($this->_ignoreTagWS($output), $this->_ignoreTagWS($this->_realoutput()));
 }
Exemplo n.º 21
0
 /**
  * Prints the comment form
  *
  * FIXME
  *  allow comments only for registered users
  *  add toolbar
  */
 function tpl_form($page, $pid)
 {
     global $INFO;
     global $BLOGTNG;
     $form = new DOKU_Form('blogtng__comment_form', wl($page) . '#blogtng__comment_form');
     $form->addHidden('pid', $pid);
     $form->addHidden('id', $page);
     $form->addHidden('btng[comment][source]', 'comment');
     foreach (array('name', 'mail', 'web') as $field) {
         $attr = $BLOGTNG['comment_submit_errors'][$field] ? array('class' => 'edit error') : array();
         if ($field == 'web' && !$this->getConf('comments_allow_web')) {
             continue;
         } else {
             $form->addElement(form_makeTextField('btng[comment][' . $field . ']', $BLOGTNG['comment'][$field], $this->getLang('comment_' . $field), 'blogtng__comment_' . $field, 'edit block', $attr));
         }
     }
     $form->addElement(form_makeOpenTag('div', array('class' => 'blogtng__toolbar')));
     $form->addElement(form_makeCloseTag('div'));
     if ($BLOGTNG['comment_submit_errors']['text']) {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text'], array('class' => 'edit error')));
     } else {
         $form->addElement(form_makeWikiText($BLOGTNG['comment']['text']));
     }
     //add captcha if available
     $helper = null;
     if (@is_dir(DOKU_PLUGIN . 'captcha')) {
         $helper = plugin_load('helper', 'captcha');
     }
     if (!is_null($helper) && $helper->isEnabled()) {
         $form->addElement($helper->getHTML());
     }
     $form->addElement(form_makeButton('submit', 'comment_preview', $this->getLang('comment_preview'), array('class' => 'button', 'id' => 'blogtng__preview_submit')));
     $form->addElement(form_makeButton('submit', 'comment_submit', $this->getLang('comment_submit'), array('class' => 'button', 'id' => 'blogtng__comment_submit')));
     if ($this->getConf('comments_subscription')) {
         $form->addElement(form_makeCheckboxField('blogtng[subscribe]', 1, $this->getLang('comment_subscribe')));
     }
     print '<div id="blogtng__comment_form_wrap">' . DOKU_LF;
     $form->printForm();
     if (isset($BLOGTNG['comment_action']) && $BLOGTNG['comment_action'] == 'preview' && empty($BLOGTNG['comment_submit_errors'])) {
         print '<div id="blogtng__comment_preview">' . DOKU_LF;
         $comment = new blogtng_comment();
         $comment->data = $BLOGTNG['comment'];
         $comment->data['cid'] = 'preview';
         $comment->output('default');
         print '</div>' . DOKU_LF;
     }
     print '</div>' . DOKU_LF;
 }
Exemplo n.º 22
0
/**
 * 
 * Show diff
 * between current page version and provided $text
 * or between the revisions provided via GET or POST
 *
 * @author Andreas Gohr <*****@*****.**>
 * @param  string $text  when non-empty: compare with this text with most current version
 * @param  bool   $intro display the intro text
 * @param  string $type  type of the diff (inline or sidebyside)
 */
function revisionsfull_html_diff($text = '', $intro = true, $type = null)
{
    global $ID;
    global $REV;
    global $lang;
    global $INPUT;
    global $INFO;
    $pagelog = new PageChangeLog($ID);
    /*
     * Determine diff type
     */
    if (!$type) {
        $type = $INPUT->str('difftype');
        if (empty($type)) {
            $type = get_doku_pref('difftype', $type);
            if (empty($type) && $INFO['ismobile']) {
                $type = 'inline';
            }
        }
    }
    if (!in_array($type, array('inline', 'sidebyside'))) {
        $type = 'full';
    }
    /*
     * Determine requested revision(s)
     */
    // we're trying to be clever here, revisions to compare can be either
    // given as rev and rev2 parameters, with rev2 being optional. Or in an
    // array in rev2.
    $rev1 = $REV;
    $rev2 = $INPUT->ref('rev2');
    if (is_array($rev2)) {
        $rev1 = (int) $rev2[0];
        $rev2 = (int) $rev2[1];
        if (!$rev1) {
            $rev1 = $rev2;
            unset($rev2);
        }
    } else {
        $rev2 = $INPUT->int('rev2');
    }
    /*
     * Determine left and right revision, its texts and the header
     */
    $r_minor = '';
    $l_minor = '';
    if ($text) {
        // compare text to the most current revision
        $l_rev = '';
        $l_text = rawWiki($ID, '');
        $l_head = '<a class="wikilink1" href="' . wl($ID) . '">' . $ID . ' ' . dformat((int) @filemtime(wikiFN($ID))) . '</a> ' . $lang['current'];
        $r_rev = '';
        $r_text = cleanText($text);
        $r_head = $lang['yours'];
    } else {
        if ($rev1 && isset($rev2) && $rev2) {
            // two specific revisions wanted
            // make sure order is correct (older on the left)
            if ($rev1 < $rev2) {
                $l_rev = $rev1;
                $r_rev = $rev2;
            } else {
                $l_rev = $rev2;
                $r_rev = $rev1;
            }
        } elseif ($rev1) {
            // single revision given, compare to current
            $r_rev = '';
            $l_rev = $rev1;
        } else {
            // no revision was given, compare previous to current
            $r_rev = '';
            $revs = $pagelog->getRevisions(0, 1);
            $l_rev = $revs[0];
            $REV = $l_rev;
            // store revision back in $REV
        }
        // when both revisions are empty then the page was created just now
        if (!$l_rev && !$r_rev) {
            $l_text = '';
        } else {
            $l_text = rawWiki($ID, $l_rev);
        }
        $r_text = rawWiki($ID, $r_rev);
        list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev, null, false, $type == 'inline');
    }
    /*
     * Build navigation
     */
    $l_nav = '';
    $r_nav = '';
    if (!$text) {
        list($l_nav, $r_nav) = html_diff_navigation($pagelog, $type, $l_rev, $r_rev);
    }
    /*
     * Create diff object and the formatter
     */
    $diff = new Diff(explode("\n", $l_text), explode("\n", $r_text));
    if ($type == 'inline') {
        $diffformatter = new InlineDiffFormatter();
    } elseif ($type == 'sidebyside') {
        $diffformatter = new TableDiffFormatter();
    } else {
        $diffformatter = new FullTableDiffFormatter();
    }
    /*
     * Display intro
     */
    if ($intro) {
        print p_locale_xhtml('diff');
    }
    /*
     * Display type and exact reference
     */
    if (!$text) {
        ptln('<div class="diffoptions group">');
        $form = new Doku_Form(array('action' => wl()));
        $form->addHidden('id', $ID);
        $form->addHidden('rev2[0]', $l_rev);
        $form->addHidden('rev2[1]', $r_rev);
        $form->addHidden('do', 'diff');
        $form->addElement(form_makeListboxField('difftype', array('full' => 'Full Side by Side', 'sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect')));
        $form->addElement(form_makeButton('submit', 'diff', 'Go'));
        $form->printForm();
        ptln('<p>');
        // link to exactly this view FS#2835
        echo html_diff_navigationlink($type, 'difflink', $l_rev, $r_rev ? $r_rev : $INFO['currentrev']);
        ptln('</p>');
        ptln('</div>');
        // .diffoptions
    }
    /*
     * Display diff view table
     */
    ?>
    <div class="table">
    <table class="diff diff_<?php 
    echo $type;
    ?>
">

        <?php 
    //navigation and header
    if ($type == 'inline') {
        if (!$text) {
            ?>
                <tr>
                    <td class="diff-lineheader">-</td>
                    <td class="diffnav"><?php 
            echo $l_nav;
            ?>
</td>
                </tr>
                <tr>
                    <th class="diff-lineheader">-</th>
                    <th <?php 
            echo $l_minor;
            ?>
>
                        <?php 
            echo $l_head;
            ?>
                    </th>
                </tr>
            <?php 
        }
        ?>
            <tr>
                <td class="diff-lineheader">+</td>
                <td class="diffnav"><?php 
        echo $r_nav;
        ?>
</td>
            </tr>
            <tr>
                <th class="diff-lineheader">+</th>
                <th <?php 
        echo $r_minor;
        ?>
>
                    <?php 
        echo $r_head;
        ?>
                </th>
            </tr>
        <?php 
    } else {
        if (!$text) {
            ?>
                <tr>
                    <td colspan="2" class="diffnav"><?php 
            echo $l_nav;
            ?>
</td>
                    <td colspan="2" class="diffnav"><?php 
            echo $r_nav;
            ?>
</td>
                </tr>
            <?php 
        }
        ?>
            <tr>
                <th colspan="2" <?php 
        echo $l_minor;
        ?>
>
                    <?php 
        echo $l_head;
        ?>
                </th>
                <th colspan="2" <?php 
        echo $r_minor;
        ?>
>
                    <?php 
        echo $r_head;
        ?>
                </th>
            </tr>
        <?php 
    }
    //diff view
    echo html_insert_softbreaks($diffformatter->format($diff));
    ?>

    </table>
    </div>
<?php 
}
Exemplo n.º 23
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM fields";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_fields');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('title') . '</th>' . '<th>' . $this->getLang('defaultval') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'title' => '', 'defaultval' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addHidden('up[' . $cur . '][fid]', $row['fid']);
         $form->addElement(form_makeTextField('up[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][title]', $row['title'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('up[' . $cur . '][defaultval]', $row['defaultval'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }
Exemplo n.º 24
0
 function _renderReviews($id, $meta, $parid)
 {
     # Check for permission to write reviews
     $mod = canReview($id, $meta, $parid);
     # No reviews and no moderator privileges => no review block
     if (!$mod && empty($meta[$parid]['reviews'])) {
         return '';
     }
     $ret = "<div class=\"dokutranslate_review\">\n";
     $ret .= '<h5>' . $this->getLang('review_header') . "</h5>\n";
     $ret .= "<table>\n";
     $listbox = array(array('0', $this->getLang('trans_wrong')), array('1', $this->getLang('trans_rephrase')), array('2', $this->getLang('trans_accepted')));
     # Prepare review form for current user
     if ($mod) {
         if (isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) {
             $myReview = $meta[$parid]['reviews'][$_SERVER['REMOTE_USER']];
         } else {
             $myReview = array('message' => '', 'quality' => 0, 'incomplete' => false);
         }
         $form = new Doku_Form(array());
         $form->addHidden('parid', strval($parid));
         $form->addHidden('do', 'dokutranslate_review');
         $form->addElement(form_makeTextField('review', $myReview['message'], $this->getLang('trans_message'), '', 'nowrap', array('size' => '50')));
         $form->addElement(form_makeMenuField('quality', $listbox, strval($myReview['quality']), $this->getLang('trans_quality'), '', 'nowrap'));
         $args = array();
         if ($myReview['incomplete']) {
             $args['checked'] = 'checked';
         }
         $form->addElement(form_makeCheckboxField('incomplete', '1', $this->getLang('trans_incomplete'), '', 'nowrap', $args));
         $form->addElement(form_makeButton('submit', '', $this->getLang('add_review')));
     }
     # Display all reviews for this paragraph
     while (list($key, $value) = each($meta[$parid]['reviews'])) {
         $ret .= '<tr><td>' . hsc($key) . '</td><td>';
         # Moderators can modify their own review
         if ($mod && $key == $_SERVER['REMOTE_USER']) {
             $ret .= $form->getForm();
         } else {
             $ret .= '(' . $listbox[$value['quality']][1];
             if ($value['incomplete']) {
                 $ret .= ', ' . $this->getLang('rend_incomplete');
             }
             $ret .= ') ';
             $ret .= hsc($value['message']);
         }
         $ret .= "</td></tr>\n";
     }
     # Current user is a moderator who didn't write a review yet,
     # display the review form at the end
     if ($mod && !isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) {
         if (empty($meta[$parid]['reviews'])) {
             $ret .= '<tr><td>';
         } else {
             $ret .= '<tr><td colspan="2">';
         }
         $ret .= $form->getForm();
         $ret .= "</td></tr>\n";
     }
     $ret .= "</table></div>\n";
     return $ret;
 }
Exemplo n.º 25
0
/**
 * Display the subscribe form
 *
 * @author Adrian Lang <*****@*****.**>
 */
function tpl_subscribe()
{
    global $INFO;
    global $ID;
    global $lang;
    global $conf;
    $stime_days = $conf['subscribe_time'] / 60 / 60 / 24;
    echo p_locale_xhtml('subscr_form');
    echo '<h2>' . $lang['subscr_m_current_header'] . '</h2>';
    echo '<div class="level2">';
    if ($INFO['subscribed'] === false) {
        echo '<p>' . $lang['subscr_m_not_subscribed'] . '</p>';
    } else {
        echo '<ul>';
        foreach ($INFO['subscribed'] as $sub) {
            echo '<li><div class="li">';
            if ($sub['target'] !== $ID) {
                echo '<code class="ns">' . hsc(prettyprint_id($sub['target'])) . '</code>';
            } else {
                echo '<code class="page">' . hsc(prettyprint_id($sub['target'])) . '</code>';
            }
            $sstl = sprintf($lang['subscr_style_' . $sub['style']], $stime_days);
            if (!$sstl) {
                $sstl = hsc($sub['style']);
            }
            echo ' (' . $sstl . ') ';
            echo '<a href="' . wl($ID, array('do' => 'subscribe', 'sub_target' => $sub['target'], 'sub_style' => $sub['style'], 'sub_action' => 'unsubscribe', 'sectok' => getSecurityToken())) . '" class="unsubscribe">' . $lang['subscr_m_unsubscribe'] . '</a></div></li>';
        }
        echo '</ul>';
    }
    echo '</div>';
    // Add new subscription form
    echo '<h2>' . $lang['subscr_m_new_header'] . '</h2>';
    echo '<div class="level2">';
    $ns = getNS($ID) . ':';
    $targets = array($ID => '<code class="page">' . prettyprint_id($ID) . '</code>', $ns => '<code class="ns">' . prettyprint_id($ns) . '</code>');
    $styles = array('every' => $lang['subscr_style_every'], 'digest' => sprintf($lang['subscr_style_digest'], $stime_days), 'list' => sprintf($lang['subscr_style_list'], $stime_days));
    $form = new Doku_Form(array('id' => 'subscribe__form'));
    $form->startFieldset($lang['subscr_m_subscribe']);
    $form->addRadioSet('sub_target', $targets);
    $form->startFieldset($lang['subscr_m_receive']);
    $form->addRadioSet('sub_style', $styles);
    $form->addHidden('sub_action', 'subscribe');
    $form->addHidden('do', 'subscribe');
    $form->addHidden('id', $ID);
    $form->endFieldset();
    $form->addElement(form_makeButton('submit', 'subscribe', $lang['subscr_m_subscribe']));
    html_form('SUBSCRIBE', $form);
    echo '</div>';
}
Exemplo n.º 26
0
 function html()
 {
     $sqlite = $this->dthlp->_getDB();
     if (!$sqlite) {
         return false;
     }
     echo $this->locale_xhtml('admin_intro');
     $sql = "SELECT * FROM aliases ORDER BY name";
     $res = $sqlite->query($sql);
     $rows = $sqlite->res2arr($res);
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'data_aliases');
     $form->addElement('<table class="inline">' . '<tr>' . '<th>' . $this->getLang('name') . '</th>' . '<th>' . $this->getLang('type') . '</th>' . '<th>' . $this->getLang('prefix') . '</th>' . '<th>' . $this->getLang('postfix') . '</th>' . '<th>' . $this->getLang('enum') . '</th>' . '</tr>');
     // add empty row for adding a new entry
     $rows[] = array('name' => '', 'type' => '', 'prefix' => '', 'postfix' => '', 'enum' => '');
     $cur = 0;
     foreach ($rows as $row) {
         $form->addElement('<tr>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][name]', $row['name'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeMenuField('d[' . $cur . '][type]', array('', 'page', 'title', 'mail', 'url', 'dt', 'wiki'), $row['type'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][prefix]', $row['prefix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][postfix]', $row['postfix'], ''));
         $form->addElement('</td>');
         $form->addElement('<td>');
         $form->addElement(form_makeTextField('d[' . $cur . '][enum]', $row['enum'], ''));
         $form->addElement('</td>');
         $form->addElement('</tr>');
         $cur++;
     }
     $form->addElement('</table>');
     $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
     $form->printForm();
 }
Exemplo n.º 27
0
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <*****@*****.**>
 */
function html_resendpwd()
{
    global $lang;
    global $conf;
    global $ID;
    print p_locale_xhtml('resendpwd');
    print '<div class="centeralign">' . NL;
    $form = new Doku_Form(array('id' => 'dw__resendpwd'));
    $form->startFieldset($lang['resendpwd']);
    $form->addHidden('do', 'resendpwd');
    $form->addHidden('save', '1');
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block'));
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeTag('br'));
    $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd']));
    $form->endFieldset();
    html_form('resendpwd', $form);
    print '</div>' . NL;
}
Exemplo n.º 28
0
 /**
  * Output html of the admin page
  */
 public function html()
 {
     global $ID;
     global $INPUT;
     if (is_null($this->_auth)) {
         print $this->lang['badauth'];
         return false;
     }
     $sqlite = $this->hlp->_getDB();
     if (!$sqlite) {
         return;
     }
     $fn = $INPUT->param('fn');
     if (is_array($fn)) {
         $cmd = key($fn);
         $param = is_array($fn[$cmd]) ? key($fn[$cmd]) : null;
     } else {
         $cmd = $fn;
         $param = null;
     }
     $user_list = $this->_auth->retrieveUsers($this->_start, $this->_pagesize, $this->_filter);
     echo $this->locale_xhtml('admin_intro');
     $form = new Doku_Form(array('method' => 'post'));
     $form->addHidden('page', 'userprofile_users');
     // List registered users
     $form->addElement('<table>' . '<tr>' . '<th>' . $this->getLang('username') . '</th>' . '<th>' . $this->getLang('realname') . '</th>' . '<th>' . $this->getLang('email') . '</th>' . '</tr>');
     foreach ($user_list as $user => $userinfo) {
         extract($userinfo);
         /**
          * @var string $name
          * @var string $pass
          * @var string $mail
          * @var array  $grps
          */
         if (!in_array('noprofile', $grps)) {
             $form->addElement('<tr>' . '<td><a href="' . wl($ID, array('fn[edit][' . $user . ']' => 1, 'do' => 'admin', 'page' => 'userprofile_users', 'sectok' => getSecurityToken())) . '" title="' . $this->lang['edit_prompt'] . '">' . hsc($user) . '</a></td>' . '<td>' . hsc($name) . '</td>' . '<td>' . hsc($mail) . '</td>' . '</tr>');
         }
     }
     $form->addElement('</table>');
     // Edit table
     if ($cmd == "edit") {
         $user = $param;
         $profile = $this->hlp->getProfile($user);
         // create hidden fields
         $form->addHidden('up[user][user]', $user);
         $form->addHidden('up[user][name]', $user_list[$user]['name']);
         $form->addHidden('up[user][email]', $user_list[$user]['mail']);
         $sql = "SELECT * FROM fields";
         $res = $sqlite->query($sql);
         $fields = $sqlite->res2arr($res);
         $form->addElement('<table>' . '<tr>' . '<th colspan="2">' . $this->getLang('th_edit') . '</th>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('realname') . '</td>' . '<td>' . hsc($user_list[$user]['name']) . '</td>' . '</tr>' . '<tr>' . '<td>' . $this->getLang('email') . '</td>' . '<td>' . hsc($user_list[$user]['mail']) . '</td>' . '</tr>');
         foreach ($fields as $field) {
             $form->addElement('<tr>');
             $form->addElement('<td>' . hsc($field['title']) . '</td>');
             $form->addElement('<td>');
             $defaults_array = explode('|', $field['defaultval']);
             if (count($defaults_array) > 1) {
                 // create select field
                 $defaults_array = array_map('trim', $defaults_array);
                 $form->addElement(form_makeMenuField('up[data][' . $field['name'] . ']', $defaults_array, $profile[$field['name']], ''));
             } else {
                 // create regular text field
                 $form->addElement(form_makeTextField('up[data][' . $field['name'] . ']', $profile[$field['name']], ''));
             }
             $form->addElement('</td>');
             $form->addElement('</tr>');
         }
         $form->addElement('<tr>' . '<td colspan="2">');
         $form->addElement(form_makeButton('submit', 'admin', $this->getLang('submit')));
         $form->addElement('</td>');
         $form->addElement('</table>');
     }
     $form->printForm();
 }
Exemplo n.º 29
0
 /**
  * form for slack invite
  *
  *
  */
 function slackinvite_signinform()
 {
     global $ID;
     $html = '';
     $params = array();
     $params['id'] = 'slackinvite_plugin_id';
     $params['action'] = wl($ID);
     $params['method'] = 'post';
     $params['enctype'] = 'multipart/form-data';
     $params['class'] = 'slackinvite_plugin';
     // Modification of the default dw HTML upload form
     $form = new Doku_Form($params);
     $form->startFieldset($this->getLang('signup'));
     $form->addHidden('source', hsc("slackinvite"));
     //add source of call, used in action to ignore anything not from this form
     $form->addElement(form_makeTextField('first_name', '', $this->getLang('first_name'), 'first__name'));
     $form->addElement(form_makeTextField('last_name', '', $this->getLang('last_name'), 'last__name'));
     $form->addElement(form_makeTextField('email', '', $this->getLang('email'), 'email'));
     $form->addElement(form_makeButton('submit', 'slacksignup', $this->getLang('btn_signup')));
     $form->endFieldset();
     $html .= '<div class="dokuwiki"><p>' . NL;
     //$html .= '<h3>TEAM43 Slack Sign Up</h3>';
     $html .= $form->getForm();
     $html .= '</p></div>' . NL;
     return $html;
 }
Exemplo n.º 30
0
/**
 * Print the search field form
 *
 * @author Tobias Sarnowski <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_searchform($ns, $query = '', $fullscreen = false)
{
    global $lang;
    // The default HTML search form
    $params = array('id' => 'dw__mediasearch');
    if (!$fullscreen) {
        $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php';
    } else {
        $params['action'] = media_managerURL(array(), '&');
    }
    $form = new Doku_Form($params);
    $form->addHidden('ns', $ns);
    $form->addHidden($fullscreen ? 'mediado' : 'do', 'searchlist');
    if (!$fullscreen) {
        $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>' . NL);
    }
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*'))));
    $form->addElement(form_makeButton('submit', '', $lang['btn_search']));
    $form->addElement(form_makeCloseTag('p'));
    html_form('searchmedia', $form);
}