Failed Conditions
Pull Request — master (#3198)
by
unknown
03:47
created

PageDraft::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 31
rs 9.424
c 0
b 0
f 0
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 <[email protected]>
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
}
55