[TASK] Show info in empty list module 05/35505/3
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 16 Dec 2014 06:03:04 +0000 (07:03 +0100)
committerFrank Nägler <typo3@naegler.net>
Tue, 23 Dec 2014 17:17:11 +0000 (18:17 +0100)
If the selected page doesn't contain any records to edit, the module
is completly empty. This looks like an error ("white page").

Show a flash message instead.

Resolves: #58743
Releases: master
Change-Id: I4b3fa45d36e42a06ba9855d9d72f0995eac3b0dd
Reviewed-on: http://review.typo3.org/35505
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/lang/locallang_mod_web_list.xlf
typo3/sysext/recordlist/Classes/RecordList.php

index ecd92ec..8305f87 100644 (file)
                        <trans-unit id="missingTcaColumnsMessage" xml:space="preserve">
                                <source>Warning: No fields for table "%s" have been found. $TCA['%s']['columns'] does not contain the necessary definitions.</source>
                        </trans-unit>
+                       <trans-unit id="noRecordsOnThisPage" xml:space="preserve">
+                               <source>There are no records on this page.</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index 99a4910..bb57897 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Recordlist;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 
@@ -416,8 +417,20 @@ class RecordList {
                } else {
                        $this->body = $this->doc->header($this->pageinfo['title']);
                }
+
+               if (!empty($dblist->HTMLcode)) {
+                       $output = $dblist->HTMLcode;
+               } else {
+                       $output = $flashMessage = GeneralUtility::makeInstance(
+                               FlashMessage::class,
+                               $GLOBALS['LANG']->getLL('noRecordsOnThisPage'),
+                               '',
+                               FlashMessage::INFO
+                       )->render();
+               }
+
                $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
-               $this->body .= $dblist->HTMLcode;
+               $this->body .= $output;
                $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
                // If a listing was produced, create the page footer with search form etc:
                if ($dblist->HTMLcode) {