From f7b891b8a6a07ddcc6ef6d4feea6b1545b09d51a Mon Sep 17 00:00:00 2001 From: Kamil Musial Date: Tue, 22 Mar 2016 08:27:18 +0100 Subject: [PATCH] patch EZS-637 --- Controller/StudioUIController.php | 17 +++++++++++++++-- Resources/config/yui.yml | 1 - .../public/js/views/services/ezs-browserviewservice.js | 10 +++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Controller/StudioUIController.php b/Controller/StudioUIController.php index 71880d7..c37fb25 100644 --- a/Controller/StudioUIController.php +++ b/Controller/StudioUIController.php @@ -52,8 +52,21 @@ class StudioUIController extends Controller 'contentId' => 0, 'hasLandingPageFieldType' => false, ); - $locationId = $this->urlAliasService->lookup($this->removeSiteaccessFromUrl($request->get('url'))); - $location = $this->locationService->loadLocation($locationId->destination); + + $url = $this->removeSiteaccessFromUrl($request->get('url')); + + if ($url != '/') { + $locationId = $this->urlAliasService->lookup($url); + $location = $this->locationService->loadLocation($locationId->destination); + } else { + $locationId = $this->getConfigResolver()->getParameter( + 'content.tree_root.location_id', + 'ezsettings', + $request->get('previewSiteaccess') + ); + $location = $this->locationService->loadLocation($locationId); + } + $contentType = $this->contentTypeService->loadContentType($location->getContentInfo()->contentTypeId); $response['contentId'] = $this->generateUrl('ezpublish_rest_loadContent', array('contentId' => $location->getContentInfo()->id)); diff --git a/Resources/config/yui.yml b/Resources/config/yui.yml index 26e86e1..5595390 100644 --- a/Resources/config/yui.yml +++ b/Resources/config/yui.yml @@ -171,7 +171,6 @@ system: requires: - 'ezs-landingpagecreatorview' - 'ezs-confirmboxview' - - 'ezs-slotcontentpreviewpopupview' - 'ezs-scheduleblockview' - 'ezs-tagblockview' - 'ezs-blockview' diff --git a/Resources/public/js/views/services/ezs-browserviewservice.js b/Resources/public/js/views/services/ezs-browserviewservice.js index 65f2383..a1e8c7d 100644 --- a/Resources/public/js/views/services/ezs-browserviewservice.js +++ b/Resources/public/js/views/services/ezs-browserviewservice.js @@ -93,9 +93,13 @@ YUI.add('ezs-browserviewservice', function (Y) { * @return {Object} promise */ _getPageInfo: function (path) { - var promise = new Y.Promise(Y.bind(function (resolve, reject) { - Y.io(this.get('app').get('apiRoot') + this.get('hasLandingPageFieldTypeUrl'), { - data: {url: path}, + var app = this.get('app'), + promise = new Y.Promise(Y.bind(function (resolve, reject) { + Y.io(app.get('apiRoot') + this.get('hasLandingPageFieldTypeUrl'), { + data: { + url: path, + previewSiteaccess: app.get('studioActiveSiteaccess') + }, on: { success: function (id, xhr) { resolve(JSON.parse(xhr.response)); -- 2.6.3