Fixes U4-2053
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -16,12 +15,22 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
private int _defaultTemplate;
|
||||
private IEnumerable<ITemplate> _allowedTemplates;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor for creating a ContentType with the parent's id.
|
||||
/// </summary>
|
||||
/// <remarks>You usually only want to use this for creating ContentTypes at the root.</remarks>
|
||||
/// <param name="parentId"></param>
|
||||
public ContentType(int parentId) : base(parentId)
|
||||
{
|
||||
_allowedTemplates = new List<ITemplate>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor for creating a ContentType with the parent as an inherited type.
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
public ContentType(IContentType parent) : base(parent)
|
||||
{
|
||||
_allowedTemplates = new List<ITemplate>();
|
||||
|
||||
@@ -20,8 +20,10 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
}
|
||||
|
||||
protected ContentTypeCompositionBase(IContentTypeBase parent) : base(parent)
|
||||
protected ContentTypeCompositionBase(IContentTypeComposition parent)
|
||||
: base(parent)
|
||||
{
|
||||
AddContentType(parent);
|
||||
}
|
||||
|
||||
private static readonly PropertyInfo ContentTypeCompositionSelector =
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
@@ -11,10 +10,20 @@ namespace Umbraco.Core.Models
|
||||
[DataContract(IsReference = true)]
|
||||
public class MediaType : ContentTypeCompositionBase, IMediaType
|
||||
{
|
||||
/// <summary>
|
||||
/// Constuctor for creating a MediaType with the parent's id.
|
||||
/// </summary>
|
||||
/// <remarks>You usually only want to use this for creating MediaTypes at the root.</remarks>
|
||||
/// <param name="parentId"></param>
|
||||
public MediaType(int parentId) : base(parentId)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constuctor for creating a MediaType with the parent as an inherited type.
|
||||
/// </summary>
|
||||
/// <remarks>Use this to ensure inheritance from parent.</remarks>
|
||||
/// <param name="parent"></param>
|
||||
public MediaType(IMediaType parent) : base(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,13 +47,16 @@ namespace umbraco
|
||||
{
|
||||
//NOTE: TypeID is the parent id!
|
||||
//NOTE: ParentID is aparently a flag to determine if we are to create a template! Hack much ?! :P
|
||||
var contentType = new ContentType(TypeID != 0 ? TypeID : -1)
|
||||
{
|
||||
CreatorId = _userID,
|
||||
Alias = Alias.Replace("'", "''"),
|
||||
Icon = UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates ? ".sprTreeFolder" : "folder.gif",
|
||||
Name = Alias.Replace("'", "''")
|
||||
};
|
||||
var parentId = TypeID != 0 ? TypeID : -1;
|
||||
var contentType = parentId == -1
|
||||
? new ContentType(-1)
|
||||
: new ContentType(ApplicationContext.Current.Services.ContentTypeService.GetContentType(parentId));
|
||||
contentType.CreatorId = _userID;
|
||||
contentType.Alias = Alias.Replace("'", "''");
|
||||
contentType.Name = Alias.Replace("'", "''");
|
||||
contentType.Icon = UmbracoSettings.IconPickerBehaviour == IconPickerBehaviour.HideFileDuplicates
|
||||
? ".sprTreeFolder"
|
||||
: "folder.gif";
|
||||
|
||||
// Create template?
|
||||
if (ParentID == 1)
|
||||
|
||||
Reference in New Issue
Block a user