285 if (isset($backendUser->uc[
'titleLen']) && $backendUser->uc[
'titleLen'] > 0) {
286 $this->fixedL = $backendUser->uc[
'titleLen'];
288 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
292 $this->thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
294 $backendUser->getTSConfig()[
'options.'][
'file_list.'][
'filesPerPage'] ?? $this->iLimit,
321 $this->totalbytes = 0;
323 $this->HTMLcode =
'';
327 $this->firstElementNumber = $pointer;
331 $this->fixedL = max($this->fixedL, $this->
getBackendUser()->uc[
'titleLen']);
341 $this->HTMLcode .= $this->
getTable(
'fileext,tstamp,size,rw,_REF_');
355 $jsCode =
'document.dblistForm.cmd.value=' . GeneralUtility::quoteJSvalue($cmd)
356 .
';document.dblistForm.submit();';
360 $attributes[
'class'] =
'btn btn-default t3js-modal-trigger';
361 $attributes[
'data-href'] =
'javascript:' . $jsCode;
362 $attributes[
'data-severity'] =
'warning';
363 $attributes[
'data-content'] = $warning;
365 $attributes[
'class'] =
'btn btn-default';
366 $attributes[
'onclick'] = $jsCode .
'return false;';
369 $attributesString =
'';
370 foreach ($attributes as $key => $value) {
371 $attributesString .=
' ' . $key .
'="' . htmlspecialchars($value) .
'"';
373 return '<a href="#" ' . $attributesString .
'>' . $string .
'</a>';
385 $this->spaceIcon =
'<span class="btn btn-default disabled">' . $this->iconFactory->getIcon(
'empty-empty',
Icon::SIZE_SMALL)->render() .
'</span>';
388 $storage = $this->folderObject->getStorage();
389 $storage->resetFileAndFolderNameFiltersToDefault();
392 if ($this->folderObject->getStorage()->isBrowsable()) {
394 $foldersCount = $storage->countFoldersInFolder($this->folderObject);
395 $filesCount = $storage->countFilesInFolder($this->folderObject);
396 }
catch (InsufficientFolderAccessPermissionsException $e) {
401 if ($foldersCount <= $this->firstElementNumber) {
402 $foldersFrom =
false;
406 if ($this->firstElementNumber + $this->iLimit > $foldersCount) {
412 if ($foldersCount >= $this->firstElementNumber + $this->iLimit) {
416 if ($this->firstElementNumber <= $foldersCount) {
418 $filesNum = $this->iLimit - $foldersNum;
420 $filesFrom = $this->firstElementNumber - $foldersCount;
421 if ($filesFrom + $this->iLimit > $filesCount) {
422 $filesNum = $filesCount - $filesFrom;
429 $folders = $storage->getFoldersInFolder($this->folderObject, $foldersFrom, $foldersNum,
true,
false, trim($this->sort), (
bool)$this->sortRev);
431 $this->totalItems = $foldersCount + $filesCount;
436 $rowlist =
'_LOCALIZATION_,' . $rowlist;
437 $rowlist = GeneralUtility::rmFromList($titleCol, $rowlist);
438 $rowlist = GeneralUtility::uniqueList($rowlist);
439 $rowlist = $rowlist ? $titleCol .
',' . $rowlist : $titleCol;
440 if ($this->clipBoard) {
441 $rowlist = str_replace(
'_LOCALIZATION_,',
'_LOCALIZATION_,_CLIPBOARD_,', $rowlist);
442 $this->addElement_tdCssClass[
'_CLIPBOARD_'] =
'col-clipboard';
444 if ($this->bigControlPanel) {
445 $rowlist = str_replace(
'_LOCALIZATION_,',
'_LOCALIZATION_,_CONTROL_,', $rowlist);
446 $this->addElement_tdCssClass[
'_CONTROL_'] =
'col-control';
448 $this->fieldArray = explode(
',', $rowlist);
451 $this->addElement_tdCssClass[$titleCol] =
'col-title col-responsive';
452 $this->addElement_tdCssClass[
'_LOCALIZATION_'] =
'col-localizationa';
466 $this->eCounter = $this->firstElementNumber + $this->iLimit < $this->totalItems
467 ? $this->firstElementNumber + $this->iLimit
474 foreach ($this->fieldArray as $v) {
475 if ($v ===
'_CLIPBOARD_' && $this->clipBoard) {
478 $elFromTable = $this->clipObj->elFromTable($table);
479 if (!empty($elFromTable) && $this->folderObject->checkActionPermission(
'write')) {
480 $clipboardMode = $this->clipObj->clipData[$this->clipObj->current][
'mode'] ??
'';
481 $permission = $clipboardMode ===
'copy' ?
'copy' :
'move';
482 $addPasteButton = $this->folderObject->checkActionPermission($permission);
484 foreach ($elFromTable as $key => $element) {
485 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
486 if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder($clipBoardElement, $this->folderObject)) {
487 $addPasteButton =
false;
489 $elToConfirm[$key] = $clipBoardElement->getName();
491 if ($addPasteButton) {
492 $cells[] =
'<a class="btn btn-default t3js-modal-trigger"' .
493 ' href="' . htmlspecialchars($this->clipObj->pasteUrl(
495 $this->folderObject->getCombinedIdentifier()
497 .
' data-content="' . htmlspecialchars($this->clipObj->confirmMsgText(
503 .
' data-severity="warning"'
504 .
' data-title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'clip_paste')) .
'"'
513 if ($this->clipObj->current !==
'normal' && $iOut) {
515 $cells[] = $this->
linkClipboardHeaderIcon(
'<span title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'clip_deleteMarked')) .
'">' . $this->iconFactory->getIcon(
'actions-edit-delete',
Icon::SIZE_SMALL)->render(), $table,
'delete', $this->getLanguageService()->getLL(
'clip_deleteMarkedWarning'));
516 $onClick =
'checkOffCB(' . GeneralUtility::quoteJSvalue(implode(
',', $this->CBnames)) .
', this); return false;';
517 $cells[] =
'<a class="btn btn-default" rel="" href="#" onclick="' . htmlspecialchars($onClick) .
'" title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'clip_markRecords')) .
'">' . $this->iconFactory->getIcon(
'actions-document-select',
Icon::SIZE_SMALL)->render() .
'</a>';
519 $theData[$v] = implode(
'', $cells);
520 } elseif ($v ===
'_REF_') {
525 $theData[$v] = $theT;
529 $out .=
'<thead>' . $this->
addElement(1,
'', $theData,
'',
'',
'',
'th') .
'</thead>';
530 $out .=
'<tbody>' . $iOut .
'</tbody>';
537 <div class="panel panel-default">
538 <div class="table-fit">
539 <table class="table table-striped table-hover" id="typo3-filelist">
548 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
550 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
551 $defaultFlashMessageQueue->enqueue($flashMessage);
571 public function addElement($h, $icon, $data, $rowParams =
'', $_ =
'', $_2 =
'', $colType =
'td')
573 $colType = ($colType ===
'th') ?
'th' :
'td';
574 $noWrap = $this->no_noWrap ?
'' :
' nowrap';
576 $l10nParent = (int)($data[
'_l10nparent_'] ?? 0);
578 <!-- Element, begin: -->
579 <tr ' . $rowParams .
' data-uid="' . (int)($data[
'uid'] ?? 0) .
'" data-l10nparent="' . $l10nParent .
'">';
581 if ($this->showIcon) {
583 <' . $colType .
' class="col-icon nowrap">';
587 for ($a = 0; $a < $h; $a++) {
595 $out .=
'</' . $colType .
'>
606 if ($colType ===
'td' && array_key_exists(
'__label', $data)) {
611 if (isset($data[$vKey])) {
613 $cssClass = $this->addElement_tdCssClass[$lastKey] ??
'';
614 if ($this->oddColumnsCssClass && $ccount % 2 == 0) {
615 $cssClass = implode(
' ', [$cssClass, $this->oddColumnsCssClass]);
618 <' . $colType .
' class="' . $cssClass . $noWrap .
'"' . $colsp . ($this->addElement_tdParams[$lastKey] ??
'') .
'>' . $data[$lastKey] .
'</' . $colType .
'>';
630 $colsp =
' colspan="' . $c .
'"';
636 $cssClass = $this->addElement_tdCssClass[$lastKey] ??
'';
637 if ($this->oddColumnsCssClass) {
638 $cssClass = implode(
' ', [$cssClass, $this->oddColumnsCssClass]);
641 <' . $colType .
' class="' . $cssClass . $noWrap .
'"' . $colsp . ($this->addElement_tdParams[$lastKey] ??
'') .
'>' . $data[$lastKey] .
'</' . $colType .
'>';
666 if ($this->eCounter >= $this->firstElementNumber && $this->eCounter < $this->firstElementNumber + $this->iLimit) {
667 if ($this->firstElementNumber && $this->eCounter == $this->firstElementNumber) {
670 $titleCol = $this->fieldArray[0];
671 $theData[$titleCol] = $this->
fwd_rwd_HTML(
'fwd', $this->eCounter, $table);
672 $code = $this->
addElement(1,
'', $theData,
'class="fwd_rwd_nav"');
676 if ($this->eCounter == $this->firstElementNumber + $this->iLimit) {
679 $titleCol = $this->fieldArray[0];
680 $theData[$titleCol] = $this->
fwd_rwd_HTML(
'rwd', $this->eCounter, $table);
681 $code = $this->
addElement(1,
'', $theData,
'class="fwd_rwd_nav"');
698 $tParam = $table ?
'&table=' . rawurlencode($table) :
'';
702 $content =
'<a href="' . htmlspecialchars($href) .
'">' . $this->iconFactory->getIcon(
705 )->render() .
' <i>[' . (max(0, $pointer - $this->iLimit) + 1) .
' - ' . $pointer .
']</i></a>';
708 $href = $this->
listURL() .
'&pointer=' . $pointer . $tParam;
709 $content =
'<a href="' . htmlspecialchars($href) .
'">' . $this->iconFactory->getIcon(
712 )->render() .
' <i>[' . ($pointer + 1) .
' - ' . $this->totalItems .
']</i></a>';
727 function checkOffCB(listOfCBnames, link) { //
728 var checkBoxes, flag, i;
729 var checkBoxes = listOfCBnames.split(",");
730 if (link.rel === "") {
731 link.rel = "allChecked";
737 for (i = 0; i < checkBoxes.length; i++) {
738 setcbValue(checkBoxes[i], flag);
742 function cbValue(CBname) { //
743 var CBfullName = "CBC["+CBname+"]";
744 return (document.dblistForm[CBfullName] && document.dblistForm[CBfullName].checked ? 1 : 0);
747 function setcbValue(CBname,flag) { //
748 CBfullName = "CBC["+CBname+"]";
749 if(document.dblistForm[CBfullName]) {
750 document.dblistForm[CBfullName].checked = flag ? "on" : 0;
763 $localizationParentField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField'];
764 $languageField =
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField'];
765 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
766 ->getQueryBuilderForTable(
'pages');
767 $queryBuilder->getRestrictions()
769 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
770 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
771 $result = $queryBuilder
775 $queryBuilder->expr()->andX(
776 $queryBuilder->expr()->eq(
777 $localizationParentField,
778 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
780 $queryBuilder->expr()->gt(
782 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
788 $this->pageOverlays = [];
789 while ($row = $result->fetch()) {
790 $this->pageOverlays[$row[$languageField]] = $row;
803 public function languageFlag($sys_language_uid, $addAsAdditionalText =
true)
806 $title = htmlspecialchars($this->languageIconTitles[$sys_language_uid][
'title']);
807 if ($this->languageIconTitles[$sys_language_uid][
'flagIcon']) {
808 $out .=
'<span title="' . $title .
'">' . $this->iconFactory->getIcon(
809 $this->languageIconTitles[$sys_language_uid][
'flagIcon'],
811 )->render() .
'</span>';
812 if (!$addAsAdditionalText) {
832 $currentStorage = $currentFolder->getStorage();
833 $parentFolder = $currentFolder->getParentFolder();
834 if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
836 '<span title="' . htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel')) .
'">'
842 }
catch (\Exception $e) {
854 if ($this->counter == 1) {
859 return $this->counter .
' ' . $fileLabel .
', ' . GeneralUtility::formatSize($this->totalbytes, htmlspecialchars($this->
getLanguageService()->getLL(
'byteSizeUnits')));
878 $displayName =
'<strong>' . htmlspecialchars($folderName) .
'</strong>';
880 $displayName = htmlspecialchars($folderName);
890 $theIcon =
'<span title="' . htmlspecialchars($folderName) .
'">' . $this->iconFactory->getIconForResource(
$folderObject,
Icon::SIZE_SMALL)->render() .
'</span>';
898 foreach ($this->fieldArray as $field) {
899 $theData[$field] =
'';
901 $theData[
'file'] = $displayName;
903 foreach ($this->fieldArray as $field) {
908 }
catch (InsufficientFolderAccessPermissionsException $e) {
911 $theData[$field] = $numFiles .
' ' . htmlspecialchars($this->
getLanguageService()->getLL(($numFiles === 1 ?
'file' :
'files')));
914 $theData[$field] =
'<strong class="text-danger">' . htmlspecialchars($this->
getLanguageService()->getLL(
'read')) .
'</strong>' . (!$isWritable ?
'' :
'<strong class="text-danger">' . htmlspecialchars($this->
getLanguageService()->getLL(
'write')) .
'</strong>');
927 $theData[$field] = $this->
makeEdit($folderObject);
930 $theData[$field] = $this->
makeClip($folderObject);
933 $theData[$field] = $this->
makeRef($folderObject);
936 $theData[$field] = GeneralUtility::fixed_lgd_cs($theData[$field] ??
'', $this->fixedL);
955 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
957 $onclick =
' onclick="' . htmlspecialchars(
'top.document.getElementsByName("nav_frame")[0].contentWindow.Tree.highlightActiveItem("file","folder' . GeneralUtility::md5int(
$folderObject->
getCombinedIdentifier()) .
'_"+top.fsMod.currentBank)') .
'"';
959 if ((
string)$title === strip_tags($title)) {
960 return '<a href="' . htmlspecialchars($href) .
'"' . $onclick .
' title="' . htmlspecialchars($title) .
'">' . $title .
'</a>';
962 return '<a href="' . htmlspecialchars($href) .
'"' . $onclick .
'>' . $title .
'</a>';
975 if ($fileObject instanceof File && $fileObject->isIndexed() && $fileObject->checkActionPermission(
'editMeta') && $this->getBackendUser()->check(
'tables_modify',
'sys_file_metadata')) {
976 $metaData = $fileObject->_getMetaData();
979 'sys_file_metadata' => [
980 $metaData[
'uid'] =>
'edit'
986 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
987 $url = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $urlParameters);
988 $title = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata'));
989 $code =
'<a class="responsive-title" href="' . htmlspecialchars($url) .
'" title="' . $title .
'">' . $code .
'</a>';
991 }
catch (\Exception $e) {
1008 public function listURL($altId =
'', $table =
'-1', $exclList =
'')
1010 return GeneralUtility::linkThisScript([
1011 'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
1012 'imagemode' => $this->thumbs
1025 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
1028 $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
1029 $systemLanguages = array_filter($allSystemLanguages,
function ($languageRecord) {
1030 if ($languageRecord[
'uid'] === -1 || $languageRecord[
'uid'] === 0 || !$this->
getBackendUser()->checkLanguageAccess($languageRecord[
'uid'])) {
1036 foreach (
$files as $fileObject) {
1039 $this->totalbytes += $fileObject->getSize();
1040 $ext = $fileObject->getExtension();
1041 $fileName = trim($fileObject->getName());
1043 $theIcon =
'<span title="' . htmlspecialchars($fileName .
' [' . (
int)$fileObject->getUid() .
']') .
'">'
1044 . $this->iconFactory->getIconForResource($fileObject,
Icon::SIZE_SMALL)->render() .
'</span>';
1048 foreach ($this->fieldArray as $field) {
1051 $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), htmlspecialchars($this->
getLanguageService()->getLL(
'byteSizeUnits')));
1054 $theData[$field] =
'' . (!$fileObject->checkActionPermission(
'read') ?
' ' :
'<strong class="text-danger">' . htmlspecialchars($this->
getLanguageService()->getLL(
'read')) .
'</strong>') . (!$fileObject->checkActionPermission(
'write') ?
'' :
'<strong class="text-danger">' . htmlspecialchars($this->
getLanguageService()->getLL(
'write')) .
'</strong>');
1057 $theData[$field] = htmlspecialchars(strtoupper($ext));
1063 $theData[$field] = $this->
makeEdit($fileObject);
1066 $theData[$field] = $this->
makeClip($fileObject);
1068 case '_LOCALIZATION_':
1069 if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission(
'editMeta') && $this->getBackendUser()->check(
'tables_modify',
'sys_file_metadata')) {
1070 $metaDataRecord = $fileObject->_getMetaData();
1074 foreach ($systemLanguages as $language) {
1075 $languageId = $language[
'uid'];
1076 $flagIcon = $language[
'flagIcon'];
1077 if (array_key_exists($languageId, $translations)) {
1078 $title = htmlspecialchars(sprintf($this->
getLanguageService()->getLL(
'editMetadataForLanguage'), $language[
'title']));
1082 'sys_file_metadata' => [
1083 $translations[$languageId][
'uid'] =>
'edit'
1088 $flagButtonIcon = $this->iconFactory->getIcon($flagIcon,
Icon::SIZE_SMALL,
'overlay-edit')->render();
1089 $url = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $urlParameters);
1090 $languageCode .=
'<a href="' . htmlspecialchars($url) .
'" class="btn btn-default" title="' . $title .
'">'
1091 . $flagButtonIcon .
'</a>';
1094 'justLocalized' =>
'sys_file_metadata:' . $metaDataRecord[
'uid'] .
':' . $languageId,
1097 $returnUrl = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $parameters);
1099 '&cmd[sys_file_metadata][' . $metaDataRecord[
'uid'] .
'][localize]=' . $languageId,
1102 $flagButtonIcon =
'<span title="' . htmlspecialchars(sprintf($this->
getLanguageService()->getLL(
'createMetadataForLanguage'), $language[
'title'])) .
'">' . $this->iconFactory->getIcon($flagIcon,
Icon::SIZE_SMALL,
'overlay-new')->render() .
'</span>';
1103 $languageCode .=
'<a href="' . htmlspecialchars($href) .
'" class="btn btn-default">' . $flagButtonIcon .
'</a> ';
1108 $theData[$field] =
' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() .
'"' .
1109 (empty($translations) ?
' style="display: none;"' :
'') .
'>' . $languageCode .
'</div>';
1110 $theData[$field] .=
'<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() .
'">' .
1111 '<span title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'translateMetadata')) .
'">'
1112 . $this->iconFactory->getIcon(
'mimetypes-x-content-page-language-overlay',
Icon::SIZE_SMALL)->render() .
'</span>'
1117 $theData[$field] = $this->
makeRef($fileObject);
1121 $theData[$field] = $this->
linkWrapFile(htmlspecialchars($fileName), $fileObject);
1123 if ($fileObject->isMissing()) {
1124 $theData[$field] .=
'<span class="label label-danger label-space-left">'
1125 . htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:warning.file_missing'))
1129 $processedFile = $fileObject->process(
1132 'width' => $this->thumbnailConfiguration->getWidth(),
1133 'height' => $this->thumbnailConfiguration->getHeight()
1136 if ($processedFile) {
1137 $thumbUrl = $processedFile->getPublicUrl(
true);
1138 $theData[$field] .=
'<br /><img src="' . htmlspecialchars($thumbUrl) .
'" ' .
1139 'width="' . $processedFile->getProperty(
'width') .
'" ' .
1140 'height="' . $processedFile->getProperty(
'height') .
'" ' .
1141 'title="' . htmlspecialchars($fileName) .
'" alt="" />';
1146 $theData[$field] =
'';
1147 if ($fileObject->hasProperty($field)) {
1148 $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
1152 $out .= $this->
addElement(1, $theIcon, $theData);
1165 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_file_metadata');
1166 $queryBuilder->getRestrictions()->removeAll();
1167 $translationRecords = $queryBuilder->select(
'*')
1168 ->from(
'sys_file_metadata')
1170 $queryBuilder->expr()->eq(
1171 $GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'transOrigPointerField'],
1172 $queryBuilder->createNamedParameter($metaDataRecord[
'uid'], \PDO::PARAM_INT)
1174 $queryBuilder->expr()->gt(
1175 $GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'languageField'],
1176 $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
1183 foreach ($translationRecords as $record) {
1184 $translations[$record[
$GLOBALS[
'TCA'][
'sys_file_metadata'][
'ctrl'][
'languageField']]] = $record;
1186 return $translations;
1197 return GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'], strtolower($ext));
1208 return GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'mediafile_ext'], strtolower($ext));
1219 public function linkWrapSort($code, $folderIdentifier, $col)
1221 $params = [
'id' => $folderIdentifier,
'SET' => [
'sort' => $col]];
1223 if ($this->sort === $col) {
1225 $params[
'SET'][
'reverse'] = ($this->sortRev ?
'0' :
'1');
1226 $sortArrow = $this->iconFactory->getIcon(
'status-status-sorting-' . ($this->sortRev ?
'desc' :
'asc'),
Icon::SIZE_SMALL)->render();
1228 $params[
'SET'][
'reverse'] = 0;
1232 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
1233 $href = (string)$uriBuilder->buildUriFromRoute(
'file_FilelistList', $params);
1234 return '<a href="' . htmlspecialchars($href) .
'">' . $code .
' ' . $sortArrow .
'</a>';
1243 public function makeClip($fileOrFolderObject)
1245 if (!$fileOrFolderObject->checkActionPermission(
'read')) {
1249 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
1250 $fullName = $fileOrFolderObject->getName();
1251 $md5 = GeneralUtility::shortMD5($fullIdentifier);
1253 if ($this->clipObj->current ===
'normal') {
1254 $isSel = $this->clipObj->isSelected(
'_FILE', $md5);
1255 $copyTitle = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy'));
1256 $cutTitle = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut'));
1257 $copyIcon = $this->iconFactory->getIcon(
'actions-edit-copy',
Icon::SIZE_SMALL)->render();
1258 $cutIcon = $this->iconFactory->getIcon(
'actions-edit-cut',
Icon::SIZE_SMALL)->render();
1260 if ($isSel ===
'copy') {
1261 $copyIcon = $this->iconFactory->getIcon(
'actions-edit-copy-release',
Icon::SIZE_SMALL)->render();
1262 } elseif ($isSel ===
'cut') {
1263 $cutIcon = $this->iconFactory->getIcon(
'actions-edit-cut-release',
Icon::SIZE_SMALL)->render();
1266 if ($fileOrFolderObject->checkActionPermission(
'copy')) {
1267 $cells[] =
'<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile(
1271 )) .
'" title="' . $copyTitle .
'">' . $copyIcon .
'</a>';
1276 if ($fileOrFolderObject->checkActionPermission(
'move')) {
1277 $cells[] =
'<a class="btn btn-default" href="' . htmlspecialchars($this->clipObj->selUrlFile(
1281 )) .
'" title="' . $cutTitle .
'">' . $cutIcon .
'</a>';
1287 $n =
'_FILE|' . $md5;
1288 $this->CBnames[] = $n;
1289 $checked = $this->clipObj->isSelected(
'_FILE', $md5) ?
' checked="checked"' :
'';
1290 $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>';
1293 $elFromTable = $this->clipObj->elFromTable(
'_FILE');
1295 $clipboardMode = $this->clipObj->clipData[$this->clipObj->current][
'mode'] ??
'';
1296 $permission = $clipboardMode ===
'copy' ?
'copy' :
'move';
1297 $addPasteButton = $this->folderObject->checkActionPermission($permission);
1299 foreach ($elFromTable as $key => $element) {
1300 $clipBoardElement = $this->resourceFactory->retrieveFileOrFolderObject($element);
1302 $addPasteButton =
false;
1304 $elToConfirm[$key] = $clipBoardElement->getName();
1306 if ($addPasteButton) {
1307 $cells[] =
'<a class="btn btn-default t3js-modal-trigger" '
1308 .
' href="' . htmlspecialchars($this->clipObj->pasteUrl(
'_FILE', $fullIdentifier)) .
'"'
1309 .
' data-content="' . htmlspecialchars($this->clipObj->confirmMsgText(
'_FILE', $fullName,
'into', $elToConfirm)) .
'"'
1310 .
' data-severity="warning"'
1311 .
' data-title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'clip_pasteInto')) .
'"'
1312 .
' title="' . htmlspecialchars($this->
getLanguageService()->getLL(
'clip_pasteInto')) .
'"'
1314 . $this->iconFactory->getIcon(
'actions-document-paste-into',
Icon::SIZE_SMALL)->render()
1321 return ' <div class="btn-group" role="group">' . implode(
'', $cells) .
'</div>';
1330 public function makeEdit($fileOrFolderObject)
1333 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier();
1334 $md5 = GeneralUtility::shortMD5($fullIdentifier);
1336 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
1339 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission(
'write') && GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'textfile_ext'], $fileOrFolderObject->getExtension())) {
1340 $url = (string)$uriBuilder->buildUriFromRoute(
'file_edit', [
'target' => $fullIdentifier]);
1341 $editOnClick =
'top.list_frame.location.href=' . GeneralUtility::quoteJSvalue($url) .
'+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
1342 $cells[
'edit'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) .
'" title="' . $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editcontent') .
'">'
1350 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission(
'editMeta') && $this->getBackendUser()->check(
'tables_modify',
'sys_file_metadata')) {
1351 $metaData = $fileOrFolderObject->_getMetaData();
1354 'sys_file_metadata' => [
1355 $metaData[
'uid'] =>
'edit'
1360 $url = (string)$uriBuilder->buildUriFromRoute(
'record_edit', $urlParameters);
1361 $title = htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata'));
1362 $cells[
'metadata'] =
'<a class="btn btn-default" href="' . htmlspecialchars($url) .
'" title="' . $title .
'">' . $this->iconFactory->getIcon(
'actions-open',
Icon::SIZE_SMALL)->render() .
'</a>';
1366 if ($fileOrFolderObject instanceof File) {
1367 $fileUrl = $fileOrFolderObject->getPublicUrl(
true);
1369 $aOnClick =
'return top.openUrlInWindow(' . GeneralUtility::quoteJSvalue($fileUrl) .
', \'WebFile\');';
1370 $cells[
'view'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($aOnClick) .
'" title="' . $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.view') .
'">' . $this->iconFactory->getIcon(
'actions-document-view',
Icon::SIZE_SMALL)->render() .
'</a>';
1379 if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission(
'replace')) {
1380 $url = (string)$uriBuilder->buildUriFromRoute(
'file_replace', [
'target' => $fullIdentifier,
'uid' => $fileOrFolderObject->getUid()]);
1381 $replaceOnClick =
'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) .
'+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
1382 $cells[
'replace'] =
'<a href="#" class="btn btn-default" onclick="' . $replaceOnClick .
'" title="' . $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.replace') .
'">' . $this->iconFactory->getIcon(
'actions-edit-replace',
Icon::SIZE_SMALL)->render() .
'</a>';
1386 if ($fileOrFolderObject->checkActionPermission(
'rename')) {
1387 $url = (string)$uriBuilder->buildUriFromRoute(
'file_rename', [
'target' => $fullIdentifier]);
1388 $renameOnClick =
'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) .
'+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
1389 $cells[
'rename'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($renameOnClick) .
'" title="' . $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.rename') .
'">' . $this->iconFactory->getIcon(
'actions-edit-rename',
Icon::SIZE_SMALL)->render() .
'</a>';
1395 if ($fileOrFolderObject->getStorage()->checkUserActionPermission(
'add',
'File') && $fileOrFolderObject->checkActionPermission(
'write')) {
1396 if ($fileOrFolderObject instanceof Folder) {
1397 $url = (string)$uriBuilder->buildUriFromRoute(
'file_upload', [
'target' => $fullIdentifier]);
1398 $uploadOnClick =
'top.list_frame.location.href = ' . GeneralUtility::quoteJSvalue($url) .
'+\'&returnUrl=\'+top.rawurlencode(top.list_frame.document.location.pathname+top.list_frame.document.location.search);return false;';
1399 $cells[
'upload'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($uploadOnClick) .
'" title="' . htmlspecialchars($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload')) .
'">' . $this->iconFactory->getIcon(
'actions-edit-upload',
Icon::SIZE_SMALL)->render() .
'</a>';
1403 if ($fileOrFolderObject->checkActionPermission(
'read')) {
1405 if ($fileOrFolderObject instanceof Folder) {
1406 $infoOnClick =
'top.TYPO3.InfoWindow.showItem(\'_FOLDER\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) .
');return false;';
1407 } elseif ($fileOrFolderObject instanceof File) {
1408 $infoOnClick =
'top.TYPO3.InfoWindow.showItem(\'_FILE\', ' . GeneralUtility::quoteJSvalue($fullIdentifier) .
');return false;';
1410 $cells[
'info'] =
'<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($infoOnClick) .
'" title="' . $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.info') .
'">' . $this->iconFactory->getIcon(
'actions-document-info',
Icon::SIZE_SMALL)->render() .
'</a>';
1416 if ($fileOrFolderObject->checkActionPermission(
'delete')) {
1417 $identifier = $fileOrFolderObject->getIdentifier();
1418 if ($fileOrFolderObject instanceof Folder) {
1420 $deleteType =
'delete_folder';
1422 $referenceCountText =
BackendUtility::referenceCount(
'sys_file', $fileOrFolderObject->getUid(),
' ' . $this->getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.referencesToFile'));
1423 $deleteType =
'delete_file';
1427 $confirmationCheck =
'1';
1429 $confirmationCheck =
'0';
1432 $deleteUrl = (string)$uriBuilder->buildUriFromRoute(
'tce_file');
1433 $confirmationMessage = sprintf($this->
getLanguageService()->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:mess.delete'), $fileOrFolderObject->getName()) . $referenceCountText;
1434 $title = $this->
getLanguageService()->
sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.delete');
1435 $cells[
'delete'] =
'<a href="#" class="btn btn-default t3js-filelist-delete" data-content="' . htmlspecialchars($confirmationMessage)
1436 .
'" data-check="' . $confirmationCheck
1437 .
'" data-delete-url="' . htmlspecialchars($deleteUrl)
1438 .
'" data-title="' . htmlspecialchars($title)
1439 .
'" data-identifier="' . htmlspecialchars($fileOrFolderObject->getCombinedIdentifier())
1440 .
'" data-delete-type="' . $deleteType
1441 .
'" title="' . htmlspecialchars($title) .
'">'
1442 . $this->iconFactory->getIcon(
'actions-edit-delete',
Icon::SIZE_SMALL)->render() .
'</a>';
1448 $cells[
'__fileOrFolderObject'] = $fileOrFolderObject;
1449 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'fileList'][
'editIconsHook'] ?? [] as $className) {
1450 $hookObject = GeneralUtility::makeInstance($className);
1451 if (!$hookObject instanceof FileListEditIconHookInterface) {
1452 throw new \UnexpectedValueException(
1453 $className .
' must implement interface ' . FileListEditIconHookInterface::class,
1457 $hookObject->manipulateEditIcons($cells, $this);
1459 unset($cells[
'__fileOrFolderObject']);
1461 return '<div class="btn-group">' . implode(
'', $cells) .
'</div>';
1470 public function makeRef($fileOrFolderObject)
1472 if ($fileOrFolderObject instanceof FolderInterface) {
1477 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'sys_refindex');
1478 $referenceCount = $queryBuilder->count(
'*')
1479 ->from(
'sys_refindex')
1481 $queryBuilder->expr()->eq(
'deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
1482 $queryBuilder->expr()->eq(
1484 $queryBuilder->createNamedParameter(
'sys_file', \PDO::PARAM_STR)
1486 $queryBuilder->expr()->eq(
1488 $queryBuilder->createNamedParameter($fileOrFolderObject->getUid(), \PDO::PARAM_INT)
1490 $queryBuilder->expr()->neq(
1492 $queryBuilder->createNamedParameter(
'sys_file_metadata', \PDO::PARAM_STR)
1498 return $this->
generateReferenceToolTip($referenceCount,
'\'_FILE\
', ' . GeneralUtility::quoteJSvalue($fileOrFolderObject->getCombinedIdentifier()));
1526 if ($routePath = GeneralUtility::_GP(
'route')) {
1527 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
1528 $this->thisScript = (string)$uriBuilder->buildUriFromRoutePath($routePath);
1530 $this->thisScript = GeneralUtility::getIndpEnv(
'SCRIPT_NAME');
1539 return strpos($this->thisScript,
'?') ===
false ? $this->thisScript .
'?' : $this->thisScript .
'&';
1549 if (!isset($this->translateTools)) {
1550 $this->translateTools = GeneralUtility::makeInstance(TranslationConfigurationProvider::class);
1568 $htmlCode =
'<a href="#"';
1569 if ($launchViewParameter !==
'') {
1570 $htmlCode .=
' onclick="' . htmlspecialchars(
1571 'top.TYPO3.InfoWindow.showItem(' . $launchViewParameter .
'); return false;'
1574 $htmlCode .=
' title="' . htmlspecialchars(
1576 'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references'
1577 ) .
' (' . $references .
')'
1579 $htmlCode .= $references;
1580 $htmlCode .=
'</a>';