Exemplo n.º 1
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 <anika@selfthinker.org>
  */
 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;
 }
 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
 public function tplMetaDataForm(Doku_Event &$event)
 {
     if ($event->data != 'social_form') {
         return;
     }
     global $ID;
     echo '<div class="plugin_social">';
     echo '<div class="form" id="pluginsocialform" >';
     $form = new Doku_Form(array());
     $form->addHidden('target', 'plugin_social');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'social_save');
     foreach (helper_plugin_social_meta::$metaEditableKeys as $type => $values) {
         $form->addElement('<div>');
         $form->startFieldset($type);
         foreach ($values as $value) {
             $metadata = $this->helper->meta->getMetaData();
             $name = $this->helper->meta->getMetaPropertyName($type, $value);
             $form->addElement(form_makeTextField($name, $metadata[$name], $name, null, 'block'));
         }
         $form->endFieldset();
         $form->addElement('</div>');
     }
     $form->addElement(form_makeButton('submit', null, $this->getLang('btnSave')));
     html_form('', $form);
     echo '</div>';
     echo '</div>';
     $event->preventDefault();
 }
Exemplo n.º 4
0
 /**
  * Render the field as XHTML
  *
  * Outputs the represented field using the passed Doku_Form object.
  * Additional parameters (CSS class & HTML name) are passed in $params.
  *
  * @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)
 {
     $this->_handlePreload();
     if (!$form->_infieldset) {
         $form->startFieldset('');
     }
     if ($this->error) {
         $params['class'] = 'bureaucracy_error';
     }
     $params = array_merge($this->opt, $params);
     list($name, $entries, $value, $label, $id, $class) = $this->_parse_tpl(array('@@NAME@@', $params['args'], '@@VALUE@@', '@@DISPLAY@@', '@@ID@@', '@@CLASS@@'), $params);
     $value = in_array($value, $entries) ? $value : null;
     $valueoffieldwithid = $value !== null ? $value : current($entries);
     // label
     $s = '<label';
     $s .= ' class="radiolabel ' . $class . '"';
     $s .= '><span>' . $label . '</span>';
     $s .= '</label>';
     $form->addElement($s);
     // radio fields
     foreach ($entries as $val) {
         if ($value === $val) {
             $attrs = array('checked' => 'checked');
         } else {
             $attrs = array();
         }
         if ($valueoffieldwithid === $val) {
             $_id = $id;
             //e.g. autofocus with 'focus__this' id
         } else {
             $_id = '';
         }
         $form->addElement(form_makeRadioField($name, $val, $val, $_id, $class, $attrs));
     }
 }
Exemplo n.º 5
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.º 6
0
 /**
  * Render the field as XHTML
  *
  * Outputs the represented field using the passed Doku_Form object.
  * Additional parameters (CSS class & HTML name) are passed in $params.
  *
  * @params array     $params Additional HTML specific parameters
  * @params Doku_Form $form   The target Doku_Form object
  */
 public function renderfield($params, Doku_Form $form)
 {
     $this->_handlePreload();
     if (!$form->_infieldset) {
         $form->startFieldset('');
     }
     if ($this->error) {
         $params['class'] = 'bureaucracy_error';
     }
     $params = array_merge($this->opt, $params);
     $form->addElement(call_user_func_array('form_makeListboxField', $this->_parse_tpl(array('@@NAME@@', $params['args'], '@@VALUE|' . $params['args'][0] . '@@', '@@DISPLAY@@', '', '@@CLASS@@'), $params)));
 }
 /**
  * Render the top of the fieldset 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
  */
 function renderfield($params, Doku_Form $form, $formid)
 {
     $form->startFieldset(hsc($this->getParam('display')));
     if (isset($this->depends_on)) {
         $dependencies = array_map('hsc', (array) $this->depends_on);
         if (count($this->depends_on) > 1) {
             $msg = 'Only edit this fieldset if ' . '“<span class="bureaucracy_depends_fname">%s</span>” ' . 'is set to “<span class="bureaucracy_depends_fvalue">%s</span>”.';
         } else {
             $msg = 'Only edit this fieldset if ' . '“<span class="bureaucracy_depends_fname">%s</span>” is set.';
         }
         $form->addElement('<p class="bureaucracy_depends">' . vsprintf($msg, $dependencies) . '</p>');
     }
 }
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>';
 }
