@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | call_user_func(function () { |
| 5 | 5 | |
| 6 | - if (TYPO3_MODE === 'BE') { |
|
| 6 | + if (TYPO3_MODE === 'BE') { |
|
| 7 | 7 | |
| 8 | - $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 9 | - \TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
| 10 | - )->get('media'); |
|
| 8 | + $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 9 | + \TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class |
|
| 10 | + )->get('media'); |
|
| 11 | 11 | |
| 12 | - // Default User TSConfig to be added in any case. |
|
| 13 | - TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
| 12 | + // Default User TSConfig to be added in any case. |
|
| 13 | + TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
| 14 | 14 | |
| 15 | 15 | # Enable or disabled the Media File Picker in the BE |
| 16 | 16 | options.vidi.enableMediaFilePicker = 1 |
@@ -20,149 +20,149 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | '); |
| 22 | 22 | |
| 23 | - $moduleFileLanguage = 'LLL:EXT:media/Resources/Private/Language/locallang.xlf'; |
|
| 24 | - if ($configuration['hide_file_list'] == 1) { |
|
| 23 | + $moduleFileLanguage = 'LLL:EXT:media/Resources/Private/Language/locallang.xlf'; |
|
| 24 | + if ($configuration['hide_file_list'] == 1) { |
|
| 25 | 25 | |
| 26 | - $moduleFileLanguage = 'LLL:EXT:media/Resources/Private/Language/locallang_filelist.xlf'; |
|
| 26 | + $moduleFileLanguage = 'LLL:EXT:media/Resources/Private/Language/locallang_filelist.xlf'; |
|
| 27 | 27 | |
| 28 | - // Default User TSConfig to be added in any case. |
|
| 29 | - TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
| 28 | + // Default User TSConfig to be added in any case. |
|
| 29 | + TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
| 30 | 30 | |
| 31 | 31 | # Hide default File List |
| 32 | 32 | options.hideModules.file := addToList(FilelistList) |
| 33 | 33 | '); |
| 34 | - } |
|
| 35 | - |
|
| 36 | - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( |
|
| 37 | - 'Fab.media', |
|
| 38 | - 'user', // Make media module a submodule of 'user' |
|
| 39 | - 'm1', |
|
| 40 | - 'bottom', // Position |
|
| 41 | - [ |
|
| 42 | - 'Asset' => 'create, update, download, editStorage', |
|
| 43 | - 'ImageEditor' => 'show', |
|
| 44 | - 'LinkCreator' => 'show', |
|
| 45 | - 'ProcessedFile' => 'create', |
|
| 46 | - ], |
|
| 47 | - [ |
|
| 48 | - 'access' => 'user,group', |
|
| 49 | - 'icon' => 'EXT:media/Resources/Public/Icons/Extension.svg', |
|
| 50 | - 'labels' => 'LLL:EXT:media/Resources/Private/Language/locallang_module.xlf', |
|
| 51 | - ] |
|
| 52 | - ); |
|
| 53 | - |
|
| 54 | - $defaultMainModule = (bool)$configuration['has_folder_tree'] ? 'file' : 'content'; |
|
| 55 | - |
|
| 56 | - /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */ |
|
| 57 | - $moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 58 | - \Fab\Vidi\Module\ModuleLoader::class, |
|
| 59 | - 'sys_file' |
|
| 60 | - ); |
|
| 61 | - $moduleLoader->setIcon('EXT:media/Resources/Public/Icons/Extension.svg') |
|
| 62 | - ->setModuleLanguageFile($moduleFileLanguage) |
|
| 63 | - ->setMainModule($defaultMainModule) |
|
| 64 | - ->addJavaScriptFiles([ |
|
| 65 | - 'EXT:media/Resources/Public/Libraries/Fineuploader/jquery.fineuploader-5.0.9.min.js', |
|
| 66 | - ]) |
|
| 67 | - ->addStyleSheetFiles([ |
|
| 68 | - 'EXT:media/Resources/Public/StyleSheets/media.css', |
|
| 69 | - 'EXT:media/Resources/Public/StyleSheets/fineuploader.css', |
|
| 70 | - ]) |
|
| 71 | - ->setDocHeaderTopLeftComponents([ |
|
| 72 | - \Fab\Media\View\Menu\StorageMenu::class, |
|
| 73 | - \Fab\Media\View\Checkbox\RecursiveCheckbox::class,] |
|
| 74 | - ) |
|
| 75 | - ->setDocHeaderBottomLeftComponents([ |
|
| 76 | - \Fab\Vidi\View\Button\ClipboardButton::class, |
|
| 77 | - \Fab\Media\View\Button\NewFolder::class, |
|
| 78 | - \Fab\Media\View\Button\UploadButton::class, |
|
| 79 | - ]) |
|
| 80 | - ->setGridTopComponents([ |
|
| 81 | - \Fab\Media\View\InlineJavaScript::class, |
|
| 82 | - \Fab\Media\View\Warning\ConfigurationWarning::class, |
|
| 83 | - \Fab\Media\View\Info\SelectedFolderInfo::class, |
|
| 84 | - ]) |
|
| 85 | - ->setGridBottomComponents([ |
|
| 86 | - \Fab\Media\View\Plugin\LinkCreatorPlugin::class, |
|
| 87 | - \Fab\Media\View\Plugin\ImageEditorPlugin::class, |
|
| 88 | - \Fab\Media\View\Plugin\FilePickerPlugin::class, |
|
| 89 | - ]) |
|
| 90 | - ->setGridButtonsComponents([ |
|
| 91 | - \Fab\Media\View\Button\LinkCreatorButton::class, |
|
| 92 | - \Fab\Media\View\Button\ImageEditorButton::class, |
|
| 93 | - \Fab\Media\View\Button\FilePickerButton::class, |
|
| 94 | - \Fab\Media\View\Button\EditButton::class, |
|
| 95 | - \Fab\Media\View\Button\DownloadButton::class, |
|
| 96 | - \Fab\Media\View\Button\DeleteButton::class, |
|
| 97 | - ]) |
|
| 98 | - ->setMenuMassActionComponents([ |
|
| 99 | - \Fab\Vidi\View\MenuItem\ExportXlsMenuItem::class, |
|
| 100 | - \Fab\Vidi\View\MenuItem\ExportXmlMenuItem::class, |
|
| 101 | - \Fab\Vidi\View\MenuItem\ExportCsvMenuItem::class, |
|
| 102 | - \Fab\Vidi\View\MenuItem\DividerMenuItem::class, |
|
| 103 | - |
|
| 104 | - // Media custom View Helper |
|
| 105 | - \Fab\Vidi\View\MenuItem\ClipboardMenuItem::class, |
|
| 106 | - \Fab\Media\View\MenuItem\FilePickerMenuItem::class, |
|
| 107 | - \Fab\Media\View\MenuItem\ChangeStorageMenuItem::class, |
|
| 108 | - \Fab\Vidi\View\MenuItem\MassDeleteMenuItem::class, |
|
| 109 | - ]) |
|
| 110 | - ->register(); |
|
| 111 | - |
|
| 112 | - /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ |
|
| 113 | - $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
| 114 | - |
|
| 115 | - /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */ |
|
| 116 | - $signalSlotDispatcher = $objectManager->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); |
|
| 117 | - |
|
| 118 | - # Register some tool for Media. |
|
| 119 | - \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\ThumbnailGeneratorTool::class); |
|
| 120 | - \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\CacheWarmUpTool::class); |
|
| 121 | - \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\MissingFilesFinderTool::class); |
|
| 122 | - \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\DuplicateRecordsFinderTool::class); |
|
| 123 | - \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\DuplicateFilesFinderTool::class); |
|
| 124 | - |
|
| 125 | - // Connect some signals with slots. |
|
| 126 | - $signalSlotDispatcher->connect( |
|
| 127 | - 'Fab\Vidi\Controller\Backend\ContentController', // Small exception in naming here as the class was previously located in "Controller\Backend". |
|
| 128 | - 'postProcessMatcherObject', |
|
| 129 | - \Fab\Media\Security\FilePermissionsAspect::class, |
|
| 130 | - 'addFilePermissionsForFileStorages' |
|
| 131 | - ); |
|
| 132 | - |
|
| 133 | - $signalSlotDispatcher->connect( |
|
| 134 | - \Fab\Vidi\Domain\Repository\ContentRepository::class, |
|
| 135 | - 'postProcessConstraintsObject', |
|
| 136 | - \Fab\Media\Security\FilePermissionsAspect::class, |
|
| 137 | - 'addFilePermissionsForFileMounts' |
|
| 138 | - ); |
|
| 139 | - |
|
| 140 | - $signalSlotDispatcher->connect( |
|
| 141 | - \Fab\Vidi\Service\ContentService::class, |
|
| 142 | - 'afterFindContentObjects', |
|
| 143 | - \Fab\Media\Facet\ActionPermissionFacet::class, |
|
| 144 | - 'modifyResultSet' |
|
| 145 | - ); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - // Add new sprite icon. |
|
| 149 | - $icons = [ |
|
| 150 | - 'image-edit' => 'EXT:media/Resources/Public/Icons/image_edit.png', |
|
| 151 | - 'image-link' => 'EXT:media/Resources/Public/Icons/image_link.png', |
|
| 152 | - 'image-export' => 'EXT:media/Resources/Public/Icons/image_export.png', |
|
| 153 | - 'storage-change' => 'EXT:media/Resources/Public/Icons/folder_go.png', |
|
| 154 | - ]; |
|
| 155 | - /** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */ |
|
| 156 | - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); |
|
| 157 | - foreach ($icons as $key => $icon) { |
|
| 158 | - $iconRegistry->registerIcon('extensions-media-' . $key, |
|
| 159 | - \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, |
|
| 160 | - [ |
|
| 161 | - 'source' => $icon |
|
| 162 | - ] |
|
| 163 | - ); |
|
| 164 | - } |
|
| 165 | - unset($iconRegistry); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( |
|
| 37 | + 'Fab.media', |
|
| 38 | + 'user', // Make media module a submodule of 'user' |
|
| 39 | + 'm1', |
|
| 40 | + 'bottom', // Position |
|
| 41 | + [ |
|
| 42 | + 'Asset' => 'create, update, download, editStorage', |
|
| 43 | + 'ImageEditor' => 'show', |
|
| 44 | + 'LinkCreator' => 'show', |
|
| 45 | + 'ProcessedFile' => 'create', |
|
| 46 | + ], |
|
| 47 | + [ |
|
| 48 | + 'access' => 'user,group', |
|
| 49 | + 'icon' => 'EXT:media/Resources/Public/Icons/Extension.svg', |
|
| 50 | + 'labels' => 'LLL:EXT:media/Resources/Private/Language/locallang_module.xlf', |
|
| 51 | + ] |
|
| 52 | + ); |
|
| 53 | + |
|
| 54 | + $defaultMainModule = (bool)$configuration['has_folder_tree'] ? 'file' : 'content'; |
|
| 55 | + |
|
| 56 | + /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */ |
|
| 57 | + $moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
| 58 | + \Fab\Vidi\Module\ModuleLoader::class, |
|
| 59 | + 'sys_file' |
|
| 60 | + ); |
|
| 61 | + $moduleLoader->setIcon('EXT:media/Resources/Public/Icons/Extension.svg') |
|
| 62 | + ->setModuleLanguageFile($moduleFileLanguage) |
|
| 63 | + ->setMainModule($defaultMainModule) |
|
| 64 | + ->addJavaScriptFiles([ |
|
| 65 | + 'EXT:media/Resources/Public/Libraries/Fineuploader/jquery.fineuploader-5.0.9.min.js', |
|
| 66 | + ]) |
|
| 67 | + ->addStyleSheetFiles([ |
|
| 68 | + 'EXT:media/Resources/Public/StyleSheets/media.css', |
|
| 69 | + 'EXT:media/Resources/Public/StyleSheets/fineuploader.css', |
|
| 70 | + ]) |
|
| 71 | + ->setDocHeaderTopLeftComponents([ |
|
| 72 | + \Fab\Media\View\Menu\StorageMenu::class, |
|
| 73 | + \Fab\Media\View\Checkbox\RecursiveCheckbox::class,] |
|
| 74 | + ) |
|
| 75 | + ->setDocHeaderBottomLeftComponents([ |
|
| 76 | + \Fab\Vidi\View\Button\ClipboardButton::class, |
|
| 77 | + \Fab\Media\View\Button\NewFolder::class, |
|
| 78 | + \Fab\Media\View\Button\UploadButton::class, |
|
| 79 | + ]) |
|
| 80 | + ->setGridTopComponents([ |
|
| 81 | + \Fab\Media\View\InlineJavaScript::class, |
|
| 82 | + \Fab\Media\View\Warning\ConfigurationWarning::class, |
|
| 83 | + \Fab\Media\View\Info\SelectedFolderInfo::class, |
|
| 84 | + ]) |
|
| 85 | + ->setGridBottomComponents([ |
|
| 86 | + \Fab\Media\View\Plugin\LinkCreatorPlugin::class, |
|
| 87 | + \Fab\Media\View\Plugin\ImageEditorPlugin::class, |
|
| 88 | + \Fab\Media\View\Plugin\FilePickerPlugin::class, |
|
| 89 | + ]) |
|
| 90 | + ->setGridButtonsComponents([ |
|
| 91 | + \Fab\Media\View\Button\LinkCreatorButton::class, |
|
| 92 | + \Fab\Media\View\Button\ImageEditorButton::class, |
|
| 93 | + \Fab\Media\View\Button\FilePickerButton::class, |
|
| 94 | + \Fab\Media\View\Button\EditButton::class, |
|
| 95 | + \Fab\Media\View\Button\DownloadButton::class, |
|
| 96 | + \Fab\Media\View\Button\DeleteButton::class, |
|
| 97 | + ]) |
|
| 98 | + ->setMenuMassActionComponents([ |
|
| 99 | + \Fab\Vidi\View\MenuItem\ExportXlsMenuItem::class, |
|
| 100 | + \Fab\Vidi\View\MenuItem\ExportXmlMenuItem::class, |
|
| 101 | + \Fab\Vidi\View\MenuItem\ExportCsvMenuItem::class, |
|
| 102 | + \Fab\Vidi\View\MenuItem\DividerMenuItem::class, |
|
| 103 | + |
|
| 104 | + // Media custom View Helper |
|
| 105 | + \Fab\Vidi\View\MenuItem\ClipboardMenuItem::class, |
|
| 106 | + \Fab\Media\View\MenuItem\FilePickerMenuItem::class, |
|
| 107 | + \Fab\Media\View\MenuItem\ChangeStorageMenuItem::class, |
|
| 108 | + \Fab\Vidi\View\MenuItem\MassDeleteMenuItem::class, |
|
| 109 | + ]) |
|
| 110 | + ->register(); |
|
| 111 | + |
|
| 112 | + /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ |
|
| 113 | + $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); |
|
| 114 | + |
|
| 115 | + /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */ |
|
| 116 | + $signalSlotDispatcher = $objectManager->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class); |
|
| 117 | + |
|
| 118 | + # Register some tool for Media. |
|
| 119 | + \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\ThumbnailGeneratorTool::class); |
|
| 120 | + \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\CacheWarmUpTool::class); |
|
| 121 | + \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\MissingFilesFinderTool::class); |
|
| 122 | + \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\DuplicateRecordsFinderTool::class); |
|
| 123 | + \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('sys_file', \Fab\Media\Tool\DuplicateFilesFinderTool::class); |
|
| 124 | + |
|
| 125 | + // Connect some signals with slots. |
|
| 126 | + $signalSlotDispatcher->connect( |
|
| 127 | + 'Fab\Vidi\Controller\Backend\ContentController', // Small exception in naming here as the class was previously located in "Controller\Backend". |
|
| 128 | + 'postProcessMatcherObject', |
|
| 129 | + \Fab\Media\Security\FilePermissionsAspect::class, |
|
| 130 | + 'addFilePermissionsForFileStorages' |
|
| 131 | + ); |
|
| 132 | + |
|
| 133 | + $signalSlotDispatcher->connect( |
|
| 134 | + \Fab\Vidi\Domain\Repository\ContentRepository::class, |
|
| 135 | + 'postProcessConstraintsObject', |
|
| 136 | + \Fab\Media\Security\FilePermissionsAspect::class, |
|
| 137 | + 'addFilePermissionsForFileMounts' |
|
| 138 | + ); |
|
| 139 | + |
|
| 140 | + $signalSlotDispatcher->connect( |
|
| 141 | + \Fab\Vidi\Service\ContentService::class, |
|
| 142 | + 'afterFindContentObjects', |
|
| 143 | + \Fab\Media\Facet\ActionPermissionFacet::class, |
|
| 144 | + 'modifyResultSet' |
|
| 145 | + ); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + // Add new sprite icon. |
|
| 149 | + $icons = [ |
|
| 150 | + 'image-edit' => 'EXT:media/Resources/Public/Icons/image_edit.png', |
|
| 151 | + 'image-link' => 'EXT:media/Resources/Public/Icons/image_link.png', |
|
| 152 | + 'image-export' => 'EXT:media/Resources/Public/Icons/image_export.png', |
|
| 153 | + 'storage-change' => 'EXT:media/Resources/Public/Icons/folder_go.png', |
|
| 154 | + ]; |
|
| 155 | + /** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */ |
|
| 156 | + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); |
|
| 157 | + foreach ($icons as $key => $icon) { |
|
| 158 | + $iconRegistry->registerIcon('extensions-media-' . $key, |
|
| 159 | + \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class, |
|
| 160 | + [ |
|
| 161 | + 'source' => $icon |
|
| 162 | + ] |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | + unset($iconRegistry); |
|
| 166 | 166 | |
| 167 | 167 | }); |
| 168 | 168 | |
@@ -21,59 +21,59 @@ |
||
| 21 | 21 | class SelectedFolderInfo extends AbstractComponentView |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 27 | - public $notAllowedMountPoints = []; |
|
| 24 | + /** |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | + public $notAllowedMountPoints = []; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Renders a button for uploading assets. |
|
| 31 | - * |
|
| 32 | - * @return string |
|
| 33 | - */ |
|
| 34 | - public function render() |
|
| 35 | - { |
|
| 29 | + /** |
|
| 30 | + * Renders a button for uploading assets. |
|
| 31 | + * |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | + public function render() |
|
| 35 | + { |
|
| 36 | 36 | |
| 37 | - $result = ''; |
|
| 38 | - if ($this->getMediaModule()->hasFolderTree()) { |
|
| 37 | + $result = ''; |
|
| 38 | + if ($this->getMediaModule()->hasFolderTree()) { |
|
| 39 | 39 | |
| 40 | - $folder = $this->getMediaModule()->getCurrentFolder(); |
|
| 41 | - $result = sprintf('<h1>%s</h1>', $this->getFolderName($folder)); |
|
| 42 | - } |
|
| 40 | + $folder = $this->getMediaModule()->getCurrentFolder(); |
|
| 41 | + $result = sprintf('<h1>%s</h1>', $this->getFolderName($folder)); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - return $result; |
|
| 45 | - } |
|
| 44 | + return $result; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get main headline based on active folder or storage for backend module |
|
| 49 | - * |
|
| 50 | - * Folder names are resolved to their special names like done in the tree view. |
|
| 51 | - * |
|
| 52 | - * @param Folder $folder |
|
| 53 | - * @return string |
|
| 54 | - */ |
|
| 55 | - protected function getFolderName(Folder $folder) |
|
| 56 | - { |
|
| 57 | - $name = $folder->getName(); |
|
| 58 | - if ($name === '') { |
|
| 59 | - // Show storage name on storage root |
|
| 60 | - if ($folder->getIdentifier() === '/') { |
|
| 61 | - $name = $folder->getStorage()->getName(); |
|
| 62 | - } |
|
| 63 | - } else { |
|
| 64 | - $name = key(ListUtility::resolveSpecialFolderNames( |
|
| 65 | - array($name => $folder) |
|
| 66 | - )); |
|
| 67 | - } |
|
| 68 | - return $name; |
|
| 69 | - } |
|
| 47 | + /** |
|
| 48 | + * Get main headline based on active folder or storage for backend module |
|
| 49 | + * |
|
| 50 | + * Folder names are resolved to their special names like done in the tree view. |
|
| 51 | + * |
|
| 52 | + * @param Folder $folder |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | + protected function getFolderName(Folder $folder) |
|
| 56 | + { |
|
| 57 | + $name = $folder->getName(); |
|
| 58 | + if ($name === '') { |
|
| 59 | + // Show storage name on storage root |
|
| 60 | + if ($folder->getIdentifier() === '/') { |
|
| 61 | + $name = $folder->getStorage()->getName(); |
|
| 62 | + } |
|
| 63 | + } else { |
|
| 64 | + $name = key(ListUtility::resolveSpecialFolderNames( |
|
| 65 | + array($name => $folder) |
|
| 66 | + )); |
|
| 67 | + } |
|
| 68 | + return $name; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @return MediaModule|object |
|
| 73 | - */ |
|
| 74 | - protected function getMediaModule() |
|
| 75 | - { |
|
| 76 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 77 | - } |
|
| 71 | + /** |
|
| 72 | + * @return MediaModule|object |
|
| 73 | + */ |
|
| 74 | + protected function getMediaModule() |
|
| 75 | + { |
|
| 76 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | } |
@@ -19,50 +19,50 @@ discard block |
||
| 19 | 19 | class RecursiveCheckbox extends AbstractComponentView |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var \Fab\Vidi\Module\ModuleLoader |
|
| 24 | - * @inject |
|
| 25 | - */ |
|
| 26 | - protected $moduleLoader; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Renders a checkbox for recursive file browsing. |
|
| 30 | - * |
|
| 31 | - * @return string |
|
| 32 | - * @throws \InvalidArgumentException |
|
| 33 | - */ |
|
| 34 | - public function render() |
|
| 35 | - { |
|
| 36 | - |
|
| 37 | - $output = ''; |
|
| 38 | - if ($this->isDisplayed()) { |
|
| 39 | - $this->loadRequireJsCode(); |
|
| 40 | - $output = $this->renderRecursiveCheckbox(); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - return $output; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @return string |
|
| 48 | - * @throws \InvalidArgumentException |
|
| 49 | - */ |
|
| 50 | - protected function isDisplayed() |
|
| 51 | - { |
|
| 52 | - $isDisplayed = $this->getMediaModule()->hasFolderTree(); |
|
| 53 | - if ($this->getModuleLoader()->hasPlugin()) { |
|
| 54 | - $isDisplayed = false; |
|
| 55 | - } |
|
| 56 | - return $isDisplayed; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - protected function renderRecursiveCheckbox() |
|
| 63 | - { |
|
| 64 | - |
|
| 65 | - $template = '<form action="%s" id="form-checkbox-hasRecursiveSelection" method="get"> |
|
| 22 | + /** |
|
| 23 | + * @var \Fab\Vidi\Module\ModuleLoader |
|
| 24 | + * @inject |
|
| 25 | + */ |
|
| 26 | + protected $moduleLoader; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Renders a checkbox for recursive file browsing. |
|
| 30 | + * |
|
| 31 | + * @return string |
|
| 32 | + * @throws \InvalidArgumentException |
|
| 33 | + */ |
|
| 34 | + public function render() |
|
| 35 | + { |
|
| 36 | + |
|
| 37 | + $output = ''; |
|
| 38 | + if ($this->isDisplayed()) { |
|
| 39 | + $this->loadRequireJsCode(); |
|
| 40 | + $output = $this->renderRecursiveCheckbox(); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + return $output; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @return string |
|
| 48 | + * @throws \InvalidArgumentException |
|
| 49 | + */ |
|
| 50 | + protected function isDisplayed() |
|
| 51 | + { |
|
| 52 | + $isDisplayed = $this->getMediaModule()->hasFolderTree(); |
|
| 53 | + if ($this->getModuleLoader()->hasPlugin()) { |
|
| 54 | + $isDisplayed = false; |
|
| 55 | + } |
|
| 56 | + return $isDisplayed; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + protected function renderRecursiveCheckbox() |
|
| 63 | + { |
|
| 64 | + |
|
| 65 | + $template = '<form action="%s" id="form-checkbox-hasRecursiveSelection" method="get"> |
|
| 66 | 66 | <label> |
| 67 | 67 | <input type="checkbox" |
| 68 | 68 | name="%s[hasRecursiveSelection]" |
@@ -73,35 +73,35 @@ discard block |
||
| 73 | 73 | </label> |
| 74 | 74 | </form>'; |
| 75 | 75 | |
| 76 | - return sprintf( |
|
| 77 | - $template, |
|
| 78 | - $this->getModuleLoader()->getModuleUrl(), |
|
| 79 | - $this->moduleLoader->getParameterPrefix(), |
|
| 80 | - $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:browse_subfolders') |
|
| 81 | - ); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @return void |
|
| 86 | - * @throws \InvalidArgumentException |
|
| 87 | - */ |
|
| 88 | - protected function loadRequireJsCode() |
|
| 89 | - { |
|
| 90 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 91 | - |
|
| 92 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 93 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 94 | - $pageRenderer->loadRequireJsModule('Fab/Media/BrowseRecursively'); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @return MediaModule|object |
|
| 100 | - * @throws \InvalidArgumentException |
|
| 101 | - */ |
|
| 102 | - protected function getMediaModule() |
|
| 103 | - { |
|
| 104 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 105 | - } |
|
| 76 | + return sprintf( |
|
| 77 | + $template, |
|
| 78 | + $this->getModuleLoader()->getModuleUrl(), |
|
| 79 | + $this->moduleLoader->getParameterPrefix(), |
|
| 80 | + $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:browse_subfolders') |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @return void |
|
| 86 | + * @throws \InvalidArgumentException |
|
| 87 | + */ |
|
| 88 | + protected function loadRequireJsCode() |
|
| 89 | + { |
|
| 90 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 91 | + |
|
| 92 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 93 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 94 | + $pageRenderer->loadRequireJsModule('Fab/Media/BrowseRecursively'); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @return MediaModule|object |
|
| 100 | + * @throws \InvalidArgumentException |
|
| 101 | + */ |
|
| 102 | + protected function getMediaModule() |
|
| 103 | + { |
|
| 104 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | } |
@@ -22,80 +22,80 @@ |
||
| 22 | 22 | class EditButton extends AbstractComponentView |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Renders a "edit" button to be placed in the grid. |
|
| 27 | - * |
|
| 28 | - * @param Content $object |
|
| 29 | - * @return string |
|
| 30 | - */ |
|
| 31 | - public function render(Content $object = null) |
|
| 32 | - { |
|
| 33 | - $file = $this->getFileConverter()->convert($object); |
|
| 34 | - $metadataProperties = $file->_getMetaData(); |
|
| 25 | + /** |
|
| 26 | + * Renders a "edit" button to be placed in the grid. |
|
| 27 | + * |
|
| 28 | + * @param Content $object |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 31 | + public function render(Content $object = null) |
|
| 32 | + { |
|
| 33 | + $file = $this->getFileConverter()->convert($object); |
|
| 34 | + $metadataProperties = $file->_getMetaData(); |
|
| 35 | 35 | |
| 36 | - $button = ''; |
|
| 37 | - if ($file->checkActionPermission('write')) { |
|
| 38 | - $button = $this->makeLinkButton() |
|
| 39 | - ->setHref($this->getUri($file)) |
|
| 40 | - ->setDataAttributes([ |
|
| 41 | - 'uid' => $metadataProperties['uid'], |
|
| 42 | - 'toggle' => 'tooltip', |
|
| 43 | - ]) |
|
| 44 | - ->setClasses('btn-edit') |
|
| 45 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_metadata')) |
|
| 46 | - ->setIcon($this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)) |
|
| 47 | - ->render(); |
|
| 48 | - } |
|
| 36 | + $button = ''; |
|
| 37 | + if ($file->checkActionPermission('write')) { |
|
| 38 | + $button = $this->makeLinkButton() |
|
| 39 | + ->setHref($this->getUri($file)) |
|
| 40 | + ->setDataAttributes([ |
|
| 41 | + 'uid' => $metadataProperties['uid'], |
|
| 42 | + 'toggle' => 'tooltip', |
|
| 43 | + ]) |
|
| 44 | + ->setClasses('btn-edit') |
|
| 45 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_metadata')) |
|
| 46 | + ->setIcon($this->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)) |
|
| 47 | + ->render(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $button; |
|
| 51 | - } |
|
| 50 | + return $button; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @param File $file |
|
| 55 | - * @return string |
|
| 56 | - */ |
|
| 57 | - protected function getUri(File $file) |
|
| 58 | - { |
|
| 59 | - $metadataProperties = $file->_getMetaData(); |
|
| 53 | + /** |
|
| 54 | + * @param File $file |
|
| 55 | + * @return string |
|
| 56 | + */ |
|
| 57 | + protected function getUri(File $file) |
|
| 58 | + { |
|
| 59 | + $metadataProperties = $file->_getMetaData(); |
|
| 60 | 60 | |
| 61 | - $parameterName = sprintf('edit[sys_file_metadata][%s]', $metadataProperties['uid']); |
|
| 62 | - $uri = BackendUtility::getModuleUrl( |
|
| 63 | - 'record_edit', |
|
| 64 | - array( |
|
| 65 | - $parameterName => 'edit', |
|
| 66 | - 'returnUrl' => BackendUtility::getModuleUrl(GeneralUtility::_GP('route'), $this->getAdditionalParameters()) |
|
| 67 | - ) |
|
| 68 | - ); |
|
| 69 | - return $uri; |
|
| 70 | - } |
|
| 61 | + $parameterName = sprintf('edit[sys_file_metadata][%s]', $metadataProperties['uid']); |
|
| 62 | + $uri = BackendUtility::getModuleUrl( |
|
| 63 | + 'record_edit', |
|
| 64 | + array( |
|
| 65 | + $parameterName => 'edit', |
|
| 66 | + 'returnUrl' => BackendUtility::getModuleUrl(GeneralUtility::_GP('route'), $this->getAdditionalParameters()) |
|
| 67 | + ) |
|
| 68 | + ); |
|
| 69 | + return $uri; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - protected function getAdditionalParameters() |
|
| 76 | - { |
|
| 77 | - $additionalParameters = []; |
|
| 78 | - if (GeneralUtility::_GP('id')) { |
|
| 79 | - $additionalParameters['id'] = urldecode(GeneralUtility::_GP('id')); |
|
| 80 | - } |
|
| 72 | + /** |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + protected function getAdditionalParameters() |
|
| 76 | + { |
|
| 77 | + $additionalParameters = []; |
|
| 78 | + if (GeneralUtility::_GP('id')) { |
|
| 79 | + $additionalParameters['id'] = urldecode(GeneralUtility::_GP('id')); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $vidiParameters = GeneralUtility::_GP(VidiModule::PARAMETER_PREFIX); |
|
| 83 | - if (is_array($vidiParameters)) { |
|
| 84 | - $whitelistedParameters = array_intersect_key($vidiParameters, ['plugins' => true, 'matches' => true]); |
|
| 85 | - if (count($whitelistedParameters) === 2) { |
|
| 86 | - $additionalParameters[VidiModule::PARAMETER_PREFIX] = $whitelistedParameters; |
|
| 87 | - } |
|
| 88 | - } |
|
| 82 | + $vidiParameters = GeneralUtility::_GP(VidiModule::PARAMETER_PREFIX); |
|
| 83 | + if (is_array($vidiParameters)) { |
|
| 84 | + $whitelistedParameters = array_intersect_key($vidiParameters, ['plugins' => true, 'matches' => true]); |
|
| 85 | + if (count($whitelistedParameters) === 2) { |
|
| 86 | + $additionalParameters[VidiModule::PARAMETER_PREFIX] = $whitelistedParameters; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - return $additionalParameters; |
|
| 91 | - } |
|
| 90 | + return $additionalParameters; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
| 95 | - */ |
|
| 96 | - protected function getFileConverter() |
|
| 97 | - { |
|
| 98 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
| 99 | - } |
|
| 93 | + /** |
|
| 94 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
| 95 | + */ |
|
| 96 | + protected function getFileConverter() |
|
| 97 | + { |
|
| 98 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | 101 | } |
@@ -21,101 +21,101 @@ |
||
| 21 | 21 | class NewFolder extends AbstractComponentView |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Renders a button to create a new folder. |
|
| 26 | - * |
|
| 27 | - * @param Content $object |
|
| 28 | - * @return string |
|
| 29 | - */ |
|
| 30 | - public function render($object = null) |
|
| 31 | - { |
|
| 32 | - $output = ''; |
|
| 33 | - if ($this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin()) { |
|
| 34 | - |
|
| 35 | - $button = $this->makeLinkButton() |
|
| 36 | - ->setHref($this->getNewFolderUri()) |
|
| 37 | - ->setTitle($this->getLabel()) |
|
| 38 | - ->setIcon($this->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)) |
|
| 39 | - ->render(); |
|
| 40 | - |
|
| 41 | - $output = '<div style="float: left;">' . $button . '</div>'; |
|
| 42 | - } |
|
| 43 | - return $output; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 49 | - protected function getLabel() |
|
| 50 | - { |
|
| 51 | - return $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new'); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @return string |
|
| 56 | - */ |
|
| 57 | - protected function getNewFolderUri() |
|
| 58 | - { |
|
| 59 | - return BackendUtility::getModuleUrl( |
|
| 60 | - 'file_newfolder', |
|
| 61 | - array( |
|
| 62 | - 'target' => $this->getCombineIdentifier(), |
|
| 63 | - 'returnUrl' => $this->getReturnUrl(), |
|
| 64 | - ) |
|
| 65 | - ); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - protected function getCombineIdentifier() |
|
| 73 | - { |
|
| 74 | - $folder = $this->getMediaModule()->getCurrentFolder(); |
|
| 75 | - return $folder->getCombinedIdentifier(); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @return string |
|
| 80 | - */ |
|
| 81 | - protected function getReturnUrl() |
|
| 82 | - { |
|
| 83 | - $returnUrl = BackendUtility::getModuleUrl( |
|
| 84 | - GeneralUtility::_GP('route'), |
|
| 85 | - $this->getAdditionalParameters() |
|
| 86 | - ); |
|
| 87 | - return $returnUrl; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @return array |
|
| 92 | - */ |
|
| 93 | - protected function getAdditionalParameters() |
|
| 94 | - { |
|
| 95 | - |
|
| 96 | - $additionalParameters = []; |
|
| 97 | - if (GeneralUtility::_GP('id')) { |
|
| 98 | - $additionalParameters = [ |
|
| 99 | - 'id' => urldecode(GeneralUtility::_GP('id')), |
|
| 100 | - ]; |
|
| 101 | - } |
|
| 102 | - return $additionalParameters; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return MediaModule|object |
|
| 107 | - */ |
|
| 108 | - protected function getMediaModule() |
|
| 109 | - { |
|
| 110 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return \TYPO3\CMS\Lang\LanguageService |
|
| 115 | - */ |
|
| 116 | - protected function getLanguageService() |
|
| 117 | - { |
|
| 118 | - return $GLOBALS['LANG']; |
|
| 119 | - } |
|
| 24 | + /** |
|
| 25 | + * Renders a button to create a new folder. |
|
| 26 | + * |
|
| 27 | + * @param Content $object |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 30 | + public function render($object = null) |
|
| 31 | + { |
|
| 32 | + $output = ''; |
|
| 33 | + if ($this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin()) { |
|
| 34 | + |
|
| 35 | + $button = $this->makeLinkButton() |
|
| 36 | + ->setHref($this->getNewFolderUri()) |
|
| 37 | + ->setTitle($this->getLabel()) |
|
| 38 | + ->setIcon($this->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)) |
|
| 39 | + ->render(); |
|
| 40 | + |
|
| 41 | + $output = '<div style="float: left;">' . $button . '</div>'; |
|
| 42 | + } |
|
| 43 | + return $output; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | + protected function getLabel() |
|
| 50 | + { |
|
| 51 | + return $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.new'); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @return string |
|
| 56 | + */ |
|
| 57 | + protected function getNewFolderUri() |
|
| 58 | + { |
|
| 59 | + return BackendUtility::getModuleUrl( |
|
| 60 | + 'file_newfolder', |
|
| 61 | + array( |
|
| 62 | + 'target' => $this->getCombineIdentifier(), |
|
| 63 | + 'returnUrl' => $this->getReturnUrl(), |
|
| 64 | + ) |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + protected function getCombineIdentifier() |
|
| 73 | + { |
|
| 74 | + $folder = $this->getMediaModule()->getCurrentFolder(); |
|
| 75 | + return $folder->getCombinedIdentifier(); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @return string |
|
| 80 | + */ |
|
| 81 | + protected function getReturnUrl() |
|
| 82 | + { |
|
| 83 | + $returnUrl = BackendUtility::getModuleUrl( |
|
| 84 | + GeneralUtility::_GP('route'), |
|
| 85 | + $this->getAdditionalParameters() |
|
| 86 | + ); |
|
| 87 | + return $returnUrl; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @return array |
|
| 92 | + */ |
|
| 93 | + protected function getAdditionalParameters() |
|
| 94 | + { |
|
| 95 | + |
|
| 96 | + $additionalParameters = []; |
|
| 97 | + if (GeneralUtility::_GP('id')) { |
|
| 98 | + $additionalParameters = [ |
|
| 99 | + 'id' => urldecode(GeneralUtility::_GP('id')), |
|
| 100 | + ]; |
|
| 101 | + } |
|
| 102 | + return $additionalParameters; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return MediaModule|object |
|
| 107 | + */ |
|
| 108 | + protected function getMediaModule() |
|
| 109 | + { |
|
| 110 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return \TYPO3\CMS\Lang\LanguageService |
|
| 115 | + */ |
|
| 116 | + protected function getLanguageService() |
|
| 117 | + { |
|
| 118 | + return $GLOBALS['LANG']; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | } |
@@ -19,75 +19,75 @@ |
||
| 19 | 19 | class DeleteButton extends AbstractComponentView |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Renders a "delete" button to be placed in the grid. |
|
| 24 | - * |
|
| 25 | - * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 26 | - * @return string |
|
| 27 | - * @throws \RuntimeException |
|
| 28 | - * @throws \InvalidArgumentException |
|
| 29 | - */ |
|
| 30 | - public function render(Content $object = null) |
|
| 31 | - { |
|
| 22 | + /** |
|
| 23 | + * Renders a "delete" button to be placed in the grid. |
|
| 24 | + * |
|
| 25 | + * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 26 | + * @return string |
|
| 27 | + * @throws \RuntimeException |
|
| 28 | + * @throws \InvalidArgumentException |
|
| 29 | + */ |
|
| 30 | + public function render(Content $object = null) |
|
| 31 | + { |
|
| 32 | 32 | |
| 33 | - $button = ''; |
|
| 34 | - $file = $this->getFileConverter()->convert($object); |
|
| 33 | + $button = ''; |
|
| 34 | + $file = $this->getFileConverter()->convert($object); |
|
| 35 | 35 | |
| 36 | - // Only display the delete icon if the file has no reference. |
|
| 37 | - if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) { |
|
| 36 | + // Only display the delete icon if the file has no reference. |
|
| 37 | + if ($this->getFileReferenceService()->countTotalReferences($object->getUid()) === 0 && $file->checkActionPermission('write')) { |
|
| 38 | 38 | |
| 39 | - $button = $this->makeLinkButton() |
|
| 40 | - ->setHref($this->getDeleteUri($object)) |
|
| 41 | - ->setDataAttributes([ |
|
| 42 | - 'uid' => $object->getUid(), |
|
| 43 | - 'toggle' => 'tooltip', |
|
| 44 | - 'label' => $file->getProperty('title'), |
|
| 45 | - ]) |
|
| 46 | - ->setClasses('btn-delete') |
|
| 47 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete')) |
|
| 48 | - ->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)) |
|
| 49 | - ->render(); |
|
| 50 | - } |
|
| 39 | + $button = $this->makeLinkButton() |
|
| 40 | + ->setHref($this->getDeleteUri($object)) |
|
| 41 | + ->setDataAttributes([ |
|
| 42 | + 'uid' => $object->getUid(), |
|
| 43 | + 'toggle' => 'tooltip', |
|
| 44 | + 'label' => $file->getProperty('title'), |
|
| 45 | + ]) |
|
| 46 | + ->setClasses('btn-delete') |
|
| 47 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:delete')) |
|
| 48 | + ->setIcon($this->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)) |
|
| 49 | + ->render(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - return $button; |
|
| 53 | - } |
|
| 52 | + return $button; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @param Content $object |
|
| 57 | - * @return string |
|
| 58 | - * @throws \InvalidArgumentException |
|
| 59 | - */ |
|
| 60 | - protected function getDeleteUri(Content $object) |
|
| 61 | - { |
|
| 62 | - $additionalParameters = array( |
|
| 63 | - $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 64 | - 'controller' => 'Content', |
|
| 65 | - 'action' => 'delete', |
|
| 66 | - 'format' => 'json', |
|
| 67 | - 'matches' => array( |
|
| 68 | - 'uid' => $object->getUid(), |
|
| 69 | - ), |
|
| 70 | - ), |
|
| 71 | - ); |
|
| 72 | - return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
| 73 | - } |
|
| 55 | + /** |
|
| 56 | + * @param Content $object |
|
| 57 | + * @return string |
|
| 58 | + * @throws \InvalidArgumentException |
|
| 59 | + */ |
|
| 60 | + protected function getDeleteUri(Content $object) |
|
| 61 | + { |
|
| 62 | + $additionalParameters = array( |
|
| 63 | + $this->getModuleLoader()->getParameterPrefix() => array( |
|
| 64 | + 'controller' => 'Content', |
|
| 65 | + 'action' => 'delete', |
|
| 66 | + 'format' => 'json', |
|
| 67 | + 'matches' => array( |
|
| 68 | + 'uid' => $object->getUid(), |
|
| 69 | + ), |
|
| 70 | + ), |
|
| 71 | + ); |
|
| 72 | + return $this->getModuleLoader()->getModuleUrl($additionalParameters); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @return \Fab\Media\Resource\FileReferenceService|object |
|
| 77 | - * @throws \InvalidArgumentException |
|
| 78 | - */ |
|
| 79 | - protected function getFileReferenceService() |
|
| 80 | - { |
|
| 81 | - return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
| 82 | - } |
|
| 75 | + /** |
|
| 76 | + * @return \Fab\Media\Resource\FileReferenceService|object |
|
| 77 | + * @throws \InvalidArgumentException |
|
| 78 | + */ |
|
| 79 | + protected function getFileReferenceService() |
|
| 80 | + { |
|
| 81 | + return GeneralUtility::makeInstance(\Fab\Media\Resource\FileReferenceService::class); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
| 86 | - * @throws \InvalidArgumentException |
|
| 87 | - */ |
|
| 88 | - protected function getFileConverter() |
|
| 89 | - { |
|
| 90 | - return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
| 91 | - } |
|
| 84 | + /** |
|
| 85 | + * @return \Fab\Media\TypeConverter\ContentToFileConverter|object |
|
| 86 | + * @throws \InvalidArgumentException |
|
| 87 | + */ |
|
| 88 | + protected function getFileConverter() |
|
| 89 | + { |
|
| 90 | + return GeneralUtility::makeInstance(\Fab\Media\TypeConverter\ContentToFileConverter::class); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | } |
@@ -18,16 +18,16 @@ |
||
| 18 | 18 | class UploadButton extends AbstractComponentView |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Renders a button for uploading assets. |
|
| 23 | - * |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public function render() |
|
| 27 | - { |
|
| 21 | + /** |
|
| 22 | + * Renders a button for uploading assets. |
|
| 23 | + * |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public function render() |
|
| 27 | + { |
|
| 28 | 28 | |
| 29 | - /** @var $fileUpload \Fab\Media\Form\FileUpload */ |
|
| 30 | - $fileUpload = GeneralUtility::makeInstance(\Fab\Media\Form\FileUpload::class); |
|
| 31 | - return $fileUpload->setPrefix(MediaModule::getParameterPrefix())->render(); |
|
| 32 | - } |
|
| 29 | + /** @var $fileUpload \Fab\Media\Form\FileUpload */ |
|
| 30 | + $fileUpload = GeneralUtility::makeInstance(\Fab\Media\Form\FileUpload::class); |
|
| 31 | + return $fileUpload->setPrefix(MediaModule::getParameterPrefix())->render(); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -19,126 +19,126 @@ |
||
| 19 | 19 | class StorageMenu extends AbstractComponentView |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var \Fab\Vidi\Module\ModuleLoader |
|
| 24 | - * @inject |
|
| 25 | - */ |
|
| 26 | - protected $moduleLoader; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Renders a dropdown menu for storage. |
|
| 30 | - * |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function render() |
|
| 34 | - { |
|
| 35 | - |
|
| 36 | - $output = ''; |
|
| 37 | - if ($this->isDisplayed()) { |
|
| 38 | - $this->loadRequireJsCode(); |
|
| 39 | - |
|
| 40 | - $output = $this->renderStorageMenu(); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - return $output; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 49 | - protected function isDisplayed() |
|
| 50 | - { |
|
| 51 | - $isDisplayed = !$this->getMediaModule()->hasFolderTree() || $this->getModuleLoader()->hasPlugin(); |
|
| 52 | - return $isDisplayed; |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @return string |
|
| 57 | - */ |
|
| 58 | - protected function renderStorageMenu() |
|
| 59 | - { |
|
| 60 | - |
|
| 61 | - $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
| 62 | - |
|
| 63 | - /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */ |
|
| 64 | - $options = ''; |
|
| 65 | - foreach ($this->getMediaModule()->getAllowedStorages() as $storage) { |
|
| 66 | - $selected = ''; |
|
| 67 | - if ($currentStorage->getUid() == $storage->getUid()) { |
|
| 68 | - $selected = 'selected'; |
|
| 69 | - } |
|
| 70 | - $options .= sprintf('<option value="%s" %s>%s %s</option>', |
|
| 71 | - $storage->getUid(), |
|
| 72 | - $selected, |
|
| 73 | - $storage->getName(), |
|
| 74 | - $storage->isOnline() ? |
|
| 75 | - '' : |
|
| 76 | - '(' . $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline') . ')' |
|
| 77 | - ); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - $parameters = GeneralUtility::_GET(); |
|
| 81 | - $inputs = ''; |
|
| 82 | - foreach ($parameters as $parameter => $value) { |
|
| 83 | - list($parameter, $value) = $this->computeParameterAndValue($parameter, $value); |
|
| 84 | - if ($parameter !== $this->moduleLoader->getParameterPrefix() . '[storage]') { |
|
| 85 | - $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $template = '<form action="%s" id="form-menu-storage" method="get"> |
|
| 22 | + /** |
|
| 23 | + * @var \Fab\Vidi\Module\ModuleLoader |
|
| 24 | + * @inject |
|
| 25 | + */ |
|
| 26 | + protected $moduleLoader; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Renders a dropdown menu for storage. |
|
| 30 | + * |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function render() |
|
| 34 | + { |
|
| 35 | + |
|
| 36 | + $output = ''; |
|
| 37 | + if ($this->isDisplayed()) { |
|
| 38 | + $this->loadRequireJsCode(); |
|
| 39 | + |
|
| 40 | + $output = $this->renderStorageMenu(); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + return $output; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | + protected function isDisplayed() |
|
| 50 | + { |
|
| 51 | + $isDisplayed = !$this->getMediaModule()->hasFolderTree() || $this->getModuleLoader()->hasPlugin(); |
|
| 52 | + return $isDisplayed; |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 58 | + protected function renderStorageMenu() |
|
| 59 | + { |
|
| 60 | + |
|
| 61 | + $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
| 62 | + |
|
| 63 | + /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */ |
|
| 64 | + $options = ''; |
|
| 65 | + foreach ($this->getMediaModule()->getAllowedStorages() as $storage) { |
|
| 66 | + $selected = ''; |
|
| 67 | + if ($currentStorage->getUid() == $storage->getUid()) { |
|
| 68 | + $selected = 'selected'; |
|
| 69 | + } |
|
| 70 | + $options .= sprintf('<option value="%s" %s>%s %s</option>', |
|
| 71 | + $storage->getUid(), |
|
| 72 | + $selected, |
|
| 73 | + $storage->getName(), |
|
| 74 | + $storage->isOnline() ? |
|
| 75 | + '' : |
|
| 76 | + '(' . $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline') . ')' |
|
| 77 | + ); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + $parameters = GeneralUtility::_GET(); |
|
| 81 | + $inputs = ''; |
|
| 82 | + foreach ($parameters as $parameter => $value) { |
|
| 83 | + list($parameter, $value) = $this->computeParameterAndValue($parameter, $value); |
|
| 84 | + if ($parameter !== $this->moduleLoader->getParameterPrefix() . '[storage]') { |
|
| 85 | + $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $template = '<form action="%s" id="form-menu-storage" method="get"> |
|
| 90 | 90 | %s |
| 91 | 91 | <select name="%s[storage]" class="form-control" style="padding-right: 20px" id="menu-storage" onchange="$(\'#form-menu-storage\').submit()">%s</select> |
| 92 | 92 | </form>'; |
| 93 | 93 | |
| 94 | - return sprintf( |
|
| 95 | - $template, |
|
| 96 | - $this->getModuleLoader()->getModuleUrl(), |
|
| 97 | - $inputs, |
|
| 98 | - $this->moduleLoader->getParameterPrefix(), |
|
| 99 | - $options |
|
| 100 | - ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @return void |
|
| 105 | - */ |
|
| 106 | - protected function loadRequireJsCode() |
|
| 107 | - { |
|
| 108 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 109 | - |
|
| 110 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 111 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 112 | - $pageRenderer->loadRequireJsModule('Fab/Media/EditStorage'); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Compute parameter and value to be correctly encoded by the browser. |
|
| 117 | - * |
|
| 118 | - * @param string $parameter |
|
| 119 | - * @param mixed $value |
|
| 120 | - * @return array |
|
| 121 | - */ |
|
| 122 | - protected function computeParameterAndValue($parameter, $value) |
|
| 123 | - { |
|
| 124 | - |
|
| 125 | - if (is_string($value)) { |
|
| 126 | - $result = array($parameter, $value); |
|
| 127 | - } else { |
|
| 128 | - $key = key($value); |
|
| 129 | - $value = current($value); |
|
| 130 | - $parameter = sprintf('%s[%s]', $parameter, $key); |
|
| 131 | - $result = $this->computeParameterAndValue($parameter, $value); |
|
| 132 | - } |
|
| 133 | - return $result; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @return MediaModule|object |
|
| 138 | - */ |
|
| 139 | - protected function getMediaModule() |
|
| 140 | - { |
|
| 141 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 142 | - } |
|
| 94 | + return sprintf( |
|
| 95 | + $template, |
|
| 96 | + $this->getModuleLoader()->getModuleUrl(), |
|
| 97 | + $inputs, |
|
| 98 | + $this->moduleLoader->getParameterPrefix(), |
|
| 99 | + $options |
|
| 100 | + ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @return void |
|
| 105 | + */ |
|
| 106 | + protected function loadRequireJsCode() |
|
| 107 | + { |
|
| 108 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 109 | + |
|
| 110 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 111 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 112 | + $pageRenderer->loadRequireJsModule('Fab/Media/EditStorage'); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Compute parameter and value to be correctly encoded by the browser. |
|
| 117 | + * |
|
| 118 | + * @param string $parameter |
|
| 119 | + * @param mixed $value |
|
| 120 | + * @return array |
|
| 121 | + */ |
|
| 122 | + protected function computeParameterAndValue($parameter, $value) |
|
| 123 | + { |
|
| 124 | + |
|
| 125 | + if (is_string($value)) { |
|
| 126 | + $result = array($parameter, $value); |
|
| 127 | + } else { |
|
| 128 | + $key = key($value); |
|
| 129 | + $value = current($value); |
|
| 130 | + $parameter = sprintf('%s[%s]', $parameter, $key); |
|
| 131 | + $result = $this->computeParameterAndValue($parameter, $value); |
|
| 132 | + } |
|
| 133 | + return $result; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @return MediaModule|object |
|
| 138 | + */ |
|
| 139 | + protected function getMediaModule() |
|
| 140 | + { |
|
| 141 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | } |
@@ -16,28 +16,28 @@ |
||
| 16 | 16 | class ClientValidation implements SingletonInterface |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Returns a class instance |
|
| 21 | - * |
|
| 22 | - * @return \Fab\Media\Utility\ClientValidation|object |
|
| 23 | - */ |
|
| 24 | - static public function getInstance() |
|
| 25 | - { |
|
| 26 | - return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class); |
|
| 27 | - } |
|
| 19 | + /** |
|
| 20 | + * Returns a class instance |
|
| 21 | + * |
|
| 22 | + * @return \Fab\Media\Utility\ClientValidation|object |
|
| 23 | + */ |
|
| 24 | + static public function getInstance() |
|
| 25 | + { |
|
| 26 | + return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\Fab\Media\Utility\ClientValidation::class); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Get the validation class name given a field. |
|
| 31 | - * |
|
| 32 | - * @param string $fieldName |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function get($fieldName) |
|
| 36 | - { |
|
| 37 | - $result = ''; |
|
| 38 | - if (\Fab\Media\Utility\TcaField::getService()->isRequired($fieldName)) { |
|
| 39 | - $result = ' validate[required]'; |
|
| 40 | - } |
|
| 41 | - return $result; |
|
| 42 | - } |
|
| 29 | + /** |
|
| 30 | + * Get the validation class name given a field. |
|
| 31 | + * |
|
| 32 | + * @param string $fieldName |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function get($fieldName) |
|
| 36 | + { |
|
| 37 | + $result = ''; |
|
| 38 | + if (\Fab\Media\Utility\TcaField::getService()->isRequired($fieldName)) { |
|
| 39 | + $result = ' validate[required]'; |
|
| 40 | + } |
|
| 41 | + return $result; |
|
| 42 | + } |
|
| 43 | 43 | } |