From e79fd5ecb34fe7eb9d8553d7f6a7bc3865f62718 Mon Sep 17 00:00:00 2001
From: Benjamin Mack <benni@typo3.org>
Date: Tue, 14 Jul 2015 20:47:27 +0200
Subject: [PATCH] [TASK] Streamline page tree in Export module

Resolves: #68137
Releases: master
Change-Id: Id254bfc0ab5608212af7e92863edefa2b09e270a
Reviewed-on: http://review.typo3.org/41234
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
---
 .../Public/Less/TYPO3/_element_tree.less        | 10 ++++++++++
 .../backend/Classes/Tree/View/PageTreeView.php  |  8 ++++----
 .../Migrations/Code/ClassAliasMap.php           |  2 +-
 .../Migrations/Code/LegacyClassesForIde.php     |  2 +-
 .../Controller/ImportExportController.php       |  4 ++--
 .../ExportPageTreeView.php}                     | 17 +++++++----------
 .../Resources/Public/Css/visual/t3skin.css      |  6 ++++++
 7 files changed, 31 insertions(+), 18 deletions(-)
 rename typo3/sysext/impexp/Classes/{LocalPageTree.php => View/ExportPageTreeView.php} (79%)

diff --git a/Build/Resources/Public/Less/TYPO3/_element_tree.less b/Build/Resources/Public/Less/TYPO3/_element_tree.less
index 60a918938532..2bcc08231185 100644
--- a/Build/Resources/Public/Less/TYPO3/_element_tree.less
+++ b/Build/Resources/Public/Less/TYPO3/_element_tree.less
@@ -155,6 +155,16 @@ ul#treeRoot {
 body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul#treeRoot li:last-child:before {
 	background-color: #f5f5f5;
 }
+
+body#imp-exp-mod ul#treeRoot {
+	> li:first-child {
+		padding-left: 0;
+	}
+	ul li:last-child:before {
+		background-color: #f1f1f1;
+	}
+}
+
 //
 // Configuration trees, used in Admin Tools => Configuration
 //
