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