diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index 213251fd55..82e78f6f22 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -440,8 +440,8 @@ namespace Umbraco.Core internal IEnumerable ResolveParameterEditors() { //return all paramter editor types found except for the base property editor type - return ResolveTypes() - .Except(new[] { typeof(ParameterEditor) }); + return ResolveTypes() + .Except(new[] { typeof(ParameterEditor), typeof(PropertyEditor) }); } /// diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index dda5518ed8..15fa9ef5dc 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -17,6 +17,7 @@ angular.module("umbraco.directives") showoptions: '@', showheader: '@', cachekey: '@', + isdialog: '@', eventhandler: '=' }, @@ -42,7 +43,7 @@ angular.module("umbraco.directives") element.replaceWith(template); - return function (scope, element, attrs, controller) { + return function (scope, elem, attr, controller) { //flag to track the last loaded section when the tree 'un-loads'. We use this to determine if we should // re-load the tree again. For example, if we hover over 'content' the content tree is shown. Then we hover @@ -109,7 +110,7 @@ angular.module("umbraco.directives") enableDeleteAnimations = false; //use $q.when because a promise OR raw data might be returned. - $q.when(treeService.getTree({ section: scope.section, tree: scope.treealias, cachekey: scope.cachekey })) + $q.when(treeService.getTree({ section: scope.section, tree: scope.treealias, cachekey: scope.cachekey, isDialog: scope.isdialog ? scope.isdialog : false })) .then(function (data) { //set the data once we have it scope.tree = data; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js index 9938012cc3..5261e984ff 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/tree.resource.js @@ -41,7 +41,10 @@ function treeResource($q, $http, umbRequestHelper) { if(!options.tree){ options.tree = ""; - } + } + if (!options.isDialog) { + options.isDialog = false; + } return umbRequestHelper.resourcePromise( $http.get( @@ -50,7 +53,8 @@ function treeResource($q, $http, umbRequestHelper) { "GetApplicationTrees", [ {application: options.section}, - {tree: options.tree} + { tree: options.tree }, + { isDialog: options.isDialog } ])), 'Failed to retreive data for application tree ' + options.section); }, diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html index d21f4709af..3da0a7e320 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html @@ -41,6 +41,7 @@ cachekey="contentpickerDialog" showheader="true" showoptions="false" + isdialog="true" eventhandler="dialogTreeEventHandler"> diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/memberpicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/memberpicker.html index f3b83b5680..54ee551a9e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/memberpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/memberpicker.html @@ -41,7 +41,8 @@ treealias="member" cachekey="memberpickerDialog" showheader="false" - showoptions="false" + showoptions="false" + isdialog="true" eventhandler="dialogTreeEventHandler"> diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html index 23b874ed94..d611b42e56 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.html @@ -39,6 +39,7 @@ cachekey="treepickerDialog" showheader="true" showoptions="false" + isdialog="true" eventhandler="dialogTreeEventHandler"> 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 7f25f669fd..0a4d6d8699 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 @@ -5,7 +5,7 @@ angular.module('umbraco') function($scope, dialogService, entityResource, $log, iconHelper){ $scope.renderModel = []; - $scope.ids = $scope.model.value.split(','); + $scope.ids = $scope.model.value ? $scope.model.value.split(',') : []; //configuration diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs index 2e205cbe47..796ead8105 100644 --- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.ContentPickerAlias, "Content Picker", "contentpicker")] + [PropertyEditor(Constants.PropertyEditors.ContentPickerAlias, "Content Picker", "contentpicker", IsParameterEditor = true)] public class ContentPickerPropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index 4462bfb5fe..3e96dee554 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -2,7 +2,9 @@ using System.Globalization; using System.Linq; using System.Management.Instrumentation; +using System.Net; using System.Net.Http.Formatting; +using System.Web.Http; using System.Web.Mvc; using Umbraco.Core; using Umbraco.Core.Models; @@ -35,28 +37,27 @@ namespace Umbraco.Web.Trees /// /// Returns the tree nodes for an application /// - /// + /// The application to load tree for + /// An optional single tree alias, if specified will only load the single tree for the request app /// /// [HttpQueryStringFilter("queryStrings")] public SectionRootNode GetApplicationTrees(string application, string tree, FormDataCollection queryStrings) { - if (application == null) throw new ArgumentNullException("application"); + if (string.IsNullOrEmpty(application)) throw new HttpResponseException(HttpStatusCode.NotFound); var rootId = Constants.System.Root.ToString(CultureInfo.InvariantCulture); //find all tree definitions that have the current application alias var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, true).ToArray(); - if (appTrees.Count() == 1 || !string.IsNullOrEmpty(tree) ) + if (appTrees.Count() == 1 || string.IsNullOrEmpty(tree) == false ) { - ApplicationTree apptree; - - if (!string.IsNullOrEmpty(tree)) - apptree = appTrees.Where(x => x.Alias == tree).Single(); - else - apptree = appTrees.Single(); + var apptree = string.IsNullOrEmpty(tree) == false + ? appTrees.SingleOrDefault(x => x.Alias == tree) + : appTrees.SingleOrDefault(); + if (apptree == null) throw new HttpResponseException(HttpStatusCode.NotFound); var result = GetRootForSingleAppTree( apptree, @@ -64,8 +65,8 @@ namespace Umbraco.Web.Trees queryStrings, application); - //PP: should this be further down in the logic? - result.Title = ui.Text("sections", application); + ////PP: should this be further down in the logic? + //result.Title = ui.Text("sections", application); return result; } diff --git a/src/Umbraco.Web/Trees/TreeController.cs b/src/Umbraco.Web/Trees/TreeController.cs index 1dcff19f49..a5f90fd2dc 100644 --- a/src/Umbraco.Web/Trees/TreeController.cs +++ b/src/Umbraco.Web/Trees/TreeController.cs @@ -190,7 +190,7 @@ namespace Umbraco.Web.Trees /// protected bool IsDialog(FormDataCollection queryStrings) { - return queryStrings.GetValue(TreeQueryStringParameters.DialogMode); + return queryStrings.GetValue(TreeQueryStringParameters.IsDialog); } /// diff --git a/src/Umbraco.Web/Trees/TreeQueryStringParameters.cs b/src/Umbraco.Web/Trees/TreeQueryStringParameters.cs index a727366484..2bbbcf0a1a 100644 --- a/src/Umbraco.Web/Trees/TreeQueryStringParameters.cs +++ b/src/Umbraco.Web/Trees/TreeQueryStringParameters.cs @@ -5,7 +5,7 @@ /// internal struct TreeQueryStringParameters { - public const string DialogMode = "DialogMode"; + public const string IsDialog = "isDialog"; public const string Application = "application"; //public const string OnNodeClick = "OnNodeClick"; //public const string RenderParent = "RenderParent";