diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index c6b233ee0e..819104b70f 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Threading.Tasks; using System.Web; using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; namespace Umbraco.Core.IO { @@ -88,8 +89,15 @@ namespace Umbraco.Core.IO ? _fs.GetExtension(Path).Substring(1).ToLowerInvariant() : ""; Url = _fs.GetUrl(Path); + Exists = _fs.FileExists(Path); + if (Exists == false) + { + LogHelper.Warn("The media file doesn't exist: " + Path); + } } + public bool Exists { get; private set; } + public string Filename { get; private set; } public string Extension { get; private set; } @@ -110,7 +118,14 @@ namespace Umbraco.Core.IO { if (_length == null) { - _length = _fs.GetSize(Path); + if (Exists) + { + _length = _fs.GetSize(Path); + } + else + { + _length = -1; + } } return _length.Value; } @@ -133,37 +148,52 @@ namespace Umbraco.Core.IO { if (_size == null) { - EnsureFileSupportsResizing(); - - using (var fs = _fs.OpenFile(Path)) + if (_fs.FileExists(Path)) { - using (var image = Image.FromStream(fs)) + EnsureFileSupportsResizing(); + + using (var fs = _fs.OpenFile(Path)) { - var fileWidth = image.Width; - var fileHeight = image.Height; - _size = new Size(fileWidth, fileHeight); + using (var image = Image.FromStream(fs)) + { + var fileWidth = image.Width; + var fileHeight = image.Height; + _size = new Size(fileWidth, fileHeight); + } } } + else + { + _size = new Size(-1, -1); + } } return _size.Value; } public string Resize(int width, int height) { - EnsureFileSupportsResizing(); + if (Exists) + { + EnsureFileSupportsResizing(); - var fileNameThumb = DoResize(width, height, 0, string.Empty); + var fileNameThumb = DoResize(width, height, 0, string.Empty); - return _fs.GetUrl(fileNameThumb); + return _fs.GetUrl(fileNameThumb); + } + return string.Empty; } public string Resize(int maxWidthHeight, string fileNameAddition) { - EnsureFileSupportsResizing(); + if (Exists) + { + EnsureFileSupportsResizing(); - var fileNameThumb = DoResize(GetDimensions().Width, GetDimensions().Height, maxWidthHeight, fileNameAddition); + var fileNameThumb = DoResize(GetDimensions().Width, GetDimensions().Height, maxWidthHeight, fileNameAddition); - return _fs.GetUrl(fileNameThumb); + return _fs.GetUrl(fileNameThumb); + } + return string.Empty; } private string DoResize(int width, int height, int maxWidthHeight, string fileNameAddition) @@ -180,7 +210,7 @@ namespace Umbraco.Core.IO return thumbnail.FileName; } - } + } } private void EnsureFileSupportsResizing() diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index eaa2805e48..a48891e8ca 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -31,11 +31,8 @@ namespace Umbraco.Core.Services private readonly RepositoryFactory _repositoryFactory; private readonly IDatabaseUnitOfWorkProvider _uowProvider; private Dictionary _importedContentTypes; - - //Support recursive locks because some of the methods that require locking call other methods that require locking. - //for example, the Move method needs to be locked but this calls the Save method which also needs to be locked. - private static readonly ReaderWriterLockSlim Locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); - + + public PackagingService(IContentService contentService, IContentTypeService contentTypeService, IMediaService mediaService, IDataTypeService dataTypeService, IFileService fileService, RepositoryFactory repositoryFactory, IDatabaseUnitOfWorkProvider uowProvider) { _contentService = contentService; diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index fabba3931b..85f8bae9be 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Belle.Tests var a = JsonConvert.DeserializeObject(@"[ { - id: '0EEBB7CE-51BA-4F6B-9D9C-78BB3314366C', + alias: 'Test.Test1', name: 'Test 1', editor: { view: '~/App_Plugins/MyPackage/PropertyEditors/MyEditor.html', diff --git a/src/Umbraco.Tests/Models/DataValueSetterTests.cs b/src/Umbraco.Tests/Models/DataValueSetterTests.cs deleted file mode 100644 index 5382858195..0000000000 --- a/src/Umbraco.Tests/Models/DataValueSetterTests.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Diagnostics; -using System.Xml; -using NUnit.Framework; -using Rhino.Mocks; -using Rhino.Mocks.Interfaces; -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Core.PropertyEditors; -using Umbraco.Core.Services; -using Umbraco.Core.Strings; -using Umbraco.Tests.TestHelpers; -using umbraco.cms.businesslogic.datatype; -using umbraco.interfaces; - -namespace Umbraco.Tests.Models -{ - [TestFixture] - public class DataValueSetterTests : BaseUmbracoApplicationTest - { - protected override void FreezeResolution() - { - ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper()); - PropertyEditorResolver.Current = new PropertyEditorResolver( - () => PluginManager.Current.ResolvePropertyEditors()); - base.FreezeResolution(); - } - - [Test] - public void LoadValueFromDatabase_Is_Not_Called_When_SetValue_Is_Used() - { - // Arrange - var baseDataType = MockRepository.GenerateStub(); - var dataTypeData = MockRepository.GenerateMock(baseDataType); - dataTypeData.Stub(x => x.Value).CallOriginalMethod(OriginalCallOptions.NoExpectation); - - // Act - - ((IDataValueSetter)dataTypeData).SetValue("Hello world", DataTypeDatabaseType.Nvarchar.ToString()); - var val = dataTypeData.Value; - - // Assert - - dataTypeData.AssertWasNotCalled(data => data.LoadValueFromDatabase()); - } - - [Test] - public void LoadValueFromDatabase_Is_Called_When_SetValue_Is_Not_Used() - { - // Arrange - var baseDataType = MockRepository.GenerateStub(); - var dataTypeData = MockRepository.GenerateMock(baseDataType); - dataTypeData - .Stub(data => data.LoadValueFromDatabase()).WhenCalled(invocation => Debug.WriteLine("asdf")); - dataTypeData.Stub(x => x.Value).CallOriginalMethod(OriginalCallOptions.NoExpectation); - - // Act - - var val = dataTypeData.Value; - - // Assert - - dataTypeData.AssertWasCalled(data => data.LoadValueFromDatabase()); - } - - [Test] - public void SetValue_Is_Called_When_Executing_ToXml_On_A_Property_With_DataType_That_Implements_IDataValueSetter() - { - // Arrange - var propEdId = Guid.NewGuid(); - - var dataTypeData = MockRepository.GenerateMock(); - - dataTypeData - .Stub(data => data.ToXMl(Arg.Is.Anything)) - .Return(null) // you have to call Return() even though we're about to override it - .WhenCalled(invocation => - { - var xmlDoc = (XmlDocument) invocation.Arguments[0]; - invocation.ReturnValue = xmlDoc.CreateElement("test"); - }); - - var dataType = MockRepository.GenerateStub(); - dataType.Stub(type => type.Data).Return(dataTypeData); - - var dataTypeSvc = MockRepository.GenerateStub(); - dataTypeSvc.Stub(service => service.GetDataTypeById(Arg.Is.Anything)).Return(dataType); - - var property = new Property( - 1234, - Guid.NewGuid(), - new PropertyType("test", DataTypeDatabaseType.Nvarchar) - { - Alias = "test" - }, "Hello world"); - - // Act - - var xml = property.ToXml(dataTypeSvc); - - // Assert - - ((IDataValueSetter)dataTypeData).AssertWasCalled(setter => setter.SetValue("Hello world", DataTypeDatabaseType.Nvarchar.ToString())); - } - - [TestCase(DataTypeDatabaseType.Nvarchar)] - [TestCase(DataTypeDatabaseType.Date)] - [TestCase(DataTypeDatabaseType.Integer)] - [TestCase(DataTypeDatabaseType.Ntext)] - public void DefaultData_SetValue_Ensures_Empty_String_When_Null_Value_Any_Data_Type(DataTypeDatabaseType type) - { - var defaultData = new DefaultData(MockRepository.GenerateMock()); - - ((IDataValueSetter)defaultData).SetValue(null, type.ToString()); - - Assert.AreEqual(string.Empty, defaultData.Value); - } - - } -} \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index c782a2fdfc..e410dfef9d 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -18,7 +18,7 @@ namespace Umbraco.Tests.Models.Mapping [TestFixture] public class ContentWebModelMappingTests : BaseDatabaseFactoryTest { - [PropertyEditor("00000000-0000-0000-0000-000000000000", "Test", "~/Test.html")] + [PropertyEditor("Test.Test", "Test", "~/Test.html")] public class TestPropertyEditor : PropertyEditor { @@ -123,8 +123,8 @@ namespace Umbraco.Tests.Models.Mapping var idSeed = 1; var contentType = MockedContentTypes.CreateSimpleContentType(); //add non-grouped properties - contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentType.AddPropertyType(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "nonGrouped1", Name = "Non Grouped 1", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentType.AddPropertyType(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "nonGrouped2", Name = "Non Grouped 2", Description = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); //set ids or it wont work contentType.Id = idSeed; foreach (var p in contentType.PropertyTypes) @@ -186,7 +186,7 @@ namespace Umbraco.Tests.Models.Mapping { Assert.AreEqual(content.Id, result.Id); Assert.AreEqual(0, result.Owner.UserId); - Assert.AreEqual("admin", result.Owner.Name); + Assert.AreEqual("Administrator", result.Owner.Name); Assert.AreEqual(content.ParentId, result.ParentId); Assert.AreEqual(content.UpdateDate, result.UpdateDate); Assert.AreEqual(content.CreateDate, result.CreateDate); diff --git a/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs b/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs index 3d4a88d4d5..b107e0b279 100644 --- a/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs +++ b/src/Umbraco.Tests/Persistence/Mappers/PropertyTypeMapperTest.cs @@ -60,16 +60,16 @@ namespace Umbraco.Tests.Persistence.Mappers } [Test] - public void Can_Map_DataTypeControlId_Property() + public void Can_Map_PropertyEditorAlias_Property() { // Arrange SqlSyntaxContext.SqlSyntaxProvider = SqlCeSyntax.Provider; // Act - string column = new PropertyTypeMapper().Map("DataTypeId"); + string column = new PropertyTypeMapper().Map("PropertyEditorAlias"); // Assert - Assert.That(column, Is.EqualTo("[cmsDataType].[controlId]")); + Assert.That(column, Is.EqualTo("[cmsDataType].[propertyEditorAlias]")); } [Test] diff --git a/src/Umbraco.Tests/PluginManagerTests.cs b/src/Umbraco.Tests/PluginManagerTests.cs index 1703c4be75..f8ec3f26bb 100644 --- a/src/Umbraco.Tests/PluginManagerTests.cs +++ b/src/Umbraco.Tests/PluginManagerTests.cs @@ -282,7 +282,7 @@ namespace Umbraco.Tests public void Resolves_Attributed_Trees() { var trees = PluginManager.Current.ResolveAttributedTrees(); - Assert.AreEqual(27, trees.Count()); + Assert.AreEqual(20, trees.Count()); } [Test] diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index 8ef80f63fb..8d725b976a 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -81,9 +81,9 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.TextboxAlias, DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); @@ -266,11 +266,11 @@ namespace Umbraco.Tests.TestHelpers.Entities }; var contentCollection = new PropertyTypeCollection(); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Nvarchar) { Alias = Constants.Conventions.Media.File, Name = "File", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); - contentCollection.Add(new PropertyType("test", DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.UploadFieldAlias, DataTypeDatabaseType.Nvarchar) { Alias = Constants.Conventions.Media.File, Name = "File", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Width, Name = "Width", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Height, Name = "Height", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Bytes, Name = "Bytes", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.NoEditAlias, DataTypeDatabaseType.Integer) { Alias = Constants.Conventions.Media.Extension, Name = "File Extension", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -90 }); mediaType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Media", SortOrder = 1 }); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 60398719b2..cc1dfdf6eb 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -238,7 +238,6 @@ - diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/PostcodePropertyEditor.cs b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/PostcodePropertyEditor.cs index f4cd12d3f9..da6eddc8c7 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/PostcodePropertyEditor.cs +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/PostcodePropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.UI.App_Plugins.MyPackage.PropertyEditors { - [PropertyEditor("E96E24E5-7124-4FA8-A7D7-C3D3695E100D", "Postal Code", + [PropertyEditor("MyPackage.PostalCode", "Postal Code", "~/App_Plugins/MyPackage/PropertyEditors/Views/PostcodeEditor.html")] public class PostcodePropertyEditor : PropertyEditor { diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/ServerInfoPropertyEditor.cs b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/ServerInfoPropertyEditor.cs index d03f09a08f..03974c7c2e 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/ServerInfoPropertyEditor.cs +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/ServerInfoPropertyEditor.cs @@ -8,7 +8,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.UI.App_Plugins.MyPackage.PropertyEditors { - [PropertyEditor("AD056473-492B-47F8-9613-5A4936666C67", "Server Info")] + [PropertyEditor("MyPackage.ServerInfo", "Server Info")] public class ServerInfoPropertyEditor : PropertyEditor { //cache the URL since these values get called numerous times. diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 9a4585ed08..02e047cec1 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -879,13 +879,6 @@ - - - - - - - diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/index.html b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/index.html deleted file mode 100644 index 1be1aca58b..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - -

