From a75bac8c04cc922e198373d9fdd496908a980d3e Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Sun, 23 Sep 2012 00:25:27 +0200
Subject: [PATCH] [TASK] Fix deprecated $doc->isCMlayers()

Function TYPO3\CMS\Backend\Template\DocumentTemplate->isCMlayers()
is not needed and can be removed.

Change-Id: I7cef6a7711055c8cd6ce7ca0b3bf94b22e50a62f
Resolves: #41272
Releases: 6.0
Reviewed-on: http://review.typo3.org/14955
Reviewed-by: Mattias Nilsson
Tested-by: Mattias Nilsson
Reviewed-by: Oliver Klee
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
---
 .../backend/Classes/ClickMenu/ClickMenu.php   | 56 +++----------------
 .../Controller/ClickMenuController.php        | 12 +---
 .../FileSystemNavigationFrameController.php   |  4 +-
 .../PageTreeNavigationController.php          |  4 +-
 .../Classes/Template/DocumentTemplate.php     |  2 +-
 5 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php b/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
index 6cf5c0be2d70..7b36f7605870 100644
--- a/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
+++ b/typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
@@ -72,12 +72,6 @@ class ClickMenu {
 	 */
 	public $disabledItems = array();
 
-	// If TRUE, the context sensitive menu will not appear in the top frame, only as a layer.
-	/**
-	 * @todo Define visibility
-	 */
-	public $dontDisplayTopFrameCM = 0;
-
 	// If TRUE, Show icons on the left.
 	/**
 	 * @todo Define visibility
@@ -181,13 +175,11 @@ class ClickMenu {
 	 *
 	 * @return boolean
 	 * @todo Define visibility
+	 * @deprecated since TYPO3 6.0, will be removed in 6.2 as there is no click menu in the topframe anymore (no topframe at all actually)
 	 */
 	public function doDisplayTopFrameCM() {
-		if ($this->ajax) {
-			return FALSE;
-		} else {
-			return !$GLOBALS['SOBE']->doc->isCMlayers() || !$this->dontDisplayTopFrameCM;
-		}
+		\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
+		return FALSE;
 	}
 
 	/***************************************
@@ -1007,8 +999,7 @@ class ClickMenu {
 	 *
 	 **************************************/
 	/**
-	 * Prints the items from input $menuItems array - both as topframe menu AND the JS section for writing to the div-layers.
-	 * Of course the topframe menu will appear only if $this->doDisplayTopFrameCM() returns TRUE
+	 * Prints the items from input $menuItems array - as JS section for writing to the div-layers.
 	 *
 	 * @param array $menuItems Array
 	 * @param string $item HTML code for the element which was clicked - shown in the end of the horizontal menu in topframe after the close-button.
@@ -1021,34 +1012,6 @@ class ClickMenu {
 		$menuItems = $this->enableDisableItems($menuItems);
 		// Clean up spacers:
 		$menuItems = $this->cleanUpSpacers($menuItems);
-		// Adding topframe part (horizontal clickmenu)
-		if ($this->doDisplayTopFrameCM()) {
-			$out .= '
-
-				<!--
-					Table, which contains the click menu when shown in the top frame of the backend:
-				-->
-				<table border="0" cellpadding="0" cellspacing="0" id="typo3-CSM-top">
-					<tr>
-
-							<!-- Items: -->
-						<td class="c-item">' . implode(('</td>
-						<td><img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($this->PH_backPath, 'gfx/acm_spacer2.gif', 'width="8" height="12"') . ' alt="" /></td>
-						<td class="c-item">'), $this->menuItemsForTopFrame($menuItems)) . '</td>
-
-							<!-- Close button: -->
-						<td class="c-closebutton"><a href="#" onclick="hideCM();return false;">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array(
-				'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close', 1)
-			)) . '</a></td>
-
-							<!-- The item of the clickmenu: -->
-						<td class="c-itemicon">' . $item . '</td>
-					</tr>
-				</table>
-			';
-			// Set remaining BACK_PATH to blank (if any)
-			$out = str_replace($this->PH_backPath, '', $out);
-		}
 		// Adding JS part:
 		$out .= $this->printLayerJScode($menuItems);
 		// Return the content
@@ -1089,7 +1052,8 @@ class ClickMenu {
 				if (top.content && top.content' . $frameName . ' && top.content' . $frameName . '.Clickmenu) {
 					top.content' . $frameName . '.Clickmenu.populateData(unescape("' . GeneralUtility::rawurlencodeJS($CMtable) . '"),' . $this->cmLevel . ');
 				}
-				' . (!$this->doDisplayTopFrameCM() ? 'hideCM();' : ''));
+				hideCM();
+				');
 				return $script;
 			}
 		}
@@ -1378,11 +1342,7 @@ class ClickMenu {
 	 * @todo Define visibility
 	 */
 	public function isCMlayers() {
-		if ($this->ajax) {
-			return !$this->CB;
-		} else {
-			return $GLOBALS['SOBE']->doc->isCMlayers() && !$this->CB;
-		}
+		return !$this->CB;
 	}
 
 	/**
@@ -1399,4 +1359,4 @@ class ClickMenu {
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/typo3/sysext/backend/Classes/Controller/ClickMenuController.php b/typo3/sysext/backend/Classes/Controller/ClickMenuController.php
index e0b3394b6e76..766ce70a2b50 100644
--- a/typo3/sysext/backend/Classes/Controller/ClickMenuController.php
+++ b/typo3/sysext/backend/Classes/Controller/ClickMenuController.php
@@ -55,12 +55,6 @@ class ClickMenuController {
 	 */
 	public $extClassArray = array();
 
-	// If set, then the clickmenu will NOT display in the top frame.
-	/**
-	 * @todo Define visibility
-	 */
-	public $dontDisplayTopFrameCM = 0;
-
 	/**
 	 * Constructor function for script class.
 	 *
@@ -97,10 +91,7 @@ class ClickMenuController {
 			$this->doc->backPath = $GLOBALS['BACK_PATH'];
 		}
 		// Setting mode for display and background image in the top frame
-		$this->dontDisplayTopFrameCM = $this->doc->isCMlayers() && !$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.alwaysShowClickMenuInTopFrame');
-		if ($this->dontDisplayTopFrameCM) {
-			$this->doc->bodyTagId .= '-notop';
-		}
+
 		// Setting clickmenu timeout
 		$secs = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.clickMenuTimeOut'), 1, 100, 5);
 		// default is 5
@@ -175,7 +166,6 @@ class ClickMenuController {
 		// Set internal vars in clickmenu object:
 		$clickMenu->clipObj = $clipObj;
 		$clickMenu->extClassArray = $this->extClassArray;
-		$clickMenu->dontDisplayTopFrameCM = $this->dontDisplayTopFrameCM;
 		$clickMenu->backPath = $this->backPath;
 		// Start page
 		if (!$this->ajax) {
diff --git a/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php b/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
index f864a435b715..9b2c99aaa4c8 100644
--- a/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
+++ b/typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
@@ -169,7 +169,7 @@ class FileSystemNavigationFrameController {
 		// Adding javascript for drag & drop activation and highlighting
 		$this->content .= $this->doc->wrapScriptTags('
 			' . ($this->doHighlight ? 'Tree.highlightActiveItem("", top.fsMod.navFrameHighlightedID["file"]);' : '') . '
-			' . (!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();'));
+			Tree.registerDragDropHandlers();');
 		// Setting up the buttons and markers for docheader
 		$docHeaderButtons = $this->getButtons();
 		$markers = array(
@@ -239,4 +239,4 @@ class FileSystemNavigationFrameController {
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php b/typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
index 9b4b8f03f147..722d58df7b03 100644
--- a/typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
+++ b/typo3/sysext/backend/Classes/Controller/PageTreeNavigationController.php
@@ -178,7 +178,7 @@ class PageTreeNavigationController {
 		// Adding javascript for drag & drop activation and highlighting
 		$this->content .= $this->doc->wrapScriptTags('
 			' . ($this->doHighlight ? 'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '') . '
-			' . (!$this->doc->isCMlayers() ? 'Tree.activateDragDrop = false;' : 'Tree.registerDragDropHandlers();'));
+			Tree.registerDragDropHandlers();');
 		// Setting up the buttons and markers for docheader
 		$docHeaderButtons = $this->getButtons();
 		$markers = array(
@@ -329,4 +329,4 @@ class PageTreeNavigationController {
 }
 
 
-?>
\ No newline at end of file
+?>
diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
index abbb73001a62..42d96f8698f0 100644
--- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
+++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php
@@ -1521,7 +1521,7 @@ class DocumentTemplate {
 		$this->loadJavascriptLib('js/clickmenu.js');
 		$this->JScodeArray['clickmenu'] = '
 			Clickmenu.clickURL = "' . $this->backPath . 'alt_clickmenu.php";
-			Clickmenu.ajax     = ' . ($this->isCMLayers() ? 'true' : 'false') . ';';
+			Clickmenu.ajax     = true;';
 	}
 
 	/**
-- 
GitLab