Bug #22809 » bug_14618.diff
t3lib/extjs/class.t3lib_extjs_extdirectapi.php (working copy) | ||
---|---|---|
public function getAPI($ajaxParams, TYPO3AJAX $ajaxObj) {
|
||
$filterNamespace = t3lib_div::_GET('namespace');
|
||
// Check parameter clear_cache
|
||
$clearCache = t3lib_div::_GET('clear_cache') ? TRUE : FALSE;
|
||
|
||
// look up into the cache
|
||
$cacheIdentifier = 'ExtDirectApi';
|
||
$cacheHash = md5($cacheIdentifier . $filterNamespace . serialize($this->settings));
|
||
$cacheContent = t3lib_pageSelect::getHash($cacheHash);
|
||
// generate the javascript content if it wasn't found inside the cache and cache it!
|
||
if (!$cacheContent) {
|
||
// if $clearCache is detected, replace the old cache by the new one
|
||
if (!$cacheContent || $clearCache) {
|
||
$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 {
|
||
$errorMessage[] = 'Ext Direct error in \"' . __CLASS__ . '\" with namespace: \"' . $filterNamespace .'\"';
|
||
$errorMessage[] = 'Try to clear the TYPO3 cache and / or use paramater clear_cache=1 as parameter in URL typo3/ajax.php';
|
||
$errorMessage[] = '\nCheck also the following points:';
|
||
$errorMessage[] = '- configuration in ext_localconf.php: registration key should be like \"TYPO3.MyExtension.Sample\"';
|
||
$errorMessage[] = '- URL typo3/ajax.php: namespace parameter should be like: \"TYPO3.MyExtension\"';
|
||
$errorMessage[] = '- javascript: method\'s name should be like: \"TYPO3.MyExtension.Sample.myMethod\"';
|
||
$ajaxObj->setContentFormat('javascript');
|
||
$ajaxObj->setJavascriptCallbackWrap('
|
||
errorMessage = "' . implode('\n', $errorMessage) . '";
|
||
if (typeof console == "object") {
|
||
console.log(errorMessage);
|
||
} else {
|
||
alert(errorMessage);
|
||
}
|
||
');
|
||
}
|
||
}
|
||
/**
|