1<?php 2 3namespace dokuwiki\Ui; 4 5use dokuwiki\Form\Form; 6 7/** 8 * DokuWiki Page Draft Interface 9 * 10 * @package dokuwiki\Ui 11 */ 12class 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 $lang; 26 27 $draft = new \dokuwiki\Draft($ID, $INFO['client']); 28 $text = $draft->getDraftText(); 29 30 // print intro 31 print p_locale_xhtml('draft'); 32 33 (new PageDiff($INFO['id'], $text))->preference('showIntro', false)->show(); 34 35 // create the draft form 36 $form = new Form(['id' => 'dw__editform']); 37 $form->addTagOpen('div')->addClass('no'); 38 $form->setHiddenField('id', $INFO['id']); 39 $form->setHiddenField('date', $draft->getDraftDate()); 40 $form->setHiddenField('wikitext', $text); 41 42 $form->addTagOpen('div')->id('draft__status'); 43 $form->addHTML($draft->getDraftMessage()); 44 $form->addTagClose('div'); 45 $form->addButton('do[recover]', $lang['btn_recover'] )->attrs(['type' => 'submit', 'tabindex' => '1']); 46 $form->addButton('do[draftdel]', $lang['btn_draftdel'])->attrs(['type' => 'submit', 'tabindex' => '2']); 47 $form->addButton('do[show]', $lang['btn_cancel'] )->attrs(['type' => 'submit', 'tabindex' => '3']); 48 $form->addTagClose('div'); 49 50 print $form->toHTML('Draft'); 51 } 52 53} 54