diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-79310-AddOptionsAndClipboardToFilelistSearch.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-79310-AddOptionsAndClipboardToFilelistSearch.rst new file mode 100644 index 0000000000000000000000000000000000000000..15661f904cb009e16d72e884862292f386f53fe4 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-79310-AddOptionsAndClipboardToFilelistSearch.rst @@ -0,0 +1,22 @@ +.. include:: ../../Includes.txt + +============================================================== +Feature: #79310 - Add options and clipboard to filelist search +============================================================== + +See :issue:`79310` + +Description +=========== + +The filelist backend module now shows the clipboard and the display options +checkboxes on search results. + + +Impact +====== + +Files and folders can now be put on the clipboard when using the search result +view of the filelist backend module. + +.. index:: Backend, ext:filelist diff --git a/typo3/sysext/filelist/Classes/Controller/FileListController.php b/typo3/sysext/filelist/Classes/Controller/FileListController.php index 2a945311aa6bb66ac99ff5d053af7447ef8c3b32..d8a82ca6ca1ceb986da8cb5909be062b4402ec85 100644 --- a/typo3/sysext/filelist/Classes/Controller/FileListController.php +++ b/typo3/sysext/filelist/Classes/Controller/FileListController.php @@ -1,4 +1,5 @@ <?php + namespace TYPO3\CMS\Filelist\Controller; /* @@ -337,6 +338,7 @@ class FileListController extends ActionController implements LoggerAwareInterfac // There there was access to this file path, continue, make the list if ($this->folderObject) { + $this->initClipboard(); $userTsConfig = $this->getBackendUser()->getTSConfig(); $this->filelist = GeneralUtility::makeInstance(FileList::class); $this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs']; @@ -354,6 +356,7 @@ class FileListController extends ActionController implements LoggerAwareInterfac $this->filelist->clipObj->cleanCurrent(); // Saves $this->filelist->clipObj->endClipboard(); + // If the "cmd" was to delete files from the list (clipboard thing), do that: if ($this->cmd === 'delete') { $items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1); @@ -393,11 +396,7 @@ class FileListController extends ActionController implements LoggerAwareInterfac } // Set top JavaScript: - $this->view->getModuleTemplate()->addJavaScriptCode( - 'FileListIndex', - 'if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '"; - ' - ); + $this->addJumpToUrl(); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ClipboardComponent'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete'); $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons'); @@ -469,6 +468,7 @@ class FileListController extends ActionController implements LoggerAwareInterfac $this->view->assign('fileDenyPattern', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']); $this->view->assign('maxFileSize', GeneralUtility::getMaxUploadFileSize() * 1024); $this->view->assign('defaultAction', $this->getDefaultAction()); + $this->buildListOptionCheckboxes(); } else { $this->forward('missingFolder'); } @@ -551,9 +551,14 @@ class FileListController extends ActionController implements LoggerAwareInterfac $this->view->assign('settings', [ 'jsConfirmationDelete' => $this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE) ]); + $this->view->assign('moduleSettings', $this->MOD_SETTINGS); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete'); $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons'); + + $this->initClipboard(); + $this->buildListOptionCheckboxes($searchWord); + $this->addJumpToUrl(); } /** @@ -746,4 +751,101 @@ class FileListController extends ActionController implements LoggerAwareInterfac { return $GLOBALS['BE_USER']; } + + /** + * build option checkboxes for filelist + */ + protected function buildListOptionCheckboxes(string $searchWord = ''): void + { + $backendUser = $this->getBackendUser(); + $userTsConfig = $backendUser->getTSConfig(); + + $addParams = ''; + if ($searchWord) { + $addParams = '&tx_filelist_file_filelistlist%5Baction%5D=search'; + $addParams .= '&tx_filelist_file_filelistlist%5Bcontroller%5D=FileList'; + $addParams .= '&tx_filelist_file_filelistlist%5BsearchWord%5D=' . htmlspecialchars($searchWord); + } + $this->view->assign('checkboxes', [ + 'bigControlPanel' => [ + 'enabled' => $userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] === 'selectable', + 'label' => htmlspecialchars($this->getLanguageService()->getLL('bigControlPanel')), + 'html' => BackendUtility::getFuncCheck( + $this->id, + 'SET[bigControlPanel]', + $this->MOD_SETTINGS['bigControlPanel'] ?? '', + '', + $addParams, + 'id="bigControlPanel"' + ), + ], + 'displayThumbs' => [ + 'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] === 'selectable', + 'label' => htmlspecialchars($this->getLanguageService()->getLL('displayThumbs')), + 'html' => BackendUtility::getFuncCheck( + $this->id, + 'SET[displayThumbs]', + $this->MOD_SETTINGS['displayThumbs'] ?? '', + '', + $addParams, + 'id="checkDisplayThumbs"' + ), + ], + 'enableClipBoard' => [ + 'enabled' => $userTsConfig['options.']['file_list.']['enableClipBoard'] === 'selectable', + 'label' => htmlspecialchars($this->getLanguageService()->getLL('clipBoard')), + 'html' => BackendUtility::getFuncCheck( + $this->id, + 'SET[clipBoard]', + $this->MOD_SETTINGS['clipBoard'] ?? '', + '', + $addParams, + 'id="checkClipBoard"' + ), + ] + ]); + } + + /** + * init and assign clipboard to view + */ + protected function initClipboard(): void + { + // Create fileListing object + $this->filelist = GeneralUtility::makeInstance(FileList::class, $this); + $this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs']; + // Create clipboard object and initialize that + $this->filelist->clipObj = GeneralUtility::makeInstance(Clipboard::class); + $this->filelist->clipObj->fileMode = true; + $this->filelist->clipObj->initializeClipboard(); + $CB = GeneralUtility::_GET('CB'); + if ($this->cmd === 'setCB') { + $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge( + GeneralUtility::_POST('CBH'), + (array)GeneralUtility::_POST('CBC') + ), '_FILE'); + } + if (!$this->MOD_SETTINGS['clipBoard']) { + $CB['setP'] = 'normal'; + } + $this->filelist->clipObj->setCmd($CB); + $this->filelist->clipObj->cleanCurrent(); + // Saves + $this->filelist->clipObj->endClipboard(); + + $this->view->assign('showClipBoard', (bool)$this->MOD_SETTINGS['clipBoard']); + $this->view->assign('clipBoardHtml', $this->filelist->clipObj->printClipboard()); + } + + /** + * add javascript jumpToUrl function + */ + protected function addJumpToUrl(): void + { + $this->view->getModuleTemplate()->addJavaScriptCode( + 'FileListIndex', + 'if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '"; + ' + ); + } } diff --git a/typo3/sysext/filelist/Resources/Private/Partials/ClipBoard.html b/typo3/sysext/filelist/Resources/Private/Partials/ClipBoard.html new file mode 100644 index 0000000000000000000000000000000000000000..137286950f8d0eb38e15436817bd6cbbf083e21c --- /dev/null +++ b/typo3/sysext/filelist/Resources/Private/Partials/ClipBoard.html @@ -0,0 +1,5 @@ +<f:if condition="{showClipBoard}"> + {clipBoardHtml -> f:format.raw()} + + <f:be.buttons.csh table="xMOD_csh_corebe" field="filelist_clipboard" wrap="<span class='btn btn-sm btn-default'>|</span>" /> +</f:if> diff --git a/typo3/sysext/filelist/Resources/Private/Partials/ListOptions.html b/typo3/sysext/filelist/Resources/Private/Partials/ListOptions.html new file mode 100644 index 0000000000000000000000000000000000000000..ac688b0c49c965dbf3c031cb7fbe9ca13763bd89 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Private/Partials/ListOptions.html @@ -0,0 +1,29 @@ +<!-- + Listing options for extended view, clipboard and thumbnails +--> +<div class="typo3-listOptions"> + <f:if condition="{checkboxes.bigControlPanel.enabled}"> + <div class="checkbox"> + <label for="bigControlPanel"> + {checkboxes.bigControlPanel.html -> f:format.raw()} + {checkboxes.bigControlPanel.label} + </label> + </div> + </f:if> + <f:if condition="{checkboxes.displayThumbs.enabled}"> + <div class="checkbox"> + <label for="checkDisplayThumbs"> + {checkboxes.displayThumbs.html -> f:format.raw()} + {checkboxes.displayThumbs.label} + </label> + </div> + </f:if> + <f:if condition="{checkboxes.enableClipBoard.enabled}"> + <div class="checkbox"> + <label for="checkClipBoard"> + {checkboxes.enableClipBoard.html -> f:format.raw()} + {checkboxes.enableClipBoard.label} + </label> + </div> + </f:if> +</div> diff --git a/typo3/sysext/filelist/Resources/Private/Templates/FileList/Index.html b/typo3/sysext/filelist/Resources/Private/Templates/FileList/Index.html index 18e327a9de06270b6e7d29b4099a4ea2ff3fa44b..1505dc8c6af935db5ed1c28e16a73411ce231f9d 100644 --- a/typo3/sysext/filelist/Resources/Private/Templates/FileList/Index.html +++ b/typo3/sysext/filelist/Resources/Private/Templates/FileList/Index.html @@ -14,40 +14,7 @@ </f:form> <f:if condition="{listHtml}"> - <!-- - Listing options for extended view, clipboard and thumbnails - --> - <div class="typo3-listOptions"> - <f:if condition="{checkboxes.bigControlPanel.enabled}"> - <div class="checkbox"> - <label for="bigControlPanel"> - {checkboxes.bigControlPanel.html -> f:format.raw()} - {checkboxes.bigControlPanel.label} - </label> - </div> - </f:if> - <f:if condition="{checkboxes.displayThumbs.enabled}"> - <div class="checkbox"> - <label for="checkDisplayThumbs"> - {checkboxes.displayThumbs.html -> f:format.raw()} - {checkboxes.displayThumbs.label} - </label> - </div> - </f:if> - <f:if condition="{checkboxes.enableClipBoard.enabled}"> - <div class="checkbox"> - <label for="checkClipBoard"> - {checkboxes.enableClipBoard.html -> f:format.raw()} - {checkboxes.enableClipBoard.label} - </label> - </div> - </f:if> - </div> - - <f:if condition="{showClipBoard}"> - {clipBoardHtml -> f:format.raw()} - - <f:be.buttons.csh table="xMOD_csh_corebe" field="filelist_clipboard" wrap="<span class='btn btn-sm btn-default'>|</span>" /> - </f:if> + <f:render partial="ListOptions" arguments="{checkboxes:checkboxes}" /> + <f:render partial="ClipBoard" arguments="{showClipBoard:showClipBoard,clipBoardHtml:clipBoardHtml}" /> </f:if> </f:section> diff --git a/typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html b/typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html index 272cc6e181020017559a691ddc42424b10de397c..000505d25001e5e68a50be6f6b1b60596d41294f 100644 --- a/typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html +++ b/typo3/sysext/filelist/Resources/Private/Templates/FileList/Search.html @@ -221,5 +221,8 @@ </table> </div> </f:if> + + <f:render partial="ListOptions" arguments="{checkboxes:checkboxes}" /> + <f:render partial="ClipBoard" arguments="{showClipBoard:showClipBoard,clipBoardHtml:clipBoardHtml}" /> </f:section> </html>