Merge remote-tracking branch 'origin/6.2.0' into 6.2.0-pubcontent

Conflicts:
	src/Umbraco.Tests/TestHelpers/BaseWebTest.cs
This commit is contained in:
Stephan
2013-10-10 15:52:09 +02:00
49 changed files with 1175 additions and 261 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
@@ -50,6 +51,7 @@ namespace Umbraco.Core.Models
_contentTypeId = int.Parse(contentType.Id.ToString(CultureInfo.InvariantCulture));
_properties = properties;
_properties.EnsurePropertyTypes(PropertyTypes);
_additionalData = new Dictionary<string, object>();
}
/// <summary>
@@ -73,6 +75,7 @@ namespace Umbraco.Core.Models
_contentTypeId = int.Parse(contentType.Id.ToString(CultureInfo.InvariantCulture));
_properties = properties;
_properties.EnsurePropertyTypes(PropertyTypes);
_additionalData = new Dictionary<string, object>();
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Name);
@@ -253,6 +256,16 @@ namespace Umbraco.Core.Models
}
}
private readonly IDictionary<string, object> _additionalData;
/// <summary>
/// Some entities may expose additional data that other's might not, this custom data will be available in this collection
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
IDictionary<string, object> IUmbracoEntity.AdditionalData
{
get { return _additionalData; }
}
/// <summary>
/// List of PropertyGroups available on this Content object
/// </summary>

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
@@ -42,6 +43,7 @@ namespace Umbraco.Core.Models
_allowedContentTypes = new List<ContentTypeSort>();
_propertyGroups = new PropertyGroupCollection();
_propertyTypes = new PropertyTypeCollection();
_additionalData = new Dictionary<string, object>();
}
protected ContentTypeBase(IContentTypeBase parent)
@@ -52,6 +54,7 @@ namespace Umbraco.Core.Models
_allowedContentTypes = new List<ContentTypeSort>();
_propertyGroups = new PropertyGroupCollection();
_propertyTypes = new PropertyTypeCollection();
_additionalData = new Dictionary<string, object>();
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<ContentTypeBase, string>(x => x.Name);
@@ -314,6 +317,16 @@ namespace Umbraco.Core.Models
}
}
private readonly IDictionary<string, object> _additionalData;
/// <summary>
/// Some entities may expose additional data that other's might not, this custom data will be available in this collection
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
IDictionary<string, object> IUmbracoEntity.AdditionalData
{
get { return _additionalData; }
}
/// <summary>
/// Gets or sets a list of integer Ids for allowed ContentTypes
/// </summary>

View File

