Added feature #2859: List view should have 'collapse' / 'expand' functionality for...
authorBenni Mack <benni.mack@typo3.org>
Sat, 28 Feb 2009 19:49:05 +0000 (19:49 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sat, 28 Feb 2009 19:49:05 +0000 (19:49 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5108 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/class.db_list.inc
typo3/class.db_list_extra.inc
typo3/stylesheet.css
typo3/sysext/lang/locallang_core.xml
typo3/sysext/t3skin/stylesheets/typo3-db-list-php.css

index f9c2cc2..ca80209 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2009-02-28  Benjamin Mack  <benni@typo3.org>
 
+       * Added feature #2859: List view should have 'collapse' / 'expand' functionality for all list types (Thanks to Christian Kuhn)
        * Fixed bug #4367: Reset recs with clear_all should reset as array, not as string (Thanks to Christian Kuhn)
 
 2009-02-27  Jeff Segars  <jeff@webempoweredchurch.org>
index 44a47bd..c13982e 100755 (executable)
@@ -119,6 +119,7 @@ class recordList extends t3lib_recordList {
        var $pageRecord = array();              // Loaded with page record with version overlay if any.
        var $hideTables = '';                   // Tables which should not get listed
        var $tableTSconfigOverTCA = array(); //TSconfig which overwrites TCA-Settings
+       var $tablesCollapsed = array(); // Array of collapsed / uncollapsed tables in multi table view
 
                // Internal, dynamic:
        var $JScode = '';                               // JavaScript code accumulation
@@ -189,6 +190,20 @@ class recordList extends t3lib_recordList {
                        }
                }
 
+               // Get configuration of collapsed tables from user uc and merge with sanitized GP vars
+               $this->tablesCollapsed = is_array($GLOBALS['BE_USER']->uc['moduleData']['db_list.php']) ? $GLOBALS['BE_USER']->uc['moduleData']['db_list.php'] : array();
+               $collapseOverride = t3lib_div::_GP('collapse');
+               if (is_array($collapseOverride)) {
+                       foreach($collapseOverride as $collapseTable => $collapseValue) {
+                               if (is_array($GLOBALS['TCA'][$collapseTable]) && ($collapseValue == 0 || $collapseValue == 1)) {
+                                       $this->tablesCollapsed[$collapseTable] = $collapseValue;
+                               }
+                       }
+                       // Save modified user uc
+                       $GLOBALS['BE_USER']->uc['moduleData']['db_list.php'] = $this->tablesCollapsed;
+                       $GLOBALS['BE_USER']->writeUC($GLOBALS['BE_USER']->uc);
+               }
+
                if ($sL>0)      {
                        $tree = $this->getTreeObject($id,$sL,$this->perms_clause);
                        $this->pidSelect = 'pid IN ('.implode(',',$tree->ids).')';
index 31ac65c..833642e 100755 (executable)
@@ -275,6 +275,7 @@ class localRecordList extends recordList {
                $titleCol = $TCA[$table]['ctrl']['label'];
                $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
                $l10nEnabled = $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField'] && !$TCA[$table]['ctrl']['transOrigPointerTable'];
+               $tableCollapsed = (!$this->tablesCollapsed[$table]) ? false : true;
 
                        // prepare space icon
                $iconWidth  = $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  ? $GLOBALS['TBE_STYLES']['skinImgAutoCfg']['iconSizeWidth']  : 12;
@@ -403,7 +404,8 @@ class localRecordList extends recordList {
 
                        // If the count query returned any number of records, we perform the real query, selecting records.
                if ($this->totalItems)  {
-                       if ($listOnlyInSingleTableMode) {
+                       // Fetch records only if not in single table mode or if in multi table mode and not collapsed
+                       if ($listOnlyInSingleTableMode || (!$this->table && $tableCollapsed)) {
                                $dbCount = $this->totalItems;
                        } else {
                                        // set the showLimit to the number of records when outputting as CSV
@@ -458,11 +460,16 @@ class localRecordList extends recordList {
                                        }
                                }
                        } else {
-                               $theUpIcon = ($table=='pages'&&$this->id&&isset($this->pageRow['pid'])) ? '<a href="'.htmlspecialchars($this->listURL($this->pageRow['pid'])).'" onclick="setHighlight('.$this->pageRow['pid'].')"><img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/pages_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" /></a>':'';
-                               $out.=$this->addelement(1,$theUpIcon,$theData,' class="c-headLineTable"','');
+                               // Render collapse button if in multi table mode
+                               $collapseIcon = '';
+                               if (!$this->table) {
+                                       $collapseIcon = '<a href="' . htmlspecialchars($this->listURL()) . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1') . '"><img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/arrow' . ($tableCollapsed ? 'right' : 'down') . '.png') . ' class="collapseIcon" alt="" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandTable',1) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.collapseTable',1)) . '" /></a>';
+                               }
+                               $out .= $this->addelement(1, $collapseIcon, $theData, ' class="c-headLineTable"', '');
                        }
 
-                       If (!$listOnlyInSingleTableMode)        {
+                       // Render table rows only if in multi table view and not collapsed or if in single table view
+                       if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
                                        // Fixing a order table for sortby tables
                                $this->currentTable = array();
                                $currentIdList = array();
index 4efecab..6949f32 100755 (executable)
@@ -1838,6 +1838,10 @@ table.typo3-dblist tr td.col-icon a {
        display: block;
 }
 
+table.typo3-dblist tr td.col-icon a img.collapseIcon {
+       margin-left: 2px;
+}
+
 table.typo3-dblist tr td.col-title {
        width: 240px;
        overflow: hidden;
index 4b784dd..53c03dc 100755 (executable)
@@ -21,6 +21,8 @@
                        <label index="labels.path">Path</label>
                        <label index="labels.table">Table</label>
                        <label index="labels.upOneLevel">Up one level</label>
+                       <label index="labels.expandTable">Expand table</label>
+                       <label index="labels.collapseTable">Collapse table</label>
                        <label index="labels.enterSearchString">Search String:</label>
                        <label index="labels.enterSearchLevels">This page|1 level down|2 levels down|3 levels down|4 levels down</label>
                        <label index="labels.noEditPermission">Sorry, you didn't have proper permissions to perform this change.</label>
index 0f25a52..16416ac 100644 (file)
@@ -57,6 +57,10 @@ table.typo3-page-stdlist tr td div.typo3-clipCtrl {
        background-color: transparent;
 }
 
+table.typo3-dblist tr td.col-icon a img.collapseIcon {
+       margin: 1px 0px 0px 2px;
+}
+
 tr.firstcol td.col-control,
 tr.firstcol td.col-clipboard {
        border-top: 1px solid #d7d8e2;