@@ -21,37 +21,37 @@ |
||
21 | 21 | class ImageEditorController extends ActionController |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Initializes the controller before invoking an action method. |
|
26 | - */ |
|
27 | - public function initializeAction() |
|
28 | - { |
|
29 | - /** @var PageRenderer $pageRenderer */ |
|
30 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
31 | - $pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
32 | - |
|
33 | - // Configure property mapping to retrieve the file object. |
|
34 | - if ($this->arguments->hasArgument('file')) { |
|
35 | - |
|
36 | - /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
37 | - $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
38 | - |
|
39 | - $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
40 | - $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Handle GUI for inserting an image in the RTE. |
|
46 | - * |
|
47 | - * @param File $file |
|
48 | - * @return void |
|
49 | - */ |
|
50 | - public function showAction(File $file) |
|
51 | - { |
|
52 | - $this->view->assign('file', $file); |
|
53 | - $moduleSignature = MediaModule::getSignature(); |
|
54 | - $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
55 | - } |
|
24 | + /** |
|
25 | + * Initializes the controller before invoking an action method. |
|
26 | + */ |
|
27 | + public function initializeAction() |
|
28 | + { |
|
29 | + /** @var PageRenderer $pageRenderer */ |
|
30 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
31 | + $pageRenderer->addInlineLanguageLabelFile('EXT:media/Resources/Private/Language/locallang.xlf'); |
|
32 | + |
|
33 | + // Configure property mapping to retrieve the file object. |
|
34 | + if ($this->arguments->hasArgument('file')) { |
|
35 | + |
|
36 | + /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
37 | + $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
38 | + |
|
39 | + $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
40 | + $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Handle GUI for inserting an image in the RTE. |
|
46 | + * |
|
47 | + * @param File $file |
|
48 | + * @return void |
|
49 | + */ |
|
50 | + public function showAction(File $file) |
|
51 | + { |
|
52 | + $this->view->assign('file', $file); |
|
53 | + $moduleSignature = MediaModule::getSignature(); |
|
54 | + $this->view->assign('moduleUrl', BackendUtility::getModuleUrl($moduleSignature)); |
|
55 | + } |
|
56 | 56 | |
57 | 57 | } |
@@ -19,44 +19,44 @@ discard block |
||
19 | 19 | class RecursiveCheckbox extends AbstractComponentView |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Renders a checkbox for recursive file browsing. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - * @throws \InvalidArgumentException |
|
27 | - */ |
|
28 | - public function render() |
|
29 | - { |
|
22 | + /** |
|
23 | + * Renders a checkbox for recursive file browsing. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + * @throws \InvalidArgumentException |
|
27 | + */ |
|
28 | + public function render() |
|
29 | + { |
|
30 | 30 | |
31 | - $output = ''; |
|
32 | - if ($this->isDisplayed()) { |
|
33 | - $this->loadRequireJsCode(); |
|
34 | - $output = $this->renderRecursiveCheckbox(); |
|
35 | - } |
|
31 | + $output = ''; |
|
32 | + if ($this->isDisplayed()) { |
|
33 | + $this->loadRequireJsCode(); |
|
34 | + $output = $this->renderRecursiveCheckbox(); |
|
35 | + } |
|
36 | 36 | |
37 | - return $output; |
|
38 | - } |
|
37 | + return $output; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string |
|
42 | - * @throws \InvalidArgumentException |
|
43 | - */ |
|
44 | - protected function isDisplayed() |
|
45 | - { |
|
46 | - $isDisplayed = $this->getMediaModule()->hasFolderTree(); |
|
47 | - if ($this->getModuleLoader()->hasPlugin()) { |
|
48 | - $isDisplayed = false; |
|
49 | - } |
|
50 | - return $isDisplayed; |
|
51 | - } |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + * @throws \InvalidArgumentException |
|
43 | + */ |
|
44 | + protected function isDisplayed() |
|
45 | + { |
|
46 | + $isDisplayed = $this->getMediaModule()->hasFolderTree(); |
|
47 | + if ($this->getModuleLoader()->hasPlugin()) { |
|
48 | + $isDisplayed = false; |
|
49 | + } |
|
50 | + return $isDisplayed; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - protected function renderRecursiveCheckbox() |
|
57 | - { |
|
53 | + /** |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + protected function renderRecursiveCheckbox() |
|
57 | + { |
|
58 | 58 | |
59 | - $template = '<form action="%s" id="form-checkbox-hasRecursiveSelection" method="get"> |
|
59 | + $template = '<form action="%s" id="form-checkbox-hasRecursiveSelection" method="get"> |
|
60 | 60 | <label> |
61 | 61 | <input type="checkbox" |
62 | 62 | name="%s[hasRecursiveSelection]" |
@@ -67,35 +67,35 @@ discard block |
||
67 | 67 | </label> |
68 | 68 | </form>'; |
69 | 69 | |
70 | - return sprintf( |
|
71 | - $template, |
|
72 | - $this->getModuleLoader()->getModuleUrl(), |
|
73 | - $this->getModuleLoader()->getParameterPrefix(), |
|
74 | - $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:browse_subfolders') |
|
75 | - ); |
|
76 | - } |
|
70 | + return sprintf( |
|
71 | + $template, |
|
72 | + $this->getModuleLoader()->getModuleUrl(), |
|
73 | + $this->getModuleLoader()->getParameterPrefix(), |
|
74 | + $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:browse_subfolders') |
|
75 | + ); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @return void |
|
80 | - * @throws \InvalidArgumentException |
|
81 | - */ |
|
82 | - protected function loadRequireJsCode() |
|
83 | - { |
|
84 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
78 | + /** |
|
79 | + * @return void |
|
80 | + * @throws \InvalidArgumentException |
|
81 | + */ |
|
82 | + protected function loadRequireJsCode() |
|
83 | + { |
|
84 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
85 | 85 | |
86 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
87 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
88 | - $pageRenderer->loadRequireJsModule('Fab/Media/BrowseRecursively'); |
|
89 | - } |
|
86 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
87 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
88 | + $pageRenderer->loadRequireJsModule('Fab/Media/BrowseRecursively'); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * @return MediaModule|object |
|
94 | - * @throws \InvalidArgumentException |
|
95 | - */ |
|
96 | - protected function getMediaModule() |
|
97 | - { |
|
98 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
99 | - } |
|
92 | + /** |
|
93 | + * @return MediaModule|object |
|
94 | + * @throws \InvalidArgumentException |
|
95 | + */ |
|
96 | + protected function getMediaModule() |
|
97 | + { |
|
98 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
@@ -19,120 +19,120 @@ |
||
19 | 19 | class StorageMenu extends AbstractComponentView |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Renders a dropdown menu for storage. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function render() |
|
28 | - { |
|
29 | - |
|
30 | - $output = ''; |
|
31 | - if ($this->isDisplayed()) { |
|
32 | - $this->loadRequireJsCode(); |
|
33 | - |
|
34 | - $output = $this->renderStorageMenu(); |
|
35 | - } |
|
36 | - |
|
37 | - return $output; |
|
38 | - } |
|
39 | - |
|
40 | - /** |
|
41 | - * @return string |
|
42 | - */ |
|
43 | - protected function isDisplayed() |
|
44 | - { |
|
45 | - $isDisplayed = !$this->getMediaModule()->hasFolderTree() || $this->getModuleLoader()->hasPlugin(); |
|
46 | - return $isDisplayed; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - protected function renderStorageMenu() |
|
53 | - { |
|
54 | - |
|
55 | - $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
56 | - |
|
57 | - /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */ |
|
58 | - $options = ''; |
|
59 | - foreach ($this->getMediaModule()->getAllowedStorages() as $storage) { |
|
60 | - $selected = ''; |
|
61 | - if ($currentStorage->getUid() == $storage->getUid()) { |
|
62 | - $selected = 'selected'; |
|
63 | - } |
|
64 | - $options .= sprintf('<option value="%s" %s>%s %s</option>', |
|
65 | - $storage->getUid(), |
|
66 | - $selected, |
|
67 | - $storage->getName(), |
|
68 | - $storage->isOnline() ? |
|
69 | - '' : |
|
70 | - '(' . $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline') . ')' |
|
71 | - ); |
|
72 | - } |
|
73 | - |
|
74 | - $parameters = GeneralUtility::_GET(); |
|
75 | - $inputs = ''; |
|
76 | - foreach ($parameters as $parameter => $value) { |
|
77 | - list($parameter, $value) = $this->computeParameterAndValue($parameter, $value); |
|
78 | - if ($parameter !== $this->getModuleLoader()->getParameterPrefix() . '[storage]') { |
|
79 | - $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value); |
|
80 | - } |
|
81 | - } |
|
82 | - |
|
83 | - $template = '<form action="%s" id="form-menu-storage" method="get"> |
|
22 | + /** |
|
23 | + * Renders a dropdown menu for storage. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function render() |
|
28 | + { |
|
29 | + |
|
30 | + $output = ''; |
|
31 | + if ($this->isDisplayed()) { |
|
32 | + $this->loadRequireJsCode(); |
|
33 | + |
|
34 | + $output = $this->renderStorageMenu(); |
|
35 | + } |
|
36 | + |
|
37 | + return $output; |
|
38 | + } |
|
39 | + |
|
40 | + /** |
|
41 | + * @return string |
|
42 | + */ |
|
43 | + protected function isDisplayed() |
|
44 | + { |
|
45 | + $isDisplayed = !$this->getMediaModule()->hasFolderTree() || $this->getModuleLoader()->hasPlugin(); |
|
46 | + return $isDisplayed; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + protected function renderStorageMenu() |
|
53 | + { |
|
54 | + |
|
55 | + $currentStorage = $this->getMediaModule()->getCurrentStorage(); |
|
56 | + |
|
57 | + /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */ |
|
58 | + $options = ''; |
|
59 | + foreach ($this->getMediaModule()->getAllowedStorages() as $storage) { |
|
60 | + $selected = ''; |
|
61 | + if ($currentStorage->getUid() == $storage->getUid()) { |
|
62 | + $selected = 'selected'; |
|
63 | + } |
|
64 | + $options .= sprintf('<option value="%s" %s>%s %s</option>', |
|
65 | + $storage->getUid(), |
|
66 | + $selected, |
|
67 | + $storage->getName(), |
|
68 | + $storage->isOnline() ? |
|
69 | + '' : |
|
70 | + '(' . $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline') . ')' |
|
71 | + ); |
|
72 | + } |
|
73 | + |
|
74 | + $parameters = GeneralUtility::_GET(); |
|
75 | + $inputs = ''; |
|
76 | + foreach ($parameters as $parameter => $value) { |
|
77 | + list($parameter, $value) = $this->computeParameterAndValue($parameter, $value); |
|
78 | + if ($parameter !== $this->getModuleLoader()->getParameterPrefix() . '[storage]') { |
|
79 | + $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value); |
|
80 | + } |
|
81 | + } |
|
82 | + |
|
83 | + $template = '<form action="%s" id="form-menu-storage" method="get"> |
|
84 | 84 | %s |
85 | 85 | <select name="%s[storage]" class="form-control" style="padding-right: 20px" id="menu-storage" onchange="$(\'#form-menu-storage\').submit()">%s</select> |
86 | 86 | </form>'; |
87 | 87 | |
88 | - return sprintf( |
|
89 | - $template, |
|
90 | - $this->getModuleLoader()->getModuleUrl(), |
|
91 | - $inputs, |
|
92 | - $this->getModuleLoader()->getParameterPrefix(), |
|
93 | - $options |
|
94 | - ); |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * @return void |
|
99 | - */ |
|
100 | - protected function loadRequireJsCode() |
|
101 | - { |
|
102 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
103 | - |
|
104 | - $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
105 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
106 | - $pageRenderer->loadRequireJsModule('Fab/Media/EditStorage'); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Compute parameter and value to be correctly encoded by the browser. |
|
111 | - * |
|
112 | - * @param string $parameter |
|
113 | - * @param mixed $value |
|
114 | - * @return array |
|
115 | - */ |
|
116 | - protected function computeParameterAndValue($parameter, $value) |
|
117 | - { |
|
118 | - |
|
119 | - if (is_string($value)) { |
|
120 | - $result = array($parameter, $value); |
|
121 | - } else { |
|
122 | - $key = key($value); |
|
123 | - $value = current($value); |
|
124 | - $parameter = sprintf('%s[%s]', $parameter, $key); |
|
125 | - $result = $this->computeParameterAndValue($parameter, $value); |
|
126 | - } |
|
127 | - return $result; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @return MediaModule|object |
|
132 | - */ |
|
133 | - protected function getMediaModule() |
|
134 | - { |
|
135 | - return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
136 | - } |
|
88 | + return sprintf( |
|
89 | + $template, |
|
90 | + $this->getModuleLoader()->getModuleUrl(), |
|
91 | + $inputs, |
|
92 | + $this->getModuleLoader()->getParameterPrefix(), |
|
93 | + $options |
|
94 | + ); |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * @return void |
|
99 | + */ |
|
100 | + protected function loadRequireJsCode() |
|
101 | + { |
|
102 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
103 | + |
|
104 | + $configuration['paths']['Fab/Media'] = '../typo3conf/ext/media/Resources/Public/JavaScript'; |
|
105 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
106 | + $pageRenderer->loadRequireJsModule('Fab/Media/EditStorage'); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Compute parameter and value to be correctly encoded by the browser. |
|
111 | + * |
|
112 | + * @param string $parameter |
|
113 | + * @param mixed $value |
|
114 | + * @return array |
|
115 | + */ |
|
116 | + protected function computeParameterAndValue($parameter, $value) |
|
117 | + { |
|
118 | + |
|
119 | + if (is_string($value)) { |
|
120 | + $result = array($parameter, $value); |
|
121 | + } else { |
|
122 | + $key = key($value); |
|
123 | + $value = current($value); |
|
124 | + $parameter = sprintf('%s[%s]', $parameter, $key); |
|
125 | + $result = $this->computeParameterAndValue($parameter, $value); |
|
126 | + } |
|
127 | + return $result; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @return MediaModule|object |
|
132 | + */ |
|
133 | + protected function getMediaModule() |
|
134 | + { |
|
135 | + return GeneralUtility::makeInstance(\Fab\Media\Module\MediaModule::class); |
|
136 | + } |
|
137 | 137 | |
138 | 138 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | $selected, |
67 | 67 | $storage->getName(), |
68 | 68 | $storage->isOnline() ? |
69 | - '' : |
|
70 | - '(' . $this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline') . ')' |
|
69 | + '' : '('.$this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:offline').')' |
|
71 | 70 | ); |
72 | 71 | } |
73 | 72 | |
@@ -75,7 +74,7 @@ discard block |
||
75 | 74 | $inputs = ''; |
76 | 75 | foreach ($parameters as $parameter => $value) { |
77 | 76 | list($parameter, $value) = $this->computeParameterAndValue($parameter, $value); |
78 | - if ($parameter !== $this->getModuleLoader()->getParameterPrefix() . '[storage]') { |
|
77 | + if ($parameter !== $this->getModuleLoader()->getParameterPrefix().'[storage]') { |
|
79 | 78 | $inputs .= sprintf('<input type="hidden" name="%s" value="%s" />', $parameter, $value); |
80 | 79 | } |
81 | 80 | } |