Esempio n. 1
0
 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'));
 }
Esempio n. 2
0
 /**
  * output appropriate html
  */
 public function html()
 {
     global $lang;
     $helper = $this->loadHelper('loadskin', true);
     print '<div id="plugin__loadskin">';
     print $this->locale_xhtml('intro');
     $form = new Doku_Form(array());
     $form->startFieldSet('Add rule');
     $form->addHidden('id', $ID);
     $form->addHidden('do', 'admin');
     $form->addHidden('page', 'loadskin');
     $form->addHidden('act', 'add');
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeTextField('pattern', '', $this->getLang('pattern')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeOpenTag('p'));
     $form->addElement(form_makeListboxField('tpl', $helper->getTemplates(), '', $this->getLang('template')));
     $form->addElement(form_makeCloseTag('p'));
     $form->addElement(form_makeButton('submit', '', $lang['btn_save']));
     $form->endFieldSet();
     $form->printForm();
     if (@file_exists($this->config)) {
         $data = unserialize(io_readFile($this->config, false));
         if (!empty($data)) {
             echo '<table class="inline">' . DOKU_LF;
             echo '  <tr>' . DOKU_LF;
             echo '    <th>' . $this->getLang('pattern') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('template') . '</th>' . DOKU_LF;
             echo '    <th>' . $this->getLang('action') . '</th>' . DOKU_LF;
             echo '  </tr>' . DOKU_LF;
             foreach ($data as $key => $value) {
                 echo '  <tr>' . DOKU_LF;
                 echo '    <td>' . $key . '</td>' . DOKU_LF;
                 echo '    <td>' . $value . '</td>' . DOKU_LF;
                 echo '    <td>' . DOKU_LF;
                 $form = new Doku_Form(array());
                 $form->addHidden('do', 'admin');
                 $form->addHidden('page', 'loadskin');
                 $form->addHidden('act', 'del');
                 $form->addHidden('id', $ID);
                 $form->addHidden('pattern', $key);
                 $form->addElement(form_makeButton('submit', '', $lang['btn_delete']));
                 $form->printForm();
                 echo '    </td>' . DOKU_LF;
                 echo '  </tr>' . DOKU_LF;
             }
             echo '</table>' . DOKU_LF;
         }
     }
     print '</div>';
 }
Esempio n. 3
0
/**
 * This displays the edit form (lots of logic included)
 *
 * @fixme    this is a huge lump of code and should be modularized
 * @triggers HTML_PAGE_FROMTEMPLATE
 * @triggers HTML_EDITFORM_INJECTION
 * @author   Andreas Gohr <*****@*****.**>
 */
function html_edit($text = null, $include = 'edit')
{
    //FIXME: include needed?
    global $ID;
    global $REV;
    global $DATE;
    global $RANGE;
    global $PRE;
    global $SUF;
    global $INFO;
    global $SUM;
    global $lang;
    global $conf;
    global $license;
    //set summary default
    if (!$SUM) {
        if ($REV) {
            $SUM = $lang['restored'];
        } elseif (!$INFO['exists']) {
            $SUM = $lang['created'];
        }
    }
    //no text? Load it!
    if (!isset($text)) {
        $pr = false;
        //no preview mode
        if ($INFO['exists']) {
            if ($RANGE) {
                list($PRE, $text, $SUF) = rawWikiSlices($RANGE, $ID, $REV);
            } else {
                $text = rawWiki($ID, $REV);
            }
            $check = md5($text);
            $mod = false;
        } else {
            //try to load a pagetemplate
            $data = array($ID);
            $text = trigger_event('HTML_PAGE_FROMTEMPLATE', $data, 'pageTemplate', true);
            $check = md5('');
            $mod = $text !== '';
        }
    } else {
        $pr = true;
        //preview mode
        if (isset($_REQUEST['changecheck'])) {
            $check = $_REQUEST['changecheck'];
            $mod = md5($text) !== $check;
        } else {
            // Why? Assume default text is unmodified.
            $check = md5($text);
            $mod = false;
        }
    }
    $wr = $INFO['writable'] && !$INFO['locked'];
    if ($wr) {
        if ($REV) {
            print p_locale_xhtml('editrev');
        }
        print p_locale_xhtml($include);
    } else {
        // check pseudo action 'source'
        if (!actionOK('source')) {
            msg('Command disabled: source', -1);
            return;
        }
        print p_locale_xhtml('read');
    }
    if (!$DATE) {
        $DATE = $INFO['lastmod'];
    }
    ?>
  <div style="width:99%;">

   <div class="toolbar">
      <div id="draft__status"><?php 
    if (!empty($INFO['draft'])) {
        echo $lang['draftdate'] . ' ' . strftime($conf['dformat']);
    }
    ?>
</div>
      <div id="tool__bar"><?php 
    if ($wr) {
        ?>
<a href="<?php 
        echo DOKU_BASE;
        ?>
lib/exe/mediamanager.php?ns=<?php 
        echo $INFO['namespace'];
        ?>
"
      target="_blank"><?php 
        echo $lang['mediaselect'];
        ?>
</a><?php 
    }
    ?>
</div>

      <?php 
    if ($wr) {
        ?>
      <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--
        <?php 
        /* sets changed to true when previewed */
        ?>
        textChanged = <?php 
        $mod ? print 'true' : (print 'false');
        ?>
;
      //--><!]]></script>
      <span id="spell__action"></span>
      <div id="spell__suggest"></div>
      <?php 
    }
    ?>
   </div>
   <div id="spell__result"></div>
<?php 
    $form = new Doku_Form('dw__editform');
    $form->addHidden('id', $ID);
    $form->addHidden('rev', $REV);
    $form->addHidden('date', $DATE);
    $form->addHidden('prefix', $PRE);
    $form->addHidden('suffix', $SUF);
    $form->addHidden('changecheck', $check);
    $attr = array('tabindex' => '1');
    if (!$wr) {
        $attr['readonly'] = 'readonly';
    }
    $form->addElement(form_makeWikiText($text, $attr));
    $form->addElement(form_makeOpenTag('div', array('id' => 'wiki__editbar')));
    $form->addElement(form_makeOpenTag('div', array('id' => 'size__ctl')));
    $form->addElement(form_makeCloseTag('div'));
    if ($wr) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'editButtons')));
        $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id' => 'edbtn__save', 'accesskey' => 's', 'tabindex' => '4')));
        $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id' => 'edbtn__preview', 'accesskey' => 'p', 'tabindex' => '5')));
        $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex' => '6')));
        $form->addElement(form_makeCloseTag('div'));
        $form->addElement(form_makeOpenTag('div', array('class' => 'summary')));
        $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size' => '50', 'tabindex' => '2')));
        $elem = html_minoredit();
        if ($elem) {
            $form->addElement($elem);
        }
        $form->addElement(form_makeCloseTag('div'));
    }
    $form->addElement(form_makeCloseTag('div'));
    if ($conf['license']) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'license')));
        $out = $lang['licenseok'];
        $out .= '<a href="' . $license[$conf['license']]['url'] . '" rel="license" class="urlextern"';
        if ($conf['target']['external']) {
            $out .= ' target="' . $conf['target']['external'] . '"';
        }
        $out .= '> ' . $license[$conf['license']]['name'] . '</a>';
        $form->addElement($out);
        $form->addElement(form_makeCloseTag('div'));
    }
    html_form('edit', $form);
    print '</div>' . NL;
}
Esempio n. 4
0
 /**
  * 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;
 }
Esempio n. 5
0
/**
 * Print the search field form
 *
 * @author Tobias Sarnowski <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 */
function media_searchform($ns, $query = '', $fullscreen = false)
{
    global $lang;
    // The default HTML search form
    $params = array('id' => 'dw__mediasearch');
    if (!$fullscreen) {
        $params['action'] = DOKU_BASE . 'lib/exe/mediamanager.php';
    } else {
        $params['action'] = media_managerURL(array(), '&');
    }
    $form = new Doku_Form($params);
    $form->addHidden('ns', $ns);
    $form->addHidden($fullscreen ? 'mediado' : 'do', 'searchlist');
    if (!$fullscreen) {
        $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>' . NL);
    }
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*'))));
    $form->addElement(form_makeButton('submit', '', $lang['btn_search']));
    $form->addElement(form_makeCloseTag('p'));
    html_form('searchmedia', $form);
}
Esempio n. 6
0
 /**
  * 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();
 }
Esempio n. 7
0
/**
 * Print the search field form
 *
 * @author Tobias Sarnowski <*****@*****.**>
 */