Exemplo n.º 9
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.º 10
0
function xhtml_action($action, $title, $hidden_fields = array(), $fields = array())
{
    $hidden_fields['do'] = $action;
    $name = preg_replace('/[^0-9A-Za-z_]+/', '_', $title);
    $formID = "PROJECTS_{$name_form}";
    $form = new Doku_Form(array('id' => $formID));
    foreach ($hidden_fields as $name => $value) {
        $form->addHidden($name, $value);
    }
    foreach ($fields as $field) {
        $form->addElement($field);
    }
    $form->addElement("<a href=\"\" class=\"action_link\">{$title}</a>");
    return '<span class="action">' . $form->getForm() . '</span>';
}
Exemplo n.º 11
0
 /**
  * Render the field as XHTML
  *
  * @params array     $params Additional HTML specific parameters
  * @params Doku_Form $form   The target Doku_Form object
  */
 public function renderfield($params, Doku_Form $form)
 {
     if (!syntax_plugin_bureaucracy_field_submit::$captcha_displayed) {
         syntax_plugin_bureaucracy_field_submit::$captcha_displayed = 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());
         }
     }
     $this->tpl = form_makeButton('submit', '', '@@DISPLAY|' . $this->getLang('submit') . '@@');
     parent::renderfield($params, $form);
 }
Exemplo n.º 12
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.º 13
0
 /**
  * Creates the HTML for the field
  *
  * @param array $params
  * @param Doku_Form $form
  * @param int $formid
  */
 public function renderfield($params, Doku_Form $form, $formid)
 {
     if (!$this->column) {
         return;
     }
     // this is what parent does
     $this->_handlePreload();
     if (!$form->_infieldset) {
         $form->startFieldset('');
     }
     if ($this->error) {
         $params['class'] = 'bureaucracy_error';
     }
     // output the field
     $value = new Value($this->column, $this->opt['value']);
     $field = $this->makeField($value, $params['name']);
     $form->addElement($field);
 }
Exemplo n.º 14
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.º 15
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.º 16
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);
 }
Exemplo n.º 17
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.º 18
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.º 19
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();
 }
 /**
  * Add input fields for dynamic filtering
  */
 protected function renderDynamicFilters()
 {
     if ($this->mode != 'xhtml') {
         return;
     }
     if (!$this->data['dynfilters']) {
         return;
     }
     global $conf;
     $this->renderer->doc .= '<tr class="dataflt">';
     // add extra column for row numbers
     if ($this->data['rownumbers']) {
         $this->renderer->doc .= '<th></th>';
     }
     // each column gets a form
     foreach ($this->columns as $column) {
         $this->renderer->doc .= '<th>';
         $form = new \Doku_Form(array('method' => 'GET', 'action' => wl($this->id)));
         unset($form->_hidden['sectok']);
         // we don't need it here
         if (!$conf['userewrite']) {
             $form->addHidden('id', $this->id);
         }
         // current value
         $dynamic = $this->searchConfig->getDynamicParameters();
         $filters = $dynamic->getFilters();
         if (isset($filters[$column->getFullQualifiedLabel()])) {
             list(, $current) = $filters[$column->getFullQualifiedLabel()];
             $dynamic->removeFilter($column);
         } else {
             $current = '';
         }
         // Add current request params
         $params = $dynamic->getURLParameters();
         foreach ($params as $key => $val) {
             $form->addHidden($key, $val);
         }
         // add input field
         $key = $column->getFullQualifiedLabel() . '*~';
         $form->addElement(form_makeField('text', SearchConfigParameters::$PARAM_FILTER . '[' . $key . ']', $current, ''));
         $this->renderer->doc .= $form->getForm();
         $this->renderer->doc .= '</th>';
     }
     $this->renderer->doc .= '</tr>';
 }
