[BUGFIX] Distinguish unassigend columns and colPos 0 89/25389/3
authorPhilipp Gampe <philipp.gampe@typo3.org>
Wed, 13 Nov 2013 17:52:52 +0000 (18:52 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Tue, 26 Nov 2013 22:12:44 +0000 (23:12 +0100)
When using backend layout columns without a colPos value they should be
just placeholders with the label "Not assigned". Currently they are
showing the content of the column 0 instead if there is such a column in
the backend layout.

The label "Not assigned" is used for columns without any
label, otherwise the label is used together with the suffix
"(Not assigned)".

Change-Id: I02c418eebdd9345c3066aa8c3eeec353d2cd9e58
Resolves: #25157
Resolves: #45550
Releases: 4.5, 4.7, 6.0, 6.1, 6.2
Reviewed-on: https://review.typo3.org/25389
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/cms/layout/class.tx_cms_layout.php

index bcd18c4..1782ea2 100755 (executable)
@@ -626,17 +626,19 @@ class tx_cms_layout extends recordList {
                                                                        ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') .
                                                                        ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') .
                                                                        ' class="t3-gridCell t3-page-column t3-page-column-' . $columnKey .
-                                                                       (!isset($columnConfig['colPos']) ? ' t3-gridCell-unassigned' : '') .
-                                                                       ((isset($columnConfig['colPos']) && $head[$columnKey]) ? ' t3-gridCell-restricted' : '') .
+                                                                       ((!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '') ? ' t3-gridCell-unassigned' : '') .
+                                                                       ((isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey]) ? ' t3-gridCell-restricted' : '') .
                                                                        ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') .
                                                                        ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';
 
                                                        // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
                                                        // If not, a new header without any buttons will be generated.
-                                                       if (isset($columnConfig['colPos']) && $head[$columnKey]) {
+                                                       if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey]) {
                                                                $grid .= $head[$columnKey] . $content[$columnKey];
-                                                       } else if ($columnConfig['colPos']) {
+                                                       } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '') {
                                                                $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->getLL('noAccess'), '', '');
+                                                       } elseif (isset($columnConfig['name']) && strlen($columnConfig['name']) > 0) {
+                                                               $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->sL($columnConfig['name']) . ' (' . $GLOBALS['LANG']->getLL('notAssigned') . ')', '', '');
                                                        } else {
                                                                $grid .= $this->tt_content_drawColHeader($GLOBALS['LANG']->getLL('notAssigned'), '', '');
                                                        }