Fixed bug #17592: ExtDirect API calls are splitted in single requests and slows down...
authorsteffenk <steffenk@709f56b5-9817-0410-a4d7-c38de5d9e867>
Thu, 17 Feb 2011 20:51:05 +0000 (20:51 +0000)
committersteffenk <steffenk@709f56b5-9817-0410-a4d7-c38de5d9e867>
Thu, 17 Feb 2011 20:51:05 +0000 (20:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-5@10484 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_extmgm.php
t3lib/class.t3lib_pagerenderer.php
t3lib/core_autoload.php
t3lib/extjs/class.t3lib_extjs_extdirectapi.php
typo3/backend.php
typo3/classes/class.livesearch.php
typo3/template.php

index d149b13..2067e56 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-17  Steffen Kamper  <steffen@typo3.org>
+
+       * Fixed bug #17592: ExtDirect API calls are splitted in single requests and slows down page loading
+
 2011-02-17  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #17616: htmlArea RTE: Link dialogue doesn't open when anchor class is set with double quotes
index defdf59..0b47a4d 100644 (file)
@@ -844,15 +844,13 @@ final class t3lib_extMgm {
         *
         * @param string $module
         * @param string $componentId
-        * @param array $extDirectNamespaces
         * @return void
         */
-       public static function addNavigationComponent($module, $componentId, $extDirectNamespaces = array()) {
+       public static function addNavigationComponent($module, $componentId) {
                $GLOBALS['TBE_MODULES']['_navigationComponents'][$module] = array(
                        'componentId' => $componentId,
                        'extKey' => $GLOBALS['_EXTKEY'],
                        'isCoreComponent' => FALSE,
-                       'extDirectNamespaces' => $extDirectNamespaces
                );
        }
 
@@ -861,11 +859,10 @@ final class t3lib_extMgm {
         *
         * @param string $module
         * @param string $componentId
-        * @param array $extDirectNamespaces
         * @return void
         */
-       public static function addCoreNavigationComponent($module, $componentId, $extDirectNamespaces = array()) {
-               self::addNavigationComponent($module, $componentId, $extDirectNamespaces);
+       public static function addCoreNavigationComponent($module, $componentId) {
+               self::addNavigationComponent($module, $componentId);
                $GLOBALS['TBE_MODULES']['_navigationComponents'][$module]['isCoreComponent'] = TRUE;
        }
 
index 2cdd6ee..d75c518 100644 (file)
@@ -941,14 +941,36 @@ class t3lib_PageRenderer implements t3lib_Singleton {
        /**
         * Adds the ExtDirect code
         *
+        * @param array $filterNamespaces  limit the output to defined namespaces. If empty, all namespaces are generated
         * @return void
         */
-       public function addExtDirectCode() {
+       public function addExtDirectCode(array $filterNamespaces = array()) {
                if ($this->extDirectCodeAdded) {
                        return;
                }
                $this->extDirectCodeAdded = TRUE;
-               $token = '';
+
+               if (count($filterNamespaces) === 0) {
+                       $filterNamespaces = array('TYPO3');
+               }
+
+                       // for ExtDirect we need flash message support
+               $this->addJsFile(t3lib_div::resolveBackPath($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js'));
+
+                       // add language labels for ExtDirect
+               if (TYPO3_MODE === 'FE') {
+                       $this->addInlineLanguageLabelArray(array(
+                               'extDirect_timeoutHeader' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xml:extDirect_timeoutHeader'),
+                               'extDirect_timeoutMessage' => $GLOBALS['TSFE']->sL('LLL:EXT:lang/locallang_misc.xml:extDirect_timeoutMessage'),
+                       ));
+               } else {
+                       $this->addInlineLanguageLabelArray(array(
+                               'extDirect_timeoutHeader' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:extDirect_timeoutHeader'),
+                               'extDirect_timeoutMessage' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:extDirect_timeoutMessage'),
+                       ));
+               }
+
+               $token = $api = '';
                if (TYPO3_MODE === 'BE') {
                        $formprotection = t3lib_formprotection_Factory::get();
                        $token = $formprotection->generateToken('extDirect');
@@ -999,8 +1021,8 @@ class t3lib_PageRenderer implements t3lib_Singleton {
                                if (event.code === Ext.Direct.exceptions.TRANSPORT && !event.where) {
                                        TYPO3.Flashmessage.display(
                                                TYPO3.Severity.error,
-                                               TYPO3.LLL.extDirect.timeoutHeader,
-                                               TYPO3.LLL.extDirect.timeoutMessage,
+                                               TYPO3.lang.extDirect_timeoutHeader,
+                                               TYPO3.lang.extDirect_timeoutMessage,
                                                30
                                        );
                                } else {
index 4b8ab00..806d274 100644 (file)
@@ -167,6 +167,7 @@ $t3libClasses = array(
        't3lib_spritemanager_spritebuildinghandler' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_spritebuildinghandler.php',
        't3lib_spritemanager_abstracthandler' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_abstracthandler.php',
        't3lib_extjs_extdirectdebug' => PATH_t3lib . 'extjs/class.t3lib_extjs_extdirectdebug.php',
+       't3lib_extjs_extdirectapi' => PATH_t3lib . 'extjs/class.t3lib_extjs_extdirectapi.php',
        't3lib_tree_abstracttree' => PATH_t3lib . 'tree/class.t3lib_tree_abstracttree.php',
        't3lib_tree_abstractdataprovider' => PATH_t3lib . 'tree/class.t3lib_tree_abstractdataprovider.php',
        't3lib_tree_abstractstateprovider' => PATH_t3lib . 'tree/class.t3lib_tree_abstractstateprovider.php',
index ad5efea..74897f4 100644 (file)
@@ -62,36 +62,8 @@ class t3lib_extjs_ExtDirectApi {
         * @return void
         */
        public function getAPI($ajaxParams, TYPO3AJAX $ajaxObj) {
-               $filterNamespace = t3lib_div::_GET('namespace');
-
-                       // Check GET-parameter no_cache and extCache setting
-               $extCache = isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache']) && (
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] === 0 ||
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] === '0'
-               );
-               $noCache = t3lib_div::_GET('no_cache') ? TRUE : $extCache;
-
-                       // look up into the cache
-               $cacheIdentifier = 'ExtDirectApi';
-               $cacheHash = md5($cacheIdentifier . $filterNamespace . t3lib_div::getIndpEnv('TYPO3_SSL') .
-                        serialize($this->settings) . TYPO3_MODE . t3lib_div::getIndpEnv('HTTP_HOST'));
-
-                       // with no_cache always generate the javascript content
-               $cacheContent = $noCache ? '' : t3lib_pageSelect::getHash($cacheHash);
-
-                       // generate the javascript content if it wasn't found inside the cache and cache it!
-               if (!$cacheContent) {
-                       $javascriptNamespaces = $this->generateAPI($filterNamespace);
-                       if (!empty($javascriptNamespaces)) {
-                               t3lib_pageSelect::storeHash(
-                                       $cacheHash,
-                                       serialize($javascriptNamespaces),
-                                       $cacheIdentifier
-                               );
-                       }
-               } else {
-                       $javascriptNamespaces = unserialize($cacheContent);
-               }
+               $ajaxObj->setContent(array());
+       }
 
                        // enable caching
                $expireDate = date('r', $GLOBALS['EXEC_TIME'] + 3600 * 24 * 30);
index 43c97cc..de3a5be 100644 (file)
@@ -342,16 +342,6 @@ class TYPO3backend {
                        foreach ($jsFiles as $jsFile) {
                                $this->pageRenderer->addJsFile($relativeComponentPath . 'javascript/' . $jsFile);
                        }
-
-                       if (is_array($info['extDirectNamespaces']) && count($info['extDirectNamespaces'])) {
-                               foreach ($info['extDirectNamespaces'] as $namespace) {
-                                       $this->pageRenderer->addJsFile(
-                                               'ajax.php?ajaxID=ExtDirect::getAPI&namespace=' . $namespace . '&' . TYPO3_version,
-                                               NULL,
-                                               FALSE
-                                       );
-                               }
-                       }
                }
        }
 
@@ -518,10 +508,6 @@ class TYPO3backend {
                                'helpDescriptionPages',
                                'helpDescriptionContent',
                        ),
-                       'extDirect' => array(
-                               'timeoutHeader',
-                               'timeoutMessage',
-                       ),
                        'viewPort' => array(
                                'tooltipModuleMenuSplit',
                                'tooltipNavigationContainerSplitDrag',
index 917493a..bba0cb2 100644 (file)
@@ -93,7 +93,6 @@ class LiveSearch implements backend_toolbarItem {
         */
        protected function addJavascriptToBackend() {
                $pageRenderer = $GLOBALS['TBE_TEMPLATE']->getPageRenderer();
-               $pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.LiveSearchActions&' . TYPO3_version, 'text/javascript', $compress = FALSE);
 
                $this->backendReference->addJavascriptFile('js/livesearch.js');
        }
index c433dae..5349e33 100644 (file)
@@ -1637,7 +1637,6 @@ $str.=$this->docBodyTagBegin().
        protected function loadCshJavascript() {
                $this->pageRenderer->loadExtJS();
                $this->pageRenderer->addJsFile($this->backPath .'../t3lib/js/extjs/contexthelp.js');
-               $this->pageRenderer->addJsFile($this->backPath . 'ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.CSH&' . TYPO3_version, NULL, FALSE);
                $this->pageRenderer->addExtDirectCode();
        }