From ce498d33de2d71ff968955e001dc6a76e040c19c Mon Sep 17 00:00:00 2001
From: Benjamin Mack <benni@typo3.org>
Date: Wed, 15 Jul 2015 00:32:47 +0200
Subject: [PATCH] [TASK] Remove tree code in element browser selection

Resolves: #68144
Releases: master
Change-Id: I37b34fcd132718c18d8c7483d3e9df3b481ec764
Reviewed-on: http://review.typo3.org/41256
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Public/Less/TYPO3/_element_tree.less      |  6 +++++
 .../Classes/Browser/ElementBrowser.php        | 25 +++----------------
 .../Resources/Public/Css/visual/t3skin.css    |  3 +++
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/Build/Resources/Public/Less/TYPO3/_element_tree.less b/Build/Resources/Public/Less/TYPO3/_element_tree.less
index 2bcc08231185..72d3992eca26 100644
--- a/Build/Resources/Public/Less/TYPO3/_element_tree.less
+++ b/Build/Resources/Public/Less/TYPO3/_element_tree.less
@@ -165,6 +165,12 @@ body#imp-exp-mod ul#treeRoot {
 	}
 }
 
+ul#flatTreeRoot {
+	li:last-child:before {
+		background-color: #f1f1f1;
+	}
+}
+
 //
 // Configuration trees, used in Admin Tools => Configuration
 //
diff --git a/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php b/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
index 93235fb61fdc..84f154945769 100644
--- a/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
+++ b/typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
@@ -1603,7 +1603,7 @@ class ElementBrowser {
 			$db = $this->getDatabaseConnection();
 			$picon = IconUtility::getSpriteIconForRecord('pages', $mainPageRec);
 			$picon .= BackendUtility::getRecordTitle('pages', $mainPageRec, TRUE);
-			$out .= $picon . '<br />';
+			$out .= $picon . '<ul class="list-tree" id="flatTreeRoot">';
 			// Look up tt_content elements from the expanded page:
 			$res = $db->exec_SELECTquery(
 				'uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext',
@@ -1624,28 +1624,11 @@ class ElementBrowser {
 					$selected = ' class="bg-success"';
 				}
 				// Putting list element HTML together:
-				$out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ('gfx/ol/join' . ($c == $cc ? 'bottom' : '')
-						. '.gif'), 'width="18" height="16"') . ' alt="" />' . $arrCol
+				$out .= '<li>'
 					. '<a href="#"' . $selected . ' onclick="return link_typo3Page(\'' . $expPageId . '\',\'#' . $row['uid'] . '\');">'
-					. $icon . BackendUtility::getRecordTitle('tt_content', $row, TRUE) . '</a><br />';
-				// Finding internal anchor points:
-				if (GeneralUtility::inList('text,textpic', $row['CType'])) {
-					$split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
-					foreach ($split as $skey => $sval) {
-						if ($skey % 3 == 2) {
-							// Putting list element HTML together:
-							$sval = substr($sval, 0, 100);
-							$out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/line.gif',
-									'width="18" height="16"') . ' alt="" />'
-								. '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], ('gfx/ol/join'
-									. ($skey + 3 > count($split) ? 'bottom' : '') . '.gif'), 'width="18" height="16"')
-									. ' alt="" />' . '<a href="#" onclick="return link_typo3Page(' . GeneralUtility::quoteJSvalue($expPageId)
-									. ',' . GeneralUtility::quoteJSvalue('#' . $sval) . ');">' . htmlspecialchars((' <A> ' . $sval))
-									. '</a><br />';
-						}
-					}
-				}
+					. $icon . BackendUtility::getRecordTitle('tt_content', $row, TRUE) . '</a></li>';
 			}
+			$out .= '</ul>';
 		}
 		return $out;
 	}
diff --git a/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css b/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
index abe7f027e687..064a040f98ad 100644
--- a/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
+++ b/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
@@ -10850,6 +10850,9 @@ body#imp-exp-mod ul#treeRoot > li:first-child {
 body#imp-exp-mod ul#treeRoot ul li:last-child:before {
   background-color: #f1f1f1;
 }
+ul#flatTreeRoot li:last-child:before {
+  background-color: #f1f1f1;
+}
 table.t3-tree-config {
   background: #ececec;
   background-image: linear-gradient(center top, #ffffff 0px, #ececec 100px);
-- 
GitLab