Bug #22809 » 14618_v2.diff
t3lib/extjs/class.t3lib_extjs_extdirectapi.php (working copy) | ||
---|---|---|
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);
|
||
}
|
||
... | ... | |
$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);
|
||
}
|
||
');
|
||
}
|
||
}
|
||
/**
|
||
... | ... | |
$numberOfParameters = $reflectionMethod->getNumberOfParameters();
|
||
$docHeader = $reflectionMethod->getDocComment();
|
||
$formHandler = (strpos($docHeader, '@formHandler') !== FALSE);
|
||
|
||
$javascriptNamespaces[$javascriptNamespace]['actions'][$javascriptObjectName][] = array(
|
||
'name' => $methodName,
|
||
'len' => $numberOfParameters,
|
typo3/backend.php (working copy) | ||
---|---|---|
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);
|
||
typo3/sysext/lang/locallang_core.xml (working copy) | ||
---|---|---|
<label index="donateWindow.button_donate">Donate now</label>
|
||
<label index="donateWindow.button_disable">Never show again</label>
|
||
<label index="donateWindow.button_postpone">Remind me later</label>
|
||
<label index="ExtDirect.namespaceError">Ext Direct error in "%s" with namespace: "%s"
|
||
Try to clear the TYPO3 cache and / or use paramater no_cache=1 as parameter in URL typo3/ajax.php
|
||
Check also the following points:
|
||
- configuration in ext_localconf.php: registration key should be like "TYPO3.MyExtension.Sample"
|
||
- URL typo3/ajax.php: namespace parameter should be like: "TYPO3.MyExtension"
|
||
- javascript: method\'s name should be like: "TYPO3.MyExtension.Sample.myMethod"</label>
|
||
<label index="ExtDirect.noNamespace">Ext Direct error in "%s": no namespace has been found.</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|