diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js index 182b487f11..75d2f47a28 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js @@ -99,16 +99,6 @@ function entityResource($q, $http, umbRequestHelper) { 'Failed to retreive entity data for id ' + id); }, - getByQuery: function (query, rootNodeId, type) { - return umbRequestHelper.resourcePromise( - $http.get( - umbRequestHelper.getApiUrl( - "entityApiBaseUrl", - "GetByQuery", - [{query: query},{ rootNodeId: rootNodeId}, {type: type }])), - 'Failed to retreive entity data for query ' + query); - }, - /** * @ngdoc method * @name umbraco.resources.entityResource#getByIds diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index 70de53bf24..ab1aeb06e2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -3,7 +3,7 @@ angular.module('umbraco') .controller("Umbraco.PropertyEditors.ContentPickerController", - function($scope, dialogService, entityResource, editorState, $log, iconHelper){ + function($scope, dialogService, entityResource, $log, iconHelper){ $scope.renderModel = []; $scope.ids = $scope.model.value ? $scope.model.value.split(',') : []; @@ -11,8 +11,6 @@ angular.module('umbraco') $scope.cfg = { multiPicker: "0", entityType: "Document", - filterCssClass: "not-allowed not-published", - startNode:{ type: "content", id: -1 @@ -33,23 +31,11 @@ angular.module('umbraco') $scope.cfg.entityType = "Media"; } - //if we have a query for the startnode, we will use that. - if($scope.cfg.startNode.query){ - var rootId = -1; - if($scope.cfg.startNode.scope === "current"){ - rootId = editorState.current.id; - } - - entityResource.getByQuery($scope.cfg.startNode.query, rootId, "Document").then(function(ent){ - $scope.cfg.startNodeId = ent.id; - }); - }else{ - $scope.cfg.startNodeId = $scope.cfg.startNode.id; - } - $scope.cfg.callback = populate; $scope.cfg.treeAlias = $scope.cfg.startNode.type; - $scope.cfg.section = $scope.cfg.startNode.type; + $scope.cfg.section = $scope.cfg.startNode.type; + $scope.cfg.startNodeId = $scope.cfg.startNode.id; + $scope.cfg.filterCssClass = "not-allowed not-published"; //load current data entityResource.getByIds($scope.ids, $scope.cfg.entityType).then(function(data){ diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 4eef37e3ed..e30d67fe1d 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -25,7 +25,6 @@ using Examine; using Examine.LuceneEngine.SearchCriteria; using Examine.SearchCriteria; using Umbraco.Web.Dynamics; -using umbraco; namespace Umbraco.Web.Editors { @@ -129,59 +128,6 @@ namespace Umbraco.Web.Editors return GetResultForKey(id, type); } - /// - /// Gets an entity by a xpath or css-like query - /// - /// - /// - /// - /// - public EntityBasic GetByQuery(string query, int rootNodeId, UmbracoEntityTypes type) - { - - //this is css (commented out for now, due to external dependency) - //if (!query.Contains("::") && !query.Contains('/')) - // query = css2xpath.Converter.CSSToXPath(query, ""); - - - if(rootNodeId < 0) - { - var node = Umbraco.TypedContentSingleAtXPath(query); - - if(node == null) - return null; - - return GetById(node.Id, UmbracoEntityTypes.Document); - } - else - { - //SD: This should be done using UmbracoHelper - - //var node = Umbraco.TypedContent(rootNodeId); - //if (node != null) - //{ - // //TODO: Build an Xpath query based on this node ID and the rest of the query - // // var subQuery = [@id=rootNodeId]/query - // // and then get that node with: - // // var result = Umbraco.TypedContentSingleAtXPath(subQuery); - //} - - var node = global::umbraco.library.GetXmlNodeById(rootNodeId.ToString()); - if (node.MoveNext()) - { - if (node.Current != null) - { - var result = node.Current.Select(query); - //set it to the first node found (if there is one), otherwise to -1 - if (result.Current != null) - return GetById(int.Parse(result.Current.GetAttribute("id", string.Empty)), UmbracoEntityTypes.Document); - } - } - } - - return null; - } - public EntityBasic GetById(int id, UmbracoEntityTypes type) { return GetResultForId(id, type);