diff --git a/typo3/sysext/backend/Classes/Tree/View/PageTreeView.php b/typo3/sysext/backend/Classes/Tree/View/PageTreeView.php
index 21de6399b531..6356bcdad14f 100644
--- a/typo3/sysext/backend/Classes/Tree/View/PageTreeView.php
+++ b/typo3/sysext/backend/Classes/Tree/View/PageTreeView.php
@@ -86,13 +86,13 @@ class PageTreeView extends AbstractTreeView {
 	 * @param int $a The current entry number
 	 * @param int $c The total number of entries. If equal to $a, a 'bottom' element is returned.
 	 * @param int $nextCount The number of sub-elements to the current element.
-	 * @param bool $exp The element was expanded to render subelements if this flag is set.
+	 * @param bool $isExpand The element was expanded to render subelements if this flag is set.
 	 * @return string Image tag with the plus/minus icon.
 	 * @access private
-	 * @see AbstarctTreeView::PMicon()
+	 * @see AbstractTreeView::PMicon()
 	 */
-	public function PMicon($row, $a, $c, $nextCount, $exp) {
-		return \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('treeline-join' . ($a == $c ? 'bottom' : ''));
+	public function PMicon($row, $a, $c, $nextCount, $isExpand) {
+		return '<i class="fa"></i>';
 	}
 
 	/**
diff --git a/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php b/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
index 585ae96814d6..592d9950d6ff 100644
--- a/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
+++ b/typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
@@ -1019,7 +1019,7 @@ return array(
 	'tx_impexp_clickmenu' => \TYPO3\CMS\Impexp\Clickmenu::class,
 	'SC_mod_tools_log_index' => \TYPO3\CMS\Impexp\Controller\ImportExportController::class,
 	'tx_impexp' => \TYPO3\CMS\Impexp\ImportExport::class,
-	'tx_impexp_localPageTree' => \TYPO3\CMS\Impexp\LocalPageTree::class,
+	'tx_impexp_localPageTree' => \TYPO3\CMS\Impexp\View\ExportPageTreeView::class,
 	'tx_impexp_task' => \TYPO3\CMS\Impexp\Task\ImportExportTask::class,
 	'Tx_IndexedSearch_Domain_Repository_IndexSearchRepository' => \TYPO3\CMS\IndexedSearch\Domain\Repository\IndexSearchRepository::class,
 	'tx_indexedsearch_files' => \TYPO3\CMS\IndexedSearch\Hook\CrawlerFilesHook::class,
diff --git a/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php b/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
index a0d96ab86089..a6c5e456ee83 100644
--- a/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
+++ b/typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
@@ -5079,7 +5079,7 @@ class tx_impexp extends \TYPO3\CMS\Impexp\ImportExport {}
 /**
  * @deprecated since 6.0, removed since 7.0
  */
-class tx_impexp_localPageTree extends \TYPO3\CMS\Impexp\LocalPageTree {}
+class tx_impexp_localPageTree extends \TYPO3\CMS\Impexp\View\ExportPageTreeView {}
 
 /**
  * @deprecated since 6.0, removed since 7.0
diff --git a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php
index ed902d9c8535..09c3a51f370d 100644
--- a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php
+++ b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php
@@ -276,7 +276,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
 			// Based on click-expandable tree
 			$idH = NULL;
 			if ($inData['pagetree']['levels'] == -1) {
-				$pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\LocalPageTree::class);
+				$pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\View\ExportPageTreeView::class);
 				$tree = $pagetree->ext_tree($inData['pagetree']['id'], $this->filterPageIds($this->export->excludeMap));
 				$this->treeHTML = $pagetree->printTree($tree);
 				$idH = $pagetree->buffer_idH;
@@ -309,7 +309,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
 					if (!empty($tree->buffer_idH)) {
 						$idH[$pid]['subrow'] = $tree->buffer_idH;
 					}
-					$pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\LocalPageTree::class);
+					$pagetree = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\View\ExportPageTreeView::class);
 					$this->treeHTML = $pagetree->printTree($tree->tree);
 				}
 			}
diff --git a/typo3/sysext/impexp/Classes/LocalPageTree.php b/typo3/sysext/impexp/Classes/View/ExportPageTreeView.php
similarity index 79%
rename from typo3/sysext/impexp/Classes/LocalPageTree.php
rename to typo3/sysext/impexp/Classes/View/ExportPageTreeView.php
index 0ad70808cbe0..a7f22d3a286d 100644
--- a/typo3/sysext/impexp/Classes/LocalPageTree.php
+++ b/typo3/sysext/impexp/Classes/View/ExportPageTreeView.php
@@ -1,5 +1,5 @@
 <?php
-namespace TYPO3\CMS\Impexp;
+namespace TYPO3\CMS\Impexp\View;
 
 /*
  * This file is part of the TYPO3 CMS project.
@@ -20,7 +20,7 @@ use TYPO3\CMS\Backend\Utility\IconUtility;
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-class LocalPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
+class ExportPageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
 
 	/**
 	 * Initialization
@@ -85,25 +85,23 @@ class LocalPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
 		$curIds = $this->ids;
 		$this->reset();
 		$this->ids = $curIds;
-		$firstHtml = '<img' . IconUtility::skinImg($this->backPath, ('gfx/ol/' . ($isOpen ? 'minus' : 'plus') . 'only.gif'), 'width="18" height="16"') . ' align="top" alt="" />';
 		if ($pid > 0) {
 			$rootRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $pid);
-			$firstHtml .= IconUtility::getSpriteIconForRecord('pages', $rootRec);
+			$firstHtml = IconUtility::getSpriteIconForRecord('pages', $rootRec);
 		} else {
 			$rootRec = array(
 				'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'],
 				'uid' => 0
 			);
-			$firstHtml .= $this->getRootIcon($rootRec);
+			$firstHtml = $this->getRootIcon($rootRec);
 		}
-		$this->tree[] = array('HTML' => $firstHtml, 'row' => $rootRec);
+		$this->tree[] = array('HTML' => $firstHtml, 'row' => $rootRec, 'hasSub' => $isOpen);
 		if ($isOpen) {
 			// Set depth:
-			$depthD = '<img' . IconUtility::skinImg($this->backPath, 'gfx/ol/blank.gif', 'width="18" height="16"') . ' align="top" alt="" />';
 			if ($this->addSelfId) {
 				$this->ids[] = $pid;
 			}
-			$this->getTree($pid, 999, $depthD);
+			$this->getTree($pid, 999, '');
 			$idH = array();
 			$idH[$pid]['uid'] = $pid;
 			if (!empty($this->buffer_idH)) {
@@ -112,8 +110,7 @@ class LocalPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
 			$this->buffer_idH = $idH;
 		}
 		// Add tree:
-		$treeArr = array_merge($treeArr, $this->tree);
-		return $treeArr;
+		return array_merge($treeArr, $this->tree);
 	}
 
 }
diff --git a/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css b/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
index b2cb95b0bdfa..abe7f027e687 100644
--- a/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
+++ b/typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css
@@ -10844,6 +10844,12 @@ ul#treeRoot > li {
 body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul#treeRoot li:last-child:before {
   background-color: #f5f5f5;
 }
+body#imp-exp-mod ul#treeRoot > li:first-child {
+  padding-left: 0;
+}
+body#imp-exp-mod ul#treeRoot ul li:last-child:before {
+  background-color: #f1f1f1;
+}
 table.t3-tree-config {
   background: #ececec;
   background-image: linear-gradient(center top, #ffffff 0px, #ececec 100px);
-- 
GitLab