@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public function setUp() { |
| 42 | 42 | parent::setUp(); |
| 43 | 43 | |
| 44 | - $this->fixture = $this->getMock('Fab\Media\Form\FileUpload', array('addLanguage')); |
|
| 44 | + $this->fixture = $this->getMock('Fab\Media\Form\FileUpload', array('addLanguage')); |
|
| 45 | 45 | $this->fakeName = uniqid('name'); |
| 46 | 46 | $this->fakePrefix= uniqid('prefix'); |
| 47 | 47 | } |
@@ -14,16 +14,16 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class FeatureContext extends MinkContext |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Initializes context. |
|
| 19 | - * Every scenario gets it's own context object. |
|
| 20 | - * |
|
| 21 | - * @param array $parameters context parameters (set them up through behat.yml) |
|
| 22 | - */ |
|
| 23 | - public function __construct(array $parameters) |
|
| 24 | - { |
|
| 25 | - // Initialize your context here |
|
| 26 | - } |
|
| 17 | + /** |
|
| 18 | + * Initializes context. |
|
| 19 | + * Every scenario gets it's own context object. |
|
| 20 | + * |
|
| 21 | + * @param array $parameters context parameters (set them up through behat.yml) |
|
| 22 | + */ |
|
| 23 | + public function __construct(array $parameters) |
|
| 24 | + { |
|
| 25 | + // Initialize your context here |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @Given /^I wait "([^"]*)" seconds$/ |
@@ -27,50 +27,50 @@ |
||
| 27 | 27 | class LinkCreatorPlugin extends AbstractComponentView |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Renders a hidden link for link creator. |
|
| 32 | - * |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function render() |
|
| 36 | - { |
|
| 37 | - $result = ''; |
|
| 38 | - if ($this->getModuleLoader()->hasPlugin('linkCreator')) { |
|
| 30 | + /** |
|
| 31 | + * Renders a hidden link for link creator. |
|
| 32 | + * |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function render() |
|
| 36 | + { |
|
| 37 | + $result = ''; |
|
| 38 | + if ($this->getModuleLoader()->hasPlugin('linkCreator')) { |
|
| 39 | 39 | |
| 40 | - // Load Require JS code |
|
| 41 | - $this->loadRequireJsCode(); |
|
| 40 | + // Load Require JS code |
|
| 41 | + $this->loadRequireJsCode(); |
|
| 42 | 42 | |
| 43 | - $result = sprintf('<a href="%s" id="btn-linkCreator-current" class="btn btn-linkCreator" style="display: none"></a>', |
|
| 44 | - $this->getLinkCreatorUri() |
|
| 45 | - ); |
|
| 46 | - }; |
|
| 47 | - return $result; |
|
| 48 | - } |
|
| 43 | + $result = sprintf('<a href="%s" id="btn-linkCreator-current" class="btn btn-linkCreator" style="display: none"></a>', |
|
| 44 | + $this->getLinkCreatorUri() |
|
| 45 | + ); |
|
| 46 | + }; |
|
| 47 | + return $result; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @return string |
|
| 52 | - */ |
|
| 53 | - protected function getLinkCreatorUri() |
|
| 54 | - { |
|
| 55 | - $urlParameters = array( |
|
| 56 | - MediaModule::getParameterPrefix() => array( |
|
| 57 | - 'controller' => 'LinkCreator', |
|
| 58 | - 'action' => 'show', |
|
| 59 | - ), |
|
| 60 | - ); |
|
| 61 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
| 62 | - } |
|
| 50 | + /** |
|
| 51 | + * @return string |
|
| 52 | + */ |
|
| 53 | + protected function getLinkCreatorUri() |
|
| 54 | + { |
|
| 55 | + $urlParameters = array( |
|
| 56 | + MediaModule::getParameterPrefix() => array( |
|
| 57 | + 'controller' => 'LinkCreator', |
|
| 58 | + 'action' => 'show', |
|
| 59 | + ), |
|
| 60 | + ); |
|
| 61 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @return void |
|
| 66 | - */ |
|
| 67 | - protected function loadRequireJsCode() |
|
| 68 | - { |
|
| 69 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 64 | + /** |
|
| 65 | + * @return void |
|
| 66 | + */ |
|
| 67 | + protected function loadRequireJsCode() |
|
| 68 | + { |
|
| 69 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 70 | 70 | |
| 71 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 72 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 73 | - $pageRenderer->loadRequireJsModule('Fab/Media/PluginLinkCreator'); |
|
| 74 | - } |
|
| 71 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 72 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 73 | + $pageRenderer->loadRequireJsModule('Fab/Media/PluginLinkCreator'); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | } |
@@ -27,50 +27,50 @@ |
||
| 27 | 27 | class ImageEditorPlugin extends AbstractComponentView |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Renders a hidden link for image editor. |
|
| 32 | - * |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function render() |
|
| 36 | - { |
|
| 30 | + /** |
|
| 31 | + * Renders a hidden link for image editor. |
|
| 32 | + * |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function render() |
|
| 36 | + { |
|
| 37 | 37 | |
| 38 | - $result = ''; |
|
| 39 | - if ($this->getModuleLoader()->hasPlugin('imageEditor')) { |
|
| 38 | + $result = ''; |
|
| 39 | + if ($this->getModuleLoader()->hasPlugin('imageEditor')) { |
|
| 40 | 40 | |
| 41 | - // Load Require JS code |
|
| 42 | - $this->loadRequireJsCode(); |
|
| 41 | + // Load Require JS code |
|
| 42 | + $this->loadRequireJsCode(); |
|
| 43 | 43 | |
| 44 | - $result = sprintf('<a href="%s" id="btn-imageEditor-current" class="btn btn-imageEditor" style="display: none"></a>', |
|
| 45 | - $this->getImageEditorUri() |
|
| 46 | - ); |
|
| 47 | - }; |
|
| 48 | - return $result; |
|
| 49 | - } |
|
| 44 | + $result = sprintf('<a href="%s" id="btn-imageEditor-current" class="btn btn-imageEditor" style="display: none"></a>', |
|
| 45 | + $this->getImageEditorUri() |
|
| 46 | + ); |
|
| 47 | + }; |
|
| 48 | + return $result; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - protected function getImageEditorUri() |
|
| 55 | - { |
|
| 56 | - $urlParameters = array( |
|
| 57 | - MediaModule::getParameterPrefix() => array( |
|
| 58 | - 'controller' => 'ImageEditor', |
|
| 59 | - 'action' => 'show', |
|
| 60 | - ), |
|
| 61 | - ); |
|
| 62 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
| 63 | - } |
|
| 51 | + /** |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + protected function getImageEditorUri() |
|
| 55 | + { |
|
| 56 | + $urlParameters = array( |
|
| 57 | + MediaModule::getParameterPrefix() => array( |
|
| 58 | + 'controller' => 'ImageEditor', |
|
| 59 | + 'action' => 'show', |
|
| 60 | + ), |
|
| 61 | + ); |
|
| 62 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @return void |
|
| 67 | - */ |
|
| 68 | - protected function loadRequireJsCode() |
|
| 69 | - { |
|
| 70 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 65 | + /** |
|
| 66 | + * @return void |
|
| 67 | + */ |
|
| 68 | + protected function loadRequireJsCode() |
|
| 69 | + { |
|
| 70 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 71 | 71 | |
| 72 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 73 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 74 | - $pageRenderer->loadRequireJsModule('Fab/Media/PluginImageEditor'); |
|
| 75 | - } |
|
| 72 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 73 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 74 | + $pageRenderer->loadRequireJsModule('Fab/Media/PluginImageEditor'); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -23,32 +23,32 @@ |
||
| 23 | 23 | class LinkCreatorController extends ActionController |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Initializes the controller before invoking an action method. |
|
| 28 | - */ |
|
| 29 | - public function initializeAction() |
|
| 30 | - { |
|
| 31 | - |
|
| 32 | - // Configure property mapping to retrieve the file object. |
|
| 33 | - if ($this->arguments->hasArgument('file')) { |
|
| 34 | - |
|
| 35 | - /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 36 | - $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 37 | - |
|
| 38 | - $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 39 | - $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Handle GUI for creating a link in the RTE. |
|
| 45 | - * |
|
| 46 | - * @param File $file |
|
| 47 | - * @return void |
|
| 48 | - */ |
|
| 49 | - public function showAction(File $file) |
|
| 50 | - { |
|
| 51 | - $this->view->assign('file', $file); |
|
| 52 | - } |
|
| 26 | + /** |
|
| 27 | + * Initializes the controller before invoking an action method. |
|
| 28 | + */ |
|
| 29 | + public function initializeAction() |
|
| 30 | + { |
|
| 31 | + |
|
| 32 | + // Configure property mapping to retrieve the file object. |
|
| 33 | + if ($this->arguments->hasArgument('file')) { |
|
| 34 | + |
|
| 35 | + /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 36 | + $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 37 | + |
|
| 38 | + $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 39 | + $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Handle GUI for creating a link in the RTE. |
|
| 45 | + * |
|
| 46 | + * @param File $file |
|
| 47 | + * @return void |
|
| 48 | + */ |
|
| 49 | + public function showAction(File $file) |
|
| 50 | + { |
|
| 51 | + $this->view->assign('file', $file); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |
@@ -25,30 +25,30 @@ |
||
| 25 | 25 | class FilePickerPlugin extends AbstractComponentView |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Renders a hidden link for file picker. |
|
| 30 | - * |
|
| 31 | - * @return string |
|
| 32 | - */ |
|
| 33 | - public function render() |
|
| 34 | - { |
|
| 35 | - |
|
| 36 | - if ($this->getModuleLoader()->hasPlugin('filePicker')) { |
|
| 37 | - $this->loadRequireJsCode(); |
|
| 38 | - }; |
|
| 39 | - return ''; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @return void |
|
| 44 | - */ |
|
| 45 | - protected function loadRequireJsCode() |
|
| 46 | - { |
|
| 47 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 48 | - |
|
| 49 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 50 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 51 | - $pageRenderer->loadRequireJsModule('Fab/Media/PluginFilePicker'); |
|
| 52 | - } |
|
| 28 | + /** |
|
| 29 | + * Renders a hidden link for file picker. |
|
| 30 | + * |
|
| 31 | + * @return string |
|
| 32 | + */ |
|
| 33 | + public function render() |
|
| 34 | + { |
|
| 35 | + |
|
| 36 | + if ($this->getModuleLoader()->hasPlugin('filePicker')) { |
|
| 37 | + $this->loadRequireJsCode(); |
|
| 38 | + }; |
|
| 39 | + return ''; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @return void |
|
| 44 | + */ |
|
| 45 | + protected function loadRequireJsCode() |
|
| 46 | + { |
|
| 47 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
| 48 | + |
|
| 49 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
| 50 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
| 51 | + $pageRenderer->loadRequireJsModule('Fab/Media/PluginFilePicker'); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | } |
@@ -24,142 +24,142 @@ |
||
| 24 | 24 | abstract class UploadedFileAbstract implements UploadedFileInterface |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 30 | - protected $uploadFolder; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var string |
|
| 34 | - */ |
|
| 35 | - protected $inputName; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 40 | - protected $name; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Get the file type. |
|
| 44 | - * |
|
| 45 | - * @return int |
|
| 46 | - */ |
|
| 47 | - public function getType() |
|
| 48 | - { |
|
| 49 | - $this->checkFileExistence(); |
|
| 50 | - |
|
| 51 | - // this basically extracts the mimetype and guess the filetype based |
|
| 52 | - // on the first part of the mimetype works for 99% of all cases, and |
|
| 53 | - // we don't need to make an SQL statement like EXT:media does currently |
|
| 54 | - $mimeType = $this->getMimeType(); |
|
| 55 | - list($fileType) = explode('/', $mimeType); |
|
| 56 | - switch (strtolower($fileType)) { |
|
| 57 | - case 'text': |
|
| 58 | - $type = File::FILETYPE_TEXT; |
|
| 59 | - break; |
|
| 60 | - case 'image': |
|
| 61 | - $type = File::FILETYPE_IMAGE; |
|
| 62 | - break; |
|
| 63 | - case 'audio': |
|
| 64 | - $type = File::FILETYPE_AUDIO; |
|
| 65 | - break; |
|
| 66 | - case 'video': |
|
| 67 | - $type = File::FILETYPE_VIDEO; |
|
| 68 | - break; |
|
| 69 | - case 'application': |
|
| 70 | - case 'software': |
|
| 71 | - $type = File::FILETYPE_APPLICATION; |
|
| 72 | - break; |
|
| 73 | - default: |
|
| 74 | - $type = File::FILETYPE_UNKNOWN; |
|
| 75 | - } |
|
| 76 | - return $type; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Get the file with its absolute path. |
|
| 81 | - * |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - public function getFileWithAbsolutePath() |
|
| 85 | - { |
|
| 86 | - return $this->uploadFolder . DIRECTORY_SEPARATOR . $this->name; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Get the file's public URL. |
|
| 91 | - * |
|
| 92 | - * @return string |
|
| 93 | - */ |
|
| 94 | - public function getPublicUrl() |
|
| 95 | - { |
|
| 96 | - $fileNameAndPath = str_replace(PATH_site, '', $this->getFileWithAbsolutePath()); |
|
| 97 | - return '/' . ltrim($fileNameAndPath, '/'); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - public function getInputName() |
|
| 104 | - { |
|
| 105 | - return $this->inputName; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @param string $inputName |
|
| 110 | - * @return UploadedFileInterface |
|
| 111 | - */ |
|
| 112 | - public function setInputName($inputName) |
|
| 113 | - { |
|
| 114 | - $this->inputName = $inputName; |
|
| 115 | - return $this; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * @return string |
|
| 120 | - */ |
|
| 121 | - public function getUploadFolder() |
|
| 122 | - { |
|
| 123 | - return $this->uploadFolder; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * @param string $uploadFolder |
|
| 128 | - * @return UploadedFileInterface |
|
| 129 | - */ |
|
| 130 | - public function setUploadFolder($uploadFolder) |
|
| 131 | - { |
|
| 132 | - $this->uploadFolder = $uploadFolder; |
|
| 133 | - return $this; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @return string |
|
| 138 | - */ |
|
| 139 | - public function getName() |
|
| 140 | - { |
|
| 141 | - return $this->name; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - /** |
|
| 145 | - * @param string $name |
|
| 146 | - * @return UploadedFileInterface |
|
| 147 | - */ |
|
| 148 | - public function setName($name) |
|
| 149 | - { |
|
| 150 | - $this->name = $name; |
|
| 151 | - return $this; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Check whether the file exists. |
|
| 156 | - */ |
|
| 157 | - protected function checkFileExistence() |
|
| 158 | - { |
|
| 159 | - if (!is_file($this->getFileWithAbsolutePath())) { |
|
| 160 | - $message = sprintf('File not found at "%s". Did you save it?', $this->getFileWithAbsolutePath()); |
|
| 161 | - throw new MissingFileException($message, 1361786958); |
|
| 162 | - } |
|
| 163 | - } |
|
| 27 | + /** |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | + protected $uploadFolder; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | + protected $inputName; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | + protected $name; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Get the file type. |
|
| 44 | + * |
|
| 45 | + * @return int |
|
| 46 | + */ |
|
| 47 | + public function getType() |
|
| 48 | + { |
|
| 49 | + $this->checkFileExistence(); |
|
| 50 | + |
|
| 51 | + // this basically extracts the mimetype and guess the filetype based |
|
| 52 | + // on the first part of the mimetype works for 99% of all cases, and |
|
| 53 | + // we don't need to make an SQL statement like EXT:media does currently |
|
| 54 | + $mimeType = $this->getMimeType(); |
|
| 55 | + list($fileType) = explode('/', $mimeType); |
|
| 56 | + switch (strtolower($fileType)) { |
|
| 57 | + case 'text': |
|
| 58 | + $type = File::FILETYPE_TEXT; |
|
| 59 | + break; |
|
| 60 | + case 'image': |
|
| 61 | + $type = File::FILETYPE_IMAGE; |
|
| 62 | + break; |
|
| 63 | + case 'audio': |
|
| 64 | + $type = File::FILETYPE_AUDIO; |
|
| 65 | + break; |
|
| 66 | + case 'video': |
|
| 67 | + $type = File::FILETYPE_VIDEO; |
|
| 68 | + break; |
|
| 69 | + case 'application': |
|
| 70 | + case 'software': |
|
| 71 | + $type = File::FILETYPE_APPLICATION; |
|
| 72 | + break; |
|
| 73 | + default: |
|
| 74 | + $type = File::FILETYPE_UNKNOWN; |
|
| 75 | + } |
|
| 76 | + return $type; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Get the file with its absolute path. |
|
| 81 | + * |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + public function getFileWithAbsolutePath() |
|
| 85 | + { |
|
| 86 | + return $this->uploadFolder . DIRECTORY_SEPARATOR . $this->name; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Get the file's public URL. |
|
| 91 | + * |
|
| 92 | + * @return string |
|
| 93 | + */ |
|
| 94 | + public function getPublicUrl() |
|
| 95 | + { |
|
| 96 | + $fileNameAndPath = str_replace(PATH_site, '', $this->getFileWithAbsolutePath()); |
|
| 97 | + return '/' . ltrim($fileNameAndPath, '/'); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + public function getInputName() |
|
| 104 | + { |
|
| 105 | + return $this->inputName; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @param string $inputName |
|
| 110 | + * @return UploadedFileInterface |
|
| 111 | + */ |
|
| 112 | + public function setInputName($inputName) |
|
| 113 | + { |
|
| 114 | + $this->inputName = $inputName; |
|
| 115 | + return $this; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * @return string |
|
| 120 | + */ |
|
| 121 | + public function getUploadFolder() |
|
| 122 | + { |
|
| 123 | + return $this->uploadFolder; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * @param string $uploadFolder |
|
| 128 | + * @return UploadedFileInterface |
|
| 129 | + */ |
|
| 130 | + public function setUploadFolder($uploadFolder) |
|
| 131 | + { |
|
| 132 | + $this->uploadFolder = $uploadFolder; |
|
| 133 | + return $this; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @return string |
|
| 138 | + */ |
|
| 139 | + public function getName() |
|
| 140 | + { |
|
| 141 | + return $this->name; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * @param string $name |
|
| 146 | + * @return UploadedFileInterface |
|
| 147 | + */ |
|
| 148 | + public function setName($name) |
|
| 149 | + { |
|
| 150 | + $this->name = $name; |
|
| 151 | + return $this; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Check whether the file exists. |
|
| 156 | + */ |
|
| 157 | + protected function checkFileExistence() |
|
| 158 | + { |
|
| 159 | + if (!is_file($this->getFileWithAbsolutePath())) { |
|
| 160 | + $message = sprintf('File not found at "%s". Did you save it?', $this->getFileWithAbsolutePath()); |
|
| 161 | + throw new MissingFileException($message, 1361786958); |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | 165 | } |
@@ -2,9 +2,9 @@ |
||
| 2 | 2 | if (!defined('TYPO3_MODE')) die ('Access denied.'); |
| 3 | 3 | |
| 4 | 4 | $tca = [ |
| 5 | - 'ctrl' => [ |
|
| 6 | - 'rootLevel' => -1, // Otherwise File Reference will not work between files. |
|
| 7 | - ], |
|
| 5 | + 'ctrl' => [ |
|
| 6 | + 'rootLevel' => -1, // Otherwise File Reference will not work between files. |
|
| 7 | + ], |
|
| 8 | 8 | ]; |
| 9 | 9 | |
| 10 | 10 | // Disable the File Upload in IRRE since it can not be configured the target storage. |
@@ -19,41 +19,41 @@ |
||
| 19 | 19 | class ImageEditorController extends ActionController |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var \TYPO3\CMS\Core\Page\PageRenderer |
|
| 24 | - * @inject |
|
| 25 | - */ |
|
| 26 | - protected $pageRenderer; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Initializes the controller before invoking an action method. |
|
| 30 | - */ |
|
| 31 | - public function initializeAction() |
|
| 32 | - { |
|
| 33 | - $this->pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
| 34 | - |
|
| 35 | - // Configure property mapping to retrieve the file object. |
|
| 36 | - if ($this->arguments->hasArgument('file')) { |
|
| 37 | - |
|
| 38 | - /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 39 | - $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 40 | - |
|
| 41 | - $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 42 | - $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Handle GUI for inserting an image in the RTE. |
|
| 48 | - * |
|
| 49 | - * @param File $file |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function showAction(File $file) |
|
| 53 | - { |
|
| 54 | - $this->view->assign('file', $file); |
|
| 55 | - $moduleSignature = MediaModule::getSignature(); |
|
| 56 | - $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
| 57 | - } |
|
| 22 | + /** |
|
| 23 | + * @var \TYPO3\CMS\Core\Page\PageRenderer |
|
| 24 | + * @inject |
|
| 25 | + */ |
|
| 26 | + protected $pageRenderer; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Initializes the controller before invoking an action method. |
|
| 30 | + */ |
|
| 31 | + public function initializeAction() |
|
| 32 | + { |
|
| 33 | + $this->pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
| 34 | + |
|
| 35 | + // Configure property mapping to retrieve the file object. |
|
| 36 | + if ($this->arguments->hasArgument('file')) { |
|
| 37 | + |
|
| 38 | + /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
| 39 | + $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
| 40 | + |
|
| 41 | + $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
| 42 | + $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Handle GUI for inserting an image in the RTE. |
|
| 48 | + * |
|
| 49 | + * @param File $file |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function showAction(File $file) |
|
| 53 | + { |
|
| 54 | + $this->view->assign('file', $file); |
|
| 55 | + $moduleSignature = MediaModule::getSignature(); |
|
| 56 | + $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | } |