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