function media_searchform($ns, $query = '')
{
    global $lang;
    // The default HTML search form
    $form = new Doku_Form(array('id' => 'dw__mediasearch', 'action' => DOKU_BASE . 'lib/exe/mediamanager.php'));
    $form->addElement('<div class="upload">' . $lang['mediasearch'] . '</div>');
    $form->addElement(formSecurityToken());
    $form->addHidden('ns', $ns);
    $form->addHidden('do', 'searchlist');
    $form->addElement(form_makeOpenTag('p'));
    $form->addElement(form_makeTextField('q', $query, $lang['searchmedia'], '', '', array('title' => sprintf($lang['searchmedia_in'], hsc($ns) . ':*'))));
    $form->addElement(form_makeButton('submit', '', $lang['btn_search']));
    $form->addElement(form_makeCloseTag('p'));
    html_form('searchmedia', $form);
}
Esempio n. 8
0
 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();
 }
Esempio n. 9
0
/**
 * Display size change
 *
 * @param int $sizechange - size of change in Bytes
 * @param Doku_Form $form - form to add elements to
 */
function html_sizechange($sizechange, Doku_Form $form)
{
    if (isset($sizechange)) {
        $class = 'sizechange';
        $value = filesize_h(abs($sizechange));
        if ($sizechange > 0) {
            $class .= ' positive';
            $value = '+' . $value;
        } elseif ($sizechange < 0) {
            $class .= ' negative';
            $value = '-' . $value;
        } else {
            $value = '±' . $value;
        }
        $form->addElement(form_makeOpenTag('span', array('class' => $class)));
        $form->addElement($value);
        $form->addElement(form_makeCloseTag('span'));
    }
}
Esempio n. 10
0
/**
 * 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('dw__upload', DOKU_BASE . 'lib/exe/mediamanager.php', false, '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'], 'O_ns' => ":{$ns}", 'O_backend' => 'mediamanager.php?' . session_name() . '=' . session_id(), 'O_size' => 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 
}
Esempio n. 11
0
 /**
  * Displays a form to create new entries
  */
 function xhtml_newform($conf)
 {
     global $ID;
     // allowed to create?
     if (!$this->toolshelper) {
         $this->toolshelper =& plugin_load('helper', 'blogtng_tools');
     }
     $new = $this->toolshelper->mkpostid($conf['format'], 'dummy');
     if (auth_quickaclcheck($new) < AUTH_CREATE) {
         return '';
     }
     $form = new Doku_Form($ID, wl($ID, array('do' => 'btngnew'), false, '&'));
     if ($conf['title']) {
         $form->addElement(form_makeOpenTag('h3'));
         $form->addElement(hsc($conf['title']));
         $form->addElement(form_makeCloseTag('h3'));
     }
     if (isset($conf['select'])) {
         $form->addElement(form_makeMenuField('btng[new][title]', array_filter(preg_split('/\\s*,\\s*/', $conf['select'])), '', $this->getLang('title'), 'btng__nt', 'edit'));
     } else {
         $form->addElement(form_makeTextField('btng[new][title]', '', $this->getLang('title'), 'btng__nt', 'edit'));
     }
     $form->addElement(form_makeButton('submit', null, $this->getLang('create')));
     $form->addHidden('btng[new][format]', hsc($conf['format']));
     $form->addHidden('btng[post][blog]', hsc($conf['blog'][0]));
     return '<div class="blogtng_newform">' . $form->getForm() . '</div>';
 }
Esempio n. 12
0
 /**
  * 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();
 }
Esempio n. 13
0
 /**
  * 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'));
 }
Esempio n. 14
0
/**
 * Display the default edit form
 *
 * Is the default action for HTML_EDIT_FORMSELECTION.
 *
 * @triggers HTML_EDITFORM_OUTPUT
 */
