‪TYPO3CMS  9.5
FileListController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
44 
50 {
53 
55  'MOD_MENU' => 'Using FileListController::$MOD_MENU is deprecated and will not be possible anymore in TYPO3 v10.0.',
56  'MOD_SETTINGS' => 'Using FileListController::$MOD_SETTINGS is deprecated and will not be possible anymore in TYPO3 v10.0.',
57  'doc' => 'Using FileListController::$doc is deprecated, property will be removed in TYPO3 v10.0.',
58  'id' => 'Using FileListController::$id is deprecated and will not be possible anymore in TYPO3 v10.0.',
59  'pointer' => 'Using FileListController::$pointer is deprecated and will not be possible anymore in TYPO3 v10.0.',
60  'table' => 'Using FileListController::$table is deprecated, , property will be removed in TYPO3 v10.0.',
61  'imagemode' => 'Using FileListController::$imagemode is deprecated and will not be possible anymore in TYPO3 v10.0.',
62  'cmd' => 'Using FileListController::$cmd is deprecated and will not be possible anymore in TYPO3 v10.0.',
63  'filelist' => 'Using FileListController::$filelist is deprecated and will not be possible anymore in TYPO3 v10.0.',
64  ];
65 
69  private ‪$deprecatedPublicMethods = [
70  'menuConfig' => 'Using FileListController::menuConfig() is deprecated and will not be possible anymore in TYPO3 v10.0.',
71  'initializeView' => 'Using FileListController::initializeView() is deprecated and will not be possible anymore in TYPO3 v10.0.',
72  'initializeIndexAction' => 'Using FileListController::initializeIndexAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
73  'indexAction' => 'Using FileListController::indexAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
74  'missingFolderAction' => 'Using FileListController::missingFolderAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
75  'searchAction' => 'Using FileListController::searchAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
76  ];
77 
81  protected ‪$MOD_MENU = [];
82 
86  protected ‪$MOD_SETTINGS = [];
87 
94  protected ‪$doc;
95 
101  protected ‪$id;
102 
106  protected ‪$folderObject;
107 
111  protected ‪$errorMessage;
112 
118  protected ‪$pointer;
119 
125  protected ‪$table;
126 
132  protected ‪$imagemode;
133 
137  protected ‪$cmd;
138 
145  protected ‪$overwriteExistingFiles;
146 
152  protected ‪$filelist;
153 
159  protected ‪$moduleName = 'file_list';
160 
164  protected ‪$fileRepository;
165 
169  protected ‪$view;
170 
176  protected ‪$defaultViewObjectName = BackendTemplateView::class;
177 
181  public function ‪injectFileRepository(\‪TYPO3\CMS\Core\Resource\FileRepository ‪$fileRepository)
182  {
183  $this->fileRepository = ‪$fileRepository;
184  }
185 
192  public function ‪initializeObject()
193  {
194  $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
195  $this->‪getLanguageService()->‪includeLLFile('EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf');
196  $this->‪getLanguageService()->‪includeLLFile('EXT:core/Resources/Private/Language/locallang_misc.xlf');
197 
198  // Setting GPvars:
199  $this->id = ($combinedIdentifier = GeneralUtility::_GP('id'));
200  $this->pointer = GeneralUtility::_GP('pointer');
201  $this->table = GeneralUtility::_GP('table');
202  $this->imagemode = GeneralUtility::_GP('imagemode');
203  $this->cmd = GeneralUtility::_GP('cmd');
204  $this->overwriteExistingFiles = ‪DuplicationBehavior::cast(GeneralUtility::_GP('overwriteExistingFiles'));
205 
206  try {
207  if ($combinedIdentifier) {
209  $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
210  $storage = $resourceFactory->getStorageObjectFromCombinedIdentifier($combinedIdentifier);
211  $identifier = substr($combinedIdentifier, strpos($combinedIdentifier, ':') + 1);
212  if (!$storage->hasFolder($identifier)) {
213  $identifier = $storage->getFolderIdentifierFromFileIdentifier($identifier);
214  }
215 
216  $this->folderObject = $resourceFactory->getFolderObjectFromCombinedIdentifier($storage->getUid() . ':' . $identifier);
217  // Disallow access to fallback storage 0
218  if ($storage->getUid() === 0) {
219  throw new Exception\InsufficientFolderAccessPermissionsException(
220  'You are not allowed to access files outside your storages',
221  1434539815
222  );
223  }
224  // Disallow the rendering of the processing folder (e.g. could be called manually)
225  if ($this->folderObject && $storage->isProcessingFolder($this->folderObject)) {
226  $this->folderObject = $storage->getRootLevelFolder();
227  }
228  } else {
229  // Take the first object of the first storage
230  $fileStorages = $this->‪getBackendUser()->‪getFileStorages();
231  $fileStorage = reset($fileStorages);
232  if ($fileStorage) {
233  $this->folderObject = $fileStorage->getRootLevelFolder();
234  } else {
235  throw new \RuntimeException('Could not find any folder to be displayed.', 1349276894);
236  }
237  }
238 
239  if ($this->folderObject && !$this->folderObject->getStorage()->isWithinFileMountBoundaries($this->folderObject)) {
240  throw new \RuntimeException('Folder not accessible.', 1430409089);
241  }
242  } catch (Exception\InsufficientFolderAccessPermissionsException $permissionException) {
243  $this->folderObject = null;
244  $this->errorMessage = GeneralUtility::makeInstance(
245  FlashMessage::class,
246  sprintf(
247  $this->‪getLanguageService()->getLL('missingFolderPermissionsMessage'),
248  $this->id
249  ),
250  $this->‪getLanguageService()->getLL('missingFolderPermissionsTitle'),
252  );
253  } catch (Exception $fileException) {
254  // Set folder object to null and throw a message later on
255  $this->folderObject = null;
256  // Take the first object of the first storage
257  $fileStorages = $this->‪getBackendUser()->‪getFileStorages();
258  $fileStorage = reset($fileStorages);
259  if ($fileStorage instanceof \‪TYPO3\CMS\Core\Resource\ResourceStorage) {
260  $this->folderObject = $fileStorage->getRootLevelFolder();
261  if (!$fileStorage->isWithinFileMountBoundaries($this->folderObject)) {
262  $this->folderObject = null;
263  }
264  }
265  $this->errorMessage = GeneralUtility::makeInstance(
266  FlashMessage::class,
267  sprintf(
268  $this->‪getLanguageService()->getLL('folderNotFoundMessage'),
269  $this->id
270  ),
271  $this->‪getLanguageService()->getLL('folderNotFoundTitle'),
273  );
274  } catch (\RuntimeException $e) {
275  $this->folderObject = null;
276  $this->errorMessage = GeneralUtility::makeInstance(
277  FlashMessage::class,
278  $e->getMessage() . ' (' . $e->getCode() . ')',
279  $this->getLanguageService()->getLL('folderNotFoundTitle'),
281  );
282  }
283 
284  if ($this->folderObject && !$this->folderObject->getStorage()->checkFolderActionPermission(
285  'read',
286  $this->folderObject
287  )
288  ) {
289  $this->folderObject = null;
290  }
291 
292  // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
293  $this->‪menuConfig();
294  }
295 
299  protected function ‪menuConfig()
300  {
301  // MENU-ITEMS:
302  // If array, then it's a selector box menu
303  // If empty string it's just a variable, that will be saved.
304  // Values NOT in this array will not be saved in the settings-array for the module.
305  $this->MOD_MENU = [
306  'sort' => '',
307  'reverse' => '',
308  'displayThumbs' => '',
309  'clipBoard' => '',
310  'bigControlPanel' => ''
311  ];
312  // CLEANSE SETTINGS
313  $this->MOD_SETTINGS = ‪BackendUtility::getModuleData(
314  $this->MOD_MENU,
315  GeneralUtility::_GP('SET'),
316  $this->moduleName
317  );
318  }
319 
325  protected function ‪initializeView(‪ViewInterface ‪$view)
326  {
328  parent::initializeView(‪$view);
329  $pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
330  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
331  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileSearch');
332  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
334  }
335 
338  protected function ‪initializeIndexAction()
339  {
340  // Apply predefined values for hidden checkboxes
341  // Set predefined value for DisplayBigControlPanel:
342  $backendUser = $this->‪getBackendUser();
343  $userTsConfig = $backendUser->getTSConfig();
344  if (($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'activated') {
345  $this->MOD_SETTINGS['bigControlPanel'] = true;
346  } elseif (($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'deactivated') {
347  $this->MOD_SETTINGS['bigControlPanel'] = false;
348  }
349  // Set predefined value for DisplayThumbnails:
350  if (($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'activated') {
351  $this->MOD_SETTINGS['displayThumbs'] = true;
352  } elseif (($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'deactivated') {
353  $this->MOD_SETTINGS['displayThumbs'] = false;
354  }
355  // Set predefined value for Clipboard:
356  if (($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'activated') {
357  $this->MOD_SETTINGS['clipBoard'] = true;
358  } elseif (($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'deactivated') {
359  $this->MOD_SETTINGS['clipBoard'] = false;
360  }
361  // If user never opened the list module, set the value for displayThumbs
362  if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
363  $this->MOD_SETTINGS['displayThumbs'] = $backendUser->uc['thumbnailsByDefault'];
364  }
365  if (!isset($this->MOD_SETTINGS['sort'])) {
366  // Set default sorting
367  $this->MOD_SETTINGS['sort'] = 'file';
368  $this->MOD_SETTINGS['reverse'] = 0;
369  }
370  }
371 
374  protected function ‪indexAction()
375  {
376  $pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
377  $pageRenderer->setTitle($this->‪getLanguageService()->getLL('files'));
378 
379  // There there was access to this file path, continue, make the list
380  if ($this->folderObject) {
381  $userTsConfig = $this->‪getBackendUser()->‪getTSConfig();
382  // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Argument $this will be removed in TYPO3 v10.0.
383  $this->filelist = GeneralUtility::makeInstance(FileList::class, $this);
384  $this->filelist->thumbs = ‪$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs'];
385  // Create clipboard object and initialize that
386  $this->filelist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
387  $this->filelist->clipObj->fileMode = true;
388  $this->filelist->clipObj->initializeClipboard();
389  $CB = GeneralUtility::_GET('CB');
390  if ($this->cmd === 'setCB') {
391  $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(
392  GeneralUtility::_POST('CBH'),
393  (array)GeneralUtility::_POST('CBC')
394  ), '_FILE');
395  }
396  if (!$this->MOD_SETTINGS['clipBoard']) {
397  $CB['setP'] = 'normal';
398  }
399  $this->filelist->clipObj->setCmd($CB);
400  $this->filelist->clipObj->cleanCurrent();
401  // Saves
402  $this->filelist->clipObj->endClipboard();
403  // If the "cmd" was to delete files from the list (clipboard thing), do that:
404  if ($this->cmd === 'delete') {
405  $items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1);
406  if (!empty($items)) {
407  // Make command array:
408  $FILE = [];
409  foreach ($items as $clipboardIdentifier => $combinedIdentifier) {
410  $FILE['delete'][] = ['data' => $combinedIdentifier];
411  $this->filelist->clipObj->removeElement($clipboardIdentifier);
412  }
413  // Init file processing object for deleting and pass the cmd array.
415  $fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
416  $fileProcessor->setActionPermissions();
417  $fileProcessor->setExistingFilesConflictMode($this->overwriteExistingFiles);
418  $fileProcessor->start($FILE);
419  $fileProcessor->processData();
420  // Clean & Save clipboard state
421  $this->filelist->clipObj->cleanCurrent();
422  $this->filelist->clipObj->endClipboard();
423  }
424  }
425  // Start up filelisting object, include settings.
426  $this->pointer = ‪MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
427  $this->filelist->start(
428  $this->folderObject,
429  $this->pointer,
430  $this->MOD_SETTINGS['sort'],
431  $this->MOD_SETTINGS['reverse'],
432  $this->MOD_SETTINGS['clipBoard'],
433  $this->MOD_SETTINGS['bigControlPanel']
434  );
435  // Generate the list
436  $this->filelist->generateList();
437  // Set top JavaScript:
438  $this->view->getModuleTemplate()->addJavaScriptCode(
439  'FileListIndex',
440  'if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions() . '
441  function jumpToUrl(URL) {
442  window.location.href = URL;
443  return false;
444  }
445  '
446  );
447  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete');
448  $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons');
449 
450  // Include DragUploader only if we have write access
451  if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')
452  && $this->folderObject->checkActionPermission('write')
453  ) {
454  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
455  $pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_upload');
456  $pageRenderer->addInlineLanguageLabelArray([
457  'permissions.read' => $this->‪getLanguageService()->getLL('read'),
458  'permissions.write' => $this->‪getLanguageService()->getLL('write'),
459  ]);
460  }
461 
462  // Setting up the buttons
463  $this->‪registerButtons();
464 
465  $pageRecord = [
466  '_additional_info' => $this->filelist->getFolderInfo(),
467  'combined_identifier' => $this->folderObject->getCombinedIdentifier(),
468  ];
469  $this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
470 
471  $this->view->assign('headline', $this->‪getModuleHeadline());
472  $this->view->assign('listHtml', $this->filelist->HTMLcode);
473 
474  $this->view->assign('checkboxes', [
475  'bigControlPanel' => [
476  'enabled' => ($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'selectable',
477  'label' => htmlspecialchars($this->‪getLanguageService()->getLL('bigControlPanel')),
479  $this->id,
480  'SET[bigControlPanel]',
481  $this->MOD_SETTINGS['bigControlPanel'] ?? '',
482  '',
483  '',
484  'id="bigControlPanel"'
485  ),
486  ],
487  'displayThumbs' => [
488  'enabled' => ‪$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && ($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'selectable',
489  'label' => htmlspecialchars($this->‪getLanguageService()->getLL('displayThumbs')),
491  $this->id,
492  'SET[displayThumbs]',
493  $this->MOD_SETTINGS['displayThumbs'] ?? '',
494  '',
495  '',
496  'id="checkDisplayThumbs"'
497  ),
498  ],
499  'enableClipBoard' => [
500  'enabled' => ($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'selectable',
501  'label' => htmlspecialchars($this->‪getLanguageService()->getLL('clipBoard')),
503  $this->id,
504  'SET[clipBoard]',
505  $this->MOD_SETTINGS['clipBoard'] ?? '',
506  '',
507  '',
508  'id="checkClipBoard"'
509  ),
510  ]
511  ]);
512  $this->view->assign('showClipBoard', (bool)$this->MOD_SETTINGS['clipBoard']);
513  $this->view->assign('clipBoardHtml', $this->filelist->clipObj->printClipboard());
514  $this->view->assign('folderIdentifier', $this->folderObject->getCombinedIdentifier());
515  $this->view->assign('fileDenyPattern', ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']);
516  $this->view->assign('maxFileSize', GeneralUtility::getMaxUploadFileSize() * 1024);
517  } else {
518  $this->‪forward('missingFolder');
519  }
520  }
521 
524  protected function ‪missingFolderAction()
525  {
526  if ($this->errorMessage) {
527  $this->errorMessage->setSeverity(‪FlashMessage::ERROR);
528  $this->controllerContext->getFlashMessageQueue('core.template.flashMessages')->addMessage($this->errorMessage);
529  }
530  }
531 
537  protected function ‪searchAction($searchWord = '')
538  {
539  if (empty($searchWord)) {
540  $this->‪forward('index');
541  }
542  $searchDemand = ‪FileSearchDemand::createForSearchTerm($searchWord)->withRecursive();
543  $files = $this->folderObject->searchFiles($searchDemand);
544 
545  $fileFacades = [];
546  if (count($files) === 0) {
547  $this->controllerContext->getFlashMessageQueue('core.template.flashMessages')->addMessage(
548  new FlashMessage(
549  ‪LocalizationUtility::translate('flashmessage.no_results', 'filelist'),
550  '',
552  )
553  );
554  } else {
555  foreach ($files as $file) {
556  $fileFacades[] = new \TYPO3\CMS\Filelist\FileFacade($file);
557  }
558  }
559 
561  ‪$uriBuilder = GeneralUtility::makeInstance(\‪TYPO3\CMS\Backend\Routing\UriBuilder::class);
562 
563  $pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
564  $pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', (string)‪$uriBuilder->buildUriFromRoute('show_item'));
565  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileList');
566 
567  $thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
568  $this->view->assign('thumbnail', [
569  'width' => $thumbnailConfiguration->getWidth(),
570  'height' => $thumbnailConfiguration->getHeight(),
571  ]);
572 
573  $this->view->assign('searchWord', $searchWord);
574  $this->view->assign('files', $fileFacades);
575  $this->view->assign('deleteUrl', (string)‪$uriBuilder->buildUriFromRoute('tce_file'));
576  $this->view->assign('settings', [
577  'jsConfirmationDelete' => $this->‪getBackendUser()->jsConfirmation(‪JsConfirmation::DELETE)
578  ]);
579 
580  $pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete');
581  $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons');
582  }
583 
590  protected function ‪getModuleHeadline()
591  {
592  $name = $this->folderObject->getName();
593  if ($name === '') {
594  // Show storage name on storage root
595  if ($this->folderObject->getIdentifier() === '/') {
596  $name = $this->folderObject->getStorage()->getName();
597  }
598  } else {
600  [$name => $this->folderObject]
601  ));
602  }
603  return $name;
604  }
605 
611  protected function ‪registerDocHeaderButtons()
612  {
614  $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
615 
616  // CSH
617  $cshButton = $buttonBar->makeHelpButton()
618  ->setModuleName('xMOD_csh_corebe')
619  ->setFieldName('filelist_module');
620  $buttonBar->addButton($cshButton);
621  }
622 
626  protected function ‪registerButtons()
627  {
629  $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
630 
632  $iconFactory = $this->view->getModuleTemplate()->getIconFactory();
633 
634  $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
635 
636  $lang = $this->‪getLanguageService();
637 
638  ‪$uriBuilder = GeneralUtility::makeInstance(\‪TYPO3\CMS\Backend\Routing\UriBuilder::class);
639 
640  // Refresh page
641  $refreshLink = GeneralUtility::linkThisScript(
642  [
643  'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
644  'imagemode' => $this->filelist->thumbs
645  ]
646  );
647  $refreshButton = $buttonBar->makeLinkButton()
648  ->setHref($refreshLink)
649  ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload'))
650  ->setIcon($iconFactory->getIcon('actions-refresh', ‪Icon::SIZE_SMALL));
651  $buttonBar->addButton($refreshButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
652 
653  // Level up
654  try {
655  $currentStorage = $this->folderObject->getStorage();
656  $parentFolder = $this->folderObject->getParentFolder();
657  if ($parentFolder->getIdentifier() !== $this->folderObject->getIdentifier()
658  && $currentStorage->isWithinFileMountBoundaries($parentFolder)
659  ) {
660  $levelUpClick = 'top.document.getElementsByName("nav_frame")[0].contentWindow.Tree.highlightActiveItem("file","folder'
661  . GeneralUtility::md5int($parentFolder->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)';
662  $levelUpButton = $buttonBar->makeLinkButton()
663  ->setHref((string)‪$uriBuilder->buildUriFromRoute('file_FilelistList', ['id' => $parentFolder->getCombinedIdentifier()]))
664  ->setOnClick($levelUpClick)
665  ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel'))
666  ->setIcon($iconFactory->getIcon('actions-view-go-up', ‪Icon::SIZE_SMALL));
667  $buttonBar->addButton($levelUpButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 1);
668  }
669  } catch (\Exception $e) {
670  }
671 
672  // Shortcut
673  if ($this->‪getBackendUser()->mayMakeShortcut()) {
674  $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName('file_FilelistList');
675  $buttonBar->addButton($shortCutButton, ‪ButtonBar::BUTTON_POSITION_RIGHT);
676  }
677 
678  // Upload button (only if upload to this directory is allowed)
679  if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission(
680  'add',
681  'File'
682  ) && $this->folderObject->checkActionPermission('write')
683  ) {
684  $uploadButton = $buttonBar->makeLinkButton()
685  ->setHref((string)‪$uriBuilder->buildUriFromRoute(
686  'file_upload',
687  [
688  'target' => $this->folderObject->getCombinedIdentifier(),
689  'returnUrl' => $this->filelist->listURL(),
690  ]
691  ))
692  ->setClasses('t3js-drag-uploader-trigger')
693  ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload'))
694  ->setIcon($iconFactory->getIcon('actions-edit-upload', ‪Icon::SIZE_SMALL));
695  $buttonBar->addButton($uploadButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 1);
696  }
697 
698  // New folder button
699  if ($this->folderObject && $this->folderObject->checkActionPermission('write')
700  && ($this->folderObject->getStorage()->checkUserActionPermission(
701  'add',
702  'File'
703  ) || $this->folderObject->checkActionPermission('add'))
704  ) {
705  $newButton = $buttonBar->makeLinkButton()
706  ->setHref((string)‪$uriBuilder->buildUriFromRoute(
707  'file_newfolder',
708  [
709  'target' => $this->folderObject->getCombinedIdentifier(),
710  'returnUrl' => $this->filelist->listURL(),
711  ]
712  ))
713  ->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new'))
714  ->setIcon($iconFactory->getIcon('actions-add', ‪Icon::SIZE_SMALL));
715  $buttonBar->addButton($newButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 1);
716  }
717 
718  // Add paste button if clipboard is initialized
719  if ($this->filelist->clipObj instanceof Clipboard && $this->folderObject->checkActionPermission('write')) {
720  $elFromTable = $this->filelist->clipObj->elFromTable('_FILE');
721  if (!empty($elFromTable)) {
722  $addPasteButton = true;
723  $elToConfirm = [];
724  foreach ($elFromTable as $key => $element) {
725  $clipBoardElement = $resourceFactory->retrieveFileOrFolderObject($element);
726  if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder(
727  $clipBoardElement,
728  $this->folderObject
729  )
730  ) {
731  $addPasteButton = false;
732  }
733  $elToConfirm[$key] = $clipBoardElement->getName();
734  }
735  if ($addPasteButton) {
736  $confirmText = $this->filelist->clipObj
737  ->confirmMsgText('_FILE', $this->folderObject->getReadablePath(), 'into', $elToConfirm);
738  $pasteButton = $buttonBar->makeLinkButton()
739  ->setHref($this->filelist->clipObj
740  ->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier()))
741  ->setClasses('t3js-modal-trigger')
742  ->setDataAttributes([
743  'severity' => 'warning',
744  'content' => $confirmText,
745  'title' => $lang->getLL('clip_paste')
746  ])
747  ->setTitle($lang->getLL('clip_paste'))
748  ->setIcon($iconFactory->getIcon('actions-document-paste-into', ‪Icon::SIZE_SMALL));
749  $buttonBar->addButton($pasteButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 2);
750  }
751  }
752  }
753  }
754 
760  protected function ‪getLanguageService(): ‪LanguageService
761  {
762  return ‪$GLOBALS['LANG'];
763  }
764 
770  protected function ‪getBackendUser(): BackendUserAuthentication
771  {
772  return ‪$GLOBALS['BE_USER'];
773  }
774 }
‪TYPO3\CMS\Filelist\Controller\FileListController\$deprecatedPublicProperties
‪$deprecatedPublicProperties
Definition: FileListController.php:53
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication\evaluateUserSpecificFileFilterSettings
‪evaluateUserSpecificFileFilterSettings()
Definition: BackendUserAuthentication.php:1865
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Filelist\Configuration\ThumbnailConfiguration
Definition: ThumbnailConfiguration.php:26
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪mixed includeLLFile($fileRef, $setGlobal=true, $mergeLocalOntoDefault=false)
Definition: LanguageService.php:260
‪TYPO3\CMS\Filelist\Controller\FileListController\$imagemode
‪string $imagemode
Definition: FileListController.php:121
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_LEFT
‪const BUTTON_POSITION_LEFT
Definition: ButtonBar.php:35
‪TYPO3\CMS\Backend\Template\Components\ButtonBar
Definition: ButtonBar.php:31
‪TYPO3\CMS\Core\Resource\DuplicationBehavior
Definition: DuplicationBehavior.php:23
‪TYPO3\CMS\Filelist\Controller\FileListController\initializeObject
‪initializeObject()
Definition: FileListController.php:174
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility
Definition: LocalizationUtility.php:29
‪TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException
Definition: InsufficientFolderAccessPermissionsException.php:21
‪TYPO3\CMS\Backend\Clipboard\Clipboard
Definition: Clipboard.php:38
‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\$uriBuilder
‪TYPO3 CMS Extbase Mvc Web Routing UriBuilder $uriBuilder
Definition: AbstractController.php:37
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Filelist\Controller\FileListController\$overwriteExistingFiles
‪TYPO3 CMS Core Resource DuplicationBehavior $overwriteExistingFiles
Definition: FileListController.php:132
‪TYPO3\CMS\Filelist\Controller\FileListController\searchAction
‪searchAction($searchWord='')
Definition: FileListController.php:519
‪TYPO3
‪TYPO3\CMS\Filelist\Controller\FileListController\$filelist
‪FileList $filelist
Definition: FileListController.php:138
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:31
‪TYPO3\CMS\Filelist\Controller\FileListController\$table
‪string $table
Definition: FileListController.php:115
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getTSConfig
‪array getTSConfig($objectString=null, $config=null)
Definition: BackendUserAuthentication.php:1232
‪TYPO3\CMS\Filelist\Controller\FileListController\initializeView
‪initializeView(ViewInterface $view)
Definition: FileListController.php:307
‪TYPO3\CMS\Filelist\Controller\FileListController\injectFileRepository
‪injectFileRepository(\TYPO3\CMS\Core\Resource\FileRepository $fileRepository)
Definition: FileListController.php:163
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:31
‪TYPO3\CMS\Core\Resource\Utility\ListUtility
Definition: ListUtility.php:24
‪TYPO3\CMS\Filelist\Controller\FileListController\menuConfig
‪menuConfig()
Definition: FileListController.php:281
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication\getFileStorages
‪TYPO3 CMS Core Resource ResourceStorage[] getFileStorages()
Definition: BackendUserAuthentication.php:1851
‪TYPO3\CMS\Filelist\Controller\FileListController\$doc
‪DocumentTemplate $doc
Definition: FileListController.php:89
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\DELETE
‪const DELETE
Definition: JsConfirmation.php:38
‪TYPO3\CMS\Core\Resource\Folder\getStorage
‪ResourceStorage getStorage()
Definition: Folder.php:146
‪TYPO3\CMS\Core\Type\Enumeration\cast
‪static static cast($value)
Definition: Enumeration.php:182
‪TYPO3\CMS\Core\Utility\File\ExtendedFileUtility
Definition: ExtendedFileUtility.php:63
‪TYPO3\CMS\Filelist\Controller\FileListController\registerButtons
‪registerButtons()
Definition: FileListController.php:608
‪TYPO3\CMS\Filelist\Controller\FileListController\getLanguageService
‪LanguageService getLanguageService()
Definition: FileListController.php:742
‪TYPO3\CMS\Filelist\Controller
Definition: FileListController.php:2
‪TYPO3\CMS\Filelist\FileList
Definition: FileList.php:47
‪TYPO3\CMS\Backend\Template\DocumentTemplate
Definition: DocumentTemplate.php:48
‪TYPO3\CMS\Extbase\Utility\LocalizationUtility\translate
‪static string null translate($key, $extensionName=null, $arguments=null, string $languageKey=null, array $alternativeLanguageKeys=null)
Definition: LocalizationUtility.php:63
‪TYPO3\CMS\Filelist\Controller\FileListController
Definition: FileListController.php:50
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand
Definition: FileSearchDemand.php:24
‪TYPO3\CMS\Filelist\Controller\FileListController\$view
‪BackendTemplateView $view
Definition: FileListController.php:152
‪TYPO3\CMS\Core\Resource\Folder
Definition: Folder.php:34
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:33
‪TYPO3\CMS\Core\Resource\ResourceStorage\isWithinFolder
‪bool isWithinFolder(Folder $folder, ResourceInterface $resource)
Definition: ResourceStorage.php:2517
‪TYPO3\CMS\Backend\Utility\BackendUtility\getModuleData
‪static array getModuleData( $MOD_MENU, $CHANGED_SETTINGS, $modName, $type='', $dontValidateList='', $setDefaultList='')
Definition: BackendUtility.php:3259
‪TYPO3\CMS\Backend\Utility\BackendUtility\getFuncCheck
‪static string getFuncCheck( $mainParams, $elementName, $currentValue, $script='', $addParams='', $tagParams='')
Definition: BackendUtility.php:3054
‪TYPO3\CMS\Filelist\Controller\FileListController\$fileRepository
‪TYPO3 CMS Core Resource FileRepository $fileRepository
Definition: FileListController.php:148
‪TYPO3\CMS\Filelist\Controller\FileListController\indexAction
‪indexAction()
Definition: FileListController.php:356
‪TYPO3\CMS\Filelist\Controller\FileListController\missingFolderAction
‪missingFolderAction()
Definition: FileListController.php:506
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Filelist\Controller\FileListController\$moduleName
‪string $moduleName
Definition: FileListController.php:144
‪TYPO3\CMS\Extbase\Mvc\View\ViewInterface
Definition: ViewInterface.php:21
‪TYPO3\CMS\Filelist\Controller\FileListController\initializeIndexAction
‪initializeIndexAction()
Definition: FileListController.php:320
‪TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait
Definition: PublicMethodDeprecationTrait.php:68
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪TYPO3\CMS\Filelist\Controller\FileListController\$MOD_SETTINGS
‪array $MOD_SETTINGS
Definition: FileListController.php:82
‪TYPO3\CMS\Filelist\Controller\FileListController\$id
‪string $id
Definition: FileListController.php:95
‪TYPO3\CMS\Filelist\Controller\FileListController\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: FileListController.php:752
‪TYPO3\CMS\Core\Resource\Exception
Definition: Exception.php:21
‪TYPO3\CMS\Backend\View\BackendTemplateView
Definition: BackendTemplateView.php:27
‪TYPO3\CMS\Core\Messaging\AbstractMessage\INFO
‪const INFO
Definition: AbstractMessage.php:26
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:22
‪TYPO3\CMS\Filelist\Controller\FileListController\getModuleHeadline
‪string getModuleHeadline()
Definition: FileListController.php:572
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Filelist\Controller\FileListController\$pointer
‪int $pointer
Definition: FileListController.php:109
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController
Definition: ActionController.php:31
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:21
‪TYPO3\CMS\Core\Messaging\AbstractMessage\NOTICE
‪const NOTICE
Definition: AbstractMessage.php:25
‪TYPO3\CMS\Filelist\Controller\FileListController\$MOD_MENU
‪array $MOD_MENU
Definition: FileListController.php:78
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait
Definition: PublicPropertyDeprecationTrait.php:66
‪TYPO3\CMS\Filelist\Controller\FileListController\$deprecatedPublicMethods
‪array $deprecatedPublicMethods
Definition: FileListController.php:67
‪TYPO3\CMS\Filelist\Controller\FileListController\$cmd
‪string $cmd
Definition: FileListController.php:125
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Core\Resource\Search\FileSearchDemand\createForSearchTerm
‪static createForSearchTerm(string $searchTerm)
Definition: FileSearchDemand.php:68
‪TYPO3\CMS\Filelist\Controller\FileListController\$errorMessage
‪FlashMessage $errorMessage
Definition: FileListController.php:103
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_RIGHT
‪const BUTTON_POSITION_RIGHT
Definition: ButtonBar.php:40
‪TYPO3\CMS\Core\Resource\Utility\ListUtility\resolveSpecialFolderNames
‪static array resolveSpecialFolderNames(array $folders)
Definition: ListUtility.php:31
‪TYPO3\CMS\Core\Type\Bitmask\JsConfirmation
Definition: JsConfirmation.php:24
‪TYPO3\CMS\Core\Resource\Exception
Definition: AbstractFileOperationException.php:2
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:29
‪TYPO3\CMS\Extbase\Mvc\Controller\AbstractController\forward
‪forward($actionName, $controllerName=null, $extensionName=null, array $arguments=null)
Definition: AbstractController.php:247
‪TYPO3\CMS\Filelist\Controller\FileListController\registerDocHeaderButtons
‪registerDocHeaderButtons()
Definition: FileListController.php:593
‪TYPO3\CMS\Filelist\Controller\FileListController\$folderObject
‪Folder $folderObject
Definition: FileListController.php:99
‪TYPO3\CMS\Filelist\Controller\FileListController\$defaultViewObjectName
‪BackendTemplateView $defaultViewObjectName
Definition: FileListController.php:158