diff --git a/src/Umbraco.Core/Dynamics/PropertyResult.cs b/src/Umbraco.Core/Dynamics/PropertyResult.cs index bb2165d184..97d93a653e 100644 --- a/src/Umbraco.Core/Dynamics/PropertyResult.cs +++ b/src/Umbraco.Core/Dynamics/PropertyResult.cs @@ -13,17 +13,15 @@ namespace Umbraco.Core.Dynamics Alias = source.Alias; Value = source.Value; - Version = source.Version; PropertyType = type; } - internal PropertyResult(string alias, object value, Guid version, PropertyResultType type) + internal PropertyResult(string alias, object value, PropertyResultType type) { if (alias == null) throw new ArgumentNullException("alias"); if (value == null) throw new ArgumentNullException("value"); Alias = alias; Value = value; - Version = version; PropertyType = type; } @@ -44,9 +42,6 @@ namespace Umbraco.Core.Dynamics } } - public Guid Version { get; private set; } - - /// /// The Id of the document for which this property belongs to /// diff --git a/src/Umbraco.Core/Manifest/PropertyEditorConverter.cs b/src/Umbraco.Core/Manifest/PropertyEditorConverter.cs index 8d946d56a9..e6f256c789 100644 --- a/src/Umbraco.Core/Manifest/PropertyEditorConverter.cs +++ b/src/Umbraco.Core/Manifest/PropertyEditorConverter.cs @@ -28,14 +28,63 @@ namespace Umbraco.Core.Manifest { View = jObject["editor"]["view"].ToString() }; - + + //the manifest JSON is a simplified json for the validators which is actually a dictionary, however, the + //c# model requires an array of validators not a dictionary so we need to change the json to an array + //to deserialize properly. + JArray converted; + if (TryConvertValidatorDictionaryToArray(jObject["editor"]["validation"] as JObject, out converted)) + { + jObject["editor"]["validation"] = converted; + } + } - if (jObject["preValueEditor"] != null) + if (jObject["prevalues"] != null) { target.ManifestDefinedPreValueEditor = new PreValueEditor(); + + //the manifest JSON is a simplified json for the validators which is actually a dictionary, however, the + //c# model requires an array of validators not a dictionary so we need to change the json to an array + //to deserialize properly. + var fields = jObject["prevalues"]["fields"] as JArray; + if (fields != null) + { + foreach (var f in fields) + { + JArray converted; + if (TryConvertValidatorDictionaryToArray(f["validation"] as JObject, out converted)) + { + f["validation"] = converted; + } + } + } } base.Deserialize(jObject, target, serializer); } + + private bool TryConvertValidatorDictionaryToArray(JObject validation, out JArray result) + { + if (validation == null) + { + result = null; + return false; + } + + result = new JArray(); + foreach (var entry in validation) + { + //in a special case if the value is simply 'true' (boolean) this just indicates that the + // validator is enabled, the config should just be empty. + var formattedItem = JObject.FromObject(new { type = entry.Key, config = entry.Value }); + if (entry.Value.Type == JTokenType.Boolean) + { + formattedItem["config"] = ""; + } + + result.Add(formattedItem); + } + return true; + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/ApplicationTree.cs b/src/Umbraco.Core/Models/ApplicationTree.cs index c00c28155e..d964dc2bff 100644 --- a/src/Umbraco.Core/Models/ApplicationTree.cs +++ b/src/Umbraco.Core/Models/ApplicationTree.cs @@ -1,4 +1,5 @@ -using System.Diagnostics; +using System; +using System.Diagnostics; namespace Umbraco.Core.Models { @@ -82,5 +83,17 @@ namespace Umbraco.Core.Models /// The type. public string Type { get; set; } + private Type _runtimeType; + + /// + /// Returns the CLR type based on it's assembly name stored in the config + /// + /// + public Type GetRuntimeType() + { + return _runtimeType ?? (_runtimeType = System.Type.GetType(Type)); + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/IPublishedContentProperty.cs b/src/Umbraco.Core/Models/IPublishedContentProperty.cs index 6361c29683..1651e12f04 100644 --- a/src/Umbraco.Core/Models/IPublishedContentProperty.cs +++ b/src/Umbraco.Core/Models/IPublishedContentProperty.cs @@ -5,7 +5,6 @@ namespace Umbraco.Core.Models public interface IPublishedContentProperty { string Alias { get; } - object Value { get; } - Guid Version { get; } + object Value { get; } } } \ No newline at end of file diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs index 7b2adf0e26..6df0f91275 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs @@ -63,7 +63,7 @@ namespace Umbraco.Core.PropertyEditors get { return CreateValueEditor(); } } - [JsonProperty("preValueEditor")] + [JsonProperty("prevalues")] public PreValueEditor PreValueEditor { get { return CreatePreValueEditor(); } diff --git a/src/Umbraco.Core/PropertyEditors/ValidatorsResolver.cs b/src/Umbraco.Core/PropertyEditors/ValidatorsResolver.cs index 4b1f0b7c28..6fcbe112f7 100644 --- a/src/Umbraco.Core/PropertyEditors/ValidatorsResolver.cs +++ b/src/Umbraco.Core/PropertyEditors/ValidatorsResolver.cs @@ -30,7 +30,7 @@ namespace Umbraco.Core.PropertyEditors /// public ManifestValueValidator GetValidator(string name) { - return Values.FirstOrDefault(x => x.TypeName == name); + return Values.FirstOrDefault(x => x.TypeName.InvariantEquals(name)); } } } \ No newline at end of file diff --git a/src/Umbraco.Core/PublishedContentExtensions.cs b/src/Umbraco.Core/PublishedContentExtensions.cs index 83e5c53402..9888363f45 100644 --- a/src/Umbraco.Core/PublishedContentExtensions.cs +++ b/src/Umbraco.Core/PublishedContentExtensions.cs @@ -112,7 +112,7 @@ namespace Umbraco.Core } //cache this lookup in a new custom (hidden) property - publishedContent.Properties.Add(new PropertyResult("__recursive__" + fieldname, contentValue, Guid.Empty, PropertyResultType.CustomProperty)); + publishedContent.Properties.Add(new PropertyResult("__recursive__" + fieldname, contentValue, PropertyResultType.CustomProperty)); return contentValue; } diff --git a/src/Umbraco.Core/Serialization/JsonCreationConverter.cs b/src/Umbraco.Core/Serialization/JsonCreationConverter.cs index 5716d11dd9..1dd79fbb96 100644 --- a/src/Umbraco.Core/Serialization/JsonCreationConverter.cs +++ b/src/Umbraco.Core/Serialization/JsonCreationConverter.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq; namespace Umbraco.Core.Serialization { + internal abstract class JsonCreationConverter : JsonConverter { /// diff --git a/src/Umbraco.Core/Services/ApplicationTreeService.cs b/src/Umbraco.Core/Services/ApplicationTreeService.cs index 389b836c29..33a86fa070 100644 --- a/src/Umbraco.Core/Services/ApplicationTreeService.cs +++ b/src/Umbraco.Core/Services/ApplicationTreeService.cs @@ -6,6 +6,7 @@ using System.Xml.Linq; using Umbraco.Core.Cache; using Umbraco.Core.Events; using Umbraco.Core.IO; +using Umbraco.Core.Logging; using Umbraco.Core.Models; using File = System.IO.File; @@ -66,10 +67,16 @@ namespace Umbraco.Core.Services var type = (string) addElement.Attribute("type"); var assembly = (string) addElement.Attribute("assembly"); + var clrType = Type.GetType(type); + if (clrType == null) + { + LogHelper.Warn("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type"); + continue; + } + //check if the tree definition (applicationAlias + type + assembly) is already in the list - if (list.Any(tree => tree.ApplicationAlias.InvariantEquals(applicationAlias) - && tree.Type.InvariantEquals(type)) == false) + if (list.Any(tree => tree.ApplicationAlias.InvariantEquals(applicationAlias) && tree.GetRuntimeType() == clrType) == false) { list.Add(new ApplicationTree( addElement.Attribute("initialize") == null || Convert.ToBoolean(addElement.Attribute("initialize").Value), diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index 1e631bb09a..5cc1c2fae0 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -1,14 +1,13 @@ using System; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using NUnit.Framework; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Core.Manifest; +using Umbraco.Core.PropertyEditors; -namespace Umbraco.Belle.Tests +namespace Umbraco.Tests.Manifest { [TestFixture] public class ManifestParserTests @@ -25,27 +24,20 @@ namespace Umbraco.Belle.Tests editor: { view: '~/App_Plugins/MyPackage/PropertyEditors/MyEditor.html', valueType: 'int', - validation: [ - { - type: 'Required' - }, - { - type: 'Regex', - value: '\\d*' - }, - ] + validation: { + 'required': true, + 'Regex': '\\d*' + } }, - preValueEditor: { + prevalues: { fields: [ { label: 'Some config 1', key: 'key1', view: '~/App_Plugins/MyPackage/PropertyEditors/Views/pre-val1.html', - validation: [ - { - type: 'Required' - } - ] + validation: { + required: true + } }, { label: 'Some config 2', @@ -64,7 +56,7 @@ namespace Umbraco.Belle.Tests Assert.AreEqual("Some config 1", parser.ElementAt(0).PreValueEditor.Fields.ElementAt(0).Name); Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val1.html", parser.ElementAt(0).PreValueEditor.Fields.ElementAt(0).View); Assert.AreEqual(1, parser.ElementAt(0).PreValueEditor.Fields.ElementAt(0).Validators.Count()); - + Assert.AreEqual("key2", parser.ElementAt(0).PreValueEditor.Fields.ElementAt(1).Key); Assert.AreEqual("Some config 2", parser.ElementAt(0).PreValueEditor.Fields.ElementAt(1).Name); Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/Views/pre-val2.html", parser.ElementAt(0).PreValueEditor.Fields.ElementAt(1).View); @@ -82,15 +74,10 @@ namespace Umbraco.Belle.Tests editor: { view: '~/App_Plugins/MyPackage/PropertyEditors/MyEditor.html', valueType: 'int', - validation: [ - { - type: 'Required' - }, - { - type: 'Regex', - value: '\\d*' - }, - ] + validation: { + required : true, + regex : '\\d*' + } } }, { @@ -110,6 +97,12 @@ namespace Umbraco.Belle.Tests Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/MyEditor.html", parser.ElementAt(0).ValueEditor.View); Assert.AreEqual("int", parser.ElementAt(0).ValueEditor.ValueType); Assert.AreEqual(2, parser.ElementAt(0).ValueEditor.Validators.Count()); + var manifestValidator1 = parser.ElementAt(0).ValueEditor.Validators.ElementAt(0) as ManifestPropertyValidator; + Assert.IsNotNull(manifestValidator1); + Assert.AreEqual("required", manifestValidator1.Type); + var manifestValidator2 = parser.ElementAt(0).ValueEditor.Validators.ElementAt(1) as ManifestPropertyValidator; + Assert.IsNotNull(manifestValidator2); + Assert.AreEqual("regex", manifestValidator2.Type); Assert.AreEqual(new Guid("1FCF5C39-5FC7-4BCE-AFBE-6500D9EBA261"), parser.ElementAt(1).Id); Assert.AreEqual("Test 2", parser.ElementAt(1).Name); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs index c6ce668a40..57a37ec5e3 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs @@ -140,8 +140,8 @@ namespace Umbraco.Tests.PublishedContent Properties = new Collection( new List() { - new PropertyResult("property1", "value" + indexVals, Guid.NewGuid(), PropertyResultType.UserProperty), - new PropertyResult("property2", "value" + (indexVals + 1), Guid.NewGuid(), PropertyResultType.UserProperty) + new PropertyResult("property1", "value" + indexVals, PropertyResultType.UserProperty), + new PropertyResult("property2", "value" + (indexVals + 1), PropertyResultType.UserProperty) }), Children = new List() }; @@ -157,11 +157,11 @@ namespace Umbraco.Tests.PublishedContent if (!createChildren) { //create additional columns, used to test the different columns for child nodes - d.Properties.Add(new PropertyResult("property4", "value" + (indexVals + 2), Guid.NewGuid(), PropertyResultType.UserProperty)); + d.Properties.Add(new PropertyResult("property4", "value" + (indexVals + 2), PropertyResultType.UserProperty)); } else { - d.Properties.Add(new PropertyResult("property3", "value" + (indexVals + 2), Guid.NewGuid(), PropertyResultType.UserProperty)); + d.Properties.Add(new PropertyResult("property3", "value" + (indexVals + 2), PropertyResultType.UserProperty)); } return d; } diff --git a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Adding-Configuration-To-Property-Editor.ngdoc b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Adding-Configuration-To-Property-Editor.ngdoc index 79663f1a6b..75fd88857b 100644 --- a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Adding-Configuration-To-Property-Editor.ngdoc +++ b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Adding-Configuration-To-Property-Editor.ngdoc @@ -15,7 +15,7 @@ So an editor can be used several times, with different configurations, and that ##package.manifest So to add configuration options to our markdown editor, open the package.manifest file. rigth below the editor definition, paste in the following: - preValueEditor: { + prevalues: { fields: [ { label: "Preview", diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js index f3f58c7446..702c07431d 100644 --- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js +++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js @@ -182,24 +182,27 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); var self = this; - //TODO: need to get the closeTriggers working for compatibility too somehow. - var dialog = dialogService.open({ template: url, width: width, height: height, iframe: true, - show: true, - callback: function (result) { - - if (typeof onCloseCallback == "function") { - onCloseCallback.apply(self, [result]); - } - - dialog.hide(); - } + show: true }); + //add the callback to the jquery data for the modal so we can call it on close to support the legacy way dialogs worked. + dialog.data("modalCb", onCloseCallback); + //add the close triggers + for (var i = 0; i < closeTriggers.length; i++) { + var e = dialog.find(closeTriggers[i]); + if (e.length > 0) { + e.click(function() { + self.closeModalWindow(); + }); + } + } + + this._modal.push(dialog); return dialog; @@ -213,7 +216,17 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); // all legacy calls to closeModalWindow are expecting to just close the last opened one so we'll ensure // that this is still the case. if (this._modal != null && this._modal.length > 0) { - dialogService.close(this._modal.pop(), { outVal: rVal }); + + var lastModal = this._modal.pop(); + + //if we've stored a callback on this modal call it before we close. + var self = this; + var onCloseCallback = lastModal.data("modalCb"); + if (typeof onCloseCallback == "function") { + onCloseCallback.apply(self, [{ outVal: rVal }]); + } + + dialogService.close(lastModal); } else { dialogService.closeAll(rVal); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js index 3cac289133..067ec19cf9 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js @@ -34,26 +34,16 @@ angular.module('umbraco.services') var dialogs = []; /** Internal method that removes all dialogs */ - function removeAllDialogs(args) { + function removeAllDialogs() { for (var i = 0; i < dialogs.length; i++) { var dialog = dialogs[i]; - removeDialog(dialog, args); + removeDialog(dialog); dialogs.splice(i, 1); } } /** Internal method that handles closing a specific dialog */ - function removeDialog(dialog, args) { - - //if there's arguments passed in then check if there's a callback registered in the current modal then call it. - //this occurs when the "closeDialogs" event is triggered with arguments. - - /* PP: I've commented this out again, because I dont believe a modal should - submit data on exit, only on submit - if (args && dialog.data("modalCb") != null && angular.isFunction(dialog.data("modalCb"))) { - var cb = dialog.data("modalCb"); - cb.apply(dialog, [args]); - }*/ + function removeDialog(dialog) { dialog.modal("hide"); @@ -123,10 +113,7 @@ angular.module('umbraco.services') if (options.show) { $modal.modal('show'); } - - //store the callback in the modal jquery data - $modal.data("modalCb", callback); - + return $modal; } else { @@ -144,10 +131,7 @@ angular.module('umbraco.services') //append to body or other container element container.append($modal); - - //store the callback in the modal jquery data - $modal.data("modalCb", callback); - + // Compile modal content $timeout(function() { $compile($modal)(scope); @@ -223,7 +207,7 @@ angular.module('umbraco.services') /** Handles the closeDialogs event */ $rootScope.$on("closeDialogs", function (evt, args) { - removeAllDialogs(args); + removeAllDialogs(); }); return { @@ -260,10 +244,9 @@ angular.module('umbraco.services') * @description * Closes a specific dialog * @param {Object} dialog the dialog object to close - * @param {Object} args if specified this object will be sent to any callbacks registered on the dialogs. */ - close: function (dialog, args) { - removeDialog(dialog, args); + close: function (dialog) { + removeDialog(dialog); }, /** @@ -273,10 +256,9 @@ angular.module('umbraco.services') * * @description * Closes all dialogs - * @param {Object} args if specified this object will be sent to any callbacks registered on the dialogs. */ - closeAll: function(args) { - removeAllDialogs(args); + closeAll: function() { + removeAllDialogs(); }, /** diff --git a/src/Umbraco.Web.UI.Client/src/packages/MarkdownEditor/package.manifest b/src/Umbraco.Web.UI.Client/src/packages/MarkdownEditor/package.manifest index dc3c7bb77b..fa7be19e47 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/MarkdownEditor/package.manifest +++ b/src/Umbraco.Web.UI.Client/src/packages/MarkdownEditor/package.manifest @@ -6,7 +6,7 @@ editor: { view: "~/App_Plugins/MarkDownEditor/markdowneditor.html" }, - preValueEditor: { + prevalues: { fields: [ { label: "Preview", diff --git a/src/Umbraco.Web.UI.Client/src/packages/propertyeditors/package.manifest b/src/Umbraco.Web.UI.Client/src/packages/propertyeditors/package.manifest index 46831aaae2..5ac299c246 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/propertyeditors/package.manifest +++ b/src/Umbraco.Web.UI.Client/src/packages/propertyeditors/package.manifest @@ -7,7 +7,7 @@ view: "~/App_Plugins/propertyeditors/mntp/mntp.html" }, - preValueEditor: { + prevalues: { fields: [ { label: "Multipicker", diff --git a/src/Umbraco.Web.UI/App_Plugins/MarkdownEditor/package.manifest b/src/Umbraco.Web.UI/App_Plugins/MarkdownEditor/package.manifest index dc3c7bb77b..fa7be19e47 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MarkdownEditor/package.manifest +++ b/src/Umbraco.Web.UI/App_Plugins/MarkdownEditor/package.manifest @@ -6,7 +6,7 @@ editor: { view: "~/App_Plugins/MarkDownEditor/markdowneditor.html" }, - preValueEditor: { + prevalues: { fields: [ { label: "Preview", diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest index 5b68389b52..d612d3f0e3 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest @@ -8,17 +8,12 @@ }, editor: { view: "~/App_Plugins/MyPackage/PropertyEditors/Views/RegexEditor.html", - validation: [ - { - type: "Required" - }, - { - type: "Regex", - config: "^\\d*$" - } - ] + validation: { + required : true, + regex : "^\\d*$" + } }, - preValueEditor: { + prevalues: { fields: [ { label: "Regular expression", @@ -39,31 +34,19 @@ name: "CSV Editor", editor: { view: "~/App_Plugins/MyPackage/PropertyEditors/Views/CsvEditor.html", - validation: [ - { - type: "Delimited", - config: { - delimiter: ",", - pattern: "^[a-zA-Z]*$" - } - }, - ] + validation: { + delimited : { + delimiter: ",", + pattern: "^[a-zA-Z]*$" + } + } } - }, - { - id: "48B0DA8C-3492-4693-96DB-5C5099C680F3", - name: "Custom editor", - editor: { - view: "~/App_Plugins/MyPackage/PropertyEditors/Views/CustomJson.html" - } - } + } ], javascript: [ '~/App_Plugins/MyPackage/Common/Js/MyPackage.js', '~/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js', '~/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js', '~/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js' - /* - '~/App_Plugins/MyPackage/PropertyEditors/Js/CustomJsonEditor.js'*/ ] } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/config/trees.config b/src/Umbraco.Web.UI/config/trees.config index ffbf2306c0..e18f473875 100644 --- a/src/Umbraco.Web.UI/config/trees.config +++ b/src/Umbraco.Web.UI/config/trees.config @@ -1,13 +1,13 @@  - - + + - + - + @@ -39,8 +39,4 @@ - - - - \ No newline at end of file diff --git a/src/Umbraco.Web/ExamineExtensions.cs b/src/Umbraco.Web/ExamineExtensions.cs index e24cf1c9b0..cd309fe180 100644 --- a/src/Umbraco.Web/ExamineExtensions.cs +++ b/src/Umbraco.Web/ExamineExtensions.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web var doc = cache.GetById(result.Id); if (doc == null) continue; //skip if this doesn't exist in the cache doc.Properties.Add( - new PropertyResult("examineScore", result.Score.ToString(), Guid.Empty, PropertyResultType.CustomProperty)); + new PropertyResult("examineScore", result.Score.ToString(), PropertyResultType.CustomProperty)); list.Add(doc); } return list; diff --git a/src/Umbraco.Web/Models/DynamicPublishedContent.cs b/src/Umbraco.Web/Models/DynamicPublishedContent.cs index 3ff0732f99..07a8f42c96 100644 --- a/src/Umbraco.Web/Models/DynamicPublishedContent.cs +++ b/src/Umbraco.Web/Models/DynamicPublishedContent.cs @@ -411,7 +411,7 @@ namespace Umbraco.Web.Models return !attempt.Success ? null - : new PropertyResult(alias, attempt.Result, Guid.Empty, PropertyResultType.ReflectedProperty) + : new PropertyResult(alias, attempt.Result, PropertyResultType.ReflectedProperty) { DocumentTypeAlias = content.DocumentTypeAlias, DocumentId = content.Id diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index c0f156de87..43f3f5cdc9 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -514,8 +514,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { //this is taken from examine _properties.Add(i.Key.InvariantStartsWith("__") - ? new PropertyResult(i.Key, i.Value, Guid.Empty, PropertyResultType.CustomProperty) - : new PropertyResult(i.Key, i.Value, Guid.Empty, PropertyResultType.UserProperty)); + ? new PropertyResult(i.Key, i.Value, PropertyResultType.CustomProperty) + : new PropertyResult(i.Key, i.Value, PropertyResultType.UserProperty)); } } diff --git a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs index 86667486ac..e482cb0ffc 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web.Trees .ToArray(); //find the one we're looking for - var foundControllerTree = controllerTrees.FirstOrDefault(x => x.GetFullNameWithAssembly() == appTree.Type); + var foundControllerTree = controllerTrees.FirstOrDefault(x => x == appTree.GetRuntimeType()); if (foundControllerTree == null) { return new Attempt(new InstanceNotFoundException("Could not find tree of type " + appTree.Type + " in any loaded DLLs")); diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs index 179998201a..0362095d4f 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/DynamicBackingItem.cs @@ -146,7 +146,7 @@ namespace umbraco.MacroEngines } if (result != null) { - return new PropertyResult(alias, string.Format("{0}", result), Guid.Empty) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id }; + return new PropertyResult(alias, string.Format("{0}", result)) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id }; } } } @@ -188,7 +188,7 @@ namespace umbraco.MacroEngines } if (result != null) { - return new PropertyResult(alias, string.Format("{0}", result), Guid.Empty) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id }; + return new PropertyResult(alias, string.Format("{0}", result)) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id }; } } } diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/ExamineBackedMedia.cs b/src/umbraco.MacroEngines/RazorDynamicNode/ExamineBackedMedia.cs index 92c2f84323..f6351623ff 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/ExamineBackedMedia.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/ExamineBackedMedia.cs @@ -141,7 +141,7 @@ namespace umbraco.MacroEngines } Values.Add(result.Current.Name, value); propertyExists = true; - return new PropertyResult(alias, value, Guid.Empty); + return new PropertyResult(alias, value); } } } @@ -376,7 +376,7 @@ namespace umbraco.MacroEngines return Values .Where(kvp => !internalProperties.Contains(kvp.Key)) .ToList() - .ConvertAll(kvp => new PropertyResult(kvp.Key, kvp.Value, Guid.Empty)) + .ConvertAll(kvp => new PropertyResult(kvp.Key, kvp.Value)) .Cast() .ToList(); } @@ -473,7 +473,7 @@ namespace umbraco.MacroEngines || Values.TryGetValue(alias, out value)) { propertyExists = true; - return new PropertyResult(alias, value, Guid.Empty); + return new PropertyResult(alias, value); } propertyExists = false; diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/PropertyResult.cs b/src/umbraco.MacroEngines/RazorDynamicNode/PropertyResult.cs index 76fb729cec..6d9696e836 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/PropertyResult.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/PropertyResult.cs @@ -12,7 +12,6 @@ namespace umbraco.MacroEngines { private string _alias; private string _value; - private Guid _version; public PropertyResult(IProperty source) { @@ -20,20 +19,17 @@ namespace umbraco.MacroEngines { this._alias = source.Alias; this._value = source.Value; - this._version = source.Version; } } - public PropertyResult(string alias, string value, Guid version) + public PropertyResult(string alias, string value) { this._alias = alias; this._value = value; - this._version = version; } public PropertyResult(Property source) { this._alias = source.PropertyType.Alias; this._value = string.Format("{0}", source.Value); - this._version = source.VersionId; } public string Alias { @@ -44,12 +40,7 @@ namespace umbraco.MacroEngines { get { return _value; } } - - public Guid Version - { - get { return _version; } - } - + public bool IsNull() { return Value == null; diff --git a/src/umbraco.MacroEngines/RazorDynamicNode/PublishedContentExtensions.cs b/src/umbraco.MacroEngines/RazorDynamicNode/PublishedContentExtensions.cs index 1dabc444ac..1b52810943 100644 --- a/src/umbraco.MacroEngines/RazorDynamicNode/PublishedContentExtensions.cs +++ b/src/umbraco.MacroEngines/RazorDynamicNode/PublishedContentExtensions.cs @@ -20,7 +20,7 @@ namespace umbraco.MacroEngines.Library internal static IProperty ConvertToNodeProperty(this IPublishedContentProperty prop) { - return new PropertyResult(prop.Alias, prop.Value.ToString(), prop.Version); + return new PropertyResult(prop.Alias, prop.Value.ToString()); } internal static INode ConvertToNode(this IPublishedContent doc) diff --git a/src/umbraco.interfaces/IProperty.cs b/src/umbraco.interfaces/IProperty.cs index 78ce237916..ce4188cd06 100644 --- a/src/umbraco.interfaces/IProperty.cs +++ b/src/umbraco.interfaces/IProperty.cs @@ -6,7 +6,6 @@ namespace umbraco.interfaces { string Alias { get; } string Value { get; } - Guid Version { get; } string ToString(); } } \ No newline at end of file