[TASK] Fix trees inside tables 86/41486/10
authorBenjamin Mack <benni@typo3.org>
Thu, 16 Jul 2015 16:08:56 +0000 (18:08 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Fri, 17 Jul 2015 09:13:44 +0000 (11:13 +0200)
Fix tree indentation in Info and Access modules.

Resolves: #68233
Releases: master
Change-Id: I37e43e83b803ea521b9563722ffc6801bfb05c5a
Reviewed-on: http://review.typo3.org/41486
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott <info@bk2k.info>
typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php
typo3/sysext/backend/Classes/Tree/View/PageTreeView.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Classes/View/PageTreeView.php
typo3/sysext/beuser/Classes/Controller/PermissionController.php
typo3/sysext/beuser/Resources/Private/Templates/Permission/Index.html
typo3/sysext/frontend/Classes/Controller/TranslationStatusController.php

index d5891ab..c3142c7 100644 (file)
@@ -388,10 +388,11 @@ abstract class AbstractTreeView {
                                $this->tree[] = array('HTML' => $firstHtml, 'row' => $rootRec, 'hasSub' => $isOpen, 'bank' => $this->bank);
                                // If the mount is expanded, go down:
                                if ($isOpen) {
+                                       $depthData = '<span class="treeline-icon treeline-icon-clear"></span>';
                                        if ($this->addSelfId) {
                                                $this->ids[] = $uid;
                                        }
-                                       $this->getTree($uid);
+                                       $this->getTree($uid, 999, $depthData);
                                }
                                // Add tree:
                                $treeArr = array_merge($treeArr, $this->tree);
@@ -632,6 +633,9 @@ abstract class AbstractTreeView {
         * @return string Image tag.
         */
        public function getIcon($row) {
+               if (is_int($row)) {
+                       $row = BackendUtility::getRecord($this->table, $row);
+               }
                $icon = IconUtility::getSpriteIconForRecord($this->table, $row, array(
                        'title' => $this->showDefaultTitleAttribute ? 'UID: ' . $row['uid'] : $this->getTitleAttrib($row)
                ));
@@ -738,9 +742,10 @@ abstract class AbstractTreeView {
                        $this->orig_ids_hierarchy[$depth][] = $row['_ORIG_uid'] ?: $row['uid'];
 
                        // Make a recursive call to the next level
+                       $nextLevelDepthData = $depthData . '<span class="treeline-icon treeline-icon-' . ($a === $c ? 'clear' : 'line') .'"></span>';
                        $hasSub = $this->expandNext($newID) && !$row['php_tree_stop'];
                        if ($depth > 1 && $hasSub) {
-                               $nextCount = $this->getTree($newID, $depth - 1);
+                               $nextCount = $this->getTree($newID, $depth - 1, $nextLevelDepthData);
                                if (!empty($this->buffer_idH)) {
                                        $idH[$row['uid']]['subrow'] = $this->buffer_idH;
                                }
@@ -760,6 +765,7 @@ abstract class AbstractTreeView {
                                'row' => $row,
                                'HTML' => $HTML,
                                'invertedDepth' => $depth,
+                               'depthData' => $depthData,
                                'bank' => $this->bank,
                                'hasSub' => $nextCount && $hasSub,
                                'isFirst' => $a === 1,
index 8fa1bad..9386847 100644 (file)
@@ -89,7 +89,7 @@ class PageTreeView extends AbstractTreeView {
         * @see AbstractTreeView::PMicon()
         */
        public function PMicon($row, $a, $c, $nextCount, $isExpand) {
-               return '<i class="fa"></i>';
+               return '<span class="treeline-icon treeline-icon-join' . ($a == $c ? 'bottom' : '') . '"></span>';
        }
 
        /**
index 40b5fdd..7fb503c 100644 (file)
@@ -947,18 +947,10 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                BackendUtility::workspaceOL('pages', $row);
                                if (is_array($row)) {
                                        $c++;
-                                       $row['treeIcons'] = $treeIcons . '<img' . IconUtility::skinImg(
-                                                       $this->backPath,
-                                                       'gfx/ol/join' . ($rc == $c ? 'bottom' : '') . '.gif',
-                                                       'width="18" height="16"'
-                                               ) . ' alt="" />';
+                                       $row['treeIcons'] = $treeIcons . '<span class="treeline-icon treeline-icon-join' . ($rc === $c ? 'bottom' : '') . '"></span>';
                                        $theRows[] = $row;
                                        // Get the branch
-                                       $spaceOutIcons = '<img' . IconUtility::skinImg(
-                                                       $this->backPath,
-                                                       'gfx/ol/' . ($rc == $c ? 'blank.gif' : 'line.gif'),
-                                                       'width="18" height="16"'
-                                               ) . ' alt="" />';
+                                       $spaceOutIcons = '<span class="treeline-icon treeline-icon-' . ($rc === $c ? 'clear' : 'line') . '"></span>';
                                        $theRows = $this->pages_getTree($theRows, $row['uid'], $qWhere, $treeIcons . $spaceOutIcons, $row['php_tree_stop'] ? 0 : $depth);
                                }
                        }
index eefef32..2f04b67 100644 (file)
@@ -312,113 +312,4 @@ class PageTreeView extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
                return $this->printTree($treeArr);
        }
 
-       /**
-        * Fetches the data for the tree
-        *
-        * @param int $uid Item id for which to select subitems (parent id)
-        * @param int $depth Max depth (recursivity limit)
-        * @param string $blankLineCode ? (internal)
-        * @param string $subCSSclass
-        * @return int The count of items on the level
-        */
-       public function getTreexxx($uid, $depth = 999, $blankLineCode = '', $subCSSclass = '') {
-               // Buffer for id hierarchy is reset:
-               $this->buffer_idH = array();
-               // Init vars
-               $depth = (int)$depth;
-               $HTML = '';
-               $a = 0;
-               $res = $this->getDataInit($uid);
-               $c = $this->getDataCount($res);
-               $crazyRecursionLimiter = 999;
-               $inMenuPages = array();
-               $outOfMenuPages = array();
-               $outOfMenuPagesTextIndex = array();
-               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'])) {
-                               $outOfMenuPages[] = $row;
-                               $outOfMenuPagesTextIndex[] = ($row['doktype'] >= 200 ? 'zzz' . $row['doktype'] . '_' : '') . $row['title'];
-                       } else {
-                               $inMenuPages[] = $row;
-                       }
-               }
-               $label_shownAlphabetically = '';
-               if (!empty($outOfMenuPages)) {
-                       // Sort out-of-menu pages:
-                       $outOfMenuPages_alphabetic = array();
-                       if ($this->ext_alphasortNotinmenuPages) {
-                               asort($outOfMenuPagesTextIndex);
-                               $label_shownAlphabetically = ' (alphabetic)';
-                       }
-                       foreach ($outOfMenuPagesTextIndex as $idx => $txt) {
-                               $outOfMenuPages_alphabetic[] = $outOfMenuPages[$idx];
-                       }
-                       // Merge:
-                       $outOfMenuPages_alphabetic[0]['_FIRST_NOT_IN_MENU'] = TRUE;
-                       $allRows = array_merge($inMenuPages, $outOfMenuPages_alphabetic);
-               } else {
-                       $allRows = $inMenuPages;
-               }
-               // Traverse the records:
-               foreach ($allRows as $row) {
-                       $a++;
-                       $newID = $row['uid'];
-                       // Reserve space.
-                       $this->tree[] = array();
-                       end($this->tree);
-                       // Get the key for this space
-                       $treeKey = key($this->tree);
-                       $LN = $a == $c ? 'blank' : 'line';
-                       // If records should be accumulated, do so
-                       if ($this->setRecs) {
-                               $this->recs[$row['uid']] = $row;
-                       }
-                       // Accumulate the id of the element in the internal arrays
-                       $this->ids[] = ($idH[$row['uid']]['uid'] = $row['uid']);
-                       $this->ids_hierarchy[$depth][] = $row['uid'];
-                       // Make a recursive call to the next level
-                       if ($depth > 1 && $this->expandNext($newID) && !$row['php_tree_stop']) {
-                               $nextCount = $this->getTree($newID, $depth - 1, $blankLineCode . ',' . $LN, $row['_SUBCSSCLASS']);
-                               if (!empty($this->buffer_idH)) {
-                                       $idH[$row['uid']]['subrow'] = $this->buffer_idH;
-                               }
-                               // Set "did expand" flag
-                               $exp = 1;
-                       } else {
-                               $nextCount = $this->getCount($newID);
-                               // Clear "did expand" flag
-                               $exp = 0;
-                       }
-                       // Set HTML-icons, if any:
-                       if ($this->makeHTML) {
-                               if ($row['_FIRST_NOT_IN_MENU']) {
-                                       $HTML = '<br><br><i>Not shown in menu' . $label_shownAlphabetically . ':</i><br>';
-                               } else {
-                                       $HTML = '';
-                               }
-                               $HTML .= $this->PMicon($row, $a, $c, $nextCount, $exp);
-                               $HTML .= $this->wrapStop($this->getIcon($row), $row);
-                       }
-                       // Finally, add the row/HTML content to the ->tree array in the reserved key.
-                       $this->tree[$treeKey] = array(
-                               'row' => $row,
-                               'HTML' => $HTML,
-                               'hasSub' => $nextCount && $this->expandNext($newID),
-                               'isFirst' => $a == 1,
-                               'isLast' => FALSE,
-                               'invertedDepth' => $depth,
-                               'blankLineCode' => $blankLineCode,
-                               'bank' => $this->bank
-                       );
-               }
-               if ($a) {
-                       $this->tree[$treeKey]['isLast'] = TRUE;
-               }
-               $this->getDataFree($res);
-               $this->buffer_idH = $idH;
-               return $c;
-       }
-
 }
index ca1e1ef..eb3ad3e 100644 (file)
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Beuser\Controller;
  */
 
 use TYPO3\CMS\Backend\Tree\View\PageTreeView;
-use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -145,7 +144,7 @@ class PermissionController extends ActionController {
                $beGroupArray = BackendUtility::getGroupNames();
                $this->view->assign('beGroups', $beGroupArray);
 
-               /** @var PageTreeView */
+               /** @var $tree PageTreeView */
                $tree = GeneralUtility::makeInstance(PageTreeView::class);
                $tree->init();
                $tree->addField('perms_user', TRUE);
@@ -159,12 +158,13 @@ class PermissionController extends ActionController {
                $tree->addField('endtime');
                $tree->addField('editlock');
 
-               // Creating top icon; the current page
-               $html = IconUtility::getSpriteIconForRecord('pages', $this->pageInfo);
-               $tree->tree[] = array('row' => $this->pageInfo, 'HTML' => $html);
-
                // Create the tree from $this->id
-               $tree->getTree($this->id, $this->depth, '');
+               if ($this->id) {
+                       $tree->tree[] = array('row' => $this->pageInfo, 'HTML' => $tree->getIcon($this->id));
+               } else {
+                       $tree->tree[] = array('row' => $this->pageInfo, 'HTML' => $tree->getRootIcon($this->pageInfo));
+               }
+               $tree->getTree($this->id, $this->depth);
                $this->view->assign('viewTree', $tree->tree);
 
                // CSH for permissions setting
index 799d0db..8c158e5 100644 (file)
@@ -46,7 +46,7 @@
                                                                                data-uid="{data.row.uid}"
                                                                                data-listfr="1"
                                                                        >
-                                                                               <f:format.raw>{data.HTML}</f:format.raw>
+                                                                               <f:format.raw>{data.depthData}{data.HTML}</f:format.raw>
                                                                                {data.row.title -> f:format.crop(maxCharacters:20)}
                                                                        </a>
                                                                </td>
index c94d1e2..be361d5 100644 (file)
@@ -113,6 +113,7 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
                        $langRecUids[0][] = $data['row']['uid'];
                        // Page icons / titles etc.
                        $tCells[] = '<td' . ($data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '') . '>' .
+                               ($data['depthData'] ?: '') .
                                $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($data['HTML'], 'pages', $data['row']['uid']) .
                                '<a href="#" onclick="' . htmlspecialchars(
                                        'top.loadEditId(' . (int)$data['row']['uid'] . ',"&SET[language]=0"); return false;'