@@ -20,45 +20,45 @@ |
||
20 | 20 | class DownloadButton extends AbstractComponentView |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Renders a "download" button to be placed in the grid. |
|
25 | - * |
|
26 | - * @param Content $object |
|
27 | - * @return string |
|
28 | - * @throws \InvalidArgumentException |
|
29 | - */ |
|
30 | - public function render(Content $object = null) |
|
31 | - { |
|
23 | + /** |
|
24 | + * Renders a "download" button to be placed in the grid. |
|
25 | + * |
|
26 | + * @param Content $object |
|
27 | + * @return string |
|
28 | + * @throws \InvalidArgumentException |
|
29 | + */ |
|
30 | + public function render(Content $object = null) |
|
31 | + { |
|
32 | 32 | |
33 | - $button = $this->makeLinkButton() |
|
34 | - ->setHref($this->getDownloadUri($object)) |
|
35 | - ->setDataAttributes([ |
|
36 | - 'uid' => $object->getUid(), |
|
37 | - 'toggle' => 'tooltip', |
|
38 | - ]) |
|
39 | - ->setClasses('btn-download') |
|
40 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:download')) |
|
41 | - ->setIcon($this->getIconFactory()->getIcon('actions-system-extension-download', Icon::SIZE_SMALL)) |
|
42 | - ->render(); |
|
33 | + $button = $this->makeLinkButton() |
|
34 | + ->setHref($this->getDownloadUri($object)) |
|
35 | + ->setDataAttributes([ |
|
36 | + 'uid' => $object->getUid(), |
|
37 | + 'toggle' => 'tooltip', |
|
38 | + ]) |
|
39 | + ->setClasses('btn-download') |
|
40 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:download')) |
|
41 | + ->setIcon($this->getIconFactory()->getIcon('actions-system-extension-download', Icon::SIZE_SMALL)) |
|
42 | + ->render(); |
|
43 | 43 | |
44 | - return $button; |
|
45 | - } |
|
44 | + return $button; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param Content $object |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - protected function getDownloadUri(Content $object) |
|
52 | - { |
|
53 | - $urlParameters = [ |
|
54 | - MediaModule::getParameterPrefix() => [ |
|
55 | - 'controller' => 'Asset', |
|
56 | - 'action' => 'download', |
|
57 | - 'forceDownload' => true, |
|
58 | - 'file' => $object->getUid(), |
|
59 | - ], |
|
60 | - ]; |
|
61 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
62 | - } |
|
47 | + /** |
|
48 | + * @param Content $object |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + protected function getDownloadUri(Content $object) |
|
52 | + { |
|
53 | + $urlParameters = [ |
|
54 | + MediaModule::getParameterPrefix() => [ |
|
55 | + 'controller' => 'Asset', |
|
56 | + 'action' => 'download', |
|
57 | + 'forceDownload' => true, |
|
58 | + 'file' => $object->getUid(), |
|
59 | + ], |
|
60 | + ]; |
|
61 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
62 | + } |
|
63 | 63 | |
64 | 64 | } |
@@ -20,43 +20,43 @@ |
||
20 | 20 | class LinkCreatorButton extends AbstractComponentView |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Renders a "link-creator" button to be placed in the grid. |
|
25 | - * |
|
26 | - * @param Content $object |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function render(Content $object = null) |
|
30 | - { |
|
31 | - $button = ''; |
|
32 | - if ($this->getModuleLoader()->hasPlugin('linkCreator')) { |
|
33 | - $button = $this->makeLinkButton() |
|
34 | - ->setHref($this->getLinkCreatorUri($object)) |
|
35 | - ->setDataAttributes([ |
|
36 | - 'uid' => $object->getUid(), |
|
37 | - 'toggle' => 'tooltip', |
|
38 | - ]) |
|
39 | - ->setClasses('btn-linkCreator') |
|
40 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:create_link')) |
|
41 | - ->setIcon($this->getIconFactory()->getIcon('apps-pagetree-page-shortcut-external-root', Icon::SIZE_SMALL)) |
|
42 | - ->render(); |
|
43 | - } |
|
44 | - return $button; |
|
45 | - } |
|
23 | + /** |
|
24 | + * Renders a "link-creator" button to be placed in the grid. |
|
25 | + * |
|
26 | + * @param Content $object |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function render(Content $object = null) |
|
30 | + { |
|
31 | + $button = ''; |
|
32 | + if ($this->getModuleLoader()->hasPlugin('linkCreator')) { |
|
33 | + $button = $this->makeLinkButton() |
|
34 | + ->setHref($this->getLinkCreatorUri($object)) |
|
35 | + ->setDataAttributes([ |
|
36 | + 'uid' => $object->getUid(), |
|
37 | + 'toggle' => 'tooltip', |
|
38 | + ]) |
|
39 | + ->setClasses('btn-linkCreator') |
|
40 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:create_link')) |
|
41 | + ->setIcon($this->getIconFactory()->getIcon('apps-pagetree-page-shortcut-external-root', Icon::SIZE_SMALL)) |
|
42 | + ->render(); |
|
43 | + } |
|
44 | + return $button; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param Content $object |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - protected function getLinkCreatorUri(Content $object) |
|
52 | - { |
|
53 | - $urlParameters = array( |
|
54 | - MediaModule::getParameterPrefix() => array( |
|
55 | - 'controller' => 'LinkCreator', |
|
56 | - 'action' => 'show', |
|
57 | - 'file' => $object->getUid(), |
|
58 | - ), |
|
59 | - ); |
|
60 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
61 | - } |
|
47 | + /** |
|
48 | + * @param Content $object |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + protected function getLinkCreatorUri(Content $object) |
|
52 | + { |
|
53 | + $urlParameters = array( |
|
54 | + MediaModule::getParameterPrefix() => array( |
|
55 | + 'controller' => 'LinkCreator', |
|
56 | + 'action' => 'show', |
|
57 | + 'file' => $object->getUid(), |
|
58 | + ), |
|
59 | + ); |
|
60 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
61 | + } |
|
62 | 62 | } |
@@ -20,43 +20,43 @@ |
||
20 | 20 | class ImageEditorButton extends AbstractComponentView |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Renders a "image-editor" button to be placed in the grid. |
|
25 | - * |
|
26 | - * @param Content $object |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function render(Content $object = null) |
|
30 | - { |
|
31 | - $button = ''; |
|
32 | - if ($this->getModuleLoader()->hasPlugin('imageEditor')) { |
|
33 | - $button = $this->makeLinkButton() |
|
34 | - ->setHref($this->getImageEditorUri($object)) |
|
35 | - ->setDataAttributes([ |
|
36 | - 'uid' => $object->getUid(), |
|
37 | - 'toggle' => 'tooltip', |
|
38 | - ]) |
|
39 | - ->setClasses('btn-imageEditor') |
|
40 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_image')) |
|
41 | - ->setIcon($this->getIconFactory()->getIcon('extensions-media-image-edit', Icon::SIZE_SMALL)) |
|
42 | - ->render(); |
|
43 | - } |
|
44 | - return $button; |
|
45 | - } |
|
23 | + /** |
|
24 | + * Renders a "image-editor" button to be placed in the grid. |
|
25 | + * |
|
26 | + * @param Content $object |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function render(Content $object = null) |
|
30 | + { |
|
31 | + $button = ''; |
|
32 | + if ($this->getModuleLoader()->hasPlugin('imageEditor')) { |
|
33 | + $button = $this->makeLinkButton() |
|
34 | + ->setHref($this->getImageEditorUri($object)) |
|
35 | + ->setDataAttributes([ |
|
36 | + 'uid' => $object->getUid(), |
|
37 | + 'toggle' => 'tooltip', |
|
38 | + ]) |
|
39 | + ->setClasses('btn-imageEditor') |
|
40 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_image')) |
|
41 | + ->setIcon($this->getIconFactory()->getIcon('extensions-media-image-edit', Icon::SIZE_SMALL)) |
|
42 | + ->render(); |
|
43 | + } |
|
44 | + return $button; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param Content $object |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - protected function getImageEditorUri(Content $object) |
|
52 | - { |
|
53 | - $urlParameters = array( |
|
54 | - MediaModule::getParameterPrefix() => array( |
|
55 | - 'controller' => 'ImageEditor', |
|
56 | - 'action' => 'show', |
|
57 | - 'file' => $object->getUid(), |
|
58 | - ), |
|
59 | - ); |
|
60 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
61 | - } |
|
47 | + /** |
|
48 | + * @param Content $object |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + protected function getImageEditorUri(Content $object) |
|
52 | + { |
|
53 | + $urlParameters = array( |
|
54 | + MediaModule::getParameterPrefix() => array( |
|
55 | + 'controller' => 'ImageEditor', |
|
56 | + 'action' => 'show', |
|
57 | + 'file' => $object->getUid(), |
|
58 | + ), |
|
59 | + ); |
|
60 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
61 | + } |
|
62 | 62 | } |
@@ -20,44 +20,44 @@ |
||
20 | 20 | class FilePickerButton extends AbstractComponentView |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * Renders a "file-picker" button to be placed in the grid. |
|
25 | - * |
|
26 | - * @param Content $object |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function render(Content $object = null) |
|
30 | - { |
|
31 | - $button = ''; |
|
32 | - if ($this->getModuleLoader()->hasPlugin('filePicker')) { |
|
33 | - $button = $this->makeLinkButton() |
|
34 | - ->setHref($this->getFilePickerUri($object)) |
|
35 | - ->setDataAttributes([ |
|
36 | - 'uid' => $object->getUid(), |
|
37 | - 'toggle' => 'tooltip', |
|
38 | - ]) |
|
39 | - ->setClasses('btn-filePicker') |
|
40 | - ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_image')) |
|
41 | - ->setIcon($this->getIconFactory()->getIcon('extensions-media-image-export', Icon::SIZE_SMALL)) |
|
42 | - ->render(); |
|
23 | + /** |
|
24 | + * Renders a "file-picker" button to be placed in the grid. |
|
25 | + * |
|
26 | + * @param Content $object |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function render(Content $object = null) |
|
30 | + { |
|
31 | + $button = ''; |
|
32 | + if ($this->getModuleLoader()->hasPlugin('filePicker')) { |
|
33 | + $button = $this->makeLinkButton() |
|
34 | + ->setHref($this->getFilePickerUri($object)) |
|
35 | + ->setDataAttributes([ |
|
36 | + 'uid' => $object->getUid(), |
|
37 | + 'toggle' => 'tooltip', |
|
38 | + ]) |
|
39 | + ->setClasses('btn-filePicker') |
|
40 | + ->setTitle($this->getLanguageService()->sL('LLL:EXT:media/Resources/Private/Language/locallang.xlf:edit_image')) |
|
41 | + ->setIcon($this->getIconFactory()->getIcon('extensions-media-image-export', Icon::SIZE_SMALL)) |
|
42 | + ->render(); |
|
43 | 43 | |
44 | - } |
|
45 | - return $button; |
|
46 | - } |
|
44 | + } |
|
45 | + return $button; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param Content $object |
|
50 | - * @return string |
|
51 | - */ |
|
52 | - protected function getFilePickerUri(Content $object) |
|
53 | - { |
|
54 | - $urlParameters = array( |
|
55 | - MediaModule::getParameterPrefix() => array( |
|
56 | - 'controller' => 'Asset', |
|
57 | - 'action' => 'download', |
|
58 | - 'file' => $object->getUid(), |
|
59 | - ), |
|
60 | - ); |
|
61 | - return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
62 | - } |
|
48 | + /** |
|
49 | + * @param Content $object |
|
50 | + * @return string |
|
51 | + */ |
|
52 | + protected function getFilePickerUri(Content $object) |
|
53 | + { |
|
54 | + $urlParameters = array( |
|
55 | + MediaModule::getParameterPrefix() => array( |
|
56 | + 'controller' => 'Asset', |
|
57 | + 'action' => 'download', |
|
58 | + 'file' => $object->getUid(), |
|
59 | + ), |
|
60 | + ); |
|
61 | + return BackendUtility::getModuleUrl(MediaModule::getSignature(), $urlParameters); |
|
62 | + } |
|
63 | 63 | } |
@@ -23,248 +23,248 @@ |
||
23 | 23 | class ActionPermissionFacet implements FacetInterface |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $name = '__action_permission'; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - protected $label = 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permission'; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var array |
|
38 | - */ |
|
39 | - protected $suggestions = array( |
|
40 | - 'r' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:facet.read_only', |
|
41 | - 'w' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:facet.write', |
|
42 | - ); |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $fieldNameAndPath = ''; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - protected $dataType; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var bool |
|
56 | - */ |
|
57 | - protected $canModifyMatcher = false; |
|
58 | - |
|
59 | - /** |
|
60 | - * Constructor of a Generic Facet in Vidi. |
|
61 | - * |
|
62 | - * @param string $name |
|
63 | - * @param string $label |
|
64 | - * @param array $suggestions |
|
65 | - * @param string $fieldNameAndPath |
|
66 | - */ |
|
67 | - public function __construct($name = '', $label = '', array $suggestions = [], $fieldNameAndPath = '') |
|
68 | - { |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @return string |
|
73 | - */ |
|
74 | - public function getName() |
|
75 | - { |
|
76 | - return $this->name; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function getLabel() |
|
83 | - { |
|
84 | - return $this->getLanguageService()->sL($this->label); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @return array |
|
89 | - */ |
|
90 | - public function getSuggestions() |
|
91 | - { |
|
92 | - $suggestions = []; |
|
93 | - foreach ($this->suggestions as $key => $label) { |
|
94 | - $suggestions[] = array($key => $this->getLanguageService()->sL($label)); |
|
95 | - } |
|
96 | - |
|
97 | - return $suggestions; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function hasSuggestions() |
|
104 | - { |
|
105 | - return true; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @param string $dataType |
|
110 | - * @return $this |
|
111 | - */ |
|
112 | - public function setDataType($dataType) |
|
113 | - { |
|
114 | - $this->dataType = $dataType; |
|
115 | - return $this; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - public function canModifyMatcher() |
|
122 | - { |
|
123 | - return $this->canModifyMatcher; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @param Matcher $matcher |
|
128 | - * @param $value |
|
129 | - * @return Matcher |
|
130 | - */ |
|
131 | - public function modifyMatcher(Matcher $matcher, $value) |
|
132 | - { |
|
133 | - return $matcher; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @param AfterFindContentObjectsSignalArguments $signalArguments |
|
138 | - * @return array |
|
139 | - */ |
|
140 | - public function modifyResultSet(AfterFindContentObjectsSignalArguments $signalArguments) |
|
141 | - { |
|
142 | - |
|
143 | - if ($signalArguments->getDataType() === 'sys_file') { |
|
144 | - |
|
145 | - $queryParts = $this->getQueryParts(); |
|
146 | - |
|
147 | - if (!empty($queryParts)) { |
|
148 | - $permission = $this->getPermissionValue($queryParts); |
|
149 | - |
|
150 | - if ($permission) { |
|
151 | - |
|
152 | - // We are force to query the content repository again here without limit |
|
153 | - $matcher = $signalArguments->getMatcher(); |
|
154 | - $order = $signalArguments->getOrder(); |
|
155 | - $objects = ContentRepositoryFactory::getInstance($this->dataType)->findBy($matcher, $order); |
|
156 | - |
|
157 | - $filteredObjects = []; |
|
158 | - foreach ($objects as $object) { |
|
159 | - |
|
160 | - $file = $this->getFileConverter()->convert($object->getUid()); |
|
161 | - if ($permission === 'read' && !$file->checkActionPermission('write')) { |
|
162 | - $filteredObjects[] = $object; |
|
163 | - } elseif ($permission === 'write' && $file->checkActionPermission('write')) { |
|
164 | - $filteredObjects[] = $object; |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - // Only take part of the array according to offset and limit. |
|
169 | - $offset = $signalArguments->getOffset(); |
|
170 | - $limit = $signalArguments->getLimit(); |
|
171 | - $signalArguments->setContentObjects(array_slice($filteredObjects, $offset, $limit)); |
|
172 | - |
|
173 | - // Count number of records |
|
174 | - $signalArguments->setNumberOfObjects(count($filteredObjects)); |
|
175 | - $signalArguments->setHasBeenProcessed(true); |
|
176 | - } |
|
177 | - } |
|
178 | - } |
|
179 | - |
|
180 | - return array($signalArguments); |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * @return array |
|
185 | - */ |
|
186 | - protected function getQueryParts() |
|
187 | - { |
|
188 | - |
|
189 | - // Transmit recursive selection parameter. |
|
190 | - $parameterPrefix = $this->getModuleLoader()->getParameterPrefix(); |
|
191 | - $parameters = GeneralUtility::_GP($parameterPrefix); |
|
192 | - |
|
193 | - $queryParts = []; |
|
194 | - if (!empty($parameters['searchTerm'])) { |
|
195 | - $query = rawurldecode($parameters['searchTerm']); |
|
196 | - $queryParts = json_decode($query, true); |
|
197 | - } |
|
198 | - |
|
199 | - return $queryParts; |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * Retrieve the search permission value. |
|
204 | - * |
|
205 | - * @param array $queryParts |
|
206 | - * @return string |
|
207 | - */ |
|
208 | - protected function getPermissionValue(array $queryParts) |
|
209 | - { |
|
210 | - $permission = ''; |
|
211 | - |
|
212 | - // Check also amongst labels. |
|
213 | - $labelReadOnly = $this->getLanguageService()->sL($this->suggestions['r']); |
|
214 | - $labelWrite = $this->getLanguageService()->sL($this->suggestions['w']); |
|
215 | - |
|
216 | - foreach ($queryParts as $queryPart) { |
|
217 | - $facetName = key($queryPart); |
|
218 | - $value = $queryPart[$facetName]; |
|
219 | - if ($facetName === $this->name) { |
|
220 | - |
|
221 | - if ($value === 'r' || $value === $labelReadOnly) { |
|
222 | - $permission = 'read'; |
|
223 | - } elseif ($value === 'w' || $value === $labelWrite) { |
|
224 | - $permission = 'write'; |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - return $permission; |
|
229 | - } |
|
230 | - |
|
231 | - /** |
|
232 | - * Magic method implementation for retrieving state. |
|
233 | - * |
|
234 | - * @param array $states |
|
235 | - * @return $this |
|
236 | - */ |
|
237 | - static public function __set_state($states) |
|
238 | - { |
|
239 | - return new ActionPermissionFacet($states['name'], $states['label'], $states['suggestions'], $states['fieldNameAndPath']); |
|
240 | - } |
|
241 | - |
|
242 | - /** |
|
243 | - * @return \TYPO3\CMS\Lang\LanguageService |
|
244 | - */ |
|
245 | - protected function getLanguageService() |
|
246 | - { |
|
247 | - return $GLOBALS['LANG']; |
|
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * @return ContentToFileConverter |
|
252 | - * @throws \InvalidArgumentException |
|
253 | - */ |
|
254 | - protected function getFileConverter() |
|
255 | - { |
|
256 | - return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
257 | - } |
|
258 | - |
|
259 | - /** |
|
260 | - * Get the Vidi Module Loader. |
|
261 | - * |
|
262 | - * @return ModuleLoader |
|
263 | - * @throws \InvalidArgumentException |
|
264 | - */ |
|
265 | - protected function getModuleLoader() |
|
266 | - { |
|
267 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
268 | - } |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $name = '__action_permission'; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + protected $label = 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permission'; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var array |
|
38 | + */ |
|
39 | + protected $suggestions = array( |
|
40 | + 'r' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:facet.read_only', |
|
41 | + 'w' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:facet.write', |
|
42 | + ); |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $fieldNameAndPath = ''; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + protected $dataType; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var bool |
|
56 | + */ |
|
57 | + protected $canModifyMatcher = false; |
|
58 | + |
|
59 | + /** |
|
60 | + * Constructor of a Generic Facet in Vidi. |
|
61 | + * |
|
62 | + * @param string $name |
|
63 | + * @param string $label |
|
64 | + * @param array $suggestions |
|
65 | + * @param string $fieldNameAndPath |
|
66 | + */ |
|
67 | + public function __construct($name = '', $label = '', array $suggestions = [], $fieldNameAndPath = '') |
|
68 | + { |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @return string |
|
73 | + */ |
|
74 | + public function getName() |
|
75 | + { |
|
76 | + return $this->name; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function getLabel() |
|
83 | + { |
|
84 | + return $this->getLanguageService()->sL($this->label); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @return array |
|
89 | + */ |
|
90 | + public function getSuggestions() |
|
91 | + { |
|
92 | + $suggestions = []; |
|
93 | + foreach ($this->suggestions as $key => $label) { |
|
94 | + $suggestions[] = array($key => $this->getLanguageService()->sL($label)); |
|
95 | + } |
|
96 | + |
|
97 | + return $suggestions; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + public function hasSuggestions() |
|
104 | + { |
|
105 | + return true; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @param string $dataType |
|
110 | + * @return $this |
|
111 | + */ |
|
112 | + public function setDataType($dataType) |
|
113 | + { |
|
114 | + $this->dataType = $dataType; |
|
115 | + return $this; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + public function canModifyMatcher() |
|
122 | + { |
|
123 | + return $this->canModifyMatcher; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @param Matcher $matcher |
|
128 | + * @param $value |
|
129 | + * @return Matcher |
|
130 | + */ |
|
131 | + public function modifyMatcher(Matcher $matcher, $value) |
|
132 | + { |
|
133 | + return $matcher; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @param AfterFindContentObjectsSignalArguments $signalArguments |
|
138 | + * @return array |
|
139 | + */ |
|
140 | + public function modifyResultSet(AfterFindContentObjectsSignalArguments $signalArguments) |
|
141 | + { |
|
142 | + |
|
143 | + if ($signalArguments->getDataType() === 'sys_file') { |
|
144 | + |
|
145 | + $queryParts = $this->getQueryParts(); |
|
146 | + |
|
147 | + if (!empty($queryParts)) { |
|
148 | + $permission = $this->getPermissionValue($queryParts); |
|
149 | + |
|
150 | + if ($permission) { |
|
151 | + |
|
152 | + // We are force to query the content repository again here without limit |
|
153 | + $matcher = $signalArguments->getMatcher(); |
|
154 | + $order = $signalArguments->getOrder(); |
|
155 | + $objects = ContentRepositoryFactory::getInstance($this->dataType)->findBy($matcher, $order); |
|
156 | + |
|
157 | + $filteredObjects = []; |
|
158 | + foreach ($objects as $object) { |
|
159 | + |
|
160 | + $file = $this->getFileConverter()->convert($object->getUid()); |
|
161 | + if ($permission === 'read' && !$file->checkActionPermission('write')) { |
|
162 | + $filteredObjects[] = $object; |
|
163 | + } elseif ($permission === 'write' && $file->checkActionPermission('write')) { |
|
164 | + $filteredObjects[] = $object; |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + // Only take part of the array according to offset and limit. |
|
169 | + $offset = $signalArguments->getOffset(); |
|
170 | + $limit = $signalArguments->getLimit(); |
|
171 | + $signalArguments->setContentObjects(array_slice($filteredObjects, $offset, $limit)); |
|
172 | + |
|
173 | + // Count number of records |
|
174 | + $signalArguments->setNumberOfObjects(count($filteredObjects)); |
|
175 | + $signalArguments->setHasBeenProcessed(true); |
|
176 | + } |
|
177 | + } |
|
178 | + } |
|
179 | + |
|
180 | + return array($signalArguments); |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * @return array |
|
185 | + */ |
|
186 | + protected function getQueryParts() |
|
187 | + { |
|
188 | + |
|
189 | + // Transmit recursive selection parameter. |
|
190 | + $parameterPrefix = $this->getModuleLoader()->getParameterPrefix(); |
|
191 | + $parameters = GeneralUtility::_GP($parameterPrefix); |
|
192 | + |
|
193 | + $queryParts = []; |
|
194 | + if (!empty($parameters['searchTerm'])) { |
|
195 | + $query = rawurldecode($parameters['searchTerm']); |
|
196 | + $queryParts = json_decode($query, true); |
|
197 | + } |
|
198 | + |
|
199 | + return $queryParts; |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * Retrieve the search permission value. |
|
204 | + * |
|
205 | + * @param array $queryParts |
|
206 | + * @return string |
|
207 | + */ |
|
208 | + protected function getPermissionValue(array $queryParts) |
|
209 | + { |
|
210 | + $permission = ''; |
|
211 | + |
|
212 | + // Check also amongst labels. |
|
213 | + $labelReadOnly = $this->getLanguageService()->sL($this->suggestions['r']); |
|
214 | + $labelWrite = $this->getLanguageService()->sL($this->suggestions['w']); |
|
215 | + |
|
216 | + foreach ($queryParts as $queryPart) { |
|
217 | + $facetName = key($queryPart); |
|
218 | + $value = $queryPart[$facetName]; |
|
219 | + if ($facetName === $this->name) { |
|
220 | + |
|
221 | + if ($value === 'r' || $value === $labelReadOnly) { |
|
222 | + $permission = 'read'; |
|
223 | + } elseif ($value === 'w' || $value === $labelWrite) { |
|
224 | + $permission = 'write'; |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + return $permission; |
|
229 | + } |
|
230 | + |
|
231 | + /** |
|
232 | + * Magic method implementation for retrieving state. |
|
233 | + * |
|
234 | + * @param array $states |
|
235 | + * @return $this |
|
236 | + */ |
|
237 | + static public function __set_state($states) |
|
238 | + { |
|
239 | + return new ActionPermissionFacet($states['name'], $states['label'], $states['suggestions'], $states['fieldNameAndPath']); |
|
240 | + } |
|
241 | + |
|
242 | + /** |
|
243 | + * @return \TYPO3\CMS\Lang\LanguageService |
|
244 | + */ |
|
245 | + protected function getLanguageService() |
|
246 | + { |
|
247 | + return $GLOBALS['LANG']; |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * @return ContentToFileConverter |
|
252 | + * @throws \InvalidArgumentException |
|
253 | + */ |
|
254 | + protected function getFileConverter() |
|
255 | + { |
|
256 | + return GeneralUtility::makeInstance(ContentToFileConverter::class); |
|
257 | + } |
|
258 | + |
|
259 | + /** |
|
260 | + * Get the Vidi Module Loader. |
|
261 | + * |
|
262 | + * @return ModuleLoader |
|
263 | + * @throws \InvalidArgumentException |
|
264 | + */ |
|
265 | + protected function getModuleLoader() |
|
266 | + { |
|
267 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | } |
@@ -19,45 +19,45 @@ |
||
19 | 19 | class ProcessedFileController extends ActionController |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * Initializes the controller before invoking an action method. |
|
24 | - */ |
|
25 | - public function initializeAction() |
|
26 | - { |
|
27 | - |
|
28 | - // Configure property mapping to retrieve the file object. |
|
29 | - if ($this->arguments->hasArgument('file')) { |
|
30 | - |
|
31 | - /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
32 | - $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
33 | - |
|
34 | - $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
35 | - $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
36 | - } |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Create a processed file according to some configuration. |
|
41 | - * |
|
42 | - * @param File $file |
|
43 | - * @param array $processingConfiguration |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - public function createAction(File $file, array $processingConfiguration = []) |
|
47 | - { |
|
48 | - $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration); |
|
49 | - |
|
50 | - $response = array( |
|
51 | - 'success' => true, |
|
52 | - 'original' => $file->getUid(), |
|
53 | - 'title' => $file->getProperty('title') ? $file->getProperty('title') : $file->getName(), |
|
54 | - 'publicUrl' => $processedFile->getPublicUrl(), |
|
55 | - 'width' => $processedFile->getProperty('width'), |
|
56 | - 'height' => $processedFile->getProperty('height'), |
|
57 | - ); |
|
58 | - |
|
59 | - header("Content-Type: text/json"); |
|
60 | - return htmlspecialchars(json_encode($response), ENT_NOQUOTES); |
|
61 | - } |
|
22 | + /** |
|
23 | + * Initializes the controller before invoking an action method. |
|
24 | + */ |
|
25 | + public function initializeAction() |
|
26 | + { |
|
27 | + |
|
28 | + // Configure property mapping to retrieve the file object. |
|
29 | + if ($this->arguments->hasArgument('file')) { |
|
30 | + |
|
31 | + /** @var \Fab\Media\TypeConverter\FileConverter $typeConverter */ |
|
32 | + $typeConverter = $this->objectManager->get('Fab\Media\TypeConverter\FileConverter'); |
|
33 | + |
|
34 | + $propertyMappingConfiguration = $this->arguments->getArgument('file')->getPropertyMappingConfiguration(); |
|
35 | + $propertyMappingConfiguration->setTypeConverter($typeConverter); |
|
36 | + } |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Create a processed file according to some configuration. |
|
41 | + * |
|
42 | + * @param File $file |
|
43 | + * @param array $processingConfiguration |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + public function createAction(File $file, array $processingConfiguration = []) |
|
47 | + { |
|
48 | + $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration); |
|
49 | + |
|
50 | + $response = array( |
|
51 | + 'success' => true, |
|
52 | + 'original' => $file->getUid(), |
|
53 | + 'title' => $file->getProperty('title') ? $file->getProperty('title') : $file->getName(), |
|
54 | + 'publicUrl' => $processedFile->getPublicUrl(), |
|
55 | + 'width' => $processedFile->getProperty('width'), |
|
56 | + 'height' => $processedFile->getProperty('height'), |
|
57 | + ); |
|
58 | + |
|
59 | + header("Content-Type: text/json"); |
|
60 | + return htmlspecialchars(json_encode($response), ENT_NOQUOTES); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | // Only add like condition if needed. |
48 | 48 | if ($folder->getStorage()->getRootLevelFolder() !== $folder) { |
49 | - $matcher->like('identifier', $folder->getIdentifier() . '%', $automaticallyAddWildCard = false); |
|
49 | + $matcher->like('identifier', $folder->getIdentifier().'%', $automaticallyAddWildCard = false); |
|
50 | 50 | } |
51 | 51 | } else { |
52 | 52 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $collectedFiles = []; |
72 | 72 | foreach ($fileMounts as $fileMount) { |
73 | 73 | |
74 | - $combinedIdentifier = $fileMount['base'] . ':' . $fileMount['path']; |
|
74 | + $combinedIdentifier = $fileMount['base'].':'.$fileMount['path']; |
|
75 | 75 | $folder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); |
76 | 76 | |
77 | 77 | $files = $this->getFileUids($folder); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | if ($fileMountRecord['path']) { |
184 | 184 | $constraintsRespectingFileMounts[] = $query->like( |
185 | 185 | 'identifier', |
186 | - $fileMountRecord['path'] . '%' |
|
186 | + $fileMountRecord['path'].'%' |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | } |
@@ -27,207 +27,207 @@ |
||
27 | 27 | class FilePermissionsAspect |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * Post-process the matcher object to respect the file storages. |
|
32 | - * |
|
33 | - * @param Matcher $matcher |
|
34 | - * @param string $dataType |
|
35 | - * @return void |
|
36 | - * @throws \InvalidArgumentException |
|
37 | - */ |
|
38 | - public function addFilePermissionsForFileStorages(Matcher $matcher, $dataType) |
|
39 | - { |
|
40 | - if ($dataType === 'sys_file' && $this->isPermissionNecessary()) { |
|
41 | - |
|
42 | - if ($this->isFolderConsidered()) { |
|
43 | - |
|
44 | - $folder = $this->getMediaModule()->getCurrentFolder(); |
|
45 | - |
|
46 | - if ($this->getMediaModule()->hasRecursiveSelection()) { |
|
47 | - |
|
48 | - // Only add like condition if needed. |
|
49 | - if ($folder->getStorage()->getRootLevelFolder() !== $folder) { |
|
50 | - $matcher->like('identifier', $folder->getIdentifier() . '%', $automaticallyAddWildCard = false); |
|
51 | - } |
|
52 | - } else { |
|
53 | - |
|
54 | - // Browse only currently |
|
55 | - $files = $this->getFileUids($folder); |
|
56 | - $matcher->in('uid', $files); |
|
57 | - } |
|
58 | - |
|
59 | - $matcher->equals('storage', $folder->getStorage()->getUid()); |
|
60 | - } else { |
|
61 | - $storage = $this->getMediaModule()->getCurrentStorage(); |
|
62 | - |
|
63 | - // Set the storage identifier only if the storage is on-line. |
|
64 | - $identifier = -1; |
|
65 | - if ($storage->isOnline()) { |
|
66 | - $identifier = $storage->getUid(); |
|
67 | - } |
|
68 | - |
|
69 | - if ($this->getModuleLoader()->hasPlugin() && !$this->getCurrentBackendUser()->isAdmin()) { |
|
70 | - |
|
71 | - $fileMounts = $this->getCurrentBackendUser()->getFileMountRecords(); |
|
72 | - $collectedFiles = []; |
|
73 | - foreach ($fileMounts as $fileMount) { |
|
74 | - |
|
75 | - $combinedIdentifier = $fileMount['base'] . ':' . $fileMount['path']; |
|
76 | - $folder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); |
|
77 | - |
|
78 | - $files = $this->getFileUids($folder); |
|
79 | - $collectedFiles = array_merge($collectedFiles, $files); |
|
80 | - } |
|
81 | - |
|
82 | - $matcher->in('uid', $collectedFiles); |
|
83 | - } |
|
84 | - |
|
85 | - $matcher->equals('storage', $identifier); |
|
86 | - } |
|
87 | - } |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - protected function isPermissionNecessary() |
|
94 | - { |
|
95 | - |
|
96 | - $isNecessary = true; |
|
97 | - |
|
98 | - $parameters = GeneralUtility::_GET(VidiModule::getParameterPrefix()); |
|
99 | - |
|
100 | - if ($parameters['controller'] === 'Clipboard' && ($parameters['action'] === 'show' || $parameters['action'] === 'flush')) { |
|
101 | - $isNecessary = false; |
|
102 | - } |
|
103 | - |
|
104 | - if ($parameters['controller'] === 'Content' && ($parameters['action'] === 'copyClipboard' || $parameters['action'] === 'moveClipboard')) { |
|
105 | - $isNecessary = false; |
|
106 | - } |
|
107 | - |
|
108 | - return $isNecessary; |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @return bool |
|
113 | - */ |
|
114 | - protected function isFolderConsidered() |
|
115 | - { |
|
116 | - return $this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin(); |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * @param Folder $folder |
|
121 | - * @return array |
|
122 | - */ |
|
123 | - protected function getFileUids(Folder $folder) |
|
124 | - { |
|
125 | - $files = []; |
|
126 | - foreach ($folder->getFiles() as $file) { |
|
127 | - $files[] = $file->getUid(); |
|
128 | - } |
|
129 | - return $files; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Post-process the constraints object to respect the file mounts. |
|
134 | - * |
|
135 | - * @param Query $query |
|
136 | - * @param ConstraintInterface|null $constraints |
|
137 | - * @param ConstraintContainer $constraintContainer |
|
138 | - * @throws \InvalidArgumentException |
|
139 | - * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidNumberOfConstraintsException |
|
140 | - */ |
|
141 | - public function addFilePermissionsForFileMounts(Query $query, $constraints, ConstraintContainer $constraintContainer) |
|
142 | - { |
|
143 | - if ($query->getType() === 'sys_file') { |
|
144 | - if (!$this->getCurrentBackendUser()->isAdmin()) { |
|
145 | - $this->respectFileMounts($query, $constraints, $constraintContainer); |
|
146 | - } |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * @param Query $query |
|
152 | - * @param ConstraintInterface|null $constraints |
|
153 | - * @param ConstraintContainer $constraintContainer |
|
154 | - * @return array |
|
155 | - * @throws \InvalidArgumentException |
|
156 | - * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidNumberOfConstraintsException |
|
157 | - */ |
|
158 | - protected function respectFileMounts(Query $query, $constraints, ConstraintContainer $constraintContainer) |
|
159 | - { |
|
160 | - $tableName = 'sys_filemounts'; |
|
161 | - |
|
162 | - // Get the file mount identifiers for the current Backend User. |
|
163 | - $fileMounts = GeneralUtility::trimExplode(',', $this->getCurrentBackendUser()->dataLists['filemount_list']); |
|
164 | - $fileMountUids = implode(',', array_filter($fileMounts)); |
|
165 | - |
|
166 | - // Fetch the records. |
|
167 | - $fileMountRecords = $this->getDataService()->getRecords( |
|
168 | - $tableName, |
|
169 | - [ |
|
170 | - 'uid' => $fileMountUids |
|
171 | - ] |
|
172 | - ); |
|
173 | - $constraintsRespectingFileMounts = []; |
|
174 | - foreach ((array)$fileMountRecords as $fileMountRecord) { |
|
175 | - if ($fileMountRecord['path']) { |
|
176 | - $constraintsRespectingFileMounts[] = $query->like( |
|
177 | - 'identifier', |
|
178 | - $fileMountRecord['path'] . '%' |
|
179 | - ); |
|
180 | - } |
|
181 | - } |
|
182 | - |
|
183 | - $logicalOrForRespectingFileMounts = $query->logicalOr($constraintsRespectingFileMounts); |
|
184 | - |
|
185 | - if ($constraints) { |
|
186 | - $constraints = $query->logicalAnd( |
|
187 | - $constraints, |
|
188 | - $logicalOrForRespectingFileMounts |
|
189 | - ); |
|
190 | - } else { |
|
191 | - $constraints = $logicalOrForRespectingFileMounts; |
|
192 | - } |
|
193 | - |
|
194 | - $constraintContainer->setConstraint($constraints); |
|
195 | - |
|
196 | - return [$query, $constraints, $constraintContainer]; |
|
197 | - } |
|
198 | - |
|
199 | - /** |
|
200 | - * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
201 | - */ |
|
202 | - protected function getCurrentBackendUser() |
|
203 | - { |
|
204 | - return $GLOBALS['BE_USER']; |
|
205 | - } |
|
206 | - |
|
207 | - /** |
|
208 | - * @return object|DataService |
|
209 | - */ |
|
210 | - protected function getDataService(): DataService |
|
211 | - { |
|
212 | - return GeneralUtility::makeInstance(DataService::class); |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * @return MediaModule|object |
|
217 | - * @throws \InvalidArgumentException |
|
218 | - */ |
|
219 | - protected function getMediaModule() |
|
220 | - { |
|
221 | - return GeneralUtility::makeInstance(MediaModule::class); |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * Get the Vidi Module Loader. |
|
226 | - * |
|
227 | - * @return object|ModuleLoader |
|
228 | - */ |
|
229 | - protected function getModuleLoader() |
|
230 | - { |
|
231 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
232 | - } |
|
30 | + /** |
|
31 | + * Post-process the matcher object to respect the file storages. |
|
32 | + * |
|
33 | + * @param Matcher $matcher |
|
34 | + * @param string $dataType |
|
35 | + * @return void |
|
36 | + * @throws \InvalidArgumentException |
|
37 | + */ |
|
38 | + public function addFilePermissionsForFileStorages(Matcher $matcher, $dataType) |
|
39 | + { |
|
40 | + if ($dataType === 'sys_file' && $this->isPermissionNecessary()) { |
|
41 | + |
|
42 | + if ($this->isFolderConsidered()) { |
|
43 | + |
|
44 | + $folder = $this->getMediaModule()->getCurrentFolder(); |
|
45 | + |
|
46 | + if ($this->getMediaModule()->hasRecursiveSelection()) { |
|
47 | + |
|
48 | + // Only add like condition if needed. |
|
49 | + if ($folder->getStorage()->getRootLevelFolder() !== $folder) { |
|
50 | + $matcher->like('identifier', $folder->getIdentifier() . '%', $automaticallyAddWildCard = false); |
|
51 | + } |
|
52 | + } else { |
|
53 | + |
|
54 | + // Browse only currently |
|
55 | + $files = $this->getFileUids($folder); |
|
56 | + $matcher->in('uid', $files); |
|
57 | + } |
|
58 | + |
|
59 | + $matcher->equals('storage', $folder->getStorage()->getUid()); |
|
60 | + } else { |
|
61 | + $storage = $this->getMediaModule()->getCurrentStorage(); |
|
62 | + |
|
63 | + // Set the storage identifier only if the storage is on-line. |
|
64 | + $identifier = -1; |
|
65 | + if ($storage->isOnline()) { |
|
66 | + $identifier = $storage->getUid(); |
|
67 | + } |
|
68 | + |
|
69 | + if ($this->getModuleLoader()->hasPlugin() && !$this->getCurrentBackendUser()->isAdmin()) { |
|
70 | + |
|
71 | + $fileMounts = $this->getCurrentBackendUser()->getFileMountRecords(); |
|
72 | + $collectedFiles = []; |
|
73 | + foreach ($fileMounts as $fileMount) { |
|
74 | + |
|
75 | + $combinedIdentifier = $fileMount['base'] . ':' . $fileMount['path']; |
|
76 | + $folder = ResourceFactory::getInstance()->getFolderObjectFromCombinedIdentifier($combinedIdentifier); |
|
77 | + |
|
78 | + $files = $this->getFileUids($folder); |
|
79 | + $collectedFiles = array_merge($collectedFiles, $files); |
|
80 | + } |
|
81 | + |
|
82 | + $matcher->in('uid', $collectedFiles); |
|
83 | + } |
|
84 | + |
|
85 | + $matcher->equals('storage', $identifier); |
|
86 | + } |
|
87 | + } |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + protected function isPermissionNecessary() |
|
94 | + { |
|
95 | + |
|
96 | + $isNecessary = true; |
|
97 | + |
|
98 | + $parameters = GeneralUtility::_GET(VidiModule::getParameterPrefix()); |
|
99 | + |
|
100 | + if ($parameters['controller'] === 'Clipboard' && ($parameters['action'] === 'show' || $parameters['action'] === 'flush')) { |
|
101 | + $isNecessary = false; |
|
102 | + } |
|
103 | + |
|
104 | + if ($parameters['controller'] === 'Content' && ($parameters['action'] === 'copyClipboard' || $parameters['action'] === 'moveClipboard')) { |
|
105 | + $isNecessary = false; |
|
106 | + } |
|
107 | + |
|
108 | + return $isNecessary; |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @return bool |
|
113 | + */ |
|
114 | + protected function isFolderConsidered() |
|
115 | + { |
|
116 | + return $this->getMediaModule()->hasFolderTree() && !$this->getModuleLoader()->hasPlugin(); |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * @param Folder $folder |
|
121 | + * @return array |
|
122 | + */ |
|
123 | + protected function getFileUids(Folder $folder) |
|
124 | + { |
|
125 | + $files = []; |
|
126 | + foreach ($folder->getFiles() as $file) { |
|
127 | + $files[] = $file->getUid(); |
|
128 | + } |
|
129 | + return $files; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Post-process the constraints object to respect the file mounts. |
|
134 | + * |
|
135 | + * @param Query $query |
|
136 | + * @param ConstraintInterface|null $constraints |
|
137 | + * @param ConstraintContainer $constraintContainer |
|
138 | + * @throws \InvalidArgumentException |
|
139 | + * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidNumberOfConstraintsException |
|
140 | + */ |
|
141 | + public function addFilePermissionsForFileMounts(Query $query, $constraints, ConstraintContainer $constraintContainer) |
|
142 | + { |
|
143 | + if ($query->getType() === 'sys_file') { |
|
144 | + if (!$this->getCurrentBackendUser()->isAdmin()) { |
|
145 | + $this->respectFileMounts($query, $constraints, $constraintContainer); |
|
146 | + } |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * @param Query $query |
|
152 | + * @param ConstraintInterface|null $constraints |
|
153 | + * @param ConstraintContainer $constraintContainer |
|
154 | + * @return array |
|
155 | + * @throws \InvalidArgumentException |
|
156 | + * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception\InvalidNumberOfConstraintsException |
|
157 | + */ |
|
158 | + protected function respectFileMounts(Query $query, $constraints, ConstraintContainer $constraintContainer) |
|
159 | + { |
|
160 | + $tableName = 'sys_filemounts'; |
|
161 | + |
|
162 | + // Get the file mount identifiers for the current Backend User. |
|
163 | + $fileMounts = GeneralUtility::trimExplode(',', $this->getCurrentBackendUser()->dataLists['filemount_list']); |
|
164 | + $fileMountUids = implode(',', array_filter($fileMounts)); |
|
165 | + |
|
166 | + // Fetch the records. |
|
167 | + $fileMountRecords = $this->getDataService()->getRecords( |
|
168 | + $tableName, |
|
169 | + [ |
|
170 | + 'uid' => $fileMountUids |
|
171 | + ] |
|
172 | + ); |
|
173 | + $constraintsRespectingFileMounts = []; |
|
174 | + foreach ((array)$fileMountRecords as $fileMountRecord) { |
|
175 | + if ($fileMountRecord['path']) { |
|
176 | + $constraintsRespectingFileMounts[] = $query->like( |
|
177 | + 'identifier', |
|
178 | + $fileMountRecord['path'] . '%' |
|
179 | + ); |
|
180 | + } |
|
181 | + } |
|
182 | + |
|
183 | + $logicalOrForRespectingFileMounts = $query->logicalOr($constraintsRespectingFileMounts); |
|
184 | + |
|
185 | + if ($constraints) { |
|
186 | + $constraints = $query->logicalAnd( |
|
187 | + $constraints, |
|
188 | + $logicalOrForRespectingFileMounts |
|
189 | + ); |
|
190 | + } else { |
|
191 | + $constraints = $logicalOrForRespectingFileMounts; |
|
192 | + } |
|
193 | + |
|
194 | + $constraintContainer->setConstraint($constraints); |
|
195 | + |
|
196 | + return [$query, $constraints, $constraintContainer]; |
|
197 | + } |
|
198 | + |
|
199 | + /** |
|
200 | + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
201 | + */ |
|
202 | + protected function getCurrentBackendUser() |
|
203 | + { |
|
204 | + return $GLOBALS['BE_USER']; |
|
205 | + } |
|
206 | + |
|
207 | + /** |
|
208 | + * @return object|DataService |
|
209 | + */ |
|
210 | + protected function getDataService(): DataService |
|
211 | + { |
|
212 | + return GeneralUtility::makeInstance(DataService::class); |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * @return MediaModule|object |
|
217 | + * @throws \InvalidArgumentException |
|
218 | + */ |
|
219 | + protected function getMediaModule() |
|
220 | + { |
|
221 | + return GeneralUtility::makeInstance(MediaModule::class); |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * Get the Vidi Module Loader. |
|
226 | + * |
|
227 | + * @return object|ModuleLoader |
|
228 | + */ |
|
229 | + protected function getModuleLoader() |
|
230 | + { |
|
231 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
232 | + } |
|
233 | 233 | } |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * Renders a button for uploading assets. |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - public function render() |
|
27 | - { |
|
28 | - $parameterPrefix = MediaModule::getParameterPrefix(); |
|
29 | - $output = " |
|
21 | + /** |
|
22 | + * Renders a button for uploading assets. |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + public function render() |
|
27 | + { |
|
28 | + $parameterPrefix = MediaModule::getParameterPrefix(); |
|
29 | + $output = " |
|
30 | 30 | <script> |
31 | 31 | |
32 | 32 | window.Media = window.Media || {}; |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | </script>"; |
36 | 36 | |
37 | - return $output; |
|
38 | - } |
|
37 | + return $output; |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | 41 | } |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('TYPO3_MODE')) die ('Access denied.'); |
|
2 | +if (!defined('TYPO3_MODE')) { |
|
3 | + die ('Access denied.'); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | $tca = [ |
5 | 7 | 'ctrl' => [ |
@@ -145,7 +145,7 @@ |
||
145 | 145 | |
146 | 146 | $additionalTca = [ |
147 | 147 | 'ctrl' => [ |
148 | - 'searchFields' => $tca['ctrl']['searchFields'] . ', metadata.keywords', |
|
148 | + 'searchFields' => $tca['ctrl']['searchFields'].', metadata.keywords', |
|
149 | 149 | ], |
150 | 150 | 'grid' => [ |
151 | 151 | 'columns' => [ |
@@ -2,226 +2,226 @@ |
||
2 | 2 | if (!defined('TYPO3_MODE')) die ('Access denied.'); |
3 | 3 | |
4 | 4 | $tca = [ |
5 | - 'ctrl' => [ |
|
6 | - 'default_sortby' => 'uid DESC', |
|
7 | - // Beware that "metadata.categories" is quite expansive performance wise. |
|
8 | - 'searchFields' => 'uid, extension, name, metadata.title, metadata.description, metadata.categories', |
|
9 | - ], |
|
10 | - 'columns' => [ |
|
11 | - 'extension' => [ |
|
12 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.extension', |
|
13 | - 'config' => [ |
|
14 | - 'type' => 'input', |
|
15 | - 'size' => 255, |
|
16 | - 'eval' => 'trim', |
|
17 | - ], |
|
18 | - ], |
|
19 | - 'number_of_references' => [ |
|
20 | - 'config' => [ |
|
21 | - 'type' => 'input', |
|
22 | - 'size' => 255, |
|
23 | - 'readOnly' => true, |
|
24 | - ], |
|
25 | - ], |
|
26 | - ], |
|
27 | - 'vidi' => [ |
|
28 | - // For actions such as update, remove, copy, move, the DataHandler of the Core is configured to be used by default. |
|
29 | - // It will work fine in most cases. However, there is the chance to set your own Data Handler if there are special needs (@see FileDataHandler in EXT:media) |
|
30 | - // Another reasons, would be for speed. You will notice a performance cost when mass editing data using the Core DataHandler. |
|
31 | - // Using your own DataHandler would make the mass processing much faster. |
|
32 | - 'data_handler' => [ |
|
33 | - // For all actions |
|
34 | - '*' => 'Fab\Media\DataHandler\FileDataHandler' |
|
35 | - ], |
|
36 | - ], |
|
37 | - 'grid' => [ |
|
38 | - 'excluded_fields' => 'number_of_references, missing', |
|
39 | - 'facets' => [ |
|
40 | - 'metadata.title', |
|
41 | - 'metadata.categories', |
|
42 | - 'name', |
|
43 | - \Fab\Vidi\Facet\StandardFacet::class => [ |
|
44 | - 'name' => 'extension', |
|
45 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.extension' |
|
46 | - ], |
|
47 | - 'metadata.description', |
|
48 | - 'identifier', |
|
49 | - \Fab\Vidi\Facet\StandardFacet::class => [ |
|
50 | - 'name' => 'number_of_references', |
|
51 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:usage', |
|
52 | - 'suggestions' => ['0', '1', '2', '3', 'etc...'] // auto-suggestions |
|
53 | - ], |
|
5 | + 'ctrl' => [ |
|
6 | + 'default_sortby' => 'uid DESC', |
|
7 | + // Beware that "metadata.categories" is quite expansive performance wise. |
|
8 | + 'searchFields' => 'uid, extension, name, metadata.title, metadata.description, metadata.categories', |
|
9 | + ], |
|
10 | + 'columns' => [ |
|
11 | + 'extension' => [ |
|
12 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.extension', |
|
13 | + 'config' => [ |
|
14 | + 'type' => 'input', |
|
15 | + 'size' => 255, |
|
16 | + 'eval' => 'trim', |
|
17 | + ], |
|
18 | + ], |
|
19 | + 'number_of_references' => [ |
|
20 | + 'config' => [ |
|
21 | + 'type' => 'input', |
|
22 | + 'size' => 255, |
|
23 | + 'readOnly' => true, |
|
24 | + ], |
|
25 | + ], |
|
26 | + ], |
|
27 | + 'vidi' => [ |
|
28 | + // For actions such as update, remove, copy, move, the DataHandler of the Core is configured to be used by default. |
|
29 | + // It will work fine in most cases. However, there is the chance to set your own Data Handler if there are special needs (@see FileDataHandler in EXT:media) |
|
30 | + // Another reasons, would be for speed. You will notice a performance cost when mass editing data using the Core DataHandler. |
|
31 | + // Using your own DataHandler would make the mass processing much faster. |
|
32 | + 'data_handler' => [ |
|
33 | + // For all actions |
|
34 | + '*' => 'Fab\Media\DataHandler\FileDataHandler' |
|
35 | + ], |
|
36 | + ], |
|
37 | + 'grid' => [ |
|
38 | + 'excluded_fields' => 'number_of_references, missing', |
|
39 | + 'facets' => [ |
|
40 | + 'metadata.title', |
|
41 | + 'metadata.categories', |
|
42 | + 'name', |
|
43 | + \Fab\Vidi\Facet\StandardFacet::class => [ |
|
44 | + 'name' => 'extension', |
|
45 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.extension' |
|
46 | + ], |
|
47 | + 'metadata.description', |
|
48 | + 'identifier', |
|
49 | + \Fab\Vidi\Facet\StandardFacet::class => [ |
|
50 | + 'name' => 'number_of_references', |
|
51 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:usage', |
|
52 | + 'suggestions' => ['0', '1', '2', '3', 'etc...'] // auto-suggestions |
|
53 | + ], |
|
54 | 54 | |
55 | - \Fab\Vidi\Facet\StandardFacet::class => [ |
|
56 | - 'name' => 'type', |
|
57 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type', |
|
58 | - 'suggestions' => [ |
|
59 | - \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_1', |
|
60 | - \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_2', |
|
61 | - \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_3', |
|
62 | - \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_4', |
|
63 | - \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_5', |
|
64 | - ] |
|
65 | - ], |
|
66 | - \Fab\Media\Facet\ActionPermissionFacet::class => [], |
|
67 | - 'uid', |
|
68 | - ], |
|
69 | - 'columns' => [ |
|
70 | - '__checkbox' => [ |
|
71 | - 'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class, |
|
72 | - ], |
|
73 | - 'uid' => [ |
|
74 | - 'visible' => false, |
|
75 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:uid', |
|
76 | - 'width' => '5px', |
|
77 | - ], |
|
78 | - 'identifier' => [ |
|
79 | - 'visible' => false, |
|
80 | - ], |
|
81 | - 'fileinfo' => [ |
|
82 | - 'renderer' => Fab\Media\Grid\PreviewRenderer::class, |
|
83 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:preview', |
|
84 | - 'wrap' => '<div class="center preview">|</div>', |
|
85 | - 'width' => '150px', |
|
86 | - 'sortable' => false, |
|
87 | - ], |
|
88 | - 'metadata.title' => [ |
|
89 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
90 | - 'rendererConfiguration' => [ |
|
91 | - 'property' => 'title', |
|
92 | - ], |
|
93 | - 'width' => '400px', |
|
94 | - 'editable' => true, |
|
95 | - 'sortable' => true, |
|
96 | - ], |
|
97 | - 'metadata.description' => [ |
|
98 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
99 | - 'rendererConfiguration' => [ |
|
100 | - 'property' => 'description', |
|
101 | - ], |
|
102 | - 'visible' => false, |
|
103 | - 'sortable' => false, |
|
104 | - ], |
|
105 | - 'tstamp' => [ |
|
106 | - 'visible' => false, |
|
107 | - 'format' => 'Fab\Vidi\Formatter\Date', |
|
108 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.tstamp', |
|
109 | - ], |
|
110 | - 'metadata.categories' => [ |
|
111 | - 'renderers' => [ |
|
112 | - \Fab\Vidi\Grid\RelationEditRenderer::class, |
|
113 | - \Fab\Media\Grid\CategoryRenderer::class, |
|
114 | - ], |
|
115 | - 'editable' => true, |
|
116 | - 'visible' => true, |
|
117 | - 'sortable' => false, |
|
118 | - ], |
|
119 | - 'usage' => [ |
|
120 | - 'renderer' => 'Fab\Media\Grid\UsageRenderer', |
|
121 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:usage', |
|
122 | - 'visible' => true, |
|
123 | - 'sortable' => false, |
|
124 | - ], |
|
125 | - 'metadata' => [ |
|
126 | - 'label' => 'Metadata File Identifier', |
|
127 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
128 | - 'rendererConfiguration' => [ |
|
129 | - 'property' => 'uid', |
|
130 | - ], |
|
131 | - 'visible' => false, |
|
132 | - 'sortable' => false, |
|
133 | - ], |
|
134 | - '__action_permission' => [ |
|
135 | - 'renderer' => 'Fab\Media\Grid\ActionPermissionColumn', |
|
136 | - 'visible' => false, |
|
137 | - 'sortable' => false, |
|
138 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permission', |
|
139 | - ], |
|
140 | - ] |
|
141 | - ] |
|
55 | + \Fab\Vidi\Facet\StandardFacet::class => [ |
|
56 | + 'name' => 'type', |
|
57 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type', |
|
58 | + 'suggestions' => [ |
|
59 | + \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_1', |
|
60 | + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_2', |
|
61 | + \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_3', |
|
62 | + \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_4', |
|
63 | + \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:type_5', |
|
64 | + ] |
|
65 | + ], |
|
66 | + \Fab\Media\Facet\ActionPermissionFacet::class => [], |
|
67 | + 'uid', |
|
68 | + ], |
|
69 | + 'columns' => [ |
|
70 | + '__checkbox' => [ |
|
71 | + 'renderer' => \Fab\Vidi\Grid\CheckBoxRenderer::class, |
|
72 | + ], |
|
73 | + 'uid' => [ |
|
74 | + 'visible' => false, |
|
75 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:uid', |
|
76 | + 'width' => '5px', |
|
77 | + ], |
|
78 | + 'identifier' => [ |
|
79 | + 'visible' => false, |
|
80 | + ], |
|
81 | + 'fileinfo' => [ |
|
82 | + 'renderer' => Fab\Media\Grid\PreviewRenderer::class, |
|
83 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:preview', |
|
84 | + 'wrap' => '<div class="center preview">|</div>', |
|
85 | + 'width' => '150px', |
|
86 | + 'sortable' => false, |
|
87 | + ], |
|
88 | + 'metadata.title' => [ |
|
89 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
90 | + 'rendererConfiguration' => [ |
|
91 | + 'property' => 'title', |
|
92 | + ], |
|
93 | + 'width' => '400px', |
|
94 | + 'editable' => true, |
|
95 | + 'sortable' => true, |
|
96 | + ], |
|
97 | + 'metadata.description' => [ |
|
98 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
99 | + 'rendererConfiguration' => [ |
|
100 | + 'property' => 'description', |
|
101 | + ], |
|
102 | + 'visible' => false, |
|
103 | + 'sortable' => false, |
|
104 | + ], |
|
105 | + 'tstamp' => [ |
|
106 | + 'visible' => false, |
|
107 | + 'format' => 'Fab\Vidi\Formatter\Date', |
|
108 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:sys_file.tstamp', |
|
109 | + ], |
|
110 | + 'metadata.categories' => [ |
|
111 | + 'renderers' => [ |
|
112 | + \Fab\Vidi\Grid\RelationEditRenderer::class, |
|
113 | + \Fab\Media\Grid\CategoryRenderer::class, |
|
114 | + ], |
|
115 | + 'editable' => true, |
|
116 | + 'visible' => true, |
|
117 | + 'sortable' => false, |
|
118 | + ], |
|
119 | + 'usage' => [ |
|
120 | + 'renderer' => 'Fab\Media\Grid\UsageRenderer', |
|
121 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:usage', |
|
122 | + 'visible' => true, |
|
123 | + 'sortable' => false, |
|
124 | + ], |
|
125 | + 'metadata' => [ |
|
126 | + 'label' => 'Metadata File Identifier', |
|
127 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
128 | + 'rendererConfiguration' => [ |
|
129 | + 'property' => 'uid', |
|
130 | + ], |
|
131 | + 'visible' => false, |
|
132 | + 'sortable' => false, |
|
133 | + ], |
|
134 | + '__action_permission' => [ |
|
135 | + 'renderer' => 'Fab\Media\Grid\ActionPermissionColumn', |
|
136 | + 'visible' => false, |
|
137 | + 'sortable' => false, |
|
138 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permission', |
|
139 | + ], |
|
140 | + ] |
|
141 | + ] |
|
142 | 142 | ]; |
143 | 143 | |
144 | 144 | // Add more info to the Grid if EXT:filemetadata is loaded. Notice that the extension is not required but suggested. |
145 | 145 | if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('filemetadata')) { |
146 | 146 | |
147 | - $additionalTca = [ |
|
148 | - 'ctrl' => [ |
|
149 | - 'searchFields' => $tca['ctrl']['searchFields'] . ', metadata.keywords', |
|
150 | - ], |
|
151 | - 'grid' => [ |
|
152 | - 'columns' => [ |
|
153 | - 'metadata.keywords' => [ |
|
154 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
155 | - 'configuration' => [ |
|
156 | - 'property' => 'keywords', |
|
157 | - ], |
|
158 | - 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.keywords', |
|
159 | - 'visible' => false, |
|
160 | - 'sortable' => false, |
|
161 | - ], |
|
162 | - 'metadata.fe_groups' => [ |
|
163 | - 'renderers' => [ |
|
164 | - \Fab\Vidi\Grid\RelationEditRenderer::class, |
|
165 | - \Fab\Media\Grid\FrontendPermissionRenderer::class, |
|
166 | - ], |
|
167 | - 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permissions_fe_groups', |
|
168 | - 'visible' => false, |
|
169 | - 'sortable' => false, |
|
170 | - ], |
|
171 | - 'metadata.status' => [ |
|
172 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
173 | - 'rendererConfiguration' => [ |
|
174 | - 'property' => 'status', |
|
175 | - ], |
|
176 | - 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status', |
|
177 | - 'visible' => false, |
|
178 | - 'width' => '5%', |
|
179 | - 'sortable' => false, |
|
180 | - ], |
|
181 | - # un-comment me to see the "visible" flag in the grid. |
|
182 | - #'visible' => array( |
|
183 | - # 'renderer' => 'Fab\Media\Grid\VisibilityRenderer', @todo will not work out of the box after 6.2 migration |
|
184 | - # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
185 | - # 'width' => '3%', |
|
186 | - #), |
|
187 | - 'metadata.creator_tool' => [ |
|
188 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
189 | - 'rendererConfiguration' => [ |
|
190 | - 'property' => 'creator_tool', |
|
191 | - ], |
|
192 | - 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator_tool', |
|
193 | - 'visible' => false, |
|
194 | - 'sortable' => false, |
|
195 | - ], |
|
196 | - 'metadata.content_creation_date' => [ |
|
197 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
198 | - 'rendererConfiguration' => [ |
|
199 | - 'property' => 'content_creation_date', |
|
200 | - ], |
|
201 | - 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_creation_date', |
|
202 | - 'visible' => false, |
|
203 | - 'format' => 'datetime', |
|
204 | - 'sortable' => false, |
|
205 | - ], |
|
206 | - 'metadata.content_modification_date' => [ |
|
207 | - 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
208 | - 'rendererConfiguration' => [ |
|
209 | - 'property' => 'content_modification_date', |
|
210 | - ], |
|
211 | - 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_modification_date', |
|
212 | - 'visible' => false, |
|
213 | - 'format' => 'datetime', |
|
214 | - 'sortable' => false, |
|
215 | - ], |
|
216 | - ] |
|
217 | - ] |
|
218 | - ]; |
|
219 | - \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tca, $additionalTca); |
|
147 | + $additionalTca = [ |
|
148 | + 'ctrl' => [ |
|
149 | + 'searchFields' => $tca['ctrl']['searchFields'] . ', metadata.keywords', |
|
150 | + ], |
|
151 | + 'grid' => [ |
|
152 | + 'columns' => [ |
|
153 | + 'metadata.keywords' => [ |
|
154 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
155 | + 'configuration' => [ |
|
156 | + 'property' => 'keywords', |
|
157 | + ], |
|
158 | + 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.keywords', |
|
159 | + 'visible' => false, |
|
160 | + 'sortable' => false, |
|
161 | + ], |
|
162 | + 'metadata.fe_groups' => [ |
|
163 | + 'renderers' => [ |
|
164 | + \Fab\Vidi\Grid\RelationEditRenderer::class, |
|
165 | + \Fab\Media\Grid\FrontendPermissionRenderer::class, |
|
166 | + ], |
|
167 | + 'label' => 'LLL:EXT:media/Resources/Private/Language/locallang.xlf:permissions_fe_groups', |
|
168 | + 'visible' => false, |
|
169 | + 'sortable' => false, |
|
170 | + ], |
|
171 | + 'metadata.status' => [ |
|
172 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
173 | + 'rendererConfiguration' => [ |
|
174 | + 'property' => 'status', |
|
175 | + ], |
|
176 | + 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.status', |
|
177 | + 'visible' => false, |
|
178 | + 'width' => '5%', |
|
179 | + 'sortable' => false, |
|
180 | + ], |
|
181 | + # un-comment me to see the "visible" flag in the grid. |
|
182 | + #'visible' => array( |
|
183 | + # 'renderer' => 'Fab\Media\Grid\VisibilityRenderer', @todo will not work out of the box after 6.2 migration |
|
184 | + # 'label' => 'LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:visibility_abbreviation', |
|
185 | + # 'width' => '3%', |
|
186 | + #), |
|
187 | + 'metadata.creator_tool' => [ |
|
188 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
189 | + 'rendererConfiguration' => [ |
|
190 | + 'property' => 'creator_tool', |
|
191 | + ], |
|
192 | + 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.creator_tool', |
|
193 | + 'visible' => false, |
|
194 | + 'sortable' => false, |
|
195 | + ], |
|
196 | + 'metadata.content_creation_date' => [ |
|
197 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
198 | + 'rendererConfiguration' => [ |
|
199 | + 'property' => 'content_creation_date', |
|
200 | + ], |
|
201 | + 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_creation_date', |
|
202 | + 'visible' => false, |
|
203 | + 'format' => 'datetime', |
|
204 | + 'sortable' => false, |
|
205 | + ], |
|
206 | + 'metadata.content_modification_date' => [ |
|
207 | + 'renderer' => \Fab\Media\Grid\MetadataRenderer::class, |
|
208 | + 'rendererConfiguration' => [ |
|
209 | + 'property' => 'content_modification_date', |
|
210 | + ], |
|
211 | + 'label' => 'LLL:EXT:filemetadata/Resources/Private/Language/locallang_tca.xlf:sys_file_metadata.content_modification_date', |
|
212 | + 'visible' => false, |
|
213 | + 'format' => 'datetime', |
|
214 | + 'sortable' => false, |
|
215 | + ], |
|
216 | + ] |
|
217 | + ] |
|
218 | + ]; |
|
219 | + \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tca, $additionalTca); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | // Control buttons such as edit, delete, etc... must be set at the end in any case. |
223 | 223 | $tca['grid']['columns']['__buttons'] = [ |
224 | - 'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class, |
|
224 | + 'renderer' => \Fab\Vidi\Grid\ButtonGroupRenderer::class, |
|
225 | 225 | ]; |
226 | 226 | |
227 | 227 | \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['sys_file'], $tca); |
228 | 228 | \ No newline at end of file |