diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 2cd581604..10a534910 100755 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -266,8 +266,6 @@ class ActionController extends Zend_Controller_Action return call_user_func_array(array($this, $deprecatedMethod), $params); } - parent::__call($name, $params); - - return null; + return parent::__call($name, $params); } } diff --git a/modules/doc/application/controllers/IndexController.php b/modules/doc/application/controllers/IndexController.php index a83cbdec5..d18eff5db 100644 --- a/modules/doc/application/controllers/IndexController.php +++ b/modules/doc/application/controllers/IndexController.php @@ -3,13 +3,21 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} +use Icinga\Application\Icinga; +use Icinga\Module\Doc\Parser as DocParser; use Icinga\Web\Controller\ActionController; class Doc_IndexController extends ActionController { + /** + * Display the application's documentation + */ public function indexAction() { - $this->_forward('index', 'view'); + $parser = new DocParser(); + list($html, $toc) = $parser->parseDirectory(Icinga::app()->getApplicationDir('/../doc')); + $this->view->html = $html; + $this->view->toc = $toc; } } // @codingStandardsIgnoreEnd diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php new file mode 100644 index 000000000..f59467505 --- /dev/null +++ b/modules/doc/application/controllers/ModuleController.php @@ -0,0 +1,44 @@ +getModuleManager(); + $moduleName = substr($methodName, 0, -6); // Strip 'Action' suffix + if (!$moduleManager->hasEnabled($moduleName)) { + // TODO(el): Throw a not found exception once the code has been moved to the moduleAction (see TODO above) + return parent::__call($methodName, $args); + } + } +} +// @codingStandardsIgnoreEnd diff --git a/modules/doc/application/controllers/ViewController.php b/modules/doc/application/controllers/ViewController.php deleted file mode 100644 index b2174872d..000000000 --- a/modules/doc/application/controllers/ViewController.php +++ /dev/null @@ -1,52 +0,0 @@ -_helper->viewRenderer->setRender('view'); - } - - /** - * Populate view - * - * @param string $dir - */ - private function populateView($dir) - { - $parser = new DocParser(); - list($html, $toc) = $parser->parseDirectory($dir); - $this->view->html = $html; - $this->view->toc = $toc; - } - - public function indexAction() - { - $this->populateView(Icinga::app()->getApplicationDir('/../doc')); - } - - /** - * Provide run-time dispatching of module documentation - * - * @param string $methodName - * @param array $args - */ - public function __call($methodName, $args) - { - $moduleManager = Icinga::app()->getModuleManager(); - $moduleName = substr($methodName, 0, -6); // Strip 'Action' suffix - if ($moduleManager->hasEnabled($moduleName)) { - $this->populateView($moduleManager->getModuleDir($moduleName, '/doc')); - } else { - parent::__call($methodName, $args); - } - } -} -// @codingStandardsIgnoreEnd diff --git a/modules/doc/application/views/scripts/index/index.phtml b/modules/doc/application/views/scripts/index/index.phtml new file mode 100644 index 000000000..9be7c042a --- /dev/null +++ b/modules/doc/application/views/scripts/index/index.phtml @@ -0,0 +1,14 @@ +