pageRenderer->loadJavaScriptModule('@typo3/filelist/resource-creation.js'); } protected function initializeDragUploader(): void { $lang = $this->getLanguageService(); $this->pageRenderer->loadJavaScriptModule('@typo3/backend/drag-uploader.js'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_upload'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_download'); $this->pageRenderer->addInlineLanguageLabelArray([ 'type.file' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:file'), 'permissions.read' => $lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:read'), 'permissions.write' => $lang->sL('LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:write'), 'online_media.update.success' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.update.success'), 'online_media.update.error' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.update.error'), 'labels.contextMenu.open' => $lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.contextMenu.open'), ]); $defaultDuplicationBehavior = DuplicationBehavior::getDefaultDuplicationBehaviour($this->getBackendUser()); $this->view->assign('dragUploader', [ 'fileDenyPattern' => $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] ?? null, 'maxFileSize' => GeneralUtility::getMaxUploadFileSize() * 1024, 'defaultDuplicationBehaviourAction' => $defaultDuplicationBehavior->value, ]); } protected function initVariables(ServerRequestInterface $request): void { parent::initVariables($request); $this->resourceDisplayMatcher = GeneralUtility::makeInstance(Matcher::class); $this->resourceDisplayMatcher->addMatcher(GeneralUtility::makeInstance(ResourceFolderTypeMatcher::class)); $this->resourceDisplayMatcher->addMatcher(GeneralUtility::makeInstance(ResourceFileTypeMatcher::class)); } public function render(): string { $this->initSelectedFolder(); $this->initializeDragUploader(); $contentHtml = ''; if ($this->selectedFolder !== null) { $markup = []; // Build the file creation and upload forms $resourceUtilityRenderer = GeneralUtility::makeInstance(ResourceUtilityRenderer::class, $this); $markup[] = $resourceUtilityRenderer->createDragUpload($this->selectedFolder); $markup[] = $resourceUtilityRenderer->addOnlineMedia($this->getRequest(), $this->selectedFolder); $markup[] = $resourceUtilityRenderer->createRegularFile($this->getRequest(), $this->selectedFolder); // Create the filelist $this->filelist->start( $this->selectedFolder, MathUtility::forceIntegerInRange($this->currentPage, 1, 100000), $this->sortField, $this->sortDirection, Mode::BROWSE ); // Create the filelist header bar $markup[] = '
'; $markup[] = '
'; $markup[] = '
'; $markup[] = ' ' . $this->getSortingModeButtons(); $markup[] = ' ' . $this->getViewModeButton(); $markup[] = '
'; $markup[] = '
'; $this->filelist->setResourceDisplayMatcher($this->resourceDisplayMatcher); $this->filelist->setResourceSelectableMatcher($this->resourceSelectableMatcher); $markup[] = $this->filelist->render(null, $this->view); $contentHtml = implode(PHP_EOL, $markup); } $contentOnly = (bool)($this->getRequest()->getQueryParams()['contentOnly'] ?? false); $this->pageRenderer->setTitle($this->getLanguageService()->sL('LLL:EXT:filelist/Resources/Private/Language/locallang.xlf:actions.new_file')); $this->view->assign('selectedFolder', $this->selectedFolder); $this->view->assign('content', $contentHtml); $this->view->assign('contentOnly', $contentOnly); $content = $this->view->render('ElementBrowser/ResourceCreation'); if ($contentOnly) { return $content; } $this->pageRenderer->setBodyContent('getBodyTagParameters() . '>' . $content); return $this->pageRenderer->render($this->getRequest()); } }