Index: t3lib/extjs/class.t3lib_extjs_extdirectapi.php =================================================================== --- t3lib/extjs/class.t3lib_extjs_extdirectapi.php (revision 7835) +++ t3lib/extjs/class.t3lib_extjs_extdirectapi.php (working copy) @@ -64,19 +64,26 @@ public function getAPI($ajaxParams, TYPO3AJAX $ajaxObj) { $filterNamespace = t3lib_div::_GET('namespace'); - // look up into the cache + // Check GET-parameter no_cache and extCache setting + $noCache = t3lib_div::_GET('no_cache') ? TRUE : ($GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] === '0'); + + // look up into the cache $cacheIdentifier = 'ExtDirectApi'; $cacheHash = md5($cacheIdentifier . $filterNamespace . serialize($this->settings)); - $cacheContent = t3lib_pageSelect::getHash($cacheHash); + // 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! + // generate the javascript content if it wasn't found inside the cache and cache it! if (!$cacheContent) { + $javascriptNamespaces = $this->generateAPI($filterNamespace); - t3lib_pageSelect::storeHash( - $cacheHash, - serialize($javascriptNamespaces), - $cacheIdentifier - ); + if (!empty($javascriptNamespaces)) { + t3lib_pageSelect::storeHash( + $cacheHash, + serialize($javascriptNamespaces), + $cacheIdentifier + ); + } } else { $javascriptNamespaces = unserialize($cacheContent); } @@ -104,6 +111,30 @@ $setup . 'Ext.app.ExtDirectAPI = Object.extend(Ext.app.ExtDirectAPI, |);' ); } + else { + if ($filterNamespace) { + // namespace error + $errorMessage = sprintf($GLOBALS['lang']->sL('LLL:EXT:lang/locallang_core.xml:ExtDirect.namespaceError'), + __CLASS__, $filterNamespace + ); + } + else { + // no namespace given + $errorMessage[] = sprintf($GLOBALS['lang']->sL('LLL:EXT:lang/locallang_core.xml:ExtDirect.noNamespace'), + __CLASS__ + ); + } + + $ajaxObj->setContentFormat('javascript'); + $ajaxObj->setJavascriptCallbackWrap(' + errorMessage = "' . $errorMessage . '"; + if (typeof console == "object") { + console.log(errorMessage); + } else { + alert(errorMessage); + } + '); + } } /** @@ -142,7 +173,7 @@ $numberOfParameters = $reflectionMethod->getNumberOfParameters(); $docHeader = $reflectionMethod->getDocComment(); $formHandler = (strpos($docHeader, '@formHandler') !== FALSE); - + $javascriptNamespaces[$javascriptNamespace]['actions'][$javascriptObjectName][] = array( 'name' => $methodName, 'len' => $numberOfParameters, Index: typo3/backend.php =================================================================== --- typo3/backend.php (revision 7835) +++ typo3/backend.php (working copy) @@ -247,9 +247,21 @@ foreach ($this->jsFiles as $jsFile) { $this->pageRenderer->addJsFile($jsFile); } - // we mustn't compress this file - $this->pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend', NULL, FALSE); + // Those lines can be removed once we have at least one official ExtDirect router within the backend. + $hasExtDirectRouter = FALSE; + if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'] as $key => $value) { + if (strpos($key, 'TYPO3.Backend') !== FALSE) { + $hasExtDirectRouter = TRUE; + break; + } + } + } + if ($hasExtDirectRouter) { + $this->pageRenderer->addJsFile('ajax.php?ajaxID=ExtDirect::getAPI&namespace=TYPO3.Backend', NULL, FALSE); + } + $this->generateJavascript(); $this->pageRenderer->addJsInlineCode('BackendInlineJavascript', $this->js); Index: typo3/sysext/lang/locallang_core.xml =================================================================== --- typo3/sysext/lang/locallang_core.xml (revision 7835) +++ typo3/sysext/lang/locallang_core.xml (working copy) @@ -272,6 +272,13 @@ + +