From 06ae6ad15e5185ea1c556a8ce7eb225cd2495c06 Mon Sep 17 00:00:00 2001 From: Richard Soeteman Date: Mon, 27 Jan 2014 10:15:14 +0100 Subject: [PATCH 01/20] Fix media.save throws an error in Umbraco 7.0.x See http://issues.umbraco.org/issue/U4-3928 width and Height properties are assigned on the file media types. This was because of always assigning a value to content.getProperty(uploadFieldConfigNode.WidthFieldAlias).Value Added an if statement to make sure the media item is an image when assigning those values. --- .../DataTypes/LegacyUploadFieldWorkaround.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs index 20ba39dccc..f7168b7e66 100644 --- a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs +++ b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs @@ -81,10 +81,15 @@ namespace Umbraco.Web.Strategies.DataTypes var dimensions = isImageType ? GetDimensions(path, fileSystem) : null; - // only add dimensions to web images - content.getProperty(uploadFieldConfigNode.WidthFieldAlias).Value = isImageType ? dimensions.Item1.ToString(CultureInfo.InvariantCulture) : string.Empty; - content.getProperty(uploadFieldConfigNode.HeightFieldAlias).Value = isImageType ? dimensions.Item2.ToString(CultureInfo.InvariantCulture) : string.Empty; - content.getProperty(uploadFieldConfigNode.LengthFieldAlias).Value = size == default(long) ? string.Empty : size.ToString(CultureInfo.InvariantCulture); + + if (isImageType) + { + // only add dimensions to web images + content.getProperty(uploadFieldConfigNode.WidthFieldAlias).Value = dimensions.Item1.ToString(CultureInfo.InvariantCulture); + content.getProperty(uploadFieldConfigNode.HeightFieldAlias).Value = dimensions.Item2.ToString(CultureInfo.InvariantCulture); + } + + content.getProperty(uploadFieldConfigNode.LengthFieldAlias).Value = size == default(long) ? string.Empty : size.ToString(CultureInfo.InvariantCulture); content.getProperty(uploadFieldConfigNode.ExtensionFieldAlias).Value = string.IsNullOrEmpty(extension) ? string.Empty : extension; } From 7de1b2d09d0250edc9aee2d3016303a8b7539356 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 29 Jan 2014 09:33:14 +1100 Subject: [PATCH 02/20] Fixes ServerVariablesParser to have a proper event declared! :P --- .gitignore | 1 + src/Umbraco.Web/UI/JavaScript/ServerVariablesParser.cs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8e77a3ce1f..fac78b6bf9 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,4 @@ src/Umbraco.Web.UI/[Cc]onfig/appSettings.config src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config src/Umbraco.Web.UI/umbraco/plugins/* src/Umbraco.Web.UI/umbraco/js/init.js +build/ApiDocs/* diff --git a/src/Umbraco.Web/UI/JavaScript/ServerVariablesParser.cs b/src/Umbraco.Web/UI/JavaScript/ServerVariablesParser.cs index bab84de3ad..fa34fb3ee9 100644 --- a/src/Umbraco.Web/UI/JavaScript/ServerVariablesParser.cs +++ b/src/Umbraco.Web/UI/JavaScript/ServerVariablesParser.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.UI.JavaScript /// /// Could allow developers to add custom variables on startup /// - public static EventHandler> Parsing; + public static event EventHandler> Parsing; internal const string Token = "##Variables##"; @@ -24,7 +24,8 @@ namespace Umbraco.Web.UI.JavaScript } var json = JObject.FromObject(items); - return vars.Replace(Token, json.ToString()); + return vars.Replace(Token, json.ToString()); + } } From 6338d57959c4437f9c071b6879abec51fa3b8193 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 29 Jan 2014 09:34:07 +1100 Subject: [PATCH 03/20] Cherry picked - Removes hard coded api url from rte embed --- .../src/views/common/dialogs/rteembed.controller.js | 4 ++-- src/Umbraco.Web/Editors/BackOfficeController.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js index d2ef92317a..abbf475a27 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js @@ -1,4 +1,4 @@ -angular.module("umbraco").controller("Umbraco.Dialogs.RteEmbedController", function ($scope, $http) { +angular.module("umbraco").controller("Umbraco.Dialogs.RteEmbedController", function ($scope, $http, umbRequestHelper) { $scope.form = {}; $scope.form.url = ""; $scope.form.width = 360; @@ -20,7 +20,7 @@ $scope.form.info = ""; $scope.form.success = false; - $http({ method: 'GET', url: '/umbraco/UmbracoApi/RteEmbed/GetEmbed', params: { url: $scope.form.url, width: $scope.form.width, height: $scope.form.height } }) + $http({ method: 'GET', url: umbRequestHelper.getApiUrl("embedApiBaseUrl", "GetEmbed"), params: { url: $scope.form.url, width: $scope.form.width, height: $scope.form.height } }) .success(function (data) { $scope.form.preview = ""; diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 3a0b648fc3..37ded874a8 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -110,6 +110,10 @@ namespace Umbraco.Web.Editors {"manifestAssetList", Url.Action("GetManifestAssetList", "BackOffice")}, {"serverVarsJs", Url.Action("Application", "BackOffice")}, //API URLs + { + "embedApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( + controller => controller.GetEmbed("",0,0)) + }, { "contentApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( controller => controller.PostSave(null)) From 68b4a493c671e4e6fbeaa52170dc6cbf9304acaf Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 29 Jan 2014 09:46:25 +1100 Subject: [PATCH 04/20] updates versions and port --- build/Build.bat | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Build.bat b/build/Build.bat index 0c9b1f1ad2..706bfc61c2 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -1,5 +1,5 @@ @ECHO OFF -SET release=7.0.2 +SET release=7.0.3 SET comment= SET version=%release% diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index f4517608a4..5fe2f1c160 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration { public class UmbracoVersion { - private static readonly Version Version = new Version("7.0.2"); + private static readonly Version Version = new Version("7.0.3"); /// /// Gets the current version of Umbraco. diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index ab7f865b06..c4e9a6c935 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -2645,7 +2645,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\" True 7020 / - http://localhost:7020 + http://localhost:7030 False False From 5a9874bfadd040f4019571df416a1fdac2f42f78 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 29 Jan 2014 11:19:59 +1100 Subject: [PATCH 05/20] =?UTF-8?q?Fixes=20U4-3894=20Date=20picker=20with=20?= =?UTF-8?q?time=20resets=20to=20"m=C3=A5ndag=20januari=201,=200001"=20on?= =?UTF-8?q?=20Republish=20entire=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Umbraco.Core/ObjectExtensions.cs | 17 +++++++++-- src/Umbraco.Tests/ObjectExtensionsTests.cs | 34 +++++++++------------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/Umbraco.Core/ObjectExtensions.cs b/src/Umbraco.Core/ObjectExtensions.cs index 603c508e0f..026a9fcef5 100644 --- a/src/Umbraco.Core/ObjectExtensions.cs +++ b/src/Umbraco.Core/ObjectExtensions.cs @@ -292,7 +292,20 @@ namespace Umbraco.Core else if (destinationType == typeof(DateTime)) { DateTime value; - return DateTime.TryParse(input, out value) ? Attempt.Succeed(value) : Attempt.Fail(); + if (DateTime.TryParse(input, out value)) + { + switch (value.Kind) + { + case DateTimeKind.Unspecified: + case DateTimeKind.Utc: + return Attempt.Succeed(value); + case DateTimeKind.Local: + return Attempt.Succeed(value.ToUniversalTime()); + default: + throw new ArgumentOutOfRangeException(); + } + } + return Attempt.Fail(); } else if (destinationType == typeof(DateTimeOffset)) { @@ -526,7 +539,7 @@ namespace Umbraco.Core if (type == typeof(bool)) return XmlConvert.ToString((bool)value); if (type == typeof(byte)) return XmlConvert.ToString((byte)value); if (type == typeof(char)) return XmlConvert.ToString((char)value); - if (type == typeof(DateTime)) return XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.RoundtripKind); + if (type == typeof(DateTime)) return XmlConvert.ToString((DateTime)value, XmlDateTimeSerializationMode.Unspecified); if (type == typeof(DateTimeOffset)) return XmlConvert.ToString((DateTimeOffset)value); if (type == typeof(decimal)) return XmlConvert.ToString((decimal)value); if (type == typeof(double)) return XmlConvert.ToString((double)value); diff --git a/src/Umbraco.Tests/ObjectExtensionsTests.cs b/src/Umbraco.Tests/ObjectExtensionsTests.cs index 420a2eb856..4e78b2da1f 100644 --- a/src/Umbraco.Tests/ObjectExtensionsTests.cs +++ b/src/Umbraco.Tests/ObjectExtensionsTests.cs @@ -104,30 +104,24 @@ namespace Umbraco.Tests } } - [Test] - public virtual void CanConvertStringToDateTime() + [TestCase("2012-11-10", true)] + [TestCase("2012/11/10", true)] + [TestCase("10/11/2012", true)]// assuming your culture uses DD/MM/YYYY + [TestCase("11/10/2012", false)]// assuming your culture uses DD/MM/YYYY + [TestCase("Sat 10, Nov 2012", true)] + [TestCase("Saturday 10, Nov 2012", true)] + [TestCase("Sat 10, November 2012", true)] + [TestCase("Saturday 10, November 2012", true)] + [TestCase("2012-11-10 13:14:15", true)] + [TestCase("2012-11-10T13:14:15Z", true)] + public virtual void CanConvertStringToDateTime(string date, bool outcome) { var dateTime = new DateTime(2012, 11, 10, 13, 14, 15); - var testCases = new Dictionary - { - {"2012-11-10", true}, - {"2012/11/10", true}, - {"10/11/2012", true}, // assuming your culture uses DD/MM/YYYY - {"11/10/2012", false}, // assuming your culture uses DD/MM/YYYY - {"Sat 10, Nov 2012", true}, - {"Saturday 10, Nov 2012", true}, - {"Sat 10, November 2012", true}, - {"Saturday 10, November 2012", true}, - {"2012-11-10 13:14:15", true} - }; - foreach (var testCase in testCases) - { - var result = testCase.Key.TryConvertTo(); + var result = date.TryConvertTo(); - Assert.IsTrue(result.Success, testCase.Key); - Assert.AreEqual(DateTime.Equals(dateTime.Date, result.Result.Date), testCase.Value, testCase.Key); - } + Assert.IsTrue(result.Success, date); + Assert.AreEqual(DateTime.Equals(dateTime.Date, result.Result.Date), outcome, date); } [Test] From 2f7727af689acf956f8aee6df74a4ffc26b4f490 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 29 Jan 2014 11:20:25 +1100 Subject: [PATCH 06/20] =?UTF-8?q?Fixes:=20U4-3894=20Date=20picker=20with?= =?UTF-8?q?=20time=20resets=20to=20"m=C3=A5ndag=20januari=201,=200001"=20o?= =?UTF-8?q?n=20Republish=20entire=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ValueConverters/DatePickerValueConverter.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/DatePickerValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/DatePickerValueConverter.cs index 435a9833a6..769f3928a7 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/DatePickerValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/DatePickerValueConverter.cs @@ -26,13 +26,14 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters if (source == null) return DateTime.MinValue; // in XML a DateTime is: string - format "yyyy-MM-ddTHH:mm:ss" + // Actually, not always sometimes it is formatted in UTC style with 'Z' suffixed on the end but that is due to this bug: + // http://issues.umbraco.org/issue/U4-4145, http://issues.umbraco.org/issue/U4-3894 + // We should just be using TryConvertTo instead. var sourceString = source as string; if (sourceString != null) { - DateTime value; - return DateTime.TryParseExact(sourceString, "yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out value) - ? value - : DateTime.MinValue; + var attempt = sourceString.TryConvertTo(); + return attempt.Success == false ? DateTime.MinValue : attempt.Result; } // in the database a DateTime is: DateTime @@ -47,7 +48,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters public override object ConvertSourceToXPath(PublishedPropertyType propertyType, object source, bool preview) { // source should come from ConvertSource and be a DateTime already - return XmlConvert.ToString((DateTime) source, "yyyy-MM-ddTHH:mm:ss"); + return XmlConvert.ToString((DateTime)source, XmlDateTimeSerializationMode.Unspecified); } } } \ No newline at end of file From 81c32716fef76d7dbbf675b0c7b898ba9c991bf6 Mon Sep 17 00:00:00 2001 From: perploug Date: Wed, 29 Jan 2014 22:04:37 +0100 Subject: [PATCH 07/20] Removes pre-checkpassword check --- src/umbraco.providers/UsersMembershipProvider.cs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/umbraco.providers/UsersMembershipProvider.cs b/src/umbraco.providers/UsersMembershipProvider.cs index 0843b998c0..1794ed26a3 100644 --- a/src/umbraco.providers/UsersMembershipProvider.cs +++ b/src/umbraco.providers/UsersMembershipProvider.cs @@ -497,19 +497,6 @@ namespace umbraco.providers return false; } - //Due to the way this legacy provider worked, when it 'validated' a password passed in, it would allow - // having the already hashed/encrypted password checked directly - this is bad but hey, we gotta support legacy - // don't we. - - //So, first we'll check if the user object's db stored password (already hashed/encrypted in the db) matches the password that - // has been passed in, if so then we will confirm that it is valid. If it doesn't we'll attempt to hash/encrypt the passed in - // password and then validate it - the way it is supposed to be done. - - if (user.Password == password) - { - return true; - } - return CheckPassword(password, user.Password); } } From 002988ce8660fa1d9d89bd628b7d7e3314ff3e1f Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 30 Jan 2014 08:45:43 +0100 Subject: [PATCH 08/20] U4-4144 - Media Cache dies due to new 'key' property in XML --- .../XmlPublishedCache/PublishedMediaCache.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index c762874a88..1be0496979 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -478,6 +478,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // I'm not sure that _properties contains all properties including those without a value, // neither that GetProperty will return a property without a value vs. null... @zpqrtbnk + // List of properties that will appear in the XML and do not match + // anything in the ContentType, so they must be ignored. + static readonly string[] IgnoredKeys = { "version", "isDoc", "key" }; + public DictionaryPublishedContent( IDictionary valueDictionary, Func getParent, @@ -528,8 +532,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { IPublishedProperty property = null; - // must ignore that one - if (i.Key == "version" || i.Key == "isDoc") continue; + // must ignore those + if (IgnoredKeys.Contains(i.Key)) continue; if (i.Key.InvariantStartsWith("__")) { @@ -540,6 +544,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { // use property type to ensure proper conversion var propertyType = _contentType.GetPropertyType(i.Key); + if (propertyType == null) + throw new Exception("Internal error, property '" + i.Key + "' is not a valid property for that type of content."); property = new XmlPublishedProperty(propertyType, false, i.Value); // false :: never preview a media } From 56cd1cee81b18caef8a66da3ba4fef8c03ed59e5 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 30 Jan 2014 15:07:43 +0100 Subject: [PATCH 09/20] U4-4160 - make sure string properties are returned as strings --- .../MustBeStringValueConverter.cs | 38 +++++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../MntpStringValueConverter.cs | 29 -------------- src/Umbraco.Web/Umbraco.Web.csproj | 1 - 4 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 src/Umbraco.Core/PropertyEditors/ValueConverters/MustBeStringValueConverter.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/MntpStringValueConverter.cs diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/MustBeStringValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/MustBeStringValueConverter.cs new file mode 100644 index 0000000000..45563d11e8 --- /dev/null +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/MustBeStringValueConverter.cs @@ -0,0 +1,38 @@ +using System.Linq; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Core.PropertyEditors.ValueConverters +{ + /// + /// Ensures that no matter what is selected in (editor), the value results in a string. + /// + /// + /// For more details see issues http://issues.umbraco.org/issue/U4-3776 (MNTP) + /// and http://issues.umbraco.org/issue/U4-4160 (media picker). + /// The cache level is set to .Content because the string is supposed to depend + /// on the source value only, and not on any other content. It is NOT appropriate + /// to use that converter for values whose .ToString() would depend on other content. + /// + [DefaultPropertyValueConverter] + [PropertyValueType(typeof(string))] + [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)] + public class MustBeStringValueConverter : PropertyValueConverterBase + { + private static readonly string[] Aliases = + { + Constants.PropertyEditors.MultiNodeTreePickerAlias, + Constants.PropertyEditors.MultipleMediaPickerAlias + }; + + public override bool IsConverter(PublishedPropertyType propertyType) + { + return Aliases.Contains(propertyType.PropertyEditorAlias); + } + + public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + return source.ToString(); + } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 18cd086cbe..f29a9f5b29 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -368,6 +368,7 @@ + diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/MntpStringValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/MntpStringValueConverter.cs deleted file mode 100644 index 14cc3a9b57..0000000000 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/MntpStringValueConverter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Umbraco.Core; -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.PropertyEditors; - -namespace Umbraco.Web.PropertyEditors.ValueConverters -{ - /// - /// Ensures that no matter what is selected in MNTP that the value results in a string - /// - /// - /// See here for full details:http://issues.umbraco.org/issue/U4-3776 - /// - [DefaultPropertyValueConverter] - [PropertyValueType(typeof (string))] - [PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Request)] - public class MntpStringValueConverter : PropertyValueConverterBase - { - public override bool IsConverter(PublishedPropertyType propertyType) - { - return propertyType.PropertyEditorAlias == Constants.PropertyEditors.MultiNodeTreePickerAlias; - } - - public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview) - { - if (source == null) return null; - return source.ToString(); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index ce74fb02a8..a2b131709d 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -397,7 +397,6 @@ - From 2ab1cf59a6ccee1bead57ce600fbf040531d4c70 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 30 Jan 2014 16:18:06 +0100 Subject: [PATCH 10/20] U4-2317 - issue with domains & languages management --- src/Umbraco.Web/WebServices/DomainsApiController.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/WebServices/DomainsApiController.cs b/src/Umbraco.Web/WebServices/DomainsApiController.cs index 062a9dfa62..02a4269ac5 100644 --- a/src/Umbraco.Web/WebServices/DomainsApiController.cs +++ b/src/Umbraco.Web/WebServices/DomainsApiController.cs @@ -64,12 +64,14 @@ namespace Umbraco.Web.WebServices // process domains - foreach (var domain in domains.Where(d => model.Domains.All(m => !m.Name.Equals(d.Name, StringComparison.OrdinalIgnoreCase)))) + // delete every (non-wildcard) domain, that exists in the DB yet is not in the model + foreach (var domain in domains.Where(d => d.IsWildcard == false && model.Domains.All(m => m.Name.Equals(d.Name, StringComparison.OrdinalIgnoreCase) == false))) domain.Delete(); var names = new List(); - foreach (var domainModel in model.Domains.Where(m => !string.IsNullOrWhiteSpace(m.Name))) + // create or update domains in the model + foreach (var domainModel in model.Domains.Where(m => string.IsNullOrWhiteSpace(m.Name) == false)) { language = languages.FirstOrDefault(l => l.id == domainModel.Lang); if (language == null) @@ -90,7 +92,7 @@ namespace Umbraco.Web.WebServices Domain.MakeNew(name, model.NodeId, domainModel.Lang); } - model.Valid = model.Domains.All(m => !m.Duplicate); + model.Valid = model.Domains.All(m => m.Duplicate == false); return model; } From 73173f92d6fce0ef2b6b6f28b7dd742f7af92217 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 31 Jan 2014 10:32:49 +0100 Subject: [PATCH 11/20] U4-4144 - fix --- .../PublishedCache/XmlPublishedCache/PublishedMediaCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index 1be0496979..9d8a34f3b2 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -480,7 +480,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // List of properties that will appear in the XML and do not match // anything in the ContentType, so they must be ignored. - static readonly string[] IgnoredKeys = { "version", "isDoc", "key" }; + private static readonly string[] IgnoredKeys = { "version", "isDoc", "key" }; public DictionaryPublishedContent( IDictionary valueDictionary, From 17838e044cff86c1aa20d306c0898997ce897ea2 Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 24 Jan 2014 17:20:34 +0100 Subject: [PATCH 12/20] Addss template clearing when in debugmode (cherry picked from commit 7d2f6c13c36726868d0f4ad478a7ccf72d793c3a) --- src/Umbraco.Web.UI.Client/src/init.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/init.js b/src/Umbraco.Web.UI.Client/src/init.js index 57df26b532..974cfe97ee 100644 --- a/src/Umbraco.Web.UI.Client/src/init.js +++ b/src/Umbraco.Web.UI.Client/src/init.js @@ -47,6 +47,15 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService', $location.path(rejection.path).search(rejection.search); }); + + /** For debug mode, always clear template cache to cut down on + dev frustration and chrome cache on templates */ + if(Umbraco.Sys.ServerVariables.isDebuggingEnabled){ + $rootScope.$on('$viewContentLoaded', function() { + $templateCache.removeAll(); + }); + } + /* this will initialize the navigation service once the application has started */ navigationService.init(); From 02d9d42ae27cfa1da979e90c0de0e99d58c0348f Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 24 Jan 2014 18:38:08 +0100 Subject: [PATCH 13/20] adds getByQuery to entityService (cherry picked from commit 825861905555633f7a778d9c90274c811439abea) Conflicts: src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js src/Umbraco.Web/Editors/EntityController.cs --- .../src/common/resources/entity.resource.js | 10 ++ src/Umbraco.Web/Editors/EntityController.cs | 104 ++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js index 75d2f47a28..2260fefd79 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js @@ -99,6 +99,16 @@ function entityResource($q, $http, umbRequestHelper) { 'Failed to retreive entity data for id ' + id); }, + getByQuery: function (query, nodeContextId, type) { + return umbRequestHelper.resourcePromise( + $http.get( + umbRequestHelper.getApiUrl( + "entityApiBaseUrl", + "GetByQuery", + [{query: query},{ nodeContextId: nodeContextId}, {type: type }])), + 'Failed to retreive entity data for query ' + query); + }, + /** * @ngdoc method * @name umbraco.resources.entityResource#getByIds diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index e30d67fe1d..ae1d30e665 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -25,6 +25,7 @@ using Examine; using Examine.LuceneEngine.SearchCriteria; using Examine.SearchCriteria; using Umbraco.Web.Dynamics; +using umbraco; namespace Umbraco.Web.Editors { @@ -128,6 +129,109 @@ namespace Umbraco.Web.Editors return GetResultForKey(id, type); } + /// + /// Gets an entity by a xpath query + /// + /// + /// + /// + /// + public EntityBasic GetByQuery(string query, int nodeContextId, UmbracoEntityTypes type) + { + + //this is css (commented out for now, due to external dependency) + //if (!query.Contains("::") && !query.Contains('/')) + // query = css2xpath.Converter.CSSToXPath(query, ""); + + if (type != UmbracoEntityTypes.Document) + throw new ArgumentException("Get by query is only compatible with enitities of type Document"); + + + var q = parseQuery(query, nodeContextId); + var node = Umbraco.TypedContentSingleAtXPath(q); + + if (node == null) + return null; + + return GetById(node.Id, type); + } + + //PP: wip in progress on the query parser + private string parseQuery(string query, int id) + { + if (!query.StartsWith("$")) + return query; + + //get full path + Func> getPath = delegate(int nodeid){ + var ent = Services.EntityService.Get(nodeid); + return ent.Path.Split(',').Reverse(); + }; + + //get nearest published item + Func, int> getClosestPublishedAncestor = delegate(IEnumerable path) + { + + foreach (var _id in path) + { + var item = Umbraco.TypedContent(int.Parse(_id)); + + if (item != null) + return item.Id; + } + return -1; + }; + + var rootXpath = "descendant::*[@id={0}]"; + + //parseable items: + var vars = new Dictionary>(); + vars.Add("$current", delegate(string q){ + var _id = getClosestPublishedAncestor(getPath(id)); + return q.Replace("$current", string.Format(rootXpath, _id)); + }); + + vars.Add("$parent", delegate(string q) + { + //remove the first item in the array if its the current node + //this happens when current is published, but we are looking for its parent specifically + var path = getPath(id); + if(path.ElementAt(0) == id.ToString()){ + path = path.Skip(1); + } + + var _id = getClosestPublishedAncestor(path); + return q.Replace("$parent", string.Format(rootXpath, _id)); + }); + + + vars.Add("$site", delegate(string q) + { + var _id = getClosestPublishedAncestor(getPath(id)); + return q.Replace("$site", string.Format(rootXpath, _id) + "/ancestor-or-self::*[@level = 1]"); + }); + + + vars.Add("$root", delegate(string q) + { + return q.Replace("$root", string.Empty); + }); + + + foreach (var varible in vars) + { + if (query.StartsWith(varible.Key)) + { + query = varible.Value.Invoke(query); + break; + } + } + + return query; + } + + + public EntityBasic GetById(int id, UmbracoEntityTypes type) { return GetResultForId(id, type); From d691e525b390c1491be5d54505e143e21cd3a035 Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 24 Jan 2014 18:38:39 +0100 Subject: [PATCH 14/20] Adds support for xpath root node selection on mntp (cherry picked from commit d842f0f5b7fe4322915eab0e4b12f73cdf95e115) Conflicts: src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js --- .../src/views/prevalueeditors/treesource.html | 42 +++++++++++++++---- .../contentpicker/contentpicker.controller.js | 4 +- .../contentpicker/contentpicker.html | 1 - 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html index c9fdd8674d..a3ae305a20 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html @@ -1,6 +1,6 @@
- @@ -18,13 +18,37 @@ - +
+ + + + + Choose... + + +
+ Enter query +
+ + + + +
+ + + Available placeholders:
+ $current: current page or closest found ancestor
+ $parent: parent page or closest found ancestor
+ $root: root of the content tree
+ $site: Ancestor node at level 1
+
+ + + ...Or pick a node +
+
\ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index 70a98843b6..5b0d5ec8df 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -3,7 +3,7 @@ angular.module('umbraco') .controller("Umbraco.PropertyEditors.ContentPickerController", - function($scope, dialogService, entityResource, $log, iconHelper){ + function($scope, dialogService, entityResource, editorState, $log, iconHelper, $routeParams){ $scope.renderModel = []; $scope.ids = $scope.model.value ? $scope.model.value.split(',') : []; @@ -12,6 +12,7 @@ angular.module('umbraco') multiPicker: "0", entityType: "Document", startNode:{ + query: "", type: "content", id: -1 } @@ -31,6 +32,7 @@ angular.module('umbraco') $scope.cfg.entityType = "Media"; } + var rootId = $routeParams.id; $scope.cfg.callback = populate; $scope.cfg.treeAlias = $scope.cfg.startNode.type; $scope.cfg.section = $scope.cfg.startNode.type; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html index ecdd82e15a..7132a7e868 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.html @@ -23,5 +23,4 @@ - \ No newline at end of file From 7533baf36816e097d2366a9e1c9d0556c49b79fc Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 24 Jan 2014 18:38:47 +0100 Subject: [PATCH 15/20] fixes mntp filtering (cherry picked from commit 3e22598f4a0ec4be50082d5d5d5fc79dd15d8be7) --- .../src/common/directives/umbtree.directive.js | 5 +++-- .../src/views/common/dialogs/treepicker.controller.js | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index 2c60a87db2..164b05ba03 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -235,8 +235,9 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat //set the root as the current active tree scope.activeTree = scope.tree.root; - emitEvent("treeLoaded", { tree: scope.tree.root }); - + emitEvent("treeLoaded", { tree: scope.tree }); + emitEvent("treeNodeExpanded", { tree: scope.tree, node: scope.tree.root, children: scope.tree.root.children }); + }, function(reason) { scope.loading = false; notificationsService.error("Tree Error", reason); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js index 4d7fd6be09..da55d80529 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/treepicker.controller.js @@ -40,11 +40,11 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController", //Configures filtering if (dialogOptions.filter) { - dialogOptions.filterExclude = true; + dialogOptions.filterExclude = false; dialogOptions.filterAdvanced = false; if(dialogOptions.filter[0] === "!"){ - dialogOptions.filterExclude = false; + dialogOptions.filterExclude = true; dialogOptions.filter = dialogOptions.filter.substring(1); } @@ -112,8 +112,10 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController", angular.forEach(nodes, function (value, key) { var found = a.indexOf(value.metaData.contentType) >= 0; - if ((dialogOptions.filterExclude && found) || !found) { - value.filtered = true; + + if (!dialogOptions.filterExclude && !found || dialogOptions.filterExclude && found){ + value.filtered = true; + if(dialogOptions.filterCssClass){ value.cssClasses.push(dialogOptions.filterCssClass); } From 5821444678c06ad3fee0e25dad4eb71802701109 Mon Sep 17 00:00:00 2001 From: perploug Date: Mon, 27 Jan 2014 08:27:31 +0100 Subject: [PATCH 16/20] Fixes inconsistently named private method Replaces delegates with lambdas (cherry picked from commit 2a811627565769ad43c9854d36be51edc04c6873) --- src/Umbraco.Web/Editors/EntityController.cs | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index ae1d30e665..0893d03e1d 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -138,16 +138,12 @@ namespace Umbraco.Web.Editors /// public EntityBasic GetByQuery(string query, int nodeContextId, UmbracoEntityTypes type) { - - //this is css (commented out for now, due to external dependency) - //if (!query.Contains("::") && !query.Contains('/')) - // query = css2xpath.Converter.CSSToXPath(query, ""); - + if (type != UmbracoEntityTypes.Document) throw new ArgumentException("Get by query is only compatible with enitities of type Document"); - var q = parseQuery(query, nodeContextId); + var q = ParseXPathQuery(query, nodeContextId); var node = Umbraco.TypedContentSingleAtXPath(q); if (node == null) @@ -157,8 +153,9 @@ namespace Umbraco.Web.Editors } //PP: wip in progress on the query parser - private string parseQuery(string query, int id) + private string ParseXPathQuery(string query, int id) { + //no need to parse it if (!query.StartsWith("$")) return query; @@ -169,7 +166,7 @@ namespace Umbraco.Web.Editors }; //get nearest published item - Func, int> getClosestPublishedAncestor = delegate(IEnumerable path) + Func, int> getClosestPublishedAncestor = (path => { foreach (var _id in path) @@ -180,18 +177,18 @@ namespace Umbraco.Web.Editors return item.Id; } return -1; - }; + }); var rootXpath = "descendant::*[@id={0}]"; //parseable items: var vars = new Dictionary>(); - vars.Add("$current", delegate(string q){ + vars.Add("$current", q => { var _id = getClosestPublishedAncestor(getPath(id)); return q.Replace("$current", string.Format(rootXpath, _id)); }); - vars.Add("$parent", delegate(string q) + vars.Add("$parent", q => { //remove the first item in the array if its the current node //this happens when current is published, but we are looking for its parent specifically @@ -205,14 +202,14 @@ namespace Umbraco.Web.Editors }); - vars.Add("$site", delegate(string q) + vars.Add("$site", q => { var _id = getClosestPublishedAncestor(getPath(id)); return q.Replace("$site", string.Format(rootXpath, _id) + "/ancestor-or-self::*[@level = 1]"); }); - vars.Add("$root", delegate(string q) + vars.Add("$root", q => { return q.Replace("$root", string.Empty); }); From 621a19d4bda514fce607f836c725cb76ff78e569 Mon Sep 17 00:00:00 2001 From: perploug Date: Wed, 29 Jan 2014 11:21:54 +0100 Subject: [PATCH 17/20] Final tweaks to TreeSource picker Better help text, polish icons and margins, made sure it toggles UI correctly for each type of tree (cherry picked from commit 9ce79e98a3dc8427503dd33f3f4ffc101ad48366) Conflicts: src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html --- .../prevalueeditors/treesource.controller.js | 7 +- .../src/views/prevalueeditors/treesource.html | 101 +++++++++++------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.controller.js index 5850225e68..c8eacd14c6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.controller.js @@ -37,10 +37,13 @@ angular.module('umbraco') }; $scope.clear = function() { - $scope.model.value.id = undefined; - $scope.node = undefined; + $scope.model.value.id = undefined; + $scope.node = undefined; + $scope.model.value.query = undefined; }; + + //we always need to ensure we dont submit anything broken $scope.$on("formSubmitting", function (ev, args) { if($scope.model.value.type === "member"){ $scope.model.value.id = -1; diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html index a3ae305a20..8811b549b5 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/treesource.html @@ -1,54 +1,77 @@
- -

- -
- - -
- + +
+ + + -
- - - Available placeholders:
- $current: current page or closest found ancestor
- $parent: parent page or closest found ancestor
- $root: root of the content tree
- $site: Ancestor node at level 1
+ + + + +
    +
  • + + + Show xpath query help + + + +

    + Use Xpath query to set a root node on the tree, either based on a search from the root of the content tree, or by using a context-aware placeholder. +

    + +

    + Placeholders finds the nearest published ID and runs its query from there. so for instance: + +

    $parent/newsArticle
    + + Will try to get the parent if available, but will then fall back to the nearest ancestor and query for all news articles there. +

    + +

    + Available placeholders:
    + $current: current page or closest found ancestor
    + $parent: parent page or closest found ancestor
    + $root: root of the content tree
    + $site: Ancestor node at level 1
    +

    - - - ...Or pick a node - -
+ +
  • + + Cancel and clear query +
  • + +
    \ No newline at end of file From 4ea589e954720de00369aea2f57566eb651c6ff2 Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 31 Jan 2014 11:38:01 +0100 Subject: [PATCH 18/20] Missing changes on ContentPickerControler re-added --- .../contentpicker/contentpicker.controller.js | 155 +++++++++--------- 1 file changed, 82 insertions(+), 73 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js index 5b0d5ec8df..22327f81f1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/contentpicker/contentpicker.controller.js @@ -2,71 +2,80 @@ //with a specified callback, this callback will receive an object with a selection on it angular.module('umbraco') .controller("Umbraco.PropertyEditors.ContentPickerController", - - function($scope, dialogService, entityResource, editorState, $log, iconHelper, $routeParams){ - $scope.renderModel = []; - $scope.ids = $scope.model.value ? $scope.model.value.split(',') : []; - - //configuration - $scope.cfg = { - multiPicker: "0", - entityType: "Document", - startNode:{ - query: "", - type: "content", - id: -1 - } - }; - if($scope.model.config){ - $scope.cfg = angular.extend($scope.cfg, $scope.model.config); - } - + function ($scope, dialogService, entityResource, editorState, $log, iconHelper, $routeParams) { + $scope.renderModel = []; + $scope.ids = $scope.model.value ? $scope.model.value.split(',') : []; + + //configuration + $scope.cfg = { + multiPicker: "0", + entityType: "Document", + filterCssClass: "not-allowed not-published", + + startNode: { + query: "", + type: "content", + id: -1 + } + }; + + if ($scope.model.config) { + $scope.cfg = angular.extend($scope.cfg, $scope.model.config); + } + //Umbraco persists boolean for prevalues as "0" or "1" so we need to convert that! - $scope.cfg.multiPicker = ($scope.cfg.multiPicker === "0" ? false : true); + $scope.cfg.multiPicker = ($scope.cfg.multiPicker === "0" ? false : true); - if($scope.cfg.startNode.type === "member"){ - $scope.cfg.entityType = "Member"; - } - else if ($scope.cfg.startNode.type === "media") { - $scope.cfg.entityType = "Media"; - } + if ($scope.cfg.startNode.type === "member") { + $scope.cfg.entityType = "Member"; + } + else if ($scope.cfg.startNode.type === "media") { + $scope.cfg.entityType = "Media"; + } - var rootId = $routeParams.id; - $scope.cfg.callback = populate; - $scope.cfg.treeAlias = $scope.cfg.startNode.type; - $scope.cfg.section = $scope.cfg.startNode.type; - $scope.cfg.startNodeId = $scope.cfg.startNode.id; - $scope.cfg.filterCssClass = "not-allowed not-published"; - - //load current data - entityResource.getByIds($scope.ids, $scope.cfg.entityType).then(function(data){ - _.each(data, function (item, i) { - item.icon = iconHelper.convertFromLegacyIcon(item.icon); - $scope.renderModel.push({name: item.name, id: item.id, icon: item.icon}); - }); - }); + //if we have a query for the startnode, we will use that. + if ($scope.cfg.startNode.query) { + var rootId = $routeParams.id; + entityResource.getByQuery($scope.cfg.startNode.query, rootId, "Document").then(function (ent) { + $scope.cfg.startNodeId = ent.id; + }); + } else { + $scope.cfg.startNodeId = $scope.cfg.startNode.id; + } + + $scope.cfg.callback = populate; + $scope.cfg.treeAlias = $scope.cfg.startNode.type; + $scope.cfg.section = $scope.cfg.startNode.type; + + //load current data + entityResource.getByIds($scope.ids, $scope.cfg.entityType).then(function (data) { + _.each(data, function (item, i) { + item.icon = iconHelper.convertFromLegacyIcon(item.icon); + $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon }); + }); + }); - //dialog - $scope.openContentPicker =function(){ - var d = dialogService.treePicker($scope.cfg); - }; + //dialog + $scope.openContentPicker = function () { + var d = dialogService.treePicker($scope.cfg); + }; - $scope.remove =function(index){ - $scope.renderModel.splice(index, 1); - }; + $scope.remove = function (index) { + $scope.renderModel.splice(index, 1); + }; - $scope.add =function(item){ - if($scope.ids.indexOf(item.id) < 0){ - item.icon = iconHelper.convertFromLegacyIcon(item.icon); - $scope.renderModel.push({name: item.name, id: item.id, icon: item.icon}); - } - }; + $scope.add = function (item) { + if ($scope.ids.indexOf(item.id) < 0) { + item.icon = iconHelper.convertFromLegacyIcon(item.icon); + $scope.renderModel.push({ name: item.name, id: item.id, icon: item.icon }); + } + }; - $scope.clear = function() { + $scope.clear = function () { $scope.renderModel = []; }; @@ -74,10 +83,10 @@ angular.module('umbraco') // because the ui-sortable doesn't dispatch an event after the digest of the sort operation. Any of the events for UI sortable // occur after the DOM has updated but BEFORE the digest has occured so the model has NOT changed yet - it even states so in the docs. // In their source code there is no event so we need to just subscribe to our model changes here. - //This also makes it easier to manage models, we update one and the rest will just work. - $scope.$watch(function() { + //This also makes it easier to manage models, we update one and the rest will just work. + $scope.$watch(function () { //return the joined Ids as a string to watch - return _.map($scope.renderModel, function(i) { + return _.map($scope.renderModel, function (i) { return i.id; }).join(); }, function (newVal) { @@ -88,22 +97,22 @@ angular.module('umbraco') }); $scope.$on("formSubmitting", function (ev, args) { - $scope.model.value = trim($scope.ids.join(), ","); + $scope.model.value = trim($scope.ids.join(), ","); }); - function trim(str, chr) { - var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^'+chr+'+|'+chr+'+$', 'g'); - return str.replace(rgxtrim, ''); - } + function trim(str, chr) { + var rgxtrim = (!chr) ? new RegExp('^\\s+|\\s+$', 'g') : new RegExp('^' + chr + '+|' + chr + '+$', 'g'); + return str.replace(rgxtrim, ''); + } - function populate(data){ - if(angular.isArray(data)){ - _.each(data, function (item, i) { - $scope.add(item); - }); - }else{ - $scope.clear(); - $scope.add(data); - } - } -}); \ No newline at end of file + function populate(data) { + if (angular.isArray(data)) { + _.each(data, function (item, i) { + $scope.add(item); + }); + } else { + $scope.clear(); + $scope.add(data); + } + } + }); \ No newline at end of file From 9687b2abee7ae7b2bb9abba821601eaa8145b149 Mon Sep 17 00:00:00 2001 From: perploug Date: Fri, 31 Jan 2014 13:03:46 +0100 Subject: [PATCH 19/20] Special rule for installer password change --- src/Umbraco.Core/Security/MembershipProviderBase.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index f5ba315177..d0738b24ea 100644 --- a/src/Umbraco.Core/Security/MembershipProviderBase.cs +++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs @@ -711,6 +711,11 @@ namespace Umbraco.Core.Security var decrypted = DecryptPassword(dbPassword); return decrypted == password; case MembershipPasswordFormat.Hashed: + + //only triggered when we set the initial installer password + if (dbPassword == "default" && password == dbPassword) + return true; + string salt; var storedHashedPass = StoredPassword(dbPassword, out salt); var hashed = EncryptOrHashPassword(password, salt); From 98684e62928e3d226947ad0e385e7b15a80b656a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 3 Feb 2014 10:23:13 +0100 Subject: [PATCH 20/20] Add 100 to the ClientDependency.config version to avoid conflicts with older caches --- src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs b/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs index 3aa4321071..0536647f55 100644 --- a/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs +++ b/src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs @@ -30,7 +30,7 @@ namespace Umbraco.Core.Configuration int oldVersion; int.TryParse(versionAttribute.Value, out oldVersion); - var newVersion = oldVersion + 1; + var newVersion = oldVersion + 100; versionAttribute.SetValue(newVersion); clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index c4e9a6c935..a61e8011b2 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -2643,7 +2643,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\" True True - 7020 + 7030 / http://localhost:7030 False