From 9f1cf07fcde7bf5f014e9d98c78acc9c95c76ecb Mon Sep 17 00:00:00 2001 From: Benjamin Mack <benni@typo3.org> Date: Fri, 7 Feb 2014 09:12:52 +0100 Subject: [PATCH] [TASK] Remove rollover functionality from TMENU 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 --- .../Menu/TextMenuContentObject.php | 75 +------------------ 1 file changed, 3 insertions(+), 72 deletions(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php index b3d673f65c91..417a69a88888 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php @@ -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="')) { @@ -242,28 +208,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 @@ -277,19 +221,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 * -- GitLab