[TASK] Show upload files button in filelist options if folder 56/54456/2
authorGianluigi Martino <gmartino27@gmail.com>
Tue, 10 Oct 2017 06:24:27 +0000 (08:24 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 20 Oct 2017 11:57:29 +0000 (13:57 +0200)
At the moment there is only a clickmenu entry to upload files
without entering the folder. With this patch the uploads files button is
also listed as button in option list.

Resolves: #82711
Releases: master, 8.7
Change-Id: Ice84d96a8ee5fad8dbcb9dbc728312ebb63df720
Reviewed-on: https://review.typo3.org/54456
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/filelist/Classes/FileList.php

index 70662e9..29b60f2 100644 (file)
@@ -978,6 +978,16 @@ class FileList extends AbstractRecordList
         } else {
             $cells['rename'] = $this->spaceIcon;
         }
+
+        // upload files
+        if ($fileOrFolderObject->getStorage()->checkUserActionPermission('add', 'File') && $fileOrFolderObject->checkActionPermission('write')) {
+            if ($fileOrFolderObject instanceof Folder) {
+                $url = BackendUtility::getModuleUrl('file_upload', ['target' => $fullIdentifier]);
+                $uploadOnClick = 'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) . '+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
+                $cells['upload'] = '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($uploadOnClick) . '"  title="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:cm.upload')) . '">' . $this->iconFactory->getIcon('actions-edit-upload', Icon::SIZE_SMALL)->render() . '</a>';
+            }
+        }
+
         if ($fileOrFolderObject->checkActionPermission('read')) {
             $infoOnClick = '';
             if ($fileOrFolderObject instanceof Folder) {