Commit ec534b67 authored by Benni Mack's avatar Benni Mack Committed by Wouter Wolters
Browse files

[TASK] Clean up tree code

Remove some last styling topics and leftover snippets.

Resolves: #68147
Releases: master
Change-Id: I2170b5407be897d5e2e28d8a24d668ea5617bc01
Reviewed-on: http://review.typo3.org/41260

Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent ace07f17
......@@ -145,36 +145,6 @@
}
}
table#typo3-tree {
margin: 10px 0 20px 10px;
width: 95%;
vertical-align: middle;
tr {
td {
padding: 0;
img {
vertical-align: middle;
&.c-recIcon {
margin-right: 1px;
}
}
}
}
a {
text-decoration: none;
}
}
p.c-refresh img {
margin-right: 7px;
vertical-align: middle;
}
#typo3-pagetree #typo3-docheader div.buttonsright,
#ext-backend-Modules-FileSystemNavigationFrame-index-php #typo3-docheader div.buttonsright {
margin-right: 3px;
......@@ -189,7 +159,7 @@ body#typo3-alt-db-navframe-php div.c-notice {
}
/** CSS-based tree for Foldertree */
ul#treeRoot {
ul.list-tree-root {
li:last-child:before {
background-color: #ececec;
}
......@@ -208,11 +178,11 @@ ul#treeRoot {
}
// change background color for folder nav frame
body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul#treeRoot li:last-child:before {
body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul.list-tree-root li:last-child:before {
background-color: #f5f5f5;
}
body#imp-exp-mod ul#treeRoot {
body#imp-exp-mod ul.list-tree-root {
> li:first-child {
padding-left: 0;
}
......@@ -221,10 +191,8 @@ body#imp-exp-mod ul#treeRoot {
}
}
ul#flatTreeRoot {
li:last-child:before {
background-color: #f1f1f1;
}
ul.flat-tree-root li:last-child:before {
background-color: #f1f1f1;
}
//
......@@ -359,42 +327,14 @@ ul.tree div.treeLinkItem img {
ul.tree div.treeLinkItem span.dragIcon {
vertical-align: top;
}
#dragIcon {
position: absolute;
visibility: hidden;
z-index: 20;
}
#treeFilterBox {
background: url('../../../../icons/gfx/filter_bg.gif') 0 -2px no-repeat;
background-color: #dadada;
display: none;
height: 25px;
position: absolute;
top: 49px;
left: 0;
right: 0;
width: auto;
z-index: 3;
}
#searchBubble {
padding-left: 10px;
}
#treeFilter {
margin: 6px 0 0 17px !important;
height: 16px;
width: 160px;
}
#treeFilterReset {
position: absolute;
top: 5px;
left: 192px;
border: 0;
cursor: pointer;
visibility: hidden;
filter: alpha(opacity=50);
opacity: 0.5;
white-space: nowrap;
}
#typo3-pagetree #typo3-docheader img {
......@@ -429,32 +369,3 @@ body#ext-backend-Modules-FileSystemNavigationFrame-index-php {
border-right: 1px solid @navigation-border;
background-color: @navigation-bg;
}
table#typo3-tree tr:hover {
background-color: #d7dbe2;
}
//
// AJAX Page Tree
//
#dragIcon {
filter: alpha(opacity=50);
opacity: 0.5;
white-space: nowrap;
}
#treeFilter {
background: transparent;
border: 0;
}
#tree-toolbar-filter-item {
display: inline-block;
height: 22px;
width: 20px;
}
#tree-toolbar-filter-item.active {
background-image: url("../../../../icons/gfx/toolbar_item_active_bg.png")
}
......@@ -126,7 +126,7 @@ class MoveElementController {
// Get record for element:
$elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid);
// Headerline: Icon, record title:
$headerLine = IconUtility::getSpriteIconForRecord($this->table, $elRow, array('id' => 'c-recIcon', 'title' => htmlspecialchars(BackendUtility::getRecordIconAltText($elRow, $this->table))));
$headerLine = IconUtility::getSpriteIconForRecord($this->table, $elRow, array('title' => htmlspecialchars(BackendUtility::getRecordIconAltText($elRow, $this->table))));
$headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, TRUE);
// Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
$headerLine .= $this->doc->spacer(5);
......
......@@ -75,14 +75,6 @@ abstract class AbstractTreeView {
*/
public $showDefaultTitleAttribute = FALSE;
// If TRUE, pages containing child records which has versions will be
// highlighted in yellow. This might be too expensive in terms
// of processing power.
/**
* @var bool
*/
public $highlightPagesWithVersions = TRUE;
/**
* Needs to be initialized with $GLOBALS['BE_USER']
* Done by default in init()
......@@ -399,7 +391,7 @@ abstract class AbstractTreeView {
if ($this->addSelfId) {
$this->ids[] = $uid;
}
$this->getTree($uid, 999, '', '', $rootRec['_SUBCSSCLASS']);
$this->getTree($uid);
}
// Add tree:
$treeArr = array_merge($treeArr, $this->tree);
......@@ -422,7 +414,7 @@ abstract class AbstractTreeView {
$out = '';
$closeDepth = array();
foreach ($treeArr as $treeItem) {
$classAttr = $treeItem['row']['_CSSCLASS'];
$classAttr = '';
if ($treeItem['isFirst']) {
$out .= '<ul class="list-tree">';
}
......@@ -453,7 +445,7 @@ abstract class AbstractTreeView {
}
}
}
$out = '<ul class="list-tree" id="treeRoot">' . $out . '</ul>';
$out = '<ul class="list-tree list-tree-root">' . $out . '</ul>';
return $out;
}
......@@ -641,8 +633,7 @@ abstract class AbstractTreeView {
*/
public function getIcon($row) {
$icon = IconUtility::getSpriteIconForRecord($this->table, $row, array(
'title' => $this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row),
'class' => 'c-recIcon'
'title' => $this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row)
));
return $this->wrapIcon($icon, $row);
}
......@@ -714,12 +705,12 @@ abstract class AbstractTreeView {
$depth = (int)$depth;
$HTML = '';
$a = 0;
$res = $this->getDataInit($uid, $subCSSclass);
$res = $this->getDataInit($uid);
$c = $this->getDataCount($res);
$crazyRecursionLimiter = 999;
$idH = array();
// Traverse the records:
while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, $subCSSclass))) {
while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, ''))) {
$pageUid = ($this->table === 'pages') ? $row['uid'] : $row['pid'];
if (!$GLOBALS['BE_USER']->isInWebMount($pageUid)) {
// Current record is not within web mount => skip it
......@@ -749,7 +740,7 @@ abstract class AbstractTreeView {
// Make a recursive call to the next level
$hasSub = $this->expandNext($newID) && !$row['php_tree_stop'];
if ($depth > 1 && $hasSub) {
$nextCount = $this->getTree($newID, $depth - 1, '', '', $row['_SUBCSSCLASS']);
$nextCount = $this->getTree($newID, $depth - 1);
if (!empty($this->buffer_idH)) {
$idH[$row['uid']]['subrow'] = $this->buffer_idH;
}
......@@ -883,10 +874,6 @@ abstract class AbstractTreeView {
$row = FALSE;
} else {
list(, $row) = each($this->dataLookup[$res][$this->subLevelID]);
// Passing on default <td> class for subelements:
if (is_array($row) && $subCSSclass !== '') {
$row['_CSSCLASS'] = ($row['_SUBCSSCLASS'] = $subCSSclass);
}
}
return $row;
} else {
......@@ -896,18 +883,6 @@ abstract class AbstractTreeView {
break;
}
}
// Passing on default <td> class for subelements:
if (is_array($row) && $subCSSclass !== '') {
if ($this->table === 'pages' && $this->highlightPagesWithVersions && !isset($row['_CSSCLASS']) && !empty(BackendUtility::countVersionsOfRecordsOnPage($this->BE_USER->workspace, $row['uid']))) {
$row['_CSSCLASS'] = 'ver-versions';
}
if (!isset($row['_CSSCLASS'])) {
$row['_CSSCLASS'] = $subCSSclass;
}
if (!isset($row['_SUBCSSCLASS'])) {
$row['_SUBCSSCLASS'] = $subCSSclass;
}
}
return $row;
}
}
......
......@@ -24,13 +24,6 @@ namespace TYPO3\CMS\Backend\Tree\View;
*/
class ElementBrowserFolderTreeView extends FolderTreeView {
/**
* If file-drag mode is set, temp and recycler folders are filtered out.
*
* @var int
*/
public $ext_noTempRecyclerDirs = 0;
/**
* @var int
*/
......@@ -80,6 +73,7 @@ class ElementBrowserFolderTreeView extends FolderTreeView {
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
* @param bool $isOpen check if the item has children
* @return string Link-wrapped input string
* @access private
*/
......
......@@ -109,7 +109,7 @@ class ElementBrowserPageTreeView extends BrowseTreeView {
}
}
$out = '<ul class="list-tree" id="treeRoot">' . $out . '</ul>';
$out = '<ul class="list-tree list-tree-root">' . $out . '</ul>';
return $out;
}
......
......@@ -52,6 +52,7 @@ class FolderTreeView extends AbstractTreeView {
protected $scope;
/**
* If file-drag mode is set, temp and recycler folders are filtered out.
* @var bool
*/
public $ext_noTempRecyclerDirs;
......@@ -427,10 +428,7 @@ class FolderTreeView extends AbstractTreeView {
return $message->render();
}
$out = '
<!-- TYPO3 folder tree structure. -->
<ul id="treeRoot" class="list-tree">
';
$out = '<ul class="list-tree list-tree-root">';
// Evaluate AJAX request
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
list(, $expandCollapseCommand, $expandedFolderHash, ) = $this->evaluateExpandCollapseParameter();
......
......@@ -133,10 +133,7 @@ class PageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
if (!is_array($treeArr)) {
$treeArr = $this->tree;
}
$out = '
<!-- TYPO3 tree structure. -->
<ul class="tree" id="treeRoot">
';
$out = '<ul class="tree list-tree-root">';
// -- evaluate AJAX request
// IE takes anchor as parameter
$PM = GeneralUtility::_GP('PM');
......@@ -312,7 +309,7 @@ class PageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
if ($this->addSelfId) {
$this->ids[] = $uid;
}
$this->getTree($uid, 999, '', $rootRec['_SUBCSSCLASS']);
$this->getTree($uid);
}
// Add tree:
$treeArr = array_merge($treeArr, $this->tree);
......@@ -337,13 +334,13 @@ class PageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
$depth = (int)$depth;
$HTML = '';
$a = 0;
$res = $this->getDataInit($uid, $subCSSclass);
$res = $this->getDataInit($uid);
$c = $this->getDataCount($res);
$crazyRecursionLimiter = 999;
$inMenuPages = array();
$outOfMenuPages = array();
$outOfMenuPagesTextIndex = array();
while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, $subCSSclass))) {
while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res))) {
$crazyRecursionLimiter--;
// Not in menu:
if ($this->ext_separateNotinmenuPages && ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION || $row['doktype'] >= 200 || $row['nav_hide'])) {
......
......@@ -1601,7 +1601,7 @@ class ElementBrowser {
$db = $this->getDatabaseConnection();
$picon = IconUtility::getSpriteIconForRecord('pages', $mainPageRec);
$picon .= BackendUtility::getRecordTitle('pages', $mainPageRec, TRUE);
$out .= $picon . '<ul class="list-tree" id="flatTreeRoot">';
$out .= $picon . '<ul class="list-tree flat-tree-root">';
// Look up tt_content elements from the expanded page:
$res = $db->exec_SELECTquery(
'uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext',
......@@ -1777,7 +1777,6 @@ class ElementBrowser {
}
$out .= '<a href="#"' . $selected . ' title="' . htmlspecialchars($folder->getIdentifier()) . '" onclick="return link_folder(\'file:' . $folder->getCombinedIdentifier() . '\');">'
. $folderIcon . '</a><br />';
// Get files from the folder:
if ($renderFolders) {
$items = $folder->getSubfolders();
......@@ -1785,45 +1784,43 @@ class ElementBrowser {
$items = $this->getFilesInFolder($folder, $extensionList);
}
$c = 0;
$totalItems = count($items);
foreach ($items as $fileOrFolderObject) {
$c++;
if ($renderFolders) {
$fileIdentifier = $fileOrFolderObject->getCombinedIdentifier();
$overlays = array();
if ($fileOrFolderObject instanceof InaccessibleFolder) {
$overlays = array('status-overlay-locked' => array());
if (!empty($items)) {
$out .= '<ul class="list-tree flat-tree-root">';
foreach ($items as $fileOrFolderObject) {
$c++;
if ($renderFolders) {
$fileIdentifier = $fileOrFolderObject->getCombinedIdentifier();
$overlays = array();
if ($fileOrFolderObject instanceof InaccessibleFolder) {
$overlays = array('status-overlay-locked' => array());
}
$icon = IconUtility::getSpriteIcon(
IconUtility::mapFileExtensionToSpriteIconName('folder'),
array('title' => $fileOrFolderObject->getName()),
$overlays);
$itemUid = 'file:' . $fileIdentifier;
} else {
$fileIdentifier = $fileOrFolderObject->getUid();
// Get size and icon:
$size = ' (' . GeneralUtility::formatSize($fileOrFolderObject->getSize()) . 'bytes)';
$icon = IconUtility::getSpriteIconForResource($fileOrFolderObject, array('title' => $fileOrFolderObject->getName() . $size));
$itemUid = 'file:' . $fileIdentifier;
}
$icon = IconUtility::getSpriteIcon(
IconUtility::mapFileExtensionToSpriteIconName('folder'),
array('title' => $fileOrFolderObject->getName()),
$overlays);
$itemUid = 'file:' . $fileIdentifier;
} else {
$fileIdentifier = $fileOrFolderObject->getUid();
// Get size and icon:
$size = ' (' . GeneralUtility::formatSize($fileOrFolderObject->getSize()) . 'bytes)';
$icon = IconUtility::getSpriteIconForResource($fileOrFolderObject, array('title' => $fileOrFolderObject->getName() . $size));
$itemUid = 'file:' . $fileIdentifier;
}
$selected = '';
if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder')
&& $currentIdentifier == $fileIdentifier
) {
$selected = ' class="bg-success"';
$selected = '';
if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder')
&& $currentIdentifier == $fileIdentifier
) {
$selected = ' class="bg-success"';
}
// Put it all together for the file element:
$out .=
'<li><a href="#"' . $selected . ' title="' . htmlspecialchars($fileOrFolderObject->getName()) . '" onclick="return link_folder(\'' . $itemUid . '\');">' .
$icon .
htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), $titleLen)) .
'</a></li>';
}
// Put it all together for the file element:
$out .=
'<img' .
IconUtility::skinImg(
$GLOBALS['BACK_PATH'],
('gfx/ol/join' . ($c == $totalItems ? 'bottom' : '') . '.gif'),
'width="18" height="16"'
) . ' alt="" />' . $arrCol .
'<a href="#"' . $selected . ' title="' . htmlspecialchars($fileOrFolderObject->getName()) . '" onclick="return link_folder(\'' . $itemUid . '\');">' .
$icon .
htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), $titleLen)) .
'</a><br />';
$out .= '</ul>';
}
return $out;
}
......
......@@ -79,7 +79,7 @@ class PageTree extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserPageTreeView {
}
}
}
$out = '<ul class="list-tree" id="treeRoot">' . $out . '</ul>';
$out = '<ul class="list-tree list-tree-root">' . $out . '</ul>';
return $out;
}
......
......@@ -10867,27 +10867,6 @@ a.list-tree li.active > .list-tree-group a:focus {
.treeline-icon-clear:after {
display: none;
}
table#typo3-tree {
margin: 10px 0 20px 10px;
width: 95%;
vertical-align: middle;
}
table#typo3-tree tr td {
padding: 0;
}
table#typo3-tree tr td img {
vertical-align: middle;
}
table#typo3-tree tr td img.c-recIcon {
margin-right: 1px;
}
table#typo3-tree a {
text-decoration: none;
}
p.c-refresh img {
margin-right: 7px;
vertical-align: middle;
}
#typo3-pagetree #typo3-docheader div.buttonsright,
#ext-backend-Modules-FileSystemNavigationFrame-index-php #typo3-docheader div.buttonsright {
margin-right: 3px;
......@@ -10900,28 +10879,28 @@ body#typo3-alt-db-navframe-php div.c-notice {
width: 95%;
}
/** CSS-based tree for Foldertree */
ul#treeRoot li:last-child:before {
ul.list-tree-root li:last-child:before {
background-color: #ececec;
}
ul#treeRoot:before {
ul.list-tree-root:before {
border: 0;
}
ul#treeRoot > li:before {
ul.list-tree-root > li:before {
border: 0;
}
ul#treeRoot > li {
ul.list-tree-root > li {
border-left: 0;
}
body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul#treeRoot li:last-child:before {
body#ext-backend-Modules-FileSystemNavigationFrame-index-php ul.list-tree-root li:last-child:before {
background-color: #f5f5f5;
}
body#imp-exp-mod ul#treeRoot > li:first-child {
body#imp-exp-mod ul.list-tree-root > li:first-child {
padding-left: 0;
}
body#imp-exp-mod ul#treeRoot ul li:last-child:before {
body#imp-exp-mod ul.list-tree-root ul li:last-child:before {
background-color: #f1f1f1;
}
ul#flatTreeRoot li:last-child:before {
ul.flat-tree-root li:last-child:before {
background-color: #f1f1f1;
}
table.t3-tree-config {
......@@ -11019,34 +10998,9 @@ ul.tree div.treeLinkItem span.dragIcon {
position: absolute;
visibility: hidden;
z-index: 20;
}
#treeFilterBox {
background: url('../../../../icons/gfx/filter_bg.gif') 0 -2px no-repeat;
background-color: #dadada;
display: none;
height: 25px;
position: absolute;
top: 49px;
left: 0;
right: 0;
width: auto;
z-index: 3;
}
#searchBubble {
padding-left: 10px;
}
#treeFilter {
margin: 6px 0 0 17px !important;
height: 16px;
width: 160px;
}
#treeFilterReset {
position: absolute;
top: 5px;
left: 192px;
border: 0;
cursor: pointer;
visibility: hidden;
filter: alpha(opacity=50);
opacity: 0.5;
white-space: nowrap;
}
#typo3-pagetree #typo3-docheader img {
margin: 2px;
......@@ -11072,26 +11026,6 @@ body#ext-backend-Modules-FileSystemNavigationFrame-index-php {
border-right: 1px solid #c3c3c3;
background-color: #f5f5f5;
}
table#typo3-tree tr:hover {
background-color: #d7dbe2;
}
#dragIcon {
filter: alpha(opacity=50);
opacity: 0.5;
white-space: nowrap;
}
#treeFilter {
background: transparent;
border: 0;
}
#tree-toolbar-filter-item {
display: inline-block;
height: 22px;
width: 20px;
}
#tree-toolbar-filter-item.active {
background-image: url("../../../../icons/gfx/toolbar_item_active_bg.png");
}
.pagination .t3-icon {
margin: 0;
}
......
Supports Markdown
0% or .