XQuery CodeMirror Mode

-

-

-
    -
-
- - diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testBase.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testBase.js deleted file mode 100644 index c014bb12fe..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testBase.js +++ /dev/null @@ -1,42 +0,0 @@ - $(document).ready(function(){ - module("testBase"); - test("eviltest", function() { - expect(1); - - var input = 'xquery version "1.0-ml";\ - (: this is\ - : a \ - "comment" :)\ - let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x>\ - let $joe:=1\ - return element element {\ - attribute attribute { 1 },\ - element test { 'a' }, \ - attribute foo { "bar" },\ - fn:doc()[ foo/@bar eq $let ],\ - //x } \ - \ - (: a more \'evil\' test :)\ - (: Modified Blakeley example (: with nested comment :) ... :)\ - declare private function local:declare() {()};\ - declare private function local:private() {()};\ - declare private function local:function() {()};\ - declare private function local:local() {()};\ - let $let := <let>let $let := "let"</let>\ - return element element {\ - attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\ - attribute fn:doc { "bar" castable as xs:string },\ - element text { text { "text" } },\ - fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\ - //fn:doc\ - }'; - var expected = 'xquery version "1.0-ml"; (: this is : a "comment" :) let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> let $joe:=1 return element element { attribute attribute { 1 }, element test { \'a\' }, attribute foo { "bar" }, fn:doc()[ foo/@bar eq $let ], //x } (: a more \'evil\' test :) (: Modified Blakeley example (: with nested comment :) ... :) declare private function local:declare() {()}; declare private function local:private() {()}; declare private function local:function() {()}; declare private function local:local() {()}; let $let := <let>let $let := "let"</let> return element element { attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, attribute fn:doc { "bar" castable as xs:string }, element text { text { "text" } }, fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], //fn:doc }'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testEmptySequenceKeyword.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testEmptySequenceKeyword.js deleted file mode 100644 index 7fed00debc..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testEmptySequenceKeyword.js +++ /dev/null @@ -1,16 +0,0 @@ -$(document).ready(function(){ - module("testEmptySequenceKeyword"); - test("testEmptySequenceKeyword", function() { - expect(1); - - var input = '"foo" instance of empty-sequence()'; - var expected = '"foo" instance of empty-sequence()'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); -}); diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testMultiAttr.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testMultiAttr.js deleted file mode 100644 index 62d7d736fe..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testMultiAttr.js +++ /dev/null @@ -1,16 +0,0 @@ - $(document).ready(function(){ - module("testMultiAttr"); - test("test1", function() { - expect(1); - - var expected = '<p a1="foo" a2="bar">hello world</p>'; - - $("#sandbox").html(''); - $("#editor").html('

hello world

'); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testNamespaces.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testNamespaces.js deleted file mode 100644 index 2fb2b98d8d..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testNamespaces.js +++ /dev/null @@ -1,91 +0,0 @@ -$(document).ready(function(){ - module("test namespaces"); - -// -------------------------------------------------------------------------------- -// this test is based on this: -//http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq -// -------------------------------------------------------------------------------- - test("test namespaced variable", function() { - expect(1); - - var input = 'declare namespace e = "http://example.com/ANamespace";\ -declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; - - var expected = 'declare namespace e = "http://example.com/ANamespace";declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-002.xq -// -------------------------------------------------------------------------------- - test("test EQName variable", function() { - expect(1); - - var input = 'declare variable $"http://www.example.com/ns/my":var := 12;\ -{$"http://www.example.com/ns/my":var}'; - - var expected = 'declare variable $"http://www.example.com/ns/my":var := 12;<out>{$"http://www.example.com/ns/my":var}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq -// -------------------------------------------------------------------------------- - test("test EQName function", function() { - expect(1); - - var input = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer {\ - $a + 2\ -};\ -{"http://www.example.com/ns/my":fn(12)}'; - - var expected = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer { $a + 2};<out>{"http://www.example.com/ns/my":fn(12)}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -// -------------------------------------------------------------------------------- -// this test is based on: -// http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq -// -------------------------------------------------------------------------------- - test("test EQName function with single quotes", function() { - expect(1); - - var input = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer {\ - $a + 2\ -};\ -{\'http://www.example.com/ns/my\':fn(12)}'; - - var expected = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer { $a + 2};<out>{\'http://www.example.com/ns/my\':fn(12)}</out>'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - -}); - - diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testProcessingInstructions.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testProcessingInstructions.js deleted file mode 100644 index 6d0275bf96..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testProcessingInstructions.js +++ /dev/null @@ -1,16 +0,0 @@ -$(document).ready(function(){ - module("testProcessingInstructions"); - test("testProcessingInstructions", function() { - expect(1); - - var input = 'data() instance of xs:string'; - var expected = 'data(<?target content?>) instance of xs:string'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); -}); diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testQuotes.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testQuotes.js deleted file mode 100644 index d51ac1b07b..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/mode/xquery/test/testQuotes.js +++ /dev/null @@ -1,19 +0,0 @@ - $(document).ready(function(){ - module("testQuoteEscape"); - test("testQuoteEscapeDouble", function() { - expect(1); - - var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ -let $keysfolder := concat($rootfolder, "keys\\")\ -return\ -$keysfolder'; - var expected = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"let $keysfolder := concat($rootfolder, "keys\\")return$keysfolder'; - - $("#sandbox").html(''); - var editor = CodeMirror.fromTextArea($("#editor")[0]); - var result = $(".CodeMirror-lines div div pre")[0].innerHTML; - - equal(result, expected); - $("#editor").html(""); - }); - }); diff --git a/src/Umbraco.Web/PropertyEditors/CheckBoxListPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/CheckBoxListPropertyEditor.cs index 6eb6feb93a..da2aa7f3bc 100644 --- a/src/Umbraco.Web/PropertyEditors/CheckBoxListPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/CheckBoxListPropertyEditor.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.PropertyEditors /// as INT and we have logic in here to ensure it is formatted correctly including ensuring that the string value is published /// in cache and not the int ID. /// - [PropertyEditor(Constants.PropertyEditors.CheckBoxList, "Checkbox list", "checkboxlist")] + [PropertyEditor(Constants.PropertyEditors.CheckBoxListAlias, "Checkbox list", "checkboxlist")] public class CheckBoxListPropertyEditor : PropertyEditor { diff --git a/src/Umbraco.Web/PropertyEditors/ColorPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ColorPickerPropertyEditor.cs index 2c61e9e9df..9cd5803ac7 100644 --- a/src/Umbraco.Web/PropertyEditors/ColorPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ColorPickerPropertyEditor.cs @@ -9,7 +9,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.ColorPicker, "Color Picker", "colorpicker")] + [PropertyEditor(Constants.PropertyEditors.ColorPickerAlias, "Color Picker", "colorpicker")] public class ColorPickerPropertyEditor : PropertyEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs index d3f0b75ba4..2e205cbe47 100644 --- a/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ContentPickerPropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.ContentPicker, "Content Picker", "contentpicker")] + [PropertyEditor(Constants.PropertyEditors.ContentPickerAlias, "Content Picker", "contentpicker")] public class ContentPickerPropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/PropertyEditors/DatePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DatePropertyEditor.cs index 8c65fca05e..91d5801222 100644 --- a/src/Umbraco.Web/PropertyEditors/DatePropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DatePropertyEditor.cs @@ -8,7 +8,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.Date, "Date", "DATE", "datepicker")] + [PropertyEditor(Constants.PropertyEditors.DateAlias, "Date", "DATE", "datepicker")] public class DatePropertyEditor : PropertyEditor { public DatePropertyEditor() diff --git a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs index bb4719975b..d1cd446cb1 100644 --- a/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DateTimePropertyEditor.cs @@ -5,7 +5,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.DateTime, "Date/Time", "datepicker", ValueType = "DATETIME")] + [PropertyEditor(Constants.PropertyEditors.DateTimeAlias, "Date/Time", "datepicker", ValueType = "DATETIME")] public class DateTimePropertyEditor : PropertyEditor { public DateTimePropertyEditor() diff --git a/src/Umbraco.Web/PropertyEditors/DropDownMultiplePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DropDownMultiplePropertyEditor.cs index 1210964869..2ffa1f6078 100644 --- a/src/Umbraco.Web/PropertyEditors/DropDownMultiplePropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DropDownMultiplePropertyEditor.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.PropertyEditors /// Due to maintaining backwards compatibility this data type stores the value as a string which is a comma separated value of the /// ids of the individual items so we have logic in here to deal with that. /// - [PropertyEditor(Constants.PropertyEditors.DropDownListMultiple, "Dropdown list multiple", "dropdown")] + [PropertyEditor(Constants.PropertyEditors.DropDownListMultipleAlias, "Dropdown list multiple", "dropdown")] public class DropDownMultiplePropertyEditor : DropDownMultipleWithKeysPropertyEditor { protected override ValueEditor CreateValueEditor() diff --git a/src/Umbraco.Web/PropertyEditors/DropDownMultipleWithKeysPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DropDownMultipleWithKeysPropertyEditor.cs index bae09a5cf8..9f5c543089 100644 --- a/src/Umbraco.Web/PropertyEditors/DropDownMultipleWithKeysPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DropDownMultipleWithKeysPropertyEditor.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.PropertyEditors /// Due to maintaining backwards compatibility this data type stores the value as a string which is a comma separated value of the /// ids of the individual items so we have logic in here to deal with that. /// - [PropertyEditor(Constants.PropertyEditors.DropdownlistMultiplePublishKeys, "Dropdown list multiple, publish keys", "dropdown")] + [PropertyEditor(Constants.PropertyEditors.DropdownlistMultiplePublishKeysAlias, "Dropdown list multiple, publish keys", "dropdown")] public class DropDownMultipleWithKeysPropertyEditor : DropDownPropertyEditor { protected override ValueEditor CreateValueEditor() diff --git a/src/Umbraco.Web/PropertyEditors/DropDownPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DropDownPropertyEditor.cs index f69199b8bc..e1a1e3469f 100644 --- a/src/Umbraco.Web/PropertyEditors/DropDownPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DropDownPropertyEditor.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.PropertyEditors /// as INT and we have logic in here to ensure it is formatted correctly including ensuring that the string value is published /// in cache and not the int ID. /// - [PropertyEditor(Constants.PropertyEditors.DropDownList, "Dropdown list", "dropdown", ValueType = "INT")] + [PropertyEditor(Constants.PropertyEditors.DropDownListAlias, "Dropdown list", "dropdown", ValueType = "INT")] public class DropDownPropertyEditor : DropDownWithKeysPropertyEditor { @@ -29,18 +29,4 @@ namespace Umbraco.Web.PropertyEditors } } - - /// - /// A property editor to allow the individual selection of pre-defined items. - /// - /// - /// Due to remaining backwards compatible, this stores the id of the item in the database which is why it is marked - /// as INT and we have logic in here to ensure it is formatted correctly including ensuring that the INT ID value is published - /// in cache and not the string value. - /// - [PropertyEditor(Constants.PropertyEditors.RadioButtonList, "Radio button list", "radiobuttons", ValueType = "INT")] - public class RadioButtonsPropertyEditor : DropDownWithKeysPropertyEditor - { - - } } \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/DropDownWithKeysPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/DropDownWithKeysPropertyEditor.cs index 14f3cf6577..f0d695a7eb 100644 --- a/src/Umbraco.Web/PropertyEditors/DropDownWithKeysPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/DropDownWithKeysPropertyEditor.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.PropertyEditors /// as INT and we have logic in here to ensure it is formatted correctly including ensuring that the INT ID value is published /// in cache and not the string value. /// - [PropertyEditor(Constants.PropertyEditors.DropdownlistPublishingKeys, "Dropdown list, publishing keys", "dropdown", ValueType = "INT")] + [PropertyEditor(Constants.PropertyEditors.DropdownlistPublishingKeysAlias, "Dropdown list, publishing keys", "dropdown", ValueType = "INT")] public class DropDownWithKeysPropertyEditor : PropertyEditor { diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index 182da1880f..5151ba8ac1 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -14,7 +14,7 @@ using Umbraco.Core.Services; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.UploadField, "File upload", "fileupload")] + [PropertyEditor(Constants.PropertyEditors.UploadFieldAlias, "File upload", "fileupload")] public class FileUploadPropertyEditor : PropertyEditor { /// @@ -122,7 +122,9 @@ namespace Umbraco.Web.PropertyEditors private static void UpdateContentProperty(XmlNode uploadFieldConfigNode, IContentBase content, string configPropertyAlias, object propertyValue) { var propertyNode = uploadFieldConfigNode.SelectSingleNode(configPropertyAlias); - if (propertyNode != null && string.IsNullOrEmpty(propertyNode.FirstChild.Value) == false) + if (propertyNode != null + && string.IsNullOrEmpty(propertyNode.FirstChild.Value) == false + && content.Properties.Contains(propertyNode.FirstChild.Value)) { var property = content.Properties[propertyNode.FirstChild.Value]; if (property != null) diff --git a/src/Umbraco.Web/PropertyEditors/IntegerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/IntegerPropertyEditor.cs index 689d4c8672..54e514eab6 100644 --- a/src/Umbraco.Web/PropertyEditors/IntegerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/IntegerPropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.Integer, "Numeric", "integer")] + [PropertyEditor(Constants.PropertyEditors.IntegerAlias, "Numeric", "integer")] public class IntegerPropertyEditor : PropertyEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/LabelPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/LabelPropertyEditor.cs index abaab08bcf..73a5380e41 100644 --- a/src/Umbraco.Web/PropertyEditors/LabelPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/LabelPropertyEditor.cs @@ -5,7 +5,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.NoEdit, "Label", "readonlyvalue")] + [PropertyEditor(Constants.PropertyEditors.NoEditAlias, "Label", "readonlyvalue")] public class LabelPropertyEditor : PropertyEditor { diff --git a/src/Umbraco.Web/PropertyEditors/MediaPicker.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs similarity index 82% rename from src/Umbraco.Web/PropertyEditors/MediaPicker.cs rename to src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs index f171de7c64..1319edf3dd 100644 --- a/src/Umbraco.Web/PropertyEditors/MediaPicker.cs +++ b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs @@ -1,23 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Umbraco.Core; -using Umbraco.Core.PropertyEditors; - - -namespace Umbraco.Web.PropertyEditors -{ - [PropertyEditor(Constants.PropertyEditors.MediaPicker, "Media Picker", "mediapicker")] - public class MediaPickerPropertyEditor : PropertyEditor - { - protected override ValueEditor CreateValueEditor() - { - //TODO: Need to add some validation to the ValueEditor to ensure that any media chosen actually exists! - - return base.CreateValueEditor(); - } - - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core; +using Umbraco.Core.PropertyEditors; + + +namespace Umbraco.Web.PropertyEditors +{ + [PropertyEditor(Constants.PropertyEditors.MediaPickerAlias, "Media Picker", "mediapicker")] + public class MediaPickerPropertyEditor : PropertyEditor + { + protected override ValueEditor CreateValueEditor() + { + //TODO: Need to add some validation to the ValueEditor to ensure that any media chosen actually exists! + + return base.CreateValueEditor(); + } + + } +} diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs index 1d7f55ffad..c88c15cfad 100644 --- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs @@ -13,7 +13,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.MultipleTextstring, "Multiple Textbox", "multipletextbox", ValueType = "TEXT")] + [PropertyEditor(Constants.PropertyEditors.MultipleTextstringAlias, "Multiple Textbox", "multipletextbox", ValueType = "TEXT")] public class MultipleTextStringPropertyEditor : PropertyEditor { protected override ValueEditor CreateValueEditor() diff --git a/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs new file mode 100644 index 0000000000..5a97f0de15 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/RadioButtonsPropertyEditor.cs @@ -0,0 +1,19 @@ +using Umbraco.Core; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Web.PropertyEditors +{ + /// + /// A property editor to allow the individual selection of pre-defined items. + /// + /// + /// Due to remaining backwards compatible, this stores the id of the item in the database which is why it is marked + /// as INT and we have logic in here to ensure it is formatted correctly including ensuring that the INT ID value is published + /// in cache and not the string value. + /// + [PropertyEditor(Constants.PropertyEditors.RadioButtonListAlias, "Radio button list", "radiobuttons", ValueType = "INT")] + public class RadioButtonsPropertyEditor : DropDownWithKeysPropertyEditor + { + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index a12421598d..551f08f972 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.TinyMCEv3, "Rich Text Editor", "rte")] + [PropertyEditor(Constants.PropertyEditors.TinyMCEv3Alias, "Rich Text Editor", "rte")] public class RichTextPropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs index 4fff335a69..ad761fba6d 100644 --- a/src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TextAreaPropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.TextboxMultiple, "Textarea", "textarea")] + [PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea")] public class TextAreaPropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs index 9734173858..f70132f4a0 100644 --- a/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TextboxPropertyEditor.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Services; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.Textbox, "Textbox", "textbox")] + [PropertyEditor(Constants.PropertyEditors.TextboxAlias, "Textbox", "textbox")] public class TextboxPropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs index 6062a3b7ed..4ba1d8330a 100644 --- a/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs @@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.TrueFalse, "True/False", "boolean")] + [PropertyEditor(Constants.PropertyEditors.TrueFalseAlias, "True/False", "boolean")] public class TrueFalsePropertyEditor : PropertyEditor { } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index ac6b6b83f1..99feaa2289 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -327,10 +327,11 @@ - + + diff --git a/src/umbraco.cms/businesslogic/datatype/DefaultData.cs b/src/umbraco.cms/businesslogic/datatype/DefaultData.cs index 3f01f1f62c..d192385d8b 100644 --- a/src/umbraco.cms/businesslogic/datatype/DefaultData.cs +++ b/src/umbraco.cms/businesslogic/datatype/DefaultData.cs @@ -15,7 +15,7 @@ namespace umbraco.cms.businesslogic.datatype /// Default implementation of the IData interface that stores data inside the Umbraco database. /// [Obsolete("This class is no longer used and will be removed from the codebase in the future.")] - public class DefaultData : IData, IDataWithPreview, IDataValueSetter + public class DefaultData : IData, IDataWithPreview { private int _propertyId; private object _value; @@ -57,37 +57,7 @@ namespace umbraco.cms.businesslogic.datatype _propertyId = InitPropertyId; _value = InitValue; } - - /// - /// This is here for performance reasons since in some cases we will have already resolved the value from the db - /// and want to just give this object the value so it doesn't go re-look it up from the database. - /// - /// - /// - void IDataValueSetter.SetValue(object val, string strDbType) - { - //We need to ensure that val is not a null value, if it is then we'll convert this to an empty string. - //The reason for this is because by default the DefaultData.Value property returns an empty string when - // there is no value, this is based on the PropertyDataDto.GetValue return value which defaults to an - // empty string (which is called from this class's method LoadValueFromDatabase). - //Some legacy implementations of DefaultData are expecting an empty string when there is - // no value so we need to keep this consistent. - if (val == null) - { - val = string.Empty; - } - - _value = val; - //now that we've set our value, we can update our BaseDataType object with the correct values from the db - //instead of making it query for itself. This is a peformance optimization enhancement. - var dbType = BaseDataType.GetDBType(strDbType); - var fieldName = BaseDataType.GetDataFieldName(dbType); - _dataType.SetDataTypeProperties(fieldName, dbType); - - //ensures that it doesn't go back to the db - _valueLoaded = true; - } - + /// /// Loads the data value from the database. /// diff --git a/src/umbraco.interfaces/IData.cs b/src/umbraco.interfaces/IData.cs index 17a374ff05..d113bcefea 100644 --- a/src/umbraco.interfaces/IData.cs +++ b/src/umbraco.interfaces/IData.cs @@ -3,20 +3,12 @@ using System.Xml; namespace umbraco.interfaces { - /// - /// Internal interface used to decorate any IData that can be optimized when exporting - /// XML like in the packaging service. Instead of relying on the IData to go get the value - /// from the db, any IData that implements this can have it's value set from the packaging service. - /// - internal interface IDataValueSetter - { - void SetValue(object val, string strDbType); - } /// /// The IData is part of the IDataType interface for creating new data types in the umbraco backoffice. /// The IData represents the actual value entered by the user. /// + [Obsolete("IData is obsolete and is no longer used, it will be removed from the codebase in future versions")] public interface IData { ///