[BUGFIX] Filelist: Only show paste buttons if clipObj is set 14/21514/2
authorPhilipp Gampe <philipp.gampe@typo3.org>
Tue, 28 May 2013 13:14:19 +0000 (15:14 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 19 Jun 2013 19:53:59 +0000 (21:53 +0200)
During introduction of the paste buttons for empty folders, I assumed
that the clipboard object is always set.
This might not be the case, e.g. in EXT:sphinx 4.0.0.

Wrap the paste button code with a check if the clibObj is set.

We can not set the clibObj here, because it depends on variables of the
calling class.

Resolves: #48603
Releases: 6.2, 6.1, 6.0
Change-Id: I2c7c322c9cb994cfdfa1511c96e8c7da143dc77a
Reviewed-on: https://review.typo3.org/21514
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/filelist/Classes/FileList.php

index 532a9d3..1713286 100644 (file)
@@ -81,6 +81,13 @@ class FileListController {
        public $overwriteExistingFiles;
 
        /**
+        * The file list object
+        *
+        * @var \TYPO3\CMS\Filelist\FileList
+        */
+       public $filelist = NULL;
+
+       /**
         * Initialize variables, file object
         * Incoming GET vars include id, pointer, table, imagemode
         *
index b02213e..e0e9198 100644 (file)
@@ -229,11 +229,14 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        if ($this->clickMenus) {
                                $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'], $folderObject->getCombinedIdentifier());
                        }
-                       // Add paste button
-                       $elFromTable = $this->clipObj->elFromTable('_FILE');
-                       if (count($elFromTable)) {
-                               $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                       // Add paste button if clipboard is initialized
+                       if ($this->clipObj instanceof \TYPO3\CMS\Backend\Clipboard\Clipboard) {
+                               $elFromTable = $this->clipObj->elFromTable('_FILE');
+                               if (count($elFromTable)) {
+                                       $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                               }
                        }
+
                }
                $buttons['refresh'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.reload', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                return array($buttons, $otherMarkers);