From 62ae4cf783e4c61795394dccee7263b58188f63d Mon Sep 17 00:00:00 2001 From: Jeff Segars Date: Wed, 16 Sep 2009 14:33:09 +0000 Subject: [PATCH] Added feature #11819: Added inline Javascript rendering type for TYPO3AJAX git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5945 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 4 ++++ typo3/classes/class.typo3ajax.php | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e513e72f4eb0..2059af207821 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-09-16 Jeff Segars + + * Added feature #11819: Added inline Javascript rendering type for TYPO3AJAX + 2009-09-16 Rupert Germann * Fixed bug #11905: Extension Manager is not translatable (part 3) (thanks to Christopher Stelmaszyk) diff --git a/typo3/classes/class.typo3ajax.php b/typo3/classes/class.typo3ajax.php index 9ce2eed38bad..141456704d38 100644 --- a/typo3/classes/class.typo3ajax.php +++ b/typo3/classes/class.typo3ajax.php @@ -142,7 +142,7 @@ class TYPO3AJAX { * @return void */ public function setContentFormat($format) { - if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody'), $format)) { + if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody', 'javascript'), $format)) { $this->contentFormat = $format; } } @@ -186,6 +186,9 @@ class TYPO3AJAX { case 'json': $this->renderAsJSON(); break; + case 'javascript': + $this->renderAsJavascript(); + break; case 'xml': $this->renderAsXML(); break; @@ -259,6 +262,25 @@ class TYPO3AJAX { echo $content; } } + + /** + * Renders the AJAX call as inline JSON inside a script tag. This is useful + * when an iframe is used as the AJAX transport. + * + * @return void + */ + protected function renderAsJavascript() { + $content = ''; + + header('Content-type: text/html; charset=' . $this->charset); + echo $content; + } } -- 2.20.1