/** * This user will need to interact with the QR code in order to configure GA. */ public function renderProfileForm() { global $conf, $USERINFO; $elements = array(); $ga = new PHPGangsta_GoogleAuthenticator(); if ($this->_settingExists("secret")) { // The user has a revokable GA secret. // Show the QR code so the user can add other devices. $mysecret = $this->_settingGet("secret"); $data = $this->generateQRCodeData($USERINFO['name'] . '@' . $conf['title'], $mysecret); $elements[] = '<figure><figcaption>' . $this->getLang('directions') . '</figcaption>'; $elements[] = '<img src="' . $data . '" alt="' . $this->getLang('directions') . '" />'; $elements[] = '</figure>'; // Check to see if the user needs to verify the code. if (!$this->_settingExists("verified")) { $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>'; $elements[] = form_makeTextField('googleauth_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); } // Show the option to revoke the GA secret. $elements[] = form_makeCheckboxField('googleauth_disable', '1', $this->getLang('killmodule'), '', 'block'); } else { // The user may opt in using GA. //Provide a checkbox to create a personal secret. $elements[] = form_makeCheckboxField('googleauth_enable', '1', $this->getLang('enablemodule'), '', 'block'); } return $elements; }
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>'; }
public function handle_html_editform_output(Doku_Event &$event, $param) { $pos = $event->data->findElementByAttribute('type', 'submit'); if (!$pos) { return; } // no submit button found, source view $pos -= 1; $event->data->insertElement($pos++, form_makeOpenTag('div', array())); $attrs = $_REQUEST['saveandedit'] ? array('checked' => 'checked') : array(); $event->data->insertElement($pos++, form_makeCheckboxField('saveandedit', '1', $this->getLang('btn_saveandedit'), '', '', $attrs)); $event->data->insertElement($pos++, form_makeCloseTag('div')); }
/** * This user will need to verify their email. */ public function renderProfileForm() { $elements = array(); // If email has not been verified, then do so here. if (!$this->attribute->exists("twofactoremail", "verified")) { // Render the HTML to prompt for the verification/activation OTP. $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>'; $elements[] = form_makeTextField('email_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); $elements[] = form_makeCheckboxField('email_send', '1', $this->getLang('resendcode'), '', 'block'); } else { // Render the element to remove email. $elements[] = form_makeCheckboxField('email_disable', '1', $this->getLang('killmodule'), '', 'block'); } return $elements; }
/** * 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->_settingGet("phone", ''); $elements[] = form_makeTextField('smsappliance_phone', $phone, $this->getLang('phone'), '', 'block', array('size' => '50')); // If the phone number has not been verified, then do so here. if ($phone) { if (!$this->_settingExists("verified")) { // Render the HTML to prompt for the verification/activation OTP. $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>'; $elements[] = form_makeTextField('smsappliance_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); $elements[] = form_makeCheckboxField('smsappliance_send', '1', $this->getLang('resendcode'), '', 'block'); } // Render the element to remove the phone since it exists. $elements[] = form_makeCheckboxField('smsappliance_disable', '1', $this->getLang('killmodule'), '', 'block'); } return $elements; }
/** * This user will need to verify their email. */ public function renderProfileForm() { $elements = array(); // Prompt for an email address. $email = $this->_settingGet("email"); $elements[] = form_makeTextField('altemail_email', $email, $this->getLang('email'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); // If email has not been verified, then do so here. if (!$this->_settingExists("verified") && $email) { // Render the HTML to prompt for the verification/activation OTP. $elements[] = '<span>' . $this->getLang('verifynotice') . '</span>'; $elements[] = form_makeTextField('altemail_verify', '', $this->getLang('verifymodule'), '', 'block', array('size' => '50', 'autocomplete' => 'off')); $elements[] = form_makeCheckboxField('altemail_send', '1', $this->getLang('resendcode'), '', 'block'); } if ($this->_settingExists("email")) { // Render the element to remove email. $elements[] = form_makeCheckboxField('altemail_disable', '1', $this->getLang('killmodule'), '', 'block'); } return $elements; }
/** * 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; }
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; }
/** * */ public function oauthConfirm($opt) { global $lang; global $conf; print '<h1>OAuth - Authorize Token</h1>' . NL; print '<div class="leftalign">' . NL; print '<p>A Consumer wants to make one or more requests on your behalf which requires your consent.<p>' . NL; print '</div>' . NL; print '<div class="centeralign">' . NL; $form = new Doku_Form('dw__oauth'); $form->startFieldset('Authorize Request Token'); # $form->addHidden('id', $ID); $form->addElement('<p>Your Username: '******'REMOTE_USER'] . '</p>'); $form->addHidden('dwoauthnonce', $opt['secpass']); $form->addElement('<div class="leftalign"><ul>'); $form->addElement('<li>Consumer-Key: ' . $opt['consumer_key'] . '</li>'); $form->addElement('<li><a href="?do[oauth]=cinfo&dwoauthnonce=' . rawurlencode($opt['secpass']) . '" alt="consumer info">Consumer Info</a></li>'); $form->addElement('<li>Token-Key: ' . $opt['token_key'] . '</li>'); $form->addElement('<li>Callback URL: ' . $opt['callback_url'] . '</li>'); $form->addElement('</ul></div>'); $form->addElement(form_makeCheckboxField('userconfirmed', '1', 'allow request', 'allow_this', 'simple')); $form->addElement(form_makeCheckboxField('trustconsumer', '1', 'always trust this consumer from now on', 'remember__me', 'simple')); $form->addElement(form_makeButton('submit', 'oauth', 'resume', array('title' => 'authorize'))); # $form->addElement(form_makeButton('submit', '', 'cancel')); $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; print '<div class="leftalign">' . NL; print '<p><b>small print</b></p>' . NL; print '<p>At this stage of prototying the dokuwiki OAuth plugin is not able to assure the Consumer’s true identity.</p>' . NL; print '<p>The request token you are about to authorize is valid only once: to get an access-token, the latter can be used to perform (multiple) requests using your account until it expires or you revoke it.<br/>' . NL; print 'A consumer may also forget the access-token and come back here every once in a while. Once consumer-verification is implemented and you have validated the consumer-information you may opt in to trust this consumer when you are logged in to dokuwiki to bypass this step by checking the "trust consumer" checkbox.</p>' . NL; print '</div>' . NL; }
function _renderReviews($id, $meta, $parid) { # Check for permission to write reviews $mod = canReview($id, $meta, $parid); # No reviews and no moderator privileges => no review block if (!$mod && empty($meta[$parid]['reviews'])) { return ''; } $ret = "<div class=\"dokutranslate_review\">\n"; $ret .= '<h5>' . $this->getLang('review_header') . "</h5>\n"; $ret .= "<table>\n"; $listbox = array(array('0', $this->getLang('trans_wrong')), array('1', $this->getLang('trans_rephrase')), array('2', $this->getLang('trans_accepted'))); # Prepare review form for current user if ($mod) { if (isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) { $myReview = $meta[$parid]['reviews'][$_SERVER['REMOTE_USER']]; } else { $myReview = array('message' => '', 'quality' => 0, 'incomplete' => false); } $form = new Doku_Form(array()); $form->addHidden('parid', strval($parid)); $form->addHidden('do', 'dokutranslate_review'); $form->addElement(form_makeTextField('review', $myReview['message'], $this->getLang('trans_message'), '', 'nowrap', array('size' => '50'))); $form->addElement(form_makeMenuField('quality', $listbox, strval($myReview['quality']), $this->getLang('trans_quality'), '', 'nowrap')); $args = array(); if ($myReview['incomplete']) { $args['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('incomplete', '1', $this->getLang('trans_incomplete'), '', 'nowrap', $args)); $form->addElement(form_makeButton('submit', '', $this->getLang('add_review'))); } # Display all reviews for this paragraph while (list($key, $value) = each($meta[$parid]['reviews'])) { $ret .= '<tr><td>' . hsc($key) . '</td><td>'; # Moderators can modify their own review if ($mod && $key == $_SERVER['REMOTE_USER']) { $ret .= $form->getForm(); } else { $ret .= '(' . $listbox[$value['quality']][1]; if ($value['incomplete']) { $ret .= ', ' . $this->getLang('rend_incomplete'); } $ret .= ') '; $ret .= hsc($value['message']); } $ret .= "</td></tr>\n"; } # Current user is a moderator who didn't write a review yet, # display the review form at the end if ($mod && !isset($meta[$parid]['reviews'][$_SERVER['REMOTE_USER']])) { if (empty($meta[$parid]['reviews'])) { $ret .= '<tr><td>'; } else { $ret .= '<tr><td colspan="2">'; } $ret .= $form->getForm(); $ret .= "</td></tr>\n"; } $ret .= "</table></div>\n"; return $ret; }
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())); }
/** * Return the search form for the namespace and the tag selection * * @return string the HTML code of the search form */ private function getForm() { global $conf, $lang; // Get the list of all namespaces for the dropdown $namespaces = array(); search($namespaces, $conf['datadir'], 'search_namespaces', array()); // build the list in the form value => label from the namespace search result $ns_select = array('' => ''); foreach ($namespaces as $ns) { // only display namespaces the user can access when sneaky index is on if ($ns['perm'] > 0 || $conf['sneaky_index'] == 0) { $ns_select[$ns['id']] = $ns['id']; } } $form = new Doku_Form(array('action' => '', 'method' => 'post', 'class' => 'plugin__tag_search')); // add a paragraph around the inputs in order to get some margin around the form elements $form->addElement(form_makeOpenTag('p')); // namespace select $form->addElement(form_makeMenuField('plugin__tag_search_namespace', $ns_select, $this->getNS(), $lang['namespaces'])); // checkbox for AND $attr = array(); if ($this->useAnd()) { $attr['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('plugin__tag_search_and', 1, $this->getLang('use_and'), '', '', $attr)); $form->addElement(form_makeCloseTag('p')); // load the tag list - only tags that actually have pages assigned that the current user can access are listed /* @var helper_plugin_tag $my */ if ($my =& plugin_load('helper', 'tag')) { $tags = $my->tagOccurrences(array(), NULL, true); } // sort tags by name ($tags is in the form $tag => $count) ksort($tags); // display error message when no tags were found if (!isset($tags) || $tags == NULL) { $form->addElement(form_makeOpenTag('p')); $form->addElement($this->getLang('no_tags')); $form->addElement(form_makeCloseTag('p')); } else { // the tags table $form->addElement(form_makeOpenTag('div', array('class' => 'table'))); $form->addElement(form_makeOpenTag('table', array('class' => 'inline'))); // print table header $form->addElement(form_makeOpenTag('tr')); $form->addElement(form_makeOpenTag('th')); $form->addElement($this->getLang('include')); $form->addElement(form_makeCloseTag('th')); $form->addElement(form_makeOpenTag('th')); $form->addElement($this->getLang('exclude')); $form->addElement(form_makeCloseTag('th')); $form->addElement(form_makeOpenTag('th')); $form->addElement($this->getLang('tags')); $form->addElement(form_makeCloseTag('th')); $form->addElement(form_makeCloseTag('tr')); // print tag checkboxes foreach ($tags as $tag => $count) { $form->addElement(form_makeOpenTag('tr')); $form->addElement(form_makeOpenTag('td')); $attr = array(); if ($this->isSelected($tag)) { $attr['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('plugin__tag_search_tags[]', $tag, '+', '', 'plus', $attr)); $form->addElement(form_makeCloseTag('td')); $form->addElement(form_makeOpenTag('td')); $attr = array(); if ($this->isSelected('-' . $tag)) { $attr['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('plugin__tag_search_tags[]', '-' . $tag, '-', '', 'minus', $attr)); $form->addElement(form_makeCloseTag('td')); $form->addElement(form_makeOpenTag('td')); $form->addElement(hsc($tag) . ' [' . $count . ']'); $form->addElement(form_makeCloseTag('td')); $form->addElement(form_makeCloseTag('tr')); } $form->addElement(form_makeCloseTag('table')); $form->addElement(form_makeCloseTag('div')); // submit button (doesn't use the button form element because it always submits an action which is not // recognized for $preact in inc/actions.php and thus always causes a redirect) $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTag('input', array('type' => 'submit', 'value' => $lang['btn_search']))); $form->addElement(form_makeCloseTag('p')); } return $form->getForm(); }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? // The default HTML upload form $form = new Doku_Form(array('id' => 'dw__upload', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php', 'enctype' => 'multipart/form-data')); $form->addElement('<div class="upload">' . $lang['mediaupload'] . '</div>'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); // prepare flashvars for multiupload $opt = array('L_gridname' => $lang['mu_gridname'], 'L_gridsize' => $lang['mu_gridsize'], 'L_gridstat' => $lang['mu_gridstat'], 'L_namespace' => $lang['mu_namespace'], 'L_overwrite' => $lang['txt_overwrt'], 'L_browse' => $lang['mu_browse'], 'L_upload' => $lang['btn_upload'], 'L_toobig' => $lang['mu_toobig'], 'L_ready' => $lang['mu_ready'], 'L_done' => $lang['mu_done'], 'L_fail' => $lang['mu_fail'], 'L_authfail' => $lang['mu_authfail'], 'L_progress' => $lang['mu_progress'], 'L_filetypes' => $lang['mu_filetypes'], 'L_info' => $lang['mu_info'], 'L_lasterr' => $lang['mu_lasterr'], 'O_ns' => ":{$ns}", 'O_backend' => 'mediamanager.php?' . session_name() . '=' . session_id(), 'O_maxsize' => php_to_byte(ini_get('upload_max_filesize')), 'O_extensions' => join('|', array_keys(getMimeTypes())), 'O_overwrite' => $auth >= AUTH_DELETE, 'O_sectok' => getSecurityToken(), 'O_authtok' => auth_createToken()); $var = buildURLparams($opt); // output the flash uploader ?> <div id="dw__flashupload" style="display:none"> <div class="upload"><?php echo $lang['mu_intro']; ?> </div> <?php echo html_flashobject('multipleUpload.swf', '500', '190', null, $opt); ?> </div> <?php }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> */ function media_uploadform($ns, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { return; } //fixme print info on missing permissions? print '<div class="upload">' . $lang['mediaupload'] . '</div>'; $form = new Doku_Form('dw__upload', DOKU_BASE . 'lib/exe/mediamanager.php', false, 'multipart/form-data'); $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'] . ':', 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('id', '', $lang['txt_filename'] . ':', 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= AUTH_DELETE) { $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check')); $form->addElement(form_makeCloseTag('p')); } html_form('upload', $form); }
/** * Adds a checkbox for minor edits for logged in users * * @author Andreas Gohr <*****@*****.**> */ function html_minoredit() { global $conf; global $lang; // minor edits are for logged in users only if (!$conf['useacl'] || !$_SERVER['REMOTE_USER']) { return false; } $p = array(); $p['tabindex'] = 3; if (!empty($_REQUEST['minor'])) { $p['checked'] = 'checked'; } return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p); }
/** * Print the media upload form if permissions are correct * * @author Andreas Gohr <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function media_uploadform($ns, $auth, $fullscreen = false) { global $lang; global $conf; global $INPUT; if ($auth < AUTH_UPLOAD) { echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL; return; } $auth_ow = $conf['mediarevisions'] ? AUTH_UPLOAD : AUTH_DELETE; $update = false; $id = ''; if ($auth >= $auth_ow && $fullscreen && $INPUT->str('mediado') == 'update') { $update = true; $id = cleanID($INPUT->str('image')); } // The default HTML upload form $params = array('id' => 'dw__upload', 'enctype' => 'multipart/form-data'); if (!$fullscreen) { $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php'; } else { $params['action'] = media_managerURL(array('tab_files' => 'files', 'tab_details' => 'view'), '&'); } $form = new Doku_Form($params); if (!$fullscreen) { echo '<div class="upload">' . $lang['mediaupload'] . '</div>'; } $form->addElement(formSecurityToken()); $form->addHidden('ns', hsc($ns)); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeFileField('upload', $lang['txt_upload'], 'upload__file')); $form->addElement(form_makeCloseTag('p')); $form->addElement(form_makeOpenTag('p')); $form->addElement(form_makeTextField('mediaid', noNS($id), $lang['txt_filename'], 'upload__name')); $form->addElement(form_makeButton('submit', '', $lang['btn_upload'])); $form->addElement(form_makeCloseTag('p')); if ($auth >= $auth_ow) { $form->addElement(form_makeOpenTag('p')); $attrs = array(); if ($update) { $attrs['checked'] = 'checked'; } $form->addElement(form_makeCheckboxField('ow', 1, $lang['txt_overwrt'], 'dw__ow', 'check', $attrs)); $form->addElement(form_makeCloseTag('p')); } echo NL . '<div id="mediamanager__uploader">' . NL; html_form('upload', $form); echo '</div>' . NL; echo '<p class="maxsize">'; printf($lang['maxuploadsize'], filesize_h(media_getuploadsize())); echo '</p>' . NL; }
/** * Add service selection to user profile * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_profileform(Doku_Event &$event, $param) { global $USERINFO; /** @var auth_plugin_authplain $auth */ global $auth; /** @var helper_plugin_oauth $hlp */ $hlp = plugin_load('helper', 'oauth'); /** @var Doku_Form $form */ $form =& $event->data; $pos = $form->findElementByAttribute('type', 'submit'); $services = $hlp->listServices(); if (!$services) { return; } $form->insertElement($pos, form_closefieldset()); $form->insertElement(++$pos, form_openfieldset(array('_legend' => $this->getLang('loginwith'), 'class' => 'plugin_oauth'))); foreach ($services as $service) { $group = $auth->cleanGroup($service); $elem = form_makeCheckboxField('oauth_group[' . $group . ']', 1, $service, '', 'simple', array('checked' => in_array($group, $USERINFO['grps']) ? 'checked' : '')); $form->insertElement(++$pos, $elem); } $form->insertElement(++$pos, form_closefieldset()); $form->insertElement(++$pos, form_openfieldset(array())); }
/** * 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(); }
/** * render the manage_files action * */ function render(&$event, $param) { global $ID; $perm = auth_quickaclcheck($ID); if ($event->data != 'manage_files') { return; } $event->preventDefault(); if ($perm < AUTH_READ) { echo '<h1>Error</h1><p>You do not have permission to view this page</p>'; return; } $project = Project::project(); if ($project == NULL) { echo '<h1>Error</h1>'; $project = getNS($ID); $path = explode(":", $project); if (!$project || $path[0] != PROJECTS_NAMESPACE) { echo "<p>Projects wiki has to work under the " . PROJECTS_NAMESPACE . " namespace</p>"; return; } $parent = getNS($project); if (!$parent) { echo "<p>The namespace " . PROJECTS_NAMESPACE . " has not been created yet!</p>"; return; } echo "<p>This project does not exist!</p>"; $name = noNS($parent); $link = DOKU_URL . "/doku.php?id={$parent}:{$name}&do=manage_files"; echo "<p>Go back to <a href=\"{$link}\">{$parent}</a>"; return; } echo '<h1>Manage Project ' . $project->name() . '</h1>'; $files = $project->files(); ksort($files); echo "<h1>Manage Files</h1>"; echo "<table>"; foreach (array(SOURCE, TARGET, CROSSLINK) as $type) { $count = 0; $utype = ucfirst($type); echo "<tr><td></td><td></td><td><h2>{$utype} Files</h2></td></tr>"; foreach ($files as $file) { if ($file->type() != $type) { continue; } echo "<tr>"; $name = $file->name(); echo "<td>"; if ($file->is_target() && $perm > AUTH_READ) { echo button_remake($project->id($name)); } echo "</td>"; echo "<td>"; if ($perm >= AUTH_DELETE) { echo button_delete($project->id($name)); } echo "</td>"; echo "<td>"; echo html_wikilink($project->id($name)); if ($project->error($name) != NULL) { echo "<img src=\"" . DOKU_URL . "/lib/images/error.png\"></img>"; } echo "</td>"; echo "</tr>"; $count++; } if ($count == 0) { echo "<tr><td></td><td></td><td>No {$type} files in this project</td></tr>"; } } $files = $project->subprojects(); if ($files) { sort($files); echo "<tr><td></td><td></td><td><h2>Subprojects</h2></td></tr>"; foreach ($files as $file) { $id = $project->name() . ":{$file}"; $link = DOKU_URL . "/doku.php?id={$id}:{$file}&do=manage_files"; echo "<tr><td></td><td></td><td>"; echo "<a href=\"{$link}\">{$file}</a>"; echo "</td>"; echo "</tr>"; } } echo "</table>"; $parent = $project->parent(); if ($parent != NULL) { echo "<h1>Parent project</h1>"; $name = $parent->name(); $file = end(explode(":", $name)); $link = DOKU_URL . "/doku.php?id={$name}:{$file}&do=manage_files"; echo "<a href=\"{$link}\">{$name}</a>"; } if ($perm <= AUTH_READ) { return; } echo "<p/><h1>Create Files</h1>"; $create = new Doku_Form("Create"); $create->addHidden("do", "create"); $create->addHidden("page", "projects_manage_files"); $create->addHidden("id", $ID); $create->startFieldSet('Create a new file'); $create->addElement(form_makeOpenTag("p")); $create->addElement(form_makeField('text', 'File name')); $create->addElement(form_makeCloseTag("p")); $create->addElement(form_makeOpenTag("p")); $create->addElement(form_makeRadioField('Type', SOURCE, "Source", "", "", array('checked' => "true"))); $create->addElement(form_makeRadioField('Type', TARGET, 'Generated')); $create->addElement(form_makeRadioField('Type', CROSSLINK, 'Crosslink')); $create->addElement(form_makeCloseTag("p")); $create->addElement(form_makeButton("submit", '', "Create")); $create->endFieldSet(); echo $create->getForm(); echo "<h1>Create subproject</h1>"; $subproject = new Doku_Form("Subproject"); $subproject->addHidden("do", "create_subproject"); $subproject->addHidden("page", "projects_manage_files"); $subproject->addHidden("id", $ID); $subproject->startFieldSet('Create a new subproject'); $subproject->addElement(form_makeOpenTag("p")); $subproject->addElement(form_makeField('text', 'Project name')); $subproject->addElement(form_makeCloseTag("p")); $subproject->addElement(form_makeButton("submit", '', "Create sub-project")); $subproject->endFieldSet(); echo $subproject->getForm(); echo "<h1>Clean up</h1>"; $clean = new Doku_Form("Clean"); $clean->addHidden("do", "clean"); $clean->addHidden("page", "projects_manage_files"); $clean->addHidden("id", $ID); $clean->startFieldSet('Clean the project'); $clean->addElement(form_makeCheckboxField("Recursive")); $clean->addElement(form_makeButton("submit", "", "Clean")); $clean->endFieldSet(); echo $clean->getForm(); if ($perm < AUTH_ADMIN) { return; } echo "<h1>Rebuild the project</h1>"; $rebuild = new Doku_Form("rebuild"); $rebuild->addHidden("do", "rebuild"); $rebuild->addHidden("page", "projects_manage_files"); $rebuild->addHidden("id", $ID); $rebuild->startFieldSet('Rebuild the project'); $rebuild->addElement(form_makeButton("submit", '', "Rebuild")); $rebuild->endFieldSet(); echo $rebuild->getForm(); }
/** * Handles HTML_EDITFORM_OUTPUT event. */ function handle_editform_output(&$event, $params) { global $ID; global $ACT; global $INFO; // Not in edit mode? Quit if ($ACT != 'edit' && $ACT != 'preview') { return; } // page not writable? Quit if (!$INFO['writable']) { return; } // if guests are not allowed to perform linkbacks, return if (!$this->getConf('allow_guests') && !$_SERVER['REMOTE_USER']) { return; } // get linkback meta file name $file = metaFN($ID, '.linkbacks'); $data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0); if (@file_exists($file)) { $data = unserialize(io_readFile($file, false)); } else { $namespace_conf = $this->getConf('enabled_namespaces'); if ($namespace_conf == '*') { $data['send'] = true; } else { $namespaces = explode(',', $namespace_conf); $ns = getNS($ID); foreach ($namespaces as $namespace) { if ($namespace == '') { continue; } else { if ($namespace == '*') { $data['send'] = true; break; } else { if (strstr($ns, $namespace) === $ns) { $data['send'] = true; break; } } } } } } $form = $event->data; $pos = $form->findElementById('wiki__editbar'); $form->insertElement($pos, form_makeOpenTag('div', array('id' => 'plugin__linkback_wrapper'))); $form->insertElement($pos + 1, form_makeCheckboxField('plugin__linkback_toggle', '1', $this->getLang('linkback_enabledisable'), 'plugin__linkback_toggle', 'edit', $data['send'] ? array('checked' => 'checked') : array())); $form->insertElement($pos + 2, form_makeCloseTag('div')); }
/** * Prints the comment form * * FIXME * allow comments only for registered users * add toolbar */ function tpl_form($page, $pid) { global $INFO; global $BLOGTNG; $form = new DOKU_Form('blogtng__comment_form', wl($page) . '#blogtng__comment_form'); $form->addHidden('pid', $pid); $form->addHidden('id', $page); $form->addHidden('btng[comment][source]', 'comment'); foreach (array('name', 'mail', 'web') as $field) { $attr = $BLOGTNG['comment_submit_errors'][$field] ? array('class' => 'edit error') : array(); if ($field == 'web' && !$this->getConf('comments_allow_web')) { continue; } else { $form->addElement(form_makeTextField('btng[comment][' . $field . ']', $BLOGTNG['comment'][$field], $this->getLang('comment_' . $field), 'blogtng__comment_' . $field, 'edit block', $attr)); } } $form->addElement(form_makeOpenTag('div', array('class' => 'blogtng__toolbar'))); $form->addElement(form_makeCloseTag('div')); if ($BLOGTNG['comment_submit_errors']['text']) { $form->addElement(form_makeWikiText($BLOGTNG['comment']['text'], array('class' => 'edit error'))); } else { $form->addElement(form_makeWikiText($BLOGTNG['comment']['text'])); } //add captcha if available $helper = null; if (@is_dir(DOKU_PLUGIN . 'captcha')) { $helper = plugin_load('helper', 'captcha'); } if (!is_null($helper) && $helper->isEnabled()) { $form->addElement($helper->getHTML()); } $form->addElement(form_makeButton('submit', 'comment_preview', $this->getLang('comment_preview'), array('class' => 'button', 'id' => 'blogtng__preview_submit'))); $form->addElement(form_makeButton('submit', 'comment_submit', $this->getLang('comment_submit'), array('class' => 'button', 'id' => 'blogtng__comment_submit'))); if ($this->getConf('comments_subscription')) { $form->addElement(form_makeCheckboxField('blogtng[subscribe]', 1, $this->getLang('comment_subscribe'))); } print '<div id="blogtng__comment_form_wrap">' . DOKU_LF; $form->printForm(); if (isset($BLOGTNG['comment_action']) && $BLOGTNG['comment_action'] == 'preview' && empty($BLOGTNG['comment_submit_errors'])) { print '<div id="blogtng__comment_preview">' . DOKU_LF; $comment = new blogtng_comment(); $comment->data = $BLOGTNG['comment']; $comment->data['cid'] = 'preview'; $comment->output('default'); print '</div>' . DOKU_LF; } print '</div>' . DOKU_LF; }
/** * Adds additional fields of used by the BlogTNG plugin to the editor. */ function handle_editform_output(&$event, $param) { global $ID; $pos = $event->data->findElementByAttribute('type', 'submit'); if (!$pos) { return; } // no submit button found, source view $pos -= 1; $pid = md5($ID); $this->entryhelper->load_by_pid($pid); $blog = $this->tools->getParam('post/blog'); if (!$blog) { $blog = $this->entryhelper->get_blog(); } $blogs = $this->entryhelper->get_blogs(); $event->data->insertElement($pos, form_openfieldset(array('_legend' => 'BlogTNG', 'class' => 'edit', 'id' => 'blogtng__edit'))); $pos += 1; $event->data->insertElement($pos, form_makeMenuField('btng[post][blog]', $blogs, $blog, 'Blog', 'blogtng__blog', 'edit')); $pos += 1; $this->taghelper->load($pid); $allowed_tags = $this->_get_allowed_tags(); $tags = $this->_get_post_tags(); if (!$tags) { $tags = $this->taghelper->tags; } if (count($allowed_tags) > 0) { $event->data->insertElement($pos++, form_makeOpenTag('div')); foreach ($this->_get_allowed_tags() as $val) { $data = array('style' => 'margin-top: 0.3em;'); if (in_array($val, $tags)) { $data['checked'] = 'checked'; } $event->data->insertElement($pos++, form_makeCheckboxField('btng[post][tags][]', $val, $val, '', '', $data)); } $event->data->insertElement($pos++, form_makeCloseTag('div')); } else { $event->data->insertElement($pos, form_makeTextField('btng[post][tags]', join(', ', $tags), 'Tags', 'blogtng__tags', 'edit')); $pos += 1; } if ($this->getConf('editform_set_date')) { $postdate = $this->tools->getParam('post/date'); if ($postdate) { $YY = $postdate['YY']; $MM = $postdate['MM']; $DD = $postdate['DD']; $hh = $postdate['hh']; $mm = $postdate['mm']; } else { $created = $this->entryhelper->entry['created']; if ($created) { $YY = strftime('%Y', $created); $MM = strftime('%m', $created); $DD = strftime('%d', $created); $hh = strftime('%H', $created); $mm = strftime('%M', $created); } else { $time = mktime(); $YY = strftime('%Y', $time); $MM = strftime('%m', $time); $DD = strftime('%d', $time); $hh = strftime('%H', $time); $mm = strftime('%M', $time); } } $event->data->insertElement($pos, form_makeTextField('btng[post][date][YY]', $YY, 'YYYY', 'blogtng__date_YY', 'edit', array('maxlength' => 4))); $pos += 1; $event->data->insertElement($pos, form_makeTextField('btng[post][date][MM]', $MM, 'MM', 'blogtng__date_MM', 'edit', array('maxlength' => 2))); $pos += 1; $event->data->insertElement($pos, form_makeTextField('btng[post][date][DD]', $DD, 'DD', 'blogtng__date_DD', 'edit', array('maxlength' => 2))); $pos += 1; $event->data->insertElement($pos, form_makeTextField('btng[post][date][hh]', $hh, 'hh', 'blogtng__date_hh', 'edit', array('maxlength' => 2))); $pos += 1; $event->data->insertElement($pos, form_makeTextField('btng[post][date][mm]', $mm, 'mm', 'blogtng__date_mm', 'edit', array('maxlength' => 2))); $pos += 1; } $event->data->insertElement($pos, form_makeMenuField('btng[post][commentstatus]', array('enabled', 'closed', 'disabled'), $this->entryhelper->entry['commentstatus'], $this->getLang('commentstatus'), 'blogtng__commentstatus', 'edit')); $pos += 1; $event->data->insertElement($pos, form_closefieldset()); }
public function handle_html_editform_output(Doku_Event &$event, $param) { global $ID; if (!@file_exists(metaFN($ID, '.translate'))) { # Check permissions to begin translation if (!isModerator($ID)) { return; } # No submit button => preview, don't modify the form if (!$event->data->findElementByAttribute('type', 'submit')) { return; } # Place the checkbox after minor edit checkbox or # summary text box if minor edit checkbox is not present $pos = $event->data->findElementByAttribute('name', 'minor'); if (!$pos) { $pos = $event->data->findElementByAttribute('name', 'summary'); } # Create the checkbox $p = array('tabindex' => 4); if (!empty($_REQUEST['translate'])) { $p['checked'] = 'checked'; } $elem = form_makeCheckboxField('translate', '1', $this->lang['translate_begin'], 'translate_begin', 'nowrap', $p); # Insert checkbox into the form $event->data->insertElement(++$pos, $elem); } else { # Translation in progress, add paragraph ID to the form $event->data->addHidden('parid', strval(getParID())); } }
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(); }
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(); }
/** * 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(); }