Exemplo n.º 21
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.º 22
0
/**
 * Form to request a new password for an existing account
 *
 * @author Benoit Chesneau <benoit@bchesneau.info>
 */
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.º 23
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.º 24
0
/**
 * Display the subscribe form
 *
 * @author Adrian Lang <lang@cosmocode.de>
 */
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.º 25
0
 function preList($clist, $data)
 {
     global $ID;
     global $conf;
     // Save current request params to not loose them
     $cur_params = array();
     if (isset($_REQUEST['dataflt'])) {
         $cur_params = $this->dthlp->_a2ua('dataflt', $_REQUEST['dataflt']);
     }
     if (isset($_REQUEST['datasrt'])) {
         $cur_params['datasrt'] = $_REQUEST['datasrt'];
     }
     if (isset($_REQUEST['dataofs'])) {
         $cur_params['dataofs'] = $_REQUEST['dataofs'];
     }
     // build table
     $text = '<div class="table dataaggregation">' . '<table class="inline dataplugin_table ' . $data['classes'] . '">';
     // build column headers
     $text .= '<tr>';
     foreach ($data['headers'] as $num => $head) {
         $ckey = $clist[$num];
         $text .= '<th>';
         // add sort arrow
         if (isset($data['sort']) && $ckey == $data['sort'][0]) {
             if ($data['sort'][1] == 'ASC') {
                 $text .= '<span>&darr;</span> ';
                 $ckey = '^' . $ckey;
             } else {
                 $text .= '<span>&uarr;</span> ';
             }
         }
         // Clickable header for dynamic sorting
         $text .= '<a href="' . wl($ID, array('datasrt' => $ckey) + $cur_params) . '" title="' . $this->getLang('sort') . '">' . hsc($head) . '</a>';
         $text .= '</th>';
     }
     $text .= '</tr>';
     // Dynamic filters
     if ($data['dynfilters']) {
         $text .= '<tr class="dataflt">';
         foreach ($data['headers'] as $num => $head) {
             $text .= '<th>';
             $form = new Doku_Form(array('method' => 'GET'));
             $form->_hidden = array();
             if (!$conf['userewrite']) {
                 $form->addHidden('id', $ID);
             }
             $key = 'dataflt[' . $data['cols'][$clist[$num]]['colname'] . '*~' . ']';
             $val = isset($cur_params[$key]) ? $cur_params[$key] : '';
             // Add current request params
             foreach ($cur_params as $c_key => $c_val) {
                 if ($c_val !== '' && $c_key !== $key) {
                     $form->addHidden($c_key, $c_val);
                 }
             }
             $form->addElement(form_makeField('text', $key, $val, ''));
             $text .= $form->getForm();
             $text .= '</th>';
         }
         $text .= '</tr>';
     }
     return $text;
 }
Exemplo n.º 26
0
 /**
  * Create the form
  *
  * @param helper_plugin_bureaucracy_field[] $fields array with form fields
  * @return string html of the form
  */
 private function _htmlform($fields)
 {
     global $ID;
     $form = new Doku_Form(array('class' => 'bureaucracy__plugin', 'id' => 'bureaucracy__plugin' . $this->form_id, 'enctype' => 'multipart/form-data'));
     $form->addHidden('id', $ID);
     $form->addHidden('bureaucracy[$$id]', $this->form_id);
     foreach ($fields as $id => $field) {
         $field->renderfield(array('name' => 'bureaucracy[' . $id . ']'), $form, $this->form_id);
     }
     return $form->getForm();
 }
Exemplo n.º 27
0
/**
 * Form print function.
 * Just calls printForm() on the data object.
 *
 * @param Doku_Form $data The form
 */
function html_form_output($data)
{
    $data->printForm();
}
Exemplo n.º 28
0
    /**
     * show the move and/or rename a page form
     *
     * @author  Michael Hamann <michael@content-space.de>
     * @author  Gary Owen <gary@isection.co.uk>
     */
    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.º 29
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.º 30
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;
 }