[BUGFIX] Show clipboard if it contains elements 03/28603/3
authorNicole Cordes <typo3@cordes.co>
Fri, 21 Mar 2014 13:21:38 +0000 (14:21 +0100)
committerFrans Saris <franssaris@gmail.com>
Fri, 21 Mar 2014 14:12:57 +0000 (15:12 +0100)
On empty pages no page content is rendered at all. This patch brings the
clipboard back, if it contains elements so you can check those on the
empty pages. Besides the drawFooterHook is shown again on empty pages.
this isn't set in the core itself and extension authors should be able
to choose if the content should be visible on empty pages.

Resolves: #57062
Releases: 6.2
Change-Id: Ie7bd6fda730e801b285d7876a1eff39c3ba1eff0
Reviewed-on: https://review.typo3.org/28603
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Frans Saris
Tested-by: Frans Saris
typo3/sysext/backend/Classes/Clipboard/Clipboard.php
typo3/sysext/recordlist/Classes/RecordList.php

index 1f4f527..3734abf 100644 (file)
@@ -417,6 +417,21 @@ class Clipboard {
        }
 
        /**
+        * Returns true if the clipboard contains elements
+        *
+        * @return boolean
+        */
+       public function hasElements() {
+               foreach ($this->clipData as $data) {
+                       if (is_array($data['el']) && !empty($data['el'])) {
+                               return TRUE;
+                       }
+               }
+
+               return FALSE;
+       }
+
+       /**
         * Gets all localizations of the current record.
         *
         * @param string $table The table
index 6a1f882..f3a0b2c 100644 (file)
@@ -434,22 +434,22 @@ class RecordList {
                        $this->body .= '
                                                </form>
                                        </div>';
-                       // Printing clipboard if enabled:
-                       if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) {
-                               $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
-                       }
-                       // Search box:
-                       if (!$this->modTSconfig['properties']['disableSearchBox']) {
-                               $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
-                               $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>';
-                       }
-                       // Additional footer content
-                       $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'];
-                       if (is_array($footerContentHook)) {
-                               foreach ($footerContentHook as $hook) {
-                                       $params = array();
-                                       $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
-                               }
+               }
+               // Printing clipboard if enabled 
+               if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard && ($dblist->HTMLcode || $dblist->clipObj->hasElements())) {
+                       $this->body .= '<div class="db_list-dashboard">' . $dblist->clipObj->printClipboard() . '</div>';
+               }
+               // Search box:
+               if (!$this->modTSconfig['properties']['disableSearchBox'] && $dblist->HTMLcode) {
+                       $sectionTitle = BackendUtility::wrapInHelp('xMOD_csh_corebe', 'list_searchbox', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.search', TRUE));
+                       $this->body .= '<div class="db_list-searchbox">' . $this->doc->section($sectionTitle, $dblist->getSearchBox(), FALSE, TRUE, FALSE, TRUE) . '</div>';
+               }
+               // Additional footer content
+               $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['recordlist/mod1/index.php']['drawFooterHook'];
+               if (is_array($footerContentHook)) {
+                       foreach ($footerContentHook as $hook) {
+                               $params = array();
+                               $this->body .= GeneralUtility::callUserFunction($hook, $params, $this);
                        }
                }
                // Setting up the buttons and markers for docheader