From aa899b5fe181e7d6aacc75c4e3076d75b8e9c945 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 10 Dec 2016 10:37:07 +0100 Subject: [PATCH 01/42] BUGFIX: Prevent whitespace in breadcrumb This was a regression #159 Related: #159 --- .../Partials/Module/Shared/DocumentBreadcrumb.html | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Neos.Neos/Resources/Private/Partials/Module/Shared/DocumentBreadcrumb.html b/Neos.Neos/Resources/Private/Partials/Module/Shared/DocumentBreadcrumb.html index cb32d4d4fe5..b467d49ebdd 100644 --- a/Neos.Neos/Resources/Private/Partials/Module/Shared/DocumentBreadcrumb.html +++ b/Neos.Neos/Resources/Private/Partials/Module/Shared/DocumentBreadcrumb.html @@ -1,11 +1 @@ -{namespace neos=Neos\Neos\ViewHelpers} - - / - - - - {documentNode.label} - - +{namespace neos=Neos\Neos\ViewHelpers}/ {documentNode.label} From e27da9df1a8a8289ac63031158863539eb07aef5 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 10 Dec 2016 10:43:36 +0100 Subject: [PATCH 02/42] BUGFIX: Use new format again for requestPatterns This fixes a regression in #159 Related: #159 --- Neos.Neos/Configuration/Settings.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Neos.Neos/Configuration/Settings.yaml b/Neos.Neos/Configuration/Settings.yaml index ad2cfb17197..2e855417488 100755 --- a/Neos.Neos/Configuration/Settings.yaml +++ b/Neos.Neos/Configuration/Settings.yaml @@ -567,10 +567,18 @@ Neos: label: 'Neos Backend' provider: PersistedUsernamePasswordProvider requestPatterns: - 'Neos.Neos:BackendControllers': - pattern: ControllerObjectName + 'Neos.Neos:backendControllers': + pattern: 'ControllerObjectName' patternOptions: - controllerObjectNamePattern: 'Neos\Neos\Controller\.*|Neos\Neos\Service\.*|Neos\Media\Controller\.*' + controllerObjectNamePattern: 'Neos\Neos\Controller\.*' + 'Neos.Neos:serviceControllers': + pattern: 'ControllerObjectName' + patternOptions: + controllerObjectNamePattern: 'Neos\Neos\Service\.*' + 'Neos.Neos:mediaControllers': + pattern: 'ControllerObjectName' + patternOptions: + controllerObjectNamePattern: 'Neos\Media\Controller\.*' entryPoint: WebRedirect entryPointOptions: routeValues: From 1ef78ad0ae73aef0831bd0983dd6ab4559de1d4f Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 10 Dec 2016 10:45:27 +0100 Subject: [PATCH 03/42] TASK: Adjust media browser package description Related: #159 --- Neos.Media.Browser/composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Neos.Media.Browser/composer.json b/Neos.Media.Browser/composer.json index b9ef5a38712..c445b063089 100644 --- a/Neos.Media.Browser/composer.json +++ b/Neos.Media.Browser/composer.json @@ -1,7 +1,7 @@ { "name": "neos/media-browser", "type": "neos-package", - "description": "A media browser for the Neos content application platform", + "description": "This module allows managing of media assets including pictures, videos, audio and documents.", "license": "GPL-3.0+", "require": { "neos/media": "*" @@ -76,4 +76,4 @@ "Neos.Fusion-20161201202543" ] } -} \ No newline at end of file +} From fb79f68879bd36f5e7a7c3a8ed64a81b87e0f8f0 Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 10 Dec 2016 11:11:39 +0100 Subject: [PATCH 04/42] TASK: Automatically include routes for media browser Removes the need for a route in the Neos package. --- Neos.Media.Browser/Configuration/Routes.yaml | 4 ++-- Neos.Media.Browser/Configuration/Settings.yaml | 4 ++++ Neos.Neos/Configuration/Routes.yaml | 11 ----------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Neos.Media.Browser/Configuration/Routes.yaml b/Neos.Media.Browser/Configuration/Routes.yaml index a703d60017f..09219e0bb5c 100644 --- a/Neos.Media.Browser/Configuration/Routes.yaml +++ b/Neos.Media.Browser/Configuration/Routes.yaml @@ -4,7 +4,7 @@ - name: 'Content Module - Media Browser' - uriPattern: 'media(/{@action}).{@format}' + uriPattern: 'neos/module/media/browser/media(/{@action}).{@format}' defaults: '@package': 'Neos.Media.Browser' '@controller': 'Backend\MediaBrowser' @@ -14,7 +14,7 @@ - name: 'Content Module - Image Browser' - uriPattern: 'image(/{@action}).{@format}' + uriPattern: 'neos/module/media/browser/image(/{@action}).{@format}' defaults: '@package': 'Neos.Media.Browser' '@controller': 'Backend\ImageBrowser' diff --git a/Neos.Media.Browser/Configuration/Settings.yaml b/Neos.Media.Browser/Configuration/Settings.yaml index 70bfecdf85f..721de0f4dd4 100644 --- a/Neos.Media.Browser/Configuration/Settings.yaml +++ b/Neos.Media.Browser/Configuration/Settings.yaml @@ -36,6 +36,10 @@ Neos: pattern: ControllerObjectName patternOptions: controllerObjectNamePattern: 'Neos\Media\Browser\Controller\Backend\.*' + + mvc: + routes: + 'Neos.Media.Browser': true Neos: modules: management: diff --git a/Neos.Neos/Configuration/Routes.yaml b/Neos.Neos/Configuration/Routes.yaml index a48d18deeec..66da84c1b58 100644 --- a/Neos.Neos/Configuration/Routes.yaml +++ b/Neos.Neos/Configuration/Routes.yaml @@ -2,17 +2,6 @@ # Default subroutes configuration for the Neos.Neos package # # # -## -# MediaBrowser -- - name: 'Neos Media Browser' - uriPattern: 'neos/module/media/browser/' - subRoutes: - 'NeosMediaBrowserSubroutes': - package: 'Neos.Media.Browser' - variables: - 'defaultUriSuffix': '.html' - ## # Authentication From 4301278fb5dec12092682d40fab08aaad8de7e2e Mon Sep 17 00:00:00 2001 From: Sebastian Helzle Date: Sat, 10 Dec 2016 11:46:37 +0100 Subject: [PATCH 05/42] TASK: Combines both AssetControllers Related: #159 --- .../Classes/Controller/AssetController.php | 617 ------------------ .../Module/Management/AssetController.php | 541 ++++++++++++++- 2 files changed, 536 insertions(+), 622 deletions(-) delete mode 100755 Neos.Media.Browser/Classes/Controller/AssetController.php diff --git a/Neos.Media.Browser/Classes/Controller/AssetController.php b/Neos.Media.Browser/Classes/Controller/AssetController.php deleted file mode 100755 index a7947ed9d57..00000000000 --- a/Neos.Media.Browser/Classes/Controller/AssetController.php +++ /dev/null @@ -1,617 +0,0 @@ - TemplateView::class, - 'json' => JsonView::class - ); - - /** - * Set common variables on the view - * - * @param ViewInterface $view - * @return void - */ - protected function initializeView(ViewInterface $view) - { - $view->assignMultiple(array( - 'view' => $this->browserState->get('view'), - 'sortBy' => $this->browserState->get('sortBy'), - 'sortDirection' => $this->browserState->get('sortDirection'), - 'filter' => $this->browserState->get('filter'), - 'activeTag' => $this->browserState->get('activeTag'), - 'activeAssetCollection' => $this->browserState->get('activeAssetCollection') - )); - } - - /** - * List existing assets - * - * @param string $view - * @param string $sortBy - * @param string $sortDirection - * @param string $filter - * @param integer $tagMode - * @param Tag $tag - * @param string $searchTerm - * @param integer $collectionMode - * @param AssetCollection $assetCollection - * @return void - */ - public function indexAction($view = null, $sortBy = null, $sortDirection = null, $filter = null, $tagMode = self::TAG_GIVEN, Tag $tag = null, $searchTerm = null, $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null) - { - if ($view !== null) { - $this->browserState->set('view', $view); - $this->view->assign('view', $view); - } - if ($sortBy !== null) { - $this->browserState->set('sortBy', $sortBy); - $this->view->assign('sortBy', $sortBy); - } - if ($sortDirection !== null) { - $this->browserState->set('sortDirection', $sortDirection); - $this->view->assign('sortDirection', $sortDirection); - } - if ($filter !== null) { - $this->browserState->set('filter', $filter); - $this->view->assign('filter', $filter); - } - if ($tagMode === self::TAG_GIVEN && $tag !== null) { - $this->browserState->set('activeTag', $tag); - $this->view->assign('activeTag', $tag); - } elseif ($tagMode === self::TAG_NONE || $tagMode === self::TAG_ALL) { - $this->browserState->set('activeTag', null); - $this->view->assign('activeTag', null); - } - $this->browserState->set('tagMode', $tagMode); - - if ($collectionMode === self::COLLECTION_GIVEN && $assetCollection !== null) { - $this->browserState->set('activeAssetCollection', $assetCollection); - $this->view->assign('activeAssetCollection', $assetCollection); - } elseif ($collectionMode === self::COLLECTION_ALL) { - $this->browserState->set('activeAssetCollection', null); - $this->view->assign('activeAssetCollection', null); - } - $this->browserState->set('collectionMode', $collectionMode); - try { - /** @var AssetCollection $activeAssetCollection */ - $activeAssetCollection = $this->browserState->get('activeAssetCollection'); - if ($activeAssetCollection instanceof DoctrineProxy) { - // To trigger a possible EntityNotFound have to load the entity - $activeAssetCollection->__load(); - } - } catch (EntityNotFoundException $exception) { - // If a removed tasset collection is still in the browser state it can not be fetched - $this->browserState->set('activeAssetCollection', null); - $activeAssetCollection = null; - } - - // Unset active tag if it isn't available in the active asset collection - if ($this->browserState->get('activeTag') && $activeAssetCollection !== null && !$activeAssetCollection->getTags()->contains($this->browserState->get('activeTag'))) { - $this->browserState->set('activeTag', null); - $this->view->assign('activeTag', null); - } - - if ($this->browserState->get('filter') !== 'All') { - switch ($this->browserState->get('filter')) { - case 'Image': - $this->assetRepository = new ImageRepository(); - break; - case 'Document': - $this->assetRepository = new DocumentRepository(); - break; - case 'Video': - $this->assetRepository = new VideoRepository(); - break; - case 'Audio': - $this->assetRepository = new AudioRepository(); - break; - } - } - - switch ($this->browserState->get('sortBy')) { - case 'Name': - $this->assetRepository->setDefaultOrderings(array('resource.filename' => $this->browserState->get('sortDirection'))); - break; - case 'Modified': - default: - $this->assetRepository->setDefaultOrderings(array('lastModified' => $this->browserState->get('sortDirection'))); - break; - } - - if (!$this->browserState->get('activeTag') && $this->browserState->get('tagMode') === self::TAG_GIVEN) { - $this->browserState->set('tagMode', self::TAG_ALL); - } - - $assetCollections = array(); - foreach ($this->assetCollectionRepository->findAll() as $assetCollection) { - $assetCollections[] = array('object' => $assetCollection, 'count' => $this->assetRepository->countByAssetCollection($assetCollection)); - } - - $tags = array(); - foreach ($activeAssetCollection !== null ? $activeAssetCollection->getTags() : $this->tagRepository->findAll() as $tag) { - $tags[] = array('object' => $tag, 'count' => $this->assetRepository->countByTag($tag, $activeAssetCollection)); - } - - if ($searchTerm !== null) { - $assets = $this->assetRepository->findBySearchTermOrTags($searchTerm, array(), $activeAssetCollection); - $this->view->assign('searchTerm', $searchTerm); - } elseif ($this->browserState->get('tagMode') === self::TAG_NONE) { - $assets = $this->assetRepository->findUntagged($activeAssetCollection); - } elseif ($this->browserState->get('activeTag') !== null) { - $assets = $this->assetRepository->findByTag($this->browserState->get('activeTag'), $activeAssetCollection); - } else { - $assets = $activeAssetCollection === null ? $this->assetRepository->findAll() : $this->assetRepository->findByAssetCollection($activeAssetCollection); - } - - $allCollectionsCount = $this->assetRepository->countAll(); - $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( - 'assets' => $assets, - 'tags' => $tags, - 'allCollectionsCount' => $allCollectionsCount, - 'allCount' => $activeAssetCollection ? $this->assetRepository->countByAssetCollection($activeAssetCollection) : $allCollectionsCount, - 'untaggedCount' => $this->assetRepository->countUntagged($activeAssetCollection), - 'tagMode' => $this->browserState->get('tagMode'), - 'assetCollections' => $assetCollections, - 'argumentNamespace' => $this->request->getArgumentNamespace(), - 'maximumFileUploadSize' => $maximumFileUploadSize, - 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); - } - - /** - * New asset form - * - * @return void - */ - public function newAction() - { - $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( - 'tags' => $this->tagRepository->findAll(), - 'assetCollections' => $this->assetCollectionRepository->findAll(), - 'maximumFileUploadSize' => $maximumFileUploadSize, - 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); - } - - /** - * @param Asset $asset - * @return void - */ - public function replaceAssetResourceAction(Asset $asset) - { - $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( - 'asset' => $asset, - 'maximumFileUploadSize' => $maximumFileUploadSize, - 'redirectPackageEnabled' => $this->packageManager->isPackageAvailable('Neos.RedirectHandler'), - 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); - } - - /** - * Replace the resource on an asset. - * - * @param AssetInterface $asset - * @param PersistentResource $resource - * @param array $options - * @return void - */ - public function updateAssetResourceAction(AssetInterface $asset, PersistentResource $resource, array $options = []) - { - try { - $originalFilename = $asset->getLabel(); - $this->assetService->replaceAssetResource($asset, $resource, $options); - } catch (\Exception $exception) { - $this->addFlashMessage('couldNotReplaceAsset', '', Message::SEVERITY_OK, [], 1463472606); - $this->forwardToReferringRequest(); - } - - $this->addFlashMessage('assetHasBeenReplaced', '', Message::SEVERITY_OK, [htmlspecialchars($originalFilename)]); - $this->redirect('index'); - } - - /** - * Edit an asset - * - * @param Asset $asset - * @return void - */ - public function editAction(Asset $asset) - { - $this->view->assignMultiple(array( - 'tags' => $asset->getAssetCollections()->count() > 0 ? $this->tagRepository->findByAssetCollections($asset->getAssetCollections()->toArray()) : $this->tagRepository->findAll(), - 'asset' => $asset, - 'assetCollections' => $this->assetCollectionRepository->findAll() - )); - } - - /** - * @return void - */ - protected function initializeUpdateAction() - { - $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); - $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); - $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); - } - - /** - * Update an asset - * - * @param Asset $asset - * @return void - */ - public function updateAction(Asset $asset) - { - $this->assetRepository->update($asset); - $this->addFlashMessage('assetHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); - $this->redirect('index'); - } - - /** - * Initialization for createAction - * - * @return void - */ - protected function initializeCreateAction() - { - $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); - $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); - $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); - $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); - } - - /** - * Create a new asset - * - * @param Asset $asset - * @return void - */ - public function createAction(Asset $asset) - { - if ($this->persistenceManager->isNewObject($asset)) { - $this->assetRepository->add($asset); - } - $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); - $this->redirect('index', null, null, array(), 0, 201); - } - - /** - * Initialization for uploadAction - * - * @return void - */ - protected function initializeUploadAction() - { - $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); - $assetMappingConfiguration->allowProperties('title', 'resource'); - $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); - $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); - } - - /** - * Upload a new asset. No redirection and no response body, for use by plupload (or similar). - * - * @param Asset $asset - * @return string - */ - public function uploadAction(Asset $asset) - { - if (($tag = $this->browserState->get('activeTag')) !== null) { - $asset->addTag($tag); - } - - if ($this->persistenceManager->isNewObject($asset)) { - $this->assetRepository->add($asset); - } else { - $this->assetRepository->update($asset); - } - - if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addAsset($asset)) { - $this->assetCollectionRepository->update($assetCollection); - } - - $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); - $this->response->setStatus(201); - return ''; - } - - /** - * Tags an asset with a tag. - * - * No redirection and no response body, no flash message, for use by plupload (or similar). - * - * @param Asset $asset - * @param Tag $tag - * @return boolean - */ - public function tagAssetAction(Asset $asset, Tag $tag) - { - $success = false; - if ($asset->addTag($tag)) { - $this->assetRepository->update($asset); - $success = true; - } - $this->view->assign('value', $success); - } - - /** - * Adds an asset to an asset collection - * - * @param Asset $asset - * @param AssetCollection $assetCollection - * @return boolean - */ - public function addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection) - { - $success = false; - if ($assetCollection->addAsset($asset)) { - $this->assetCollectionRepository->update($assetCollection); - $success = true; - } - $this->view->assign('value', $success); - } - - /** - * Delete an asset - * - * @param Asset $asset - * @return void - */ - public function deleteAction(Asset $asset) - { - try { - $this->assetRepository->remove($asset); - $this->addFlashMessage('assetHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); - } catch (AssetServiceException $exception) { - $this->addFlashMessage('assetCouldNotBeDeleted', '', Message::SEVERITY_WARNING, [], 1462196565); - } - - $this->redirect('index'); - } - - /** - * @param string $label - * @return void - * @Flow\Validate(argumentName="label", type="NotEmpty") - * @Flow\Validate(argumentName="label", type="Label") - */ - public function createTagAction($label) - { - $existingTag = $this->tagRepository->findOneByLabel($label); - if ($existingTag !== null) { - if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($existingTag)) { - $this->assetCollectionRepository->update($assetCollection); - $this->addFlashMessage('tagAlreadyExistsAndAddedToCollection', '', Message::SEVERITY_OK, [htmlspecialchars($label)]); - } - } else { - $tag = new Tag($label); - $this->tagRepository->add($tag); - if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($tag)) { - $this->assetCollectionRepository->update($assetCollection); - } - $this->addFlashMessage('tagHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($label)]); - } - $this->redirect('index'); - } - - /** - * @param Tag $tag - * @return void - */ - public function editTagAction(Tag $tag) - { - $this->view->assignMultiple(array( - 'tag' => $tag, - 'assetCollections' => $this->assetCollectionRepository->findAll() - )); - } - - /** - * @param Tag $tag - * @return void - */ - public function updateTagAction(Tag $tag) - { - $this->tagRepository->update($tag); - $this->addFlashMessage('tagHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]); - $this->redirect('index'); - } - - /** - * @param Tag $tag - * @return void - */ - public function deleteTagAction(Tag $tag) - { - $taggedAssets = $this->assetRepository->findByTag($tag); - foreach ($taggedAssets as $asset) { - $asset->removeTag($tag); - $this->assetRepository->update($asset); - } - $this->tagRepository->remove($tag); - $this->addFlashMessage('tagHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]); - $this->redirect('index'); - } - - /** - * @param string $title - * @return void - * @Flow\Validate(argumentName="title", type="NotEmpty") - * @Flow\Validate(argumentName="title", type="Label") - */ - public function createAssetCollectionAction($title) - { - $this->assetCollectionRepository->add(new AssetCollection($title)); - $this->addFlashMessage('collectionHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($title)]); - $this->redirect('index'); - } - - /** - * @param AssetCollection $assetCollection - * @return void - */ - public function editAssetCollectionAction(AssetCollection $assetCollection) - { - $this->view->assignMultiple(array( - 'assetCollection' => $assetCollection, - 'tags' => $this->tagRepository->findAll() - )); - } - - /** - * @param AssetCollection $assetCollection - * @return void - */ - public function updateAssetCollectionAction(AssetCollection $assetCollection) - { - $this->assetCollectionRepository->update($assetCollection); - $this->addFlashMessage('collectionHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($assetCollection->getTitle())]); - $this->redirect('index'); - } - - /** - * @param AssetCollection $assetCollection - * @return void - */ - public function deleteAssetCollectionAction(AssetCollection $assetCollection) - { - if ($this->browserState->get('activeAssetCollection') === $assetCollection) { - $this->browserState->set('activeAssetCollection', null); - } - $this->assetCollectionRepository->remove($assetCollection); - $this->addFlashMessage('collectionHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($assetCollection->getTitle())]); - $this->redirect('index'); - } - - /** - * Returns the lowest configured maximum upload file size - * - * @return integer - */ - protected function maximumFileUploadSize() - { - return min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize'))); - } - - /** - * Add a translated flashMessage. - * - * @param string $messageBody The translation id for the message body. - * @param string $messageTitle The translation id for the message title. - * @param string $severity - * @param array $messageArguments - * @param integer $messageCode - * @return void - */ - public function addFlashMessage($messageBody, $messageTitle = '', $severity = Message::SEVERITY_OK, array $messageArguments = array(), $messageCode = null) - { - if (is_string($messageBody)) { - $messageBody = $this->translator->translateById($messageBody, $messageArguments, null, null, 'Main', 'Neos.Media') ?: $messageBody; - } - - $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Main', 'Neos.Media'); - parent::addFlashMessage($messageBody, $messageTitle, $severity, $messageArguments, $messageCode); - } -} diff --git a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php index 0c2aebd3224..017b5ab256f 100644 --- a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php +++ b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php @@ -11,18 +11,39 @@ * source code. */ +use Doctrine\Common\Persistence\Proxy as DoctrineProxy; +use Doctrine\ORM\EntityNotFoundException; use Neos\Flow\Annotations as Flow; use Neos\Flow\Configuration\ConfigurationManager; use Neos\Error\Messages\Error; use Neos\Error\Messages\Message; +use Neos\Flow\I18n\Translator; +use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\Exception\InvalidArgumentValueException; +use Neos\Flow\Mvc\View\JsonView; +use Neos\Flow\Mvc\View\ViewInterface; +use Neos\Flow\Package\PackageManagerInterface; +use Neos\Flow\Property\TypeConverter\PersistentObjectConverter; use Neos\Flow\ResourceManagement\PersistentResource; use Neos\Flow\Security\Context; +use Neos\FluidAdaptor\View\TemplateView; +use Neos\Media\Domain\Model\Asset; +use Neos\Media\Domain\Model\Tag; +use Neos\Media\Domain\Repository\AssetCollectionRepository; +use Neos\Media\Domain\Repository\AssetRepository; +use Neos\Media\Domain\Repository\AudioRepository; +use Neos\Media\Domain\Repository\DocumentRepository; +use Neos\Media\Domain\Repository\ImageRepository; +use Neos\Media\Domain\Repository\TagRepository; +use Neos\Media\Domain\Repository\VideoRepository; +use Neos\Media\Domain\Service\AssetService; +use Neos\Media\Domain\Session\BrowserState; +use Neos\Media\TypeConverter\AssetInterfaceConverter; +use Neos\Utility\Files; use Neos\Utility\MediaTypes; use Neos\Utility\TypeHandling; use Neos\Media\Domain\Model\AssetCollection; use Neos\Media\Domain\Model\AssetInterface; -use Neos\Media\Exception\AssetServiceException; use Neos\Neos\Controller\BackendUserTranslationTrait; use Neos\Neos\Controller\CreateContentContextTrait; use Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties; @@ -41,11 +62,26 @@ * * @Flow\Scope("singleton") */ -class AssetController extends \Neos\Media\Browser\Controller\AssetController +class AssetController extends ActionController { use CreateContentContextTrait; use BackendUserTranslationTrait; + const TAG_GIVEN = 0; + const TAG_ALL = 1; + const TAG_NONE = 2; + + const COLLECTION_GIVEN = 0; + const COLLECTION_ALL = 1; + + /** + * @var array + */ + protected $viewFormatToObjectNameMap = array( + 'html' => TemplateView::class, + 'json' => JsonView::class + ); + /** * @Flow\Inject * @var NodeDataRepository @@ -112,6 +148,48 @@ class AssetController extends \Neos\Media\Browser\Controller\AssetController */ protected $contentDimensionPresetSource; + /** + * @Flow\Inject + * @var AssetRepository + */ + protected $assetRepository; + + /** + * @Flow\Inject + * @var TagRepository + */ + protected $tagRepository; + + /** + * @Flow\Inject + * @var AssetCollectionRepository + */ + protected $assetCollectionRepository; + + /** + * @Flow\Inject + * @var PackageManagerInterface + */ + protected $packageManager; + + /** + * @Flow\Inject(lazy = false) + * @var BrowserState + */ + protected $browserState; + + /** + * @Flow\Inject + * @var AssetService + */ + protected $assetService; + + /** + * @Flow\Inject + * @var Translator + */ + protected $translator; + /** * @return void */ @@ -125,6 +203,435 @@ public function initializeObject() } } + /** + * Set common variables on the view + * + * @param ViewInterface $view + * @return void + */ + protected function initializeView(ViewInterface $view) + { + $view->assignMultiple(array( + 'view' => $this->browserState->get('view'), + 'sortBy' => $this->browserState->get('sortBy'), + 'sortDirection' => $this->browserState->get('sortDirection'), + 'filter' => $this->browserState->get('filter'), + 'activeTag' => $this->browserState->get('activeTag'), + 'activeAssetCollection' => $this->browserState->get('activeAssetCollection') + )); + } + + /** + * List existing assets + * + * @param string $view + * @param string $sortBy + * @param string $sortDirection + * @param string $filter + * @param integer $tagMode + * @param Tag $tag + * @param string $searchTerm + * @param integer $collectionMode + * @param AssetCollection $assetCollection + * @return void + */ + public function indexAction($view = null, $sortBy = null, $sortDirection = null, $filter = null, $tagMode = self::TAG_GIVEN, Tag $tag = null, $searchTerm = null, $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null) + { + if ($view !== null) { + $this->browserState->set('view', $view); + $this->view->assign('view', $view); + } + if ($sortBy !== null) { + $this->browserState->set('sortBy', $sortBy); + $this->view->assign('sortBy', $sortBy); + } + if ($sortDirection !== null) { + $this->browserState->set('sortDirection', $sortDirection); + $this->view->assign('sortDirection', $sortDirection); + } + if ($filter !== null) { + $this->browserState->set('filter', $filter); + $this->view->assign('filter', $filter); + } + if ($tagMode === self::TAG_GIVEN && $tag !== null) { + $this->browserState->set('activeTag', $tag); + $this->view->assign('activeTag', $tag); + } elseif ($tagMode === self::TAG_NONE || $tagMode === self::TAG_ALL) { + $this->browserState->set('activeTag', null); + $this->view->assign('activeTag', null); + } + $this->browserState->set('tagMode', $tagMode); + + if ($collectionMode === self::COLLECTION_GIVEN && $assetCollection !== null) { + $this->browserState->set('activeAssetCollection', $assetCollection); + $this->view->assign('activeAssetCollection', $assetCollection); + } elseif ($collectionMode === self::COLLECTION_ALL) { + $this->browserState->set('activeAssetCollection', null); + $this->view->assign('activeAssetCollection', null); + } + $this->browserState->set('collectionMode', $collectionMode); + try { + /** @var AssetCollection $activeAssetCollection */ + $activeAssetCollection = $this->browserState->get('activeAssetCollection'); + if ($activeAssetCollection instanceof DoctrineProxy) { + // To trigger a possible EntityNotFound have to load the entity + $activeAssetCollection->__load(); + } + } catch (EntityNotFoundException $exception) { + // If a removed tasset collection is still in the browser state it can not be fetched + $this->browserState->set('activeAssetCollection', null); + $activeAssetCollection = null; + } + + // Unset active tag if it isn't available in the active asset collection + if ($this->browserState->get('activeTag') && $activeAssetCollection !== null && !$activeAssetCollection->getTags()->contains($this->browserState->get('activeTag'))) { + $this->browserState->set('activeTag', null); + $this->view->assign('activeTag', null); + } + + if ($this->browserState->get('filter') !== 'All') { + switch ($this->browserState->get('filter')) { + case 'Image': + $this->assetRepository = new ImageRepository(); + break; + case 'Document': + $this->assetRepository = new DocumentRepository(); + break; + case 'Video': + $this->assetRepository = new VideoRepository(); + break; + case 'Audio': + $this->assetRepository = new AudioRepository(); + break; + } + } + + switch ($this->browserState->get('sortBy')) { + case 'Name': + $this->assetRepository->setDefaultOrderings(array('resource.filename' => $this->browserState->get('sortDirection'))); + break; + case 'Modified': + default: + $this->assetRepository->setDefaultOrderings(array('lastModified' => $this->browserState->get('sortDirection'))); + break; + } + + if (!$this->browserState->get('activeTag') && $this->browserState->get('tagMode') === self::TAG_GIVEN) { + $this->browserState->set('tagMode', self::TAG_ALL); + } + + $assetCollections = array(); + foreach ($this->assetCollectionRepository->findAll() as $assetCollection) { + $assetCollections[] = array('object' => $assetCollection, 'count' => $this->assetRepository->countByAssetCollection($assetCollection)); + } + + $tags = array(); + foreach ($activeAssetCollection !== null ? $activeAssetCollection->getTags() : $this->tagRepository->findAll() as $tag) { + $tags[] = array('object' => $tag, 'count' => $this->assetRepository->countByTag($tag, $activeAssetCollection)); + } + + if ($searchTerm !== null) { + $assets = $this->assetRepository->findBySearchTermOrTags($searchTerm, array(), $activeAssetCollection); + $this->view->assign('searchTerm', $searchTerm); + } elseif ($this->browserState->get('tagMode') === self::TAG_NONE) { + $assets = $this->assetRepository->findUntagged($activeAssetCollection); + } elseif ($this->browserState->get('activeTag') !== null) { + $assets = $this->assetRepository->findByTag($this->browserState->get('activeTag'), $activeAssetCollection); + } else { + $assets = $activeAssetCollection === null ? $this->assetRepository->findAll() : $this->assetRepository->findByAssetCollection($activeAssetCollection); + } + + $allCollectionsCount = $this->assetRepository->countAll(); + $maximumFileUploadSize = $this->maximumFileUploadSize(); + $this->view->assignMultiple(array( + 'assets' => $assets, + 'tags' => $tags, + 'allCollectionsCount' => $allCollectionsCount, + 'allCount' => $activeAssetCollection ? $this->assetRepository->countByAssetCollection($activeAssetCollection) : $allCollectionsCount, + 'untaggedCount' => $this->assetRepository->countUntagged($activeAssetCollection), + 'tagMode' => $this->browserState->get('tagMode'), + 'assetCollections' => $assetCollections, + 'argumentNamespace' => $this->request->getArgumentNamespace(), + 'maximumFileUploadSize' => $maximumFileUploadSize, + 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) + )); + } + + /** + * New asset form + * + * @return void + */ + public function newAction() + { + $maximumFileUploadSize = $this->maximumFileUploadSize(); + $this->view->assignMultiple(array( + 'tags' => $this->tagRepository->findAll(), + 'assetCollections' => $this->assetCollectionRepository->findAll(), + 'maximumFileUploadSize' => $maximumFileUploadSize, + 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) + )); + } + + /** + * @param Asset $asset + * @return void + */ + public function replaceAssetResourceAction(Asset $asset) + { + $maximumFileUploadSize = $this->maximumFileUploadSize(); + $this->view->assignMultiple(array( + 'asset' => $asset, + 'maximumFileUploadSize' => $maximumFileUploadSize, + 'redirectPackageEnabled' => $this->packageManager->isPackageAvailable('Neos.RedirectHandler'), + 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) + )); + } + + /** + * Edit an asset + * + * @param Asset $asset + * @return void + */ + public function editAction(Asset $asset) + { + $this->view->assignMultiple(array( + 'tags' => $asset->getAssetCollections()->count() > 0 ? $this->tagRepository->findByAssetCollections($asset->getAssetCollections()->toArray()) : $this->tagRepository->findAll(), + 'asset' => $asset, + 'assetCollections' => $this->assetCollectionRepository->findAll() + )); + } + + /** + * @return void + */ + protected function initializeUpdateAction() + { + $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); + $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); + $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); + } + + /** + * Update an asset + * + * @param Asset $asset + * @return void + */ + public function updateAction(Asset $asset) + { + $this->assetRepository->update($asset); + $this->addFlashMessage('assetHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); + $this->redirect('index'); + } + + /** + * Initialization for createAction + * + * @return void + */ + protected function initializeCreateAction() + { + $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); + $assetMappingConfiguration->allowProperties('title', 'resource', 'tags', 'assetCollections'); + $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); + $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); + } + + /** + * Create a new asset + * + * @param Asset $asset + * @return void + */ + public function createAction(Asset $asset) + { + if ($this->persistenceManager->isNewObject($asset)) { + $this->assetRepository->add($asset); + } + $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); + $this->redirect('index', null, null, array(), 0, 201); + } + + /** + * Initialization for uploadAction + * + * @return void + */ + protected function initializeUploadAction() + { + $assetMappingConfiguration = $this->arguments->getArgument('asset')->getPropertyMappingConfiguration(); + $assetMappingConfiguration->allowProperties('title', 'resource'); + $assetMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); + $assetMappingConfiguration->setTypeConverterOption(AssetInterfaceConverter::class, AssetInterfaceConverter::CONFIGURATION_ONE_PER_RESOURCE, true); + } + + /** + * Upload a new asset. No redirection and no response body, for use by plupload (or similar). + * + * @param Asset $asset + * @return string + */ + public function uploadAction(Asset $asset) + { + if (($tag = $this->browserState->get('activeTag')) !== null) { + $asset->addTag($tag); + } + + if ($this->persistenceManager->isNewObject($asset)) { + $this->assetRepository->add($asset); + } else { + $this->assetRepository->update($asset); + } + + if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addAsset($asset)) { + $this->assetCollectionRepository->update($assetCollection); + } + + $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); + $this->response->setStatus(201); + return ''; + } + + /** + * Tags an asset with a tag. + * + * No redirection and no response body, no flash message, for use by plupload (or similar). + * + * @param Asset $asset + * @param Tag $tag + * @return boolean + */ + public function tagAssetAction(Asset $asset, Tag $tag) + { + $success = false; + if ($asset->addTag($tag)) { + $this->assetRepository->update($asset); + $success = true; + } + $this->view->assign('value', $success); + return $success; + } + + /** + * Adds an asset to an asset collection + * + * @param Asset $asset + * @param AssetCollection $assetCollection + * @return boolean + */ + public function addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection) + { + $success = false; + if ($assetCollection->addAsset($asset)) { + $this->assetCollectionRepository->update($assetCollection); + $success = true; + } + $this->view->assign('value', $success); + return $success; + } + + /** + * @param string $label + * @return void + * @Flow\Validate(argumentName="label", type="NotEmpty") + * @Flow\Validate(argumentName="label", type="Label") + */ + public function createTagAction($label) + { + $existingTag = $this->tagRepository->findOneByLabel($label); + if ($existingTag !== null) { + if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($existingTag)) { + $this->assetCollectionRepository->update($assetCollection); + $this->addFlashMessage('tagAlreadyExistsAndAddedToCollection', '', Message::SEVERITY_OK, [htmlspecialchars($label)]); + } + } else { + $tag = new Tag($label); + $this->tagRepository->add($tag); + if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addTag($tag)) { + $this->assetCollectionRepository->update($assetCollection); + } + $this->addFlashMessage('tagHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($label)]); + } + $this->redirect('index'); + } + + /** + * @param Tag $tag + * @return void + */ + public function editTagAction(Tag $tag) + { + $this->view->assignMultiple(array( + 'tag' => $tag, + 'assetCollections' => $this->assetCollectionRepository->findAll() + )); + } + + /** + * @param Tag $tag + * @return void + */ + public function updateTagAction(Tag $tag) + { + $this->tagRepository->update($tag); + $this->addFlashMessage('tagHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]); + $this->redirect('index'); + } + + /** + * @param Tag $tag + * @return void + */ + public function deleteTagAction(Tag $tag) + { + $taggedAssets = $this->assetRepository->findByTag($tag); + foreach ($taggedAssets as $asset) { + $asset->removeTag($tag); + $this->assetRepository->update($asset); + } + $this->tagRepository->remove($tag); + $this->addFlashMessage('tagHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($tag->getLabel())]); + $this->redirect('index'); + } + + /** + * @param string $title + * @return void + * @Flow\Validate(argumentName="title", type="NotEmpty") + * @Flow\Validate(argumentName="title", type="Label") + */ + public function createAssetCollectionAction($title) + { + $this->assetCollectionRepository->add(new AssetCollection($title)); + $this->addFlashMessage('collectionHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($title)]); + $this->redirect('index'); + } + + /** + * @param AssetCollection $assetCollection + * @return void + */ + public function editAssetCollectionAction(AssetCollection $assetCollection) + { + $this->view->assignMultiple(array( + 'assetCollection' => $assetCollection, + 'tags' => $this->tagRepository->findAll() + )); + } + + /** + * @param AssetCollection $assetCollection + * @return void + */ + public function updateAssetCollectionAction(AssetCollection $assetCollection) + { + $this->assetCollectionRepository->update($assetCollection); + $this->addFlashMessage('collectionHasBeenUpdated', '', Message::SEVERITY_OK, [htmlspecialchars($assetCollection->getTitle())]); + $this->redirect('index'); + } + /** * Delete an asset * @@ -152,7 +659,6 @@ public function deleteAction(\Neos\Media\Domain\Model\Asset $asset) $this->redirect('index'); } - // FIXME: Resources are not deleted, because we cannot be sure that the resource isn't used anywhere else. $this->assetRepository->remove($asset); $this->addFlashMessage(sprintf('Asset "%s" has been deleted.', $asset->getLabel()), null, null, array(), 1412375050); $this->redirect('index'); @@ -184,7 +690,16 @@ public function updateAssetResourceAction(AssetInterface $asset, PersistentResou $this->redirect('index'); } - parent::updateAssetResourceAction($asset, $resource, $options); + try { + $originalFilename = $asset->getLabel(); + $this->assetService->replaceAssetResource($asset, $resource, $options); + } catch (\Exception $exception) { + $this->addFlashMessage('couldNotReplaceAsset', '', Message::SEVERITY_OK, [], 1463472606); + $this->forwardToReferringRequest(); + } + + $this->addFlashMessage('assetHasBeenReplaced', '', Message::SEVERITY_OK, [htmlspecialchars($originalFilename)]); + $this->redirect('index'); } /** @@ -232,7 +747,13 @@ public function deleteAssetCollectionAction(AssetCollection $assetCollection) $site->setAssetCollection(null); $this->siteRepository->update($site); } - parent::deleteAssetCollectionAction($assetCollection); + + if ($this->browserState->get('activeAssetCollection') === $assetCollection) { + $this->browserState->set('activeAssetCollection', null); + } + $this->assetCollectionRepository->remove($assetCollection); + $this->addFlashMessage('collectionHasBeenDeleted', '', Message::SEVERITY_OK, [htmlspecialchars($assetCollection->getTitle())]); + $this->redirect('index'); } /** @@ -288,4 +809,14 @@ public function addFlashMessage($messageBody, $messageTitle = '', $severity = Me $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Modules', 'Neos.Neos'); parent::addFlashMessage($messageBody, $messageTitle, $severity, $messageArguments, $messageCode); } + + /** + * Returns the lowest configured maximum upload file size + * + * @return integer + */ + protected function maximumFileUploadSize() + { + return min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize'))); + } } From 88a693c1dc8387b280f1f1733887e4231a8dfe9b Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Wed, 14 Dec 2016 10:36:23 +0100 Subject: [PATCH 06/42] TASK: Rename Typo3MediaBrowserCallbacks to NeosMediaBrowserCallbacks --- .../Templates/Module/Management/Asset/Index.html | 4 ++-- Neos.Media.Browser/Resources/Public/Scripts/edit.js | 8 ++++---- .../Resources/Public/Scripts/upload.js | 8 ++++---- .../Content/Inspector/Editors/AssetEditor.js | 6 +++--- .../Content/Inspector/Editors/ImageEditor.js | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Index.html b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Index.html index d808a5e29e1..b327f0c869b 100644 --- a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Index.html +++ b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Index.html @@ -282,8 +282,8 @@

