diff --git a/src/Umbraco.Core/Constants-DataTypes.cs b/src/Umbraco.Core/Constants-DataTypes.cs
new file mode 100644
index 0000000000..d5d0e99dab
--- /dev/null
+++ b/src/Umbraco.Core/Constants-DataTypes.cs
@@ -0,0 +1,295 @@
+using System;
+
+namespace Umbraco.Core
+{
+ public static partial class Constants
+ {
+ ///
+ /// Defines the identifiers for Umbraco data types as constants for easy centralized access/management.
+ ///
+ public static class DataTypes
+ {
+
+ public static class ReservedPreValueKeys
+ {
+ public const string IgnoreUserStartNodes = "ignoreUserStartNodes";
+ }
+
+ ///
+ /// Guid for Content Picker as string
+ ///
+ public const string ContentPicker = "FD1E0DA5-5606-4862-B679-5D0CF3A52A59";
+
+ ///
+ /// Guid for Content Picker
+ ///
+ public static readonly Guid ContentPickerGuid = new Guid(ContentPicker);
+
+
+ ///
+ /// Guid for Member Picker as string
+ ///
+ public const string MemberPicker = "1EA2E01F-EBD8-4CE1-8D71-6B1149E63548";
+
+ ///
+ /// Guid for Member Picker
+ ///
+ public static readonly Guid MemberPickerGuid = new Guid(MemberPicker);
+
+
+ ///
+ /// Guid for Media Picker as string
+ ///
+ public const string MediaPicker = "135D60E0-64D9-49ED-AB08-893C9BA44AE5";
+
+ ///
+ /// Guid for Media Picker
+ ///
+ public static readonly Guid MediaPickerGuid = new Guid(MediaPicker);
+
+
+ ///
+ /// Guid for Multiple Media Picker as string
+ ///
+ public const string MultipleMediaPicker = "9DBBCBBB-2327-434A-B355-AF1B84E5010A";
+
+ ///
+ /// Guid for Multiple Media Picker
+ ///
+ public static readonly Guid MultipleMediaPickerGuid = new Guid(MultipleMediaPicker);
+
+
+ ///
+ /// Guid for Related Links as string
+ ///
+ public const string RelatedLinks = "B4E3535A-1753-47E2-8568-602CF8CFEE6F";
+
+ ///
+ /// Guid for Related Links
+ ///
+ public static readonly Guid RelatedLinksGuid = new Guid(RelatedLinks);
+
+
+ ///
+ /// Guid for Member as string
+ ///
+ public const string Member = "d59be02f-1df9-4228-aa1e-01917d806cda";
+
+ ///
+ /// Guid for Member
+ ///
+ public static readonly Guid MemberGuid = new Guid(Member);
+
+
+ ///
+ /// Guid for Image Cropper as string
+ ///
+ public const string ImageCropper = "1df9f033-e6d4-451f-b8d2-e0cbc50a836f";
+
+ ///
+ /// Guid for Image Cropper
+ ///
+ public static readonly Guid ImageCropperGuid = new Guid(ImageCropper);
+
+
+ ///
+ /// Guid for Tags as string
+ ///
+ public const string Tags = "b6b73142-b9c1-4bf8-a16d-e1c23320b549";
+
+ ///
+ /// Guid for Tags
+ ///
+ public static readonly Guid TagsGuid = new Guid(Tags);
+
+
+ ///
+ /// Guid for List View - Content as string
+ ///
+ public const string ListViewContent = "C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4";
+
+ ///
+ /// Guid for List View - Content
+ ///
+ public static readonly Guid ListViewContentGuid = new Guid(ListViewContent);
+
+
+ ///
+ /// Guid for List View - Media as string
+ ///
+ public const string ListViewMedia = "3A0156C4-3B8C-4803-BDC1-6871FAA83FFF";
+
+ ///
+ /// Guid for List View - Media
+ ///
+ public static readonly Guid ListViewMediaGuid = new Guid(ListViewMedia);
+
+
+ ///
+ /// Guid for List View - Members as string
+ ///
+ public const string ListViewMembers = "AA2C52A0-CE87-4E65-A47C-7DF09358585D";
+
+ ///
+ /// Guid for List View - Members
+ ///
+ public static readonly Guid ListViewMembersGuid = new Guid(ListViewMembers);
+
+
+ ///
+ /// Guid for Date Picker with time as string
+ ///
+ public const string DatePickerWithTime = "e4d66c0f-b935-4200-81f0-025f7256b89a";
+
+ ///
+ /// Guid for Date Picker with time
+ ///
+ public static readonly Guid DatePickerWithTimeGuid = new Guid(DatePickerWithTime);
+
+
+ ///
+ /// Guid for Approved Color as string
+ ///
+ public const string ApprovedColor = "0225af17-b302-49cb-9176-b9f35cab9c17";
+
+ ///
+ /// Guid for Approved Color
+ ///
+ public static readonly Guid ApprovedColorGuid = new Guid(ApprovedColor);
+
+
+ ///
+ /// Guid for Dropdown multiple as string
+ ///
+ public const string DropdownMultiple = "f38f0ac7-1d27-439c-9f3f-089cd8825a53";
+
+ ///
+ /// Guid for Dropdown multiple
+ ///
+ public static readonly Guid DropdownMultipleGuid = new Guid(DropdownMultiple);
+
+
+ ///
+ /// Guid for Radiobox as string
+ ///
+ public const string Radiobox = "bb5f57c9-ce2b-4bb9-b697-4caca783a805";
+
+ ///
+ /// Guid for Radiobox
+ ///
+ public static readonly Guid RadioboxGuid = new Guid(Radiobox);
+
+
+ ///
+ /// Guid for Date Picker as string
+ ///
+ public const string DatePicker = "5046194e-4237-453c-a547-15db3a07c4e1";
+
+ ///
+ /// Guid for Date Picker
+ ///
+ public static readonly Guid DatePickerGuid = new Guid(DatePicker);
+
+
+ ///
+ /// Guid for Dropdown as string
+ ///
+ public const string Dropdown = "0b6a45e7-44ba-430d-9da5-4e46060b9e03";
+
+ ///
+ /// Guid for Dropdown
+ ///
+ public static readonly Guid DropdownGuid = new Guid(Dropdown);
+
+
+ ///
+ /// Guid for Checkbox list as string
+ ///
+ public const string CheckboxList = "fbaf13a8-4036-41f2-93a3-974f678c312a";
+
+ ///
+ /// Guid for Checkbox list
+ ///
+ public static readonly Guid CheckboxListGuid = new Guid(CheckboxList);
+
+
+ ///
+ /// Guid for Checkbox as string
+ ///
+ public const string Checkbox = "92897bc6-a5f3-4ffe-ae27-f2e7e33dda49";
+
+ ///
+ /// Guid for Checkbox
+ ///
+ public static readonly Guid CheckboxGuid = new Guid(Checkbox);
+
+
+ ///
+ /// Guid for Numeric as string
+ ///
+ public const string Numeric = "2e6d3631-066e-44b8-aec4-96f09099b2b5";
+
+ ///
+ /// Guid for Dropdown
+ ///
+ public static readonly Guid NumericGuid = new Guid(Numeric);
+
+
+ ///
+ /// Guid for Richtext editor as string
+ ///
+ public const string RichtextEditor = "ca90c950-0aff-4e72-b976-a30b1ac57dad";
+
+ ///
+ /// Guid for Richtext editor
+ ///
+ public static readonly Guid RichtextEditorGuid = new Guid(RichtextEditor);
+
+
+ ///
+ /// Guid for Textstring as string
+ ///
+ public const string Textstring = "0cc0eba1-9960-42c9-bf9b-60e150b429ae";
+
+ ///
+ /// Guid for Textstring
+ ///
+ public static readonly Guid TextstringGuid = new Guid(Textstring);
+
+
+ ///
+ /// Guid for Textarea as string
+ ///
+ public const string Textarea = "c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3";
+
+ ///
+ /// Guid for Dropdown
+ ///
+ public static readonly Guid TextareaGuid = new Guid(Textarea);
+
+
+ ///
+ /// Guid for Upload as string
+ ///
+ public const string Upload = "84c6b441-31df-4ffe-b67e-67d5bc3ae65a";
+
+ ///
+ /// Guid for Upload
+ ///
+ public static readonly Guid UploadGuid = new Guid(Upload);
+
+
+ ///
+ /// Guid for Label as string
+ ///
+ public const string Label = "f0bc4bfb-b499-40d6-ba86-058885a5178c";
+
+ ///
+ /// Guid for Label
+ ///
+ public static readonly Guid LabelGuid = new Guid(Label);
+
+
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Models/DataTypeDefinition.cs b/src/Umbraco.Core/Models/DataTypeDefinition.cs
index 3ba5125a90..5e1fd649ae 100644
--- a/src/Umbraco.Core/Models/DataTypeDefinition.cs
+++ b/src/Umbraco.Core/Models/DataTypeDefinition.cs
@@ -1,219 +1,260 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Reflection;
-using System.Runtime.Serialization;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models.EntityBase;
-using Umbraco.Core.Persistence;
-using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
-
-namespace Umbraco.Core.Models
-{
- ///
- /// Definition of a DataType/PropertyEditor
- ///
- ///
- /// The definition exists as a database reference between an actual DataType/PropertyEditor
- /// (identified by its control id), its prevalues (configuration) and the named DataType in the backoffice UI.
- ///
- [Serializable]
- [DataContract(IsReference = true)]
- public class DataTypeDefinition : Entity, IDataTypeDefinition
- {
- private int _parentId;
- private string _name;
- private int _sortOrder;
- private int _level;
- private string _path;
- private int _creatorId;
- private bool _trashed;
- private string _propertyEditorAlias;
- private DataTypeDatabaseType _databaseType;
-
- [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the alternative contructor that specifies an alias")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public DataTypeDefinition(int parentId, Guid controlId)
- {
- _parentId = parentId;
-
- _propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, false);
- if (_propertyEditorAlias == null)
- {
- //convert to Label!
- LogHelper.Warn("Could not find a GUID -> Alias mapping for the legacy property editor with id " + controlId + ". The DataType has been converted to a Label.");
- _propertyEditorAlias = Constants.PropertyEditors.NoEditAlias;
- }
-
- _additionalData = new Dictionary();
- }
-
- public DataTypeDefinition(int parentId, string propertyEditorAlias)
- {
- _parentId = parentId;
- _propertyEditorAlias = propertyEditorAlias;
-
- _additionalData = new Dictionary();
- }
-
- public DataTypeDefinition(string propertyEditorAlias)
- {
- _parentId = -1;
- _propertyEditorAlias = propertyEditorAlias;
-
- _additionalData = new Dictionary();
- }
-
- private static readonly Lazy Ps = new Lazy();
-
- private class PropertySelectors
- {
- public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name);
- public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo(x => x.ParentId);
- public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo(x => x.SortOrder);
- public readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo(x => x.Level);
- public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo(x => x.Path);
- public readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo(x => x.CreatorId);
- public readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo(x => x.Trashed);
- public readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo(x => x.PropertyEditorAlias);
- public readonly PropertyInfo DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.DatabaseType);
- }
-
- ///
- /// Gets or sets the Id of the Parent entity
- ///
- /// Might not be necessary if handled as a relation?
- [DataMember]
- public int ParentId
- {
- get { return _parentId; }
- set { SetPropertyValueAndDetectChanges(value, ref _parentId, Ps.Value.ParentIdSelector); }
- }
-
- ///
- /// Gets or sets the name of the current entity
- ///
- [DataMember]
- public string Name
- {
- get { return _name; }
- set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
- }
-
- ///
- /// Gets or sets the sort order of the content entity
- ///
- [DataMember]
- public int SortOrder
- {
- get { return _sortOrder; }
- set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
- }
-
- ///
- /// Gets or sets the level of the content entity
- ///
- [DataMember]
- public int Level
- {
- get { return _level; }
- set { SetPropertyValueAndDetectChanges(value, ref _level, Ps.Value.LevelSelector); }
- }
-
- ///
- /// Gets or sets the path
- ///
- [DataMember]
- public string Path //Setting this value should be handled by the class not the user
- {
- get { return _path; }
- set { SetPropertyValueAndDetectChanges(value, ref _path, Ps.Value.PathSelector); }
- }
-
- ///
- /// Id of the user who created this entity
- ///
- [DataMember]
- public int CreatorId
- {
- get { return _creatorId; }
- set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.UserIdSelector); }
- }
-
- //NOTE: SD: Why do we have this ??
-
- ///
- /// Boolean indicating whether this entity is Trashed or not.
- ///
- [DataMember]
- public bool Trashed
- {
- get { return _trashed; }
- internal set
- {
- SetPropertyValueAndDetectChanges(value, ref _trashed, Ps.Value.TrashedSelector);
- //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
- _additionalData["Trashed"] = value;
- }
- }
-
- [DataMember]
- public string PropertyEditorAlias
- {
- get { return _propertyEditorAlias; }
- set
- {
- SetPropertyValueAndDetectChanges(value, ref _propertyEditorAlias, Ps.Value.PropertyEditorAliasSelector);
- //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
- _additionalData["DatabaseType"] = value;
- }
- }
-
- ///
- /// Id of the DataType control
- ///
- [DataMember]
- [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead. This method will return a generated GUID for any property editor alias not explicitly mapped to a legacy ID")]
- public Guid ControlId
- {
- get
- {
- return LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(
- _propertyEditorAlias, LegacyPropertyEditorIdToAliasConverter.NotFoundLegacyIdResponseBehavior.GenerateId).Value;
- }
- set
- {
- var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value, true);
- PropertyEditorAlias = alias;
- //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
- _additionalData["ControlId"] = value;
- }
- }
-
- ///
- /// Gets or Sets the DatabaseType for which the DataType's value is saved as
- ///
- [DataMember]
- public DataTypeDatabaseType DatabaseType
- {
- get { return _databaseType; }
- set
- {
- SetPropertyValueAndDetectChanges(value, ref _databaseType, Ps.Value.DatabaseTypeSelector);
- //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
- _additionalData["DatabaseType"] = value;
- }
- }
-
- private readonly IDictionary _additionalData;
- ///
- /// Some entities may expose additional data that other's might not, this custom data will be available in this collection
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- IDictionary IUmbracoEntity.AdditionalData
- {
- get { return _additionalData; }
- }
- }
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using System.Runtime.Serialization;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models.EntityBase;
+using Umbraco.Core.Persistence;
+using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
+
+namespace Umbraco.Core.Models
+{
+ ///
+ /// Definition of a DataType/PropertyEditor
+ ///
+ ///
+ /// The definition exists as a database reference between an actual DataType/PropertyEditor
+ /// (identified by its control id), its prevalues (configuration) and the named DataType in the backoffice UI.
+ ///
+ [Serializable]
+ [DataContract(IsReference = true)]
+ public class DataTypeDefinition : Entity, IDataTypeDefinition
+ {
+ private int _parentId;
+ private string _name;
+ private int _sortOrder;
+ private int _level;
+ private string _path;
+ private int _creatorId;
+ private bool _trashed;
+ private string _propertyEditorAlias;
+ private DataTypeDatabaseType _databaseType;
+
+ private static readonly ISet IdsOfBuildInDataTypes = new HashSet()
+ {
+ Constants.DataTypes.ContentPickerGuid,
+ Constants.DataTypes.MemberPickerGuid,
+ Constants.DataTypes.MediaPickerGuid,
+ Constants.DataTypes.MultipleMediaPickerGuid,
+ Constants.DataTypes.RelatedLinksGuid,
+ Constants.DataTypes.MemberGuid,
+ Constants.DataTypes.ImageCropperGuid,
+ Constants.DataTypes.TagsGuid,
+ Constants.DataTypes.ListViewContentGuid,
+ Constants.DataTypes.ListViewMediaGuid,
+ Constants.DataTypes.ListViewMembersGuid,
+ Constants.DataTypes.DatePickerWithTimeGuid,
+ Constants.DataTypes.ApprovedColorGuid,
+ Constants.DataTypes.DropdownMultipleGuid,
+ Constants.DataTypes.RadioboxGuid,
+ Constants.DataTypes.DatePickerGuid,
+ Constants.DataTypes.DropdownGuid,
+ Constants.DataTypes.CheckboxListGuid,
+ Constants.DataTypes.CheckboxGuid,
+ Constants.DataTypes.NumericGuid,
+ Constants.DataTypes.RichtextEditorGuid,
+ Constants.DataTypes.TextstringGuid,
+ Constants.DataTypes.TextareaGuid,
+ Constants.DataTypes.UploadGuid,
+ Constants.DataTypes.LabelGuid,
+ };
+
+ [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the alternative contructor that specifies an alias")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public DataTypeDefinition(int parentId, Guid controlId)
+ {
+ _parentId = parentId;
+
+ _propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, false);
+ if (_propertyEditorAlias == null)
+ {
+ //convert to Label!
+ LogHelper.Warn("Could not find a GUID -> Alias mapping for the legacy property editor with id " + controlId + ". The DataType has been converted to a Label.");
+ _propertyEditorAlias = Constants.PropertyEditors.NoEditAlias;
+ }
+
+ _additionalData = new Dictionary();
+ }
+
+ public DataTypeDefinition(int parentId, string propertyEditorAlias)
+ {
+ _parentId = parentId;
+ _propertyEditorAlias = propertyEditorAlias;
+
+ _additionalData = new Dictionary();
+ }
+
+ public DataTypeDefinition(string propertyEditorAlias)
+ {
+ _parentId = -1;
+ _propertyEditorAlias = propertyEditorAlias;
+
+ _additionalData = new Dictionary();
+ }
+
+ public DataTypeDefinition(string propertyEditorAlias, Guid uniqueId)
+ {
+ _parentId = -1;
+ _propertyEditorAlias = propertyEditorAlias;
+
+ _additionalData = new Dictionary();
+ IsBuildInDataType = IdsOfBuildInDataTypes.Contains(uniqueId);
+ }
+
+ private static readonly Lazy Ps = new Lazy();
+
+ private class PropertySelectors
+ {
+ public readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo(x => x.Name);
+ public readonly PropertyInfo ParentIdSelector = ExpressionHelper.GetPropertyInfo(x => x.ParentId);
+ public readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo(x => x.SortOrder);
+ public readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo(x => x.Level);
+ public readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo(x => x.Path);
+ public readonly PropertyInfo UserIdSelector = ExpressionHelper.GetPropertyInfo(x => x.CreatorId);
+ public readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo(x => x.Trashed);
+ public readonly PropertyInfo PropertyEditorAliasSelector = ExpressionHelper.GetPropertyInfo(x => x.PropertyEditorAlias);
+ public readonly PropertyInfo DatabaseTypeSelector = ExpressionHelper.GetPropertyInfo(x => x.DatabaseType);
+ }
+
+ ///
+ /// Gets or sets the Id of the Parent entity
+ ///
+ /// Might not be necessary if handled as a relation?
+ [DataMember]
+ public int ParentId
+ {
+ get { return _parentId; }
+ set { SetPropertyValueAndDetectChanges(value, ref _parentId, Ps.Value.ParentIdSelector); }
+ }
+
+ ///
+ /// Gets or sets the name of the current entity
+ ///
+ [DataMember]
+ public string Name
+ {
+ get { return _name; }
+ set { SetPropertyValueAndDetectChanges(value, ref _name, Ps.Value.NameSelector); }
+ }
+
+ ///
+ /// Gets or sets the sort order of the content entity
+ ///
+ [DataMember]
+ public int SortOrder
+ {
+ get { return _sortOrder; }
+ set { SetPropertyValueAndDetectChanges(value, ref _sortOrder, Ps.Value.SortOrderSelector); }
+ }
+
+ ///
+ /// Gets or sets the level of the content entity
+ ///
+ [DataMember]
+ public int Level
+ {
+ get { return _level; }
+ set { SetPropertyValueAndDetectChanges(value, ref _level, Ps.Value.LevelSelector); }
+ }
+
+ ///
+ /// Gets or sets the path
+ ///
+ [DataMember]
+ public string Path //Setting this value should be handled by the class not the user
+ {
+ get { return _path; }
+ set { SetPropertyValueAndDetectChanges(value, ref _path, Ps.Value.PathSelector); }
+ }
+
+ ///
+ /// Id of the user who created this entity
+ ///
+ [DataMember]
+ public int CreatorId
+ {
+ get { return _creatorId; }
+ set { SetPropertyValueAndDetectChanges(value, ref _creatorId, Ps.Value.UserIdSelector); }
+ }
+
+ //NOTE: SD: Why do we have this ??
+
+ ///
+ /// Boolean indicating whether this entity is Trashed or not.
+ ///
+ [DataMember]
+ public bool Trashed
+ {
+ get { return _trashed; }
+ internal set
+ {
+ SetPropertyValueAndDetectChanges(value, ref _trashed, Ps.Value.TrashedSelector);
+ //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
+ _additionalData["Trashed"] = value;
+ }
+ }
+
+ [DataMember]
+ public string PropertyEditorAlias
+ {
+ get { return _propertyEditorAlias; }
+ set
+ {
+ SetPropertyValueAndDetectChanges(value, ref _propertyEditorAlias, Ps.Value.PropertyEditorAliasSelector);
+ //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
+ _additionalData["DatabaseType"] = value;
+ }
+ }
+
+ ///
+ /// Id of the DataType control
+ ///
+ [DataMember]
+ [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead. This method will return a generated GUID for any property editor alias not explicitly mapped to a legacy ID")]
+ public Guid ControlId
+ {
+ get
+ {
+ return LegacyPropertyEditorIdToAliasConverter.GetLegacyIdFromAlias(
+ _propertyEditorAlias, LegacyPropertyEditorIdToAliasConverter.NotFoundLegacyIdResponseBehavior.GenerateId).Value;
+ }
+ set
+ {
+ var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(value, true);
+ PropertyEditorAlias = alias;
+ //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
+ _additionalData["ControlId"] = value;
+ }
+ }
+
+ ///
+ /// Gets or Sets the DatabaseType for which the DataType's value is saved as
+ ///
+ [DataMember]
+ public DataTypeDatabaseType DatabaseType
+ {
+ get { return _databaseType; }
+ set
+ {
+ SetPropertyValueAndDetectChanges(value, ref _databaseType, Ps.Value.DatabaseTypeSelector);
+ //This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
+ _additionalData["DatabaseType"] = value;
+ }
+ }
+
+ private readonly IDictionary _additionalData;
+ ///
+ /// Some entities may expose additional data that other's might not, this custom data will be available in this collection
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ IDictionary IUmbracoEntity.AdditionalData
+ {
+ get { return _additionalData; }
+ }
+
+ public bool IsBuildInDataType { get;}
+ }
+
}
diff --git a/src/Umbraco.Core/Models/IDataTypeDefinition.cs b/src/Umbraco.Core/Models/IDataTypeDefinition.cs
index a33736e604..f57a1bdca7 100644
--- a/src/Umbraco.Core/Models/IDataTypeDefinition.cs
+++ b/src/Umbraco.Core/Models/IDataTypeDefinition.cs
@@ -1,24 +1,29 @@
-using System;
-using Umbraco.Core.Models.EntityBase;
-
-namespace Umbraco.Core.Models
-{
- public interface IDataTypeDefinition : IUmbracoEntity
- {
- ///
- /// The Property editor alias assigned to the data type
- ///
- string PropertyEditorAlias { get; set; }
-
- ///
- /// Id of the DataType control
- ///
- [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")]
- Guid ControlId { get; set; }
-
- ///
- /// Gets or Sets the DatabaseType for which the DataType's value is saved as
- ///
- DataTypeDatabaseType DatabaseType { get; set; }
- }
-}
\ No newline at end of file
+using System;
+using Umbraco.Core.Models.EntityBase;
+
+namespace Umbraco.Core.Models
+{
+ public interface IDataTypeDefinition : IUmbracoEntity
+ {
+ ///
+ /// The Property editor alias assigned to the data type
+ ///
+ string PropertyEditorAlias { get; set; }
+
+ ///
+ /// Id of the DataType control
+ ///
+ [Obsolete("Property editor's are defined by a string alias from version 7 onwards, use the PropertyEditorAlias property instead")]
+ Guid ControlId { get; set; }
+
+ ///
+ /// Gets or Sets the DatabaseType for which the DataType's value is saved as
+ ///
+ DataTypeDatabaseType DatabaseType { get; set; }
+
+ ///
+ /// Gets information about whether this data type is build in or not.
+ ///
+ bool IsBuildInDataType { get;}
+ }
+}
diff --git a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs
index cf487fa1a2..14c162d8ea 100644
--- a/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs
+++ b/src/Umbraco.Core/Persistence/Factories/DataTypeDefinitionFactory.cs
@@ -1,98 +1,98 @@
-using System;
-using System.Globalization;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Rdbms;
-
-namespace Umbraco.Core.Persistence.Factories
-{
- internal class DataTypeDefinitionFactory
- {
- private readonly Guid _nodeObjectTypeId;
- private int _primaryKey;
-
- public DataTypeDefinitionFactory(Guid nodeObjectTypeId)
- {
- _nodeObjectTypeId = nodeObjectTypeId;
- }
-
- #region Implementation of IEntityFactory
-
- public IDataTypeDefinition BuildEntity(DataTypeDto dto)
- {
- var dataTypeDefinition = new DataTypeDefinition(dto.PropertyEditorAlias);
-
-
- try
- {
- dataTypeDefinition.DisableChangeTracking();
-
- dataTypeDefinition.CreateDate = dto.NodeDto.CreateDate;
- dataTypeDefinition.DatabaseType = dto.DbType.EnumParse(true);
- dataTypeDefinition.Id = dto.DataTypeId;
- dataTypeDefinition.Key = dto.NodeDto.UniqueId;
- dataTypeDefinition.Level = dto.NodeDto.Level;
- dataTypeDefinition.UpdateDate = dto.NodeDto.CreateDate;
- dataTypeDefinition.Name = dto.NodeDto.Text;
- dataTypeDefinition.ParentId = dto.NodeDto.ParentId;
- dataTypeDefinition.Path = dto.NodeDto.Path;
- dataTypeDefinition.SortOrder = dto.NodeDto.SortOrder;
- dataTypeDefinition.Trashed = dto.NodeDto.Trashed;
- dataTypeDefinition.CreatorId = dto.NodeDto.UserId.Value;
-
- //on initial construction we don't want to have dirty properties tracked
- // http://issues.umbraco.org/issue/U4-1946
- dataTypeDefinition.ResetDirtyProperties(false);
- return dataTypeDefinition;
- }
- finally
- {
- dataTypeDefinition.EnableChangeTracking();
- }
- }
-
- public DataTypeDto BuildDto(IDataTypeDefinition entity)
- {
- var dataTypeDto = new DataTypeDto
- {
- PropertyEditorAlias = entity.PropertyEditorAlias,
- DataTypeId = entity.Id,
- DbType = entity.DatabaseType.ToString(),
- NodeDto = BuildNodeDto(entity)
- };
-
- if (_primaryKey > 0)
- {
- dataTypeDto.PrimaryKey = _primaryKey;
- }
-
- return dataTypeDto;
- }
-
- #endregion
-
- public void SetPrimaryKey(int primaryKey)
- {
- _primaryKey = primaryKey;
- }
-
- private NodeDto BuildNodeDto(IDataTypeDefinition entity)
- {
- var nodeDto = new NodeDto
- {
- CreateDate = entity.CreateDate,
- NodeId = entity.Id,
- Level = short.Parse(entity.Level.ToString(CultureInfo.InvariantCulture)),
- NodeObjectType = _nodeObjectTypeId,
- ParentId = entity.ParentId,
- Path = entity.Path,
- SortOrder = entity.SortOrder,
- Text = entity.Name,
- Trashed = entity.Trashed,
- UniqueId = entity.Key,
- UserId = entity.CreatorId
- };
-
- return nodeDto;
- }
- }
-}
\ No newline at end of file
+using System;
+using System.Globalization;
+using Umbraco.Core.Models;
+using Umbraco.Core.Models.Rdbms;
+
+namespace Umbraco.Core.Persistence.Factories
+{
+ internal class DataTypeDefinitionFactory
+ {
+ private readonly Guid _nodeObjectTypeId;
+ private int _primaryKey;
+
+ public DataTypeDefinitionFactory(Guid nodeObjectTypeId)
+ {
+ _nodeObjectTypeId = nodeObjectTypeId;
+ }
+
+ #region Implementation of IEntityFactory
+
+ public IDataTypeDefinition BuildEntity(DataTypeDto dto)
+ {
+ var dataTypeDefinition = new DataTypeDefinition(dto.PropertyEditorAlias,dto.NodeDto.UniqueId);
+
+
+ try
+ {
+ dataTypeDefinition.DisableChangeTracking();
+
+ dataTypeDefinition.CreateDate = dto.NodeDto.CreateDate;
+ dataTypeDefinition.DatabaseType = dto.DbType.EnumParse(true);
+ dataTypeDefinition.Id = dto.DataTypeId;
+ dataTypeDefinition.Key = dto.NodeDto.UniqueId;
+ dataTypeDefinition.Level = dto.NodeDto.Level;
+ dataTypeDefinition.UpdateDate = dto.NodeDto.CreateDate;
+ dataTypeDefinition.Name = dto.NodeDto.Text;
+ dataTypeDefinition.ParentId = dto.NodeDto.ParentId;
+ dataTypeDefinition.Path = dto.NodeDto.Path;
+ dataTypeDefinition.SortOrder = dto.NodeDto.SortOrder;
+ dataTypeDefinition.Trashed = dto.NodeDto.Trashed;
+ dataTypeDefinition.CreatorId = dto.NodeDto.UserId.Value;
+
+ //on initial construction we don't want to have dirty properties tracked
+ // http://issues.umbraco.org/issue/U4-1946
+ dataTypeDefinition.ResetDirtyProperties(false);
+ return dataTypeDefinition;
+ }
+ finally
+ {
+ dataTypeDefinition.EnableChangeTracking();
+ }
+ }
+
+ public DataTypeDto BuildDto(IDataTypeDefinition entity)
+ {
+ var dataTypeDto = new DataTypeDto
+ {
+ PropertyEditorAlias = entity.PropertyEditorAlias,
+ DataTypeId = entity.Id,
+ DbType = entity.DatabaseType.ToString(),
+ NodeDto = BuildNodeDto(entity)
+ };
+
+ if (_primaryKey > 0)
+ {
+ dataTypeDto.PrimaryKey = _primaryKey;
+ }
+
+ return dataTypeDto;
+ }
+
+ #endregion
+
+ public void SetPrimaryKey(int primaryKey)
+ {
+ _primaryKey = primaryKey;
+ }
+
+ private NodeDto BuildNodeDto(IDataTypeDefinition entity)
+ {
+ var nodeDto = new NodeDto
+ {
+ CreateDate = entity.CreateDate,
+ NodeId = entity.Id,
+ Level = short.Parse(entity.Level.ToString(CultureInfo.InvariantCulture)),
+ NodeObjectType = _nodeObjectTypeId,
+ ParentId = entity.ParentId,
+ Path = entity.Path,
+ SortOrder = entity.SortOrder,
+ Text = entity.Name,
+ Trashed = entity.Trashed,
+ UniqueId = entity.Key,
+ UserId = entity.CreatorId
+ };
+
+ return nodeDto;
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs
index b8e605e63e..e1716947e1 100644
--- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs
+++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs
@@ -1,342 +1,342 @@
-using System;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models.Rdbms;
-
-namespace Umbraco.Core.Persistence.Migrations.Initial
-{
- ///
- /// Represents the initial data creation by running Insert for the base data.
- ///
- internal class BaseDataCreation
- {
- private readonly Database _database;
- private readonly ILogger _logger;
-
- public BaseDataCreation(Database database, ILogger logger)
- {
- _database = database;
- _logger = logger;
- }
-
- ///
- /// Initialize the base data creation by inserting the data foundation for umbraco
- /// specific to a table
- ///
- /// Name of the table to create base data for
- public void InitializeBaseData(string tableName)
- {
- _logger.Info(string.Format("Creating data in table {0}", tableName));
-
- if(tableName.Equals("umbracoNode"))
- {
- CreateUmbracoNodeData();
- }
-
- if (tableName.Equals("umbracoLock"))
- {
- CreateUmbracoLockData();
- }
-
- if (tableName.Equals("cmsContentType"))
- {
- CreateCmsContentTypeData();
- }
-
- if (tableName.Equals("umbracoUser"))
- {
- CreateUmbracoUserData();
- }
-
- if (tableName.Equals("umbracoUserGroup"))
- {
- CreateUmbracoUserGroupData();
- }
-
- if (tableName.Equals("umbracoUser2UserGroup"))
- {
- CreateUmbracoUser2UserGroupData();
- }
-
- if (tableName.Equals("umbracoUserGroup2App"))
- {
- CreateUmbracoUserGroup2AppData();
- }
-
- if (tableName.Equals("cmsPropertyTypeGroup"))
- {
- CreateCmsPropertyTypeGroupData();
- }
-
- if (tableName.Equals("cmsPropertyType"))
- {
- CreateCmsPropertyTypeData();
- }
-
- if (tableName.Equals("umbracoLanguage"))
- {
- CreateUmbracoLanguageData();
- }
-
- if (tableName.Equals("cmsContentTypeAllowedContentType"))
- {
- CreateCmsContentTypeAllowedContentTypeData();
- }
-
- if(tableName.Equals("cmsDataType"))
- {
- CreateCmsDataTypeData();
- }
-
- if (tableName.Equals("cmsDataTypePreValues"))
- {
- CreateCmsDataTypePreValuesData();
- }
-
- if (tableName.Equals("umbracoRelationType"))
- {
- CreateUmbracoRelationTypeData();
- }
-
- if (tableName.Equals("cmsTaskType"))
- {
- CreateCmsTaskTypeData();
- }
-
- if (tableName.Equals("umbracoMigration"))
- {
- CreateUmbracoMigrationData();
- }
-
- _logger.Info(string.Format("Done creating data in table {0}", tableName));
- }
-
- private void CreateUmbracoNodeData()
- {
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = new Guid(Constants.ObjectTypes.SystemRoot), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -20, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,-20", SortOrder = 0, UniqueId = new Guid("0F582A79-1E41-4CF0-BFA0-76340651891A"), Text = "Recycle Bin", NodeObjectType = new Guid(Constants.ObjectTypes.ContentRecycleBin), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = new Guid(Constants.ObjectTypes.MediaRecycleBin), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -92, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-92", SortOrder = 35, UniqueId = new Guid("f0bc4bfb-b499-40d6-ba86-058885a5178c"), Text = "Label", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = new Guid("84c6b441-31df-4ffe-b67e-67d5bc3ae65a"), Text = "Upload", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textarea", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae"), Text = "Textstring", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad"), Text = "Richtext editor", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = new Guid("2e6d3631-066e-44b8-aec4-96f09099b2b5"), Text = "Numeric", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -49, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-49", SortOrder = 2, UniqueId = new Guid("92897bc6-a5f3-4ffe-ae27-f2e7e33dda49"), Text = "Checkbox", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = new Guid("fbaf13a8-4036-41f2-93a3-974f678c312a"), Text = "Checkbox list", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -42, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-42", SortOrder = 2, UniqueId = new Guid("0b6a45e7-44ba-430d-9da5-4e46060b9e03"), Text = "Dropdown", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = new Guid("5046194e-4237-453c-a547-15db3a07c4e1"), Text = "Date Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = new Guid("bb5f57c9-ce2b-4bb9-b697-4caca783a805"), Text = "Radiobox", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -39, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-39", SortOrder = 2, UniqueId = new Guid("f38f0ac7-1d27-439c-9f3f-089cd8825a53"), Text = "Dropdown multiple", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = new Guid("0225af17-b302-49cb-9176-b9f35cab9c17"), Text = "Approved Color", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -36, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-36", SortOrder = 2, UniqueId = new Guid("e4d66c0f-b935-4200-81f0-025f7256b89a"), Text = "Date Picker with time", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultContentListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-95", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultMediaListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-96", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultMembersListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-97", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1031, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1031", SortOrder = 2, UniqueId = new Guid("f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d"), Text = Constants.Conventions.MediaTypes.Folder, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1032, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1032", SortOrder = 2, UniqueId = new Guid("cc07b313-0843-4aa8-bbda-871c8da728c8"), Text = Constants.Conventions.MediaTypes.Image, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1033, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1033", SortOrder = 2, UniqueId = new Guid("4c52d8ab-54e6-40cd-999c-7a5f24903e4d"), Text = Constants.Conventions.MediaTypes.File, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1041, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1041", SortOrder = 2, UniqueId = new Guid("b6b73142-b9c1-4bf8-a16d-e1c23320b549"), Text = "Tags", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1043, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1043", SortOrder = 2, UniqueId = new Guid("1df9f033-e6d4-451f-b8d2-e0cbc50a836f"), Text = "Image Cropper", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1044, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = new Guid("d59be02f-1df9-4228-aa1e-01917d806cda"), Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = new Guid(Constants.ObjectTypes.MemberType), CreateDate = DateTime.Now });
-
- //New UDI pickers with newer Ids
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1046, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1046", SortOrder = 2, UniqueId = new Guid("FD1E0DA5-5606-4862-B679-5D0CF3A52A59"), Text = "Content Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = new Guid("1EA2E01F-EBD8-4CE1-8D71-6B1149E63548"), Text = "Member Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = new Guid("135D60E0-64D9-49ED-AB08-893C9BA44AE5"), Text = "Media Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = new Guid("9DBBCBBB-2327-434A-B355-AF1B84E5010A"), Text = "Multiple Media Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Related Links", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
- }
-
- private void CreateUmbracoLockData()
- {
- // all lock objects
- _database.Insert("umbracoLock", "id", false, new LockDto { Id = Constants.Locks.Servers, Name = "Servers" });
- }
-
- private void CreateCmsContentTypeData()
- {
- _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = "icon-folder", Thumbnail = "icon-folder", IsContainer = false, AllowAtRoot = true });
- _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = "icon-picture", Thumbnail = "icon-picture", AllowAtRoot = true });
- _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = "icon-document", Thumbnail = "icon-document", AllowAtRoot = true });
- _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = "icon-user", Thumbnail = "icon-user" });
- }
-
- private void CreateUmbracoUserData()
- {
- _database.Insert("umbracoUser", "id", false, new UserDto { Id = 0, Disabled = false, NoConsole = false, UserName = "Administrator", Login = "admin", Password = "default", Email = "", UserLanguage = "en-US", CreateDate = DateTime.Now, UpdateDate = DateTime.Now });
- }
-
- private void CreateUmbracoUserGroupData()
- {
- _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 1, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.AdminGroupAlias, Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7ï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-medal" });
- _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 2, StartMediaId = -1, StartContentId = -1, Alias = "writer", Name = "Writers", DefaultPermissions = "CAH:F", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-edit" });
- _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 3, StartMediaId = -1, StartContentId = -1, Alias = "editor", Name = "Editors", DefaultPermissions = "CADMOSKTPUZ:5Fï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-tools" });
- _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 4, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.TranslatorGroupAlias, Name = "Translators", DefaultPermissions = "AF", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-globe" });
- _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 5, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.SensitiveDataGroupAlias, Name = "Sensitive data", DefaultPermissions = "", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-lock" });
- }
-
- private void CreateUmbracoUser2UserGroupData()
- {
- _database.Insert(new User2UserGroupDto { UserGroupId = 1, UserId = 0 }); //add admin to admins
- _database.Insert(new User2UserGroupDto { UserGroupId = 5, UserId = 0 }); //add admin to sensitive data
- }
-
- private void CreateUmbracoUserGroup2AppData()
- {
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Content });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Developer });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Media });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Members });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Users });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms });
-
- _database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content });
-
- _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Content });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Media });
- _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms });
-
- _database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.Applications.Translation });
- }
-
- private void CreateCmsPropertyTypeGroupData()
- {
- _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 3, ContentTypeNodeId = 1032, Text = "Image", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Image) });
- _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 4, ContentTypeNodeId = 1033, Text = "File", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.File) });
- _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 5, ContentTypeNodeId = 1031, Text = "Contents", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Contents) });
- //membership property group
- _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership) });
- }
-
- private void CreateCmsPropertyTypeData()
- {
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = 1043, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 7, UniqueId = 7.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Width, Name = "Width", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 8, UniqueId = 8.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Height, Name = "Height", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 9, UniqueId = 9.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 10, UniqueId = 10.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = -90, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 25, UniqueId = 25.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 26, UniqueId = 26.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 27, UniqueId = 27.ToGuid(), DataTypeId = Constants.System.DefaultMediaListViewDataTypeId, ContentTypeId = 1031, PropertyTypeGroupId = 5, Alias = "contents", Name = "Contents:", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- //membership property types
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = -89, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 29, UniqueId = 29.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.FailedPasswordAttempts, Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel, SortOrder = 1, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 32, UniqueId = 32.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLockoutDate, Name = Constants.Conventions.Member.LastLockoutDateLabel, SortOrder = 4, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 33, UniqueId = 33.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLoginDate, Name = Constants.Conventions.Member.LastLoginDateLabel, SortOrder = 5, Mandatory = false, ValidationRegExp = null, Description = null });
- _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 34, UniqueId = 34.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastPasswordChangeDate, Name = Constants.Conventions.Member.LastPasswordChangeDateLabel, SortOrder = 6, Mandatory = false, ValidationRegExp = null, Description = null });
-
- }
-
- private void CreateUmbracoLanguageData()
- {
- _database.Insert("umbracoLanguage", "id", false, new LanguageDto { Id = 1, IsoCode = "en-US", CultureName = "en-US" });
- }
-
- private void CreateCmsContentTypeAllowedContentTypeData()
- {
- _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1031 });
- _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1032 });
- _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1033 });
- }
-
- private void CreateCmsDataTypeData()
- {
- //TODO Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors.
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 1, DataTypeId = -49, PropertyEditorAlias = Constants.PropertyEditors.TrueFalseAlias, DbType = "Integer" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 2, DataTypeId = -51, PropertyEditorAlias = Constants.PropertyEditors.IntegerAlias, DbType = "Integer" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 3, DataTypeId = -87, PropertyEditorAlias = Constants.PropertyEditors.TinyMCEAlias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 4, DataTypeId = -88, PropertyEditorAlias = Constants.PropertyEditors.TextboxAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 5, DataTypeId = -89, PropertyEditorAlias = Constants.PropertyEditors.TextboxMultipleAlias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 6, DataTypeId = -90, PropertyEditorAlias = Constants.PropertyEditors.UploadFieldAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 7, DataTypeId = -92, PropertyEditorAlias = Constants.PropertyEditors.NoEditAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 8, DataTypeId = -36, PropertyEditorAlias = Constants.PropertyEditors.DateTimeAlias, DbType = "Date" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 9, DataTypeId = -37, PropertyEditorAlias = Constants.PropertyEditors.ColorPickerAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 11, DataTypeId = -39, PropertyEditorAlias = Constants.PropertyEditors.DropDownListFlexibleAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 12, DataTypeId = -40, PropertyEditorAlias = Constants.PropertyEditors.RadioButtonListAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 13, DataTypeId = -41, PropertyEditorAlias = Constants.PropertyEditors.DateAlias, DbType = "Date" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 14, DataTypeId = -42, PropertyEditorAlias = Constants.PropertyEditors.DropDownListFlexibleAlias, DbType = "Integer" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 15, DataTypeId = -43, PropertyEditorAlias = Constants.PropertyEditors.CheckBoxListAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 22, DataTypeId = 1041, PropertyEditorAlias = Constants.PropertyEditors.TagsAlias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 24, DataTypeId = 1043, PropertyEditorAlias = Constants.PropertyEditors.ImageCropperAlias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -26, DataTypeId = Constants.System.DefaultContentListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -27, DataTypeId = Constants.System.DefaultMediaListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -28, DataTypeId = Constants.System.DefaultMembersListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
-
- //New UDI pickers with newer Ids
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 26, DataTypeId = 1046, PropertyEditorAlias = Constants.PropertyEditors.ContentPicker2Alias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 27, DataTypeId = 1047, PropertyEditorAlias = Constants.PropertyEditors.MemberPicker2Alias, DbType = "Nvarchar" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 28, DataTypeId = 1048, PropertyEditorAlias = Constants.PropertyEditors.MediaPicker2Alias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 29, DataTypeId = 1049, PropertyEditorAlias = Constants.PropertyEditors.MediaPicker2Alias, DbType = "Ntext" });
- _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 30, DataTypeId = 1050, PropertyEditorAlias = Constants.PropertyEditors.RelatedLinks2Alias, DbType = "Ntext" });
- }
-
- private void CreateCmsDataTypePreValuesData()
- {
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 3, Alias = "", SortOrder = 0, DataTypeNodeId = -87, Value = ",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 4, Alias = "group", SortOrder = 0, DataTypeNodeId = 1041, Value = "default" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 5, Alias = "storageType", SortOrder = 0, DataTypeNodeId = 1041, Value = "Json" });
-
- //defaults for the member list
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -1, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "10" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -2, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "username" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -3, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "asc" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -4, Alias = "includeProperties", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "[{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]" });
-
- //layouts for the list view
- var cardLayout = "{\"name\": \"Grid\",\"path\": \"views/propertyeditors/listview/layouts/grid/grid.html\", \"icon\": \"icon-thumbnails-small\", \"isSystem\": 1, \"selected\": true}";
- var listLayout = "{\"name\": \"List\",\"path\": \"views/propertyeditors/listview/layouts/list/list.html\",\"icon\": \"icon-list\", \"isSystem\": 1,\"selected\": true}";
-
- //defaults for the media list
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -5, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "100" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -6, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "updateDate" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -7, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "desc" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -8, Alias = "layouts", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[" + cardLayout + "," + listLayout + "]" });
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -9, Alias = "includeProperties", SortOrder = 5, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]" });
-
- //default's for MultipleMediaPickerAlias picker
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 6, Alias = "multiPicker", SortOrder = 0, DataTypeNodeId = 1049, Value = "1" });
-
- // Defaults for single item dropdown
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 7, Alias = "multiple", SortOrder = 0, DataTypeNodeId = -42, Value = "0" });
-
- // Defaults for multiple item dropdown
- _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 8, Alias = "multiple", SortOrder = 0, DataTypeNodeId = -39, Value = "1" });
- }
-
- private void CreateUmbracoRelationTypeData()
- {
- var relationType = new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName };
- relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
- _database.Insert("umbracoRelationType", "id", false, relationType);
- relationType = new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName };
- relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
- _database.Insert("umbracoRelationType", "id", false, relationType);
- relationType = new RelationTypeDto { Id = 3, Alias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Media), ParentObjectType = new Guid(Constants.ObjectTypes.Media), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName };
- relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
- _database.Insert("umbracoRelationType", "id", false, relationType);
- }
-
- private void CreateCmsTaskTypeData()
- {
- _database.Insert("cmsTaskType", "id", false, new TaskTypeDto { Id = 1, Alias = "toTranslate" });
- }
-
- private void CreateUmbracoMigrationData()
- {
- var dto = new MigrationDto
- {
- Id = 1,
- Name = Constants.System.UmbracoMigrationName,
- Version = UmbracoVersion.GetSemanticVersion().ToString(),
- CreateDate = DateTime.Now
- };
-
- _database.Insert("umbracoMigration", "pk", false, dto);
- }
- }
-}
+using System;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models.Rdbms;
+
+namespace Umbraco.Core.Persistence.Migrations.Initial
+{
+ ///
+ /// Represents the initial data creation by running Insert for the base data.
+ ///
+ internal class BaseDataCreation
+ {
+ private readonly Database _database;
+ private readonly ILogger _logger;
+
+ public BaseDataCreation(Database database, ILogger logger)
+ {
+ _database = database;
+ _logger = logger;
+ }
+
+ ///
+ /// Initialize the base data creation by inserting the data foundation for umbraco
+ /// specific to a table
+ ///
+ /// Name of the table to create base data for
+ public void InitializeBaseData(string tableName)
+ {
+ _logger.Info(string.Format("Creating data in table {0}", tableName));
+
+ if(tableName.Equals("umbracoNode"))
+ {
+ CreateUmbracoNodeData();
+ }
+
+ if (tableName.Equals("umbracoLock"))
+ {
+ CreateUmbracoLockData();
+ }
+
+ if (tableName.Equals("cmsContentType"))
+ {
+ CreateCmsContentTypeData();
+ }
+
+ if (tableName.Equals("umbracoUser"))
+ {
+ CreateUmbracoUserData();
+ }
+
+ if (tableName.Equals("umbracoUserGroup"))
+ {
+ CreateUmbracoUserGroupData();
+ }
+
+ if (tableName.Equals("umbracoUser2UserGroup"))
+ {
+ CreateUmbracoUser2UserGroupData();
+ }
+
+ if (tableName.Equals("umbracoUserGroup2App"))
+ {
+ CreateUmbracoUserGroup2AppData();
+ }
+
+ if (tableName.Equals("cmsPropertyTypeGroup"))
+ {
+ CreateCmsPropertyTypeGroupData();
+ }
+
+ if (tableName.Equals("cmsPropertyType"))
+ {
+ CreateCmsPropertyTypeData();
+ }
+
+ if (tableName.Equals("umbracoLanguage"))
+ {
+ CreateUmbracoLanguageData();
+ }
+
+ if (tableName.Equals("cmsContentTypeAllowedContentType"))
+ {
+ CreateCmsContentTypeAllowedContentTypeData();
+ }
+
+ if(tableName.Equals("cmsDataType"))
+ {
+ CreateCmsDataTypeData();
+ }
+
+ if (tableName.Equals("cmsDataTypePreValues"))
+ {
+ CreateCmsDataTypePreValuesData();
+ }
+
+ if (tableName.Equals("umbracoRelationType"))
+ {
+ CreateUmbracoRelationTypeData();
+ }
+
+ if (tableName.Equals("cmsTaskType"))
+ {
+ CreateCmsTaskTypeData();
+ }
+
+ if (tableName.Equals("umbracoMigration"))
+ {
+ CreateUmbracoMigrationData();
+ }
+
+ _logger.Info(string.Format("Done creating data in table {0}", tableName));
+ }
+
+ private void CreateUmbracoNodeData()
+ {
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = new Guid(Constants.ObjectTypes.SystemRoot), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -20, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,-20", SortOrder = 0, UniqueId = new Guid("0F582A79-1E41-4CF0-BFA0-76340651891A"), Text = "Recycle Bin", NodeObjectType = new Guid(Constants.ObjectTypes.ContentRecycleBin), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = new Guid(Constants.ObjectTypes.MediaRecycleBin), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -92, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-92", SortOrder = 35, UniqueId = Constants.DataTypes.LabelGuid, Text = "Label", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = Constants.DataTypes.UploadGuid, Text = "Upload", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = Constants.DataTypes.TextareaGuid, Text = "Textarea", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = Constants.DataTypes.TextstringGuid, Text = "Textstring", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = Constants.DataTypes.RichtextEditorGuid, Text = "Richtext editor", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = Constants.DataTypes.NumericGuid, Text = "Numeric", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -49, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-49", SortOrder = 2, UniqueId = Constants.DataTypes.CheckboxGuid, Text = "Checkbox", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = Constants.DataTypes.CheckboxListGuid, Text = "Checkbox list", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -42, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-42", SortOrder = 2, UniqueId = Constants.DataTypes.DropdownGuid, Text = "Dropdown", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = Constants.DataTypes.DatePickerGuid, Text = "Date Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = Constants.DataTypes.RadioboxGuid, Text = "Radiobox", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -39, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-39", SortOrder = 2, UniqueId = Constants.DataTypes.DropdownMultipleGuid, Text = "Dropdown multiple", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = Constants.DataTypes.ApprovedColorGuid, Text = "Approved Color", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = -36, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-36", SortOrder = 2, UniqueId = Constants.DataTypes.DatePickerWithTimeGuid, Text = "Date Picker with time", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultContentListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-95", SortOrder = 2, UniqueId = Constants.DataTypes.ListViewContentGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultMediaListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-96", SortOrder = 2, UniqueId = Constants.DataTypes.ListViewMembersGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.System.DefaultMembersListViewDataTypeId, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-97", SortOrder = 2, UniqueId = Constants.DataTypes.ListViewMembersGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1031, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1031", SortOrder = 2, UniqueId = new Guid("f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d"), Text = Constants.Conventions.MediaTypes.Folder, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1032, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1032", SortOrder = 2, UniqueId = new Guid("cc07b313-0843-4aa8-bbda-871c8da728c8"), Text = Constants.Conventions.MediaTypes.Image, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1033, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1033", SortOrder = 2, UniqueId = new Guid("4c52d8ab-54e6-40cd-999c-7a5f24903e4d"), Text = Constants.Conventions.MediaTypes.File, NodeObjectType = new Guid(Constants.ObjectTypes.MediaType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1041, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1041", SortOrder = 2, UniqueId = Constants.DataTypes.TagsGuid, Text = "Tags", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1043, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1043", SortOrder = 2, UniqueId = Constants.DataTypes.ImageCropperGuid, Text = "Image Cropper", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1044, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = Constants.DataTypes.MemberGuid, Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = new Guid(Constants.ObjectTypes.MemberType), CreateDate = DateTime.Now });
+
+ //New UDI pickers with newer Ids
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1046, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1046", SortOrder = 2, UniqueId = Constants.DataTypes.ContentPickerGuid, Text = "Content Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = Constants.DataTypes.MemberPickerGuid, Text = "Member Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = Constants.DataTypes.MediaPickerGuid, Text = "Media Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = Constants.DataTypes.MultipleMediaPickerGuid, Text = "Multiple Media Picker", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ _database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = Constants.DataTypes.RelatedLinksGuid, Text = "Related Links", NodeObjectType = new Guid(Constants.ObjectTypes.DataType), CreateDate = DateTime.Now });
+ }
+
+ private void CreateUmbracoLockData()
+ {
+ // all lock objects
+ _database.Insert("umbracoLock", "id", false, new LockDto { Id = Constants.Locks.Servers, Name = "Servers" });
+ }
+
+ private void CreateCmsContentTypeData()
+ {
+ _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = "icon-folder", Thumbnail = "icon-folder", IsContainer = false, AllowAtRoot = true });
+ _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = "icon-picture", Thumbnail = "icon-picture", AllowAtRoot = true });
+ _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = "icon-document", Thumbnail = "icon-document", AllowAtRoot = true });
+ _database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = "icon-user", Thumbnail = "icon-user" });
+ }
+
+ private void CreateUmbracoUserData()
+ {
+ _database.Insert("umbracoUser", "id", false, new UserDto { Id = 0, Disabled = false, NoConsole = false, UserName = "Administrator", Login = "admin", Password = "default", Email = "", UserLanguage = "en-US", CreateDate = DateTime.Now, UpdateDate = DateTime.Now });
+ }
+
+ private void CreateUmbracoUserGroupData()
+ {
+ _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 1, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.AdminGroupAlias, Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7ï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-medal" });
+ _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 2, StartMediaId = -1, StartContentId = -1, Alias = "writer", Name = "Writers", DefaultPermissions = "CAH:F", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-edit" });
+ _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 3, StartMediaId = -1, StartContentId = -1, Alias = "editor", Name = "Editors", DefaultPermissions = "CADMOSKTPUZ:5Fï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-tools" });
+ _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 4, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.TranslatorGroupAlias, Name = "Translators", DefaultPermissions = "AF", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-globe" });
+ _database.Insert("umbracoUserGroup", "id", false, new UserGroupDto { Id = 5, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.SensitiveDataGroupAlias, Name = "Sensitive data", DefaultPermissions = "", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-lock" });
+ }
+
+ private void CreateUmbracoUser2UserGroupData()
+ {
+ _database.Insert(new User2UserGroupDto { UserGroupId = 1, UserId = 0 }); //add admin to admins
+ _database.Insert(new User2UserGroupDto { UserGroupId = 5, UserId = 0 }); //add admin to sensitive data
+ }
+
+ private void CreateUmbracoUserGroup2AppData()
+ {
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Content });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Developer });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Media });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Members });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Users });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms });
+
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content });
+
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Content });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Media });
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms });
+
+ _database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.Applications.Translation });
+ }
+
+ private void CreateCmsPropertyTypeGroupData()
+ {
+ _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 3, ContentTypeNodeId = 1032, Text = "Image", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Image) });
+ _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 4, ContentTypeNodeId = 1033, Text = "File", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.File) });
+ _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 5, ContentTypeNodeId = 1031, Text = "Contents", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Contents) });
+ //membership property group
+ _database.Insert("cmsPropertyTypeGroup", "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership) });
+ }
+
+ private void CreateCmsPropertyTypeData()
+ {
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = 1043, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 7, UniqueId = 7.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Width, Name = "Width", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 8, UniqueId = 8.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Height, Name = "Height", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 9, UniqueId = 9.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 10, UniqueId = 10.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = -90, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 25, UniqueId = 25.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 26, UniqueId = 26.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 27, UniqueId = 27.ToGuid(), DataTypeId = Constants.System.DefaultMediaListViewDataTypeId, ContentTypeId = 1031, PropertyTypeGroupId = 5, Alias = "contents", Name = "Contents:", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ //membership property types
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = -89, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 29, UniqueId = 29.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.FailedPasswordAttempts, Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel, SortOrder = 1, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = -49, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 32, UniqueId = 32.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLockoutDate, Name = Constants.Conventions.Member.LastLockoutDateLabel, SortOrder = 4, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 33, UniqueId = 33.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLoginDate, Name = Constants.Conventions.Member.LastLoginDateLabel, SortOrder = 5, Mandatory = false, ValidationRegExp = null, Description = null });
+ _database.Insert("cmsPropertyType", "id", false, new PropertyTypeDto { Id = 34, UniqueId = 34.ToGuid(), DataTypeId = -92, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastPasswordChangeDate, Name = Constants.Conventions.Member.LastPasswordChangeDateLabel, SortOrder = 6, Mandatory = false, ValidationRegExp = null, Description = null });
+
+ }
+
+ private void CreateUmbracoLanguageData()
+ {
+ _database.Insert("umbracoLanguage", "id", false, new LanguageDto { Id = 1, IsoCode = "en-US", CultureName = "en-US" });
+ }
+
+ private void CreateCmsContentTypeAllowedContentTypeData()
+ {
+ _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1031 });
+ _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1032 });
+ _database.Insert("cmsContentTypeAllowedContentType", "Id", false, new ContentTypeAllowedContentTypeDto { Id = 1031, AllowedId = 1033 });
+ }
+
+ private void CreateCmsDataTypeData()
+ {
+ //TODO Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors.
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 1, DataTypeId = -49, PropertyEditorAlias = Constants.PropertyEditors.TrueFalseAlias, DbType = "Integer" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 2, DataTypeId = -51, PropertyEditorAlias = Constants.PropertyEditors.IntegerAlias, DbType = "Integer" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 3, DataTypeId = -87, PropertyEditorAlias = Constants.PropertyEditors.TinyMCEAlias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 4, DataTypeId = -88, PropertyEditorAlias = Constants.PropertyEditors.TextboxAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 5, DataTypeId = -89, PropertyEditorAlias = Constants.PropertyEditors.TextboxMultipleAlias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 6, DataTypeId = -90, PropertyEditorAlias = Constants.PropertyEditors.UploadFieldAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 7, DataTypeId = -92, PropertyEditorAlias = Constants.PropertyEditors.NoEditAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 8, DataTypeId = -36, PropertyEditorAlias = Constants.PropertyEditors.DateTimeAlias, DbType = "Date" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 9, DataTypeId = -37, PropertyEditorAlias = Constants.PropertyEditors.ColorPickerAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 11, DataTypeId = -39, PropertyEditorAlias = Constants.PropertyEditors.DropDownListFlexibleAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 12, DataTypeId = -40, PropertyEditorAlias = Constants.PropertyEditors.RadioButtonListAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 13, DataTypeId = -41, PropertyEditorAlias = Constants.PropertyEditors.DateAlias, DbType = "Date" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 14, DataTypeId = -42, PropertyEditorAlias = Constants.PropertyEditors.DropDownListFlexibleAlias, DbType = "Integer" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 15, DataTypeId = -43, PropertyEditorAlias = Constants.PropertyEditors.CheckBoxListAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 22, DataTypeId = 1041, PropertyEditorAlias = Constants.PropertyEditors.TagsAlias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 24, DataTypeId = 1043, PropertyEditorAlias = Constants.PropertyEditors.ImageCropperAlias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -26, DataTypeId = Constants.System.DefaultContentListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -27, DataTypeId = Constants.System.DefaultMediaListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = -28, DataTypeId = Constants.System.DefaultMembersListViewDataTypeId, PropertyEditorAlias = Constants.PropertyEditors.ListViewAlias, DbType = "Nvarchar" });
+
+ //New UDI pickers with newer Ids
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 26, DataTypeId = 1046, PropertyEditorAlias = Constants.PropertyEditors.ContentPicker2Alias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 27, DataTypeId = 1047, PropertyEditorAlias = Constants.PropertyEditors.MemberPicker2Alias, DbType = "Nvarchar" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 28, DataTypeId = 1048, PropertyEditorAlias = Constants.PropertyEditors.MediaPicker2Alias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 29, DataTypeId = 1049, PropertyEditorAlias = Constants.PropertyEditors.MediaPicker2Alias, DbType = "Ntext" });
+ _database.Insert("cmsDataType", "pk", false, new DataTypeDto { PrimaryKey = 30, DataTypeId = 1050, PropertyEditorAlias = Constants.PropertyEditors.RelatedLinks2Alias, DbType = "Ntext" });
+ }
+
+ private void CreateCmsDataTypePreValuesData()
+ {
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 3, Alias = "", SortOrder = 0, DataTypeNodeId = -87, Value = ",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 4, Alias = "group", SortOrder = 0, DataTypeNodeId = 1041, Value = "default" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 5, Alias = "storageType", SortOrder = 0, DataTypeNodeId = 1041, Value = "Json" });
+
+ //defaults for the member list
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -1, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "10" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -2, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "username" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -3, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "asc" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -4, Alias = "includeProperties", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMembersListViewDataTypeId, Value = "[{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]" });
+
+ //layouts for the list view
+ var cardLayout = "{\"name\": \"Grid\",\"path\": \"views/propertyeditors/listview/layouts/grid/grid.html\", \"icon\": \"icon-thumbnails-small\", \"isSystem\": 1, \"selected\": true}";
+ var listLayout = "{\"name\": \"List\",\"path\": \"views/propertyeditors/listview/layouts/list/list.html\",\"icon\": \"icon-list\", \"isSystem\": 1,\"selected\": true}";
+
+ //defaults for the media list
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -5, Alias = "pageSize", SortOrder = 1, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "100" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -6, Alias = "orderBy", SortOrder = 2, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "updateDate" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -7, Alias = "orderDirection", SortOrder = 3, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "desc" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -8, Alias = "layouts", SortOrder = 4, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[" + cardLayout + "," + listLayout + "]" });
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = -9, Alias = "includeProperties", SortOrder = 5, DataTypeNodeId = Constants.System.DefaultMediaListViewDataTypeId, Value = "[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]" });
+
+ //default's for MultipleMediaPickerAlias picker
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 6, Alias = "multiPicker", SortOrder = 0, DataTypeNodeId = 1049, Value = "1" });
+
+ // Defaults for single item dropdown
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 7, Alias = "multiple", SortOrder = 0, DataTypeNodeId = -42, Value = "0" });
+
+ // Defaults for multiple item dropdown
+ _database.Insert("cmsDataTypePreValues", "id", false, new DataTypePreValueDto { Id = 8, Alias = "multiple", SortOrder = 0, DataTypeNodeId = -39, Value = "1" });
+ }
+
+ private void CreateUmbracoRelationTypeData()
+ {
+ var relationType = new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName };
+ relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
+ _database.Insert("umbracoRelationType", "id", false, relationType);
+ relationType = new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Document), ParentObjectType = new Guid(Constants.ObjectTypes.Document), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName };
+ relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
+ _database.Insert("umbracoRelationType", "id", false, relationType);
+ relationType = new RelationTypeDto { Id = 3, Alias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias, ChildObjectType = new Guid(Constants.ObjectTypes.Media), ParentObjectType = new Guid(Constants.ObjectTypes.Media), Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName };
+ relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid();
+ _database.Insert("umbracoRelationType", "id", false, relationType);
+ }
+
+ private void CreateCmsTaskTypeData()
+ {
+ _database.Insert("cmsTaskType", "id", false, new TaskTypeDto { Id = 1, Alias = "toTranslate" });
+ }
+
+ private void CreateUmbracoMigrationData()
+ {
+ var dto = new MigrationDto
+ {
+ Id = 1,
+ Name = Constants.System.UmbracoMigrationName,
+ Version = UmbracoVersion.GetSemanticVersion().ToString(),
+ CreateDate = DateTime.Now
+ };
+
+ _database.Insert("umbracoMigration", "pk", false, dto);
+ }
+ }
+}
diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs
index 43c2b69c47..b02fb644d8 100644
--- a/src/Umbraco.Core/Services/DataTypeService.cs
+++ b/src/Umbraco.Core/Services/DataTypeService.cs
@@ -356,7 +356,7 @@ namespace Umbraco.Core.Services
if (dataType != null)
{
var preValues = GetPreValuesCollectionByDataTypeId(dataType.Id);
- if (preValues.PreValuesAsDictionary.TryGetValue("ignoreUserStartNodes", out var preValue))
+ if (preValues.PreValuesAsDictionary.TryGetValue(Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, out var preValue))
{
return string.Equals(preValue.Value, "1", StringComparison.InvariantCulture);
}
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 0b3c923c83..f29c1bea46 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -324,6 +324,9 @@
+
+ Constants.cs
+
diff --git a/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs b/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs
index 9d1331e691..652bd34fff 100644
--- a/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs
+++ b/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs
@@ -1,84 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using AutoMapper;
-using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
-using Umbraco.Web.Models.ContentEditing;
-
-namespace Umbraco.Web.Models.Mapping
-{
- internal class PreValueDisplayResolver : ValueResolver>
- {
- private readonly IDataTypeService _dataTypeService;
-
- public PreValueDisplayResolver(IDataTypeService dataTypeService)
- {
- _dataTypeService = dataTypeService;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using AutoMapper;
+using Umbraco.Core;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
+using Umbraco.Web.Models.ContentEditing;
+
+namespace Umbraco.Web.Models.Mapping
+{
+ internal class PreValueDisplayResolver : ValueResolver>
+ {
+ private readonly IDataTypeService _dataTypeService;
+
+ public PreValueDisplayResolver(IDataTypeService dataTypeService)
+ {
+ _dataTypeService = dataTypeService;
}
- ///
- /// Maps pre-values in the dictionary to the values for the fields.
- ///
- /// The fields.
- /// The pre-values.
- /// The editor alias.
- internal static void MapPreValueValuesToPreValueFields(PreValueFieldDisplay[] fields, IDictionary preValues, string editorAlias)
- {
- if (fields == null) throw new ArgumentNullException(nameof(fields));
- if (preValues == null) throw new ArgumentNullException(nameof(preValues));
-
- // Now we need to wire up the pre-values values with the actual fields defined
- foreach (var field in fields)
- {
- // If the dictionary would be constructed with StringComparer.InvariantCultureIgnoreCase, we could just use TryGetValue
- var preValue = preValues.SingleOrDefault(x => x.Key.InvariantEquals(field.Key));
- if (preValue.Key == null)
- {
- LogHelper.Warn("Could not find persisted pre-value for field {0} on property editor {1}", () => field.Key, () => editorAlias);
- continue;
- }
-
- field.Value = preValue.Value;
- }
- }
-
- internal IEnumerable Convert(IDataTypeDefinition source)
- {
- PropertyEditor propEd = null;
- if (source.PropertyEditorAlias.IsNullOrWhiteSpace() == false)
- {
- propEd = PropertyEditorResolver.Current.GetByAlias(source.PropertyEditorAlias);
- if (propEd == null)
- {
- throw new InvalidOperationException("Could not find property editor with alias " + source.PropertyEditorAlias);
- }
- }
-
- // Set up the defaults
- var dataTypeService = _dataTypeService;
- var preVals = dataTypeService.GetPreValuesCollectionByDataTypeId(source.Id);
- IDictionary dictionaryVals = preVals.FormatAsDictionary().ToDictionary(x => x.Key, x => (object)x.Value);
- var result = Enumerable.Empty().ToArray();
-
- // If we have a prop editor, then format the pre-values based on it and create it's fields
- if (propEd != null)
- {
- result = propEd.PreValueEditor.Fields.Select(Mapper.Map).ToArray();
- dictionaryVals = propEd.PreValueEditor.ConvertDbToEditor(propEd.DefaultPreValues, preVals);
- }
-
- MapPreValueValuesToPreValueFields(result, dictionaryVals, source.PropertyEditorAlias);
-
- return result;
- }
-
- protected override IEnumerable ResolveCore(IDataTypeDefinition source)
- {
- return Convert(source);
- }
- }
-}
+ ///
+ /// Maps pre-values in the dictionary to the values for the fields.
+ ///
+ /// The fields.
+ /// The pre-values.
+ /// The editor alias.
+ internal static void MapPreValueValuesToPreValueFields(IEnumerable fields, IDictionary preValues, string editorAlias)
+ {
+ if (fields == null) throw new ArgumentNullException(nameof(fields));
+ if (preValues == null) throw new ArgumentNullException(nameof(preValues));
+
+ // Now we need to wire up the pre-values values with the actual fields defined
+ foreach (var field in fields)
+ {
+ // If the dictionary would be constructed with StringComparer.InvariantCultureIgnoreCase, we could just use TryGetValue
+ var preValue = preValues.SingleOrDefault(x => x.Key.InvariantEquals(field.Key));
+ if (preValue.Key == null)
+ {
+ LogHelper.Warn("Could not find persisted pre-value for field {0} on property editor {1}", () => field.Key, () => editorAlias);
+ continue;
+ }
+
+ field.Value = preValue.Value;
+ }
+ }
+
+ internal IEnumerable Convert(IDataTypeDefinition source)
+ {
+ PropertyEditor propEd = null;
+ if (source.PropertyEditorAlias.IsNullOrWhiteSpace() == false)
+ {
+ propEd = PropertyEditorResolver.Current.GetByAlias(source.PropertyEditorAlias);
+ if (propEd == null)
+ {
+ throw new InvalidOperationException("Could not find property editor with alias " + source.PropertyEditorAlias);
+ }
+ }
+
+ // Set up the defaults
+ var dataTypeService = _dataTypeService;
+ var preVals = dataTypeService.GetPreValuesCollectionByDataTypeId(source.Id);
+ IDictionary dictionaryVals = preVals.FormatAsDictionary().ToDictionary(x => x.Key, x => (object)x.Value);
+ var result = Enumerable.Empty();
+
+ // If we have a prop editor, then format the pre-values based on it and create it's fields
+ if (propEd != null)
+ {
+ result = propEd.PreValueEditor.Fields.Select(Mapper.Map).AsEnumerable();
+ if (source.IsBuildInDataType)
+ {
+ result = RemovePreValuesNotSupportedOnBuildInTypes(result);
+ }
+ dictionaryVals = propEd.PreValueEditor.ConvertDbToEditor(propEd.DefaultPreValues, preVals);
+ }
+
+ MapPreValueValuesToPreValueFields(result, dictionaryVals, source.PropertyEditorAlias);
+
+ return result;
+ }
+
+ private IEnumerable RemovePreValuesNotSupportedOnBuildInTypes(IEnumerable preValues)
+ {
+ return preValues.Where(preValue => string.Equals(preValue.Key, Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes) == false);
+ }
+
+ protected override IEnumerable ResolveCore(IDataTypeDefinition source)
+ {
+ return Convert(source);
+ }
+ }
+}
diff --git a/src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs
index 0039385e5f..46f251ebf4 100644
--- a/src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ContentPicker2PropertyEditor.cs
@@ -15,11 +15,11 @@ namespace Umbraco.Web.PropertyEditors
{
InternalPreValues = new Dictionary
{
- {"startNodeId", "-1"},
+ {"startNodeId", "-1"},
{"showOpenButton", "0"},
{"showEditButton", "0"},
{"showPathOnHover", "0"},
- {"ignoreUserStartNodes", "0"},
+ {Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "0"},
{"idType", "udi"}
};
}
@@ -40,9 +40,9 @@ namespace Umbraco.Web.PropertyEditors
{
public ContentPickerPreValueEditor()
{
- //create the fields
+ //create the fields
Fields.Add(new PreValueField()
- {
+ {
Key = "showOpenButton",
View = "boolean",
Name = "Show open button (this feature is in preview!)",
@@ -50,7 +50,7 @@ namespace Umbraco.Web.PropertyEditors
});
Fields.Add(new PreValueField()
{
- Key = "ignoreUserStartNodes",
+ Key = Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes,
View = "boolean",
Name = "Ignore user start nodes",
Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
index 4a8803a099..94aed3e852 100644
--- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs
@@ -18,7 +18,7 @@ namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Core.Constants.PropertyEditors.GridAlias, "Grid layout", "grid", HideLabel = true, IsParameterEditor = false, ValueType = PropertyEditorValueTypes.Json, Group="rich content", Icon="icon-layout")]
public class GridPropertyEditor : PropertyEditor, IApplicationEventHandler
- {
+ {
private static void DocumentWriting(object sender, Examine.LuceneEngine.DocumentWritingEventArgs e)
{
@@ -49,7 +49,7 @@ namespace Umbraco.Web.PropertyEditors
foreach (var areaVal in areaVals)
{
- //TODO: If it's not a string, then it's a json formatted value -
+ //TODO: If it's not a string, then it's a json formatted value -
// we cannot really index this in a smart way since it could be 'anything'
if (areaVal.Type == JTokenType.String)
{
@@ -87,12 +87,12 @@ namespace Umbraco.Web.PropertyEditors
catch (InvalidCastException)
{
//swallow...on purpose, there's a chance that this isn't the json format we are looking for
- // and we don't want that to affect the website.
+ // and we don't want that to affect the website.
}
catch (JsonException)
{
- //swallow...on purpose, there's a chance that this isn't json and we don't want that to affect
- // the website.
+ //swallow...on purpose, there's a chance that this isn't json and we don't want that to affect
+ // the website.
}
catch (ArgumentException)
{
@@ -137,7 +137,7 @@ namespace Umbraco.Web.PropertyEditors
[PreValueField("rte", "Rich text editor", "views/propertyeditors/rte/rte.prevalues.html", Description = "Rich text editor configuration")]
public string Rte { get; set; }
- [PreValueField("ignoreUserStartNodes", "Ignore user start nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")]
+ [PreValueField(Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore user start nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")]
public bool IgnoreUserStartNodes { get; set; }
}
@@ -152,7 +152,7 @@ namespace Umbraco.Web.PropertyEditors
{
///
/// We're going to bind to the Examine events so we can ensure grid data is index nicely.
- ///
+ ///
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
foreach (var i in ExamineManager.Instance.IndexProviderCollection.OfType())
@@ -175,7 +175,7 @@ namespace Umbraco.Web.PropertyEditors
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//wrap
- _applicationStartup.OnApplicationStarted(umbracoApplication, applicationContext);
+ _applicationStartup.OnApplicationStarted(umbracoApplication, applicationContext);
}
#endregion
}
diff --git a/src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs
index 6aa7ab4a54..e62ac98abd 100644
--- a/src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MediaPicker2PropertyEditor.cs
@@ -19,7 +19,7 @@ namespace Umbraco.Web.PropertyEditors
}
internal IDictionary InternalPreValues;
-
+
public override IDictionary DefaultPreValues
{
get { return InternalPreValues; }
@@ -58,7 +58,7 @@ namespace Umbraco.Web.PropertyEditors
});
Fields.Add(new PreValueField()
{
- Key = "ignoreUserStartNodes",
+ Key = Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes,
View = "boolean",
Name = "Ignore user start nodes",
Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs
index f57a9951b6..b79cd96313 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiNodeTreePicker2PropertyEditor.cs
@@ -16,11 +16,11 @@ namespace Umbraco.Web.PropertyEditors
{"showOpenButton", "0"},
{"showEditButton", "0"},
{"showPathOnHover", "0"},
- {"ignoreUserStartNodes", "0"},
+ {Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "0"},
{"idType", "udi"}
};
}
-
+
protected override PreValueEditor CreatePreValueEditor()
{
return new MultiNodePickerPreValueEditor();
@@ -40,7 +40,7 @@ namespace Umbraco.Web.PropertyEditors
//create the fields
Fields.Add(new PreValueField()
{
- Key = "ignoreUserStartNodes",
+ Key = Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes,
View = "boolean",
Name = "Ignore user start nodes",
Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
@@ -81,7 +81,7 @@ namespace Umbraco.Web.PropertyEditors
Name = "Show open button (this feature is in preview!)",
Description = "Opens the node in a dialog"
});
- }
+ }
///
/// This ensures the multiPicker pre-val is set based on the maxNumber of nodes set
@@ -117,9 +117,9 @@ namespace Umbraco.Web.PropertyEditors
{
result["multiPicker"] = "1";
}
- }
+ }
}
-
+
return result;
}
diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
index f3ae317efa..ea3a1572b1 100644
--- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs
@@ -34,7 +34,7 @@ namespace Umbraco.Web.PropertyEditors
{
Fields.Add(new PreValueField()
{
- Key = "ignoreUserStartNodes",
+ Key = Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes,
View = "boolean",
Name = "Ignore user start nodes",
Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs
index a96c0724ff..289e6588a9 100644
--- a/src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RelatedLinks2PropertyEditor.cs
@@ -14,7 +14,7 @@ namespace Umbraco.Web.PropertyEditors
{
InternalPreValues = new Dictionary
{
- {"ignoreUserStartNodes", "0"},
+ {Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "0"},
{"idType", "udi"}
};
}
@@ -33,11 +33,11 @@ namespace Umbraco.Web.PropertyEditors
internal class RelatedLinksPreValueEditor : PreValueEditor
{
- [PreValueField("ignoreUserStartNodes", "Ignore user start nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")]
+ [PreValueField(Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore user start nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")]
public bool IgnoreUserStartNodes { get; set; }
[PreValueField("max", "Maximum number of links", "number", Description = "Enter the maximum amount of links to be added, enter 0 for unlimited")]
- public int Maximum { get; set; }
+ public int Maximum { get; set; }
}
}
}
diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs
index 69445bc304..9fd2bf6de4 100644
--- a/src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/RichTextPreValueEditor.cs
@@ -1,73 +1,74 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Umbraco.Core.PropertyEditors;
-
-namespace Umbraco.Web.PropertyEditors
-{
- //need to figure out how to use this...
- internal class RichTextPreValueEditor : PreValueEditor
- {
- public RichTextPreValueEditor()
- {
- //SD: You can add pre-val fields here like you are doing, or you can add fields using attributes (http://issues.umbraco.org/issue/U4-2692),
- // see below for examples.
-
- //use a custom editor too
- Fields.Add(new PreValueField()
- {
- View = "views/propertyeditors/rte/rte.prevalues.html",
- HideLabel = true,
- Key = "editor"
- });
-
- Fields.Add(new PreValueField()
- {
- Key = "ignoreUserStartNodes",
- View = "boolean",
- Name = "Ignore user start nodes",
- Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
- });
-
- Fields.Add(new PreValueField()
- {
- Name = "Hide Label",
- View = "boolean",
- Key = "hideLabel"
- });
- }
-
- //SD: You can declare a field like this if you want to instead of in the ctor, there's some options here:
- //#1 - the property name becomes the Key:
- //
- // [PreValueField("", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
- // public string Editor { get; set; }
-
- //#2 - You can specify a custom Key:
- //
- // [PreValueField("editor", "", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
- // public string Editor { get; set; }
-
- //#3 - If you require custom server side validation for your field then you have to specify a custom PreValueField type to use,
- // this is why in this case I find it easier to use the ctor logic but thats just an opinion
- // - Any value specified for this property attribute will override the values set in on the class instance of the field, this
- // allows you to re-use class instances of fields if you want.
- //
- // [PreValueField(typeof(EditorPreValueField))]
- // public string Editor { get; set; }
-
- // [PreValueField("", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
- // public class EditorPreValueField : PreValueField
- // {
- // public EditorPreValueField()
- // {
- // //add any required server validators for this field
- // Validators.Add(new RegexValidator("^\\d*$"));
- // //You could also set the field properties directly here if you wanted instead of the attribute
- // }
- // }
-
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Umbraco.Core;
+using Umbraco.Core.PropertyEditors;
+
+namespace Umbraco.Web.PropertyEditors
+{
+ //need to figure out how to use this...
+ internal class RichTextPreValueEditor : PreValueEditor
+ {
+ public RichTextPreValueEditor()
+ {
+ //SD: You can add pre-val fields here like you are doing, or you can add fields using attributes (http://issues.umbraco.org/issue/U4-2692),
+ // see below for examples.
+
+ //use a custom editor too
+ Fields.Add(new PreValueField()
+ {
+ View = "views/propertyeditors/rte/rte.prevalues.html",
+ HideLabel = true,
+ Key = "editor"
+ });
+
+ Fields.Add(new PreValueField()
+ {
+ Key = Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes,
+ View = "boolean",
+ Name = "Ignore user start nodes",
+ Description = "Selecting this option allows a user to choose nodes that they normally don't have access to."
+ });
+
+ Fields.Add(new PreValueField()
+ {
+ Name = "Hide Label",
+ View = "boolean",
+ Key = "hideLabel"
+ });
+ }
+
+ //SD: You can declare a field like this if you want to instead of in the ctor, there's some options here:
+ //#1 - the property name becomes the Key:
+ //
+ // [PreValueField("", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
+ // public string Editor { get; set; }
+
+ //#2 - You can specify a custom Key:
+ //
+ // [PreValueField("editor", "", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
+ // public string Editor { get; set; }
+
+ //#3 - If you require custom server side validation for your field then you have to specify a custom PreValueField type to use,
+ // this is why in this case I find it easier to use the ctor logic but thats just an opinion
+ // - Any value specified for this property attribute will override the values set in on the class instance of the field, this
+ // allows you to re-use class instances of fields if you want.
+ //
+ // [PreValueField(typeof(EditorPreValueField))]
+ // public string Editor { get; set; }
+
+ // [PreValueField("", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)]
+ // public class EditorPreValueField : PreValueField
+ // {
+ // public EditorPreValueField()
+ // {
+ // //add any required server validators for this field
+ // Validators.Add(new RegexValidator("^\\d*$"));
+ // //You could also set the field properties directly here if you wanted instead of the attribute
+ // }
+ // }
+
+ }
+}