diff --git a/admin.php b/admin.php index e8b8f7c..c065b7d 100644 --- a/admin.php +++ b/admin.php @@ -19,6 +19,8 @@ class admin_plugin_pagemove extends DokuWiki_Admin_Plugin { private $ns_opts = false; /** @var helper_plugin_pagemove $helper */ private $helper = null; + /** @var string $ns_move_state The state of the current namespace move (none, started, continued, error) */ + private $ns_move_state = 'none'; /** * Get the sort number that defines the position in the admin menu. @@ -70,30 +72,32 @@ function html() { ptln( $this->locale_xhtml('pagemove') ); ptln('
'); - ptln(sprintf($this->getLang('pm_ns_move_started'), hsc($this->ns_opts['ns']), hsc($this->ns_opts['newns']), $this->ns_opts['num_pages'], $this->ns_opts['num_media'])); - ptln('
'); - ptln($this->helper->getNSMoveButton('continue')); - ptln($this->helper->getNSMoveButton('abort')); - } elseif ($this->ns_opts !== false && isset($this->ns_opts['remaining'])) { - if ($this->ns_opts['remaining'] === false) { + switch ($this->ns_move_state) { + case 'started': + ptln(''); + ptln(sprintf($this->getLang('pm_ns_move_started'), hsc($this->ns_opts['ns']), hsc($this->ns_opts['newns']), $this->ns_opts['num_pages'], $this->ns_opts['num_media'])); + ptln('
'); + ptln($this->helper->getNSMoveButton('continue')); + ptln($this->helper->getNSMoveButton('abort')); + break; + case 'error': ptln(''); ptln(sprintf($this->getLang('pm_ns_move_error'), $this->ns_opts['ns'], $this->ns_opts['newns'])); ptln('
'); ptln($this->helper->getNSMoveButton('tryagain')); ptln($this->helper->getNSMoveButton('skip')); ptln($this->helper->getNSMoveButton('abort')); - } else { + break; + case 'continued': ptln(''); ptln(sprintf($this->getLang('pm_ns_move_continued'), $this->ns_opts['ns'], $this->ns_opts['newns'], $this->ns_opts['remaining'])); ptln('
'); ptln($this->helper->getNSMoveButton('continue')); ptln($this->helper->getNSMoveButton('abort')); - } - } else { - $this->printForm(); + break; + default: + $this->printForm(); } ptln('