* Fixed bug #7698: htmlArea RTE fails to load due to missing toolbar constraints
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 27 Feb 2008 22:54:26 +0000 (22:54 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 27 Feb 2008 22:54:26 +0000 (22:54 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3311 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php
typo3/sysext/rtehtmlarea/doc/manual.sxw
typo3/sysext/rtehtmlarea/extensions/TYPO3Link/class.tx_rtehtmlarea_typo3link.php
typo3/sysext/rtehtmlarea/extensions/TableOperations/class.tx_rtehtmlarea_tableoperations.php

index 7024b25..47aa065 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2008-02-27  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug #7697: Syntax error raised by Mozilla 1.7 when loading htmlArea RTE
+       * Fixed bug #7698: htmlArea RTE fails to load due to missing toolbar constraints
 
 2008-02-27  Martin Kutschker  <martin.t.kutschker@blackbox.net>
 
index f56f920..e8e7ae5 100644 (file)
@@ -1,6 +1,7 @@
 2008-02-27  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Fixed bug #7697: Syntax error raised by Mozilla 1.7 when loading htmlArea RTE
+       * Fixed bug #7698: htmlArea RTE fails to load due to missing toolbar constraints
 
 2008-02-26  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
index eba754e..978e9e1 100644 (file)
@@ -635,7 +635,13 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                
                        // Hiding the buttons
                $show = array_diff($show, $this->conf_toolbar_hide, $hideButtons, t3lib_div::trimExplode(',',$this->thisConfig['hideButtons'],1));
-
+               
+                       // Apply toolbar constraints from registered plugins
+               foreach ($this->registeredPlugins as $pluginId => $plugin) {
+                       if ($this->isPluginEnabled($pluginId) && method_exists($plugin, "applyToolbarConstraints")) {
+                               $show = $plugin->applyToolbarConstraints($show);
+                       }
+               }
                        // Adding the always show buttons
                $show = array_unique(array_merge($show, $this->conf_toolbar_show));
                $toolbarOrder = array_unique(array_merge($toolbarOrder, $this->conf_toolbar_show));
index 18211c5..e246e59 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index 16ac212..d1591ef 100644 (file)
@@ -73,7 +73,7 @@ class tx_rtehtmlarea_typo3link extends tx_rtehtmlareaapi {
                if (in_array($button, $this->toolbar)) {
                        if (!is_array( $this->thisConfig['buttons.']) || !is_array( $this->thisConfig['buttons.'][$button.'.'])) {
                                        $registerRTEinJavascriptString .= '
-                       RTEarea['.$RTEcounter.']["buttons"]["'. $button .'"] = new Object();';
+                       RTEarea['.$RTEcounter.'].buttons.'. $button .' = new Object();';
                        }
                        $registerRTEinJavascriptString .= '
                        RTEarea['.$RTEcounter.'].buttons.'. $button .'.pathLinkModule = "../../mod3/browse_links.php";';
@@ -96,7 +96,7 @@ class tx_rtehtmlarea_typo3link extends tx_rtehtmlareaapi {
         *
         * @return      string          classesAnchor array definition
         */
-       function buildJSClassesAnchorArray() {
+       public function buildJSClassesAnchorArray() {
                global $LANG, $TYPO3_CONF_VARS;
                
                $linebreak = $TYPO3_CONF_VARS['EXTCONF'][$this->htmlAreaRTE->ID]['enableCompressedScripts'] ? '' : chr(10);
@@ -130,7 +130,23 @@ class tx_rtehtmlarea_typo3link extends tx_rtehtmlareaapi {
                }       
                $JSClassesAnchorArray .= '];' . $linebreak;
                return $JSClassesAnchorArray;
-        }
+       }
+        
+       /**
+        * Return an updated array of toolbar enabled buttons
+        *
+        * @param       array           $show: array of toolbar elements that will be enabled, unless modified here
+        *
+        * @return      array           toolbar button array, possibly updated
+        */
+       public function applyToolbarConstraints($show) {
+                       // We will not allow unlink if link is not enabled
+               if (!in_array('link', $show)) {
+                       return array_diff($show, t3lib_div::trimExplode(',', $this->pluginButtons));
+               } else {
+                       return $show;
+               }
+       }
 
 } // end of class
 
index 4232ccb..2798488 100644 (file)
@@ -141,6 +141,23 @@ class tx_rtehtmlarea_tableoperations extends tx_rtehtmlareaapi {
                }
                return $registerRTEinJavascriptString;
        }
+       
+        
+       /**
+        * Return an updated array of toolbar enabled buttons
+        *
+        * @param       array           $show: array of toolbar elements that will be enabled, unless modified here
+        *
+        * @return      array           toolbar button array, possibly updated
+        */
+       public function applyToolbarConstraints($show) {
+                       // We will not allow any table operations button if the table button is not enabled
+               if (!in_array('table', $show)) {
+                       return array_diff($show, t3lib_div::trimExplode(',', $this->pluginButtons));
+               } else {
+                       return $show;
+               }
+       }
 
 } // end of class