function html_edit_form($param)
{
    extract($param);
    global $conf;
    global $license;
    global $lang;
    global $REV;
    global $DATE;
    global $PRE;
    global $SUF;
    global $INFO;
    global $SUM;
    global $ID;
    ?>
            <?php 
    if ($wr) {
        ?>
                <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--
                    <?php 
        /* sets changed to true when previewed */
        ?>
                    textChanged = <?php 
        $mod ? print 'true' : (print 'false');
        ?>
;
                //--><!]]></script>
            <?php 
    }
    ?>
        <div style="width:99%;">

        <div class="toolbar">
        <div id="draft__status"><?php 
    if (!empty($INFO['draft'])) {
        echo $lang['draftdate'] . ' ' . dformat();
    }
    ?>
</div>
        <div id="tool__bar"><?php 
    if ($wr) {
        ?>
<a href="<?php 
        echo DOKU_BASE;
        ?>
lib/exe/mediamanager.php?ns=<?php 
        echo $INFO['namespace'];
        ?>
"
            target="_blank"><?php 
        echo $lang['mediaselect'];
        ?>
</a><?php 
    }
    ?>
</div>

        </div>
        <?php 
    $form = new Doku_Form(array('id' => 'dw__editform'));
    $form->addHidden('id', $ID);
    $form->addHidden('rev', $REV);
    $form->addHidden('date', $DATE);
    $form->addHidden('prefix', $PRE);
    $form->addHidden('suffix', $SUF);
    $form->addHidden('changecheck', $check);
    $attr = array('tabindex' => '1');
    if (!$wr) {
        $attr['readonly'] = 'readonly';
    }
    $form->addElement(form_makeWikiText($text, $attr));
    $form->addElement(form_makeOpenTag('div', array('id' => 'wiki__editbar')));
    $form->addElement(form_makeOpenTag('div', array('id' => 'size__ctl')));
    $form->addElement(form_makeCloseTag('div'));
    if ($wr) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'editButtons')));
        $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id' => 'edbtn__save', 'accesskey' => 's', 'tabindex' => '4')));
        $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id' => 'edbtn__preview', 'accesskey' => 'p', 'tabindex' => '5')));
        $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex' => '6')));
        $form->addElement(form_makeCloseTag('div'));
        $form->addElement(form_makeOpenTag('div', array('class' => 'summary')));
        $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size' => '50', 'tabindex' => '2')));
        $elem = html_minoredit();
        if ($elem) {
            $form->addElement($elem);
        }
        $form->addElement(form_makeCloseTag('div'));
    }
    $form->addElement(form_makeCloseTag('div'));
    if ($wr && $conf['license']) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'license')));
        $out = $lang['licenseok'];
        $out .= '<a href="' . $license[$conf['license']]['url'] . '" rel="license" class="urlextern"';
        if (isset($conf['target']['external'])) {
            $out .= ' target="' . $conf['target']['external'] . '"';
        }
        $out .= '> ' . $license[$conf['license']]['name'] . '</a>';
        $form->addElement($out);
        $form->addElement(form_makeCloseTag('div'));
    }
    html_form('edit', $form);
    print '</div>' . NL;
}
Esempio n. 15
0
/**
 * 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);
}
Esempio n. 16
0
 /**
  * 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());
 }
Esempio n. 17
0
/**
 * Preprocess edit form data
 *
 * @author   Andreas Gohr <*****@*****.**>
 *
 * @triggers HTML_EDITFORM_OUTPUT
 */
function html_edit()
{
    global $ID;
    global $REV;
    global $DATE;
    global $PRE;
    global $SUF;
    global $INFO;
    global $SUM;
    global $lang;
    global $conf;
    global $TEXT;
    global $RANGE;
    if (isset($_REQUEST['changecheck'])) {
        $check = $_REQUEST['changecheck'];
    } elseif (!$INFO['exists']) {
        // $TEXT has been loaded from page template
        $check = md5('');
    } else {
        $check = md5($TEXT);
    }
    $mod = md5($TEXT) !== $check;
    $wr = $INFO['writable'] && !$INFO['locked'];
    $include = 'edit';
    if ($wr) {
        if ($REV) {
            $include = 'editrev';
        }
    } else {
        // check pseudo action 'source'
        if (!actionOK('source')) {
            msg('Command disabled: source', -1);
            return;
        }
        $include = 'read';
    }
    global $license;
    $form = new Doku_Form(array('id' => 'dw__editform'));
    $form->addHidden('id', $ID);
    $form->addHidden('rev', $REV);
    $form->addHidden('date', $DATE);
    $form->addHidden('prefix', $PRE . '.');
    $form->addHidden('suffix', $SUF);
    $form->addHidden('changecheck', $check);
    $data = array('form' => $form, 'wr' => $wr, 'media_manager' => true, 'target' => isset($_REQUEST['target']) && $wr && $RANGE !== '' ? $_REQUEST['target'] : 'section', 'intro_locale' => $include);
    if ($data['target'] !== 'section') {
        // Only emit event if page is writable, section edit data is valid and
        // edit target is not section.
        trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true);
    } else {
        html_edit_form($data);
    }
    if (isset($data['intro_locale'])) {
        echo p_locale_xhtml($data['intro_locale']);
    }
    $form->addHidden('target', $data['target']);
    $form->addElement(form_makeOpenTag('div', array('id' => 'wiki__editbar')));
    $form->addElement(form_makeOpenTag('div', array('id' => 'size__ctl')));
    $form->addElement(form_makeCloseTag('div'));
    if ($wr) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'editButtons')));
        $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id' => 'edbtn__save', 'accesskey' => 's', 'tabindex' => '4')));
        $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id' => 'edbtn__preview', 'accesskey' => 'p', 'tabindex' => '5')));
        $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex' => '6')));
        $form->addElement(form_makeCloseTag('div'));
        $form->addElement(form_makeOpenTag('div', array('class' => 'summary')));
        $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size' => '50', 'tabindex' => '2')));
        $elem = html_minoredit();
        if ($elem) {
            $form->addElement($elem);
        }
        $form->addElement(form_makeCloseTag('div'));
    }
    $form->addElement(form_makeCloseTag('div'));
    if ($wr && $conf['license']) {
        $form->addElement(form_makeOpenTag('div', array('class' => 'license')));
        $out = $lang['licenseok'];
        $out .= ' <a href="' . $license[$conf['license']]['url'] . '" rel="license" class="urlextern"';
        if ($conf['target']['extern']) {
            $out .= ' target="' . $conf['target']['extern'] . '"';
        }
        $out .= '>' . $license[$conf['license']]['name'] . '</a>';
        $form->addElement($out);
        $form->addElement(form_makeCloseTag('div'));
    }
    if ($wr) {
        // sets changed to true when previewed
        echo '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--' . NL;
        echo 'textChanged = ' . ($mod ? 'true' : 'false');
        echo '//--><!]]></script>' . NL;
    }
    ?>
    <div style="width:99%;">

    <div class="toolbar">
    <div id="draft__status"><?php 
    if (!empty($INFO['draft'])) {
        echo $lang['draftdate'] . ' ' . dformat();
    }
    ?>