var uploadUrl = ''; var maximumFileUploadSize = {maximumFileUploadSize}; - if (window.parent !== window && window.parent.Typo3MediaBrowserCallbacks && window.parent.Typo3MediaBrowserCallbacks.refreshThumbnail) { - window.parent.Typo3MediaBrowserCallbacks.refreshThumbnail(); + if (window.parent !== window && window.parent.NeosMediaBrowserCallbacks && window.parent.NeosMediaBrowserCallbacks.refreshThumbnail) { + window.parent.NeosMediaBrowserCallbacks.refreshThumbnail(); } diff --git a/Neos.Media.Browser/Resources/Public/Scripts/edit.js b/Neos.Media.Browser/Resources/Public/Scripts/edit.js index ff7cfd0c6a7..6cff32aadf5 100644 --- a/Neos.Media.Browser/Resources/Public/Scripts/edit.js +++ b/Neos.Media.Browser/Resources/Public/Scripts/edit.js @@ -1,11 +1,11 @@ (function($) { $(function() { - if (window.parent !== window && window.parent.Typo3MediaBrowserCallbacks) { + if (window.parent !== window && window.parent.NeosMediaBrowserCallbacks) { $('.neos-action-cancel, .neos-button-primary', '.neos-footer').on('click', function(e) { - if (window.parent.Typo3MediaBrowserCallbacks && typeof window.parent.Typo3MediaBrowserCallbacks.close === 'function') { - window.parent.Typo3MediaBrowserCallbacks.close(); + if (window.parent.NeosMediaBrowserCallbacks && typeof window.parent.NeosMediaBrowserCallbacks.close === 'function') { + window.parent.NeosMediaBrowserCallbacks.close(); } }); } }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/Neos.Media.Browser/Resources/Public/Scripts/upload.js b/Neos.Media.Browser/Resources/Public/Scripts/upload.js index 99f96635573..e17cd2cf6d8 100644 --- a/Neos.Media.Browser/Resources/Public/Scripts/upload.js +++ b/Neos.Media.Browser/Resources/Public/Scripts/upload.js @@ -111,16 +111,16 @@ $fileDropZone.removeClass('neos-upload-area-active'); }); - if (window.parent !== window && window.parent.Typo3MediaBrowserCallbacks) { + if (window.parent !== window && window.parent.NeosMediaBrowserCallbacks) { // we are inside iframe $('.asset-list').on('click', '[data-asset-identifier]', function(e) { if ($(e.target).closest('button').length === 0) { - if(window.parent.Typo3MediaBrowserCallbacks && typeof window.parent.Typo3MediaBrowserCallbacks.assetChosen === 'function') { - window.parent.Typo3MediaBrowserCallbacks.assetChosen($(this).attr('data-asset-identifier')); + if(window.parent.NeosMediaBrowserCallbacks && typeof window.parent.NeosMediaBrowserCallbacks.assetChosen === 'function') { + window.parent.NeosMediaBrowserCallbacks.assetChosen($(this).attr('data-asset-identifier')); } e.preventDefault(); } }); } }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/AssetEditor.js b/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/AssetEditor.js index 1763d76eb64..4a829113f7d 100644 --- a/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/AssetEditor.js +++ b/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/AssetEditor.js @@ -37,8 +37,8 @@ function(Ember, $, FileUpload, template, SecondaryInspectorController, Utility, template: Ember.Handlebars.compile(''), didInsertElement: function() { this.$().find('iframe').on('load', function(event) { - if (window.Typo3MediaBrowserCallbacks && window.Typo3MediaBrowserCallbacks.onLoad) { - window.Typo3MediaBrowserCallbacks.onLoad(event); + if (window.NeosMediaBrowserCallbacks && window.NeosMediaBrowserCallbacks.onLoad) { + window.NeosMediaBrowserCallbacks.onLoad(event); } }); } @@ -157,7 +157,7 @@ function(Ember, $, FileUpload, template, SecondaryInspectorController, Utility, _beforeMediaBrowserIsShown: function() { var that = this; - window.Typo3MediaBrowserCallbacks = { + window.NeosMediaBrowserCallbacks = { assetChosen: function(assetIdentifier) { // we hide the default upload preview image; as we only want the loading indicator to be visible that.set('_loadPreviewImageHandler', HttpClient.getResource( diff --git a/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/ImageEditor.js b/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/ImageEditor.js index 03fb791ee37..d35a7b52410 100644 --- a/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/ImageEditor.js +++ b/Neos.Neos/Resources/Public/JavaScript/Content/Inspector/Editors/ImageEditor.js @@ -310,7 +310,7 @@ function (Ember, $, FileUpload, template, cropTemplate, BooleanEditor, Spinner, console.log('Invalid JSON value in image editor', this.get('value')); } - window.Typo3MediaBrowserCallbacks = { + window.NeosMediaBrowserCallbacks = { _assetIdentifier: value && '__identity' in value ? value.__identity : null, _frameLoaded: false, _reloadPreviewImage: function() { @@ -366,8 +366,8 @@ function (Ember, $, FileUpload, template, cropTemplate, BooleanEditor, Spinner, template: Ember.Handlebars.compile(''), didInsertElement: function() { this.$().find('iframe').on('load', function(event) { - if (window.Typo3MediaBrowserCallbacks && window.Typo3MediaBrowserCallbacks.onLoad) { - window.Typo3MediaBrowserCallbacks.onLoad(event, this); + if (window.NeosMediaBrowserCallbacks && window.NeosMediaBrowserCallbacks.onLoad) { + window.NeosMediaBrowserCallbacks.onLoad(event, this); } }); } @@ -376,7 +376,7 @@ function (Ember, $, FileUpload, template, cropTemplate, BooleanEditor, Spinner, _beforeMediaBrowserEditIsShown: function () { var that = this; - window.Typo3MediaBrowserCallbacks = { + window.NeosMediaBrowserCallbacks = { close: function () { SecondaryInspectorController.hide(that.get('_mediaBrowserEditView')); that._initializeMediaBrowserEditView(); @@ -1080,8 +1080,8 @@ function (Ember, $, FileUpload, template, cropTemplate, BooleanEditor, Spinner, template: Ember.Handlebars.compile(''), didInsertElement: function() { this.$().find('iframe').on('load', function(event) { - if (window.Typo3MediaBrowserCallbacks && window.Typo3MediaBrowserCallbacks.onLoad) { - window.Typo3MediaBrowserCallbacks.onLoad(event, this); + if (window.NeosMediaBrowserCallbacks && window.NeosMediaBrowserCallbacks.onLoad) { + window.NeosMediaBrowserCallbacks.onLoad(event, this); } }); } From 94ff76913907cfe80743ecbe9e11591de5b4e846 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Wed, 14 Dec 2016 10:54:00 +0100 Subject: [PATCH 07/42] TASK: Move translations and fix flash message translation --- .../Classes/Controller/Module/Management/AssetController.php | 4 ++-- Neos.Media.Browser/Configuration/Settings.yaml | 1 + .../Resources/Private/Translations/af/Main.xlf | 0 .../Resources/Private/Translations/ar/Main.xlf | 0 .../Resources/Private/Translations/ca/Main.xlf | 0 .../Resources/Private/Translations/cs/Main.xlf | 0 .../Resources/Private/Translations/da/Main.xlf | 0 .../Resources/Private/Translations/de/Main.xlf | 0 .../Resources/Private/Translations/el/Main.xlf | 0 .../Resources/Private/Translations/en/Main.xlf | 0 .../Resources/Private/Translations/es/Main.xlf | 0 .../Resources/Private/Translations/fi/Main.xlf | 0 .../Resources/Private/Translations/fr/Main.xlf | 0 .../Resources/Private/Translations/he/Main.xlf | 0 .../Resources/Private/Translations/hu/Main.xlf | 0 .../Resources/Private/Translations/id_ID/Main.xlf | 0 .../Resources/Private/Translations/it/Main.xlf | 0 .../Resources/Private/Translations/ja/Main.xlf | 0 .../Resources/Private/Translations/kk_KZ/Main.xlf | 0 .../Resources/Private/Translations/km/Main.xlf | 0 .../Resources/Private/Translations/ko/Main.xlf | 0 .../Resources/Private/Translations/la/Main.xlf | 0 .../Resources/Private/Translations/lv/Main.xlf | 0 .../Resources/Private/Translations/mr/Main.xlf | 0 .../Resources/Private/Translations/nl/Main.xlf | 0 .../Resources/Private/Translations/no/Main.xlf | 0 .../Resources/Private/Translations/pl/Main.xlf | 0 .../Resources/Private/Translations/pt/Main.xlf | 0 .../Resources/Private/Translations/pt_BR/Main.xlf | 0 .../Resources/Private/Translations/ro/Main.xlf | 0 .../Resources/Private/Translations/ru/Main.xlf | 0 .../Resources/Private/Translations/sr/Main.xlf | 0 .../Resources/Private/Translations/sv/Main.xlf | 0 .../Resources/Private/Translations/tr/Main.xlf | 0 .../Resources/Private/Translations/uk/Main.xlf | 0 .../Resources/Private/Translations/vi/Main.xlf | 0 .../Resources/Private/Translations/zh/Main.xlf | 0 .../Resources/Private/Translations/zh_TW/Main.xlf | 0 38 files changed, 3 insertions(+), 2 deletions(-) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/af/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ar/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ca/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/cs/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/da/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/de/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/el/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/en/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/es/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/fi/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/fr/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/he/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/hu/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/id_ID/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/it/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ja/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/kk_KZ/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/km/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ko/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/la/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/lv/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/mr/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/nl/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/no/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/pl/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/pt/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/pt_BR/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ro/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/ru/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/sr/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/sv/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/tr/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/uk/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/vi/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/zh/Main.xlf (100%) rename {Neos.Media => Neos.Media.Browser}/Resources/Private/Translations/zh_TW/Main.xlf (100%) diff --git a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php index 017b5ab256f..7341a5d6495 100644 --- a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php +++ b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php @@ -803,10 +803,10 @@ protected function getErrorFlashMessage() public function addFlashMessage($messageBody, $messageTitle = '', $severity = Message::SEVERITY_OK, array $messageArguments = [], $messageCode = null) { if (is_string($messageBody)) { - $messageBody = $this->translator->translateById($messageBody, $messageArguments, null, null, 'Modules', 'Neos.Neos') ?: $messageBody; + $messageBody = $this->translator->translateById($messageBody, $messageArguments, null, null, 'Main', 'Neos.Media.Browser') ?: $messageBody; } - $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Modules', 'Neos.Neos'); + $messageTitle = $this->translator->translateById($messageTitle, $messageArguments, null, null, 'Main', 'Neos.Media.Browser'); parent::addFlashMessage($messageBody, $messageTitle, $severity, $messageArguments, $messageCode); } diff --git a/Neos.Media.Browser/Configuration/Settings.yaml b/Neos.Media.Browser/Configuration/Settings.yaml index 721de0f4dd4..a9a294e0688 100644 --- a/Neos.Media.Browser/Configuration/Settings.yaml +++ b/Neos.Media.Browser/Configuration/Settings.yaml @@ -54,4 +54,5 @@ Neos: translation: autoInclude: Neos.Media.Browser: + - Main - Modules diff --git a/Neos.Media/Resources/Private/Translations/af/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/af/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/af/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/af/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ar/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ar/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ar/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ar/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ca/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ca/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ca/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ca/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/cs/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/cs/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/cs/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/cs/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/da/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/da/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/da/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/da/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/de/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/de/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/de/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/de/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/el/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/el/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/el/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/el/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/en/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/en/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/es/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/es/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/es/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/es/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/fi/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/fi/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/fi/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/fi/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/fr/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/fr/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/fr/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/fr/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/he/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/he/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/he/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/he/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/hu/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/hu/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/hu/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/hu/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/id_ID/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/id_ID/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/id_ID/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/id_ID/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/it/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/it/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/it/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/it/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ja/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ja/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ja/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ja/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/kk_KZ/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/kk_KZ/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/kk_KZ/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/kk_KZ/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/km/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/km/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/km/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/km/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ko/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ko/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ko/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ko/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/la/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/la/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/la/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/la/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/lv/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/lv/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/lv/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/lv/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/mr/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/mr/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/mr/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/mr/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/nl/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/nl/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/nl/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/nl/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/no/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/no/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/no/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/no/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/pl/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/pl/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/pl/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/pl/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/pt/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/pt/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/pt/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/pt/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/pt_BR/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/pt_BR/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/pt_BR/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/pt_BR/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ro/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ro/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ro/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ro/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/ru/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/ru/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/ru/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/ru/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/sr/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/sr/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/sr/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/sr/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/sv/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/sv/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/sv/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/sv/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/tr/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/tr/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/tr/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/tr/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/uk/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/uk/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/uk/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/uk/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/vi/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/vi/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/vi/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/vi/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/zh/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/zh/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/zh/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/zh/Main.xlf diff --git a/Neos.Media/Resources/Private/Translations/zh_TW/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/zh_TW/Main.xlf similarity index 100% rename from Neos.Media/Resources/Private/Translations/zh_TW/Main.xlf rename to Neos.Media.Browser/Resources/Private/Translations/zh_TW/Main.xlf From b4f4a1fef113e3f73a63abf8e7d8ef5cb7ad2086 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Wed, 14 Dec 2016 13:30:50 +0100 Subject: [PATCH 08/42] TASK: Simplify Views.yaml --- Neos.Media.Browser/Configuration/Views.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Neos.Media.Browser/Configuration/Views.yaml b/Neos.Media.Browser/Configuration/Views.yaml index 1baacc34e9b..94d6aa98fef 100644 --- a/Neos.Media.Browser/Configuration/Views.yaml +++ b/Neos.Media.Browser/Configuration/Views.yaml @@ -5,11 +5,8 @@ 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Layouts/Module' 'Neos.Neos': 'resource://Neos.Neos/Private/Layouts' partialRootPaths: - 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' - - templateRootPathPattern: 'resource://Neos.Media.Browser/Private/Templates' - templatePathAndFilenamePattern: '@templateRoot/@subpackage/Module/Management/Asset/@action.@format' + 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' - requestFilter: 'isPackage("Neos.Media.Browser") && isFormat("html")' @@ -18,8 +15,5 @@ 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Layouts/Inspector' 'Neos.Neos': 'resource://Neos.Neos/Private/Layouts' partialRootPaths: - 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' - - templateRootPathPattern: 'resource://Neos.Media.Browser/Private/Templates' - templatePathAndFilenamePattern: '@templateRoot/@subpackage/Module/Management/Asset/@action.@format' + 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' From b97140ddbdffe3987a4d809abe3774844a3e55ca Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Wed, 14 Dec 2016 13:43:51 +0100 Subject: [PATCH 09/42] TASK: Thumbnail and Preview preset belong to Neos --- Neos.Media.Browser/Configuration/Settings.yaml | 9 ++------- .../Resources/Private/Partials/ListView.html | 4 ++-- .../Resources/Private/Partials/ThumbnailView.html | 2 +- .../Private/Templates/Module/Management/Asset/Edit.html | 2 +- .../Classes/Controller/Backend/ContentController.php | 4 ++-- Neos.Neos/Configuration/Settings.yaml | 9 +++++++++ .../Private/Templates/Service/Assets/Index.html | 2 +- .../Resources/Private/Templates/Service/Assets/Show.html | 2 +- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Neos.Media.Browser/Configuration/Settings.yaml b/Neos.Media.Browser/Configuration/Settings.yaml index a9a294e0688..7b76bea4b5c 100644 --- a/Neos.Media.Browser/Configuration/Settings.yaml +++ b/Neos.Media.Browser/Configuration/Settings.yaml @@ -10,13 +10,6 @@ Neos: Media: - thumbnailPresets: - 'Neos.Media.Browser:Thumbnail': - maximumWidth: 250 - maximumHeight: 250 - 'Neos.Media.Browser:Preview': - maximumWidth: 1000 - maximumHeight: 1000 Browser: bodyClasses: 'neos neos-module media-browser' scripts: @@ -26,6 +19,7 @@ Neos: - 'resource://Neos.Media.Browser/Public/JavaScript/Modules/media-browser.js' styles: - 'resource://Neos.Neos/Public/Styles/Neos.css' + Flow: security: authentication: @@ -40,6 +34,7 @@ Neos: mvc: routes: 'Neos.Media.Browser': true + Neos: modules: management: diff --git a/Neos.Media.Browser/Resources/Private/Partials/ListView.html b/Neos.Media.Browser/Resources/Private/Partials/ListView.html index 02fbd24ee99..ebbe5d1dffa 100644 --- a/Neos.Media.Browser/Resources/Private/Partials/ListView.html +++ b/Neos.Media.Browser/Resources/Private/Partials/ListView.html @@ -66,8 +66,8 @@ -
- +
+
{asset.label} diff --git a/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html b/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html index df150b13259..aa8e626b290 100644 --- a/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html +++ b/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html @@ -7,7 +7,7 @@
  • - +
    diff --git a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Edit.html b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Edit.html index 5bcc5e14284..e727ccbb0fe 100644 --- a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Edit.html +++ b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/Edit.html @@ -122,7 +122,7 @@ diff --git a/Neos.Neos/Classes/Controller/Backend/ContentController.php b/Neos.Neos/Classes/Controller/Backend/ContentController.php index d2dce092a63..43e99e86480 100644 --- a/Neos.Neos/Classes/Controller/Backend/ContentController.php +++ b/Neos.Neos/Classes/Controller/Backend/ContentController.php @@ -251,7 +251,7 @@ protected function getImagePreviewData(Image $image) ], 'mediaType' => $image->getResource()->getMediaType() ]; - $thumbnail = $this->thumbnailService->getThumbnail($image, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Preview')); + $thumbnail = $this->thumbnailService->getThumbnail($image, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Neos:Preview')); if ($thumbnail !== null) { $imageProperties['previewImageResourceUri'] = $this->thumbnailService->getUriForThumbnail($thumbnail); $imageProperties['previewDimensions'] = [ @@ -311,7 +311,7 @@ protected function getAssetProperties(Asset $asset) 'assetUuid' => $this->persistenceManager->getIdentifierByObject($asset), 'filename' => $asset->getResource()->getFilename() ]; - $thumbnail = $this->thumbnailService->getThumbnail($asset, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Thumbnail')); + $thumbnail = $this->thumbnailService->getThumbnail($asset, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Neos:Thumbnail')); if ($thumbnail !== null) { $assetProperties['previewImageResourceUri'] = $this->thumbnailService->getUriForThumbnail($thumbnail); $assetProperties['previewSize'] = ['w' => $thumbnail->getWidth(), 'h' => $thumbnail->getHeight()]; diff --git a/Neos.Neos/Configuration/Settings.yaml b/Neos.Neos/Configuration/Settings.yaml index 7034496c6f8..ce45d9ae9af 100755 --- a/Neos.Neos/Configuration/Settings.yaml +++ b/Neos.Neos/Configuration/Settings.yaml @@ -694,6 +694,15 @@ Neos: Neos.Rendering: Neos\Neos\Fusion\Helper\RenderingHelper Neos.Caching: Neos\Neos\Fusion\Helper\CachingHelper + Media: + thumbnailPresets: + 'Neos.Neos:Thumbnail': + maximumWidth: 250 + maximumHeight: 250 + 'Neos.Neos:Preview': + maximumWidth: 1000 + maximumHeight: 1000 + Setup: stepOrder: - neosRequirements diff --git a/Neos.Neos/Resources/Private/Templates/Service/Assets/Index.html b/Neos.Neos/Resources/Private/Templates/Service/Assets/Index.html index 115d4ab853c..4b3e60f6d00 100644 --- a/Neos.Neos/Resources/Private/Templates/Service/Assets/Index.html +++ b/Neos.Neos/Resources/Private/Templates/Service/Assets/Index.html @@ -10,7 +10,7 @@

    {neos:backend.translate(id: 'assets', value: 'Assets')}

  • ({asset.identifier}) - {neos:backend.translate(id: 'thumbnail', value: 'thumbnail')} + {neos:backend.translate(id: 'thumbnail', value: 'thumbnail')} {neos:backend.translate(id: 'show', value: 'show')}
  • diff --git a/Neos.Neos/Resources/Private/Templates/Service/Assets/Show.html b/Neos.Neos/Resources/Private/Templates/Service/Assets/Show.html index 02dae2a8abb..38fae5fe4da 100644 --- a/Neos.Neos/Resources/Private/Templates/Service/Assets/Show.html +++ b/Neos.Neos/Resources/Private/Templates/Service/Assets/Show.html @@ -9,7 +9,7 @@

    {neos:backend.translate(id: 'asset', value: 'Asset')}: {asset.label}

    From 07df51e5822dc64528d26b7a97138d0bd6b037b7 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Wed, 14 Dec 2016 16:58:11 +0100 Subject: [PATCH 10/42] TASK: Cleanup AssetController dependencies This change also replace array by the short syntax everywhere --- .../Module/Management/AssetController.php | 111 ++++++------------ 1 file changed, 35 insertions(+), 76 deletions(-) diff --git a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php index 7341a5d6495..810c7e2123d 100644 --- a/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php +++ b/Neos.Media.Browser/Classes/Controller/Module/Management/AssetController.php @@ -13,10 +13,11 @@ use Doctrine\Common\Persistence\Proxy as DoctrineProxy; use Doctrine\ORM\EntityNotFoundException; -use Neos\Flow\Annotations as Flow; -use Neos\Flow\Configuration\ConfigurationManager; +use Neos\ContentRepository\Domain\Model\NodeInterface; +use Neos\ContentRepository\Domain\Repository\NodeDataRepository; use Neos\Error\Messages\Error; use Neos\Error\Messages\Message; +use Neos\Flow\Annotations as Flow; use Neos\Flow\I18n\Translator; use Neos\Flow\Mvc\Controller\ActionController; use Neos\Flow\Mvc\Exception\InvalidArgumentValueException; @@ -25,9 +26,10 @@ use Neos\Flow\Package\PackageManagerInterface; use Neos\Flow\Property\TypeConverter\PersistentObjectConverter; use Neos\Flow\ResourceManagement\PersistentResource; -use Neos\Flow\Security\Context; use Neos\FluidAdaptor\View\TemplateView; use Neos\Media\Domain\Model\Asset; +use Neos\Media\Domain\Model\AssetCollection; +use Neos\Media\Domain\Model\AssetInterface; use Neos\Media\Domain\Model\Tag; use Neos\Media\Domain\Repository\AssetCollectionRepository; use Neos\Media\Domain\Repository\AssetRepository; @@ -39,23 +41,16 @@ use Neos\Media\Domain\Service\AssetService; use Neos\Media\Domain\Session\BrowserState; use Neos\Media\TypeConverter\AssetInterfaceConverter; -use Neos\Utility\Files; -use Neos\Utility\MediaTypes; -use Neos\Utility\TypeHandling; -use Neos\Media\Domain\Model\AssetCollection; -use Neos\Media\Domain\Model\AssetInterface; use Neos\Neos\Controller\BackendUserTranslationTrait; use Neos\Neos\Controller\CreateContentContextTrait; use Neos\Neos\Domain\Model\Dto\AssetUsageInNodeProperties; use Neos\Neos\Domain\Repository\DomainRepository; use Neos\Neos\Domain\Repository\SiteRepository; use Neos\Neos\Domain\Service\ContentDimensionPresetSourceInterface; -use Neos\Neos\Domain\Service\UserService as DomainUserService; use Neos\Neos\Service\UserService; -use Neos\ContentRepository\Domain\Factory\NodeFactory; -use Neos\ContentRepository\Domain\Model\NodeInterface; -use Neos\ContentRepository\Domain\Repository\NodeDataRepository; -use Neos\ContentRepository\Domain\Repository\WorkspaceRepository; +use Neos\Utility\Files; +use Neos\Utility\MediaTypes; +use Neos\Utility\TypeHandling; /** * Controller for asset handling @@ -77,10 +72,10 @@ class AssetController extends ActionController /** * @var array */ - protected $viewFormatToObjectNameMap = array( + protected $viewFormatToObjectNameMap = [ 'html' => TemplateView::class, 'json' => JsonView::class - ); + ]; /** * @Flow\Inject @@ -88,18 +83,6 @@ class AssetController extends ActionController */ protected $nodeDataRepository; - /** - * @Flow\Inject - * @var NodeFactory - */ - protected $nodeFactory; - - /** - * @Flow\Inject - * @var ConfigurationManager - */ - protected $configurationManager; - /** * @Flow\Inject * @var SiteRepository @@ -112,36 +95,12 @@ class AssetController extends ActionController */ protected $domainRepository; - /** - * @Flow\InjectConfiguration - * @var array - */ - protected $settings; - - /** - * @Flow\Inject - * @var Context - */ - protected $securityContext; - - /** - * @Flow\Inject - * @var WorkspaceRepository - */ - protected $workspaceRepository; - /** * @Flow\Inject * @var UserService */ protected $userService; - /** - * @Flow\Inject - * @var DomainUserService - */ - protected $domainUserService; - /** * @Flow\Inject * @var ContentDimensionPresetSourceInterface @@ -211,14 +170,14 @@ public function initializeObject() */ protected function initializeView(ViewInterface $view) { - $view->assignMultiple(array( + $view->assignMultiple([ 'view' => $this->browserState->get('view'), 'sortBy' => $this->browserState->get('sortBy'), 'sortDirection' => $this->browserState->get('sortDirection'), 'filter' => $this->browserState->get('filter'), 'activeTag' => $this->browserState->get('activeTag'), 'activeAssetCollection' => $this->browserState->get('activeAssetCollection') - )); + ]); } /** @@ -308,11 +267,11 @@ public function indexAction($view = null, $sortBy = null, $sortDirection = null, switch ($this->browserState->get('sortBy')) { case 'Name': - $this->assetRepository->setDefaultOrderings(array('resource.filename' => $this->browserState->get('sortDirection'))); + $this->assetRepository->setDefaultOrderings(['resource.filename' => $this->browserState->get('sortDirection')]); break; case 'Modified': default: - $this->assetRepository->setDefaultOrderings(array('lastModified' => $this->browserState->get('sortDirection'))); + $this->assetRepository->setDefaultOrderings(['lastModified' => $this->browserState->get('sortDirection')]); break; } @@ -320,18 +279,18 @@ public function indexAction($view = null, $sortBy = null, $sortDirection = null, $this->browserState->set('tagMode', self::TAG_ALL); } - $assetCollections = array(); + $assetCollections = []; foreach ($this->assetCollectionRepository->findAll() as $assetCollection) { - $assetCollections[] = array('object' => $assetCollection, 'count' => $this->assetRepository->countByAssetCollection($assetCollection)); + $assetCollections[] = ['object' => $assetCollection, 'count' => $this->assetRepository->countByAssetCollection($assetCollection)]; } - $tags = array(); + $tags = []; foreach ($activeAssetCollection !== null ? $activeAssetCollection->getTags() : $this->tagRepository->findAll() as $tag) { - $tags[] = array('object' => $tag, 'count' => $this->assetRepository->countByTag($tag, $activeAssetCollection)); + $tags[] = ['object' => $tag, 'count' => $this->assetRepository->countByTag($tag, $activeAssetCollection)]; } if ($searchTerm !== null) { - $assets = $this->assetRepository->findBySearchTermOrTags($searchTerm, array(), $activeAssetCollection); + $assets = $this->assetRepository->findBySearchTermOrTags($searchTerm, [], $activeAssetCollection); $this->view->assign('searchTerm', $searchTerm); } elseif ($this->browserState->get('tagMode') === self::TAG_NONE) { $assets = $this->assetRepository->findUntagged($activeAssetCollection); @@ -343,7 +302,7 @@ public function indexAction($view = null, $sortBy = null, $sortDirection = null, $allCollectionsCount = $this->assetRepository->countAll(); $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'assets' => $assets, 'tags' => $tags, 'allCollectionsCount' => $allCollectionsCount, @@ -354,7 +313,7 @@ public function indexAction($view = null, $sortBy = null, $sortDirection = null, 'argumentNamespace' => $this->request->getArgumentNamespace(), 'maximumFileUploadSize' => $maximumFileUploadSize, 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); + ]); } /** @@ -365,12 +324,12 @@ public function indexAction($view = null, $sortBy = null, $sortDirection = null, public function newAction() { $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'tags' => $this->tagRepository->findAll(), 'assetCollections' => $this->assetCollectionRepository->findAll(), 'maximumFileUploadSize' => $maximumFileUploadSize, 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); + ]); } /** @@ -380,12 +339,12 @@ public function newAction() public function replaceAssetResourceAction(Asset $asset) { $maximumFileUploadSize = $this->maximumFileUploadSize(); - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'asset' => $asset, 'maximumFileUploadSize' => $maximumFileUploadSize, 'redirectPackageEnabled' => $this->packageManager->isPackageAvailable('Neos.RedirectHandler'), 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize) - )); + ]); } /** @@ -396,11 +355,11 @@ public function replaceAssetResourceAction(Asset $asset) */ public function editAction(Asset $asset) { - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'tags' => $asset->getAssetCollections()->count() > 0 ? $this->tagRepository->findByAssetCollections($asset->getAssetCollections()->toArray()) : $this->tagRepository->findAll(), 'asset' => $asset, 'assetCollections' => $this->assetCollectionRepository->findAll() - )); + ]); } /** @@ -451,7 +410,7 @@ public function createAction(Asset $asset) $this->assetRepository->add($asset); } $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]); - $this->redirect('index', null, null, array(), 0, 201); + $this->redirect('index', null, null, [], 0, 201); } /** @@ -563,10 +522,10 @@ public function createTagAction($label) */ public function editTagAction(Tag $tag) { - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'tag' => $tag, 'assetCollections' => $this->assetCollectionRepository->findAll() - )); + ]); } /** @@ -615,10 +574,10 @@ public function createAssetCollectionAction($title) */ public function editAssetCollectionAction(AssetCollection $assetCollection) { - $this->view->assignMultiple(array( + $this->view->assignMultiple([ 'assetCollection' => $assetCollection, 'tags' => $this->tagRepository->findAll() - )); + ]); } /** @@ -641,7 +600,7 @@ public function updateAssetCollectionAction(AssetCollection $assetCollection) public function deleteAction(\Neos\Media\Domain\Model\Asset $asset) { $relationMap = []; - $relationMap[TypeHandling::getTypeForValue($asset)] = array($this->persistenceManager->getIdentifierByObject($asset)); + $relationMap[TypeHandling::getTypeForValue($asset)] = [$this->persistenceManager->getIdentifierByObject($asset)]; if ($asset instanceof \Neos\Media\Domain\Model\Image) { foreach ($asset->getVariants() as $variant) { @@ -655,12 +614,12 @@ public function deleteAction(\Neos\Media\Domain\Model\Asset $asset) $relatedNodes = $this->nodeDataRepository->findNodesByRelatedEntities($relationMap); if (count($relatedNodes) > 0) { - $this->addFlashMessage('Asset could not be deleted, because there are still Nodes using it.', '', Message::SEVERITY_WARNING, array(), 1412422767); + $this->addFlashMessage('Asset could not be deleted, because there are still Nodes using it.', '', Message::SEVERITY_WARNING, [], 1412422767); $this->redirect('index'); } $this->assetRepository->remove($asset); - $this->addFlashMessage(sprintf('Asset "%s" has been deleted.', $asset->getLabel()), null, null, array(), 1412375050); + $this->addFlashMessage(sprintf('Asset "%s" has been deleted.', $asset->getLabel()), null, null, [], 1412375050); $this->redirect('index'); } From e0dc44e68ba10ec9d03c80aac2abb69c7aa42d3a Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Thu, 15 Dec 2016 10:35:06 +0100 Subject: [PATCH 11/42] TASK: Move MediaBrowser stylesheet to the correct package --- Neos.Media.Browser/.gitignore | 3 + .../Configuration/Settings.yaml | 4 ++ Neos.Media.Browser/Gemfile | 2 + Neos.Media.Browser/Gemfile.lock | 31 ++++++++++ Neos.Media.Browser/Gruntfile.js | 59 +++++++++++++++++++ .../Private/Styles/Media/_Media.scss | 1 - .../Private/Styles/MediaBrowser.scss | 13 ++++ .../Resources/Private/Styles/config.rb | 10 ++++ Neos.Media.Browser/package.json | 19 ++++++ Neos.Neos/Resources/Private/Styles/Neos.scss | 1 - 10 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 Neos.Media.Browser/.gitignore create mode 100644 Neos.Media.Browser/Gemfile create mode 100644 Neos.Media.Browser/Gemfile.lock create mode 100644 Neos.Media.Browser/Gruntfile.js rename {Neos.Neos => Neos.Media.Browser}/Resources/Private/Styles/Media/_Media.scss (99%) create mode 100644 Neos.Media.Browser/Resources/Private/Styles/MediaBrowser.scss create mode 100644 Neos.Media.Browser/Resources/Private/Styles/config.rb create mode 100644 Neos.Media.Browser/package.json diff --git a/Neos.Media.Browser/.gitignore b/Neos.Media.Browser/.gitignore new file mode 100644 index 00000000000..17ad79d3d4c --- /dev/null +++ b/Neos.Media.Browser/.gitignore @@ -0,0 +1,3 @@ +.sass-cache +node_modules +Resources/Public/Styles diff --git a/Neos.Media.Browser/Configuration/Settings.yaml b/Neos.Media.Browser/Configuration/Settings.yaml index 7b76bea4b5c..ad31e1b4397 100644 --- a/Neos.Media.Browser/Configuration/Settings.yaml +++ b/Neos.Media.Browser/Configuration/Settings.yaml @@ -19,6 +19,7 @@ Neos: - 'resource://Neos.Media.Browser/Public/JavaScript/Modules/media-browser.js' styles: - 'resource://Neos.Neos/Public/Styles/Neos.css' + - 'resource://Neos.Media.Browser/Public/Styles/MediaBrowser.css' Flow: security: @@ -45,6 +46,9 @@ Neos: description: 'Neos.Media.Browser:Modules:media.description' icon: icon-camera privilegeTarget: 'Neos.Media.Browser:ManageAssets' + additionalResources: + styleSheets: + - 'resource://Neos.Media.Browser/Public/Styles/MediaBrowser.css' userInterface: translation: autoInclude: diff --git a/Neos.Media.Browser/Gemfile b/Neos.Media.Browser/Gemfile new file mode 100644 index 00000000000..ea090f15179 --- /dev/null +++ b/Neos.Media.Browser/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'compass', '1.0.1' diff --git a/Neos.Media.Browser/Gemfile.lock b/Neos.Media.Browser/Gemfile.lock new file mode 100644 index 00000000000..53754e70482 --- /dev/null +++ b/Neos.Media.Browser/Gemfile.lock @@ -0,0 +1,31 @@ +GEM + remote: https://rubygems.org/ + specs: + chunky_png (1.3.3) + compass (1.0.1) + chunky_png (~> 1.2) + compass-core (~> 1.0.1) + compass-import-once (~> 1.0.5) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + sass (>= 3.3.13, < 3.5) + compass-core (1.0.1) + multi_json (~> 1.0) + sass (>= 3.3.0, < 3.5) + compass-import-once (1.0.5) + sass (>= 3.2, < 3.5) + ffi (1.9.6) + multi_json (1.10.1) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + sass (3.4.22) + +PLATFORMS + ruby + +DEPENDENCIES + compass (= 1.0.1) + +BUNDLED WITH + 1.12.5 diff --git a/Neos.Media.Browser/Gruntfile.js b/Neos.Media.Browser/Gruntfile.js new file mode 100644 index 00000000000..d4b3f56b36f --- /dev/null +++ b/Neos.Media.Browser/Gruntfile.js @@ -0,0 +1,59 @@ +module.exports = function (grunt) { + var path = require('path'), + packagePath = __dirname; + + grunt.loadNpmTasks('grunt-contrib-cssmin'); + + grunt.initConfig({ + watch: { + css: { + files: path.join(packagePath, 'Resources/Private/Styles/**/*.scss'), + tasks: ['compile-css'], + options: { + spawn: false, + debounceDelay: 250, + interrupt: true + } + } + }, + compass: { + compile: { + options: { + config: path.join(packagePath, 'Resources/Private/Styles/config.rb'), + basePath: path.join(packagePath, 'Resources/Private/Styles'), + trace: false, + quiet: true, + sourcemap: false, + bundleExec: true + } + } + }, + cssmin: { + target: { + files: [{ + expand: true, + cwd: path.join(packagePath, 'Resources/Public/Styles'), + src: ['*.css', '!*.min.css'], + dest: path.join(packagePath, 'Resources/Public/Styles'), + ext: '.min.css' + }] + } + } + }); + + /** + * Load and register tasks + */ + require('matchdep').filter('grunt-*').forEach(grunt.loadNpmTasks); + + /** + * Build commands for execution in the build pipeline + */ + grunt.registerTask('build', ['compass', 'cssmin']); + grunt.registerTask('build-css', ['compile-css']); + + /** + * Watch commands + */ + grunt.registerTask('watch-css', ['watch:css']); +}; diff --git a/Neos.Neos/Resources/Private/Styles/Media/_Media.scss b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss similarity index 99% rename from Neos.Neos/Resources/Private/Styles/Media/_Media.scss rename to Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss index 81927c794b9..48fcd2e31fd 100644 --- a/Neos.Neos/Resources/Private/Styles/Media/_Media.scss +++ b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss @@ -151,7 +151,6 @@ background-color: transparent; &:not(.media-module) { - padding: $unit $menuButtonWidth; .neos-footer { position: fixed; diff --git a/Neos.Media.Browser/Resources/Private/Styles/MediaBrowser.scss b/Neos.Media.Browser/Resources/Private/Styles/MediaBrowser.scss new file mode 100644 index 00000000000..c7815de54a6 --- /dev/null +++ b/Neos.Media.Browser/Resources/Private/Styles/MediaBrowser.scss @@ -0,0 +1,13 @@ +// Core variables and mixins +@import "compass"; +@import "../../../../Neos.Neos/Resources/Private/Styles/Foundation/variables"; +@import "../../../../Neos.Neos/Resources/Private/Styles/Foundation/mixins"; +@import "../../../../Neos.Neos/Resources/Private/Styles/Constants"; +@import "../../../../Neos.Neos/Resources/Private/Styles/Mixins"; +@import "../../../../Neos.Neos/Resources/Private/Styles/Fonts"; +@import "../../../../Neos.Neos/Resources/Public/Library/fontawesome/scss/variables"; +@import "../../../../Neos.Neos/Resources/Public/Library/fontawesome/scss/mixins"; + +.neos { + @import "Media/Media"; +} diff --git a/Neos.Media.Browser/Resources/Private/Styles/config.rb b/Neos.Media.Browser/Resources/Private/Styles/config.rb new file mode 100644 index 00000000000..664a4bcb3a9 --- /dev/null +++ b/Neos.Media.Browser/Resources/Private/Styles/config.rb @@ -0,0 +1,10 @@ +if RUBY_VERSION >= "1.9" + Encoding.default_external = Encoding::UTF_8 + Encoding.default_internal = Encoding::UTF_8 +end +relative_assets = true +css_dir = "../../Public/Styles" +sass_dir = "." +images_dir = "../../Public/Images" +output_style = :expanded +environment = :production diff --git a/Neos.Media.Browser/package.json b/Neos.Media.Browser/package.json new file mode 100644 index 00000000000..6edee7c9f35 --- /dev/null +++ b/Neos.Media.Browser/package.json @@ -0,0 +1,19 @@ +{ + "name": "neos-helpers", + "version": "0.0.1", + "repository": [], + "peerDependencies": { + "grunt-cli": "~0.1.13" + }, + "dependencies": { + "grunt": "~0.4.5", + "grunt-bg-shell": "~2.0.1", + "grunt-contrib-compass": "~0.9.0", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-watch": "~0.4.0", + "matchdep": "^0.3.0" + }, + "devDependencies": { + "grunt-contrib-cssmin": "^1.0.2" + } +} diff --git a/Neos.Neos/Resources/Private/Styles/Neos.scss b/Neos.Neos/Resources/Private/Styles/Neos.scss index 66425f0fb45..892b62c14cd 100755 --- a/Neos.Neos/Resources/Private/Styles/Neos.scss +++ b/Neos.Neos/Resources/Private/Styles/Neos.scss @@ -85,7 +85,6 @@ @import "ButtonGroups"; @import "Content/InsertNodePanel"; @import "Content/LoadingIndicator"; - @import "Media/Media"; @import "Notifications"; @import "Components/LoginDialog"; @import "Components/PositionSelector"; From 1dab7182408e8190f1e456529851a8494e0a5cba Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Thu, 15 Dec 2016 10:39:29 +0100 Subject: [PATCH 12/42] TASK: Include simple Readme --- Neos.Media.Browser/Readme.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Neos.Media.Browser/Readme.rst diff --git a/Neos.Media.Browser/Readme.rst b/Neos.Media.Browser/Readme.rst new file mode 100644 index 00000000000..803325c0cad --- /dev/null +++ b/Neos.Media.Browser/Readme.rst @@ -0,0 +1,18 @@ +------------------ +Neos Media Browser +------------------ + +.. note:: This repository is a **read-only subsplit** of a package that is part of the + Neos project (learn more on `www.neos.io `_). + +This package contains the backend module to management Media assets. + +If you want to use Neos, please have a look at the `Neos documentation +`_ + +Contribute +---------- + +If you want to contribute to Neos, please have a look at +https://github.com/neos/neos-development-collection - it is the repository +used for development and all pull requests should go into it. From 576d5e6eb3ece14d5404d54a6a666815170621e8 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Thu, 15 Dec 2016 10:48:58 +0100 Subject: [PATCH 13/42] Revert "TASK: Simplify Views.yaml" This reverts commit b4f4a1fef113e3f73a63abf8e7d8ef5cb7ad2086. --- Neos.Media.Browser/Configuration/Views.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Neos.Media.Browser/Configuration/Views.yaml b/Neos.Media.Browser/Configuration/Views.yaml index 94d6aa98fef..1baacc34e9b 100644 --- a/Neos.Media.Browser/Configuration/Views.yaml +++ b/Neos.Media.Browser/Configuration/Views.yaml @@ -5,8 +5,11 @@ 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Layouts/Module' 'Neos.Neos': 'resource://Neos.Neos/Private/Layouts' partialRootPaths: - 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' + 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' + + templateRootPathPattern: 'resource://Neos.Media.Browser/Private/Templates' + templatePathAndFilenamePattern: '@templateRoot/@subpackage/Module/Management/Asset/@action.@format' - requestFilter: 'isPackage("Neos.Media.Browser") && isFormat("html")' @@ -15,5 +18,8 @@ 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Layouts/Inspector' 'Neos.Neos': 'resource://Neos.Neos/Private/Layouts' partialRootPaths: - 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' 'Neos.Neos': 'resource://Neos.Neos/Private/Partials' + 'Neos.Media.Browser': 'resource://Neos.Media.Browser/Private/Partials' + + templateRootPathPattern: 'resource://Neos.Media.Browser/Private/Templates' + templatePathAndFilenamePattern: '@templateRoot/@subpackage/Module/Management/Asset/@action.@format' From 64d05be55b84cbf6a5002c9db137bc4221a626e6 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Thu, 15 Dec 2016 11:37:59 +0100 Subject: [PATCH 14/42] TASK: Add outer padding only in the secondary inspector --- .../Resources/Private/Layouts/Inspector/Default.html | 2 +- .../Resources/Private/Layouts/Inspector/EditImage.html | 2 +- .../Resources/Private/Layouts/Inspector/UploadImage.html | 2 +- Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/Default.html b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/Default.html index d1784d44527..df613b820ca 100644 --- a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/Default.html +++ b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/Default.html @@ -8,7 +8,7 @@
    - +
    diff --git a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/EditImage.html b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/EditImage.html index 68f586017dd..46835578039 100644 --- a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/EditImage.html +++ b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/EditImage.html @@ -8,7 +8,7 @@ - + diff --git a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/UploadImage.html b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/UploadImage.html index e146a47ff8b..b1c2821b2a4 100644 --- a/Neos.Media.Browser/Resources/Private/Layouts/Inspector/UploadImage.html +++ b/Neos.Media.Browser/Resources/Private/Layouts/Inspector/UploadImage.html @@ -8,7 +8,7 @@ - +
    diff --git a/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss index 48fcd2e31fd..b5a3f196b62 100644 --- a/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss +++ b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss @@ -147,6 +147,10 @@ } } +&.media-browser-inspector { + padding: 40px 54px; +} + &.media-browser { background-color: transparent; From f0a27ad423b4d6c1b2e4b84794e72940df570ceb Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Thu, 15 Dec 2016 15:00:19 +0100 Subject: [PATCH 15/42] TASK: Reuse ajax preloader image from Neos package --- .../Resources/Private/Styles/Media/_Media.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss index b5a3f196b62..be069a59d92 100644 --- a/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss +++ b/Neos.Media.Browser/Resources/Private/Styles/Media/_Media.scss @@ -556,7 +556,7 @@ padding-bottom: 100%; height: 0; background-color: $grayDarker; - background-image: url('../Images/ajax-preloader-222222.gif'); + background-image: url('../../Neos.Neos/Images/ajax-preloader-222222.gif'); background-position: center center; background-repeat: no-repeat; overflow: hidden; @@ -717,7 +717,7 @@ padding-bottom: 100%; position: relative; background-color: $grayDarker; - background-image: url('../Images/ajax-preloader-222222.gif'); + background-image: url('../../Neos.Neos/Images/ajax-preloader-222222.gif'); background-position: center center; background-repeat: no-repeat; overflow: hidden; @@ -770,7 +770,7 @@ position: relative; display: inline-block; float: left; - background-image: url('../Images/ajax-preloader-222222.gif'); + background-image: url('../../Neos.Neos/Images/ajax-preloader-222222.gif'); background-position: center center; background-repeat: no-repeat; overflow: hidden; @@ -807,7 +807,7 @@ height: 250px; position: relative; padding: 0; - background-image: url('../Images/ajax-preloader-222222.gif'); + background-image: url('../../Neos.Neos/Images/ajax-preloader-222222.gif'); background-position: center center; background-repeat: no-repeat; overflow: hidden; From d5824fd4097bb658d22d0abc633ce68341c735c1 Mon Sep 17 00:00:00 2001 From: Dominique Feyer Date: Fri, 16 Dec 2016 19:20:30 +0100 Subject: [PATCH 16/42] TASK: Move all english label from Neos.Neos to Neos.Media.Browser --- .../Private/Partials/ThumbnailView.html | 8 +- .../Module/Management/Asset/Edit.html | 52 +-- .../Management/Asset/EditAssetCollection.html | 26 +- .../Module/Management/Asset/EditTag.html | 22 +- .../Module/Management/Asset/Index.html | 121 +++--- .../Module/Management/Asset/New.html | 22 +- .../Module/Management/Asset/RelatedNodes.html | 4 +- .../Asset/ReplaceAssetResource.html | 22 +- .../Private/Translations/af/Main.xlf | 52 --- .../Private/Translations/ar/Main.xlf | 52 --- .../Private/Translations/ca/Main.xlf | 52 --- .../Private/Translations/cs/Main.xlf | 52 --- .../Private/Translations/da/Main.xlf | 52 --- .../Private/Translations/de/Main.xlf | 52 --- .../Private/Translations/el/Main.xlf | 52 --- .../Private/Translations/en/Modules.xlf | 348 +++++++++++++++++- .../Private/Translations/es/Main.xlf | 52 --- .../Private/Translations/fi/Main.xlf | 52 --- .../Private/Translations/fr/Main.xlf | 52 --- .../Private/Translations/he/Main.xlf | 52 --- .../Private/Translations/hu/Main.xlf | 52 --- .../Private/Translations/id_ID/Main.xlf | 52 --- .../Private/Translations/it/Main.xlf | 52 --- .../Private/Translations/ja/Main.xlf | 52 --- .../Private/Translations/kk_KZ/Main.xlf | 52 --- .../Private/Translations/km/Main.xlf | 52 --- .../Private/Translations/ko/Main.xlf | 52 --- .../Private/Translations/la/Main.xlf | 52 --- .../Private/Translations/lv/Main.xlf | 52 --- .../Private/Translations/mr/Main.xlf | 52 --- .../Private/Translations/nl/Main.xlf | 52 --- .../Private/Translations/no/Main.xlf | 52 --- .../Private/Translations/pl/Main.xlf | 52 --- .../Private/Translations/pt/Main.xlf | 52 --- .../Private/Translations/pt_BR/Main.xlf | 52 --- .../Private/Translations/ro/Main.xlf | 52 --- .../Private/Translations/ru/Main.xlf | 52 --- .../Private/Translations/sr/Main.xlf | 52 --- .../Private/Translations/sv/Main.xlf | 52 --- .../Private/Translations/tr/Main.xlf | 52 --- .../Private/Translations/uk/Main.xlf | 52 --- .../Private/Translations/vi/Main.xlf | 52 --- .../Private/Translations/zh/Main.xlf | 52 --- .../Private/Translations/zh_TW/Main.xlf | 52 --- .../Private/Translations/en/Modules.xlf | 328 ----------------- 45 files changed, 477 insertions(+), 2296 deletions(-) delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/af/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ar/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ca/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/cs/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/da/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/de/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/el/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/es/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/fi/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/fr/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/he/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/hu/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/id_ID/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/it/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ja/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/kk_KZ/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/km/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ko/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/la/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/lv/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/mr/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/nl/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/no/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/pl/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/pt/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/pt_BR/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ro/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/ru/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/sr/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/sv/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/tr/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/uk/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/vi/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/zh/Main.xlf delete mode 100644 Neos.Media.Browser/Resources/Private/Translations/zh_TW/Main.xlf diff --git a/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html b/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html index aa8e626b290..b7de4bf226a 100644 --- a/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html +++ b/Neos.Media.Browser/Resources/Private/Partials/ThumbnailView.html @@ -5,7 +5,7 @@
  • - +
    @@ -20,20 +20,20 @@
    @@ -93,21 +93,21 @@
    - {neos:backend.translate(id: 'media.message.reallyDeleteAsset', arguments: {0: asset.label}, source: 'Modules', package: 'Neos.Neos')} + {neos:backend.translate(id: 'media.message.reallyDeleteAsset', arguments: {0: asset.label}, source: 'Modules', package: 'Neos.Media.Browser')}

    - {neos:backend.translate(id: 'media.message.willBeDeleted', source: 'Modules', package: 'Neos.Neos')}
    - {neos:backend.translate(id: 'media.message.operationCannotBeUndone', source: 'Modules', package: 'Neos.Neos')} + {neos:backend.translate(id: 'media.message.willBeDeleted', source: 'Modules', package: 'Neos.Media.Browser')}
    + {neos:backend.translate(id: 'media.message.operationCannotBeUndone', source: 'Modules', package: 'Neos.Media.Browser')}

    diff --git a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/EditAssetCollection.html b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/EditAssetCollection.html index 8e3b48ae62b..3b8761ed37e 100644 --- a/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/EditAssetCollection.html +++ b/Neos.Media.Browser/Resources/Private/Templates/Module/Management/Asset/EditAssetCollection.html @@ -9,11 +9,11 @@
    - {neos:backend.translate(id: 'media.basics', source: 'Modules', package: 'Neos.Neos')} - - + {neos:backend.translate(id: 'media.basics', source: 'Modules', package: 'Neos.Media.Browser')} + + - +