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(); }
/** * 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); }
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; }
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(); }
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>'; }
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(); }
/** * 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(); }
/** * 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; }
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(); }
/** * 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; }
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())); }
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>'; }
/** * 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(); }
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(); }
/** * 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(); } }
/** * 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; }
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>↓</span> '; $ckey = '^' . $ckey; } else { $text .= '<span>↑</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; }
/** * 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>'; }
/** * 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(); }
/** * 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; } }
/** * 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>'; }
public function __construct($parent, $deps) { global $REV; parent::__construct($parent, 'Dependency'); $this->list = $this->newElement('ul', array('class' => 'dependency_list')); $this->root->appendChild($this->list); $this->editable = !$REV && auth_quickaclcheck($ID) >= AUTH_EDIT; if ($this->editable) { $li = $this->newElement('li'); $this->list->appendChild($li); $span = $this->newElement('span', array('class' => 'dependency')); $li->appendChild($span); $input = $this->newElement('input', array('id' => 'new_dependency_name')); $span->appendChild($input); $input = $this->newElement('a', array('id' => 'add_dependency', 'href' => '', 'class' => 'action'), 'add'); $li->appendChild($input); } if ($deps) { foreach ($deps as $dep => $auto) { $this->addDependence($dep, $auto); } } if ($this->editable) { $controls = $this->newElement('div', array('id' => 'dependency_update_controls')); $this->root->appendChild($controls); $form = new Doku_Form(array('id' => 'dependency_update_form')); $form->addHidden('new', ''); $form->addHidden('old', ''); $form->addElement(form_makeButton('submit', 'update_dependency', 'update', array('id' => 'update_dependency'))); $controls->appendChild($this->loadElement($form->getForm())); $controls->appendChild($this->loadElement(cancel_button())); } }
/** * * 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 }
/** * 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>'; }
/** * 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(' • '); 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(' • '); 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>'); } }
/** * Create the form * * @param array $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)); $form->addHidden('id', $ID); $form->addHidden('bureaucracy[$$id]', $this->form_id); foreach ($fields as $id => $opt) { /** @var $opt syntax_plugin_bureaucracy_field */ $opt->renderfield(array('name' => 'bureaucracy[' . $id . ']'), $form); } return $form->getForm(); }
/** * Create table header * * @param array $clist keys of the columns * @param array $data instruction by handler * @return string html of table header */ function preList($clist, $data) { global $ID; global $conf; // Save current request params to not loose them $cur_params = $this->dthlp->_get_current_param(); //show active filters $text = '<div class="table dataaggregation">'; if (isset($_REQUEST['dataflt'])) { $filters = $this->dthlp->_get_filters(); $fltrs = array(); foreach ($filters as $filter) { if (strpos($filter['compare'], 'LIKE') !== false) { if (strpos($filter['compare'], 'NOT') !== false) { $comparator_value = '!~' . str_replace('%', '*', $filter['value']); } else { $comparator_value = '*~' . str_replace('%', '', $filter['value']); } $fltrs[] = $filter['key'] . $comparator_value; } else { $fltrs[] = $filter['key'] . $filter['compare'] . $filter['value']; } } $text .= '<div class="filter">'; $text .= '<h4>' . sprintf($this->getLang('tablefilteredby'), hsc(implode(' & ', $fltrs))) . '</h4>'; $text .= '<div class="resetfilter">' . '<a href="' . wl($ID) . '">' . $this->getLang('tableresetfilter') . '</a>' . '</div>'; $text .= '</div>'; } // build table $text .= '<table class="inline dataplugin_table ' . $data['classes'] . '">'; // build column headers $text .= '<tr>'; if ($data['rownumbers']) { $text .= '<th>#</th>'; } foreach ($data['headers'] as $num => $head) { $ckey = $clist[$num]; $width = ''; if (isset($data['widths'][$num]) and $data['widths'][$num] != '-') { $width = ' style="width: ' . $data['widths'][$num] . ';"'; } $text .= '<th' . $width . '>'; // add sort arrow if (isset($data['sort']) && $ckey == $data['sort'][0]) { if ($data['sort'][1] == 'ASC') { $text .= '<span>↓</span> '; $ckey = '^' . $ckey; } else { $text .= '<span>↑</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">'; if ($data['rownumbers']) { $text .= '<th></th>'; } 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; }
private function button_rename_use($range) { global $ID; if (auth_quickaclcheck($ID) < AUTH_EDIT) { return ''; } $self = noNS($ID); $project = Project::project(); if ($project == NULL) { return ''; } $files = array(''); foreach (array_keys($project->files()) as $file) { if ($file != $self) { $files[] = $file; } } $form = new Doku_Form("change_use"); $form->addHidden('do', 'change_use'); $form->addHidden('range', $range); $form->addElement(form_makeMenuField('use', $files, '', '', '', '', array("onchange" => "submit();"))); return $form->getForm(); }
function html() { global $ID; echo $this->locale_xhtml('intro'); if ($_REQUEST['db'] && checkSecurityToken()) { echo '<h2>' . $this->getLang('db') . ' ' . hsc($_REQUEST['db']) . '</h2>'; echo '<div class="level2">'; echo '<ul>'; echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'table\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('table') . '</a></div></li>'; echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'sql' => 'SELECT name,sql FROM sqlite_master WHERE type=\'index\' ORDER BY name', 'sectok' => getSecurityToken())) . '">' . $this->getLang('index') . '</a></div></li>'; echo '</ul>'; $form = new Doku_Form(array()); $form->startFieldset('SQL Command'); $form->addHidden('id', $ID); $form->addHidden('do', 'admin'); $form->addHidden('page', 'sqlite'); $form->addHidden('db', $_REQUEST['db']); $form->addElement('<textarea name="sql" class="edit">' . hsc($_REQUEST['sql']) . '</textarea>'); $form->addElement('<input type="submit" class="button" />'); $form->endFieldset(); $form->printForm(); if ($_REQUEST['sql']) { $DBI =& plugin_load('helper', 'sqlite'); if (!$DBI->init($_REQUEST['db'], '')) { return; } $sql = explode(";", $_REQUEST['sql']); foreach ($sql as $s) { $s = preg_replace('!^\\s*--.*$!m', '', $s); $s = trim($s); if (!$s) { continue; } $res = $DBI->query("{$s};"); if ($res === false) { continue; } msg(sqlite_num_rows($res) . ' affected rows', 1); $result = $DBI->res2arr($res); if (!count($result)) { continue; } echo '<p>'; $ths = array_keys($result[0]); echo '<table class="inline">'; echo '<tr>'; foreach ($ths as $th) { echo '<th>' . hsc($th) . '</th>'; } echo '</tr>'; foreach ($result as $row) { echo '<tr>'; $tds = array_values($row); foreach ($tds as $td) { echo '<td>' . hsc($td) . '</td>'; } echo '</tr>'; } echo '</table>'; echo '</p>'; } } echo '</div>'; } }
/** * 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); }