Draft.php 802 B

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