* Fixed bug 4183: Incorrect display in htmlArea RTE of utf-8 labels for colors, class...
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 16 Oct 2007 14:40:04 +0000 (14:40 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 16 Oct 2007 14:40:04 +0000 (14:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-1@2568 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php

index 653cc0b..b438703 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-16  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Fixed bug 4183: Incorrect display in htmlArea RTE of utf-8 labels for colors, classes and fonts defined in PageTSConfig
+
 2007-10-15  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug 5855: Missing unlink icon in htmlArea RTE
index bdcbb1e..7ee90d1 100644 (file)
@@ -1,3 +1,7 @@
+2007-10-16  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
+
+       * Fixed bug 4183: Incorrect display in htmlArea RTE of utf-8 labels for colors, classes and fonts defined in PageTSConfig
+
 2007-10-15  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug 5855: Missing unlink icon in htmlArea RTE
index c815f58..3ed264f 100644 (file)
@@ -1272,14 +1272,10 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                if (is_array($RTEProperties['fonts.'])) {
                        reset($RTEProperties['fonts.']);
                        while(list($fontName,$conf)=each($RTEProperties['fonts.'])) {
-                               $fontName=substr($fontName,0,-1);
-                               if ($this->is_FE()) {
-                                       $string = $TSFE->sL($conf['name']);
-                               } else {
-                                       $string = $LANG->sL($conf['name']);
-                               }
+                               $fontName = substr($fontName,0,-1);
+                               $fontLabel = $this->getPageConfigLabel($conf['name'],0);
                                $HTMLAreaFontname[$fontName] = '
-                               "' . str_replace('"', '\"', str_replace('\\\'', '\'', $string)) . '" : "' . $this->cleanList($conf['value']) . '"';
+                               "' . $fontLabel . '" : "' . $this->cleanList($conf['value']) . '"';
                        }
                }
                
@@ -1333,15 +1329,9 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        reset($RTEProperties['colors.']);
                        while(list($colorName,$conf)=each($RTEProperties['colors.']))      {
                                $colorName=substr($colorName,0,-1);
-                               if ($this->is_FE()) {
-                                       $string = $TSFE->csConvObj->conv($TSFE->sL(trim($conf['name'])), $TSFE->renderCharset, $TSFE->metaCharset);
-                                       $string = str_replace('"', '\"', str_replace('\\\'', '\'', $string));
-                                       $string = $this->feJScharCode($string);
-                               } else {
-                                       $string = $this->getLLContent(trim($conf['name']));
-                               }
+                               $colorLabel = $this->getPageConfigLabel($conf['name']);
                                $HTMLAreaColorname[$colorName] = '
-                               [' . $string . ' , "' . $conf['value'] . '"]';
+                               [' . $colorLabel . ' , "' . $conf['value'] . '"]';
                        }
                }
                
@@ -1467,14 +1457,8 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        reset($RTEProperties['classes.']);
                        while(list($className,$conf)=each($RTEProperties['classes.'])) {
                                $className = substr($className,0,-1);
-                               if ($this->is_FE()) {
-                                       $string = $TSFE->csConvObj->conv($TSFE->sL(trim($conf['name'])), $TSFE->renderCharset, $TSFE->metaCharset);
-                                       $string = str_replace('"', '\"', str_replace('\\\'', '\'', $string));
-                                       $string = $this->feJScharCode($string);
-                               } else {
-                                       $string = $this->getLLContent(trim($conf['name']));
-                               }
-                               $JSClassesLabelsArray .= (($index)?',':'') . '"' . $className . '": ' . $string . $linebreak;
+                               $classLabel = $this->getPageConfigLabel($conf['name']);
+                               $JSClassesLabelsArray .= (($index)?',':'') . '"' . $className . '": ' . $classLabel . $linebreak;
                                $JSClassesValuesArray .= (($index)?',':'') . '"' . $className . '":"' . str_replace('"', '\"', str_replace('\\\'', '\'', $conf['value'])) . '"' . $linebreak;
                                $JSClassesNoShowArray .= (($index)?',':'') . '"' . $className . '":' . ($conf['noShow']?'true':'false') . $linebreak;
                                $index++;
@@ -1814,6 +1798,25 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                return $LLString;
        }
        
+       function getPageConfigLabel($string,$JScharCode=1) {
+               global $LANG, $TSFE;
+               
+               if ($this->is_FE()) {
+                       $label = $TSFE->csConvObj->conv($TSFE->sL(trim($string)), $TSFE->renderCharset, $TSFE->metaCharset);
+                       $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
+                       $label = $JScharCode ? $this->feJScharCode($label) : $label;
+               } else {
+                       if (strcmp(substr($string,0,4),'LLL:')) {
+                               $label = $string;
+                       } else {
+                               $label = $LANG->sL(trim($string));
+                       }
+                       $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
+                       $label = $JScharCode ? $LANG->JScharCode($label): $label;
+               }
+               return $label;
+       }
+       
        function feJScharCode($str) {
                global $TSFE;
                        // Convert string to UTF-8: