[BUGFIX] Filelist: Removed call to deprecated method render()
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / FileList.php
index 21a27a6..8cd814e 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
 use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\Resource\Folder;
@@ -460,7 +461,12 @@ class FileList extends AbstractRecordList
         } else {
             /** @var $flashMessage FlashMessage */
             $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('storageNotBrowsableMessage'), $this->getLanguageService()->getLL('storageNotBrowsableTitle'), FlashMessage::INFO);
-            $out = $flashMessage->render();
+            /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
+            $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+            /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+            $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
+            $defaultFlashMessageQueue->enqueue($flashMessage);
+            $out = '';
         }
         return $out;
     }
@@ -480,7 +486,7 @@ class FileList extends AbstractRecordList
             $parentFolder = $currentFolder->getParentFolder();
             if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
                 $levelUp = $this->linkWrapDir(
-                    '<span title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', true) . '">'
+                    '<span title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.upOneLevel', true) . '">'
                     . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render()
                     . '</span>',
                     $parentFolder
@@ -644,10 +650,12 @@ class FileList extends AbstractRecordList
      * the URL would be invalid
      *
      * @param string $altId
+     * @param string $table Table name to display. Enter "-1" for the current table.
+     * @param string $exclList Comma separated list of fields NOT to include ("sortField", "sortRev" or "firstElementNumber")
      *
      * @return string URL
      */
-    public function listURL($altId = '')
+    public function listURL($altId = '', $table = '-1', $exclList = '')
     {
         return GeneralUtility::linkThisScript(array(
             'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
@@ -987,14 +995,22 @@ class FileList extends AbstractRecordList
             }
 
             if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
-                $confirmationCheck = 'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) . ')';
+                $confirmationCheck = '1';
             } else {
-                $confirmationCheck = '1 == 1';
+                $confirmationCheck = '0';
             }
 
-            $removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('tce_file') . '&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . '&redirect=') . '+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
-
-            $cells['delete'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($removeOnClick) . '"  title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
+            $deleteUrl = BackendUtility::getModuleUrl('tce_file');
+            $confirmationMessage = sprintf($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText;
+            $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete');
+            $cells['delete'] = '<a href="#" class="btn btn-default t3js-filelist-delete" data-content="' . htmlspecialchars($confirmationMessage)
+                . '" data-check="' . $confirmationCheck
+                . '" data-delete-url="' . htmlspecialchars($deleteUrl)
+                . '" data-title="' . htmlspecialchars($title)
+                . '" data-identifier="' . htmlspecialchars($fileOrFolderObject->getCombinedIdentifier())
+                . '" data-veri-code="' . $this->getBackendUser()->veriCode()
+                . '" title="' . htmlspecialchars($title) . '">'
+                . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
         } else {
             $cells['delete'] = $this->spaceIcon;
         }