[FEATURE] Bug: TOC Template not editable 89/15189/1
authorBastian Bringenberg <mail@bastian-bringenberg.de>
Mon, 1 Oct 2012 14:58:52 +0000 (16:58 +0200)
committerBastian Bringenberg <mail@bastian-bringenberg.de>
Mon, 1 Oct 2012 14:58:52 +0000 (16:58 +0200)
Solved this by inserting the settings into an array and using this array for getting the correct pathes.

Change-Id: Ifd463ec705dc3da2975a95195689f33dc12fc141
Fixes: #41383 @1h00

Classes/Controller/PageController.php
Classes/Helper/RenderHelper.php

index bf1f443..29b2791 100755 (executable)
@@ -68,6 +68,7 @@ class Tx_Typo3wiki_Controller_PageController extends Tx_Extbase_MVC_Controller_A
         * @return void
         */
        public function showAction(Tx_Typo3wiki_Domain_Model_Page $page = NULL) {
+               $settings = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
                if($page === NULL ) $page = $this->pageRepository->findOneByPageTitle($this->request->getArgument('page'));
                if($page === NULL || $page->getMainRevision() === NULL){
                        if($page === NULL ){
@@ -164,6 +165,7 @@ class Tx_Typo3wiki_Controller_PageController extends Tx_Extbase_MVC_Controller_A
                $renderHelper->setPageRepository($this->pageRepository);
                $renderHelper->setUriBuilder($this->uriBuilder);
                $renderHelper->setSettings($this->settings);
+               $renderHelper->setObjectSettings($this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK));
                $renderHelper->setObjectManager($this->objectManager);
 
                return $renderHelper;
index 44c1279..dac28f5 100644 (file)
@@ -30,7 +30,6 @@
         * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
         *
         */
-       // @todo  check if __DIR__ has ending slash
        require(__DIR__ . '/markdown.php');
        class Tx_Typo3wiki_Helper_RenderHelper extends MarkdownExtra_Parser {
                /**
                protected $settings;
 
                /**
+                * The Controllers Object Settings
+                *
+                * @var array
+                */
+               protected $objectSettings;
+
+               /**
                 * The ObjectManager
                 *
                 * @var Tx_Extbase_Object_ObjectManagerInterface
                 */
                public function renderRelatedPages(Tx_Typo3wiki_Domain_Model_Page $page) {
                        foreach ($page->getRelatedPages() as $singlePage) {
-                               $text = $singlePage->getMainRevision()->getRenderedText();
-                               $text = $this->renderRelatedPagesHelper($text, $page);
-                               $singlePage->getMainRevision()->setRenderedText($text);
+                               $singlePage->getMainRevision()->setRenderedText('');
+                               /*$text = $this->renderRelatedPagesHelper($text, $page);
+                               $singlePage->getMainRevision()->setRenderedText($text); */
                                // @todo check is is saved
                        }
                }
                }
 
                /**
-                * @todo Adds the rendering of internalLinks to MarkUp
-                * @todo tx_typo3wiki_typo3wiki automatically?
+                * Adds the rendering of internalLinks to MarkUp
                 *
                 * @param string $text
                 * @return string
 
                /**
                 * Adds the rendering of ContentList based on HeadLines to MarkUp
-                * @todo Make TOC Template Movable
                 *
                 * @param string $text
                 * @return string
                        $stageList = $this->_getContentListStage($text, 1);
                        $tocView = $this->objectManager->create('Tx_Fluid_View_StandaloneView');
                        $tocView->setFormat('html');
-                       $tocView->setLayoutRootPath('typo3conf/ext/typo3wiki/Resources/Private/Layouts');
-                       $tocView->setPartialRootPath('typo3conf/ext/typo3wiki/Resources/Private/Partials');
-                       $templateRootPath = t3lib_div::getFileAbsFileName( 'typo3conf/ext/typo3wiki/Resources/Private/Templates/Rendering/' );
-                       $templatePathAndFilename = $templateRootPath .'TableOfContents.html';
-                       $tocView->setTemplatePathAndFilename($templatePathAndFilename);
+                       $tocView->setLayoutRootPath(t3lib_div::getFileAbsFileName($this->objectSettings['view']['layoutRootPath']));
+                       $tocView->setPartialRootPath(t3lib_div::getFileAbsFileName($this->objectSettings['view']['partialRootPath']));
+                       $tocView->setTemplatePathAndFilename(t3lib_div::getFileAbsFileName($this->objectSettings['view']['templateRootPath']).'Rendering/TableOfContents.html');
                        $tocView->assign('stageList', $stageList);
                        return str_replace('{TOC}', $tocView->render(), $text);
                }
                }
 
                /**
+                * Set objectSettings
+                *
+                * @param array $objectSettings
+                */
+               public function setObjectSettings($objectSettings) {
+                       $this->objectSettings = $objectSettings;
+               }
+
+               /**
+                * Get objectSettings
+                *
+                * @return array
+                */
+               public function getObjectSettings() {
+                       return $this->objectSettings;
+               }
+
+
+               /**
                 * Set ObjectManager
                 *
                 * @param \Tx_Extbase_Object_ObjectManagerInterface $objectManager