[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Ui/ -> PageDraft.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\Ui;
   4  
   5  use dokuwiki\Form\Form;
   6  
   7  /**
   8   * DokuWiki Page Draft Interface
   9   *
  10   * @package dokuwiki\Ui
  11   */
  12  class PageDraft extends Ui
  13  {
  14      /**
  15       * Display the Page Draft Form
  16       * ask the user about how to handle an exisiting draft
  17       *
  18       * @author   Andreas Gohr <andi@splitbrain.org>
  19       *
  20       * @return void
  21       */
  22      public function show()
  23      {
  24          global $INFO;
  25          global $ID;
  26          global $lang;
  27  
  28          $draft = new \dokuwiki\Draft($ID, $INFO['client']);
  29          $text  = $draft->getDraftText();
  30  
  31          // print intro
  32          print p_locale_xhtml('draft');
  33  
  34          (new Diff($text, false))->show();
  35  
  36          // create the draft form
  37          $form = new Form(['id' => 'dw__editform']);
  38          $form->addTagOpen('div')->addClass('no');
  39          $form->setHiddenField('id', $ID);
  40          $form->setHiddenField('date', $draft->getDraftDate());
  41          $form->setHiddenField('wikitext', $text);
  42  
  43          $form->addTagOpen('div')->id('draft__status');
  44          $form->addHTML($draft->getDraftMessage());
  45          $form->addTagClose('div');
  46          $form->addButton('do[recover]',  $lang['btn_recover'] )->attrs(['type' => 'submit', 'tabindex' => '1']);
  47          $form->addButton('do[draftdel]', $lang['btn_draftdel'])->attrs(['type' => 'submit', 'tabindex' => '2']);
  48          $form->addButton('do[show]',     $lang['btn_cancel']  )->attrs(['type' => 'submit', 'tabindex' => '3']);
  49          $form->addTagClose('div');
  50  
  51          print $form->toHTML('Draft');
  52      }
  53  
  54  }