xref: /dokuwiki/inc/Action/Draft.php (revision 503e913f954d5bfad625ab36d42db66ad6cedbab)
1<?php
2
3namespace dokuwiki\Action;
4
5use dokuwiki\Action\Exception\ActionException;
6
7/**
8 * Class Draft
9 *
10 * Screen to see and recover a draft
11 *
12 * @package dokuwiki\Action
13 * @fixme combine with Recover?
14 */
15class Draft extends AbstractAction {
16
17    /** @inheritdoc */
18    public function minimumPermission() {
19        global $INFO;
20        if($INFO['exists']) {
21            return AUTH_EDIT;
22        } else {
23            return AUTH_CREATE;
24        }
25    }
26
27    /** @inheritdoc */
28    public function checkPreconditions() {
29        parent::checkPreconditions();
30        global $INFO;
31        if(!file_exists($INFO['draft'])) throw new ActionException('edit');
32    }
33
34    /** @inheritdoc */
35    public function tplContent() {
36        html_draft();
37    }
38
39}
40