@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
@@ -31,6 +33,7 @@ namespace Umbraco.Core.Models
{
_parentId = parentId;
_controlId = controlId;
_additionalData = new Dictionary<string, object>();
}
private static readonly PropertyInfo NameSelector = ExpressionHelper.GetPropertyInfo<DataTypeDefinition, string>(x => x.Name);
@@ -160,9 +163,11 @@ namespace Umbraco.Core.Models
_trashed = value;
return _trashed;
}, _trashed, TrashedSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
_additionalData["Trashed"] = value;
}
}
/// <summary>
/// Id of the DataType control
/// </summary>
@@ -177,6 +182,8 @@ namespace Umbraco.Core.Models
_controlId = value;
return _controlId;
}, _controlId, ControlIdSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
_additionalData["ControlId"] = value;
}
}
@@ -194,9 +201,22 @@ namespace Umbraco.Core.Models
_databaseType = value;
return _databaseType;
}, _databaseType, 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<string, object> _additionalData;
/// <summary>
/// Some entities may expose additional data that other's might not, this custom data will be available in this collection
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
IDictionary<string, object> IUmbracoEntity.AdditionalData
{
get { return _additionalData; }
}
internal override void AddingEntity()
{
base.AddingEntity();

View File

@@ -1,4 +1,6 @@
namespace Umbraco.Core.Models.EntityBase
using System.Collections.Generic;
namespace Umbraco.Core.Models.EntityBase
{
public interface IUmbracoEntity : IAggregateRoot
{
@@ -41,5 +43,10 @@
/// Not all entities support being trashed, they'll always return false.
/// </remarks>
bool Trashed { get; }
/// <summary>
/// Some entities may expose additional data that other's might not, this custom data will be available in this collection
/// </summary>
IDictionary<string, object> AdditionalData { get; }
}
}

View File

@@ -427,7 +427,7 @@ namespace Umbraco.Core.Models
public override void ChangeTrashedState(bool isTrashed, int parentId = -20)
{
throw new NotImplementedException("Members can't be trashed as no Recycle Bin exists, so use of this method is invalid");
throw new NotSupportedException("Members can't be trashed as no Recycle Bin exists, so use of this method is invalid");
}
/* Internal experiment - only used for mapping queries.

View File

@@ -2,6 +2,8 @@
namespace Umbraco.Core.Models.Membership
{
//TODO: THere's still a bunch of properties that don't exist in this use that need to be mapped somehow.
internal class UmbracoMembershipMember : MembershipUser
{
private readonly IMember _member;
@@ -21,5 +23,44 @@ namespace Umbraco.Core.Models.Membership
get { return _member.Email; }
set { _member.Email = value; }
}
public override object ProviderUserKey
{
get { return _member.Key; }
}
public override System.DateTime CreationDate
{
get { return _member.CreateDate; }
}
public override string UserName
{
get { return _member.Username; }
}
public override string Comment
{
get { return _member.Comments; }
set { _member.Comments = value; }
}
public override bool IsApproved
{
get { return _member.IsApproved; }
set { _member.IsApproved = value; }
}
public override bool IsLockedOut
{
get { return _member.IsLockedOut; }
}
public override System.DateTime LastLoginDate
{
get { return _member.LastLoginDate; }
set { _member.LastLoginDate = value; }
}
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Represents a paged result for a model collection
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "pagedCollection", Namespace = "")]
public class PagedResult<T>
{
public PagedResult(long totalItems, long pageNumber, long pageSize)
{
TotalItems = totalItems;
PageNumber = pageNumber;
PageSize = pageSize;
if (pageSize > 0)
{
TotalPages = (long) Math.Ceiling(totalItems/(Decimal) pageSize);
}
else
{
TotalPages = 1;
}
}
[DataMember(Name = "pageNumber")]
public long PageNumber { get; private set; }
[DataMember(Name = "pageSize")]
public long PageSize { get; private set; }
[DataMember(Name = "totalPages")]
public long TotalPages { get; private set; }
[DataMember(Name = "totalItems")]
public long TotalItems { get; private set; }
[DataMember(Name = "items")]
public IEnumerable<T> Items { get; set; }
/// <summary>
/// Calculates the skip size based on the paged parameters specified
/// </summary>
/// <remarks>
/// Returns 0 if the page number or page size is zero
/// </remarks>
internal int SkipSize
{
get
{
if (PageNumber > 0 && PageSize > 0)
{
return Convert.ToInt32((PageNumber - 1)*PageSize);
}
return 0;
}
}
}
}

View File

@@ -44,10 +44,12 @@ namespace Umbraco.Core.Models
public UmbracoEntity()
{
AdditionalData = new Dictionary<string, object>();
}
public UmbracoEntity(bool trashed)
{
AdditionalData = new Dictionary<string, object>();
Trashed = trashed;
}
@@ -142,6 +144,9 @@ namespace Umbraco.Core.Models
}
}
public IDictionary<string, object> AdditionalData { get; private set; }
public bool HasChildren
{
get { return _hasChildren; }
@@ -152,6 +157,9 @@ namespace Umbraco.Core.Models
_hasChildren = value;
return _hasChildren;
}, _hasChildren, HasChildrenSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["HasChildren"] = value;
}
}
@@ -164,7 +172,10 @@ namespace Umbraco.Core.Models
{
_isPublished = value;
return _isPublished;
}, _isPublished, IsPublishedSelector);
}, _isPublished, IsPublishedSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["IsPublished"] = value;
}
}
@@ -178,6 +189,9 @@ namespace Umbraco.Core.Models
_isDraft = value;
return _isDraft;
}, _isDraft, IsDraftSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["IsDraft"] = value;
}
}
@@ -191,6 +205,9 @@ namespace Umbraco.Core.Models
_hasPendingChanges = value;
return _hasPendingChanges;
}, _hasPendingChanges, HasPendingChangesSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["HasPendingChanges"] = value;
}
}
@@ -204,6 +221,9 @@ namespace Umbraco.Core.Models
_contentTypeAlias = value;
return _contentTypeAlias;
}, _contentTypeAlias, ContentTypeAliasSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["ContentTypeAlias"] = value;
}
}
@@ -217,6 +237,9 @@ namespace Umbraco.Core.Models
_contentTypeIcon = value;
return _contentTypeIcon;
}, _contentTypeIcon, ContentTypeIconSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["ContentTypeIcon"] = value;
}
}
@@ -230,6 +253,9 @@ namespace Umbraco.Core.Models
_contentTypeThumbnail = value;
return _contentTypeThumbnail;
}, _contentTypeThumbnail, ContentTypeThumbnailSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["ContentTypeThumbnail"] = value;
}
}
@@ -242,10 +268,16 @@ namespace Umbraco.Core.Models
{
_nodeObjectTypeId = value;
return _nodeObjectTypeId;
}, _nodeObjectTypeId, NodeObjectTypeIdSelector);
}, _nodeObjectTypeId, NodeObjectTypeIdSelector);
//This is a custom property that is not exposed in IUmbracoEntity so add it to the additional data
AdditionalData["NodeObjectTypeId"] = value;
}
}
/// <summary>
/// Some entities may expose additional data that other's might not, this custom data will be available in this collection
/// </summary>
public IList<UmbracoProperty> UmbracoProperties { get; set; }
internal class UmbracoProperty