Further follow-up to issue #14494: htmlArea RTE: backpath is not correctly set when...
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 27 May 2010 21:23:59 +0000 (21:23 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 27 May 2010 21:23:59 +0000 (21:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7703 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/extensions/SpellChecker/class.tx_rtehtmlarea_spellchecker.php
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php

index 0227c31..cd1b9e4 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
        * Fixed bug #14491: htmlArea RTE: disableColorPicker not always honoured
        * Fixed bug #14494: htmlArea RTE: backpath is not correctly set
        * Follow-up to issue #14494: htmlArea RTE: backpath is not correctly set
+       * Further follow-up to issue #14494: htmlArea RTE: backpath is not correctly set
 
 2010-05-27  Oliver Hader  <oliver@typo3.org>
 
index 57a53e3..709b09d 100644 (file)
@@ -4,6 +4,7 @@
        * Fixed bug #14491: htmlArea RTE: disableColorPicker not always honoured
        * Fixed bug #14494: htmlArea RTE: backpath is not correctly set
        * Follow-up to issue #14494: htmlArea RTE: backpath is not correctly set
+       * Further follow-up to issue #14494: htmlArea RTE: backpath is not correctly set
 
 2010-05-25  Stanislas Rolland  <typo3@sjbr.ca>
 
index a36dc4d..e7257ac 100644 (file)
@@ -83,6 +83,7 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
        public $RTEdivStyle;
                // Relative path to this extension. It ends with "/"
        public $extHttpPath;
+       public $backPath = '';
                // TYPO3 site url
        public $siteURL;
                // TYPO3 host url
@@ -209,8 +210,10 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                         * INIT THE EDITOR-SETTINGS
                         * =======================================
                         */
+                               // Set backPath
+                       $this->backPath = $this->isFrontendEditActive() ? '' : $this->TCEform->backPath;
                                // Get the path to this extension:
-                       $this->extHttpPath = $this->TCEform->backPath . t3lib_extMgm::extRelPath($this->ID);
+                       $this->extHttpPath = $this->backPath . ($this->isFrontendEditActive() ? t3lib_extMgm::siteRelPath($this->ID) : t3lib_extMgm::extRelPath($this->ID));
                                // Get the site URL
                        $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
                                // Get the host URL
@@ -1110,7 +1113,11 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                if ($this->is_FE()) {
                        return ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . t3lib_div::createVersionNumberedFilename($relativeFilename);
                } else {
-                       return t3lib_div::createVersionNumberedFilename('../' . $this->TCEform->backPath . $relativeFilename);
+                       $filename = t3lib_div::createVersionNumberedFilename('../' . $this->backPath . $relativeFilename);
+                       if ($this->isFrontendEditActive()) {
+                               $filename = preg_replace('/^..\//', '', $filename);
+                       }
+                       return $filename;
                }
        }
        /**
@@ -1147,9 +1154,12 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                } else {
                        if ($compress) {
                                $compressor = t3lib_div::makeInstance('t3lib_compressor');
-                               $filename = $compressor->compressJsFile('../' . $this->TCEform->backPath  . $relativeFilename);
+                               $filename = $compressor->compressJsFile('../' . $this->backPath  . $relativeFilename);
                        } else {
-                               $filename = t3lib_div::createVersionNumberedFilename('../' . $this->TCEform->backPath  . $relativeFilename);
+                               $filename = t3lib_div::createVersionNumberedFilename('../' . $this->backPath  . $relativeFilename);
+                       }
+                       if ($this->isFrontendEditActive()) {
+                               $filename = preg_replace('/^..\//', '', $filename);
                        }
                }
                return $filename;
@@ -1305,12 +1315,12 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        list($extKey,$local) = explode('/',substr($filename,4),2);
                        $newFilename = '';
                        if (strcmp($extKey,'') &&  t3lib_extMgm::isLoaded($extKey) && strcmp($local,'')) {
-                               $newFilename = ($this->is_FE() ? t3lib_extMgm::siteRelPath($extKey) : $this->TCEform->backPath . t3lib_extMgm::extRelPath($extKey)) . $local;
+                               $newFilename = ($this->is_FE() ? t3lib_extMgm::siteRelPath($extKey) : $this->backPath . t3lib_extMgm::extRelPath($extKey)) . $local;
                        }
                } elseif (substr($filename,0,1) != '/') {
-                       $newFilename = ($this->is_FE() ? '' : '../' . $this->TCEform->backPath) . $filename;
+                       $newFilename = ($this->is_FE() ? '' : ($this->isFrontendEditActive() ? '' : '../') . $this->backPath) . $filename;
                } else {
-                       $newFilename = ($this->is_FE() ? '' : '../' . $this->TCEform->backPath) . substr($filename, 1);
+                       $newFilename = ($this->is_FE() ? '' : ($this->isFrontendEditActive() ? '' : '../') . $this->backPath) . substr($filename, 1);
                }
                return  $newFilename;
        }
@@ -1350,8 +1360,16 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         */
 
        function is_FE() {
-               global $TSFE;
-               return is_object($TSFE) && is_array($this->LOCAL_LANG) && !strstr($this->elementId,'TSFE_EDIT');
+               return is_object($GLOBALS['TSFE']) && !$this->isFrontendEditActive();
+       }
+       
+       /**
+        * Checks whether frontend editing is active.
+        *
+        * @return              boolean
+        */
+       public function isFrontendEditActive() {
+               return is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit);
        }
 
        /**
index 1b3bf5b..8d61899 100644 (file)
@@ -96,7 +96,7 @@ class tx_rtehtmlarea_spellchecker extends tx_rtehtmlareaapi {
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.spellCheckerMode = "' . $spellCheckerMode .'";
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.enablePersonalDicts = ' . ($enablePersonalDicts ? 'true' : 'false') .';';
                        $registerRTEinJavascriptString .= '
-                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.path = "' . ($this->htmlAreaRTE->is_FE() ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : $this->htmlAreaRTE->TCEform->backPath . 'ajax.php?ajaxID=rtehtmlarea::spellchecker') . '";';
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .'.path = "' . (($this->htmlAreaRTE->is_FE() || $this->htmlAreaRTE->isFrontendEditActive()) ? ($GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '') . 'index.php?eID=rtehtmlarea_spellchecker' : $this->htmlAreaRTE->backPath . 'ajax.php?ajaxID=rtehtmlarea::spellchecker') . '";';
                }
                return $registerRTEinJavascriptString;
        }
index a152a4d..281a442 100644 (file)
@@ -2845,8 +2845,8 @@ HTMLArea.util.TYPO3 = function () {
                        var docHeader = Ext.get('typo3-docheader');
                        if (docHeader) {
                                size.height -= docHeader.getHeight();
+                               docHeader.dom = null;
                        }
-                       docHeader.dom = null;
                        return size;
                }
        }
index 780b3af..80847e6 100644 (file)
@@ -81,7 +81,7 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                        // Get the path to this extension:
                $this->extHttpPath = t3lib_extMgm::siteRelPath($this->ID);
                        // Get the site URL
-               $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
+               $this->siteURL = $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '';
                        // Get the host URL
                $this->hostURL = '';
                        // Element ID + pid
@@ -207,14 +207,14 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                        // Preloading the pageStyle and including RTE skin stylesheets
                $this->addPageStyle();
                $this->addSkin();
-               $pageRenderer->addCssFile($this->hostURL . '/t3lib/js/extjs/ux/resize.css');
+               $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();
                }
-               $pageRenderer->addJsFile($this->hostURL . '/t3lib/js/extjs/ux/ext.resizable.js');
+               $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);
                }
@@ -273,6 +273,14 @@ class tx_rtehtmlarea_pi2 extends tx_rtehtmlarea_base {
                $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;
+       }
+       /**
         * Return the JS-Code for copy the HTML-Code from the editor in the hidden input field.
         * This is for submit function from the form.
         *