[TASK] Adopt standard list layout for page records list
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 8 Jul 2012 12:55:05 +0000 (14:55 +0200)
committerGeorg Ringer <mail@ringerge.org>
Sat, 18 Aug 2012 08:19:54 +0000 (10:19 +0200)
Make record list on pages flexible and conform with list layout.
Before this patch the table width was forced to 480px.

Also adds header for each record list with total count and title.
Moves the click menu and edit link to standard positions in table.
Now includes the record list hover styles and standard paddings.

CSS styles for previous non-standard table style are removed:
there were no further references for ".typo3-page-stdlist".

Change-Id: I9245442f174a5c82cd5c1cb0ab41dc0ea680fb24
Resolves: #38368
Releases: 6.0
Reviewed-on: http://review.typo3.org/12709
Reviewed-by: Ingo Renner
Tested-by: Ingo Renner
Reviewed-by: Stefan Neufeind
Reviewed-by: Felix Kopp
Tested-by: Felix Kopp
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/t3skin/stylesheets/structure/module_web_page.css
typo3/sysext/t3skin/stylesheets/visual/module_web_list.css
typo3/sysext/t3skin/stylesheets/visual/module_web_page.css

index 1912d74..21aa9de 100755 (executable)
@@ -845,78 +845,90 @@ class tx_cms_layout extends recordList {
         */
        function makeOrdinaryList($table, $id, $fList, $icon = 0, $addWhere = '') {
 
-                       // Initialize:
-               $out = '';
+                       // Initialize
                $queryParts = $this->makeQueryArray($table, $id, $addWhere);
                $this->setTotalItems($queryParts);
                $dbCount = 0;
 
-                       // Make query for records if there were any records found in the count operation:
+                       // Make query for records if there were any records found in the count operation
                if ($this->totalItems) {
                        $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
                        $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
                }
 
-                       // If records were found, render the list:
+                       // If records were found, render the list
+               if ($dbCount == 0) {
+                       return '';
+               }
+
+                       // Set fields
                $out = '';
-               if ($dbCount) {
+               $this->fieldArray = t3lib_div::trimExplode(',', '__cmds__,' . $fList . ',__editIconLink__', TRUE);
 
-                               // Set fields
-                       $this->fieldArray = t3lib_div::trimExplode(',', '__cmds__,' . $fList, TRUE);
+               $theData = array();
+               $theData = $this->headerFields($this->fieldArray, $table, $theData);
 
-                               // Header line is drawn
-                       $theData = array();
-                       $theData = $this->headerFields($this->fieldArray, $table, $theData);
-                       if ($this->doEdit) {
-                               $theData['__cmds__'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $table . '][' . $this->id . ']=new', $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' .
-                                               t3lib_iconWorks::getSpriteIcon('actions-document-new') .
-                                               '</a>';
-                       }
-                       $out .= $this->addelement(1, '', $theData, ' class="c-headLine"', 15);
+                       // Title row
+               $localizedTableTitle = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'], 1);
+               $out .= '<tr class="t3-row-header">' .
+                               '<td nowrap="nowrap" class="col-icon"></td>' .
+                               '<td nowrap="nowrap" colspan="' . (count($theData) - 2) . '"><span class="c-table">' . $localizedTableTitle . '</span> (' . $dbCount . ')</td>' .
+                               '<td nowrap="nowrap" class="col-icon"></td>' .
+                               '</tr>';
 
-                               // Render Items
-                       $this->eCounter = $this->firstElementNumber;
-                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
-                               t3lib_BEfunc::workspaceOL($table, $row);
+                       // Column's titles
+               if ($this->doEdit) {
+                       $theData['__cmds__'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[' . $table . '][' . $this->id . ']=new', $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' .
+                                       t3lib_iconWorks::getSpriteIcon('actions-document-new') .
+                                       '</a>';
 
-                               if (is_array($row)) {
-                                       list($flag, $code) = $this->fwd_rwd_nav();
-                                       $out .= $code;
-                                       if ($flag) {
-                                               $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
-                                               $Nrow = array();
-
-                                                       // Setting icons/edit links:
-                                               if ($icon) {
-                                                       $Nrow['__cmds__'] = $this->getIcon($table, $row);
-                                               }
-                                               if ($this->doEdit) {
-                                                       $Nrow['__cmds__'] .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' .
-                                                                       t3lib_iconWorks::getSpriteIcon('actions-document-open') .
-                                                                       '</a>';
-                                               } else {
-                                                       $Nrow['__cmds__'] .= $this->noEditIcon();
-                                               }
+               }
+               $out .= $this->addelement(1, '', $theData, ' class="c-headLine"', 15);
+
+                       // Render Items
+               $this->eCounter = $this->firstElementNumber;
+               while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
+                       t3lib_BEfunc::workspaceOL($table, $row);
+
+                       if (is_array($row)) {
+                               list($flag, $code) = $this->fwd_rwd_nav();
+                               $out .= $code;
+                               if ($flag) {
+                                       $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
+                                       $Nrow = array();
+
+                                               // Setting icons links
+                                       if ($icon) {
+                                               $Nrow['__cmds__'] = $this->getIcon($table, $row);
+                                       }
+
+                                               // Get values:
+                                       $Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
 
-                                                       // Get values:
-                                               $Nrow = $this->dataFields($this->fieldArray, $table, $row, $Nrow);
-                                               $tdparams = $this->eCounter % 2 ? ' class="bgColor4"' : ' class="bgColor4-20"';
-                                               $out .= $this->addelement(1, '', $Nrow, $tdparams);
+                                               // Attach edit icon
+                                       if ($this->doEdit) {
+                                               $Nrow['__editIconLink__'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' .
+                                                               t3lib_iconWorks::getSpriteIcon('actions-document-open') .
+                                                               '</a>';
+                                       } else {
+                                               $Nrow['__editIconLink__'] = $this->noEditIcon();
                                        }
-                                       $this->eCounter++;
+
+                                       $out .= $this->addelement(1, '', $Nrow, 'class="db_list_normal"');
                                }
+                               $this->eCounter++;
                        }
+               }
 
-                               // Wrap it all in a table:
-                       $out = '
+                       // Wrap it all in a table:
+               $out = '
+                       <!--
+                               Standard list of table "' . $table . '"
+                       -->
+                       <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist">
+                               ' . $out . '
+                       </table>';
 
-                               <!--
-                                       STANDARD LIST OF "' . $table . '"
-                               -->
-                               <table border="0" cellpadding="1" cellspacing="2" width="480" class="typo3-page-stdlist">
-                                       ' . $out . '
-                               </table>';
-               }
                return $out;
        }
 
@@ -989,7 +1001,7 @@ class tx_cms_layout extends recordList {
 
                foreach ($fieldArr as $fieldName) {
                        $ll = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$fieldName]['label'], 1);
-                       $out[$fieldName] = '<strong>' . ($ll ? $ll : '&nbsp;') . '</strong>';
+                       $out[$fieldName] = ($ll ? $ll : '&nbsp;');
                }
                return $out;
        }
index 44f0133..a815b86 100644 (file)
@@ -79,22 +79,6 @@ table.typo3-page-columnsMode img.c-divider {
        margin: 10px 0px 5px 0px;
 }
 
-table.typo3-page-stdlist {
-       margin-top: 10px;
-}
-
-table.typo3-page-stdlist tr td.c-headLine {
-       height: 24px;
-}
-
-table.typo3-page-stdlist tr.c-table-row-spacer td {
-       display: none;
-}
-
-table.typo3-page-stdlist tr td div.typo3-DBctrl {
-       padding: 2px;
-}
-
 td.t3-gridCell div.t3-page-ce {
        padding: 1px 5px 5px 5px;
 }
\ No newline at end of file
index fb09d58..4c886c4 100644 (file)
@@ -3,8 +3,7 @@ Web > List
 
 - - - - - - - - - - - - - - - - - - - - - */
 
-table.typo3-dblist,
-table.typo3-page-stdlist {
+table.typo3-dblist {
        background: #fff;
        border: 1px solid #a2aab8;
 }
@@ -13,8 +12,7 @@ table.typo3-dblist tr td.db_list_alt {
        background-color: #e3dfd3;
 }
 
-table.typo3-dblist tr.db_list_alt td,
-table.typo3-page-stdlist tr.db_list_alt td {
+table.typo3-dblist tr.db_list_alt td {
        background-color: #e4e5f0;
 }
 
@@ -25,13 +23,11 @@ tr.t3-row-header td {
        line-height: 16px;
 }
 
-table.typo3-page-stdlist .bgColor4,
 table#typo3-dblist-top table.bgColor4 {
        background-color: #efeff4;
 }
 
 table.typo3-dblist tr td.c-headLine,
-table.typo3-page-stdlist tr td.c-headLine,
 table.typo3-dblist tr.c-headLine td {
        border-bottom: 1px solid #cdcdcd;
 }
index 5a1f2ae..d4820aa 100644 (file)
@@ -91,10 +91,6 @@ table.t3-page-columns tr td span.exampleContent a {
        text-decoration: none;
 }
 
-table#typo3-page-stdlist tr td.c-headLine {
-       background-color: #d7dbe2;
-}
-
 table.typo3-page-buttons td {
        padding-right: 10px;
 }