2 namespace TYPO3\CMS\Recordlist\Browser;
75 $this->pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Recordlist/BrowseFiles');
84 parent::initVariables();
97 if ($this->expandFolder !== null) {
101 $this->expandFolder = $data[
'expandFolder'];
104 return array($data, $store);
116 $allowedFileExtensions = explode(
'|', $this->bparams)[3];
117 if (!empty($allowedFileExtensions) && $allowedFileExtensions !==
'sys_file' && $allowedFileExtensions !==
'*') {
120 $filterObject->setAllowedFileExtensions($allowedFileExtensions);
122 $storages = $backendUser->getFileStorages();
124 foreach ($storages as $storage) {
125 $storage->addFileAndFolderNameFilter(array($filterObject,
'filterFileList'));
129 if ($this->expandFolder) {
130 $fileOrFolderObject = null;
136 }
catch (Exception $accessException) {
138 }
catch (\InvalidArgumentException $driverMissingExecption) {
142 if ($fileOrFolderObject instanceof Folder) {
144 $this->selectedFolder = $fileOrFolderObject;
145 }
elseif ($fileOrFolderObject instanceof FileInterface) {
147 $this->selectedFolder = $fileOrFolderObject->getParentFolder();
151 if (!$this->selectedFolder) {
153 $this->selectedFolder = $backendUser->getDefaultUploadFolder();
154 }
catch (\Exception $e) {
161 if ($this->selectedFolder) {
162 $pArr = explode(
'|', $this->bparams);
165 $uploadForm = $folderUtilityRenderer->uploadForm($this->selectedFolder, $allowedExtensions);
166 $createFolder = $folderUtilityRenderer->createFolder($this->selectedFolder);
170 $noThumbs = $backendUser->getTSConfigVal(
'options.noThumbsInEB');
171 $_MOD_SETTINGS = array();
174 $_MOD_MENU = array(
'displayThumbs' =>
'');
175 $_MCONF[
'name'] =
'file_list';
178 $noThumbs = $noThumbs ?: !$_MOD_SETTINGS[
'displayThumbs'];
182 $folderTree->setLinkParameterProvider($this);
183 $tree = $folderTree->getBrowsableTree();
184 if ($this->selectedFolder) {
185 $files = $this->
renderFilesInFolder($this->selectedFolder, $allowedFileExtensions, $noThumbs);
192 $content = $this->doc->startPage(
'TBE file selector');
193 $content .= $this->doc->getFlashMessages();
196 if ($backendUser->getTSConfigVal(
'options.uploadFieldsInTopOfEB')) {
197 $content .= $uploadForm;
203 Wrapper table for folder tree / filelist:
205 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
207 <td class="c-wCell" valign="top"><h3>' . $this->
getLanguageService()->getLL(
'folderTree',
true) .
':</h3>' . $tree .
'</td>
208 <td class="c-wCell" valign="top">' . $files .
'</td>
213 if (!$backendUser->getTSConfigVal(
'options.uploadFieldsInTopOfEB')) {
214 $content .= $uploadForm;
216 $content .= $createFolder;
218 $content .=
'<br /><br />';
220 $content .= $this->doc->endPage();
221 return $this->doc->insertStylesAndJS($content);
240 if ($this->searchWord !==
'') {
241 $files = $this->fileRepository->searchByName($folder, $this->searchWord);
243 $extensionList = $extensionList ===
'*' ?
'' : $extensionList;
244 $files = $this->getFilesInFolder($folder, $extensionList);
246 $filesCount = count($files);
251 $folderIcon = $this->iconFactory->getIconForResource($folder,
Icon::SIZE_SMALL);
252 $lines[] =
'<tr class="t3-row-header"><th colspan="4">'
256 if ($filesCount === 0) {
259 <td colspan="4">No files found.</td>
263 foreach ($files as $fileObject) {
264 $fileExtension = $fileObject->getExtension();
267 if (!$noThumbs &&
GeneralUtility::inList(strtolower(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'] .
',' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'mediafile_ext']), strtolower($fileExtension))) {
268 $processedFile = $fileObject->process(
270 array(
'width' => 64,
'height' => 64)
272 $imageUrl = $processedFile->getPublicUrl(
true);
274 $fileObject->getProperty(
'width'),
275 $fileObject->getProperty(
'height')
277 $pDim = $imgInfo[0] .
'x' . $imgInfo[1] .
' pixels';
278 $clickIcon =
'<img src="' . $imageUrl .
'"'
279 .
' width="' . $processedFile->getProperty(
'width') .
'"'
280 .
' height="' . $processedFile->getProperty(
'height') .
'"'
281 .
' hspace="5" vspace="5" border="1" />';
288 $icon =
'<span title="' . htmlspecialchars($fileObject->getName() . $size) .
'">' . $this->iconFactory->getIconForResource($fileObject,
Icon::SIZE_SMALL) .
'</span>';
290 $filesIndex = count($this->elements);
291 $this->elements[
'file_' . $filesIndex] = array(
293 'table' =>
'sys_file',
294 'uid' => $fileObject->getUid(),
295 'fileName' => $fileObject->getName(),
296 'filePath' => $fileObject->getUid(),
297 'fileExt' => $fileExtension,
301 $ATag =
'<a href="#" title="' . htmlspecialchars($fileObject->getName()) .
'" data-file-index="' . htmlspecialchars($filesIndex) .
'" data-close="0">';
302 $ATag_alt =
'<a href="#" title="' . htmlspecialchars($fileObject->getName()) .
'" data-file-index="' . htmlspecialchars($filesIndex) .
'" data-close="1">';
304 $bulkCheckBox =
'<input type="checkbox" class="typo3-bulk-item" name="file_' . $filesIndex .
'" value="0" /> ';
312 $Ahref = BackendUtility::getModuleUrl(
'show_item', array(
315 'uid' => $fileObject->getCombinedIdentifier(),
320 $filenameAndIcon = $bulkCheckBox . $ATag_alt . $icon . htmlspecialchars(
GeneralUtility::fixed_lgd_cs($fileObject->getName(), $titleLen)) . $ATag_e;
324 <td nowrap="nowrap">' . $filenameAndIcon .
' </td>
325 <td>' . $ATag .
'<span title="' .
$lang->getLL(
'addToList',
true) .
'">' . $this->iconFactory->getIcon(
'actions-edit-add',
Icon::SIZE_SMALL)->render() .
'</span>' . $ATag_e .
'</td>
326 <td nowrap="nowrap"><a href="' . htmlspecialchars($Ahref) .
'" title="' .
$lang->getLL(
'info',
true) .
'">' . $this->iconFactory->getIcon(
'actions-document-info',
Icon::SIZE_SMALL) .
$lang->getLL(
'info',
true) .
'</a></td>
327 <td nowrap="nowrap"> ' . $pDim .
'</td>
332 <td class="filelistThumbnail" colspan="4">' . $ATag_alt . $clickIcon . $ATag_e .
'</td>
337 $out =
'<h3>' .
$lang->getLL(
'files',
true) .
' ' . $filesCount .
':</h3>';
339 $out .=
'<div id="filelist">';
348 <table class="table table-striped table-hover" id="typo3-filelist">
349 ' . implode(
'', $lines) .
'
363 protected function getFilesInFolder(Folder $folder, $extensionList)
365 if ($extensionList !==
'') {
368 $filter->setAllowedFileExtensions($extensionList);
387 $labelToggleSelection =
$lang->sL(
'LLL:EXT:lang/locallang_browse_links.xlf:toggleSelection',
true);
388 $labelImportSelection =
$lang->sL(
'LLL:EXT:lang/locallang_browse_links.xlf:importSelection',
true);
390 $out =
'<div style="padding-top:10px;">' .
'<a href="#" id="t3js-importSelection" title="' . $labelImportSelection .
'">'
391 . $this->iconFactory->getIcon(
'actions-document-import-t3d',
Icon::SIZE_SMALL)
392 . $labelImportSelection .
'</a> '
393 .
'<a href="#" id="t3js-toggleSelection" title="' . $labelToggleSelection .
'">'
395 . $labelToggleSelection .
'</a>' .
'</div>';
398 $noThumbsInEB = $this->
getBackendUser()->getTSConfigVal(
'options.noThumbsInEB');
399 if (!$noThumbsInEB && $this->selectedFolder) {
401 $_MOD_MENU = array(
'displayThumbs' =>
'');
402 $_MCONF[
'name'] =
'file_list';
405 $thumbNailCheck =
'<div class="checkbox" style="padding:5px 0 15px 0"><label for="checkDisplayThumbs">'
408 'SET[displayThumbs]',
409 $_MOD_SETTINGS[
'displayThumbs'],
412 'id="checkDisplayThumbs"'
414 .
$lang->sL(
'LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs',
true) .
'</label></div>';
415 $out .= $thumbNailCheck;
417 $out .=
'<div style="padding-top: 15px;"></div>';
431 <form method="post" action="' . htmlspecialchars($action) .
'" style="padding-bottom: 15px;">
432 <div class="input-group">
433 <input class="form-control" type="text" name="searchWord" value="' . htmlspecialchars($this->searchWord) .
'">
434 <span class="input-group-btn">
435 <button class="btn btn-default" type="submit">' . $this->
getLanguageService()->sL(
'LLL:EXT:filelist/Resources/Private/Language/locallang.xlf:search',
true) .
'</button>
462 'data-mode' =>
'file',
463 'data-elements' => json_encode($this->elements)
475 'expandFolder' => isset($values[
'identifier']) ? $values[
'identifier'] :
$this->expandFolder,