diff --git a/src/Umbraco.Core/Constants-Conventions.cs b/src/Umbraco.Core/Constants-Conventions.cs index b22f6e2ef3..da08bd631a 100644 --- a/src/Umbraco.Core/Constants-Conventions.cs +++ b/src/Umbraco.Core/Constants-Conventions.cs @@ -11,11 +11,6 @@ namespace Umbraco.Core /// public static class Conventions { - public static class PropertyTypes - { - public const string ListViewPropertyAlias = Constants.PropertyEditors.InternalGenericPropertiesPrefix + "containerView"; - } - public static class PropertyGroups { public const string ListViewGroupName = "umbContainerView"; diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs index 8507134a93..846a5e34dd 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs @@ -140,10 +140,7 @@ AND umbracoNode.nodeObjectType = @objectType", } var propertyFactory = new PropertyGroupFactory(nodeDto.NodeId); - - //If the entity is a container, ensure that the container property and group are there - EnsureListViewProperty(entity); - + //Insert Tabs foreach (var propertyGroup in entity.PropertyGroups) { @@ -275,8 +272,6 @@ AND umbracoNode.id <> @id", }); } - //If the entity is a container, ensure that the container property and group are there - EnsureListViewProperty(entity); if (((ICanBeDirty) entity).IsPropertyDirty("PropertyTypes") || entity.PropertyTypes.Any(x => x.IsDirty())) { @@ -478,55 +473,7 @@ AND umbracoNode.id <> @id", throw exception; }); } - - private void EnsureListViewProperty(IContentTypeComposition entity) - { - //If the entity is a container, ensure that the container property and group are there, otherwise if it is not a container, - // ensure to remove the built in props/tab - - if (entity.IsContainer == false) - { - if (entity.PropertyTypeExists(Constants.PropertyEditors.ListViewAlias)) - { - entity.RemovePropertyType(Constants.PropertyEditors.ListViewAlias); - } - if (entity.PropertyGroups.Contains(Constants.Conventions.PropertyGroups.ListViewGroupName)) - { - entity.RemovePropertyGroup(Constants.Conventions.PropertyGroups.ListViewGroupName); - } - } - else if (entity.PropertyTypeExists(Constants.PropertyEditors.ListViewAlias) == false) - { - PropertyGroup group; - if (entity.PropertyGroups.Contains(Constants.Conventions.PropertyGroups.ListViewGroupName)) - { - group = entity.PropertyGroups[Constants.Conventions.PropertyGroups.ListViewGroupName]; - } - else - { - group = new PropertyGroup - { - Name = Constants.Conventions.PropertyGroups.ListViewGroupName, - SortOrder = entity.PropertyGroups.Any() ? entity.PropertyGroups.Max(x => x.SortOrder) + 1 : 1 - }; - } - - group.PropertyTypes = new PropertyTypeCollection(new[] - { - new PropertyType(Constants.PropertyEditors.ListViewAlias, DataTypeDatabaseType.Nvarchar) - { - Alias = Constants.Conventions.PropertyTypes.ListViewPropertyAlias, - Name = Constants.Conventions.PropertyTypes.ListViewPropertyAlias, - DataTypeDefinitionId = 1037 - } - }); - - entity.PropertyGroups.Add(group); - - } - - } - + /// /// Try to set the data type id based on its ControlId /// diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 19b3fe82d4..d52a65fcb3 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -126,7 +126,7 @@ namespace Umbraco.Web.Editors var mapped = Mapper.Map(emptyContent); //remove this tab if it exists: umbContainerView - var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == "umbContainerView"); + var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName); mapped.Tabs = mapped.Tabs.Except(new[] {containerTab}); return mapped; } diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index cc8c506e08..84c4128eb5 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -78,7 +78,7 @@ namespace Umbraco.Web.Editors var mapped = Mapper.Map(emptyContent); //remove this tab if it exists: umbContainerView - var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == "umbContainerView"); + var containerTab = mapped.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName); mapped.Tabs = mapped.Tabs.Except(new[] { containerTab }); return mapped; } diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index cd58485a19..2ac4b02268 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -121,57 +121,32 @@ namespace Umbraco.Web.Models.Mapping where TPersisted : IContentBase { - var listViewProp = display.Properties.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyTypes.ListViewPropertyAlias); + var listViewTab = new Tab(); + listViewTab.Alias = Constants.Conventions.PropertyGroups.ListViewGroupName; + listViewTab.Label = ui.Text("content", "childItems"); + listViewTab.Id = 25; + listViewTab.IsActive = true; - //check if the list view property is already there (it should be with 7.2+) - if (listViewProp != null) + var listViewProperties = new List(); + listViewProperties.Add(new ContentPropertyDisplay { - //ensure label is hidden - listViewProp.HideLabel = true; - listViewProp.Value = null; - listViewProp.Label = ""; - - var defaultViewTab = display.Tabs.FirstOrDefault(x => x.Alias == Constants.Conventions.PropertyGroups.ListViewGroupName); - if (defaultViewTab != null) - { - //it's the default one, so localize the name - defaultViewTab.Label = ui.Text("content", "childItems"); - } - } - else - { - //something is a bit strange with the data, there should def be a list view property but seeing as there is not, we'll put a warning - // in the log and create one dynamically like we did pre 7.2 - - LogHelper.Warn("No list view property type was found on the content item, a dynamic one will be created. Since 7.2.0 there should be a real list view property type on a list view content type"); - - var listViewTab = new Tab(); - listViewTab.Alias = Constants.Conventions.PropertyGroups.ListViewGroupName; - listViewTab.Label = ui.Text("content", "childItems"); - listViewTab.Id = 25; - listViewTab.IsActive = true; - - var listViewProperties = new List(); - listViewProperties.Add(new ContentPropertyDisplay - { - Alias = Constants.Conventions.PropertyTypes.ListViewPropertyAlias, - Label = "", - Value = null, - View = "listview", - HideLabel = true, - Config = new Dictionary + Alias = string.Format("{0}containerView", Constants.PropertyEditors.InternalGenericPropertiesPrefix), + Label = "", + Value = null, + View = "listview", + HideLabel = true, + Config = new Dictionary { {"entityType", entityType} } - }); - listViewTab.Properties = listViewProperties; + }); + listViewTab.Properties = listViewProperties; - //Is there a better way? - var tabs = new List>(); - tabs.Add(listViewTab); - tabs.AddRange(display.Tabs); - display.Tabs = tabs; - } + //Is there a better way? + var tabs = new List>(); + tabs.Add(listViewTab); + tabs.AddRange(display.Tabs); + display.Tabs = tabs; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 4cf0dfe02e..008e836f8a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -866,18 +866,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); out cms.businesslogic.datatype.DataTypeDefinition[] filteredDefinitions) { filteredDefinitions = allDtds; - - //special case if this is a list view, if so, filter the dtd's to only include other list view types, - // don't allow editing of anything except for the tab and data type - if (pt.Alias == Constants.Conventions.PropertyTypes.ListViewPropertyAlias) - { - //filter the dtds to only list view - filteredDefinitions = allDtds.Where(x => x.PropertyEditorAlias == Constants.PropertyEditors.ListViewAlias).ToArray(); - - var gpw = new GenericPropertyWrapper(false, true, false, true, false, false, false); - return gpw; - } - + //not editable if any of the built in member types if (_contentType.ContentTypeItem is IMemberType) {