[TASK] Remove rollover functionality from TMENU 96/27396/2
authorBenjamin Mack <benni@typo3.org>
Fri, 7 Feb 2014 08:12:52 +0000 (09:12 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 7 Feb 2014 17:43:03 +0000 (18:43 +0100)
The TMENU code has "RO" functionality in its class.
This code might be used from TMENU_LAYERS, but
not from the core itself. The core should remove the
according places. If extensions need this functionality
they could implement their own menu functionality.

The patch itself just removes the functionality of
rollovers, which is currently not documented nor used.

The idea of the content object with its extProc classes
is outdated and should be replaced by hooks and/or
signal slots.

As all methods that are removed, are private, they can
IMHO be removed directly.

In a second patch, there will be a hook interface
in order to manipulate the items.

Releases: 6.2
Resolves: #55751
Change-Id: Ibd5862124a6f8bc9f06254234cfbf179893c27cc
Reviewed-on: https://review.typo3.org/27396
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php

index b3d673f..417a69a 100644 (file)
@@ -102,33 +102,7 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                                if (strlen($titleAttrValue)) {
                                        $this->I['linkHREF']['title'] = $titleAttrValue;
                                }
-                               // Make link:
-                               if ($this->I['val']['RO']) {
-                                       $this->I['theName'] = $this->imgNamePrefix . $this->I['uid'] . $this->I['INPfix'];
-                                       $over = '';
-                                       $out = '';
-                                       if ($this->I['val']['beforeROImg']) {
-                                               $over .= $this->WMfreezePrefix . 'over(\'' . $this->I['theName'] . 'before\');';
-                                               $out .= $this->WMfreezePrefix . 'out(\'' . $this->I['theName'] . 'before\');';
-                                       }
-                                       if ($this->I['val']['afterROImg']) {
-                                               $over .= $this->WMfreezePrefix . 'over(\'' . $this->I['theName'] . 'after\');';
-                                               $out .= $this->WMfreezePrefix . 'out(\'' . $this->I['theName'] . 'after\');';
-                                       }
-                                       $this->I['linkHREF']['onMouseover'] = $over;
-                                       $this->I['linkHREF']['onMouseout'] = $out;
-                                       if ($over || $out) {
-                                               $GLOBALS['TSFE']->setJS('mouseOver');
-                                       }
-                                       // Change background color:
-                                       if ($this->I['val']['RO_chBgColor']) {
-                                               $this->addJScolorShiftFunction();
-                                               $chBgP = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('|', $this->I['val']['RO_chBgColor']);
-                                               $this->I['linkHREF']['onMouseover'] .= 'changeBGcolor(\'' . $chBgP[2] . $this->I['uid'] . '\', \'' . $chBgP[0] . '\');';
-                                               $this->I['linkHREF']['onMouseout'] .= 'changeBGcolor(\'' . $chBgP[2] . $this->I['uid'] . '\', \'' . $chBgP[1] . '\');';
-                                       }
-                                       $this->extProc_RO($key);
-                               }
+
                                // Calling extra processing function
                                $this->extProc_beforeLinking($key);
                                // stdWrap for doNotLinkIt
@@ -213,16 +187,8 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
                $res = '';
                if ($imgInfo = $this->WMcObj->getImgResource($this->I['val'][$pref . 'Img'], $this->I['val'][$pref . 'Img.'])) {
                        $imgInfo[3] = \TYPO3\CMS\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick($imgInfo[3]);
-                       if ($this->I['val']['RO'] && $this->I['val'][$pref . 'ROImg'] && !$this->I['spacer']) {
-                               $imgROInfo = $this->WMcObj->getImgResource($this->I['val'][$pref . 'ROImg'], $this->I['val'][$pref . 'ROImg.']);
-                               $imgROInfo[3] = \TYPO3\CMS\Core\Utility\GeneralUtility::png_to_gif_by_imagemagick($imgROInfo[3]);
-                               if ($imgROInfo) {
-                                       $theName = $this->imgNamePrefix . $this->I['uid'] . $this->I['INPfix'] . $pref;
-                                       $name = ' ' . $this->nameAttribute . '="' . $theName . '"';
-                                       $GLOBALS['TSFE']->JSImgCode .= LF . $theName . '_n=new Image(); ' . $theName . '_n.src = "' . $GLOBALS['TSFE']->absRefPrefix . $imgInfo[3] . '"; ';
-                                       $GLOBALS['TSFE']->JSImgCode .= LF . $theName . '_h=new Image(); ' . $theName . '_h.src = "' . $GLOBALS['TSFE']->absRefPrefix . $imgROInfo[3] . '"; ';
-                               }
-                       }
+                       $theName = $this->imgNamePrefix . $this->I['uid'] . $this->I['INPfix'] . $pref;
+                       $name = ' ' . $this->nameAttribute . '="' . $theName . '"';
                        $GLOBALS['TSFE']->imagesOnPage[] = $imgInfo[3];
                        $res = '<img' . ' src="' . $GLOBALS['TSFE']->absRefPrefix . $imgInfo[3] . '"' . ' width="' . $imgInfo[0] . '"' . ' height="' . $imgInfo[1] . '"' . $name . ($this->I['val'][$pref . 'ImgTagParams'] ? ' ' . $this->I['val'][($pref . 'ImgTagParams')] : '') . \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getBorderAttr(' border="0"');
                        if (!strstr($res, 'alt="')) {
@@ -243,28 +209,6 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
        }
 
        /**
-        * Adds a JavaScript function to the $GLOBALS['TSFE']->additionalJavaScript array
-        *
-        * @return void
-        * @access private
-        * @see writeMenu()
-        * @todo Define visibility
-        */
-       public function addJScolorShiftFunction() {
-               $GLOBALS['TSFE']->additionalJavaScript['TMENU:changeBGcolor()'] = '
-                       function changeBGcolor(id,color) {      //
-                               if (document.getElementById && document.getElementById(id)) {
-                                       document.getElementById(id).style.background = color;
-                                       return true;
-                               } else if (document.layers && document.layers[id]) {
-                                       document.layers[id].bgColor = color;
-                                       return true;
-                               }
-                       }
-               ';
-       }
-
-       /**
         * Called right before the traversing of $this->result begins.
         * Can be used for various initialization
         *
@@ -278,19 +222,6 @@ class TextMenuContentObject extends \TYPO3\CMS\Frontend\ContentObject\Menu\Abstr
        }
 
        /**
-        * Called after all processing for RollOver of an element has been done.
-        *
-        * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
-        * @return void
-        * @access private
-        * @see writeMenu()
-        * @todo Define visibility
-        */
-       public function extProc_RO($key) {
-
-       }
-
-       /**
         * Called right before the creation of the link for the menu item
         *
         * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found