2 namespace TYPO3\CMS\Filelist;
25 use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
193 parent::__construct();
213 $this->totalbytes = 0;
215 $this->HTMLcode =
'';
219 $this->firstElementNumber = $pointer;
223 $this->fixedL = max($this->fixedL, $this->
getBackendUser()->uc[
'titleLen']);
235 $this->HTMLcode .= $this->getTable(
'fileext,tstamp,size,rw,_REF_');
248 $otherMarkers = array(
264 if ($folderObject->
getStorage()->isWithinFileMountBoundaries($folderObject)) {
266 $otherMarkers[
'PAGE_ICON'] =
'<span title="' . htmlspecialchars($title) .
'">' . $this->iconFactory->getIconForResource($folderObject,
Icon::SIZE_SMALL)->render() .
'</span>';
269 $otherMarkers[
'PAGE_ICON'] =
'<span title="' . htmlspecialchars($title) .
'">' . $this->iconFactory->getIconForResource($folderObject,
Icon::SIZE_SMALL, null, array(
'mount-root' =>
true))->render() .
'</span>';
273 if ($this->clickMenus) {
278 $elFromTable = $this->clipObj->elFromTable(
'_FILE');
279 if (!empty($elFromTable)) {
280 $addPasteButton =
true;
281 $elToConfirm = array();
282 foreach ($elFromTable as $key => $element) {
283 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
284 if ($clipBoardElement instanceof
Folder && $clipBoardElement->
getStorage()->isWithinFolder($clipBoardElement, $folderObject)) {
285 $addPasteButton =
false;
287 $elToConfirm[$key] = $clipBoardElement->getName();
289 if ($addPasteButton) {
290 $buttons[
'PASTE'] =
'<a href="' . htmlspecialchars($this->clipObj->pasteUrl(
'_FILE', $folderObject->
getCombinedIdentifier())) .
'" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg(
'_FILE', $this->path,
'into', $elToConfirm)) .
'" title="' . $this->
getLanguageService()->getLL(
'clip_paste',
true) .
'">' . $this->iconFactory->getIcon(
'actions-document-paste-after',
Icon::SIZE_SMALL)->render() .
'</a>';
295 $buttons[
'refresh'] =
'<a href="' . htmlspecialchars($this->
listURL()) .
'" title="' . $this->
getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.reload',
true) .
'">' . $this->iconFactory->getIcon(
'actions-refresh',
Icon::SIZE_SMALL)->render() .
'</a>';
296 return array($buttons, $otherMarkers);
310 $onClickEvent =
'document.dblistForm.cmd.value=\'' . $cmd .
'\';document.dblistForm.submit();
';
312 $onClickEvent = 'if (confirm(
' . GeneralUtility::quoteJSvalue($warning) . ')){
' . $onClickEvent . '}
';
314 return '<a href=
"#" class=
"btn btn-default" onclick=
"' . htmlspecialchars($onClickEvent) . 'return false;">
' . $string . '</a>
';
323 public function getTable($rowlist)
325 // prepare space icon
326 $this->spaceIcon = '<span
class=
"btn btn-default disabled">
' . $this->iconFactory->getIcon('empty-empty
', Icon::SIZE_SMALL)->render() . '</span>
';
328 // @todo use folder methods directly when they support filters
329 $storage = $this->folderObject->getStorage();
330 $storage->resetFileAndFolderNameFiltersToDefault();
332 // Only render the contents of a browsable storage
333 if ($this->folderObject->getStorage()->isBrowsable()) {
335 $foldersCount = $storage->countFoldersInFolder($this->folderObject);
336 $filesCount = $storage->countFilesInFolder($this->folderObject);
337 } catch (InsufficientFolderAccessPermissionsException $e) {
342 if ($foldersCount <= $this->firstElementNumber) {
343 $foldersFrom = false;
346 $foldersFrom = $this->firstElementNumber;
347 if ($this->firstElementNumber + $this->iLimit > $foldersCount) {
348 $foldersNum = $foldersCount - $this->firstElementNumber;
350 $foldersNum = $this->iLimit;
353 if ($foldersCount >= $this->firstElementNumber + $this->iLimit) {
357 if ($this->firstElementNumber <= $foldersCount) {
359 $filesNum = $this->iLimit - $foldersNum;
361 $filesFrom = $this->firstElementNumber - $foldersCount;
362 if ($filesFrom + $this->iLimit > $filesCount) {
363 $filesNum = $filesCount - $filesFrom;
365 $filesNum = $this->iLimit;
369 $folders = $storage->getFoldersInFolder($this->folderObject, $foldersFrom, $foldersNum, true, false, trim($this->sort), (bool)$this->sortRev);
370 $files = $this->folderObject->getFiles($filesFrom, $filesNum, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, false, trim($this->sort), (bool)$this->sortRev);
371 $this->totalItems = $foldersCount + $filesCount;
372 // Adds the code of files/dirs
375 // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
376 $rowlist = '_LOCALIZATION_,
' . $rowlist;
377 $rowlist = GeneralUtility::rmFromList($titleCol, $rowlist);
378 $rowlist = GeneralUtility::uniqueList($rowlist);
379 $rowlist = $rowlist ? $titleCol . ',
' . $rowlist : $titleCol;
380 if ($this->clipBoard) {
381 $rowlist = str_replace('_LOCALIZATION_,
', '_LOCALIZATION_,_CLIPBOARD_,
', $rowlist);
382 $this->addElement_tdCssClass['_CLIPBOARD_
'] = 'col-clipboard
';
384 if ($this->bigControlPanel) {
385 $rowlist = str_replace('_LOCALIZATION_,
', '_LOCALIZATION_,_CONTROL_,
', $rowlist);
386 $this->addElement_tdCssClass['_CONTROL_
'] = 'col-control
';
388 $this->fieldArray = explode(',
', $rowlist);
390 // Add classes to table cells
391 $this->addElement_tdCssClass[$titleCol] = 'col-title
';
392 $this->addElement_tdCssClass['_LOCALIZATION_
'] = 'col-localizationa
';
394 $folders = ListUtility::resolveSpecialFolderNames($folders);
397 // Directories are added
398 $this->eCounter = $this->firstElementNumber;
399 list(, $code) = $this->fwd_rwd_nav();
402 $iOut .= $this->formatDirList($folders);
404 $iOut .= $this->formatFileList($files);
406 $this->eCounter = $this->firstElementNumber + $this->iLimit <= $this->totalItems
407 ? $this->firstElementNumber + $this->iLimit
409 list(, $code) = $this->fwd_rwd_nav();
412 // Header line is drawn
414 foreach ($this->fieldArray as $v) {
415 if ($v == '_CLIPBOARD_
' && $this->clipBoard) {
418 $elFromTable = $this->clipObj->elFromTable($table);
419 if (!empty($elFromTable) && $this->folderObject->checkActionPermission('write
')) {
420 $addPasteButton = true;
421 $elToConfirm = array();
422 foreach ($elFromTable as $key => $element) {
423 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
424 if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $this->folderObject)) {
425 $addPasteButton = false;
427 $elToConfirm[$key] = $clipBoardElement->getName();
429 if ($addPasteButton) {
430 $cells[] = '<a
class=
"btn btn-default" href=
"' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick=
"return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elToConfirm)) . '" title=
"' . $this->getLanguageService()->getLL('clip_paste', 1) . '">
' . $this->iconFactory->getIcon('actions-document-paste-after
', Icon::SIZE_SMALL)->render() . '</a>
';
433 if ($this->clipObj->current !== 'normal
' && $iOut) {
434 $cells[] = $this->linkClipboardHeaderIcon('<span title=
"' . $this->getLanguageService()->getLL('clip_selectMarked', true) . '">
' . $this->iconFactory->getIcon('actions-edit-copy
', Icon::SIZE_SMALL)->render() . '</span>
', $table, 'setCB
');
435 $cells[] = $this->linkClipboardHeaderIcon('<span title=
"' . $this->getLanguageService()->getLL('clip_deleteMarked', true) . '">
' . $this->iconFactory->getIcon('actions-edit-
delete', Icon::SIZE_SMALL)->render(), $table, 'delete', $this->getLanguageService()->getLL('clip_deleteMarkedWarning
'));
436 $onClick = 'checkOffCB(\
'' . implode(
',', $this->CBnames) .
'\',
this);
return false;
';
437 $cells[] = '<a
class=
"btn btn-default" rel=
"" href=
"#" onclick=
"' . htmlspecialchars($onClick) . '" title=
"' . $this->getLanguageService()->getLL('clip_markRecords', true) . '">
' . $this->iconFactory->getIcon('actions-document-select
', Icon::SIZE_SMALL)->render() . '</a>
';
439 $theData[$v] = implode('', $cells);
442 $theT = $this->linkWrapSort($this->getLanguageService()->getLL('c_
' . $v, true), $this->folderObject->getCombinedIdentifier(), $v);
443 $theData[$v] = $theT;
447 $out .= '<thead>
' . $this->addelement(1, '', $theData, '', '', '', 'th
') . '</thead>
';
448 $out .= '<tbody>
' . $iOut . '</tbody>
';
449 // half line is drawn
455 <div
class=
"table-fit">
456 <table
class=
"table table-striped table-hover" id=
"typo3-filelist">
462 $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->getLL('storageNotBrowsableMessage
'), $this->getLanguageService()->getLL('storageNotBrowsableTitle
'), FlashMessage::INFO);
463 $out = $flashMessage->render();
475 protected function getLinkToParentFolder(Folder $currentFolder)
479 $currentStorage = $currentFolder->getStorage();
480 $parentFolder = $currentFolder->getParentFolder();
481 if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
482 $levelUp = $this->linkWrapDir(
483 '<span title=
"' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', true) . '">
'
484 . $this->iconFactory->getIcon('actions-view-go-up
', Icon::SIZE_SMALL)->render()
489 } catch (\Exception $e) {
499 public function getFolderInfo()
501 if ($this->counter == 1) {
502 $fileLabel = $this->getLanguageService()->getLL('file
', true);
504 $fileLabel = $this->getLanguageService()->getLL('files
', true);
506 return $this->counter . ' ' . $fileLabel . ',
' . GeneralUtility::formatSize($this->totalbytes, $this->getLanguageService()->getLL('byteSizeUnits
', true));
515 public function formatDirList(array $folders)
518 foreach ($folders as $folderName => $folderObject) {
519 $role = $folderObject->getRole();
520 if ($role === FolderInterface::ROLE_PROCESSING) {
521 // don't show processing-folder
525 $displayName =
'<strong>' . htmlspecialchars($folderName) .
'</strong>';
527 $displayName = htmlspecialchars($folderName);
537 $theIcon =
'<span title="' . htmlspecialchars($folderName) .
'">' . $this->iconFactory->getIconForResource(
$folderObject,
Icon::SIZE_SMALL)->render() .
'</span>';
538 if (!$isLocked && $this->clickMenus) {
545 foreach ($this->fieldArray as $field) {
546 $theData[$field] =
'';
548 $theData[
'file'] = $displayName;
550 foreach ($this->fieldArray as $field) {
555 }
catch (InsufficientFolderAccessPermissionsException $e) {
558 $theData[$field] = $numFiles .
' ' . $this->
getLanguageService()->getLL(($numFiles === 1 ?
'file' :
'files'),
true);
561 $theData[$field] =
'<strong class="text-danger">' . $this->
getLanguageService()->getLL(
'read',
true) .
'</strong>' . (!$isWritable ?
'' :
'<strong class="text-danger">' . $this->
getLanguageService()->getLL(
'write',
true) .
'</strong>');
568 $theData[$field] =
'-';
587 $out .= $this->addelement(1, $theIcon, $theData);
599 public function linkWrapDir($title,
Folder $folderObject)
601 $href = BackendUtility::getModuleUrl(
'file_FilelistList', [
'id' => $folderObject->
getCombinedIdentifier()]);
602 $onclick =
' onclick="' . htmlspecialchars((
'top.document.getElementsByName("navigation")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int($folderObject->
getCombinedIdentifier()) .
'_"+top.fsMod.currentBank)')) .
'"';
604 if ((
string)$title === strip_tags($title)) {
605 return '<a href="' . htmlspecialchars($href) .
'"' . $onclick .
' title="' . htmlspecialchars($title) .
'">' . GeneralUtility::fixed_lgd_cs($title, $this->fixedL) .
'</a>';
607 return '<a href="' . htmlspecialchars($href) .
'"' . $onclick .
'>' . $title .
'</a>';
618 public function linkWrapFile($code,
File $fileObject)
621 if ($fileObject instanceof
File && $fileObject->
isIndexed() && $fileObject->
checkActionPermission(
'write') && $this->getBackendUser()->check(
'tables_modify',
'sys_file_metadata')) {
625 'sys_file_metadata' => [
626 $metaData[
'uid'] =>
'edit'
629 'returnUrl' => $this->listURL()
631 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
632 $title = htmlspecialchars($this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.editMetadata'));
633 $code =
'<a href="' . htmlspecialchars(
$url) .
'" title="' . $title .
'">' . GeneralUtility::fixed_lgd_cs($code, $this->fixedL) .
'</a>';
635 }
catch (\Exception $e) {
650 public function listURL($altId =
'')
652 return GeneralUtility::linkThisScript(array(
653 'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
654 'imagemode' => $this->thumbs
664 public function formatFileList(array $files)
668 $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
669 $systemLanguages = array_filter($allSystemLanguages,
function ($languageRecord) {
670 if ($languageRecord[
'uid'] === -1 || $languageRecord[
'uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord[
'uid'])) {
677 foreach ($files as $fileObject) {
680 $this->totalbytes += $fileObject->getSize();
681 $ext = $fileObject->getExtension();
682 $fileName = trim($fileObject->getName());
684 $theIcon =
'<span title="' . htmlspecialchars($fileName .
' [' . (
int)$fileObject->getUid() .
']') .
'">'
685 . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() .
'</span>';
686 if ($this->clickMenus) {
687 $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
691 foreach ($this->fieldArray as $field) {
694 $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL(
'byteSizeUnits',
true));
697 $theData[$field] =
'' . (!$fileObject->checkActionPermission(
'read') ?
' ' :
'<strong class="text-danger">' . $this->getLanguageService()->getLL(
'read',
true) .
'</strong>') . (!$fileObject->checkActionPermission(
'write') ?
'' :
'<strong class="text-danger">' . $this->getLanguageService()->getLL(
'write',
true) .
'</strong>');
700 $theData[$field] = strtoupper($ext);
703 $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
706 $theData[$field] = $this->makeEdit($fileObject);
709 $theData[$field] = $this->makeClip($fileObject);
711 case '_LOCALIZATION_':
712 if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission(
'write') && $this->getBackendUser()->check(
'tables_modify',
'sys_file_metadata')) {
713 $metaDataRecord = $fileObject->_getMetaData();
714 $translations = $this->getTranslationsForMetaData($metaDataRecord);
717 foreach ($systemLanguages as $language) {
718 $languageId = $language[
'uid'];
719 $flagIcon = $language[
'flagIcon'];
720 if (array_key_exists($languageId, $translations)) {
721 $title = htmlspecialchars(sprintf($this->getLanguageService()->getLL(
'editMetadataForLanguage'), $language[
'title']));
725 'sys_file_metadata' => [
726 $translations[$languageId][
'uid'] =>
'edit'
729 'returnUrl' => $this->listURL()
731 $flagButtonIcon = $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL,
'overlay-edit')->render();
732 $url = BackendUtility::getModuleUrl(
'record_edit', $urlParameters);
733 $languageCode .=
'<a href="' . htmlspecialchars(
$url) .
'" class="btn btn-default" title="' . $title .
'">'
734 . $flagButtonIcon .
'</a>';
737 'justLocalized' =>
'sys_file_metadata:' . $metaDataRecord[
'uid'] .
':' . $languageId,
738 'returnUrl' => $this->listURL()
740 $returnUrl = BackendUtility::getModuleUrl(
'record_edit', $parameters);
741 $href = BackendUtility::getLinkToDataHandlerAction(
742 '&cmd[sys_file_metadata][' . $metaDataRecord[
'uid'] .
'][localize]=' . $languageId,
745 $flagButtonIcon =
'<span title="' . htmlspecialchars(sprintf($this->getLanguageService()->getLL(
'createMetadataForLanguage'), $language[
'title'])) .
'">' . $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL,
'overlay-new')->render() .
'</span>';
746 $languageCode .=
'<a href="' . htmlspecialchars($href) .
'" class="btn btn-default">' . $flagButtonIcon .
'</a> ';
751 $theData[$field] =
' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() .
'"' .
752 (empty($translations) ?
' style="display: none;"' :
'') .
'>' . $languageCode .
'</div>';
753 $theData[$field] .=
'<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() .
'">' .
754 '<span title="' . $this->getLanguageService()->getLL(
'translateMetadata',
true) .
'">'
755 . $this->iconFactory->getIcon(
'mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() .
'</span>'
760 $theData[$field] = $this->makeRef($fileObject);
764 $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
766 if ($fileObject->isMissing()) {
767 $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
768 $theData[$field] .= $flashMessage->render();
770 }
elseif ($this->thumbs && ($this->isImage($ext) || $this->isMediaFile($ext))) {
771 $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
772 if ($processedFile) {
773 $thumbUrl = $processedFile->getPublicUrl(
true);
774 $theData[$field] .=
'<br /><img src="' . $thumbUrl .
'" ' .
775 'width="' . $processedFile->getProperty(
'width') .
'" ' .
776 'height="' . $processedFile->getProperty(
'height') .
'" ' .
777 'title="' . htmlspecialchars($fileName) .
'" alt="" />';
782 $theData[$field] =
'';
783 if ($fileObject->hasProperty($field)) {
784 $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
788 $out .= $this->addelement(1, $theIcon, $theData);
799 protected function getTranslationsForMetaData($metaDataRecord)
801 $where =
$GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'transOrigPointerField'] .
'=' . (int)$metaDataRecord[
'uid'] .
802 ' AND ' .
$GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'languageField'] .
'>0';
803 $translationRecords = $this->getDatabaseConnection()->exec_SELECTgetRows(
'*',
'sys_file_metadata', $where);
804 $translations = array();
805 foreach ($translationRecords as $record) {
806 $translations[$record[
$GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'languageField']]] = $record;
808 return $translations;
817 public function isImage($ext)
819 return GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'], strtolower($ext));
828 public function isMediaFile($ext)
830 return GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'mediafile_ext'], strtolower($ext));
841 public function linkWrapSort($code, $folderIdentifier, $col)
843 $params = [
'id' => $folderIdentifier,
'SET' => [
'sort' => $col ]];
845 if ($this->sort === $col) {
847 $params[
'SET'][
'reverse'] = ($this->sortRev ?
'0' :
'1');
848 $sortArrow = $this->iconFactory->getIcon(
'status-status-sorting-light-' . ($this->sortRev ?
'desc' :
'asc'), Icon::SIZE_SMALL)->render();
850 $params[
'SET'][
'reverse'] = 0;
853 $href = BackendUtility::getModuleUrl(
'file_FilelistList', $params);
854 return '<a href="' . htmlspecialchars($href) .
'">' . $code .
' ' . $sortArrow .
'</a>';
863 public function makeClip($fileOrFolderObject)
865 if (!$fileOrFolderObject->checkActionPermission(
'read')) {
869 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
870 $fullName = $fileOrFolderObject->getName();
871 $md5 = GeneralUtility::shortmd5($fullIdentifier);
873 if ($this->clipObj->current ===
'normal') {
874 $isSel = $this->clipObj->isSelected(
'_FILE', $md5);
875 $copyTitle = $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.copy',
true);
876 $cutTitle = $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.cut',
true);
877 $copyIcon = $this->iconFactory->getIcon(
'actions-edit-copy', Icon::SIZE_SMALL)->render();
878 $cutIcon = $this->iconFactory->getIcon(
'actions-edit-cut', Icon::SIZE_SMALL)->render();
880 if ($isSel ===
'copy') {
881 $copyIcon = $this->iconFactory->getIcon(
'actions-edit-copy-release', Icon::SIZE_SMALL)->render();
882 }
elseif ($isSel ===
'cut') {
883 $cutIcon = $this->iconFactory->getIcon(
'actions-edit-cut-release', Icon::SIZE_SMALL)->render();
886 $cells[] =
'<a class="btn btn-default"" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 1, ($isSel ===
'copy'))) .
'" title="' . $copyTitle .
'">' . $copyIcon .
'</a>';
888 if ($fileOrFolderObject->checkActionPermission(
'move')) {
889 $cells[] =
'<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile($fullIdentifier, 0, ($isSel ===
'cut'))) .
'" title="' . $cutTitle .
'">' . $cutIcon .
'</a>';
891 $cells[] = $this->spaceIcon;
895 $n =
'_FILE|' . $md5;
896 $this->CBnames[] = $n;
897 $checked = $this->clipObj->isSelected(
'_FILE', $md5) ?
' checked="checked"' :
'';
898 $cells[] =
'<input type="hidden" name="CBH[' . $n .
']" value="0" /><label class="btn btn-default btn-checkbox"><input type="checkbox" name="CBC[' . $n .
']" value="' . htmlspecialchars($fullIdentifier) .
'" ' . $checked .
' /><span class="t3-icon fa"></span></label>';
901 $elFromTable = $this->clipObj->elFromTable(
'_FILE');
903 $addPasteButton =
true;
904 $elToConfirm = array();
905 foreach ($elFromTable as $key => $element) {
906 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
907 if ($clipBoardElement instanceof
Folder && $clipBoardElement->
getStorage()->isWithinFolder($clipBoardElement, $fileOrFolderObject)) {
908 $addPasteButton =
false;
910 $elToConfirm[$key] = $clipBoardElement->getName();
912 if ($addPasteButton) {
913 $cells[] =
'<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->pasteUrl(
'_FILE', $fullIdentifier)) .
'" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg(
'_FILE', $fullName,
'into', $elToConfirm)) .
'" title="' . $this->getLanguageService()->getLL(
'clip_pasteInto',
true) .
'">' . $this->iconFactory->getIcon(
'actions-document-paste-into', Icon::SIZE_SMALL)->render() .
'</a>';
917 return ' <div class="btn-group" role="group">' . implode(
'', $cells) .
'</div>';
926 public function makeEdit($fileOrFolderObject)
929 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
932 if ($fileOrFolderObject instanceof
File && $fileOrFolderObject->
checkActionPermission(
'write') && GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'textfile_ext'], $fileOrFolderObject->getExtension())) {
933 $url = BackendUtility::getModuleUrl(
'file_edit', array(
'target' => $fullIdentifier));
934 $editOnClick =
'top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(
$url) .
'+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
935 $cells[
'edit'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.editcontent') .
'">'
936 . $this->iconFactory->getIcon(
'actions-page-open', Icon::SIZE_SMALL)->render()
939 $cells[
'edit'] = $this->spaceIcon;
941 if ($fileOrFolderObject instanceof
File) {
942 $fileUrl = $fileOrFolderObject->getPublicUrl(
true);
944 $aOnClick =
'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) .
', \'WebFile\');';
945 $cells[
'view'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.view') .
'">' . $this->iconFactory->getIcon(
'actions-document-view', Icon::SIZE_SMALL)->render() .
'</a>';
947 $cells[
'view'] = $this->spaceIcon;
950 $cells[
'view'] = $this->spaceIcon;
954 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission(
'replace')) {
955 $url = BackendUtility::getModuleUrl(
'file_replace', array(
'target' => $fullIdentifier,
'uid' => $fileOrFolderObject->getUid()));
956 $replaceOnClick =
'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue(
$url) .
'+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
957 $cells[
'replace'] =
'<a href="#" class="btn btn-default" onclick="' . $replaceOnClick .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.replace') .
'">' . $this->iconFactory->getIcon(
'actions-edit-replace', Icon::SIZE_SMALL)->render() .
'</a>';
961 if ($fileOrFolderObject->checkActionPermission(
'rename')) {
962 $url = BackendUtility::getModuleUrl(
'file_rename', array(
'target' => $fullIdentifier));
963 $renameOnClick =
'top.content.list_frame.location.href = ' . GeneralUtility::quoteJSvalue(
$url) .
'+\'&returnUrl=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);return false;';
964 $cells[
'rename'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.rename') .
'">' . $this->iconFactory->getIcon(
'actions-edit-rename', Icon::SIZE_SMALL)->render() .
'</a>';
966 $cells[
'rename'] = $this->spaceIcon;
968 if ($fileOrFolderObject->checkActionPermission(
'read')) {
970 if ($fileOrFolderObject instanceof
Folder) {
971 $infoOnClick =
'top.launchView( \'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) .
');return false;';
972 }
elseif ($fileOrFolderObject instanceof File) {
973 $infoOnClick =
'top.launchView( \'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) .
');return false;';
975 $cells[
'info'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.info') .
'">' . $this->iconFactory->getIcon(
'actions-document-info', Icon::SIZE_SMALL)->render() .
'</a>';
977 $cells[
'info'] = $this->spaceIcon;
981 if ($fileOrFolderObject->checkActionPermission(
'delete')) {
982 $identifier = $fileOrFolderObject->getIdentifier();
983 if ($fileOrFolderObject instanceof
Folder) {
984 $referenceCountText = BackendUtility::referenceCount(
'_FILE', $identifier,
' ' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.referencesToFolder'));
986 $referenceCountText = BackendUtility::referenceCount(
'sys_file', $fileOrFolderObject->getUid(),
' ' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:labels.referencesToFile'));
989 if ($this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)) {
990 $confirmationCheck =
'confirm(' . GeneralUtility::quoteJSvalue(sprintf($this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText) .
')';
992 $confirmationCheck =
'1 == 1';
995 $removeOnClick =
'if (' . $confirmationCheck .
') { top.content.list_frame.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl(
'tce_file') .
'&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) .
'&vC=' . $this->getBackendUser()->veriCode() .
'&redirect=') .
'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
997 $cells[
'delete'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($removeOnClick) .
'" title="' . $this->getLanguageService()->sL(
'LLL:EXT:lang/locallang_core.xlf:cm.delete') .
'">' . $this->iconFactory->getIcon(
'actions-edit-delete', Icon::SIZE_SMALL)->render() .
'</a>';
999 $cells[
'delete'] = $this->spaceIcon;
1003 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'fileList'][
'editIconsHook'])) {
1004 $cells[
'__fileOrFolderObject'] = $fileOrFolderObject;
1005 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'fileList'][
'editIconsHook'] as $classData) {
1006 $hookObject = GeneralUtility::getUserObj($classData);
1008 throw new \UnexpectedValueException(
1009 '$hookObject must implement interface \\TYPO3\\CMS\\Filelist\\FileListEditIconHookInterface',
1013 $hookObject->manipulateEditIcons($cells, $this);
1015 unset($cells[
'__fileOrFolderObject']);
1018 return '<div class="btn-group">' . implode(
'', $cells) .
'</div>';
1027 public function makeRef($fileOrFolderObject)
1034 $databaseConnection = $this->getDatabaseConnection();
1035 $table =
'sys_refindex';
1036 $referenceCount = $databaseConnection->exec_SELECTcountRows(
1039 'ref_table=' . $databaseConnection->fullQuoteStr(
'sys_file', $table)
1040 .
' AND ref_uid=' . (int)$fileOrFolderObject->getUid()
1042 .
' AND tablename != ' . $databaseConnection->fullQuoteStr(
'sys_file_metadata', $table)
1044 return $this->generateReferenceToolTip($referenceCount,
'\'_FILE\
', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
1052 protected function getDatabaseConnection()
1062 protected function getLanguageService()
1072 protected function getBackendUser()