[FEATURE] RealURL integration 70/15670/1
authorBastian Bringenberg <mail@bastian-bringenberg.de>
Tue, 16 Oct 2012 06:09:59 +0000 (08:09 +0200)
committerBastian Bringenberg <mail@bastian-bringenberg.de>
Tue, 16 Oct 2012 06:09:59 +0000 (08:09 +0200)
Change-Id: I6ec97ac4d82131dd7b0fc427c93be15ef74f875f
Fixes: #42030 @1h30

Classes/Controller/PageController.php
Classes/Helper/RenderHelper.php
Configuration/Realurl/realurl_conf.php [new file with mode: 0644]
ext_localconf.php

index f11853f..6423daa 100755 (executable)
@@ -68,6 +68,9 @@ class Tx_Typo3wiki_Controller_PageController extends Tx_Extbase_MVC_Controller_A
         * @return void
         */
        public function showAction(Tx_Typo3wiki_Domain_Model_Page $page = NULL) {
+               //var_dump($this->request->getArgument('page'), get_class($page));
+               //var_dump($page->getUid());
+               //die();
                $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){
@@ -98,10 +101,17 @@ class Tx_Typo3wiki_Controller_PageController extends Tx_Extbase_MVC_Controller_A
        /**
         * action unknownPage
         *
+        * @param Tx_Typo3wiki_Domain_Model_Page $page
+        * @dontvalidate $page
+        *
         * @return vpid
         */
-       public function unknownPageAction(){
-               $page = $this->request->getArgument('page');
+       public function unknownPageAction(Tx_Typo3wiki_Domain_Model_Page $page = NULL){
+               if($page === NULL){
+                       $page = $this->request->getArgument('page');
+               }else{
+                       $page = $page->getPageTitle();
+               }
                $this->view->assign('page', $page);
        }
 
index 950abf4..2ec211a 100644 (file)
                                $linkTitle = explode('|', $linkTitle);
                                if(count($linkTitle)==2){
                                        $link = $this->uriBuilder->setArguments(array('tx_typo3wiki_typo3wiki[action]' => 'show', 'tx_typo3wiki_typo3wiki[page]' => $linkTitle[1]));
-                                       $link = $link->build();
+                                       $link = $link->buildFrontendUri();
                                        $cssClass = 'internal exists';
                                        if(!isset($this->helper[$linkTitle[1]])){
                                                $target = $this->createPageIfNotExists($linkTitle[1]);
                                        $text = str_replace('[['.$linkTitle[0].'|'.$linkTitle[1].']]', $link, $text);
                                }else{
                                        $link = $this->uriBuilder->setArguments(array('tx_typo3wiki_typo3wiki[action]' => 'show', 'tx_typo3wiki_typo3wiki[page]' => $linkTitle[0]));
-                                       $link = $link->build();
+                                       $link = $link->buildFrontendUri();
                                        $cssClass = 'internal exists';
                                        if(!isset($this->helper[$linkTitle[0]])){
                                                $target = $this->createPageIfNotExists($linkTitle[0]);
diff --git a/Configuration/Realurl/realurl_conf.php b/Configuration/Realurl/realurl_conf.php
new file mode 100644 (file)
index 0000000..f0e4b38
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+       /***************************************************************
+        *  Copyright notice
+        *
+        *  (c) 2012 Bastian Bringenberg <typo3@bastian-bringenberg.de>, Bastian Bringenberg
+        *
+        *  All rights reserved
+        *
+        *  This script is part of the TYPO3 project. The TYPO3 project is
+        *  free software; you can redistribute it and/or modify
+        *  it under the terms of the GNU General Public License as published by
+        *  the Free Software Foundation; either version 3 of the License, or
+        *  (at your option) any later version.
+        *
+        *  The GNU General Public License can be found at
+        *  http://www.gnu.org/copyleft/gpl.html.
+        *
+        *  This script is distributed in the hope that it will be useful,
+        *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+        *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        *  GNU General Public License for more details.
+        *
+        *  This copyright notice MUST APPEAR in all copies of the script!
+        ***************************************************************/
+       if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'])) {
+               $register = array(
+                       'wiki' => array (
+                               array(
+                                       'GETvar' => 'tx_typo3wiki_typo3wiki[action]',
+                                       //'value' => 'show'
+                               ),
+                               array(
+                                       //tx_typo3wiki_typo3wiki%5Bcontroller%5D=Page
+                                       'GETvar' => 'tx_typo3wiki_typo3wiki[controller]',
+                                       'value' => 'Page'
+                               ),
+                               array(
+                                       'GETvar' => 'tx_typo3wiki_typo3wiki[page]',
+                                       'lookUpTable' => array (
+                                               'table' => 'tx_typo3wiki_domain_model_page',
+                                               'id_field' => 'uid',
+                                               'alias_field' => 'page_title',
+                                               'addWhereClause'=> 'AND NOT deleted',
+                                               'useUniqueCache'=> 1,
+                                               'useUniqueCache_conf' => array (
+                                                       'strtolower' => 1,
+                                                       'spaceCharacter' => '-',
+                                               ),
+                                       ),
+                               ),
+                       ),
+               );
+
+               foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] as $domain => $config) {
+                       if (is_array($config)) {
+                               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain]['postVarSets']['_DEFAULT'] = array_merge(
+                                       $register, (array) $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'][$domain]['postVarSets']['_DEFAULT']
+                               );
+                       }
+
+                       unset($config);
+               }
+
+               unset($register);
+               reset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']);
+       }
index 0cd7c73..70078de 100755 (executable)
@@ -3,7 +3,9 @@ if (!defined('TYPO3_MODE')) {
        die ('Access denied.');
 }
 
-Tx_Extbase_Utility_Extension::configurePlugin(
+       if(t3lib_extMgm::isLoaded('realurl')) require_once(t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/Realurl/realurl_conf.php');
+
+       Tx_Extbase_Utility_Extension::configurePlugin(
        $_EXTKEY,
        'Typo3wiki',
        array(
@@ -22,9 +24,4 @@ Tx_Extbase_Utility_Extension::configurePlugin(
  *
  */
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'][] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki_cachemenu.php:&tx_typo3wiki_cachemenu';
-$TYPO3_CONF_VARS['BE']['AJAX']['tx_typo3wiki::clear'] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki_cache.php:tx_typo3wiki_cache->clear';
-
-       /** NOT NEEDED */
-//$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'][] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki_cachemenu.php:&tx_typo3wiki_cachemenu';
-//$TYPO3_CONF_VARS['BE']['AJAX']['tx_realurlclearcache::clear'] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki.php:tx_typo3wiki->clear';
-//$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'][] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki.php:tx_tx_typo3wiki->pageIcon';
\ No newline at end of file
+$TYPO3_CONF_VARS['BE']['AJAX']['tx_typo3wiki::clear'] = 'EXT:'.$_EXTKEY.'/class.tx_typo3wiki_cache.php:tx_typo3wiki_cache->clear';
\ No newline at end of file