mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
doc: Make documentation for all installed modules avaiable
Before, only documentation of enabled modules was available. refs #9644
This commit is contained in:
parent
de29d66005
commit
07fb82357b
@ -49,24 +49,24 @@ class Doc_ModuleController extends DocController
|
|||||||
{
|
{
|
||||||
$moduleManager = Icinga::app()->getModuleManager();
|
$moduleManager = Icinga::app()->getModuleManager();
|
||||||
$modules = array();
|
$modules = array();
|
||||||
foreach ($moduleManager->listEnabledModules() as $module) {
|
foreach ($moduleManager->listInstalledModules() as $module) {
|
||||||
$path = $this->getPath($module, $moduleManager->getModuleDir($module, '/doc'), true);
|
$path = $this->getPath($module, $moduleManager->getModuleDir($module, '/doc'), true);
|
||||||
if ($path !== null) {
|
if ($path !== null) {
|
||||||
$modules[] = $moduleManager->getModule($module);
|
$modules[] = $moduleManager->getModule($module, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->view->modules = $modules;
|
$this->view->modules = $modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert that the given module is enabled
|
* Assert that the given module is installed
|
||||||
*
|
*
|
||||||
* @param $moduleName
|
* @param string $moduleName
|
||||||
*
|
*
|
||||||
* @throws Zend_Controller_Action_Exception If the required parameter 'moduleName' is empty or either if the
|
* @throws Zend_Controller_Action_Exception If the required parameter 'moduleName' is empty or if the
|
||||||
* given module is neither installed nor enabled
|
* given module is not installed
|
||||||
*/
|
*/
|
||||||
protected function assertModuleEnabled($moduleName)
|
protected function assertModuleInstalled($moduleName)
|
||||||
{
|
{
|
||||||
if (empty($moduleName)) {
|
if (empty($moduleName)) {
|
||||||
throw new Zend_Controller_Action_Exception(
|
throw new Zend_Controller_Action_Exception(
|
||||||
@ -81,23 +81,17 @@ class Doc_ModuleController extends DocController
|
|||||||
404
|
404
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (! $moduleManager->hasEnabled($moduleName)) {
|
|
||||||
throw new Zend_Controller_Action_Exception(
|
|
||||||
sprintf($this->translate('Module \'%s\' is not enabled'), $moduleName),
|
|
||||||
404
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View the toc of a module's documentation
|
* View the toc of a module's documentation
|
||||||
*
|
*
|
||||||
* @see assertModuleEnabled()
|
* @see assertModuleInstalled()
|
||||||
*/
|
*/
|
||||||
public function tocAction()
|
public function tocAction()
|
||||||
{
|
{
|
||||||
$module = $this->getParam('moduleName');
|
$module = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($module);
|
$this->assertModuleInstalled($module);
|
||||||
$this->view->moduleName = $module;
|
$this->view->moduleName = $module;
|
||||||
try {
|
try {
|
||||||
$this->renderToc(
|
$this->renderToc(
|
||||||
@ -116,12 +110,12 @@ class Doc_ModuleController extends DocController
|
|||||||
*
|
*
|
||||||
* @throws Zend_Controller_Action_Exception If the required parameter 'chapterId' is missing or if an error in
|
* @throws Zend_Controller_Action_Exception If the required parameter 'chapterId' is missing or if an error in
|
||||||
* the documentation module's library occurs
|
* the documentation module's library occurs
|
||||||
* @see assertModuleEnabled()
|
* @see assertModuleInstalled()
|
||||||
*/
|
*/
|
||||||
public function chapterAction()
|
public function chapterAction()
|
||||||
{
|
{
|
||||||
$module = $this->getParam('moduleName');
|
$module = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($module);
|
$this->assertModuleInstalled($module);
|
||||||
$chapter = $this->getParam('chapter');
|
$chapter = $this->getParam('chapter');
|
||||||
if ($chapter === null) {
|
if ($chapter === null) {
|
||||||
throw new Zend_Controller_Action_Exception(
|
throw new Zend_Controller_Action_Exception(
|
||||||
@ -145,12 +139,12 @@ class Doc_ModuleController extends DocController
|
|||||||
/**
|
/**
|
||||||
* View a module's documentation as PDF
|
* View a module's documentation as PDF
|
||||||
*
|
*
|
||||||
* @see assertModuleEnabled()
|
* @see assertModuleInstalled()
|
||||||
*/
|
*/
|
||||||
public function pdfAction()
|
public function pdfAction()
|
||||||
{
|
{
|
||||||
$module = $this->getParam('moduleName');
|
$module = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($module);
|
$this->assertModuleInstalled($module);
|
||||||
$this->renderPdf(
|
$this->renderPdf(
|
||||||
$this->getPath($module, Icinga::app()->getModuleManager()->getModuleDir($module, '/doc')),
|
$this->getPath($module, Icinga::app()->getModuleManager()->getModuleDir($module, '/doc')),
|
||||||
$module,
|
$module,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
$this->translate('Module documentations'),
|
$this->translate('Module documentations'),
|
||||||
'doc/module/',
|
'doc/module/',
|
||||||
null,
|
null,
|
||||||
array('title' => $this->translate('List all modifications for which documentation is available'))
|
array('title' => $this->translate('List all modules for which documentation is available'))
|
||||||
); ?></li>
|
); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($modules as $module): ?>
|
<?php foreach ($modules as $module): /** @var \Icinga\Application\Modules\Module $module */ ?>
|
||||||
<li><?= $this->qlink(
|
<li><?= $this->qlink(
|
||||||
$module->getTitle(),
|
$module->getTitle(),
|
||||||
'doc/module/toc',
|
'doc/module/toc',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user