[BUGFIX] Provide page ID in pagetree overview 95/58295/9
authorGuido Schmechel <guido.schmechel@brandung.de>
Sun, 16 Sep 2018 16:47:44 +0000 (18:47 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 20 Sep 2018 10:48:32 +0000 (12:48 +0200)
Implement the page ID in pagetree and localization overview. And
make it controllable with User TS Config.

Resolves: #86269
Releases: master
Change-Id: Ie6fc1824aa3ecc781d3386017744c58604fb36e4
Reviewed-on: https://review.typo3.org/58295
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Tobi Kretschmann <tobi@tobishome.de>
Tested-by: Tobi Kretschmann <tobi@tobishome.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/info/Classes/Controller/TranslationStatusController.php

index 76df8e6..751b66a 100644 (file)
@@ -799,12 +799,12 @@ class PageLayoutView implements LoggerAwareInterface
                 }
                 switch ($field) {
                     case 'title':
-                        $theData[$field] = '&nbsp;' . $eI . '<strong>'
+                        $theData[$field] = $eI . '&nbsp;<strong>'
                             . $lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label'])
                             . '</strong>';
                         break;
                     case 'uid':
-                        $theData[$field] = '&nbsp;<strong>ID</strong>';
+                        $theData[$field] = '';
                         break;
                     default:
                         if (strpos($field, 'table_') === 0) {
@@ -818,7 +818,7 @@ class PageLayoutView implements LoggerAwareInterface
                                     '</span>';
                             }
                         } else {
-                            $theData[$field] = '&nbsp;&nbsp;' . $eI . '<strong>'
+                            $theData[$field] = $eI . '&nbsp;<strong>'
                                 . htmlspecialchars($lang->sL($GLOBALS['TCA']['pages']['columns'][$field]['label']))
                                 . '</strong>';
                         }
@@ -1765,6 +1765,8 @@ class PageLayoutView implements LoggerAwareInterface
      */
     public function pages_drawItem($row, $fieldArr)
     {
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+
         // Initialization
         $theIcon = $this->getIcon('pages', $row);
         // Preparing and getting the data-array
@@ -1772,8 +1774,9 @@ class PageLayoutView implements LoggerAwareInterface
         foreach ($fieldArr as $field) {
             switch ($field) {
                 case 'title':
+                    $showPageId = !empty($userTsConfig['options.']['pageTree.']['showPageIdWithTitle']);
                     $pTitle = htmlspecialchars(BackendUtility::getProcessedValue('pages', $field, $row[$field], 20));
-                    $theData[$field] = $row['treeIcons'] . $theIcon . $pTitle;
+                    $theData[$field] = $row['treeIcons'] . $theIcon . ($showPageId ? '[' . $row['uid'] . '] ' : '') . $pTitle;
                     break;
                 case 'php_tree_stop':
                     // Intended fall through
index e9040ee..fd2eb6e 100644 (file)
@@ -212,9 +212,14 @@ class TranslationStatusController
         $newOL_js = [];
         $langRecUids = [];
         $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
+
+        $userTsConfig = $this->getBackendUser()->getTSConfig();
+        $showPageId = !empty($userTsConfig['options.']['pageTree.']['showPageIdWithTitle']);
+
         foreach ($tree->tree as $data) {
             $tCells = [];
             $langRecUids[0][] = $data['row']['uid'];
+            $pageTitle = ($showPageId ? '[' . (int)$data['row']['uid'] . '] ' : '') . GeneralUtility::fixed_lgd_cs($data['row']['title'], $titleLen);
             // Page icons / titles etc.
             $tCells[] = '<td' . ($data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : '') . '>' .
                 ($data['depthData'] ?: '') .
@@ -222,7 +227,7 @@ class TranslationStatusController
                 '<a href="#" onclick="' . htmlspecialchars(
                     'top.loadEditId(' . (int)$data['row']['uid'] . ',"&SET[language]=0"); return false;'
                 ) . '" title="' . $lang->sL('LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_editPage') . '">' .
-                htmlspecialchars(GeneralUtility::fixed_lgd_cs($data['row']['title'], $titleLen)) .
+                htmlspecialchars($pageTitle) .
                 '</a>' .
                 ((string)$data['row']['nav_title'] !== '' ? ' [Nav: <em>' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($data['row']['nav_title'], $titleLen)) . '</em>]' : '') .
                 '</td>';
@@ -284,7 +289,7 @@ class TranslationStatusController
                         $langRecUids[$languageId][] = $row['uid'];
                         $status = $row['_HIDDEN'] ? (GeneralUtility::hideIfNotTranslated($data['row']['l18n_cfg']) || GeneralUtility::hideIfDefaultLanguage($data['row']['l18n_cfg']) ? 'danger' : '') : 'success';
                         $icon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL)->render();
-                        $info = $icon . htmlspecialchars(
+                        $info = $icon . ($showPageId ? ' [' . (int)$row['uid'] . ']' : '') . ' ' . htmlspecialchars(
                                 GeneralUtility::fixed_lgd_cs($row['title'], $titleLen)
                             ) . ((string)$row['nav_title'] !== '' ? ' [Nav: <em>' . htmlspecialchars(
                                 GeneralUtility::fixed_lgd_cs($row['nav_title'], $titleLen)