first commit
This commit is contained in:
commit
1218dd1517
12716 files changed
+989233
No files matched your search
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace TYPO3\CMS\Filelist\Configuration;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\SingletonInterface;
|
||||
|
||||
/**
|
||||
* @internal this is a concrete TYPO3 implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class ThumbnailConfiguration implements SingletonInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $width = 64;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $height = 64;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$userTsConfig = $this->getBackendUser()->getTSConfig();
|
||||
$this->width = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['width'] ?? 64);
|
||||
$this->height = (int)($userTsConfig['options.']['file_list.']['thumbnail.']['height'] ?? 64);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth(): int
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight(): int
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUser()
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace TYPO3\CMS\Filelist\ContextMenu\ItemProviders;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Drag drop menu provider for legacy tree (used in filelist folder tree)
|
||||
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FileDragProvider extends \TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $itemsConfiguration = [
|
||||
'copyInto' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copyFolder_into',
|
||||
'iconIdentifier' => 'apps-pagetree-drag-move-into',
|
||||
'callbackAction' => 'dropCopyInto'
|
||||
],
|
||||
'moveInto' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.moveFolder_into',
|
||||
'iconIdentifier' => 'apps-pagetree-drag-move-into',
|
||||
'callbackAction' => 'dropMoveInto'
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canHandle(): bool
|
||||
{
|
||||
return $this->table === 'folders-drag';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $itemName
|
||||
* @return array
|
||||
*/
|
||||
protected function getAdditionalAttributes(string $itemName): array
|
||||
{
|
||||
$attributes = [
|
||||
'data-callback-module' => 'TYPO3/CMS/Filelist/ContextMenuActions',
|
||||
'data-drop-target' => htmlspecialchars(GeneralUtility::_GP('dstId'))
|
||||
];
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace TYPO3\CMS\Filelist\ContextMenu\ItemProviders;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Core\Resource\File;
|
||||
use TYPO3\CMS\Core\Resource\Folder;
|
||||
use TYPO3\CMS\Core\Resource\ResourceFactory;
|
||||
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Provides click menu items for files and folders
|
||||
*/
|
||||
class FileProvider extends \TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider
|
||||
{
|
||||
/**
|
||||
* @var File|Folder
|
||||
*/
|
||||
protected $record;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $itemsConfiguration = [
|
||||
'edit' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.edit',
|
||||
'iconIdentifier' => 'actions-page-open',
|
||||
'callbackAction' => 'editFile'
|
||||
],
|
||||
'rename' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.rename',
|
||||
'iconIdentifier' => 'actions-edit-rename',
|
||||
'callbackAction' => 'renameFile'
|
||||
],
|
||||
'upload' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload',
|
||||
'iconIdentifier' => 'actions-edit-upload',
|
||||
'callbackAction' => 'uploadFile'
|
||||
],
|
||||
'new' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new',
|
||||
'iconIdentifier' => 'actions-document-new',
|
||||
'callbackAction' => 'createFile'
|
||||
],
|
||||
'info' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.info',
|
||||
'iconIdentifier' => 'actions-document-info',
|
||||
'callbackAction' => 'openInfoPopUp'
|
||||
],
|
||||
'divider' => [
|
||||
'type' => 'divider'
|
||||
],
|
||||
'copy' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy',
|
||||
'iconIdentifier' => 'actions-edit-copy',
|
||||
'callbackAction' => 'copyFile'
|
||||
],
|
||||
'copyRelease' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy',
|
||||
'iconIdentifier' => 'actions-edit-copy-release',
|
||||
'callbackAction' => 'copyReleaseFile'
|
||||
],
|
||||
'cut' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut',
|
||||
'iconIdentifier' => 'actions-edit-cut',
|
||||
'callbackAction' => 'cutFile'
|
||||
],
|
||||
'cutRelease' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cutrelease',
|
||||
'iconIdentifier' => 'actions-edit-cut-release',
|
||||
'callbackAction' => 'cutReleaseFile'
|
||||
],
|
||||
'pasteInto' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.pasteinto',
|
||||
'iconIdentifier' => 'actions-document-paste-into',
|
||||
'callbackAction' => 'pasteFileInto'
|
||||
],
|
||||
'divider2' => [
|
||||
'type' => 'divider'
|
||||
],
|
||||
'delete' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.delete',
|
||||
'iconIdentifier' => 'actions-edit-delete',
|
||||
'callbackAction' => 'deleteFile'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canHandle(): bool
|
||||
{
|
||||
return $this->table === 'sys_file';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize file object
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$fileObject = ResourceFactory::getInstance()
|
||||
->retrieveFileOrFolderObject($this->identifier);
|
||||
$this->record = $fileObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether certain item can be rendered (e.g. check for disabled items or permissions)
|
||||
*
|
||||
* @param string $itemName
|
||||
* @param string $type
|
||||
* @return bool
|
||||
*/
|
||||
protected function canRender(string $itemName, string $type): bool
|
||||
{
|
||||
if (in_array($type, ['divider', 'submenu'], true)) {
|
||||
return true;
|
||||
}
|
||||
if (in_array($itemName, $this->disabledItems, true)) {
|
||||
return false;
|
||||
}
|
||||
$canRender = false;
|
||||
switch ($itemName) {
|
||||
//just for files
|
||||
case 'edit':
|
||||
$canRender = $this->canBeEdited();
|
||||
break;
|
||||
case 'info':
|
||||
$canRender = $this->canShowInfo();
|
||||
break;
|
||||
|
||||
//just for folders
|
||||
case 'upload':
|
||||
case 'new':
|
||||
$canRender = $this->canCreateNew();
|
||||
break;
|
||||
case 'pasteInto':
|
||||
$canRender = $this->canBePastedInto();
|
||||
break;
|
||||
|
||||
//for both files and folders
|
||||
case 'rename':
|
||||
$canRender = $this->canBeRenamed();
|
||||
break;
|
||||
case 'copy':
|
||||
$canRender = $this->canBeCopied();
|
||||
break;
|
||||
case 'copyRelease':
|
||||
$canRender = $this->isRecordInClipboard('copy');
|
||||
break;
|
||||
case 'cut':
|
||||
$canRender = $this->canBeCut();
|
||||
break;
|
||||
case 'cutRelease':
|
||||
$canRender = $this->isRecordInClipboard('cut');
|
||||
break;
|
||||
case 'delete':
|
||||
$canRender = $this->canBeDeleted();
|
||||
break;
|
||||
}
|
||||
return $canRender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeEdited(): bool
|
||||
{
|
||||
return $this->isFile()
|
||||
&& $this->record->checkActionPermission('write')
|
||||
&& GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $this->record->getExtension());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeRenamed(): bool
|
||||
{
|
||||
return $this->record->checkActionPermission('rename');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeDeleted(): bool
|
||||
{
|
||||
return $this->record->checkActionPermission('delete');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canShowInfo(): bool
|
||||
{
|
||||
return $this->isFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canCreateNew(): bool
|
||||
{
|
||||
return $this->isFolder() && $this->record->checkActionPermission('write');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeCopied(): bool
|
||||
{
|
||||
return $this->record->checkActionPermission('read') && $this->record->checkActionPermission('copy') && !$this->isRecordInClipboard('copy');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeCut(): bool
|
||||
{
|
||||
return $this->record->checkActionPermission('move') && !$this->isRecordInClipboard('cut');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBePastedInto(): bool
|
||||
{
|
||||
$elArr = $this->clipboard->elFromTable('_FILE');
|
||||
if (empty($elArr)) {
|
||||
return false;
|
||||
}
|
||||
$selItem = reset($elArr);
|
||||
$fileOrFolderInClipBoard = ResourceFactory::getInstance()->retrieveFileOrFolderObject($selItem);
|
||||
|
||||
return $this->isFolder()
|
||||
&& $this->record->checkActionPermission('write')
|
||||
&& (
|
||||
!$fileOrFolderInClipBoard instanceof Folder
|
||||
|| !$fileOrFolderInClipBoard->getStorage()->isWithinFolder($fileOrFolderInClipBoard, $this->record)
|
||||
)
|
||||
&& $this->isFoldersAreInTheSameRoot($fileOrFolderInClipBoard);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if folder and record are in the same filemount
|
||||
* Cannot copy folders between filemounts
|
||||
*
|
||||
* @param File|Folder $fileOrFolderInClipBoard
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFoldersAreInTheSameRoot($fileOrFolderInClipBoard): bool
|
||||
{
|
||||
return (!$fileOrFolderInClipBoard instanceof Folder)
|
||||
|| (
|
||||
$this->record->getStorage()->getRootLevelFolder()->getCombinedIdentifier()
|
||||
== $fileOrFolderInClipBoard->getStorage()->getRootLevelFolder()->getCombinedIdentifier()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a file record is in the "normal" pad of the clipboard
|
||||
*
|
||||
* @param string $mode "copy", "cut" or '' for any mode
|
||||
* @return bool
|
||||
*/
|
||||
protected function isRecordInClipboard(string $mode = ''): bool
|
||||
{
|
||||
if ($mode !== '' && !$this->record->checkActionPermission($mode)) {
|
||||
return false;
|
||||
}
|
||||
$isSelected = '';
|
||||
// Pseudo table name for use in the clipboard.
|
||||
$table = '_FILE';
|
||||
$uid = GeneralUtility::shortMD5($this->record->getCombinedIdentifier());
|
||||
if ($this->clipboard->current === 'normal') {
|
||||
$isSelected = $this->clipboard->isSelected($table, $uid);
|
||||
}
|
||||
return $mode === '' ? !empty($isSelected) : $isSelected === $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isStorageRoot(): bool
|
||||
{
|
||||
return $this->record->getIdentifier() === $this->record->getStorage()->getRootLevelFolder()->getIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFile(): bool
|
||||
{
|
||||
return $this->record instanceof File;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFolder(): bool
|
||||
{
|
||||
return $this->record instanceof Folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $itemName
|
||||
* @return array
|
||||
*/
|
||||
protected function getAdditionalAttributes(string $itemName): array
|
||||
{
|
||||
$attributes = [
|
||||
'data-callback-module' => 'TYPO3/CMS/Filelist/ContextMenuActions'
|
||||
];
|
||||
if ($itemName === 'delete' && $this->backendUser->jsConfirmation(JsConfirmation::DELETE)) {
|
||||
$recordTitle = GeneralUtility::fixed_lgd_cs($this->record->getName(), $this->backendUser->uc['titleLen']);
|
||||
|
||||
$title = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:delete');
|
||||
$confirmMessage = sprintf(
|
||||
$this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:mess.delete'),
|
||||
$recordTitle
|
||||
);
|
||||
if ($this->isFolder()) {
|
||||
$confirmMessage .= BackendUtility::referenceCount(
|
||||
'_FILE',
|
||||
$this->record->getIdentifier(),
|
||||
' ' . $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.referencesToFolder')
|
||||
);
|
||||
} else {
|
||||
$confirmMessage .= BackendUtility::referenceCount(
|
||||
'sys_file',
|
||||
$this->record->getUid(),
|
||||
' ' . $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.referencesToFile')
|
||||
);
|
||||
}
|
||||
$closeText = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:button.cancel');
|
||||
$deleteText = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:button.delete');
|
||||
$attributes += [
|
||||
'data-title' => htmlspecialchars($title),
|
||||
'data-message' => htmlspecialchars($confirmMessage),
|
||||
'data-button-close-text' => htmlspecialchars($closeText),
|
||||
'data-button-ok-text' => htmlspecialchars($deleteText),
|
||||
];
|
||||
}
|
||||
if ($itemName === 'pasteInto' && $this->backendUser->jsConfirmation(JsConfirmation::COPY_MOVE_PASTE)) {
|
||||
$elArr = $this->clipboard->elFromTable('_FILE');
|
||||
$selItem = reset($elArr);
|
||||
$fileOrFolderInClipBoard = ResourceFactory::getInstance()->retrieveFileOrFolderObject($selItem);
|
||||
|
||||
$title = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:clip_paste');
|
||||
|
||||
$confirmMessage = sprintf(
|
||||
$this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:mess.'
|
||||
. ($this->clipboard->currentMode() === 'copy' ? 'copy' : 'move') . '_into'),
|
||||
$fileOrFolderInClipBoard->getName(),
|
||||
$this->record->getName()
|
||||
);
|
||||
$closeText = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:button.cancel');
|
||||
$okLabel = $this->clipboard->currentMode() === 'copy' ? 'copy' : 'pasteinto';
|
||||
$okText = $this->languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.' . $okLabel);
|
||||
$attributes += [
|
||||
'data-title' => htmlspecialchars($title),
|
||||
'data-message' => htmlspecialchars($confirmMessage),
|
||||
'data-button-close-text' => htmlspecialchars($closeText),
|
||||
'data-button-ok-text' => htmlspecialchars($okText),
|
||||
];
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getIdentifier(): string
|
||||
{
|
||||
return $this->record->getCombinedIdentifier();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace TYPO3\CMS\Filelist\ContextMenu\ItemProviders;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides click menu items for file_storage
|
||||
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FileStorageProvider extends FileProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $itemsConfiguration = [
|
||||
'edit' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.edit',
|
||||
'iconIdentifier' => 'actions-open',
|
||||
'callbackAction' => 'editFileStorage'
|
||||
],
|
||||
'upload' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload',
|
||||
'iconIdentifier' => 'actions-edit-upload',
|
||||
'callbackAction' => 'uploadFile'
|
||||
],
|
||||
'new' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new',
|
||||
'iconIdentifier' => 'actions-document-new',
|
||||
'callbackAction' => 'createFile'
|
||||
],
|
||||
'info' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.info',
|
||||
'iconIdentifier' => 'actions-document-info',
|
||||
'callbackAction' => 'openInfoPopUp'
|
||||
],
|
||||
'divider' => [
|
||||
'type' => 'divider'
|
||||
],
|
||||
'pasteInto' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.pasteinto',
|
||||
'iconIdentifier' => 'actions-document-paste-into',
|
||||
'callbackAction' => 'pasteFileInto'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canHandle(): bool
|
||||
{
|
||||
return $this->table === 'sys_file_storage';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canShowInfo(): bool
|
||||
{
|
||||
return $this->backendUser->check('tables_select', 'sys_file_storage');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function canBeEdited(): bool
|
||||
{
|
||||
return $this->backendUser->check('tables_modify', 'sys_file_storage');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace TYPO3\CMS\Filelist\ContextMenu\ItemProviders;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provides click menu items for filemounts
|
||||
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FilemountsProvider extends FileProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $itemsConfiguration = [
|
||||
'upload' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload',
|
||||
'iconIdentifier' => 'actions-edit-upload',
|
||||
'callbackAction' => 'uploadFile'
|
||||
],
|
||||
'new' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new',
|
||||
'iconIdentifier' => 'actions-document-new',
|
||||
'callbackAction' => 'createFile'
|
||||
],
|
||||
'divider' => [
|
||||
'type' => 'divider'
|
||||
],
|
||||
'pasteInto' => [
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.pasteinto',
|
||||
'iconIdentifier' => 'actions-document-paste-into',
|
||||
'callbackAction' => 'pasteFileInto'
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function canHandle(): bool
|
||||
{
|
||||
return $this->table === 'sys_filemounts';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,774 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\Controller;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Clipboard\Clipboard;
|
||||
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
|
||||
use TYPO3\CMS\Backend\Template\DocumentTemplate;
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Backend\View\BackendTemplateView;
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait;
|
||||
use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||
use TYPO3\CMS\Core\Localization\LanguageService;
|
||||
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
||||
use TYPO3\CMS\Core\Resource\DuplicationBehavior;
|
||||
use TYPO3\CMS\Core\Resource\Exception;
|
||||
use TYPO3\CMS\Core\Resource\Folder;
|
||||
use TYPO3\CMS\Core\Resource\ResourceFactory;
|
||||
use TYPO3\CMS\Core\Resource\Search\FileSearchDemand;
|
||||
use TYPO3\CMS\Core\Resource\Utility\ListUtility;
|
||||
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
|
||||
use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
use TYPO3\CMS\Filelist\Configuration\ThumbnailConfiguration;
|
||||
use TYPO3\CMS\Filelist\FileList;
|
||||
|
||||
/**
|
||||
* Script Class for creating the list of files in the File > Filelist module
|
||||
* @internal this is a concrete TYPO3 controller implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FileListController extends ActionController
|
||||
{
|
||||
use PublicPropertyDeprecationTrait;
|
||||
use PublicMethodDeprecationTrait;
|
||||
|
||||
private $deprecatedPublicProperties = [
|
||||
'MOD_MENU' => 'Using FileListController::$MOD_MENU is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'MOD_SETTINGS' => 'Using FileListController::$MOD_SETTINGS is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'doc' => 'Using FileListController::$doc is deprecated, property will be removed in TYPO3 v10.0.',
|
||||
'id' => 'Using FileListController::$id is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'pointer' => 'Using FileListController::$pointer is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'table' => 'Using FileListController::$table is deprecated, , property will be removed in TYPO3 v10.0.',
|
||||
'imagemode' => 'Using FileListController::$imagemode is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'cmd' => 'Using FileListController::$cmd is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'filelist' => 'Using FileListController::$filelist is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $deprecatedPublicMethods = [
|
||||
'menuConfig' => 'Using FileListController::menuConfig() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'initializeView' => 'Using FileListController::initializeView() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'initializeIndexAction' => 'Using FileListController::initializeIndexAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'indexAction' => 'Using FileListController::indexAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'missingFolderAction' => 'Using FileListController::missingFolderAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
'searchAction' => 'Using FileListController::searchAction() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $MOD_MENU = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $MOD_SETTINGS = [];
|
||||
|
||||
/**
|
||||
* Document template object
|
||||
*
|
||||
* @var DocumentTemplate
|
||||
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
|
||||
*/
|
||||
protected $doc;
|
||||
|
||||
/**
|
||||
* "id" -> the path to list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var Folder
|
||||
*/
|
||||
protected $folderObject;
|
||||
|
||||
/**
|
||||
* @var FlashMessage
|
||||
*/
|
||||
protected $errorMessage;
|
||||
|
||||
/**
|
||||
* Pointer to listing
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $pointer;
|
||||
|
||||
/**
|
||||
* "Table"
|
||||
* @var string
|
||||
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
/**
|
||||
* Thumbnail mode.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $imagemode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $cmd;
|
||||
|
||||
/**
|
||||
* Defines behaviour when uploading files with names that already exist; possible values are
|
||||
* the values of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
|
||||
*
|
||||
* @var \TYPO3\CMS\Core\Resource\DuplicationBehavior
|
||||
*/
|
||||
protected $overwriteExistingFiles;
|
||||
|
||||
/**
|
||||
* The filelist object
|
||||
*
|
||||
* @var FileList
|
||||
*/
|
||||
protected $filelist;
|
||||
|
||||
/**
|
||||
* The name of the module
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleName = 'file_list';
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Core\Resource\FileRepository
|
||||
*/
|
||||
protected $fileRepository;
|
||||
|
||||
/**
|
||||
* @var BackendTemplateView
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
/**
|
||||
* BackendTemplateView Container
|
||||
*
|
||||
* @var BackendTemplateView
|
||||
*/
|
||||
protected $defaultViewObjectName = BackendTemplateView::class;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Core\Resource\FileRepository $fileRepository
|
||||
*/
|
||||
public function injectFileRepository(\TYPO3\CMS\Core\Resource\FileRepository $fileRepository)
|
||||
{
|
||||
$this->fileRepository = $fileRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize variables, file object
|
||||
* Incoming GET vars include id, pointer, table, imagemode
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function initializeObject()
|
||||
{
|
||||
$this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
|
||||
$this->getLanguageService()->includeLLFile('EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf');
|
||||
$this->getLanguageService()->includeLLFile('EXT:core/Resources/Private/Language/locallang_misc.xlf');
|
||||
|
||||
// Setting GPvars:
|
||||
$this->id = ($combinedIdentifier = GeneralUtility::_GP('id'));
|
||||
$this->pointer = GeneralUtility::_GP('pointer');
|
||||
$this->table = GeneralUtility::_GP('table');
|
||||
$this->imagemode = GeneralUtility::_GP('imagemode');
|
||||
$this->cmd = GeneralUtility::_GP('cmd');
|
||||
$this->overwriteExistingFiles = DuplicationBehavior::cast(GeneralUtility::_GP('overwriteExistingFiles'));
|
||||
|
||||
try {
|
||||
if ($combinedIdentifier) {
|
||||
$this->getBackendUser()->evaluateUserSpecificFileFilterSettings();
|
||||
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
|
||||
$storage = $resourceFactory->getStorageObjectFromCombinedIdentifier($combinedIdentifier);
|
||||
$identifier = substr($combinedIdentifier, strpos($combinedIdentifier, ':') + 1);
|
||||
if (!$storage->hasFolder($identifier)) {
|
||||
$identifier = $storage->getFolderIdentifierFromFileIdentifier($identifier);
|
||||
}
|
||||
|
||||
$this->folderObject = $resourceFactory->getFolderObjectFromCombinedIdentifier($storage->getUid() . ':' . $identifier);
|
||||
// Disallow access to fallback storage 0
|
||||
if ($storage->getUid() === 0) {
|
||||
throw new Exception\InsufficientFolderAccessPermissionsException(
|
||||
'You are not allowed to access files outside your storages',
|
||||
1434539815
|
||||
);
|
||||
}
|
||||
// Disallow the rendering of the processing folder (e.g. could be called manually)
|
||||
if ($this->folderObject && $storage->isProcessingFolder($this->folderObject)) {
|
||||
$this->folderObject = $storage->getRootLevelFolder();
|
||||
}
|
||||
} else {
|
||||
// Take the first object of the first storage
|
||||
$fileStorages = $this->getBackendUser()->getFileStorages();
|
||||
$fileStorage = reset($fileStorages);
|
||||
if ($fileStorage) {
|
||||
$this->folderObject = $fileStorage->getRootLevelFolder();
|
||||
} else {
|
||||
throw new \RuntimeException('Could not find any folder to be displayed.', 1349276894);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->folderObject && !$this->folderObject->getStorage()->isWithinFileMountBoundaries($this->folderObject)) {
|
||||
throw new \RuntimeException('Folder not accessible.', 1430409089);
|
||||
}
|
||||
} catch (Exception\InsufficientFolderAccessPermissionsException $permissionException) {
|
||||
$this->folderObject = null;
|
||||
$this->errorMessage = GeneralUtility::makeInstance(
|
||||
FlashMessage::class,
|
||||
sprintf(
|
||||
$this->getLanguageService()->getLL('missingFolderPermissionsMessage'),
|
||||
$this->id
|
||||
),
|
||||
$this->getLanguageService()->getLL('missingFolderPermissionsTitle'),
|
||||
FlashMessage::NOTICE
|
||||
);
|
||||
} catch (Exception $fileException) {
|
||||
// Set folder object to null and throw a message later on
|
||||
$this->folderObject = null;
|
||||
// Take the first object of the first storage
|
||||
$fileStorages = $this->getBackendUser()->getFileStorages();
|
||||
$fileStorage = reset($fileStorages);
|
||||
if ($fileStorage instanceof \TYPO3\CMS\Core\Resource\ResourceStorage) {
|
||||
$this->folderObject = $fileStorage->getRootLevelFolder();
|
||||
if (!$fileStorage->isWithinFileMountBoundaries($this->folderObject)) {
|
||||
$this->folderObject = null;
|
||||
}
|
||||
}
|
||||
$this->errorMessage = GeneralUtility::makeInstance(
|
||||
FlashMessage::class,
|
||||
sprintf(
|
||||
$this->getLanguageService()->getLL('folderNotFoundMessage'),
|
||||
$this->id
|
||||
),
|
||||
$this->getLanguageService()->getLL('folderNotFoundTitle'),
|
||||
FlashMessage::NOTICE
|
||||
);
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->folderObject = null;
|
||||
$this->errorMessage = GeneralUtility::makeInstance(
|
||||
FlashMessage::class,
|
||||
$e->getMessage() . ' (' . $e->getCode() . ')',
|
||||
$this->getLanguageService()->getLL('folderNotFoundTitle'),
|
||||
FlashMessage::NOTICE
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->folderObject && !$this->folderObject->getStorage()->checkFolderActionPermission(
|
||||
'read',
|
||||
$this->folderObject
|
||||
)
|
||||
) {
|
||||
$this->folderObject = null;
|
||||
}
|
||||
|
||||
// Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
|
||||
$this->menuConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the menu/session variables
|
||||
*/
|
||||
protected function menuConfig()
|
||||
{
|
||||
// MENU-ITEMS:
|
||||
// If array, then it's a selector box menu
|
||||
// If empty string it's just a variable, that will be saved.
|
||||
// Values NOT in this array will not be saved in the settings-array for the module.
|
||||
$this->MOD_MENU = [
|
||||
'sort' => '',
|
||||
'reverse' => '',
|
||||
'displayThumbs' => '',
|
||||
'clipBoard' => '',
|
||||
'bigControlPanel' => ''
|
||||
];
|
||||
// CLEANSE SETTINGS
|
||||
$this->MOD_SETTINGS = BackendUtility::getModuleData(
|
||||
$this->MOD_MENU,
|
||||
GeneralUtility::_GP('SET'),
|
||||
$this->moduleName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the view
|
||||
*
|
||||
* @param ViewInterface $view The view
|
||||
*/
|
||||
protected function initializeView(ViewInterface $view)
|
||||
{
|
||||
/** @var BackendTemplateView $view */
|
||||
parent::initializeView($view);
|
||||
$pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileListLocalisation');
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileSearch');
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ContextMenu');
|
||||
$this->registerDocHeaderButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
protected function initializeIndexAction()
|
||||
{
|
||||
// Apply predefined values for hidden checkboxes
|
||||
// Set predefined value for DisplayBigControlPanel:
|
||||
$backendUser = $this->getBackendUser();
|
||||
$userTsConfig = $backendUser->getTSConfig();
|
||||
if (($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'activated') {
|
||||
$this->MOD_SETTINGS['bigControlPanel'] = true;
|
||||
} elseif (($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'deactivated') {
|
||||
$this->MOD_SETTINGS['bigControlPanel'] = false;
|
||||
}
|
||||
// Set predefined value for DisplayThumbnails:
|
||||
if (($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'activated') {
|
||||
$this->MOD_SETTINGS['displayThumbs'] = true;
|
||||
} elseif (($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'deactivated') {
|
||||
$this->MOD_SETTINGS['displayThumbs'] = false;
|
||||
}
|
||||
// Set predefined value for Clipboard:
|
||||
if (($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'activated') {
|
||||
$this->MOD_SETTINGS['clipBoard'] = true;
|
||||
} elseif (($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'deactivated') {
|
||||
$this->MOD_SETTINGS['clipBoard'] = false;
|
||||
}
|
||||
// If user never opened the list module, set the value for displayThumbs
|
||||
if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
|
||||
$this->MOD_SETTINGS['displayThumbs'] = $backendUser->uc['thumbnailsByDefault'];
|
||||
}
|
||||
if (!isset($this->MOD_SETTINGS['sort'])) {
|
||||
// Set default sorting
|
||||
$this->MOD_SETTINGS['sort'] = 'file';
|
||||
$this->MOD_SETTINGS['reverse'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
protected function indexAction()
|
||||
{
|
||||
$pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
|
||||
$pageRenderer->setTitle($this->getLanguageService()->getLL('files'));
|
||||
|
||||
// There there was access to this file path, continue, make the list
|
||||
if ($this->folderObject) {
|
||||
$userTsConfig = $this->getBackendUser()->getTSConfig();
|
||||
// @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0. Argument $this will be removed in TYPO3 v10.0.
|
||||
$this->filelist = GeneralUtility::makeInstance(FileList::class, $this);
|
||||
$this->filelist->thumbs = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && $this->MOD_SETTINGS['displayThumbs'];
|
||||
// Create clipboard object and initialize that
|
||||
$this->filelist->clipObj = GeneralUtility::makeInstance(Clipboard::class);
|
||||
$this->filelist->clipObj->fileMode = true;
|
||||
$this->filelist->clipObj->initializeClipboard();
|
||||
$CB = GeneralUtility::_GET('CB');
|
||||
if ($this->cmd === 'setCB') {
|
||||
$CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(
|
||||
GeneralUtility::_POST('CBH'),
|
||||
(array)GeneralUtility::_POST('CBC')
|
||||
), '_FILE');
|
||||
}
|
||||
if (!$this->MOD_SETTINGS['clipBoard']) {
|
||||
$CB['setP'] = 'normal';
|
||||
}
|
||||
$this->filelist->clipObj->setCmd($CB);
|
||||
$this->filelist->clipObj->cleanCurrent();
|
||||
// Saves
|
||||
$this->filelist->clipObj->endClipboard();
|
||||
// If the "cmd" was to delete files from the list (clipboard thing), do that:
|
||||
if ($this->cmd === 'delete') {
|
||||
$items = $this->filelist->clipObj->cleanUpCBC(GeneralUtility::_POST('CBC'), '_FILE', 1);
|
||||
if (!empty($items)) {
|
||||
// Make command array:
|
||||
$FILE = [];
|
||||
foreach ($items as $clipboardIdentifier => $combinedIdentifier) {
|
||||
$FILE['delete'][] = ['data' => $combinedIdentifier];
|
||||
$this->filelist->clipObj->removeElement($clipboardIdentifier);
|
||||
}
|
||||
// Init file processing object for deleting and pass the cmd array.
|
||||
/** @var ExtendedFileUtility $fileProcessor */
|
||||
$fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
|
||||
$fileProcessor->setActionPermissions();
|
||||
$fileProcessor->setExistingFilesConflictMode($this->overwriteExistingFiles);
|
||||
$fileProcessor->start($FILE);
|
||||
$fileProcessor->processData();
|
||||
// Clean & Save clipboard state
|
||||
$this->filelist->clipObj->cleanCurrent();
|
||||
$this->filelist->clipObj->endClipboard();
|
||||
}
|
||||
}
|
||||
// Start up filelisting object, include settings.
|
||||
$this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
|
||||
$this->filelist->start(
|
||||
$this->folderObject,
|
||||
$this->pointer,
|
||||
$this->MOD_SETTINGS['sort'],
|
||||
$this->MOD_SETTINGS['reverse'],
|
||||
$this->MOD_SETTINGS['clipBoard'],
|
||||
$this->MOD_SETTINGS['bigControlPanel']
|
||||
);
|
||||
// Generate the list
|
||||
$this->filelist->generateList();
|
||||
// Set top JavaScript:
|
||||
$this->view->getModuleTemplate()->addJavaScriptCode(
|
||||
'FileListIndex',
|
||||
'if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions() . '
|
||||
function jumpToUrl(URL) {
|
||||
window.location.href = URL;
|
||||
return false;
|
||||
}
|
||||
'
|
||||
);
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete');
|
||||
$pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons');
|
||||
|
||||
// Include DragUploader only if we have write access
|
||||
if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')
|
||||
&& $this->folderObject->checkActionPermission('write')
|
||||
) {
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/DragUploader');
|
||||
$pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_upload');
|
||||
$pageRenderer->addInlineLanguageLabelArray([
|
||||
'permissions.read' => $this->getLanguageService()->getLL('read'),
|
||||
'permissions.write' => $this->getLanguageService()->getLL('write'),
|
||||
]);
|
||||
}
|
||||
|
||||
// Setting up the buttons
|
||||
$this->registerButtons();
|
||||
|
||||
$pageRecord = [
|
||||
'_additional_info' => $this->filelist->getFolderInfo(),
|
||||
'combined_identifier' => $this->folderObject->getCombinedIdentifier(),
|
||||
];
|
||||
$this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
|
||||
|
||||
$this->view->assign('headline', $this->getModuleHeadline());
|
||||
$this->view->assign('listHtml', $this->filelist->HTMLcode);
|
||||
|
||||
$this->view->assign('checkboxes', [
|
||||
'bigControlPanel' => [
|
||||
'enabled' => ($userTsConfig['options.']['file_list.']['enableDisplayBigControlPanel'] ?? '') === 'selectable',
|
||||
'label' => htmlspecialchars($this->getLanguageService()->getLL('bigControlPanel')),
|
||||
'html' => BackendUtility::getFuncCheck(
|
||||
$this->id,
|
||||
'SET[bigControlPanel]',
|
||||
$this->MOD_SETTINGS['bigControlPanel'] ?? '',
|
||||
'',
|
||||
'',
|
||||
'id="bigControlPanel"'
|
||||
),
|
||||
],
|
||||
'displayThumbs' => [
|
||||
'enabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'] && ($userTsConfig['options.']['file_list.']['enableDisplayThumbnails'] ?? '') === 'selectable',
|
||||
'label' => htmlspecialchars($this->getLanguageService()->getLL('displayThumbs')),
|
||||
'html' => BackendUtility::getFuncCheck(
|
||||
$this->id,
|
||||
'SET[displayThumbs]',
|
||||
$this->MOD_SETTINGS['displayThumbs'] ?? '',
|
||||
'',
|
||||
'',
|
||||
'id="checkDisplayThumbs"'
|
||||
),
|
||||
],
|
||||
'enableClipBoard' => [
|
||||
'enabled' => ($userTsConfig['options.']['file_list.']['enableClipBoard'] ?? '') === 'selectable',
|
||||
'label' => htmlspecialchars($this->getLanguageService()->getLL('clipBoard')),
|
||||
'html' => BackendUtility::getFuncCheck(
|
||||
$this->id,
|
||||
'SET[clipBoard]',
|
||||
$this->MOD_SETTINGS['clipBoard'] ?? '',
|
||||
'',
|
||||
'',
|
||||
'id="checkClipBoard"'
|
||||
),
|
||||
]
|
||||
]);
|
||||
$this->view->assign('showClipBoard', (bool)$this->MOD_SETTINGS['clipBoard']);
|
||||
$this->view->assign('clipBoardHtml', $this->filelist->clipObj->printClipboard());
|
||||
$this->view->assign('folderIdentifier', $this->folderObject->getCombinedIdentifier());
|
||||
$this->view->assign('fileDenyPattern', $GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern']);
|
||||
$this->view->assign('maxFileSize', GeneralUtility::getMaxUploadFileSize() * 1024);
|
||||
} else {
|
||||
$this->forward('missingFolder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
protected function missingFolderAction()
|
||||
{
|
||||
if ($this->errorMessage) {
|
||||
$this->errorMessage->setSeverity(FlashMessage::ERROR);
|
||||
$this->controllerContext->getFlashMessageQueue('core.template.flashMessages')->addMessage($this->errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for files by name and pass them with a facade to fluid
|
||||
*
|
||||
* @param string $searchWord
|
||||
*/
|
||||
protected function searchAction($searchWord = '')
|
||||
{
|
||||
if (empty($searchWord)) {
|
||||
$this->forward('index');
|
||||
}
|
||||
$searchDemand = FileSearchDemand::createForSearchTerm($searchWord)->withRecursive();
|
||||
$files = $this->folderObject->searchFiles($searchDemand);
|
||||
|
||||
$fileFacades = [];
|
||||
if (count($files) === 0) {
|
||||
$this->controllerContext->getFlashMessageQueue('core.template.flashMessages')->addMessage(
|
||||
new FlashMessage(
|
||||
LocalizationUtility::translate('flashmessage.no_results', 'filelist'),
|
||||
'',
|
||||
FlashMessage::INFO
|
||||
)
|
||||
);
|
||||
} else {
|
||||
foreach ($files as $file) {
|
||||
$fileFacades[] = new \TYPO3\CMS\Filelist\FileFacade($file);
|
||||
}
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
|
||||
$pageRenderer = $this->view->getModuleTemplate()->getPageRenderer();
|
||||
$pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('show_item'));
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileList');
|
||||
|
||||
$thumbnailConfiguration = GeneralUtility::makeInstance(ThumbnailConfiguration::class);
|
||||
$this->view->assign('thumbnail', [
|
||||
'width' => $thumbnailConfiguration->getWidth(),
|
||||
'height' => $thumbnailConfiguration->getHeight(),
|
||||
]);
|
||||
|
||||
$this->view->assign('searchWord', $searchWord);
|
||||
$this->view->assign('files', $fileFacades);
|
||||
$this->view->assign('deleteUrl', (string)$uriBuilder->buildUriFromRoute('tce_file'));
|
||||
$this->view->assign('settings', [
|
||||
'jsConfirmationDelete' => $this->getBackendUser()->jsConfirmation(JsConfirmation::DELETE)
|
||||
]);
|
||||
|
||||
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Filelist/FileDelete');
|
||||
$pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get main headline based on active folder or storage for backend module
|
||||
* Folder names are resolved to their special names like done in the tree view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getModuleHeadline()
|
||||
{
|
||||
$name = $this->folderObject->getName();
|
||||
if ($name === '') {
|
||||
// Show storage name on storage root
|
||||
if ($this->folderObject->getIdentifier() === '/') {
|
||||
$name = $this->folderObject->getStorage()->getName();
|
||||
}
|
||||
} else {
|
||||
$name = key(ListUtility::resolveSpecialFolderNames(
|
||||
[$name => $this->folderObject]
|
||||
));
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the Icons into the docheader
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function registerDocHeaderButtons()
|
||||
{
|
||||
/** @var ButtonBar $buttonBar */
|
||||
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
|
||||
|
||||
// CSH
|
||||
$cshButton = $buttonBar->makeHelpButton()
|
||||
->setModuleName('xMOD_csh_corebe')
|
||||
->setFieldName('filelist_module');
|
||||
$buttonBar->addButton($cshButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the panel of buttons for submitting the form or otherwise perform operations.
|
||||
*/
|
||||
protected function registerButtons()
|
||||
{
|
||||
/** @var ButtonBar $buttonBar */
|
||||
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
|
||||
|
||||
/** @var IconFactory $iconFactory */
|
||||
$iconFactory = $this->view->getModuleTemplate()->getIconFactory();
|
||||
|
||||
$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
|
||||
|
||||
$lang = $this->getLanguageService();
|
||||
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
|
||||
// Refresh page
|
||||
$refreshLink = GeneralUtility::linkThisScript(
|
||||
[
|
||||
'target' => rawurlencode($this->folderObject->getCombinedIdentifier()),
|
||||
'imagemode' => $this->filelist->thumbs
|
||||
]
|
||||
);
|
||||
$refreshButton = $buttonBar->makeLinkButton()
|
||||
->setHref($refreshLink)
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload'))
|
||||
->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
|
||||
$buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT);
|
||||
|
||||
// Level up
|
||||
try {
|
||||
$currentStorage = $this->folderObject->getStorage();
|
||||
$parentFolder = $this->folderObject->getParentFolder();
|
||||
if ($parentFolder->getIdentifier() !== $this->folderObject->getIdentifier()
|
||||
&& $currentStorage->isWithinFileMountBoundaries($parentFolder)
|
||||
) {
|
||||
$levelUpClick = 'top.document.getElementsByName("nav_frame")[0].contentWindow.Tree.highlightActiveItem("file","folder'
|
||||
. GeneralUtility::md5int($parentFolder->getCombinedIdentifier()) . '_"+top.fsMod.currentBank)';
|
||||
$levelUpButton = $buttonBar->makeLinkButton()
|
||||
->setHref((string)$uriBuilder->buildUriFromRoute('file_FilelistList', ['id' => $parentFolder->getCombinedIdentifier()]))
|
||||
->setOnClick($levelUpClick)
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.upOneLevel'))
|
||||
->setIcon($iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL));
|
||||
$buttonBar->addButton($levelUpButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
// Shortcut
|
||||
if ($this->getBackendUser()->mayMakeShortcut()) {
|
||||
$shortCutButton = $buttonBar->makeShortcutButton()->setModuleName('file_FilelistList');
|
||||
$buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
|
||||
}
|
||||
|
||||
// Upload button (only if upload to this directory is allowed)
|
||||
if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission(
|
||||
'add',
|
||||
'File'
|
||||
) && $this->folderObject->checkActionPermission('write')
|
||||
) {
|
||||
$uploadButton = $buttonBar->makeLinkButton()
|
||||
->setHref((string)$uriBuilder->buildUriFromRoute(
|
||||
'file_upload',
|
||||
[
|
||||
'target' => $this->folderObject->getCombinedIdentifier(),
|
||||
'returnUrl' => $this->filelist->listURL(),
|
||||
]
|
||||
))
|
||||
->setClasses('t3js-drag-uploader-trigger')
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.upload'))
|
||||
->setIcon($iconFactory->getIcon('actions-edit-upload', Icon::SIZE_SMALL));
|
||||
$buttonBar->addButton($uploadButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
|
||||
}
|
||||
|
||||
// New folder button
|
||||
if ($this->folderObject && $this->folderObject->checkActionPermission('write')
|
||||
&& ($this->folderObject->getStorage()->checkUserActionPermission(
|
||||
'add',
|
||||
'File'
|
||||
) || $this->folderObject->checkActionPermission('add'))
|
||||
) {
|
||||
$newButton = $buttonBar->makeLinkButton()
|
||||
->setHref((string)$uriBuilder->buildUriFromRoute(
|
||||
'file_newfolder',
|
||||
[
|
||||
'target' => $this->folderObject->getCombinedIdentifier(),
|
||||
'returnUrl' => $this->filelist->listURL(),
|
||||
]
|
||||
))
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.new'))
|
||||
->setIcon($iconFactory->getIcon('actions-add', Icon::SIZE_SMALL));
|
||||
$buttonBar->addButton($newButton, ButtonBar::BUTTON_POSITION_LEFT, 1);
|
||||
}
|
||||
|
||||
// Add paste button if clipboard is initialized
|
||||
if ($this->filelist->clipObj instanceof Clipboard && $this->folderObject->checkActionPermission('write')) {
|
||||
$elFromTable = $this->filelist->clipObj->elFromTable('_FILE');
|
||||
if (!empty($elFromTable)) {
|
||||
$addPasteButton = true;
|
||||
$elToConfirm = [];
|
||||
foreach ($elFromTable as $key => $element) {
|
||||
$clipBoardElement = $resourceFactory->retrieveFileOrFolderObject($element);
|
||||
if ($clipBoardElement instanceof Folder && $clipBoardElement->getStorage()->isWithinFolder(
|
||||
$clipBoardElement,
|
||||
$this->folderObject
|
||||
)
|
||||
) {
|
||||
$addPasteButton = false;
|
||||
}
|
||||
$elToConfirm[$key] = $clipBoardElement->getName();
|
||||
}
|
||||
if ($addPasteButton) {
|
||||
$confirmText = $this->filelist->clipObj
|
||||
->confirmMsgText('_FILE', $this->folderObject->getReadablePath(), 'into', $elToConfirm);
|
||||
$pasteButton = $buttonBar->makeLinkButton()
|
||||
->setHref($this->filelist->clipObj
|
||||
->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier()))
|
||||
->setClasses('t3js-modal-trigger')
|
||||
->setDataAttributes([
|
||||
'severity' => 'warning',
|
||||
'content' => $confirmText,
|
||||
'title' => $lang->getLL('clip_paste')
|
||||
])
|
||||
->setTitle($lang->getLL('clip_paste'))
|
||||
->setIcon($iconFactory->getIcon('actions-document-paste-into', Icon::SIZE_SMALL));
|
||||
$buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of LanguageService
|
||||
*
|
||||
* @return LanguageService
|
||||
*/
|
||||
protected function getLanguageService(): LanguageService
|
||||
{
|
||||
return $GLOBALS['LANG'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current BE user.
|
||||
*
|
||||
* @return BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUser(): BackendUserAuthentication
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Clipboard\Clipboard;
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||
use TYPO3\CMS\Core\Localization\LanguageService;
|
||||
use TYPO3\CMS\Core\Resource\FileInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Class FileFacade
|
||||
*
|
||||
* This class is meant to be a wrapper for Resource\File objects, which do not
|
||||
* provide necessary methods needed in the views of the filelist extension. It
|
||||
* is a first approach to get rid of the FileList class that mixes up PHP,
|
||||
* HTML and JavaScript.
|
||||
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FileFacade
|
||||
{
|
||||
/**
|
||||
* Cache to count the number of references for each file
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $referenceCounts = [];
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Core\Resource\FileInterface
|
||||
*/
|
||||
protected $resource;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Core\Imaging\IconFactory
|
||||
*/
|
||||
protected $iconFactory;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Core\Resource\FileInterface $resource
|
||||
* @internal Do not use outside of EXT:filelist!
|
||||
*/
|
||||
public function __construct(FileInterface $resource)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0.
|
||||
*/
|
||||
public function getIcon(): string
|
||||
{
|
||||
trigger_error('FileFacade->getIcon() will be removed in TYPO3 v10.0, use ViewHelper <core:iconForResource /> instead.', E_USER_DEPRECATED);
|
||||
$title = htmlspecialchars($this->resource->getName() . ' [' . (int)$this->resource->getProperty('uid') . ']');
|
||||
return '<span title="' . $title . '">' . $this->iconFactory->getIconForResource($this->resource, Icon::SIZE_SMALL) . '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Resource\FileInterface
|
||||
*/
|
||||
public function getResource(): FileInterface
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsEditable(): bool
|
||||
{
|
||||
return $this->getIsWritable()
|
||||
&& GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $this->resource->getExtension());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsMetadataEditable(): bool
|
||||
{
|
||||
return $this->resource->isIndexed() && $this->getIsWritable() && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMetadataUid(): int
|
||||
{
|
||||
$uid = 0;
|
||||
$method = '_getMetadata';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
$metadata = call_user_func([$this->resource, $method]);
|
||||
|
||||
if (isset($metadata['uid'])) {
|
||||
$uid = (int)$metadata['uid'];
|
||||
}
|
||||
}
|
||||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->resource->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath(): string
|
||||
{
|
||||
$method = 'getReadablePath';
|
||||
if (is_callable([$this->resource->getParentFolder(), $method])) {
|
||||
return call_user_func([$this->resource->getParentFolder(), $method]);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPublicUrl()
|
||||
{
|
||||
return $this->resource->getPublicUrl(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension(): string
|
||||
{
|
||||
return strtoupper($this->resource->getExtension());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifier(): string
|
||||
{
|
||||
return $this->resource->getStorage()->getUid() . ':' . $this->resource->getIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastModified(): string
|
||||
{
|
||||
return BackendUtility::date($this->resource->getModificationTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSize(): string
|
||||
{
|
||||
return GeneralUtility::formatSize($this->resource->getSize(), htmlspecialchars($this->getLanguageService()->getLL('byteSizeUnits')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsReadable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['read']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsWritable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['write']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsReplaceable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['replace']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsRenamable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['rename']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCopyable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['copy']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCuttable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['move']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsDeletable()
|
||||
{
|
||||
$method = 'checkActionPermission';
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], ['delete']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isSelected()
|
||||
{
|
||||
$fullIdentifier = $this->getIdentifier();
|
||||
$md5 = GeneralUtility::shortMD5($fullIdentifier);
|
||||
|
||||
/** @var Clipboard $clipboard */
|
||||
$clipboard = GeneralUtility::makeInstance(Clipboard::class);
|
||||
$clipboard->initializeClipboard();
|
||||
|
||||
$isSel = $clipboard->isSelected('_FILE', $md5);
|
||||
|
||||
if ($isSel) {
|
||||
return $isSel;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsImage()
|
||||
{
|
||||
return GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], strtolower($this->getExtension()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch, cache and return the number of references of a file
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getReferenceCount(): int
|
||||
{
|
||||
$uid = (int)$this->resource->getProperty('uid');
|
||||
|
||||
if ($uid <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!isset(static::$referenceCounts[$uid])) {
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex');
|
||||
$count = $queryBuilder->count('*')
|
||||
->from('sys_refindex')
|
||||
->where(
|
||||
$queryBuilder->expr()->eq('deleted', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)),
|
||||
$queryBuilder->expr()->eq(
|
||||
'ref_table',
|
||||
$queryBuilder->createNamedParameter('sys_file', \PDO::PARAM_STR)
|
||||
),
|
||||
$queryBuilder->expr()->eq(
|
||||
'ref_uid',
|
||||
$queryBuilder->createNamedParameter($this->resource->getProperty('uid'), \PDO::PARAM_INT)
|
||||
),
|
||||
$queryBuilder->expr()->neq(
|
||||
'tablename',
|
||||
$queryBuilder->createNamedParameter('sys_file_metadata', \PDO::PARAM_STR)
|
||||
)
|
||||
)
|
||||
->execute()
|
||||
->fetchColumn();
|
||||
|
||||
static::$referenceCounts[$uid] = $count;
|
||||
}
|
||||
|
||||
return static::$referenceCounts[$uid];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
* @param array $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (is_callable([$this->resource, $method])) {
|
||||
return call_user_func_array([$this->resource, $method], $arguments);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUser(): BackendUserAuthentication
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Localization\LanguageService
|
||||
*/
|
||||
protected function getLanguageService(): LanguageService
|
||||
{
|
||||
return $GLOBALS['LANG'];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for classes which hook into filelist module and manipulated edit icon array
|
||||
*/
|
||||
interface FileListEditIconHookInterface
|
||||
{
|
||||
/**
|
||||
* Modifies edit icon array
|
||||
*
|
||||
* @param array $cells Array of edit icons
|
||||
* @param \TYPO3\CMS\Filelist\FileList $parentObject Parent object
|
||||
*/
|
||||
public function manipulateEditIcons(&$cells, &$parentObject);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class for drag and drop and ajax functionality
|
||||
* @see class \TYPO3\CMS\Backend\Tree\View\BrowseTreeView
|
||||
* @internal this is a concrete TYPO3 tree implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class FileListFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $ext_IconMode;
|
||||
|
||||
/**
|
||||
* Wrapping icon in browse tree
|
||||
*
|
||||
* @param string $theFolderIcon Icon IMG code
|
||||
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folder object
|
||||
* @return string folder icon
|
||||
*/
|
||||
public function wrapIcon($theFolderIcon, $folderObject)
|
||||
{
|
||||
$theFolderIcon = parent::wrapIcon($theFolderIcon, $folderObject);
|
||||
// Wrap icon in a drag/drop span.
|
||||
return '<span class="list-tree-icon dragIcon" id="dragIconID_' . $this->getJumpToParam($folderObject) . '">' . $theFolderIcon . '</span> ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapping $title in a-tags.
|
||||
*
|
||||
* @param string $title Title string
|
||||
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject Folder to work on
|
||||
* @param int $bank Bank pointer (which mount point number)
|
||||
* @return string
|
||||
* @internal
|
||||
*/
|
||||
public function wrapTitle($title, $folderObject, $bank = 0)
|
||||
{
|
||||
$theFolderTitle = parent::wrapTitle($title, $folderObject, $bank);
|
||||
// Wrap title in a drag/drop span.
|
||||
return '<span class="list-tree-title dragTitle" id="dragTitleID_' . $this->getJumpToParam($folderObject) . '">' . $theFolderTitle . '</span>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\Hook;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Controller\BackendController;
|
||||
use TYPO3\CMS\Core\Page\PageRenderer;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* This class adds Filelist related JavaScript to the backend
|
||||
* @internal this is a concrete TYPO3 hook implementation and solely used for EXT:filelist and not part of TYPO3's Core API.
|
||||
*/
|
||||
class BackendControllerHook
|
||||
{
|
||||
/**
|
||||
* Adds Filelist JavaScript used e.g. by context menu
|
||||
*
|
||||
* @param array $configuration
|
||||
* @param BackendController $backendController
|
||||
*/
|
||||
public function addJavaScript(array $configuration, BackendController $backendController)
|
||||
{
|
||||
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
|
||||
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
$pageRenderer->addInlineSetting('FileRename', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('file_rename'));
|
||||
$pageRenderer->addInlineSetting('FileEdit', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('file_edit'));
|
||||
$pageRenderer->addInlineSetting('FileUpload', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('file_upload'));
|
||||
$pageRenderer->addInlineSetting('FileCreate', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('file_newfolder'));
|
||||
$pageRenderer->addInlineSetting('FileCommit', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('tce_file'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use Closure;
|
||||
use TYPO3\CMS\Backend\Clipboard\Clipboard;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Class EditFileContentViewHelper
|
||||
*/
|
||||
class CopyCutFileViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('file', \TYPO3\CMS\Core\Resource\AbstractFile::class, '', true);
|
||||
$this->registerArgument('copyOrCut', 'string', '', false, 'copy');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a link to copy a file
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
if ($arguments['copyOrCut'] !== 'cut' && $arguments['copyOrCut'] !== 'copy') {
|
||||
throw new \InvalidArgumentException('Argument "copyOrCut" must be either "copy" or "cut"', 1540548015);
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
|
||||
$file = $arguments['file'];
|
||||
|
||||
/** @var Clipboard $clipboard */
|
||||
$clipboard = GeneralUtility::makeInstance(Clipboard::class);
|
||||
$clipboard->initializeClipboard();
|
||||
|
||||
$fullIdentifier = $file->getCombinedIdentifier();
|
||||
$md5 = GeneralUtility::shortMD5($fullIdentifier);
|
||||
$isSel = $clipboard->isSelected('_FILE', $md5);
|
||||
|
||||
if ($arguments['copyOrCut'] === 'copy') {
|
||||
return $clipboard->selUrlFile($fullIdentifier, true, $isSel === 'copy');
|
||||
}
|
||||
return $clipboard->selUrlFile($fullIdentifier, false, $isSel === 'cut');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use Closure;
|
||||
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class DeleteFileViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('file', \TYPO3\CMS\Core\Resource\AbstractFile::class, '', true);
|
||||
$this->registerArgument('returnUrl', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a link to delete the file
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
if (empty($arguments['returnUrl'])) {
|
||||
$arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
|
||||
$file = $arguments['file'];
|
||||
|
||||
$params = [
|
||||
'file' => [
|
||||
'delete' => [
|
||||
0 => [
|
||||
'data' => $file->getCombinedIdentifier()
|
||||
]
|
||||
]
|
||||
],
|
||||
'redirect' => $arguments['returnUrl']
|
||||
];
|
||||
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('tce_file', $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use Closure;
|
||||
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class EditFileContentViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('file', \TYPO3\CMS\Core\Resource\AbstractFile::class, '', true);
|
||||
$this->registerArgument('returnUrl', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a link to edit the file content
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
if (empty($arguments['returnUrl'])) {
|
||||
$arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
|
||||
$file = $arguments['file'];
|
||||
|
||||
$params = [
|
||||
'target' => $file->getCombinedIdentifier(),
|
||||
'returnUrl' => $arguments['returnUrl']
|
||||
];
|
||||
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('file_edit', $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class RenameFileViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('file', \TYPO3\CMS\Core\Resource\AbstractFile::class, '', true);
|
||||
$this->registerArgument('returnUrl', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a link to rename a file
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
if (empty($arguments['returnUrl'])) {
|
||||
$arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
|
||||
$file = $arguments['file'];
|
||||
|
||||
$params = [
|
||||
'target' => $file->getCombinedIdentifier(),
|
||||
'returnUrl' => $arguments['returnUrl']
|
||||
];
|
||||
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('file_rename', $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class ReplaceFileViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initialize arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('file', \TYPO3\CMS\Core\Resource\AbstractFile::class, '', true);
|
||||
$this->registerArgument('returnUrl', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a link to replace a file
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
if (empty($arguments['returnUrl'])) {
|
||||
$arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
|
||||
}
|
||||
|
||||
/** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */
|
||||
$file = $arguments['file'];
|
||||
|
||||
$params = [
|
||||
'target' => $file->getCombinedIdentifier(),
|
||||
'uid' => $file->getUid(),
|
||||
'returnUrl' => $arguments['returnUrl']
|
||||
];
|
||||
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('file_replace', $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
Some icons used in the TYPO3 project are retrieved from the "Silk" icon set of
|
||||
Mark James, which can be found at http://famfamfam.com/lab/icons/silk/. This
|
||||
set is distributed under a Creative Commons Attribution 2.5 License. The
|
||||
license can be found at http://creativecommons.org/licenses/by/2.5/.
|
||||
---------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
|
||||
<file t3:id="1440157535" source-language="en" datatype="plaintext" original="EXT:filelist/Resources/Private/Language/locallang.xlf" date="2015-08-21T11:45:35Z" product-name="filelist">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="search" resname="search">
|
||||
<source>Search</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="flashmessage.no_results" resname="flashmessage.no_results">
|
||||
<source>No results found</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
|
||||
<file t3:id="1415814869" source-language="en" datatype="plaintext" original="EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf" date="2011-10-17T20:22:34Z" product-name="lang">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="bigControlPanel" resname="bigControlPanel">
|
||||
<source>Extended view</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clipBoard" resname="clipBoard">
|
||||
<source>Show clipboard</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_paste" resname="clip_paste">
|
||||
<source>Paste in clipboard content</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_pasteInto" resname="clip_pasteInto">
|
||||
<source>Paste into: Clipboard content is inserted into this folder</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_markRecords" resname="clip_markRecords">
|
||||
<source>Mark All/Mark none</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_selectMarked" resname="clip_selectMarked">
|
||||
<source>Transfer the selection of files to clipboard</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_deleteMarked" resname="clip_deleteMarked">
|
||||
<source>Delete marked</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="clip_deleteMarkedWarning" resname="clip_deleteMarkedWarning">
|
||||
<source>Are you sure you want to delete all marked files from this folder?</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="displayThumbs" resname="displayThumbs">
|
||||
<source>Display thumbnails</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_file" resname="c_file">
|
||||
<source>File Name</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_filepath" resname="c_filepath">
|
||||
<source>File Path</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_size" resname="c_size">
|
||||
<source>Size</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_fileext" resname="c_fileext">
|
||||
<source>Type</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_tstamp" resname="c_tstamp">
|
||||
<source>Last Modified</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c_rw" resname="c_rw">
|
||||
<source>RW</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="c__REF_" resname="c__REF_">
|
||||
<source>Ref</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="files" resname="files">
|
||||
<source>files</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="temp" resname="temp">
|
||||
<source>Temporary files</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="role_folder_temporary" resname="role_folder_temporary">
|
||||
<source>Temporary files</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="role_folder_recycler" resname="role_folder_recycler">
|
||||
<source>Recycler</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="read" resname="read">
|
||||
<source>R</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="recycler" resname="recycler">
|
||||
<source>Recycler</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_labels_tablabel" resname="mlang_labels_tablabel">
|
||||
<source>Listing of files in the directory</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_labels_tabdescr" resname="mlang_labels_tabdescr">
|
||||
<source>This is the file administration system in TYPO3. It allows you to access the file mounts of your login. Through this module you can upload, copy, move an delete files on the server.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_tabs_tab" resname="mlang_tabs_tab">
|
||||
<source>Filelist</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="write" resname="write">
|
||||
<source>W</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="paramError" resname="paramError">
|
||||
<source>Parameter Error</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="targetNoDir" resname="targetNoDir">
|
||||
<source>Target was not a directory!</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_basePath" resname="localDriverFlexform_basePath">
|
||||
<source>Base path</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_basePath_placeholder" resname="localDriverFlexform_basePath_placeholder">
|
||||
<source>Add storage path here. For example: myPath/folder/</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_pathType" resname="localDriverFlexform_pathType">
|
||||
<source>Path type</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_pathType_relative" resname="localDriverFlexform_pathType_relative">
|
||||
<source>relative</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_pathType_absolute" resname="localDriverFlexform_pathType_absolute">
|
||||
<source>absolute</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="localDriverFlexform_caseSensitive" resname="localDriverFlexform_caseSensitive">
|
||||
<source>Uses case sensitive identifiers</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="storageNotBrowsableTitle" resname="storageNotBrowsableTitle">
|
||||
<source>Access denied.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="storageNotBrowsableMessage" resname="storageNotBrowsableMessage">
|
||||
<source>You are trying to access a folder in a storage that is not browsable.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="missingFolderPermissionsTitle" resname="missingFolderPermissionsTitle">
|
||||
<source>Missing folder permissions</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="missingFolderPermissionsMessage" resname="missingFolderPermissionsMessage">
|
||||
<source>You have no access to the folder "%s".</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="folderNotFoundTitle" resname="folderNotFoundTitle">
|
||||
<source>Folder not found.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="folderNotFoundMessage" resname="folderNotFoundMessage">
|
||||
<source>The folder "%s" cannot be accessed. Trying to use parent folder(s).</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="translateMetadata" resname="translateMetadata">
|
||||
<source>Translate metadata</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="createMetadataForLanguage" resname="createMetadataForLanguage">
|
||||
<source>Create metadata of this file for %s</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="editMetadataForLanguage" resname="editMetadataForLanguage">
|
||||
<source>Edit metadata of this file for %s</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,7 @@
|
||||
<f:render section="headline" />
|
||||
<f:render section="content" />
|
||||
|
||||
<div class="t3js-drag-uploader" data-target-folder="{folderIdentifier}" data-progress-container="#typo3-filelist"
|
||||
data-dropzone-trigger=".t3js-drag-uploader-trigger" data-dropzone-target=".t3js-module-body h1:first"
|
||||
data-file-deny-pattern="{fileDenyPattern}" data-max-file-size="{maxFileSize}"
|
||||
></div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<f:form action="search" class="form-inline form-inline-spaced">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="hidden" name="cmd" class="form-control" value="search">
|
||||
<f:form.textfield type="text" name="searchWord" class="form-control" value="{searchWord}"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit"><f:translate id="search">Search</f:translate></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</f:form>
|
||||
@@ -0,0 +1,53 @@
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="headline">
|
||||
<h1>{headline}</h1>
|
||||
</f:section>
|
||||
|
||||
<f:section name="content">
|
||||
|
||||
<f:render partial="SearchForm" arguments="{searchWord:''}" />
|
||||
|
||||
<f:form method="post" name="dblistForm">
|
||||
{listHtml -> f:format.raw()}
|
||||
<input type="hidden" name="cmd"/>
|
||||
</f:form>
|
||||
|
||||
<f:if condition="{listHtml}">
|
||||
<!--
|
||||
Listing options for extended view, clipboard and thumbnails
|
||||
-->
|
||||
<div class="typo3-listOptions">
|
||||
<f:if condition="{checkboxes.bigControlPanel.enabled}">
|
||||
<div class="checkbox">
|
||||
<label for="bigControlPanel">
|
||||
{checkboxes.bigControlPanel.html -> f:format.raw()}
|
||||
{checkboxes.bigControlPanel.label}
|
||||
</label>
|
||||
</div>
|
||||
</f:if>
|
||||
<f:if condition="{checkboxes.displayThumbs.enabled}">
|
||||
<div class="checkbox">
|
||||
<label for="checkDisplayThumbs">
|
||||
{checkboxes.displayThumbs.html -> f:format.raw()}
|
||||
{checkboxes.displayThumbs.label}
|
||||
</label>
|
||||
</div>
|
||||
</f:if>
|
||||
<f:if condition="{checkboxes.enableClipBoard.enabled}">
|
||||
<div class="checkbox">
|
||||
<label for="checkClipBoard">
|
||||
{checkboxes.enableClipBoard.html -> f:format.raw()}
|
||||
{checkboxes.enableClipBoard.label}
|
||||
</label>
|
||||
</div>
|
||||
</f:if>
|
||||
</div>
|
||||
|
||||
<f:if condition="{showClipBoard}">
|
||||
{clipBoardHtml -> f:format.raw()}
|
||||
|
||||
<f:be.buttons.csh table="xMOD_csh_corebe" field="filelist_clipboard" wrap="<span class='btn btn-sm btn-default'>|</span>" />
|
||||
</f:if>
|
||||
</f:if>
|
||||
</f:section>
|
||||
@@ -0,0 +1,9 @@
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="headline">
|
||||
|
||||
</f:section>
|
||||
|
||||
<f:section name="content">
|
||||
|
||||
</f:section>
|
||||
@@ -0,0 +1,226 @@
|
||||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
xmlns:fl="http://typo3.org/ns/TYPO3/CMS/Filelist/ViewHelpers">
|
||||
<f:layout name="Default"/>
|
||||
|
||||
<f:section name="headline">
|
||||
<h1><f:translate id="search">Search</f:translate>: "{searchWord}"</h1>
|
||||
</f:section>
|
||||
|
||||
<f:section name="content">
|
||||
|
||||
<f:render partial="SearchForm" arguments="{searchWord:searchWord}" />
|
||||
|
||||
<f:if condition="{files->f:count()} > 0">
|
||||
<div class="table-fit">
|
||||
<table class="table table-striped table-hover" id="typo3-filelist">
|
||||
<thead>
|
||||
<tr data-uid="0" data-l10nparent="0">
|
||||
<th class="col-icon nowrap"></th>
|
||||
<th class="col-path nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_filepath' )}</th>
|
||||
<th class="col-title nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_file' )}</th>
|
||||
<th class="col-control"></th>
|
||||
<th class="nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_fileext' )}</th>
|
||||
<th class="nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_tstamp' )}</th>
|
||||
<th class="nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_size' )}</th>
|
||||
<th class="nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c_rw' )}</th>
|
||||
<th class="nowrap">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:c__REF_' )}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<f:for each="{files}" as="file">
|
||||
<tr data-uid="0" data-l10nparent="0">
|
||||
<td class="col-icon nowrap">
|
||||
<a class="t3js-contextmenutrigger" data-uid="{file.identifier}" data-table="sys_file" href="#">
|
||||
<core:iconForResource resource="{file.resource}" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-path nowrap">
|
||||
{file.path}
|
||||
</td>
|
||||
<td class="col-title col-responsive nowrap">
|
||||
<f:if condition="{file.isMetadataEditable}">
|
||||
<f:then>
|
||||
<a href="#" class="filelist-file-title"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
|
||||
data-url="{be:uri.editRecord( uid:file.metadataUid, table:'sys_file_metadata', returnUrl:'{f:uri.action( action:\'search\', arguments:\'{ searchWord:\\'{searchWord->f:format.htmlentities()}\\' }\' ) -> f:format.raw()}' )}"
|
||||
>
|
||||
{file.name}
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
{file.name}
|
||||
</f:else>
|
||||
</f:if>
|
||||
<f:if condition="{file.isImage}">
|
||||
<br>
|
||||
<f:image image="{file.resource}" maxWidth="{thumbnail.width}" maxHeight="{thumbnail.height}" />
|
||||
</f:if>
|
||||
</td>
|
||||
<td class="col-control nowrap">
|
||||
<div class="btn-group">
|
||||
<f:if condition="{file.isEditable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-edit"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editcontent' )}"
|
||||
data-url="{fl:uri.editFileContent( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:\'{ searchWord:\\'{searchWord->f:format.htmlentities()}\\' }\' ) -> f:format.raw()}' )}"
|
||||
>
|
||||
<core:icon identifier="actions-page-open" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.IsMetadataEditable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-edit"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.editMetadata' )}"
|
||||
data-url="{be:uri.editRecord(uid:file.metadataUid, table:'sys_file_metadata', returnUrl:'{f:uri.action( action:\'search\', arguments:\'{ searchWord:\\'{searchWord->f:format.htmlentities()}\\' }\' ) -> f:format.raw()}' )}"
|
||||
>
|
||||
<core:icon identifier="actions-open" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.publicUrl}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-view"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.view' )}"
|
||||
data-url="{file.publicUrl}"
|
||||
>
|
||||
<core:icon identifier="actions-document-view" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.isReplaceable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-replace"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.replace' )}"
|
||||
data-url="{fl:uri.replaceFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:\'{ searchWord:\\'{searchWord->f:format.htmlentities()}\\' }\' ) -> f:format.raw()}' )}"
|
||||
>
|
||||
<core:icon identifier="actions-edit-replace" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.isRenamable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-rename"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.rename' )}"
|
||||
data-url="{fl:uri.renameFile( file:file.resource, returnUrl:'{f:uri.action( action:\'search\', arguments:\'{ searchWord:\\'{searchWord->f:format.htmlentities()}\\' }\' ) -> f:format.raw()}' )}"
|
||||
>
|
||||
<core:icon identifier="actions-edit-rename" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.isReadable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-info"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.info' )}"
|
||||
data-identifier="{file.identifier}"
|
||||
>
|
||||
<core:icon identifier="actions-document-info" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
<f:if condition="{file.copyable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-copy"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.copy' )}"
|
||||
data-url="{fl:uri.copyCutFile( file:file.resource, copyOrCut: 'copy' )}"
|
||||
data-redirect-url="{f:uri.action( action:'search', arguments:'{ searchWord:\'{searchWord->f:format.htmlentities()}\' }' )}"
|
||||
>
|
||||
<f:if condition="{file.selected} == 'copy'">
|
||||
<f:then><core:icon identifier="actions-edit-copy-release" /></f:then>
|
||||
<f:else><core:icon identifier="actions-edit-copy" /></f:else>
|
||||
</f:if>
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
<f:if condition="{file.cuttable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default filelist-file-cut"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.cut' )}"
|
||||
data-url="{fl:uri.copyCutFile( file:file.resource, copyOrCut: 'cut' )}"
|
||||
>
|
||||
<f:if condition="{file.selected} == 'cut'">
|
||||
<f:then><core:icon identifier="actions-edit-cut-release" /></f:then>
|
||||
<f:else><core:icon identifier="actions-edit-cut" /></f:else>
|
||||
</f:if>
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
|
||||
<f:if condition="{file.isDeletable}">
|
||||
<f:then>
|
||||
<a href="#" class="btn btn-default t3js-filelist-delete"
|
||||
title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.delete' )}"
|
||||
data-identifier="{file.identifier}"
|
||||
data-title="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.delete' )}"
|
||||
data-content="{f:translate( key:'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:mess.delete', arguments: '{0:file.name}' )}"
|
||||
data-check="{f:if(condition:settings.jsConfirmationDelete, then:'1', else:'0')}"
|
||||
data-delete-url="{deleteUrl}"
|
||||
data-delete-type="delete_file"
|
||||
data-redirect-url="{f:uri.action( action:'search', arguments:'{ searchWord:\'{searchWord->f:format.htmlentities()}\' }' )}"
|
||||
>
|
||||
<core:icon identifier="actions-edit-delete" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</div>
|
||||
</td>
|
||||
<td class="nowrap">{file.extension}</td>
|
||||
<td class="nowrap">{file.lastModified}</td>
|
||||
<td class="nowrap">{file.size}</td>
|
||||
<td class="nowrap">
|
||||
<f:if condition="{file.isReadable}"><strong class="text-danger">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:read' )}</strong></f:if><f:if condition="{file.isWritable}"><strong class="text-danger">{f:translate( key:'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf:write' )}</strong></f:if>
|
||||
</td>
|
||||
<td class="nowrap">
|
||||
<f:if condition="{file.referenceCount} > 0">
|
||||
<f:then>
|
||||
<a href="#" class="filelist-file-references" data-identifier="{file.identifier}" title="{f:translate( key:'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:show_references' )} ({file.referenceCount})">{file.referenceCount}</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</tr>
|
||||
</f:for>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</f:if>
|
||||
</f:section>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 350 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#4C7E3A" d="M0 0h64v64H0z"/><path fill="#FFF" d="M36 30h10c0-.692-.097-1.36-.262-2H36v2zM36 26h8.921a8.02 8.02 0 0 0-1.642-2H36v2zM36 34h14.648a5.958 5.958 0 0 0-1.195-2H36v2zM34 40V21.865A9.959 9.959 0 0 0 27 19c-5.413 0-9.81 4.304-9.984 9.675A6.995 6.995 0 0 0 20 42h14v-2zM36 38h14.651A5.97 5.97 0 0 0 51 36H36v2zM36 40v2h9a5.976 5.976 0 0 0 4.463-2H36z"/></svg>
|
||||
|
After Width: | Height: | Size: 437 B |
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Filelist/ContextMenuActions
|
||||
*
|
||||
* JavaScript to handle filelist actions from context menu
|
||||
* @exports TYPO3/CMS/Filelist/ContextMenuActions
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], function($, Modal, Severity) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @exports TYPO3/CMS/Filelist/ContextMenuActions
|
||||
*/
|
||||
var ContextMenuActions = {};
|
||||
ContextMenuActions.getReturnUrl = function() {
|
||||
return top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
|
||||
};
|
||||
|
||||
ContextMenuActions.renameFile = function(table, uid) {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileRename.moduleUrl + '&target=' + top.rawurlencode(uid) + '&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
|
||||
ContextMenuActions.editFile = function(table, uid) {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileEdit.moduleUrl + '&target=' + top.rawurlencode(uid) + '&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
|
||||
ContextMenuActions.editFileStorage = function(table, uid) {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FormEngine.moduleUrl + '&edit[sys_file_storage][' + parseInt(uid, 10) + ']=edit&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
|
||||
ContextMenuActions.openInfoPopUp = function(table, uid) {
|
||||
if (table === 'sys_file_storage') {
|
||||
top.TYPO3.InfoWindow.showItem(table, uid);
|
||||
} else {
|
||||
//files and folders
|
||||
top.TYPO3.InfoWindow.showItem('_FILE', uid);
|
||||
}
|
||||
};
|
||||
|
||||
ContextMenuActions.uploadFile = function(table, uid) {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileUpload.moduleUrl + '&target=' + top.rawurlencode(uid) + '&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
|
||||
ContextMenuActions.createFile = function(table, uid) {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileCreate.moduleUrl + '&target=' + top.rawurlencode(uid) + '&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
|
||||
ContextMenuActions.deleteFile = function(table, uid) {
|
||||
var $anchorElement = $(this);
|
||||
var performDelete = function() {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileCommit.moduleUrl + '&data[delete][0][data]=' + top.rawurlencode(uid) + '&data[delete][0][redirect]=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
if (!$anchorElement.data('title')) {
|
||||
performDelete();
|
||||
return;
|
||||
}
|
||||
|
||||
var $modal = Modal.confirm(
|
||||
$anchorElement.data('title'),
|
||||
$anchorElement.data('message'),
|
||||
Severity.warning, [
|
||||
{
|
||||
text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'cancel'
|
||||
},
|
||||
{
|
||||
text: $(this).data('button-ok-text') || TYPO3.lang['button.delete'] || 'Delete',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'delete'
|
||||
}
|
||||
]);
|
||||
|
||||
$modal.on('button.clicked', function(e) {
|
||||
if (e.target.name === 'delete') {
|
||||
performDelete();
|
||||
}
|
||||
Modal.dismiss();
|
||||
});
|
||||
};
|
||||
|
||||
ContextMenuActions.copyFile = function(table, uid) {
|
||||
var shortMD5 = top.MD5(uid).substring(0, 10);
|
||||
var url = TYPO3.settings.ajaxUrls['contextmenu_clipboard'];
|
||||
url += '&CB[el][_FILE%7C' + shortMD5 + ']=' + top.rawurlencode(uid) + '&CB[setCopyMode]=1';
|
||||
$.ajax(url).always(function() {
|
||||
top.TYPO3.Backend.ContentContainer.refresh(true);
|
||||
});
|
||||
};
|
||||
|
||||
ContextMenuActions.copyReleaseFile = function(table, uid) {
|
||||
var shortMD5 = top.MD5(uid).substring(0, 10);
|
||||
var url = TYPO3.settings.ajaxUrls['contextmenu_clipboard'];
|
||||
url += '&CB[el][_FILE%7C' + shortMD5 + ']=0&CB[setCopyMode]=1';
|
||||
$.ajax(url).always(function() {
|
||||
top.TYPO3.Backend.ContentContainer.refresh(true);
|
||||
});
|
||||
};
|
||||
|
||||
ContextMenuActions.cutFile = function(table, uid) {
|
||||
var shortMD5 = top.MD5(uid).substring(0, 10);
|
||||
var url = TYPO3.settings.ajaxUrls['contextmenu_clipboard'];
|
||||
url += '&CB[el][_FILE%7C' + shortMD5 + ']=' + top.rawurlencode(uid);
|
||||
$.ajax(url).always(function() {
|
||||
top.TYPO3.Backend.ContentContainer.refresh(true);
|
||||
});
|
||||
};
|
||||
|
||||
ContextMenuActions.cutReleaseFile = function(table, uid) {
|
||||
var shortMD5 = top.MD5(uid).substring(0, 10);
|
||||
var url = TYPO3.settings.ajaxUrls['contextmenu_clipboard'];
|
||||
url += '&CB[el][_FILE%7C' + shortMD5 + ']=0';
|
||||
$.ajax(url).always(function() {
|
||||
top.TYPO3.Backend.ContentContainer.refresh(true);
|
||||
});
|
||||
};
|
||||
|
||||
ContextMenuActions.pasteFileInto = function(table, uid) {
|
||||
var $anchorElement = $(this);
|
||||
var title = $anchorElement.data('title');
|
||||
var performPaste = function() {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileCommit.moduleUrl + '&CB[paste]=FILE|' + top.rawurlencode(uid) + '&CB[pad]=normal&redirect=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
if (!$anchorElement.data('title')) {
|
||||
performPaste();
|
||||
return;
|
||||
}
|
||||
var $modal = Modal.confirm(
|
||||
$anchorElement.data('title'),
|
||||
$anchorElement.data('message'),
|
||||
Severity.warning, [
|
||||
{
|
||||
text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'cancel'
|
||||
},
|
||||
{
|
||||
text: $(this).data('button-ok-text') || TYPO3.lang['button.ok'] || 'OK',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'ok'
|
||||
}
|
||||
]);
|
||||
|
||||
$modal.on('button.clicked', function(e) {
|
||||
if (e.target.name === 'ok') {
|
||||
performPaste();
|
||||
}
|
||||
Modal.dismiss();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
ContextMenuActions.dropInto = function(table, uid, mode) {
|
||||
var target = $(this).data('drop-target');
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.FileCommit.moduleUrl
|
||||
+ '&file[' + mode + '][0][data]=' + top.rawurlencode(uid)
|
||||
+ '&file[' + mode + '][0][target]=' + top.rawurlencode(target)
|
||||
+ '&redirect=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
};
|
||||
ContextMenuActions.dropMoveInto = function(table, uid) {
|
||||
ContextMenuActions.dropInto.bind($(this))(table, uid, 'move');
|
||||
};
|
||||
ContextMenuActions.dropCopyInto = function(table, uid) {
|
||||
ContextMenuActions.dropInto.bind($(this))(table, uid, 'copy');
|
||||
};
|
||||
return ContextMenuActions;
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Filelist/FileDelete
|
||||
* JavaScript for file delete
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], function($, Modal, Severity) {
|
||||
|
||||
$(function() {
|
||||
$(document).on('click', '.t3js-filelist-delete', function(e) {
|
||||
e.preventDefault();
|
||||
var $anchorElement = $(this);
|
||||
var redirectUrl = $anchorElement.data('redirectUrl');
|
||||
if (redirectUrl) {
|
||||
redirectUrl = top.rawurlencode(redirectUrl);
|
||||
} else {
|
||||
redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
|
||||
}
|
||||
var identifier = $anchorElement.data('identifier');
|
||||
var deleteType = $anchorElement.data('deleteType');
|
||||
var deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
|
||||
if ($anchorElement.data('check')) {
|
||||
var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
|
||||
{
|
||||
text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
|
||||
active: true,
|
||||
btnClass: 'btn-default',
|
||||
name: 'no'
|
||||
},
|
||||
{
|
||||
text: TYPO3.lang['buttons.confirm.' + deleteType + '.yes'] || 'Yes, delete this file or folder',
|
||||
btnClass: 'btn-warning',
|
||||
name: 'yes'
|
||||
}
|
||||
]);
|
||||
$modal.on('button.clicked', function(e) {
|
||||
if (e.target.name === 'no') {
|
||||
Modal.dismiss();
|
||||
} else if (e.target.name === 'yes') {
|
||||
Modal.dismiss();
|
||||
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Filelist/Filelist
|
||||
* @exports TYPO3/CMS/Filelist/Filelist
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/InfoWindow'], function($, InfoWindow) {
|
||||
|
||||
$(function() {
|
||||
$('a.filelist-file-title').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
window.location.href = url;
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-edit').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
top.list_frame.location.href = url;
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-view').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
top.openUrlInWindow(url, 'WebFile')
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-replace').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
top.list_frame.location.href = url;
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-rename').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
top.list_frame.location.href = url;
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-info').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var identifier = $(this).attr('data-identifier');
|
||||
openFileInfoPopup(identifier);
|
||||
});
|
||||
|
||||
$('a.filelist-file-references').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var identifier = $(this).attr('data-identifier');
|
||||
openFileInfoPopup(identifier);
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-copy').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
var redirectUrl = $(this).attr('data-url');
|
||||
if (redirectUrl) {
|
||||
redirectUrl = top.rawurlencode(redirectUrl);
|
||||
} else {
|
||||
redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
|
||||
}
|
||||
top.list_frame.location.href = url + '&redirect=' + redirectUrl;
|
||||
});
|
||||
|
||||
$('a.btn.filelist-file-cut').click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var url = $(this).attr('data-url');
|
||||
top.list_frame.location.href = url;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @param identifier
|
||||
*/
|
||||
function openFileInfoPopup(identifier) {
|
||||
InfoWindow.showItem('_FILE', identifier);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Filelist/FileListLocalisation
|
||||
* @exports TYPO3/CMS/Filelist/FileListLocalisation
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
|
||||
$(function() {
|
||||
$('a.filelist-translationToggler').click(function(event) {
|
||||
var id = $(this).attr('data-fileid');
|
||||
$('div[data-fileid="' + id + '"]').toggle();
|
||||
});
|
||||
});
|
||||
|
||||
return null;
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Filelist/FileSearch
|
||||
* JavaScript for file search
|
||||
* @exports TYPO3/CMS/Filelist/FileSearch
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
|
||||
|
||||
$(function() {
|
||||
var $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
|
||||
var searchResultShown = ('' !== $searchFields.first().val());
|
||||
|
||||
// make search field clearable
|
||||
$searchFields.clearable({
|
||||
onClear: function() {
|
||||
if (searchResultShown) {
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "typo3/cms-filelist",
|
||||
"type": "typo3-cms-framework",
|
||||
"description": "Listing of files in the directory",
|
||||
"homepage": "https://typo3.org",
|
||||
"license": ["GPL-2.0-or-later"],
|
||||
"authors": [{
|
||||
"name": "TYPO3 Core Team",
|
||||
"email": "typo3cms@typo3.org",
|
||||
"role": "Developer"
|
||||
}],
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"typo3/cms-core": "9.5.31"
|
||||
},
|
||||
"conflict": {
|
||||
"typo3/cms": "*"
|
||||
},
|
||||
"extra": {
|
||||
"typo3/cms": {
|
||||
"Package": {
|
||||
"protected": true,
|
||||
"partOfFactoryDefault": true,
|
||||
"partOfMinimalUsableSystem": true
|
||||
},
|
||||
"extension-key": "filelist"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TYPO3\\CMS\\Filelist\\": "Classes/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$EM_CONF[$_EXTKEY] = [
|
||||
'title' => 'File>List',
|
||||
'description' => 'Listing of files in the directory',
|
||||
'category' => 'module',
|
||||
'state' => 'stable',
|
||||
'uploadfolder' => 0,
|
||||
'createDirs' => '',
|
||||
'clearCacheOnLoad' => 0,
|
||||
'author' => 'TYPO3 Core Team',
|
||||
'author_email' => 'typo3cms@typo3.org',
|
||||
'author_company' => '',
|
||||
'version' => '9.5.31',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'typo3' => '9.5.31',
|
||||
],
|
||||
'conflicts' => [],
|
||||
'suggests' => [],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined('TYPO3_MODE') or die();
|
||||
|
||||
$GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1486418731] = \TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileProvider::class;
|
||||
$GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1486418732] = \TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FilemountsProvider::class;
|
||||
$GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1486418733] = \TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileStorageProvider::class;
|
||||
$GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1486418734] = \TYPO3\CMS\Filelist\ContextMenu\ItemProviders\FileDragProvider::class;
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php']['constructPostProcess'][] = \TYPO3\CMS\Filelist\Hook\BackendControllerHook::class . '->addJavaScript';
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined('TYPO3_MODE') or die();
|
||||
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||
'TYPO3.CMS.Filelist',
|
||||
'file',
|
||||
'list',
|
||||
'',
|
||||
[
|
||||
'FileList' => 'index, search',
|
||||
],
|
||||
[
|
||||
'access' => 'user,group',
|
||||
'workspaces' => 'online,custom',
|
||||
'icon' => 'EXT:filelist/Resources/Public/Icons/module-filelist.svg',
|
||||
'labels' => 'LLL:EXT:filelist/Resources/Private/Language/locallang_mod_file_list.xlf'
|
||||
]
|
||||
);
|
||||
Reference in new issue
Block a user