[FEATURE] TCA/ctrl/descriptionColumn 60/40360/12
authorFelix Kopp <felix-source@phorax.com>
Wed, 17 Jun 2015 18:08:50 +0000 (20:08 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Fri, 17 Jul 2015 12:15:23 +0000 (14:15 +0200)
The description for content is shown in page view, for backend user
(groups) it is shown in the title of the icons in the BE user module‚Äôs
list views.

Change-Id: I347483b3a2bafeef6f9b9b4061df15cf12a8f463
Releases: master
Resolves: #67603
Related: #67550
Related: #67578
Reviewed-on: http://review.typo3.org/40360
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
13 files changed:
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/beuser/Classes/Domain/Model/BackendUser.php
typo3/sysext/beuser/Classes/Domain/Model/BackendUserGroup.php
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUser/OnlineListRow.html
typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/IndexListRow.html
typo3/sysext/core/Configuration/TCA/be_users.php
typo3/sysext/css_styled_content/Configuration/TCA/Overrides/tt_content.php
typo3/sysext/frontend/Configuration/TCA/tt_content.php
typo3/sysext/frontend/ext_tables.sql
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index e9da5a5..0077cff 100644 (file)
@@ -1059,7 +1059,6 @@ class PageLayoutController {
                // Add the content for each table we have rendered (traversing $tableOutput variable)
                foreach ($tableOutput as $table => $output) {
                        $content .= $this->doc->section('', $output, TRUE, TRUE, 0, TRUE);
-                       $content .= $this->doc->spacer(15);
                        $content .= $this->doc->sectionEnd();
                }
                // Making search form:
index c90dec8..213c78a 100644 (file)
@@ -1841,9 +1841,10 @@ class BackendUtility {
                if ($table == 'pages') {
                        $out = self::titleAttribForPages($row, '', 0);
                } else {
+                       $out = !empty(trim($GLOBALS['TCA'][$table]['ctrl']['descriptionColumn'])) ? $row[$GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']] . ' ' : '';
                        $ctrl = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
                        // Uid is added
-                       $out = 'id=' . $row['uid'];
+                       $out .= '(id=' . $row['uid'] . ')';
                        if ($table == 'pages' && $row['alias']) {
                                $out .= ' / ' . $row['alias'];
                        }
index 7fb503c..0568e34 100644 (file)
@@ -1083,7 +1083,12 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                $info = array();
                $this->getProcessedValue('tt_content', 'starttime,endtime,fe_group,spaceBefore,spaceAfter', $row, $info);
 
-               // Call drawFooter hooks
+               // Content element annotation
+               if (!empty($GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn'])) {
+                       $info[] = htmlspecialchars($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']]);
+               }
+
+                       // Call drawFooter hooks
                $drawFooterHooks = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'];
                if (is_array($drawFooterHooks)) {
                        foreach ($drawFooterHooks as $hookClass) {
@@ -1241,6 +1246,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                $out = '';
                $outHeader = '';
                // Make header:
+
                if ($row['header']) {
                        $infoArr = array();
                        $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
index 68926b4..acb5c44 100644 (file)
@@ -35,6 +35,11 @@ class BackendUser extends \TYPO3\CMS\Extbase\Domain\Model\BackendUser {
        /**
         * @var string
         */
+       protected $description;
+
+       /**
+        * @var string
+        */
        protected $fileMountPoints = '';
 
        /**
@@ -73,6 +78,20 @@ class BackendUser extends \TYPO3\CMS\Extbase\Domain\Model\BackendUser {
        }
 
        /**
+        * @return string
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+
+       /**
+        * @param string $description
+        */
+       public function setDescription($description) {
+               $this->description = $description;
+       }
+
+       /**
         * @param string $fileMountPoints
         * @return void
         */
index 71a895b..047bc82 100644 (file)
@@ -25,6 +25,11 @@ class BackendUserGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
        protected $title;
 
        /**
+        * @var string
+        */
+       protected $description;
+
+       /**
         * @var bool
         */
        protected $hidden;
@@ -36,11 +41,6 @@ class BackendUserGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
        protected $subGroups;
 
        /**
-        * @var string
-        */
-       protected $description;
-
-       /**
         * @param string $title
         */
        public function setTitle($title) {
index 047279a..6a06cf7 100644 (file)
@@ -3,7 +3,7 @@
 
 <tr>
        <td class="col-icon">
-               <a href="#" class="t3-js-clickmenutrigger" data-table="be_users" data-uid="{backendUser.uid}" data-listframe="1" title="id={backendUser.uid}">
+               <a href="#" class="t3-js-clickmenutrigger" data-table="be_users" data-uid="{backendUser.uid}" data-listframe="1" title="{f:if(condition: '{backendUser.description}', then: '{backendUser.description} ')}(id={backendUser.uid})">
                        <bu:spriteIconForRecord table="be_users" object="{backendUser}" />
                </a>
        </td>
index 5a82c29..8d275cd 100644 (file)
@@ -6,7 +6,7 @@
                <f:if condition="{it.isFirst}">
                        <f:then>
                                <td class="col-icon">
-                                       <a href="#" class="t3-js-clickmenutrigger" data-table="be_users" data-uid="{onlineUser.backendUser.uid}" data-listframe="1" title="id={onlineUser.backendUser.uid}">
+                                       <a href="#" class="t3-js-clickmenutrigger" data-table="be_users" data-uid="{onlineUser.backendUser.uid}" data-listframe="1" title="{f:if(condition: '{onlineUser.backendUser.description}', then: '{onlineUser.backendUser.description} ')}(id={onlineUser.backendUser.uid})">
                                                <bu:spriteIconForRecord table="be_users" object="{onlineUser.backendUser}" />
                                        </a>
                                </td>
index d139fef..6b198d3 100644 (file)
@@ -3,7 +3,7 @@
 
 <tr>
        <td class="col-icon">
-               <a href="#" class="t3-js-clickmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" data-listframe="1" title="id={backendUserGroup.uid}">
+               <a href="#" class="t3-js-clickmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" data-listframe="1" title="{f:if(condition: '{backendUserGroup.description}', then: '{backendUserGroup.description} ')}(id={backendUserGroup.uid})">
                        <bu:spriteIconForRecord table="be_groups" object="{backendUserGroup}" />
                </a>
        </td>
index ee863cc..360004e 100644 (file)
@@ -375,6 +375,14 @@ return array(
                                'minitems' => 0,
                                'maxitems' => 9999
                        )
+               ),
+               'description' => array(
+                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.description',
+                       'config' => array(
+                               'type' => 'text',
+                               'rows' => 5,
+                               'cols' => 30
+                       )
                )
        ),
        'types' => array(
@@ -389,4 +397,4 @@ return array(
                        --div--;LLL:EXT:lang/locallang_tca.xlf:be_users.tabs.access, starttime,endtime,
                        --div--;LLL:EXT:lang/locallang_tca.xlf:be_users.tabs.extended')
        )
-);
+);
\ No newline at end of file
index 315e2c3..d2382f4 100644 (file)
@@ -481,7 +481,7 @@ $GLOBALS['TCA']['tt_content']['palettes'] = array_replace(
 // Field arrangement for CE "header"
 $GLOBALS['TCA']['tt_content']['types']['header']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,rowDescription,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
@@ -493,7 +493,7 @@ $GLOBALS['TCA']['tt_content']['types']['header']['showitem'] = '
 // Field arrangement for CE "text"
 $GLOBALS['TCA']['tt_content']['types']['text']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
                bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext_formlabel,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
@@ -517,7 +517,7 @@ $GLOBALS['TCA']['tt_content']['types']['text']['columnsOverrides']['bodytext']['
 // Field arrangement for CE "textpic"
 $GLOBALS['TCA']['tt_content']['types']['textpic']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
                bodytext;Text,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.images,
                image,
@@ -542,7 +542,7 @@ $GLOBALS['TCA']['tt_content']['types']['textpic']['columnsOverrides']['bodytext'
 // Field arrangement for CE "image"
 $GLOBALS['TCA']['tt_content']['types']['image']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.images,
                image,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.imagelinks;imagelinks,
@@ -559,7 +559,7 @@ $GLOBALS['TCA']['tt_content']['types']['image']['showitem'] = '
 // Field arrangement for CE "bullets"
 $GLOBALS['TCA']['tt_content']['types']['bullets']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
                bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.bulletlist_formlabel,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
@@ -579,7 +579,7 @@ $GLOBALS['TCA']['tt_content']['types']['bullets']['columnsOverrides']['bodytext'
 // Field arrangement for CE "table"
 $GLOBALS['TCA']['tt_content']['types']['table']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:CType.I.5,
                --palette--;;10,
                cols,
@@ -604,7 +604,7 @@ $GLOBALS['TCA']['tt_content']['types']['table']['columnsOverrides']['bodytext'][
 // Field arrangement for CE "uploads"
 $GLOBALS['TCA']['tt_content']['types']['uploads']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:media;uploads,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
@@ -618,7 +618,7 @@ $GLOBALS['TCA']['tt_content']['types']['uploads']['showitem'] = '
 // Field arrangement for CE "menu"
 $GLOBALS['TCA']['tt_content']['types']['menu']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.menu;menu,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.menu_accessibility;menu_accessibility,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
@@ -632,7 +632,7 @@ $GLOBALS['TCA']['tt_content']['types']['menu']['showitem'] = '
 // Field arrangement for CE "shortcut"
 $GLOBALS['TCA']['tt_content']['types']['shortcut']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.shortcut_formlabel,
+               header,rowDescription;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.shortcut_formlabel,
                records;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:records_formlabel,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
@@ -645,7 +645,7 @@ $GLOBALS['TCA']['tt_content']['types']['shortcut']['showitem'] = '
 // Field arrangement for CE "list"
 $GLOBALS['TCA']['tt_content']['types']['list']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,
+               --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.header;header,rowDescription,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.plugin,
                list_type;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:list_type_formlabel,
                select_key;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:select_key_formlabel,
@@ -662,7 +662,7 @@ $GLOBALS['TCA']['tt_content']['types']['list']['showitem'] = '
 // Field arrangement for CE "div"
 $GLOBALS['TCA']['tt_content']['types']['div']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.div_formlabel,
+               header,rowDescription;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.div_formlabel,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,
@@ -674,7 +674,7 @@ $GLOBALS['TCA']['tt_content']['types']['div']['showitem'] = '
 // Field arrangement for CE "html"
 $GLOBALS['TCA']['tt_content']['types']['html']['showitem'] = '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
-               header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.html_formlabel,
+               header,rowDescription;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header.ALT.html_formlabel,
                bodytext;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:bodytext.ALT.html_formlabel,
        --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,
index e86ad44..76c1c16 100644 (file)
@@ -3,6 +3,7 @@ return array(
        'ctrl' => array(
                'label' => 'header',
                'label_alt' => 'subheader,bodytext',
+               'descriptionColumn' => 'rowDescription',
                'sortby' => 'sorting',
                'tstamp' => 'tstamp',
                'crdate' => 'crdate',
@@ -61,7 +62,7 @@ return array(
        ),
        'interface' => array(
                'always_description' => 0,
-               'showRecordFieldList' => 'CType,header,header_link,bodytext,image,media,imagewidth,imageorient,records,colPos,starttime,endtime,fe_group'
+               'showRecordFieldList' => 'CType,header,rowDescription,header_link,bodytext,image,media,imagewidth,imageorient,records,colPos,starttime,endtime,fe_group'
        ),
        'columns' => array(
                'CType' => array(
@@ -308,6 +309,14 @@ return array(
                                'max' => '256'
                        )
                ),
+               'rowDescription' => array(
+                       'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.description',
+                       'config' => array(
+                               'type' => 'text',
+                               'rows' => 5,
+                               'cols' => 30
+                       )
+               ),
                'header_link' => array(
                        'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link',
                        'exclude' => 1,
index fe7f479..9931507 100644 (file)
@@ -250,6 +250,7 @@ CREATE TABLE tt_content (
        sorting int(11) unsigned DEFAULT '0' NOT NULL,
        CType varchar(255) DEFAULT '' NOT NULL,
        header varchar(255) DEFAULT '' NOT NULL,
+       rowDescription text,
        bodytext mediumtext,
 
        # Even though we're using FAL and an IRRE field for images
index f761cc3..2f6d93a 100644 (file)
@@ -320,6 +320,11 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
         * @return string HTML table with the listing for the record.
         */
        public function getTable($table, $id, $rowList = '') {
+               $rowListArray = GeneralUtility::trimExplode(',', $rowList, TRUE);
+               // if no columns have been specified, show description (if configured)
+               if (!empty($GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']) && empty($rowListArray)) {
+                       array_push($rowListArray, $GLOBALS['TCA'][$table]['ctrl']['descriptionColumn']);
+               }
                $backendUser = $this->getBackendUserAuthentication();
                $lang = $this->getLanguageService();
                $db = $this->getDatabaseConnection();
@@ -365,7 +370,7 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                        )';
                }
                // Cleaning up:
-               $this->fieldArray = array_unique(array_merge($this->fieldArray, GeneralUtility::trimExplode(',', $rowList, TRUE)));
+               $this->fieldArray = array_unique(array_merge($this->fieldArray, $rowListArray));
                if ($this->noControlPanels) {
                        $tempArray = array_flip($this->fieldArray);
                        unset($tempArray['_CONTROL_']);
@@ -1915,4 +1920,4 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                return $GLOBALS['TBE_TEMPLATE'];
        }
 
-}
+}
\ No newline at end of file