Added feature #10155: Add controller switching for frontend editing
authorJeff Segars <jsegars@alumni.rice.edu>
Tue, 3 Feb 2009 19:51:27 +0000 (19:51 +0000)
committerJeff Segars <jsegars@alumni.rice.edu>
Tue, 3 Feb 2009 19:51:27 +0000 (19:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@4933 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tsfebeuserauth.php
t3lib/config_default.php
typo3/sysext/cms/tslib/index_ts.php

index b5c2648..17c06c7 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-02-03  Jeff Segars  <jeff@webempoweredchurch.org>
 
        * Fixed bug #9600: Frontend Edit Panel is not compatible with subdomains and RealURL (thanks to Xavier Perseguers)
+       * Added feature #10155: Add controller switching for frontend editing
 
 2009-02-03  Ingo Renner  <ingo@typo3.org>
 
index c2b4dce..19116fb 100755 (executable)
@@ -179,10 +179,19 @@ class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth {
                if (is_array($this->extAdminConfig['enable.'])) {
                        foreach($this->extAdminConfig['enable.'] as $key => $value) {
                                if ($value) {
-                                               // @todo        Add support for controller switching (ie. TV controller)
-                                       require_once(PATH_t3lib . 'class.t3lib_frontendedit.php');
-                                       $classname = 't3lib_frontendedit';
-                                       $this->frontendEdit = t3lib_div::makeInstance($classname);
+                                       if ($GLOBALS['TSFE'] instanceof tslib_fe) {
+                                                       // Grab the Page TSConfig property that determines which controller to use.
+                                               $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig();
+                                               $controllerKey = isset($pageTSConfig['TSFE.']['frontendEditingController']) ? $pageTSConfig['TSFE.']['frontendEditingController'] : 'default';
+                                       } else {
+                                               $controllerKey = 'default';
+                                       }
+                                       
+                                       $controllerClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController'][$controllerKey];
+                                       if ($controllerClass) {
+                                               $this->frontendEdit = t3lib_div::getUserObj($controllerClass, false);
+                                       }
+
                                        break;
                                }
                        }
index a30b9db..5ee5fce 100755 (executable)
@@ -329,6 +329,11 @@ $TYPO3_CONF_VARS = Array(
                        'cliKeys' => array(     // Arrays of EXT:file and module name pairs. See EXT:lowlevel/ext_localconf.php for example.
                        )
                ),
+               't3lib/class.t3lib_tsfebeuserauth.php' => array(
+                       'frontendEditingController' => array(
+                               'default' => 't3lib/class.t3lib_frontendedit.php:t3lib_frontendedit'
+                       )
+               )
        ),
        'EXTCONF' => Array (            // Here you may add manually set configuration options for your extensions. Eg. $TYPO3_CONF_VARS['EXTCONF']['my_extension_key']['my_option'] = 'my_value';
 //             '--key--' => array()
index 8c8618f..35bfd0b 100755 (executable)
@@ -242,9 +242,8 @@ if ($_COOKIE['be_typo_user']) {             // If the backend cookie is set, we proceed and
                        $BE_USER->fetchGroupData();
                        $TSFE->beUserLogin = 1;
                }
-               if ($BE_USER->checkLockToIP() && $BE_USER->checkBackendAccessSettingsFromInitPhp() && $BE_USER->user['uid']) {
-                       $BE_USER->initializeFrontendEdit();
-               } else {        // Unset the user initialization.
+                       // Unset the user initialization.
+               if (!$BE_USER->checkLockToIP() || !$BE_USER->checkBackendAccessSettingsFromInitPhp() || !$BE_USER->user['uid']) {
                        $BE_USER='';
                        $TSFE->beUserLogin=0;
                }
@@ -301,19 +300,6 @@ $TT->push('Process ID','');
        $TSFE->makeCacheHash();
 $TT->pull();
 
-
-// *****************************************
-// Frontend editing
-// *****************************************
-if ($TSFE->beUserLogin && ($BE_USER->frontendEdit instanceof t3lib_frontendedit))      {
-       require_once(t3lib_extMgm::extPath('lang').'lang.php');
-       $LANG = t3lib_div::makeInstance('language');
-       $LANG->init($BE_USER->uc['lang']);
-
-       $BE_USER->frontendEdit->initConfigOptions();
-}
-
-
 // *******************************************
 // Get compressed $TCA-Array();
 // After this, we should now have a valid $TCA, though minimized
@@ -343,6 +329,19 @@ $TT->pull();
 // ******************************************************
 $TSFE->getConfigArray();
 
+// *****************************************
+// Frontend editing
+// *****************************************
+if ($TSFE->beUserLogin) {
+       $BE_USER->initializeFrontendEdit();
+       if ($BE_USER->frontendEdit instanceof t3lib_frontendedit) {
+               require_once(t3lib_extMgm::extPath('lang').'lang.php');
+               $LANG = t3lib_div::makeInstance('language');
+               $LANG->init($BE_USER->uc['lang']);
+
+               $BE_USER->frontendEdit->initConfigOptions();
+       }
+}
 
 // ********************************
 // Convert POST data to internal "renderCharset" if different from the metaCharset