From 3134668cece24bf613652cce7952da8b54752de1 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 30 Apr 2014 12:00:08 +0200 Subject: [PATCH 1/5] Bump version number --- build/Build.bat | 2 +- build/NuSpecs/build/UmbracoCms.targets | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Build.bat b/build/Build.bat index 9ad1fd214d..cf9c5ace51 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -1,6 +1,6 @@ @ECHO OFF SET release=6.2.0 -SET comment=RC +SET comment= SET version=%release% IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%) diff --git a/build/NuSpecs/build/UmbracoCms.targets b/build/NuSpecs/build/UmbracoCms.targets index 04a60d1d44..58b66bfb0f 100644 --- a/build/NuSpecs/build/UmbracoCms.targets +++ b/build/NuSpecs/build/UmbracoCms.targets @@ -1,7 +1,7 @@  - 6.2.0-RC + 6.2.0 diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 9823d31f6b..f1b8d39765 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "RC"; } } + public static string CurrentComment { get { return ""; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx From 0501b181ce4aa9d43a0b285842012ea9297bdf2d Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 30 Apr 2014 15:45:48 +0200 Subject: [PATCH 2/5] Refactor template aliases to strict aliases --- src/Umbraco.Core/Models/Template.cs | 5 +++-- src/Umbraco.Core/Strings/CleanStringType.cs | 10 ++++++++-- src/Umbraco.Core/Strings/DefaultShortStringHelper.cs | 6 ++++++ src/umbraco.cms/businesslogic/template/Template.cs | 9 +++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/Models/Template.cs b/src/Umbraco.Core/Models/Template.cs index 2a2f59d132..25347fd861 100644 --- a/src/Umbraco.Core/Models/Template.cs +++ b/src/Umbraco.Core/Models/Template.cs @@ -5,6 +5,7 @@ using System.Runtime.Serialization; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Models.EntityBase; +using Umbraco.Core.Strings; namespace Umbraco.Core.Models { @@ -42,8 +43,8 @@ namespace Umbraco.Core.Models { base.Path = path; ParentId = -1; - _name = name.Replace("/", ".").Replace("\\", ""); - _alias = alias.ToSafeAlias(); + _name = name; //.Replace("/", ".").Replace("\\", ""); // why? that's just the name! + _alias = alias.ToCleanString(CleanStringType.UnderscoreAlias); } [DataMember] diff --git a/src/Umbraco.Core/Strings/CleanStringType.cs b/src/Umbraco.Core/Strings/CleanStringType.cs index ea9603ec6f..0e0a7c9908 100644 --- a/src/Umbraco.Core/Strings/CleanStringType.cs +++ b/src/Umbraco.Core/Strings/CleanStringType.cs @@ -92,7 +92,7 @@ namespace Umbraco.Core.Strings /// /// Flag mask for role. /// - RoleMask = UrlSegment | Alias | FileName | ConvertCase, + RoleMask = UrlSegment | Alias | UnderscoreAlias | FileName | ConvertCase, /// /// Url role. @@ -112,6 +112,12 @@ namespace Umbraco.Core.Strings /// /// ConvertCase role. /// - ConvertCase = 0x080000 + ConvertCase = 0x080000, + + /// + /// UnderscoreAlias role. + /// + /// This is Alias + leading underscore. + UnderscoreAlias = 0x100000 } } diff --git a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs index 508e356f71..879f4f0115 100644 --- a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs +++ b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs @@ -193,6 +193,12 @@ namespace Umbraco.Core.Strings : (char.IsLetterOrDigit(c) || c == '_'), // letter, digit or underscore StringType = CleanStringType.Ascii | CleanStringType.UmbracoCase, BreakTermsOnUpper = false + }).WithConfig(CleanStringType.UnderscoreAlias, new Config + { + PreFilter = ApplyUrlReplaceCharacters, + IsTerm = (c, leading) => char.IsLetterOrDigit(c) || c == '_', // letter, digit or underscore + StringType = CleanStringType.Ascii | CleanStringType.UmbracoCase, + BreakTermsOnUpper = false }).WithConfig(CleanStringType.ConvertCase, new Config { PreFilter = null, diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index 38a05adbf2..08f6e5d5e3 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -6,6 +6,7 @@ using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.IO; using Umbraco.Core.Logging; +using Umbraco.Core.Strings; using umbraco.DataLayer; using System.Text.RegularExpressions; using System.IO; @@ -204,7 +205,7 @@ namespace umbraco.cms.businesslogic.template { FlushCache(); _oldAlias = _alias; - _alias = value; + _alias = value.ToCleanString(CleanStringType.UnderscoreAlias); SqlHelper.ExecuteNonQuery("Update cmsTemplate set alias = @alias where NodeId = " + this.Id, SqlHelper.CreateParameter("@alias", _alias)); _templateAliasesInitialized = false; @@ -402,13 +403,13 @@ namespace umbraco.cms.businesslogic.template var node = MakeNew(-1, ObjectType, u.Id, 1, name, Guid.NewGuid()); //ensure unique alias - name = helpers.Casing.SafeAlias(name); + name = name.ToCleanString(CleanStringType.UnderscoreAlias); if (GetByAlias(name) != null) name = EnsureUniqueAlias(name, 1); - name = name.Replace("/", ".").Replace("\\", ""); + //name = name.Replace("/", ".").Replace("\\", ""); //why? ToSafeAlias() already removes those chars if (name.Length > 100) - name = name.Substring(0, 95) + "..."; + name = name.Substring(0, 95); // + "..."; // no, these are invalid alias chars SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)", From 7d8da56dcb75190d6b5330b933a9002754252672 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 30 Apr 2014 16:32:42 +0200 Subject: [PATCH 3/5] Revert "Reintroduce IPublishedContentProperty" This reverts commit d33cc29f98415371d5078b2015816939da0af4b4. --- src/Umbraco.Core/Dynamics/PropertyResult.cs | 9 ------- src/Umbraco.Core/Models/IPublishedProperty.cs | 17 ++----------- .../PublishedContent/PublishedPropertyBase.cs | 9 ------- .../PublishedContentTestElements.cs | 9 ------- .../PublishedContentPropertyExtension.cs | 25 +------------------ 5 files changed, 3 insertions(+), 66 deletions(-) diff --git a/src/Umbraco.Core/Dynamics/PropertyResult.cs b/src/Umbraco.Core/Dynamics/PropertyResult.cs index 4b6f83c1d2..59d3a0f247 100644 --- a/src/Umbraco.Core/Dynamics/PropertyResult.cs +++ b/src/Umbraco.Core/Dynamics/PropertyResult.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; using Umbraco.Core.Models; using System.Web; @@ -44,13 +43,5 @@ namespace Umbraco.Core.Dynamics var value = Value; return value == null ? string.Empty : value.ToString(); } - - // see notes in IPublishedProperty - [Obsolete("Use PropertyTypeAlias.", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Alias { get { return PropertyTypeAlias; } } - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public Guid Version { get { return Guid.Empty; } } } } diff --git a/src/Umbraco.Core/Models/IPublishedProperty.cs b/src/Umbraco.Core/Models/IPublishedProperty.cs index 6a93bc85ec..f6afa1f05e 100644 --- a/src/Umbraco.Core/Models/IPublishedProperty.cs +++ b/src/Umbraco.Core/Models/IPublishedProperty.cs @@ -1,12 +1,9 @@ -using System; -using System.ComponentModel; - namespace Umbraco.Core.Models { /// /// Represents a property of an IPublishedContent. /// - public interface IPublishedProperty : IPublishedContentProperty + public interface IPublishedProperty { /// /// Gets the alias of the property. @@ -48,7 +45,7 @@ namespace Umbraco.Core.Models /// It can be null, or any type of CLR object. /// It has been fully prepared and processed by the appropriate converter. /// - new object Value { get; } + object Value { get; } /// /// Gets the XPath value of the property. @@ -60,14 +57,4 @@ namespace Umbraco.Core.Models /// object XPathValue { get; } } - - // had to re-introduce that one for backward-compatibility reasons - [Obsolete("Use IPublishedProperty.", false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public interface IPublishedContentProperty - { - string Alias { get; } - object Value { get; } - Guid Version { get; } - } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs index 06c3dfbfa9..b841b85212 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; namespace Umbraco.Core.Models.PublishedContent { @@ -28,13 +27,5 @@ namespace Umbraco.Core.Models.PublishedContent public abstract object DataValue { get; } public abstract object Value { get; } public abstract object XPathValue { get; } - - // see notes in IPublishedProperty - [Obsolete("Use PropertyTypeAlias.", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Alias { get { return PropertyTypeAlias; } } - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public Guid Version { get { return Guid.Empty; } } } } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs index 04414f9e99..be357c4c03 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using System.Reflection; using System.Text; @@ -232,14 +231,6 @@ namespace Umbraco.Tests.PublishedContent public object Value { get; set; } public bool HasValue { get; set; } public object XPathValue { get; set; } - - // see notes in IPublishedProperty - [Obsolete("Use PropertyTypeAlias.", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public string Alias { get { return PropertyTypeAlias; } } - [Obsolete] - [EditorBrowsable(EditorBrowsableState.Never)] - public Guid Version { get { return Guid.Empty; } } } [PublishedContentModel("ContentType2")] diff --git a/src/Umbraco.Web/PublishedContentPropertyExtension.cs b/src/Umbraco.Web/PublishedContentPropertyExtension.cs index 54a77ddd0c..ee4dd83e57 100644 --- a/src/Umbraco.Web/PublishedContentPropertyExtension.cs +++ b/src/Umbraco.Web/PublishedContentPropertyExtension.cs @@ -1,5 +1,4 @@ -using System; -using Umbraco.Core; +using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Web.PropertyEditors; @@ -58,27 +57,5 @@ namespace Umbraco.Web } #endregion - - #region IPublishedContentProperty.GetValue - - // see notes in IPublishedProperty - - public static T GetValue(this IPublishedContentProperty property) - { - var property2 = property as IPublishedProperty; - if (property2 == null) // should never happen - throw new ArgumentException("Not an IPublishedProperty.", "property"); - return property2.GetValue(false, default(T)); - } - - public static T GetValue(this IPublishedContentProperty property, T defaultValue) - { - var property2 = property as IPublishedProperty; - if (property2 == null) // should never happen - throw new ArgumentException("Not an IPublishedProperty.", "property"); - return property2.GetValue(true, defaultValue); - } - - #endregion } } From cd5581bef6f21c8b63f9b0d0e66d4c2b4c3e95dc Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 30 Apr 2014 16:35:12 +0200 Subject: [PATCH 4/5] Back to IPublishedContentProperty (for 6 only) --- src/Umbraco.Core/Dynamics/PropertyResult.cs | 6 ++--- src/Umbraco.Core/Models/IPublishedContent.cs | 6 ++--- ...operty.cs => IPublishedContentProperty.cs} | 2 +- .../IPublishedContentExtended.cs | 2 +- .../PublishedContentExtended.cs | 10 ++++----- .../PublishedContentWrapped.cs | 6 ++--- .../PublishedContent/PublishedPropertyBase.cs | 2 +- .../PublishedContent/PublishedPropertyType.cs | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 2 +- .../CodeFirst/ContentTypeBase.cs | 4 ++-- .../PublishedContentDataTableTests.cs | 10 ++++----- .../PublishedContentMoreTests.cs | 6 ++--- .../PublishedContentRequestEngineTests.cs | 2 +- .../PublishedContentTestElements.cs | 8 +++---- .../Models/DynamicPublishedContent.cs | 10 ++++----- .../Models/PublishedContentBase.cs | 6 ++--- src/Umbraco.Web/Models/PublishedProperty.cs | 4 ++-- .../PublishedCache/MemberPublishedContent.cs | 8 +++---- .../XmlPublishedCache/PublishedFragment.cs | 8 +++---- .../XmlPublishedCache/PublishedMediaCache.cs | 22 +++++++++---------- .../XmlPublishedCache/XmlPublishedContent.cs | 12 +++++----- src/Umbraco.Web/PublishedContentExtensions.cs | 2 +- .../PublishedContentPropertyExtension.cs | 6 ++--- .../CompatibilityHelper.cs | 6 ++--- 24 files changed, 76 insertions(+), 76 deletions(-) rename src/Umbraco.Core/Models/{IPublishedProperty.cs => IPublishedContentProperty.cs} (98%) diff --git a/src/Umbraco.Core/Dynamics/PropertyResult.cs b/src/Umbraco.Core/Dynamics/PropertyResult.cs index 59d3a0f247..55182593a2 100644 --- a/src/Umbraco.Core/Dynamics/PropertyResult.cs +++ b/src/Umbraco.Core/Dynamics/PropertyResult.cs @@ -4,14 +4,14 @@ using System.Web; namespace Umbraco.Core.Dynamics { - internal class PropertyResult : IPublishedProperty, IHtmlString + internal class PropertyResult : IPublishedContentProperty, IHtmlString { - private readonly IPublishedProperty _source; + private readonly IPublishedContentProperty _source; private readonly string _alias; private readonly object _value; private readonly PropertyResultType _type; - internal PropertyResult(IPublishedProperty source, PropertyResultType type) + internal PropertyResult(IPublishedContentProperty source, PropertyResultType type) { if (source == null) throw new ArgumentNullException("source"); diff --git a/src/Umbraco.Core/Models/IPublishedContent.cs b/src/Umbraco.Core/Models/IPublishedContent.cs index 854ddfd47d..7eb38c0b12 100644 --- a/src/Umbraco.Core/Models/IPublishedContent.cs +++ b/src/Umbraco.Core/Models/IPublishedContent.cs @@ -107,7 +107,7 @@ namespace Umbraco.Core.Models /// The properties collection of an IPublishedContent instance should be read-only ie it is illegal /// to add properties to the collection. /// - ICollection Properties { get; } + ICollection Properties { get; } /// /// Gets a property identified by its alias. @@ -119,7 +119,7 @@ namespace Umbraco.Core.Models /// otherwise return a property -- that may have no value (ie HasValue is false). /// The alias is case-insensitive. /// - IPublishedProperty GetProperty(string alias); + IPublishedContentProperty GetProperty(string alias); /// /// Gets a property identified by its alias. @@ -133,7 +133,7 @@ namespace Umbraco.Core.Models /// return the first property that was found with the alias but had no value (ie HasValue is false). /// The alias is case-insensitive. /// - IPublishedProperty GetProperty(string alias, bool recurse); + IPublishedContentProperty GetProperty(string alias, bool recurse); /// /// Gets the value of a property identified by its alias. diff --git a/src/Umbraco.Core/Models/IPublishedProperty.cs b/src/Umbraco.Core/Models/IPublishedContentProperty.cs similarity index 98% rename from src/Umbraco.Core/Models/IPublishedProperty.cs rename to src/Umbraco.Core/Models/IPublishedContentProperty.cs index f6afa1f05e..96e9f0c22a 100644 --- a/src/Umbraco.Core/Models/IPublishedProperty.cs +++ b/src/Umbraco.Core/Models/IPublishedContentProperty.cs @@ -3,7 +3,7 @@ namespace Umbraco.Core.Models /// /// Represents a property of an IPublishedContent. /// - public interface IPublishedProperty + public interface IPublishedContentProperty { /// /// Gets the alias of the property. diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContentExtended.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContentExtended.cs index 1a05c2e07a..573e566eac 100644 --- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContentExtended.cs +++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContentExtended.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core.Models.PublishedContent /// Adds a property to the extended content. /// /// The property to add. - void AddProperty(IPublishedProperty property); + void AddProperty(IPublishedContentProperty property); /// /// Gets a value indicating whether properties were added to the extended content. diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs index 86ebb83919..00e9af5800 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentExtended.cs @@ -66,10 +66,10 @@ namespace Umbraco.Core.Models.PublishedContent #region IPublishedContentExtended - void IPublishedContentExtended.AddProperty(IPublishedProperty property) + void IPublishedContentExtended.AddProperty(IPublishedContentProperty property) { if (_properties == null) - _properties = new Collection(); + _properties = new Collection(); _properties.Add(property); } @@ -113,9 +113,9 @@ namespace Umbraco.Core.Models.PublishedContent #region Properties - private ICollection _properties; + private ICollection _properties; - public override ICollection Properties + public override ICollection Properties { get { @@ -138,7 +138,7 @@ namespace Umbraco.Core.Models.PublishedContent } } - public override IPublishedProperty GetProperty(string alias) + public override IPublishedContentProperty GetProperty(string alias) { return _properties == null ? Content.GetProperty(alias) diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs index 38e2537b40..0d485d9bc4 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs @@ -183,7 +183,7 @@ namespace Umbraco.Core.Models.PublishedContent #region Properties - public virtual ICollection Properties + public virtual ICollection Properties { get { return Content.Properties; } } @@ -193,12 +193,12 @@ namespace Umbraco.Core.Models.PublishedContent get { return Content[alias]; } } - public virtual IPublishedProperty GetProperty(string alias) + public virtual IPublishedContentProperty GetProperty(string alias) { return Content.GetProperty(alias); } - public virtual IPublishedProperty GetProperty(string alias, bool recurse) + public virtual IPublishedContentProperty GetProperty(string alias, bool recurse) { return Content.GetProperty(alias, recurse); } diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs index b841b85212..3afc80fe4b 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs @@ -6,7 +6,7 @@ namespace Umbraco.Core.Models.PublishedContent /// Provides a base class for IPublishedProperty implementations which converts and caches /// the value source to the actual value to use when rendering content. /// - internal abstract class PublishedPropertyBase : IPublishedProperty + internal abstract class PublishedPropertyBase : IPublishedContentProperty { public readonly PublishedPropertyType PropertyType; diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs index 1f7c6ef0ce..6decafe35e 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs @@ -10,7 +10,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Core.Models.PublishedContent { /// - /// Represents an type. + /// Represents an type. /// /// Instances of the class are immutable, ie /// if the property type changes, then a new class needs to be created. diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 18be6898de..815fe33ac4 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -201,6 +201,7 @@ + @@ -737,7 +738,6 @@ - diff --git a/src/Umbraco.Tests/CodeFirst/ContentTypeBase.cs b/src/Umbraco.Tests/CodeFirst/ContentTypeBase.cs index 2f175ad668..2de26d87f1 100644 --- a/src/Umbraco.Tests/CodeFirst/ContentTypeBase.cs +++ b/src/Umbraco.Tests/CodeFirst/ContentTypeBase.cs @@ -93,7 +93,7 @@ namespace Umbraco.Tests.CodeFirst //Using this attribute to hide Properties from Intellisense (when compiled?) [EditorBrowsable(EditorBrowsableState.Never)] - public ICollection Properties + public ICollection Properties { get { return _content.Properties; } } @@ -107,7 +107,7 @@ namespace Umbraco.Tests.CodeFirst //Using this attribute to hide Properties from Intellisense (when compiled?) [EditorBrowsable(EditorBrowsableState.Never)] - public IPublishedProperty GetProperty(string alias) + public IPublishedContentProperty GetProperty(string alias) { return _content.GetProperty(alias); } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs index 59b75b4e03..e10676864a 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs @@ -145,8 +145,8 @@ namespace Umbraco.Tests.PublishedContent WriterName = "Shannon", Parent = null, Level = 1, - Properties = new Collection( - new List() + Properties = new Collection( + new List() { new PropertyResult("property1", "value" + indexVals, Guid.NewGuid(), PropertyResultType.UserProperty), new PropertyResult("property2", "value" + (indexVals + 1), Guid.NewGuid(), PropertyResultType.UserProperty) @@ -211,7 +211,7 @@ namespace Umbraco.Tests.PublishedContent public bool IsDraft { get; set; } public int GetIndex() { throw new NotImplementedException();} - public ICollection Properties { get; set; } + public ICollection Properties { get; set; } public object this[string propertyAlias] { @@ -220,12 +220,12 @@ namespace Umbraco.Tests.PublishedContent public IEnumerable Children { get; set; } - public IPublishedProperty GetProperty(string alias) + public IPublishedContentProperty GetProperty(string alias) { return Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias)); } - public IPublishedProperty GetProperty(string alias, bool recurse) + public IPublishedContentProperty GetProperty(string alias, bool recurse) { var property = GetProperty(alias); if (recurse == false) return property; diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 6d5c9065d7..d103bee6cc 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -226,7 +226,7 @@ namespace Umbraco.Tests.PublishedContent Url = "/content-1", ParentId = -1, ChildIds = new int[] {}, - Properties = new Collection + Properties = new Collection { new SolidPublishedProperty { @@ -249,7 +249,7 @@ namespace Umbraco.Tests.PublishedContent Url = "/content-2", ParentId = -1, ChildIds = new int[] { }, - Properties = new Collection + Properties = new Collection { new SolidPublishedProperty { @@ -272,7 +272,7 @@ namespace Umbraco.Tests.PublishedContent Url = "/content-2sub", ParentId = -1, ChildIds = new int[] { }, - Properties = new Collection + Properties = new Collection { new SolidPublishedProperty { diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs index 25fa7df5f7..b7c2bce299 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs @@ -96,7 +96,7 @@ namespace Umbraco.Tests.PublishedContent pc.Setup(content => content.Version).Returns(Guid.NewGuid); pc.Setup(content => content.Parent).Returns(() => null); pc.Setup(content => content.Version).Returns(Guid.NewGuid); - pc.Setup(content => content.Properties).Returns(new Collection()); + pc.Setup(content => content.Properties).Returns(new Collection()); return pc; } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs index be357c4c03..d37dd8a15d 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs @@ -185,14 +185,14 @@ namespace Umbraco.Tests.PublishedContent #region Properties - public ICollection Properties { get; set; } + public ICollection Properties { get; set; } - public IPublishedProperty GetProperty(string alias) + public IPublishedContentProperty GetProperty(string alias) { return Properties.FirstOrDefault(p => p.PropertyTypeAlias.InvariantEquals(alias)); } - public IPublishedProperty GetProperty(string alias, bool recurse) + public IPublishedContentProperty GetProperty(string alias, bool recurse) { var property = GetProperty(alias); if (recurse == false) return property; @@ -219,7 +219,7 @@ namespace Umbraco.Tests.PublishedContent #endregion } - class SolidPublishedProperty : IPublishedProperty + class SolidPublishedProperty : IPublishedContentProperty { public SolidPublishedProperty() { diff --git a/src/Umbraco.Web/Models/DynamicPublishedContent.cs b/src/Umbraco.Web/Models/DynamicPublishedContent.cs index eb476f50a0..209fc7f3bb 100644 --- a/src/Umbraco.Web/Models/DynamicPublishedContent.cs +++ b/src/Umbraco.Web/Models/DynamicPublishedContent.cs @@ -435,7 +435,7 @@ namespace Umbraco.Web.Models return PublishedContent.GetIndex(); } - ICollection IPublishedContent.Properties + ICollection IPublishedContent.Properties { get { return PublishedContent.Properties; } } @@ -445,7 +445,7 @@ namespace Umbraco.Web.Models get { return PublishedContent.Children; } } - IPublishedProperty IPublishedContent.GetProperty(string alias) + IPublishedContentProperty IPublishedContent.GetProperty(string alias) { return PublishedContent.GetProperty(alias); } @@ -545,7 +545,7 @@ namespace Umbraco.Web.Models // get { return PublishedContent.Published; } //} - public IEnumerable Properties + public IEnumerable Properties { get { return PublishedContent.Properties; } } @@ -562,14 +562,14 @@ namespace Umbraco.Web.Models // enhanced versions of the extension methods that exist for IPublishedContent, // here we support the recursive (_) and reflected (@) syntax - public IPublishedProperty GetProperty(string alias) + public IPublishedContentProperty GetProperty(string alias) { return alias.StartsWith("_") ? GetProperty(alias.Substring(1), true) : GetProperty(alias, false); } - public IPublishedProperty GetProperty(string alias, bool recurse) + public IPublishedContentProperty GetProperty(string alias, bool recurse) { if (alias.StartsWith("@")) return GetReflectedProperty(alias.Substring(1)); diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs index 2ca1978c29..e59c2981cb 100644 --- a/src/Umbraco.Web/Models/PublishedContentBase.cs +++ b/src/Umbraco.Web/Models/PublishedContentBase.cs @@ -123,7 +123,7 @@ namespace Umbraco.Web.Models /// /// Gets the properties of the content. /// - public abstract ICollection Properties { get; } + public abstract ICollection Properties { get; } /// /// Gets the value of a property identified by its alias. @@ -158,7 +158,7 @@ namespace Umbraco.Web.Models /// The returned property may have no value (ie HasValue is false). /// The alias is case-insensitive. /// - public abstract IPublishedProperty GetProperty(string alias); + public abstract IPublishedContentProperty GetProperty(string alias); /// /// Gets a property identified by its alias. @@ -172,7 +172,7 @@ namespace Umbraco.Web.Models /// return the first property that was found with the alias but had no value (ie HasValue is false). /// The alias is case-insensitive. /// - public virtual IPublishedProperty GetProperty(string alias, bool recurse) + public virtual IPublishedContentProperty GetProperty(string alias, bool recurse) { var property = GetProperty(alias); if (recurse == false) return property; diff --git a/src/Umbraco.Web/Models/PublishedProperty.cs b/src/Umbraco.Web/Models/PublishedProperty.cs index 0865f8f915..3296ace8ca 100644 --- a/src/Umbraco.Web/Models/PublishedProperty.cs +++ b/src/Umbraco.Web/Models/PublishedProperty.cs @@ -24,9 +24,9 @@ namespace Umbraco.Web.Models /// A collection of IPublishedProperty corresponding to the collection of PublishedPropertyType /// and taking values from the collection of Property. /// Ensures that all conversions took place correctly. - internal static IEnumerable MapProperties( + internal static IEnumerable MapProperties( IEnumerable propertyTypes, IEnumerable properties, - Func map) + Func map) { return propertyTypes.Select(x => { diff --git a/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs b/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs index bdbc28f3cf..4e5d0efa39 100644 --- a/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/MemberPublishedContent.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.PublishedCache private readonly IMember _member; private readonly MembershipUser _membershipUser; - private readonly IPublishedProperty[] _properties; + private readonly IPublishedContentProperty[] _properties; private readonly PublishedContentType _publishedMemberType; public MemberPublishedContent(IMember member, MembershipUser membershipUser) @@ -106,12 +106,12 @@ namespace Umbraco.Web.PublishedCache get { return Enumerable.Empty(); } } - public override ICollection Properties + public override ICollection Properties { get { return _properties; } } - public override IPublishedProperty GetProperty(string alias, bool recurse) + public override IPublishedContentProperty GetProperty(string alias, bool recurse) { if (recurse) { @@ -120,7 +120,7 @@ namespace Umbraco.Web.PublishedCache return GetProperty(alias); } - public override IPublishedProperty GetProperty(string alias) + public override IPublishedContentProperty GetProperty(string alias) { return _properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias)); } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedFragment.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedFragment.cs index 860f9f043f..01093e01c5 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedFragment.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedFragment.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache class PublishedFragment : PublishedContentBase { private readonly PublishedContentType _contentType; - private readonly IPublishedProperty[] _properties; + private readonly IPublishedContentProperty[] _properties; public PublishedFragment(string contentTypeAlias, IDictionary dataValues, bool isPreviewing, bool managed) @@ -35,7 +35,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache ? new PublishedFragmentProperty(x, this, dataValue) : new PublishedFragmentProperty(x, this); }) - .Cast() + .Cast() .ToArray(); } @@ -142,12 +142,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache get { throw new NotImplementedException(); } } - public override ICollection Properties + public override ICollection Properties { get { return _properties; } } - public override IPublishedProperty GetProperty(string alias) + public override IPublishedContentProperty GetProperty(string alias) { return _properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias)); } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index 9217a8ac87..0db5014f98 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -317,7 +317,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache /// /// /// - private IPublishedProperty GetProperty(DictionaryPublishedContent dd, string alias) + private IPublishedContentProperty GetProperty(DictionaryPublishedContent dd, string alias) { if (dd.LoadedFromExamine) { @@ -485,7 +485,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache IDictionary valueDictionary, Func getParent, Func> getChildren, - Func getProperty, + Func getProperty, bool fromExamine) { if (valueDictionary == null) throw new ArgumentNullException("valueDictionary"); @@ -524,12 +524,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache }, "parentID"); _contentType = PublishedContentType.Get(PublishedItemType.Media, _documentTypeAlias); - _properties = new Collection(); + _properties = new Collection(); //loop through remaining values that haven't been applied foreach (var i in valueDictionary.Where(x => !_keysAdded.Contains(x.Key))) { - IPublishedProperty property; + IPublishedContentProperty property; // must ignore that one if (i.Key == "version" || i.Key == "isDoc") continue; @@ -595,7 +595,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private readonly Func _getParent; private readonly Func> _getChildren; - private readonly Func _getProperty; + private readonly Func _getProperty; /// /// Returns 'Media' as the item type @@ -700,7 +700,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache get { return false; } } - public override ICollection Properties + public override ICollection Properties { get { return _properties; } } @@ -710,7 +710,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache get { return _getChildren(this); } } - public override IPublishedProperty GetProperty(string alias) + public override IPublishedContentProperty GetProperty(string alias) { return _getProperty(this, alias); } @@ -723,11 +723,11 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // override to implement cache // cache at context level, ie once for the whole request // but cache is not shared by requests because we wouldn't know how to clear it - public override IPublishedProperty GetProperty(string alias, bool recurse) + public override IPublishedContentProperty GetProperty(string alias, bool recurse) { if (recurse == false) return GetProperty(alias); - IPublishedProperty property; + IPublishedContentProperty property; string key = null; var cache = UmbracoContextCache.Current; @@ -737,7 +737,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache object o; if (cache.TryGetValue(key, out o)) { - property = o as IPublishedProperty; + property = o as IPublishedContentProperty; if (property == null) throw new InvalidOperationException("Corrupted cache."); return property; @@ -770,7 +770,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private DateTime _updateDate; private Guid _version; private int _level; - private readonly ICollection _properties; + private readonly ICollection _properties; private readonly PublishedContentType _contentType; private void ValidateAndSetProperty(IDictionary valueDictionary, Action setProperty, params string[] potentialKeys) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index 5bcca93da5..cc10f9a64f 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -77,7 +77,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private DateTime _createDate; private DateTime _updateDate; private Guid _version; - private IPublishedProperty[] _properties; + private IPublishedContentProperty[] _properties; private int _sortOrder; private int _level; private bool _isDraft; @@ -96,7 +96,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } } - public override IPublishedProperty GetProperty(string alias) + public override IPublishedContentProperty GetProperty(string alias) { return Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias)); } @@ -104,7 +104,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // override to implement cache // cache at context level, ie once for the whole request // but cache is not shared by requests because we wouldn't know how to clear it - public override IPublishedProperty GetProperty(string alias, bool recurse) + public override IPublishedContentProperty GetProperty(string alias, bool recurse) { if (recurse == false) return GetProperty(alias); @@ -118,7 +118,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache if (value == null) return null; - var property = value as IPublishedProperty; + var property = value as IPublishedContentProperty; if (property == null) throw new InvalidOperationException("Corrupted cache."); @@ -310,7 +310,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } } - public override ICollection Properties + public override ICollection Properties { get { @@ -422,7 +422,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache return propertyNodes.TryGetValue(p.PropertyTypeAlias.ToLowerInvariant(), out n) ? new XmlPublishedProperty(p, _isPreviewing, n) : new XmlPublishedProperty(p, _isPreviewing); - }).Cast().ToArray(); + }).Cast().ToArray(); // warn: this is not thread-safe... _initialized = true; diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 411d1a9e7b..09036c14c6 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -1702,7 +1702,7 @@ namespace Umbraco.Web }; var userVals = new Dictionary(); - foreach (var p in from IPublishedProperty p in n.Properties where p.DataValue != null select p) + foreach (var p in from IPublishedContentProperty p in n.Properties where p.DataValue != null select p) { // probably want the "object value" of the property here... userVals[p.PropertyTypeAlias] = p.Value; diff --git a/src/Umbraco.Web/PublishedContentPropertyExtension.cs b/src/Umbraco.Web/PublishedContentPropertyExtension.cs index ee4dd83e57..39f195c541 100644 --- a/src/Umbraco.Web/PublishedContentPropertyExtension.cs +++ b/src/Umbraco.Web/PublishedContentPropertyExtension.cs @@ -11,17 +11,17 @@ namespace Umbraco.Web { #region GetValue - public static T GetValue(this IPublishedProperty property) + public static T GetValue(this IPublishedContentProperty property) { return property.GetValue(false, default(T)); } - public static T GetValue(this IPublishedProperty property, T defaultValue) + public static T GetValue(this IPublishedContentProperty property, T defaultValue) { return property.GetValue(true, defaultValue); } - internal static T GetValue(this IPublishedProperty property, bool withDefaultValue, T defaultValue) + internal static T GetValue(this IPublishedContentProperty property, bool withDefaultValue, T defaultValue) { if (property.HasValue == false && withDefaultValue) return defaultValue; diff --git a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs index e30fcedabe..225ae5b3d8 100644 --- a/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs +++ b/src/Umbraco.Web/umbraco.presentation/CompatibilityHelper.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.umbraco.presentation return node; } - private static IProperty ConvertToNodeProperty(IPublishedProperty prop) + private static IProperty ConvertToNodeProperty(IPublishedContentProperty prop) { return new ConvertedProperty(prop); } @@ -118,9 +118,9 @@ namespace Umbraco.Web.umbraco.presentation private class ConvertedProperty : IProperty, IHtmlString { - private readonly IPublishedProperty _prop; + private readonly IPublishedContentProperty _prop; - public ConvertedProperty(IPublishedProperty prop) + public ConvertedProperty(IPublishedContentProperty prop) { _prop = prop; } From b0c5d16ba7f76034b59e1c27be063b192e40638c Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 30 Apr 2014 19:29:32 +0200 Subject: [PATCH 5/5] U4-4127 Turkish culture prevents Macros embedded --- src/Umbraco.Web/UmbracoHelper.cs | 3 ++- src/Umbraco.Web/umbraco.presentation/macro.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 1c0882b9f5..696d17435a 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Globalization; using System.IO; using System.Linq; using System.Text; @@ -160,7 +161,7 @@ namespace Umbraco.Web { //TODO: We are doing at ToLower here because for some insane reason the UpdateMacroModel method of macro.cs // looks for a lower case match. WTF. the whole macro concept needs to be rewritten. - macroProps.Add(i.Key.ToLower(), i.Value); + macroProps.Add(i.Key.ToLowerInvariant(), i.Value); } var macroControl = m.renderMacro(macroProps, UmbracoContext.Current.PublishedContentRequest.UmbracoPage.Elements, diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index cacf2a13e3..49e49b592f 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -815,9 +815,9 @@ namespace umbraco { foreach (MacroPropertyModel mp in Model.Properties) { - if (attributes.ContainsKey(mp.Key.ToLower())) + if (attributes.ContainsKey(mp.Key.ToLowerInvariant())) { - mp.Value = attributes[mp.Key.ToLower()].ToString(); + mp.Value = attributes[mp.Key.ToLowerInvariant()].ToString(); } else {