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; }
/** * 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)); } }
/** * 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; }
/** * 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>'); } }
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; }
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())); }
/** * 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(); }
/** * 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); }
/** * 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; } }
public function html() { ptln('<h1>' . $this->getLang('menu') . '</h1>'); //ptln('FIXME here should be form for editing'); //echo $this->locale_xhtml('intro'); $form = new Doku_Form(array('class' => 'safehtmlsnippets')); $form->startFieldset('HTML Snippets'); $form->addHidden('id', $ID); $form->addHidden('do', 'admin'); $form->addHidden('page', 'safehtmlsnippets'); $form->addHidden('sectok', getSecurityToken()); $form->addElement('<label for="key">' . hsc($this->getLang('key')) . ' </label><input name="key" type="text" value="' . hsc($_REQUEST['key']) . '" /><br/>'); $form->addElement('<label for="snippet">' . hsc($this->getLang('snippet')) . '</label><br/><textarea name="snippet" class="edit">' . hsc($_REQUEST['snippet']) . '</textarea>'); $form->addElement('<button name="button" type="submit" class="button" value="add">' . hsc($this->getLang('button_add')) . '</button>'); $form->addElement('<button name="button" type="submit" class="button" value="remove">' . hsc($this->getLang('button_remove')) . '</button>'); $form->endFieldset(); $form->printForm(); /* ptln('id<br/>'.hsc($_REQUEST['id']).'<br/>'); ptln('do<br/>'.hsc($_REQUEST['do']).'<br/>'); ptln('page<br/>'.hsc($_REQUEST['page']).'<br/>'); ptln('key<br/>'.hsc($_REQUEST['key']).'<br/>'); ptln('snippet<br/>'.hsc($_REQUEST['snippet']).'<br/>'); ptln('button<br/>'.hsc($_REQUEST['button']).'<br/>'); //*/ $sqlite = plugin_load('helper', 'sqlite'); if (!$sqlite) { msg('This plugin requires the sqlite plugin. Please install it'); return $data; } // initialize the database connection if (!$sqlite->init('safehtmlsnippets', DOKU_PLUGIN . 'safehtmlsnippets/db/')) { return $data; } if ($_REQUEST['button'] && checkSecurityToken()) { $key = $_REQUEST['key']; if (!preg_match('/^[a-zA-Z0-9_.-]{1,10}$/i', $key)) { msg(sprintf($this->getLang('invalidkey'), hsc($key))); return; } if ($_REQUEST['button'] == 'add') { $res = $sqlite->query("DELETE FROM safesnippets WHERE key = ?;", $key); $res = $sqlite->query("INSERT INTO safesnippets (key,val) values (?,?);", $key, $_REQUEST['snippet']); } else { if ($_REQUEST['button'] == 'remove') { $res = $sqlite->query("DELETE FROM safesnippets WHERE key = ?;", $key); } } } $res = $sqlite->query("SELECT key,val FROM safesnippets;"); //if ($res === false) continue; //msg(sqlite_num_rows($res).' affected rows',1); $result = $sqlite->res2arr($res); if (count($result)) { 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>'; } }
/** * 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(); } }
/** * 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>'); } }
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>'; } }
/** * Displays the limit selection form * * @author hArpanet <*****@*****.**> * * @param string $query */ private function xhtml_limit_form($query = '') { global $lang; $limit = $this->getLimitParam($query); $resultset = $query['resultset']; ptln('<div class="level1">'); $form = new Doku_Form(array('id' => 'blogtng__' . $resultset . '_limit_form')); $form->startFieldset(""); $form->addHidden('page', 'blogtng'); $form->addElement(form_makeListBoxField("btng[{$resultset}][limit]", array(5, 10, 15, 20, 25, 30, 40, 50, 100), $limit, $this->getLang('numhits'))); $form->addHidden("btng[{$resultset}][offset]", $this->getOffsetParam($query)); $form->addElement(form_makeButton('submit', 'admin', $lang['btn_update'])); $form->endFieldset(); html_form('blogtng__' . $resultset . '_cnt_form', $form); ptln('</div>'); }
/** * Display the simple move form */ protected function GUI_simpleForm() { global $ID; echo $this->locale_xhtml('move'); $treelink = wl($ID, array('do' => 'admin', 'page' => 'move_tree')); echo '<p id="plugin_move__treelink">'; printf($this->getLang('treelink'), $treelink); echo '</p>'; $form = new Doku_Form(array('action' => wl($ID), 'method' => 'post', 'class' => 'plugin_move_form')); $form->addHidden('page', 'move_main'); $form->addHidden('id', $ID); $form->startFieldset($this->getLang('legend')); $form->addElement(form_makeRadioField('class', 'page', $this->getLang('movepage') . ' <code>' . $ID . '</code>', '', 'block radio click-page', array('checked' => 'checked'))); $form->addElement(form_makeRadioField('class', 'namespace', $this->getLang('movens') . ' <code>' . getNS($ID) . '</code>', '', 'block radio click-ns')); $form->addElement(form_makeTextField('dst', $ID, $this->getLang('dst'), '', 'block indent')); $form->addElement(form_makeMenuField('type', array('pages' => $this->getLang('move_pages'), 'media' => $this->getLang('move_media'), 'both' => $this->getLang('move_media_and_pages')), 'both', $this->getLang('content_to_move'), '', 'block indent select')); $form->addElement(form_makeCheckboxField('autoskip', '1', $this->getLang('autoskip'), '', 'block', $this->getConf('autoskip') ? array('checked' => 'checked') : array())); $form->addElement(form_makeCheckboxField('autorewrite', '1', $this->getLang('autorewrite'), '', 'block', $this->getConf('autorewrite') ? array('checked' => 'checked') : array())); $form->addElement(form_makeButton('submit', 'admin', $this->getLang('btn_start'))); $form->endFieldset(); $form->printForm(); }
/** * */ public function oauthAddConsumer($opt) { global $lang; global $conf; $this->oauthToolbar(); print '<h1>OAuth - Add Consumer</h1>' . NL; print '<div class="leftalign">' . NL; print '</div>' . NL; print '<div class="centeralign">' . NL; $form = new Doku_Form('dw__oauth'); $form->startFieldset('Create Consumer'); # $form->addHidden('id', $ID); # $form->addElement('<p>Your Username: '******'REMOTE_USER'].'</p>'); # $form->addHidden('dwoauthnonce', $opt['secpass']); $form->addHidden('feedback', 1); $form->addElement(form_makeTextField('consumer_key', $opt['consumer_key'], 'Consumer Key', 'focus__this', 'block')); $form->addElement(form_makeTextField('consumer_secret', $opt['consumer_secret'], 'Consumer Secret', '', 'block')); $form->addElement(form_makeTextField('callback_url', $opt['callback_url'], 'callback Url', '', 'block')); $form->addElement(form_makeButton('submit', 'oauth', 'addconsumer')); $form->addElement(form_makeButton('submit', 'oauth', 'cancel')); $form->endFieldset(); // TODO: change-user/re-login button.. (go to logout, keep special $ID='OAUTHPLUGIN:'.$opt['secpass'] html_form('confirm', $form); print '</div>' . NL; }
function __siteexport_addpage() { global $ID, $conf; $templateSwitching = false; $pdfExport = false; $usenumberedheading = false; $cronEnabled = false; $translationAvailable = false; $usenumberedheading = true; if (($functions =& plugin_load('preload', 'siteexport')) && $functions->__create_preload_function()) { $templateSwitching = true; } if ($functions =& plugin_load('action', 'dw2pdf')) { $pdfExport = true; } // if ( $functions =& plugin_load('renderer', 'nodetailsxhtml' ) ) { // } if ($functions =& plugin_load('cron', 'siteexport')) { $cronEnabled = $functions->canWriteSettings(); } if ($functions =& plugin_load('helper', 'translation')) { $translationAvailable = true; } $regenerateScript = ''; print $this->locale_xhtml('intro'); $form = new Doku_Form('siteexport', null, 'post'); $form->startFieldset($this->getLang('startingNamespace')); $form->addElement(form_makeTextField('ns', $ID, $this->getLang('ns') . ':', 'ns')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTextField('ens', $ID, $this->getLang('ens') . ':', 'ens')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeListboxField('depthType', array("0.0" => $this->getLang('depth.pageOnly'), "1.0" => $this->getLang('depth.allSubNameSpaces'), "2.0" => $this->getLang('depth.specifiedDepth')), empty($_REQUEST['depthType']) ? $this->getLang('depth.allSubNameSpaces') : $_REQUEST['depthType'], $this->getLang('depthType') . ':', 'depthType', null, array_merge(array('class' => 'edit')))); $form->addElement(form_makeTag('br')); $form->addElement(form_makeOpenTag("div", array('style' => 'display:' . ($_REQUEST['depthType'] == "2" ? "block" : "none") . ';', 'id' => 'depthContainer'))); $form->addElement(form_makeTextField('depth', $this->getConf('depth'), $this->getLang('depth') . ':', 'depth')); $form->addElement(form_makeCloseTag("div")); $form->addElement(form_makeTag('br')); $form->addElement(form_makeOpenTag("div", array('style' => 'display:none;', 'id' => 'depthContainer'))); $form->addElement(form_makeCheckboxField('exportLinkedPages', 1, $this->getLang('exportLinkedPages') . ':', 'exportLinkedPages')); $form->addElement(form_makeCloseTag("div")); $form->endFieldset(); $form->addElement(form_makeTag('br')); $form->startFieldset($this->getLang('selectYourOptions')); $form->addElement(form_makeCheckboxField('absolutePath', 1, $this->getLang('absolutePath') . ':', 'absolutePath')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('exportBody', 1, $this->getLang('exportBody') . ':', 'exportBody')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('disableCache', 1, $this->getLang('disableCache') . ':', 'disableCache')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('addParams', 1, $this->getLang('addParams') . ':', 'addParams', null, array_merge(array('checked' => $conf['userewrite'] != 1 ? 'checked' : '')))); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeListboxField('renderer', array_merge(array('', 'xhtml'), plugin_list('renderer')), '', $this->getLang('renderer') . ':', 'renderer', null, array_merge(array('class' => 'edit')))); $form->addElement(form_makeTag('br')); if ($templateSwitching) { $form->addElement(form_makeListboxField('template', $this->__getTemplates(), $conf['template'], $this->getLang('template') . ':', 'template', null, array_merge(array('class' => 'edit')))); $form->addElement(form_makeTag('br')); } else { $form->addElement(form_makeTag('br')); $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;'))); $form->addElement('Can\'t create preload file in \'inc\' directory. Template switching is not available. Plugin disabling is not available.'); $form->addElement(form_makeCloseTag('p')); } $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('pdfExport', 1, $this->getLang('pdfExport') . ':', 'pdfExport', null, $pdfExport ? array() : array_merge(array('disabled' => 'disabled')))); if (!$pdfExport) { $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;'))); $form->addElement('In order to use the PDF export, please '); $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:dw2pdf', 'alt' => 'install plugin', 'target' => '_blank'))); $form->addElement('install the dw2pdf plugin.'); $form->addElement(form_makeCloseTag('a')); $form->addElement(form_makeCloseTag('p')); } $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('usenumberedheading', 1, $this->getLang('usenumberedheading') . ':', 'usenumberedheading', null, $usenumberedheading && $pdfExport ? array() : array_merge(array('disabled' => 'disabled')))); $form->addElement(form_makeTag('br')); if (!$usenumberedheading) { $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;'))); $form->addElement('In order to use numbered headings, please '); $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:nodetailsxhtml', 'alt' => 'install plugin', 'target' => '_blank'))); $form->addElement('install the nodetailsxhtml plugin.'); $form->addElement(form_makeCloseTag('a')); $form->addElement(form_makeCloseTag('p')); } $form->endFieldset(); $form->addElement(form_makeTag('br')); $form->startFieldset($this->getLang('helpCreationOptions')); $form->addElement(form_makeCheckboxField('eclipseDocZip', 1, $this->getLang('eclipseDocZip') . ':', 'eclipseDocZip')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('JavaHelpDocZip', 1, $this->getLang('JavaHelpDocZip') . ':', 'JavaHelpDocZip')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('useTocFile', 1, $this->getLang('useTocFile') . ':', 'useTocFile')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeCheckboxField('emptyTocElem', 1, $this->getLang('emptyTocElem') . ':', 'emptyTocElem')); $form->addElement(form_makeTag('br')); if (!$translationAvailable) { $form->addElement(form_makeCheckboxField('TOCMapWithoutTranslation', 1, $this->getLang('TOCMapWithoutTranslation') . ':', 'TOCMapWithoutTranslation')); $form->addElement(form_makeTag('br')); } $form->endFieldset(); $form->addElement(form_makeTag('br')); if ($templateSwitching) { $form->startFieldset($this->getLang('disablePluginsOption')); $form->addElement(form_makeCheckboxField("disableall", 1, 'Disable All:', "disableall", 'forceVisible')); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTag('br')); list($allPlugins, $enabledPlugins) = $this->__getPluginList(); foreach ($allPlugins as $plugin) { $form->addElement(form_makeCheckboxField("disableplugin[]", $plugin, $plugin . ':', "disableplugin_{$plugin}", null, !in_array($plugin, $enabledPlugins) ? array('checked' => 'checked', 'disabled' => 'disabled') : array())); $form->addElement(form_makeTag('br')); } $form->endFieldset(); $form->addElement(form_makeTag('br')); } $form->startFieldset($this->getLang('customOptions')); $form->addElement(form_makeOpenTag('p')); $form->addElement($this->getLang('customOptionsDescription')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('ul', array('id' => 'siteexport__customActions'))); $form->addElement(form_makeCloseTag('ul')); $form->addElement(form_makeTag('br', array('class' => 'clear'))); $form->addElement(form_makeButton('submit', 'addoption', $this->getLang('addCustomOption'), array('style' => 'float:right;'))); $form->endFieldset(); $form->addElement(form_makeTag('br')); $form->startFieldset($this->getLang('startProcess')); $form->addElement(form_makeTextField('copyurl', "", $this->getLang('directDownloadLink') . ':', 'copyurl', null, array('readonly' => 'readonly'))); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTextField('wgeturl', "", $this->getLang('wgetURLLink') . ':', 'wgeturl', null, array('readonly' => 'readonly'))); $form->addElement(form_makeTag('br')); $form->addElement(form_makeTextField('curlurl', "", $this->getLang('curlURLLink') . ':', 'curlurl', null, array('readonly' => 'readonly'))); $form->addElement(form_makeTag('br', array('class' => 'clear'))); $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('start'), array('style' => 'float:right;'))); $form->endFieldset(); $form->addElement(form_makeTag('br')); $form->startFieldset($this->getLang('status')); $form->addElement(form_makeOpenTag('span', array('id' => 'siteexport__out'))); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'siteexport__throbber'))); $form->addElement(form_makeTag('img', array('src' => DOKU_BASE . 'lib/images/loading.gif', 'id' => 'siteexport__throbber'))); $form->addElement(form_makeCloseTag('span')); $form->endFieldset(); $form->addElement(form_makeTag('br')); if ($cronEnabled) { $form->startFieldset($this->getLang('cronSaveProcess')); $form->addElement(form_makeOpenTag('p')); $form->addElement($this->getLang('cronDescription')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeCheckboxField("cronOverwriteExisting", 1, $this->getLang('canOverwriteExisting'), "cronOverwriteExisting")); $form->addElement(form_makeTag('br', array('class' => 'clear'))); $form->addElement(form_makeButton('submit', 'cronDeleteAction', $this->getLang('cronDeleteAction'), array('id' => 'cronDeleteAction', 'style' => 'float:left;display:none'))); $form->addElement(form_makeButton('submit', 'cronSaveAction', $this->getLang('cronSaveAction'), array('id' => 'cronSaveAction', 'style' => 'float:right;'))); $form->addElement(form_makeTag('br', array('class' => 'clear'))); $form->addElement(form_makeOpenTag('a', array('href' => '#cronactions', 'alt' => 'show cron jobs', 'id' => 'showcronjobs', 'target' => '_blank', 'style' => 'float:right;'))); $form->addElement('show all cron jobs'); $form->addElement(form_makeCloseTag('a')); $form->endFieldset(); } $form->printForm(); }
/** * Displays the search form * * @author Michael Klier <*****@*****.**> */ function xhtml_search_form() { global $lang; ptln('<div class="level1">'); $blogs = $this->entryhelper->get_blogs(); $form = new Doku_Form(array('id' => 'blogtng__search_form')); $form->startFieldset($lang['btn_search']); $form->addHidden('page', 'blogtng'); $form->addHidden('btng[admin]', 'search'); $form->addElement(formSecurityToken()); $form->addElement(form_makeListBoxField('btng[query][blog]', $blogs, $_REQUEST['btng']['query']['blog'], $this->getLang('blog'))); $form->addElement(form_makeListBoxField('btng[query][filter]', array('entry_title', 'entry_author', 'comment', 'comment_ip', 'tags'), $_REQUEST['btng']['query']['filter'], $this->getLang('filter'))); $form->addElement(form_makeTextField('btng[query][string]', $_REQUEST['btng']['query']['string'], '')); $form->addElement(form_makeButton('submit', 'admin', $lang['btn_search'])); $form->endFieldset(); html_form('blogtng__search_form', $form); ptln('</div>'); }
function _html(&$renderer, $data) { global $ID; // set alignment $align = $data['opts']['align']; $hlp = plugin_load('helper', 'schulzevote'); # dbg($hlp); // check if the vote is over. $open = $data['opts']['date'] !== null && $data['opts']['date'] > time(); if ($open) { $renderer->info['cache'] = false; if (!isset($_SERVER['REMOTE_USER'])) { $open = false; $closemsg = $this->getLang('no_remote_user'); } elseif ($hlp->hasVoted()) { $open = false; $closemsg = $this->getLang('already_voted'); } $closemsg .= '<br />' . $this->_winnerMsg($hlp, 'leading'); } else { $closemsg = $this->getLang('vote_over') . '<br />' . $this->_winnerMsg($hlp, 'has_won'); } $ranks = array(); foreach ($hlp->getRanking() as $rank => $items) { foreach ($items as $item) { $ranks[$item] = '<span class="votebar" style="width: ' . 80 / ($rank + 1) . 'px"> </span>'; } } $form = new Doku_Form(array('id' => 'plugin__schulzevote', 'class' => 'plugin_schulzevote_' . $align)); $form->startFieldset($this->getLang('cast')); if ($open) { $form->addHidden('id', $ID); } $form->addElement('<table>'); foreach ($data['candy'] as $n => $candy) { $form->addElement('<tr>'); $form->addElement('<td>'); $form->addElement($this->_render($candy)); $form->addElement('</td>'); if ($open) { $form->addElement('<td>'); $form->addElement(form_makeTextField('vote[' . $n . ']', isset($_POST['vote']) ? $_POST['vote'][$n] : '', $this->_render($candy), '', 'block candy')); $form->addElement('</td>'); } $form->addElement('<td>'); $form->addElement($ranks[$candy]); $form->addElement('</td>'); $form->addElement('</tr>'); } $form->addElement('</table>'); if ($open) { $form->addElement('<p>' . $this->getLang('howto') . '</p>'); $form->addElement(form_makeButton('submit', '', 'Vote!')); $form->addElement($this->_winnerMsg($hlp, 'leading')); $form->addElement('</p>'); } else { $form->addElement('<p>' . $closemsg . '</p>'); } $form->endFieldset(); $renderer->doc .= $form->getForm(); return true; }
/** * 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>'; }
/** * Displays the Bookmanager - Let organize selections and export them * Only visible when a selection is loaded from the save selections or from cookie * * @param Doku_renderer_xhtml $renderer * @param bool $usercansave User has permissions to save the selection * @return bool false: empty cookie, true: selection found and bookmanager is rendered */ private function showBookManager($renderer, $usercansave) { global $ID; global $INPUT; $title = ''; // get a saved selection array from file $list = $_COOKIE['bookcreator']; // title $bookcreator_title = $INPUT->post->str('bookcreator_title'); if (!empty($bookcreator_title)) { $title = $bookcreator_title; } elseif (isset($_COOKIE['bookcreator_title'])) { $title = $_COOKIE['bookcreator_title']; } //start main container - open left column $renderer->doc .= "<div class='bookcreator__manager'><div class='bookcreator__pagelist' >"; // Display pagelists // - selected pages $this->showPagelist($renderer, $list, 'include'); $renderer->doc .= "<br />"; // - excluded pages $renderer->doc .= '<div id="bookcreator__delpglst">'; $this->showPagelist($renderer, $list, 'remove'); $renderer->doc .= '</div>'; // Reset current selection $form = new Doku_Form(array('method' => 'post', 'class' => 'clearactive')); $form->addElement(form_makeButton('submit', 'clearactiveselection', $this->getLang('reset'))); $renderer->doc .= "<div align='center'>"; $renderer->doc .= $form->getForm(); $renderer->doc .= "</div>"; //close left column - open right column $renderer->doc .= "</div>"; $renderer->doc .= "<div class='bookcreator__actions'>"; // PDF Export $values = array('export_html' => $this->getLang('exportprint')); $selected = 'export_html'; if (file_exists(DOKU_PLUGIN . "text/renderer.php") && !plugin_isdisabled("text")) { $values['export_text'] = $this->getLang('exporttext'); } if (file_exists(DOKU_PLUGIN . "odt/action/export.php") && !plugin_isdisabled("odt")) { $values['export_odtbook'] = $this->getLang('exportodt'); $selected = 'export_odtbook'; } if (file_exists(DOKU_PLUGIN . "dw2pdf/action.php") && !plugin_isdisabled("dw2pdf")) { $values['export_pdfbook'] = $this->getLang('exportpdf'); $selected = 'export_pdfbook'; } $form = new Doku_Form(array('method' => 'get')); $form->startFieldset($this->getLang('export')); $form->addElement($this->getLang('title') . " "); $form->addElement(form_makeTextField('book_title', $title, '', '', 'edit', array('size' => 40))); $form->addElement(form_makeListboxField('do', $values, $selected, '', '', '', array('size' => 1))); $form->addHidden('id', $ID); $form->addElement(form_makeButton('submit', '', $this->getLang('create'))); $form->endFieldset(); $renderer->doc .= $form->getForm(); // Save current selection to a wikipage if ($usercansave) { $form = new Doku_Form(array('method' => 'post')); $form->startFieldset($this->getLang('saveselection')); $form->addElement(form_makeTextField('bookcreator_title', $title, '', '', 'edit')); $form->addHidden('task', 'save'); $form->addElement(form_makeButton('submit', '', $this->getLang('save'))); $form->endFieldset(); $renderer->doc .= $form->getForm(); } //close containers $renderer->doc .= '</div>'; $renderer->doc .= "</div><div class='clearer'></div>"; $renderer->doc .= "<br />"; return true; }
/** * 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; }
/** * Add parsed element to Form which generates XHTML * * Outputs the represented field using the passed Doku_Form object. * Additional parameters (CSS class & HTML name) are passed in $params. * HTML output is created by passing the template $this->tpl to the simple * template engine _parse_tpl. * * @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); $form->addElement($this->_parse_tpl($this->tpl, $params)); }
function html() { global $ID; global $conf; echo $this->locale_xhtml('intro'); if (isset($_REQUEST['db']) && checkSecurityToken()) { echo '<h2>' . $this->getLang('db') . ' "' . hsc($_REQUEST['db']) . '"</h2>'; echo '<div class="level2">'; $sqlcommandform = true; /** @var $DBI helper_plugin_sqlite */ $DBI =& plugin_load('helper', 'sqlite'); if ($_REQUEST['version'] == 'sqlite2') { if (helper_plugin_sqlite_adapter::isSqlite3db($conf['metadir'] . '/' . $_REQUEST['db'] . '.sqlite')) { msg('This is a database in sqlite3 format.', 2); msg('This plugin needs your database file has the extension ".sqlite3" instead of ".sqlite" before it will be recognized as sqlite3 database.', 2); $form = new Doku_Form(array('method' => 'post')); $form->addHidden('page', 'sqlite'); $form->addHidden('sqlite_rename', 'go'); $form->addHidden('db', $_REQUEST['db']); $form->addElement(form_makeButton('submit', 'admin', sprintf($this->getLang('rename2to3'), hsc($_REQUEST['db'])))); $form->printForm(); if ($DBI->existsPDOSqlite()) { $sqlcommandform = false; } } else { if ($DBI->existsPDOSqlite()) { $sqlcommandform = false; msg('This is a database in sqlite2 format.', 2); if ($DBI->existsSqlite2()) { $form = new Doku_Form(array('method' => 'post')); $form->addHidden('page', 'sqlite'); $form->addHidden('sqlite_convert', 'go'); $form->addHidden('db', $_REQUEST['db']); $form->addElement(form_makeButton('submit', 'admin', sprintf($this->getLang('convert2to3'), hsc($_REQUEST['db'])))); $form->printForm(); } else { msg('Before PDO sqlite can handle this format, it needs a conversion to the sqlite3 format. Because PHP sqlite extension is not available, you should manually convert "' . hsc($_REQUEST['db']) . '.sqlite" in the meta directory to "' . hsc($_REQUEST['db']) . '.sqlite3".<br /> See for info about the conversion ' . $this->external_link('http://www.sqlite.org/version3.html') . '.', -1); } } } } else { if (!$DBI->existsPDOSqlite()) { $sqlcommandform = false; msg('A database in sqlite3 format needs the PHP PDO sqlite plugin.', -1); } } if ($sqlcommandform) { echo '<ul>'; echo '<li><div class="li"><a href="' . wl($ID, array('do' => 'admin', 'page' => 'sqlite', 'db' => $_REQUEST['db'], 'version' => $_REQUEST['version'], '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'], 'version' => $_REQUEST['version'], '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('class' => 'sqliteplugin')); $form->startFieldset('SQL Command'); $form->addHidden('id', $ID); $form->addHidden('do', 'admin'); $form->addHidden('page', 'sqlite'); $form->addHidden('db', $_REQUEST['db']); $form->addHidden('version', $_REQUEST['version']); $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']) { if (!$DBI->init($_REQUEST['db'], '')) { return; } $sql = $DBI->SQLstring2array($_REQUEST['sql']); foreach ($sql as $s) { $s = preg_replace('!^\\s*--.*$!m', '', $s); $s = trim($s); if (!$s) { continue; } $time_start = microtime(true); $res = $DBI->query("{$s};"); if ($res === false) { continue; } $result = $DBI->res2arr($res); $time_end = microtime(true); $time = $time_end - $time_start; $cnt = $DBI->res2count($res); msg($cnt . ' affected rows in ' . ($time < 0.0001 ? substr($time, 0, 5) . substr($time, -3) : substr($time, 0, 7)) . ' seconds', 1); if (!$cnt) { 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>'; } }
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(); }