Fixed bug #14896: ExtJS is not included when RTE is invoked by USER_INT frontend...
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 10 Jul 2010 22:22:00 +0000 (22:22 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 10 Jul 2010 22:22:00 +0000 (22:22 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8152 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php
typo3/sysext/rtehtmlarea/templates/rtehtmlarea_pageheader_frontend.html [new file with mode: 0644]

index 04b4121..c1b926c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-10  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14896: ExtJS is not included when RTE is invoked by USER_INT frontend script
+
 2010-07-09  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #15061: Remove XCLASS from t3lib_utility_Http (Thanks to Georg Ringer)
index 353beb8..829119c 100644 (file)
@@ -1,3 +1,7 @@
+2010-07-10  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14896: ExtJS is not included when RTE is invoked by USER_INT frontend script
+
 2010-07-04  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14929: htmlArea RTE: Font Family and Font Size Dropdown boxes don't open
index 07020e0..1cda109 100644 (file)
@@ -51,6 +51,10 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
        public $OutputCharset;
        var $specConf;
        var $LOCAL_LANG;
+       /**
+        * @var t3lib_PageRenderer
+        */
+       protected $pageRenderer;
 
        /**
         * Draws the RTE as an iframe
@@ -202,18 +206,19 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                 * LOAD JS, CSS and more
                 * =======================================
                 */
-               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
-               $pageRenderer->setBackPath(TYPO3_mainDir);
+               $pageRenderer = $this->getPageRenderer();
                        // Preloading the pageStyle and including RTE skin stylesheets
                $this->addPageStyle();
                $this->addSkin();
-               $pageRenderer->addCssFile($this->siteURL . 't3lib/js/extjs/ux/resize.css');
-                       // Loading JavaScript files and code
-               $pageRenderer->loadExtJs();
-               $pageRenderer->enableExtJSQuickTips();
-               if (!$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableCompressedScripts']) {
-                       $pageRenderer->enableExtJsDebug();
+                       // Loading ExtJs JavaScript files and inline code, if not configured in TS setup
+               if (!$GLOBALS['TSFE']->isINTincScript() || !is_array($GLOBALS['TSFE']->pSetup['javascriptLibs.']['ExtJs.'])) {
+                       $pageRenderer->loadExtJs();
+                       $pageRenderer->enableExtJSQuickTips();
+                       if (!$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableCompressedScripts']) {
+                               $pageRenderer->enableExtJsDebug();
+                       }
                }
+               $pageRenderer->addCssFile($this->siteURL . 't3lib/js/extjs/ux/resize.css');
                $pageRenderer->addJsFile($this->siteURL . 't3lib/js/extjs/ux/ext.resizable.js');
                if ($this->TCEform->RTEcounter == 1) {
                        $this->TCEform->additionalJS_pre['rtehtmlarea-loadJScode'] = $this->loadJScode($this->TCEform->RTEcounter);
@@ -224,7 +229,9 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                        'textareaMaxHeight' => '600'
                );
                $pageRenderer->addInlineSettingArray('', $resizableSettings);
-
+               if ($GLOBALS['TSFE']->isINTincScript()) {
+                       $GLOBALS['TSFE']->additionalHeaderData['rtehtmlarea'] = $pageRenderer->render();
+               }
                /* =======================================
                 * DRAW THE EDITOR
                 * =======================================
@@ -268,16 +275,7 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
         * @return      void
         */
        protected function addStyleSheet($key, $href, $title='', $relation='stylesheet') {
-               $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
-               $pageRenderer->addCssFile($href, $relation, 'screen', $title);
-       }
-       /**
-        * Return true if we are in the FE, but not in the FE editing feature of BE.
-        *
-        * @return boolean
-        */
-       function is_FE() {
-               return true;
+               $this->pageRenderer->addCssFile($href, $relation, 'screen', $title);
        }
        /**
         * Return the JS-Code for copy the HTML-Code from the editor in the hidden input field.
@@ -301,6 +299,25 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                        OK = 0;
                }';
        }
+       /**
+        * Gets instance of PageRenderer
+        *
+        * @return      t3lib_PageRenderer
+        */
+       public function getPageRenderer() {
+               if (!isset($this->pageRenderer)) {
+                       if ($GLOBALS['TSFE']->isINTincScript()) {
+                                       // We use an instance of t3lib_PageRenderer to render additional header data
+                                       // because this script is invoked after header has been rendered by $GLOBALS['TSFE']->getPageRenderer()
+                               $this->pageRenderer = t3lib_div::makeInstance('t3lib_PageRenderer');
+                               $this->pageRenderer->setTemplateFile($this->extHttpPath . 'templates/rtehtmlarea_pageheader_frontend.html');
+                       } else {
+                               $this->pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+                       }
+                       $this->pageRenderer->setBackPath(TYPO3_mainDir);
+               }
+               return $this->pageRenderer;
+       }
 }
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php']);
diff --git a/typo3/sysext/rtehtmlarea/templates/rtehtmlarea_pageheader_frontend.html b/typo3/sysext/rtehtmlarea/templates/rtehtmlarea_pageheader_frontend.html
new file mode 100644 (file)
index 0000000..847ebe5
--- /dev/null
@@ -0,0 +1,9 @@
+\r
+###CSS_INCLUDE###\r
+###CSS_INLINE###\r
+\r
+###JS_LIBS###\r
+###JS_INCLUDE###\r
+###JS_INLINE###\r
+\r
+###HEADERDATA###\r