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