mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
doc: Don't use $this->_helper->viewRenderer
This somehow breaks our postDispatch logic. But $this->render does not.
This commit is contained in:
parent
f470e66884
commit
a7b16bc4a2
@ -13,7 +13,7 @@ class Doc_IcingawebController extends DocController
|
|||||||
*/
|
*/
|
||||||
public function tocAction()
|
public function tocAction()
|
||||||
{
|
{
|
||||||
$this->renderToc(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter');
|
return $this->renderToc(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,7 +30,7 @@ class Doc_IcingawebController extends DocController
|
|||||||
404
|
404
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->renderChapter(
|
return $this->renderChapter(
|
||||||
Icinga::app()->getApplicationDir('/../doc'),
|
Icinga::app()->getApplicationDir('/../doc'),
|
||||||
$chapterId,
|
$chapterId,
|
||||||
'doc/icingaweb/toc',
|
'doc/icingaweb/toc',
|
||||||
@ -43,6 +43,6 @@ class Doc_IcingawebController extends DocController
|
|||||||
*/
|
*/
|
||||||
public function pdfAction()
|
public function pdfAction()
|
||||||
{
|
{
|
||||||
$this->renderPdf(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter');
|
return $this->renderPdf(Icinga::app()->getApplicationDir('/../doc'), 'Icinga Web 2', 'doc/icingaweb/chapter');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,7 @@ use Icinga\Module\Doc\DocController;
|
|||||||
|
|
||||||
class Doc_IndexController extends DocController
|
class Doc_IndexController extends DocController
|
||||||
{
|
{
|
||||||
public function indexAction() {}
|
public function indexAction()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,9 +65,10 @@ class Doc_ModuleController extends DocController
|
|||||||
{
|
{
|
||||||
$moduleName = $this->getParam('moduleName');
|
$moduleName = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($moduleName);
|
$this->assertModuleEnabled($moduleName);
|
||||||
|
$this->view->moduleName = $moduleName;
|
||||||
$moduleManager = Icinga::app()->getModuleManager();
|
$moduleManager = Icinga::app()->getModuleManager();
|
||||||
try {
|
try {
|
||||||
$this->renderToc(
|
return $this->renderToc(
|
||||||
$moduleManager->getModuleDir($moduleName, '/doc'),
|
$moduleManager->getModuleDir($moduleName, '/doc'),
|
||||||
$moduleName,
|
$moduleName,
|
||||||
'doc/module/chapter',
|
'doc/module/chapter',
|
||||||
@ -76,7 +77,6 @@ class Doc_ModuleController extends DocController
|
|||||||
} catch (DocException $e) {
|
} catch (DocException $e) {
|
||||||
throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
|
throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
|
||||||
}
|
}
|
||||||
$this->view->moduleName = $moduleName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,9 +97,10 @@ class Doc_ModuleController extends DocController
|
|||||||
404
|
404
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$this->view->moduleName = $moduleName;
|
||||||
$moduleManager = Icinga::app()->getModuleManager();
|
$moduleManager = Icinga::app()->getModuleManager();
|
||||||
try {
|
try {
|
||||||
$this->renderChapter(
|
return $this->renderChapter(
|
||||||
$moduleManager->getModuleDir($moduleName, '/doc'),
|
$moduleManager->getModuleDir($moduleName, '/doc'),
|
||||||
$chapterId,
|
$chapterId,
|
||||||
$this->_helper->url->url(array('moduleName' => $moduleName), 'doc/module/toc'),
|
$this->_helper->url->url(array('moduleName' => $moduleName), 'doc/module/toc'),
|
||||||
@ -109,7 +110,6 @@ class Doc_ModuleController extends DocController
|
|||||||
} catch (DocException $e) {
|
} catch (DocException $e) {
|
||||||
throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
|
throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
|
||||||
}
|
}
|
||||||
$this->view->moduleName = $moduleName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +122,7 @@ class Doc_ModuleController extends DocController
|
|||||||
$moduleName = $this->getParam('moduleName');
|
$moduleName = $this->getParam('moduleName');
|
||||||
$this->assertModuleEnabled($moduleName);
|
$this->assertModuleEnabled($moduleName);
|
||||||
$moduleManager = Icinga::app()->getModuleManager();
|
$moduleManager = Icinga::app()->getModuleManager();
|
||||||
$this->renderPdf(
|
return $this->renderPdf(
|
||||||
$moduleManager->getModuleDir($moduleName, '/doc'),
|
$moduleManager->getModuleDir($moduleName, '/doc'),
|
||||||
$moduleName,
|
$moduleName,
|
||||||
'doc/module/chapter',
|
'doc/module/chapter',
|
||||||
|
@ -28,7 +28,7 @@ class DocController extends ModuleActionController
|
|||||||
$urlParams
|
$urlParams
|
||||||
);
|
);
|
||||||
$this->view->title = $chapterId;
|
$this->view->title = $chapterId;
|
||||||
$this->_helper->viewRenderer('chapter', null, true);
|
return $this->render('chapter', null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +46,7 @@ class DocController extends ModuleActionController
|
|||||||
$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);
|
||||||
$this->_helper->viewRenderer('toc', null, true);
|
return $this->render('toc', null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +70,7 @@ class DocController extends ModuleActionController
|
|||||||
$urlParams
|
$urlParams
|
||||||
);
|
);
|
||||||
$this->view->docName = $name;
|
$this->view->docName = $name;
|
||||||
$this->_helper->viewRenderer('pdf', null, true);
|
|
||||||
$this->_request->setParam('format', 'pdf');
|
$this->_request->setParam('format', 'pdf');
|
||||||
|
return $this->render('pdf', null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,19 @@ class SectionRenderer extends Renderer
|
|||||||
return substr_replace($doc->saveXML($img), '', -2, 1); // Replace '/>' with '>'
|
return substr_replace($doc->saveXML($img), '', -2, 1); // Replace '/>' with '>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function blubb($match)
|
||||||
|
{
|
||||||
|
$doc = new DOMDocument();
|
||||||
|
$doc->loadHTML($match[0]);
|
||||||
|
$xpath = new DOMXPath($doc);
|
||||||
|
$blockquote = $xpath->query('//blockquote[1]')->item(0);
|
||||||
|
/* @var $blockquote \DOMElement */
|
||||||
|
if (strtolower(substr(trim($blockquote->nodeValue), 0, 5)) === 'note:') {
|
||||||
|
$blockquote->setAttribute('class', 'note');
|
||||||
|
}
|
||||||
|
return $doc->saveXML($blockquote);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the section
|
* Render the section
|
||||||
*
|
*
|
||||||
@ -213,6 +226,11 @@ class SectionRenderer extends Renderer
|
|||||||
array($this, 'replaceImg'),
|
array($this, 'replaceImg'),
|
||||||
$html
|
$html
|
||||||
);
|
);
|
||||||
|
$html = preg_replace_callback(
|
||||||
|
'#<blockquote>.+</blockquote>#ms',
|
||||||
|
array($this, 'blubb'),
|
||||||
|
$html
|
||||||
|
);
|
||||||
$content[] = preg_replace_callback(
|
$content[] = preg_replace_callback(
|
||||||
'/<a\s+(?P<attribs>[^>]*?\s+)?href="#(?P<fragment>[^"]+)"/',
|
'/<a\s+(?P<attribs>[^>]*?\s+)?href="#(?P<fragment>[^"]+)"/',
|
||||||
array($callback, 'render'),
|
array($callback, 'render'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user