mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-06-29 10:04:24 +02:00
doc/lib: Update controllers and views according to the recent changes
refs #6630
This commit is contained in:
parent
41355fe0e2
commit
005ef8c92f
@ -46,17 +46,16 @@ class Doc_IcingawebController extends DocController
|
|||||||
*/
|
*/
|
||||||
public function chapterAction()
|
public function chapterAction()
|
||||||
{
|
{
|
||||||
$chapterId = $this->getParam('chapterId');
|
$chapter = $this->getParam('chapter');
|
||||||
if ($chapterId === null) {
|
if ($chapter === null) {
|
||||||
throw new Zend_Controller_Action_Exception(
|
throw new Zend_Controller_Action_Exception(
|
||||||
sprintf($this->translate('Missing parameter \'%s\''), 'chapterId'),
|
sprintf($this->translate('Missing parameter %s'), 'chapter'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->renderChapter(
|
$this->renderChapter(
|
||||||
$this->getPath(),
|
$this->getPath(),
|
||||||
$chapterId,
|
$chapter,
|
||||||
'doc/icingaweb/toc',
|
|
||||||
'doc/icingaweb/chapter'
|
'doc/icingaweb/chapter'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -122,10 +122,10 @@ class Doc_ModuleController extends DocController
|
|||||||
{
|
{
|
||||||
$module = $this->getParam('moduleName');
|
$module = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($module);
|
$this->assertModuleEnabled($module);
|
||||||
$chapterId = $this->getParam('chapterId');
|
$chapter = $this->getParam('chapter');
|
||||||
if ($chapterId === null) {
|
if ($chapter === null) {
|
||||||
throw new Zend_Controller_Action_Exception(
|
throw new Zend_Controller_Action_Exception(
|
||||||
sprintf($this->translate('Missing parameter \'%s\''), 'chapterId'),
|
sprintf($this->translate('Missing parameter %s'), 'chapter'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -133,8 +133,7 @@ class Doc_ModuleController extends DocController
|
|||||||
try {
|
try {
|
||||||
$this->renderChapter(
|
$this->renderChapter(
|
||||||
$this->getPath($module, Icinga::app()->getModuleManager()->getModuleDir($module, '/doc')),
|
$this->getPath($module, Icinga::app()->getModuleManager()->getModuleDir($module, '/doc')),
|
||||||
$chapterId,
|
$chapter,
|
||||||
$this->_helper->url->url(array('moduleName' => $module), 'doc/module/toc'),
|
|
||||||
'doc/module/chapter',
|
'doc/module/chapter',
|
||||||
array('moduleName' => $module)
|
array('moduleName' => $module)
|
||||||
);
|
);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<div class="chapter">
|
<div class="chapter">
|
||||||
<?= $sectionRenderer->render($this, $this->getHelper('Url')); ?>
|
<?= /** @type \Icinga\Module\Doc\SectionRenderer $section */ $section ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<div class="chapter">
|
<div class="chapter">
|
||||||
<?= $sectionRenderer->render($this, $this->getHelper('Url')); ?>
|
<?= /** @type \Icinga\Module\Doc\SectionRenderer $section */ $section ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<h1><?= $title ?></h1>
|
<h1><?= /** @type string $title */ $title ?></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="content toc">
|
<div class="content toc">
|
||||||
<?= $tocRenderer->render($this, $this->getHelper('Url')); ?>
|
<?= /** @type \Icinga\Module\Doc\TocRenderer $toc */ $toc ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="controls">
|
<div class="controls">
|
||||||
<h1><?= $title ?></h1>
|
<h1><?= /** @type string $title */ $title ?></h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="content toc">
|
<div class="content toc">
|
||||||
<?= $tocRenderer->render($this, $this->getHelper('Url')); ?>
|
<?= /** @type \Icinga\Module\Doc\TocRenderer $toc */ $toc ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,3 +20,5 @@ $section->add($this->translate('Developer - Style'), array(
|
|||||||
'url' => 'doc/style/guide',
|
'url' => 'doc/style/guide',
|
||||||
'priority' => 200,
|
'priority' => 200,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->provideSearchUrl($this->translate('Doc'), 'doc/search');
|
||||||
|
@ -11,22 +11,18 @@ class DocController extends ModuleActionController
|
|||||||
* Render a chapter
|
* Render a chapter
|
||||||
*
|
*
|
||||||
* @param string $path Path to the documentation
|
* @param string $path Path to the documentation
|
||||||
* @param string $chapterId ID of the chapter
|
* @param string $chapter ID of the chapter
|
||||||
* @param string $tocUrl
|
* @param string $url URL to replace links with
|
||||||
* @param string $url
|
* @param array $urlParams Additional URL parameters
|
||||||
* @param array $urlParams
|
|
||||||
*/
|
*/
|
||||||
protected function renderChapter($path, $chapterId, $tocUrl, $url, array $urlParams = array())
|
protected function renderChapter($path, $chapter, $url, array $urlParams = array())
|
||||||
{
|
{
|
||||||
$parser = new DocParser($path);
|
$parser = new DocParser($path);
|
||||||
$this->view->sectionRenderer = new SectionRenderer(
|
$section = new SectionRenderer($parser->getDocTree(), SectionRenderer::decodeUrlParam($chapter));
|
||||||
$parser->getDocTree(),
|
$this->view->section = $section
|
||||||
SectionRenderer::decodeUrlParam($chapterId),
|
->setUrl($url)
|
||||||
$tocUrl,
|
->setUrlParams($urlParams);
|
||||||
$url,
|
$this->view->title = $chapter;
|
||||||
$urlParams
|
|
||||||
);
|
|
||||||
$this->view->title = $chapterId;
|
|
||||||
$this->render('chapter', null, true);
|
$this->render('chapter', null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,13 +31,16 @@ class DocController extends ModuleActionController
|
|||||||
*
|
*
|
||||||
* @param string $path Path to the documentation
|
* @param string $path Path to the documentation
|
||||||
* @param string $name Name of the documentation
|
* @param string $name Name of the documentation
|
||||||
* @param string $url
|
* @param string $url URL to replace links with
|
||||||
* @param array $urlParams
|
* @param array $urlParams Additional URL parameters
|
||||||
*/
|
*/
|
||||||
protected function renderToc($path, $name, $url, array $urlParams = array())
|
protected function renderToc($path, $name, $url, array $urlParams = array())
|
||||||
{
|
{
|
||||||
$parser = new DocParser($path);
|
$parser = new DocParser($path);
|
||||||
$this->view->tocRenderer = new TocRenderer($parser->getDocTree(), $url, $urlParams);
|
$toc = new TocRenderer($parser->getDocTree()->getIterator());
|
||||||
|
$this->view->toc = $toc
|
||||||
|
->setUrl($url)
|
||||||
|
->setUrlParams($urlParams);
|
||||||
$name = ucfirst($name);
|
$name = ucfirst($name);
|
||||||
$this->view->docName = $name;
|
$this->view->docName = $name;
|
||||||
$this->view->title = sprintf($this->translate('%s Documentation'), $name);
|
$this->view->title = sprintf($this->translate('%s Documentation'), $name);
|
||||||
|
@ -9,7 +9,7 @@ if (Icinga::app()->isCli()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$docModuleChapter = new Zend_Controller_Router_Route(
|
$docModuleChapter = new Zend_Controller_Router_Route(
|
||||||
'doc/module/:moduleName/chapter/:chapterId',
|
'doc/module/:moduleName/chapter/:chapter',
|
||||||
array(
|
array(
|
||||||
'controller' => 'module',
|
'controller' => 'module',
|
||||||
'action' => 'chapter',
|
'action' => 'chapter',
|
||||||
@ -18,7 +18,7 @@ $docModuleChapter = new Zend_Controller_Router_Route(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$docIcingaWebChapter = new Zend_Controller_Router_Route(
|
$docIcingaWebChapter = new Zend_Controller_Router_Route(
|
||||||
'doc/icingaweb/chapter/:chapterId',
|
'doc/icingaweb/chapter/:chapter',
|
||||||
array(
|
array(
|
||||||
'controller' => 'icingaweb',
|
'controller' => 'icingaweb',
|
||||||
'action' => 'chapter',
|
'action' => 'chapter',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user