</div>
    <div id="tool__bar"><?php 
    if ($wr && $data['media_manager']) {
        ?>
<a href="<?php 
        echo DOKU_BASE;
        ?>
lib/exe/mediamanager.php?ns=<?php 
        echo $INFO['namespace'];
        ?>
"
        target="_blank"><?php 
        echo $lang['mediaselect'];
        ?>
</a><?php 
    }
    ?>
</div>

    </div>
    <?php 
    html_form('edit', $form);
    print '</div>' . NL;
}
Esempio n. 18
0
 /**
  * Displays a form to create new entries
  *
  * @param $conf
  * @return string
  */
 public function xhtml_newform($conf)
 {
     global $ID;
     // allowed to create?
     if (!$this->toolshelper) {
         $this->toolshelper = plugin_load('helper', 'blogtng_tools');
     }
     $new = $this->toolshelper->mkpostid($conf['format'], 'dummy');
     if (auth_quickaclcheck($new) < AUTH_CREATE) {
         return '';
     }
     $form = new Doku_Form($ID, wl($ID, array('do' => 'btngnew'), false, '&'));
     if ($conf['title']) {
         $form->addElement(form_makeOpenTag('h3'));
         $form->addElement(hsc($conf['title']));
         $form->addElement(form_makeCloseTag('h3'));
     }
     if (isset($conf['select'])) {
         $form->addElement(form_makeMenuField('btng[new][title]', helper_plugin_blogtng_tools::filterExplodeCSVinput($conf['select']), '', $this->getLang('title'), 'btng__nt', 'edit'));
     } else {
         $form->addElement(form_makeTextField('btng[new][title]', '', $this->getLang('title'), 'btng__nt', 'edit'));
     }
     if ($conf['tags']) {
         if ($conf['tags'][0] == '?') {
             $conf['tags'] = helper_plugin_blogtng_tools::filterExplodeCSVinput($this->getConf('default_tags'));
         }
         $form->addElement(form_makeTextField('btng[post][tags]', implode(', ', $conf['tags']), $this->getLang('tags'), 'btng__ntags', 'edit'));
     }
     if ($conf['type']) {
         if ($conf['type'][0] == '?') {
             $conf['type'] = $this->getConf('default_commentstatus');
         }
         $form->addElement(form_makeMenuField('btng[post][commentstatus]', array('enabled', 'closed', 'disabled'), $conf['type'], $this->getLang('commentstatus'), 'blogtng__ncommentstatus', 'edit'));
     }
     $form->addElement(form_makeButton('submit', null, $this->getLang('create')));
     $form->addHidden('btng[new][format]', hsc($conf['format']));
     $form->addHidden('btng[post][blog]', hsc($conf['blog'][0]));
     return '<div class="blogtng_newform">' . $form->getForm() . '</div>';
 }