/** * 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; }
/** * 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>'; }
/** * This user will need to supply a phone number and their cell provider. */ public function renderProfileForm() { $elements = array(); // Provide an input for the phone number. $phone = $this->attribute->exists("twofactor", "phone") ? $this->attribute->get("twofactor", "phone") : ''; $elements['phone'] = form_makeTextField('phone', $phone, $this->_getSharedLang('phone'), '', 'block', array('size' => '50')); $providers = array_keys($this->_getProviders()); $provider = $this->attribute->exists("twofactorsmsgateway", "provider") ? $this->attribute->get("twofactorsmsgateway", "provider") : $providers[0]; $elements[] = form_makeListboxField('smsgateway_provider', $providers, $provider, $this->getLang('provider'), '', 'block'); // If the phone number has not been verified, then do so here. if ($phone) { if (!$this->attribute->exists("twofactorsmsgateway", "verified")) { // Render the HTML to prompt for the verification/activation OTP. $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>'; $elements[] = form_makeTextField('smsgateway_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); $elements[] = form_makeCheckboxField('smsgateway_send', '1', $this->getLang('resendcode'), '', 'block'); } // Render the element to remove the phone since it exists. $elements[] = form_makeCheckboxField('smsgateway_disable', '1', $this->getLang('killmodule'), '', 'block'); } return $elements; }
function _editData($data, &$renderer) { $renderer->form->startFieldset($this->getLang('dataentry')); $renderer->form->_content[count($renderer->form->_content) - 1]['class'] = 'plugin__data'; if ($this->getConf('edit_content_only')) { $renderer->form->addHidden('data_edit[classes]', $data['classes']); $renderer->form->addElement('<table>'); } else { $renderer->form->addElement(form_makeField('text', 'data_edit[classes]', $data['classes'], $this->getLang('class'), 'data__classes')); $renderer->form->addElement('<table>'); $text = '<tr>'; foreach (array('title', 'type', 'multi', 'value', 'comment') as $val) { $text .= '<th>' . $this->getLang($val) . '</th>'; } $renderer->form->addElement($text . '</tr>'); // New line $data['data'][''] = ''; $data['cols'][''] = array('type' => '', 'multi' => false); } $n = 0; foreach ($data['cols'] as $key => $vals) { $fieldid = 'data_edit[data][' . $n++ . ']'; $content = $vals['multi'] ? implode(', ', $data['data'][$key]) : $data['data'][$key]; if (is_array($vals['type'])) { $vals['basetype'] = $vals['type']['type']; if (isset($vals['type']['enum'])) { $vals['enum'] = $vals['type']['enum']; } $vals['type'] = $vals['origtype']; } else { $vals['basetype'] = $vals['type']; } $renderer->form->addElement('<tr>'); if ($this->getConf('edit_content_only')) { if (isset($vals['enum'])) { $values = preg_split('/\\s*,\\s*/', $vals['enum']); if (!$vals['multi']) { array_unshift($values, ''); } $content = form_makeListboxField($fieldid . '[value][]', $values, $data['data'][$key], $vals['title'], '', '', $vals['multi'] ? array('multiple' => 'multiple') : array()); } else { $classes = 'data_type_' . $vals['type'] . ($vals['multi'] ? 's' : '') . ' ' . 'data_type_' . $vals['basetype'] . ($vals['multi'] ? 's' : ''); $attr = array(); if ($vals['basetype'] == 'date' && !$vals['multi']) { $attr['class'] = 'datepicker'; } $content = form_makeField('text', $fieldid . '[value]', $content, $vals['title'], '', $classes, $attr); } $cells = array($vals['title'] . ':', $content, $vals['comment']); foreach (array('title', 'multi', 'comment', 'type') as $field) { $renderer->form->addHidden($fieldid . "[{$field}]", $vals[$field]); } } else { $check_data = $vals['multi'] ? array('checked' => 'checked') : array(); $cells = array(form_makeField('text', $fieldid . '[title]', $vals['title'], $this->getLang('title')), form_makeMenuField($fieldid . '[type]', array_merge(array('', 'page', 'nspage', 'title', 'img', 'mail', 'url', 'tag', 'wiki', 'dt'), array_keys($this->dthlp->_aliases())), $vals['type'], $this->getLang('type')), form_makeCheckboxField($fieldid . '[multi]', array('1', ''), $this->getLang('multi'), '', '', $check_data), form_makeField('text', $fieldid . '[value]', $content, $this->getLang('value')), form_makeField('text', $fieldid . '[comment]', $vals['comment'], $this->getLang('comment'), '', 'data_comment', array('readonly' => 1))); } foreach ($cells as $cell) { $renderer->form->addElement('<td>'); $renderer->form->addElement($cell); $renderer->form->addElement('</td>'); } $renderer->form->addElement('</tr>'); } $renderer->form->addElement('</table>'); $renderer->form->endFieldset(); }
/** * show diff * * @author Andreas Gohr <*****@*****.**> * @param string $text - compare with this text with most current version * @param bool $intr - display the intro text */ function html_diff($text = '', $intro = true, $type = null) { global $ID; global $REV; global $lang; global $conf; if (!$type) { $type = $_REQUEST['difftype']; } if ($type != 'inline') { $type = 'sidebyside'; } // 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; if (is_array($_REQUEST['rev2'])) { $rev1 = (int) $_REQUEST['rev2'][0]; $rev2 = (int) $_REQUEST['rev2'][1]; if (!$rev1) { $rev1 = $rev2; unset($rev2); } } else { $rev2 = (int) $_REQUEST['rev2']; } $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 && $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 = getRevisions($ID, 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); } $df = new Diff(explode("\n", htmlspecialchars($l_text)), explode("\n", htmlspecialchars($r_text))); if ($type == 'inline') { $tdf = new InlineDiffFormatter(); } else { $tdf = new TableDiffFormatter(); } if ($intro) { print p_locale_xhtml('diff'); } if (!$text) { ptln('<div class="diffoptions">'); $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('sidebyside' => $lang['diff_side'], 'inline' => $lang['diff_inline']), $type, $lang['diff_type'], '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'diff', 'Go')); $form->printForm(); $diffurl = wl($ID, array('do' => 'diff', 'rev2[0]' => $l_rev, 'rev2[1]' => $r_rev, 'difftype' => $type)); ptln('<p><a class="wikilink1" href="' . $diffurl . '">' . $lang['difflink'] . '</a></p>'); ptln('</div>'); } ?> <table class="diff diff_<?php echo $type; ?> "> <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 echo $tdf->format($df); ?> </table> <?php }
/** * Create html for revision navigation * * @param PageChangeLog $pagelog changelog object of current page * @param string $type inline vs sidebyside * @param int $l_rev left revision timestamp * @param int $r_rev right revision timestamp * @return string[] html of left and right navigation elements */ function html_diff_navigation($pagelog, $type, $l_rev, $r_rev) { global $INFO, $ID; // last timestamp is not in changelog, retrieve timestamp from metadata // note: when page is removed, the metadata timestamp is zero if (!$r_rev) { if (isset($INFO['meta']['last_change']['date'])) { $r_rev = $INFO['meta']['last_change']['date']; } else { $r_rev = 0; } } //retrieve revisions with additional info list($l_revs, $r_revs) = $pagelog->getRevisionsAround($l_rev, $r_rev); $l_revisions = array(); if (!$l_rev) { $l_revisions[0] = array(0, "", false); //no left revision given, add dummy } foreach ($l_revs as $rev) { $info = $pagelog->getRevisionInfo($rev); $l_revisions[$rev] = array($rev, dformat($info['date']) . ' ' . editorinfo($info['user'], true) . ' ' . $info['sum'], $r_rev ? $rev >= $r_rev : false); } $r_revisions = array(); if (!$r_rev) { $r_revisions[0] = array(0, "", false); //no right revision given, add dummy } foreach ($r_revs as $rev) { $info = $pagelog->getRevisionInfo($rev); $r_revisions[$rev] = array($rev, dformat($info['date']) . ' ' . editorinfo($info['user'], true) . ' ' . $info['sum'], $rev <= $l_rev); } //determine previous/next revisions $l_index = array_search($l_rev, $l_revs); $l_prev = $l_revs[$l_index + 1]; $l_next = $l_revs[$l_index - 1]; if ($r_rev) { $r_index = array_search($r_rev, $r_revs); $r_prev = $r_revs[$r_index + 1]; $r_next = $r_revs[$r_index - 1]; } else { //removed page if ($l_next) { $r_prev = $r_revs[0]; } else { $r_prev = null; } $r_next = null; } /* * Left side: */ $l_nav = ''; //move back if ($l_prev) { $l_nav .= html_diff_navigationlink($type, 'diffbothprevrev', $l_prev, $r_prev); $l_nav .= html_diff_navigationlink($type, 'diffprevrev', $l_prev, $r_rev); } //dropdown $form = new Doku_Form(array('action' => wl())); $form->addHidden('id', $ID); $form->addHidden('difftype', $type); $form->addHidden('rev2[1]', $r_rev); $form->addHidden('do', 'diff'); $form->addElement(form_makeListboxField('rev2[0]', $l_revisions, $l_rev, '', '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'diff', 'Go')); $l_nav .= $form->getForm(); //move forward if ($l_next && ($l_next < $r_rev || !$r_rev)) { $l_nav .= html_diff_navigationlink($type, 'diffnextrev', $l_next, $r_rev); } /* * Right side: */ $r_nav = ''; //move back if ($l_rev < $r_prev) { $r_nav .= html_diff_navigationlink($type, 'diffprevrev', $l_rev, $r_prev); } //dropdown $form = new Doku_Form(array('action' => wl())); $form->addHidden('id', $ID); $form->addHidden('rev2[0]', $l_rev); $form->addHidden('difftype', $type); $form->addHidden('do', 'diff'); $form->addElement(form_makeListboxField('rev2[1]', $r_revisions, $r_rev, '', '', '', array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'diff', 'Go')); $r_nav .= $form->getForm(); //move forward if ($r_next) { if ($pagelog->isCurrentRevision($r_next)) { $r_nav .= html_diff_navigationlink($type, 'difflastrev', $l_rev); //last revision is diff with current page } else { $r_nav .= html_diff_navigationlink($type, 'diffnextrev', $l_rev, $r_next); } $r_nav .= html_diff_navigationlink($type, 'diffbothnextrev', $l_next, $r_next); } return array($l_nav, $r_nav); }
/** * * 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 }
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(); }
/** * The custom editor for editing data entries * * Gets called from action_plugin_data::_editform() where also the form member is attached * * @param array $data * @param Doku_Renderer_plugin_data_edit $renderer */ function _editData($data, &$renderer) { $renderer->form->startFieldset($this->getLang('dataentry')); $renderer->form->_content[count($renderer->form->_content) - 1]['class'] = 'plugin__data'; $renderer->form->addHidden('range', '0-0'); // Adora Belle bugfix if ($this->getConf('edit_content_only')) { $renderer->form->addHidden('data_edit[classes]', $data['classes']); $columns = array('title', 'value', 'comment'); $class = 'edit_content_only'; } else { $renderer->form->addElement(form_makeField('text', 'data_edit[classes]', $data['classes'], $this->getLang('class'), 'data__classes')); $columns = array('title', 'type', 'multi', 'value', 'comment'); $class = 'edit_all_content'; // New line $data['data'][''] = ''; $data['cols'][''] = array('type' => '', 'multi' => false); } $renderer->form->addElement("<table class=\"{$class}\">"); //header $header = '<tr>'; foreach ($columns as $column) { $header .= '<th class="' . $column . '">' . $this->getLang($column) . '</th>'; } $header .= '</tr>'; $renderer->form->addElement($header); //rows $n = 0; foreach ($data['cols'] as $key => $vals) { $fieldid = 'data_edit[data][' . $n++ . ']'; $content = $vals['multi'] ? implode(', ', $data['data'][$key]) : $data['data'][$key]; if (is_array($vals['type'])) { $vals['basetype'] = $vals['type']['type']; if (isset($vals['type']['enum'])) { $vals['enum'] = $vals['type']['enum']; } $vals['type'] = $vals['origtype']; } else { $vals['basetype'] = $vals['type']; } if ($vals['type'] === 'hidden') { $renderer->form->addElement('<tr class="hidden">'); } else { $renderer->form->addElement('<tr>'); } if ($this->getConf('edit_content_only')) { if (isset($vals['enum'])) { $values = preg_split('/\\s*,\\s*/', $vals['enum']); if (!$vals['multi']) { array_unshift($values, ''); } $content = form_makeListboxField($fieldid . '[value][]', $values, $data['data'][$key], $vals['title'], '', '', $vals['multi'] ? array('multiple' => 'multiple') : array()); } else { $classes = 'data_type_' . $vals['type'] . ($vals['multi'] ? 's' : '') . ' ' . 'data_type_' . $vals['basetype'] . ($vals['multi'] ? 's' : ''); $attr = array(); if ($vals['basetype'] == 'date' && !$vals['multi']) { $attr['class'] = 'datepicker'; } $content = form_makeField('text', $fieldid . '[value]', $content, $vals['title'], '', $classes, $attr); } $cells = array(hsc($vals['title']) . ':', $content, '<span title="' . hsc($vals['comment']) . '">' . hsc($vals['comment']) . '</span>'); foreach (array('multi', 'comment', 'type') as $field) { $renderer->form->addHidden($fieldid . "[{$field}]", $vals[$field]); } $renderer->form->addHidden($fieldid . "[title]", $vals['origkey']); //keep key as key, even if title is translated } else { $check_data = $vals['multi'] ? array('checked' => 'checked') : array(); $cells = array(form_makeField('text', $fieldid . '[title]', $vals['origkey'], $this->getLang('title')), form_makeMenuField($fieldid . '[type]', array_merge(array('', 'page', 'nspage', 'title', 'img', 'mail', 'url', 'tag', 'wiki', 'dt', 'hidden'), array_keys($this->dthlp->_aliases())), $vals['type'], $this->getLang('type')), form_makeCheckboxField($fieldid . '[multi]', array('1', ''), $this->getLang('multi'), '', '', $check_data), form_makeField('text', $fieldid . '[value]', $content, $this->getLang('value')), form_makeField('text', $fieldid . '[comment]', $vals['comment'], $this->getLang('comment'), '', 'data_comment', array('readonly' => 1, 'title' => $vals['comment']))); } foreach ($cells as $index => $cell) { $renderer->form->addElement("<td class=\"{$columns[$index]}\">"); $renderer->form->addElement($cell); $renderer->form->addElement('</td>'); } $renderer->form->addElement('</tr>'); } $renderer->form->addElement('</table>'); $renderer->form->endFieldset(); }
/** * 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; }
/** * Shows a domain selection in the login form when more than one domain is configured * * @param Doku_Event $event * @param array $param */ public function handle_html_loginform_output(Doku_Event &$event, $param) { global $INPUT; /** @var auth_plugin_authad $auth */ global $auth; if (!is_a($auth, 'auth_plugin_authad')) { return; } // AD not even used $domains = $auth->_getConfiguredDomains(); if (count($domains) <= 1) { return; } // no choice at all /** @var Doku_Form $form */ $form =& $event->data; // any default? $dom = ''; if ($INPUT->has('u')) { $usr = $auth->cleanUser($INPUT->str('u')); $dom = $auth->_userDomain($usr); // update user field value if ($dom) { $usr = $auth->_userName($usr); $pos = $form->findElementByAttribute('name', 'u'); $ele =& $form->getElementAt($pos); $ele['value'] = $usr; } } // add select box $element = form_makeListboxField('dom', $domains, $dom, $this->getLang('domain'), '', 'block'); $pos = $form->findElementByAttribute('name', 'p'); $form->insertElement($pos + 1, $element); }