Merge remote-tracking branch 'origin/6.1.4' into 7.0.0

Conflicts:
	.gitignore
	src/Umbraco.Core/Models/PropertyExtensions.cs
	src/Umbraco.Core/Models/PropertyTypeExtensions.cs
	src/Umbraco.Core/Security/AuthenticationExtensions.cs
	src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs
	src/Umbraco.Core/Security/UserData.cs
	src/Umbraco.Core/Umbraco.Core.csproj
	src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
	src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs
	src/Umbraco.Tests/Umbraco.Tests.csproj
	src/Umbraco.Web/Security/WebSecurity.cs
	src/Umbraco.Web/UmbracoModule.cs
	src/umbraco.businesslogic/BasePages/BasePage.cs
	src/umbraco.cms/businesslogic/datatype/DefaultData.cs
	src/umbraco.sln
This commit is contained in:
Shannon
2013-08-07 10:29:34 +10:00
27 changed files with 540 additions and 200 deletions

View File

@@ -303,6 +303,8 @@ namespace Umbraco.Core
connString = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName].ConnectionString;
}
Initialize(providerName, connString);
DetermineSqlServerVersion();
}
else if (ConfigurationManager.AppSettings.ContainsKey(GlobalSettings.UmbracoConnectionName) && string.IsNullOrEmpty(ConfigurationManager.AppSettings[GlobalSettings.UmbracoConnectionName]) == false)
{
@@ -339,6 +341,8 @@ namespace Umbraco.Core
//Remove the legacy connection string, so we don't end up in a loop if something goes wrong.
GlobalSettings.RemoveSetting(GlobalSettings.UmbracoConnectionName);
DetermineSqlServerVersion();
}
else
{
@@ -372,6 +376,49 @@ namespace Umbraco.Core
Initialize(providerName);
}
/// <summary>
/// Set the lazy resolution of determining the SQL server version if that is the db type we're using
/// </summary>
private void DetermineSqlServerVersion()
{
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if (sqlServerSyntax != null)
{
//this will not execute now, it is lazy so will only execute when we need to actually know
// the sql server version.
sqlServerSyntax.VersionName = new Lazy<SqlServerVersionName>(() =>
{
try
{
var database = this._factory.CreateDatabase();
var version = database.ExecuteScalar<string>("SELECT SERVERPROPERTY('productversion')");
var firstPart = version.Split('.')[0];
switch (firstPart)
{
case "11":
return SqlServerVersionName.V2012;
case "10":
return SqlServerVersionName.V2008;
case "9":
return SqlServerVersionName.V2005;
case "8":
return SqlServerVersionName.V2000;
case "7":
return SqlServerVersionName.V7;
default:
return SqlServerVersionName.Other;
}
}
catch (Exception)
{
return SqlServerVersionName.Invalid;
}
});
}
}
internal DatabaseSchemaResult ValidateDatabaseSchema()
{
if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName)))
@@ -463,6 +510,8 @@ namespace Umbraco.Core
message = message + "<p>Upgrade completed!</p>";
}
//now that everything is done, we need to determine the version of SQL server that is executing
LogHelper.Info<DatabaseContext>("Database configuration status: " + message);
return new Result { Message = message, Success = true, Percentage = "100" };

View File

@@ -15,7 +15,12 @@ namespace Umbraco.Core.Models
/// <returns>Xml of the property and its value</returns>
public static XElement ToXml(this Property property)
{
string nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
return property.ToXml(ApplicationContext.Current.Services.DataTypeService);
}
internal static XElement ToXml(this Property property, IDataTypeService dataTypeService)
{
var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias();
var xd = new XmlDocument();
var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, "");
@@ -37,6 +42,16 @@ namespace Umbraco.Core.Models
//var dataType = ApplicationContext.Current.Services.DataTypeService.GetDataTypeDefinitionById(property.PropertyType.DataTypeDefinitionId);
//if (dataType == null) throw new InvalidOperationException("No data type definition found with id " + property.PropertyType.DataTypeDefinitionId);
//We've already got the value for the property so we're going to give it to the
// data type's data property so it doesn't go re-look up the value from the db again.
var defaultData = dt.Data as IDataValueSetter;
if (defaultData != null)
{
defaultData.SetValue(property.Value, property.PropertyType.DataTypeDatabaseType.ToString());
}
xmlNode.AppendChild(dt.Data.ToXMl(xd));
var propertyEditor = PropertyEditorResolver.Current.GetById(property.PropertyType.DataTypeId);
if (propertyEditor != null)
{

View File

@@ -1,4 +1,5 @@
using System;
using Umbraco.Core.Services;
using umbraco.interfaces;
namespace Umbraco.Core.Models
@@ -10,6 +11,7 @@ namespace Umbraco.Core.Models
/// </summary>
/// <param name="propertyType">PropertyType that references a DataType</param>
/// <param name="propertyId">Id of the Property which references this DataType through its PropertyType</param>
/// <param name="dataTypeService"></param>
/// <returns><see cref="IDataType"/></returns>
/// <remarks>
/// This extension method is left internal because we don't want to take
@@ -17,10 +19,10 @@ namespace Umbraco.Core.Models
/// be replaced by PropertyEditors. It is however needed to generate xml
/// for a property/propertytype when publishing.
/// </remarks>
internal static IDataType DataType(this PropertyType propertyType, int propertyId)
internal static IDataType DataType(this PropertyType propertyType, int propertyId, IDataTypeService dataTypeService)
{
Mandate.ParameterNotNull(propertyType, "propertyType");
var dataType = ApplicationContext.Current.Services.DataTypeService.GetDataTypeById(propertyType.DataTypeId);
var dataType = dataTypeService.GetDataTypeById(propertyType.DataTypeId);
if (dataType == null)
throw new InvalidOperationException("No IDataType found for control ID " + propertyType.DataTypeId);

View File

@@ -51,7 +51,10 @@ namespace Umbraco.Core.Persistence
try
{
if (SqlSyntaxContext.SqlSyntaxProvider is SqlCeSyntaxProvider)
//if it is sql ce or it is a sql server version less than 2008, we need to do individual inserts.
var sqlServerSyntax = SqlSyntaxContext.SqlSyntaxProvider as SqlServerSyntaxProvider;
if ((sqlServerSyntax != null && (int)sqlServerSyntax.VersionName.Value < (int)SqlServerVersionName.V2008)
|| SqlSyntaxContext.SqlSyntaxProvider is SqlCeSyntaxProvider)
{
//SqlCe doesn't support bulk insert statements!

View File

@@ -339,12 +339,12 @@ namespace Umbraco.Core.Persistence.Repositories
}
}
var contentVersionDto = dto.ContentVersionDto;
if (shouldCreateNewVersion)
{
//Look up (newest) entries by id in cmsDocument table to set newest = false
//NOTE: This is only relevant when a new version is created, which is why its done inside this if-statement.
var documentDtos = Database.Fetch<DocumentDto>("WHERE nodeId = @Id AND newest = @IsNewest", new { Id = entity.Id, IsNewest = true });
//NOTE: This should only be done for all other versions then the current one, so we don't cause the same entry to be updated multiple times.
var documentDtos =
Database.Query<DocumentDto>(
"WHERE nodeId = @Id AND newest = @IsNewest AND NOT(versionId = @VersionId)",
new {Id = entity.Id, IsNewest = true, VersionId = dto.ContentVersionDto.VersionId});
foreach (var documentDto in documentDtos)
{
var docDto = documentDto;
@@ -352,6 +352,9 @@ namespace Umbraco.Core.Persistence.Repositories
Database.Update(docDto);
}
var contentVersionDto = dto.ContentVersionDto;
if (shouldCreateNewVersion)
{
//Create a new version - cmsContentVersion
//Assumes a new Version guid and Version date (modified date) has been set
Database.Insert(contentVersionDto);

View File

@@ -13,6 +13,20 @@ namespace Umbraco.Core.Persistence.SqlSyntax
public static ISqlSyntaxProvider Provider { get { return new SqlServerSyntaxProvider(); } }
}
/// <summary>
/// Represents the version name of SQL server (i.e. the year 2008, 2005, etc...)
/// </summary>
internal enum SqlServerVersionName
{
Invalid = -1,
V7 = 0,
V2000 = 1,
V2005 = 2,
V2008 = 3,
V2012 = 4,
Other = 5
}
/// <summary>
/// Represents an SqlSyntaxProvider for Sql Server
/// </summary>
@@ -36,6 +50,11 @@ namespace Umbraco.Core.Persistence.SqlSyntax
InitColumnTypeMap();
}
/// <summary>
/// Gets/sets the version of the current SQL server instance
/// </summary>
internal Lazy<SqlServerVersionName> VersionName { get; set; }
public override string GetQuotedTableName(string tableName)
{
return string.Format("[{0}]", tableName);

View File

@@ -8,15 +8,14 @@ namespace Umbraco.Core.Publishing
/// </summary>
internal class PublishStatus
{
public IContent ContentItem { get; private set; }
public PublishStatusType StatusType { get; internal set; }
/// <summary>
/// Gets sets the invalid properties if the status failed due to validation.
/// </summary>
public IEnumerable<Property> InvalidProperties { get; set; }
public PublishStatus()
{
//initialize
InvalidProperties = new List<Property>();
}
public PublishStatus(IContent content, PublishStatusType statusType)
: this()
{
ContentItem = content;
StatusType = statusType;
@@ -30,5 +29,12 @@ namespace Umbraco.Core.Publishing
{
}
public IContent ContentItem { get; private set; }
public PublishStatusType StatusType { get; internal set; }
/// <summary>
/// Gets sets the invalid properties if the status failed due to validation.
/// </summary>
public IEnumerable<Property> InvalidProperties { get; set; }
}
}

View File

@@ -1,4 +1,6 @@
using System.Web.Security;
using System;
using System.Web;
using System.Web.Security;
using Newtonsoft.Json;
namespace Umbraco.Core.Security
@@ -15,6 +17,7 @@ namespace Umbraco.Core.Security
: base(ticket)
{
UserData = ticket.UserData;
EnsureDeserialized();
}
protected readonly string UserData;
@@ -24,54 +27,33 @@ namespace Umbraco.Core.Security
{
get
{
EnsureDeserialized();
return DeserializedData.StartContentNode;
}
}
public int StartMediaNode
{
get
{
EnsureDeserialized();
return DeserializedData.StartMediaNode;
}
get { return DeserializedData.StartMediaNode; }
}
public string[] AllowedApplications
{
get
{
EnsureDeserialized();
return DeserializedData.AllowedApplications;
}
get { return DeserializedData.AllowedApplications; }
}
public object Id
{
get
{
EnsureDeserialized();
return DeserializedData.Id;
}
get { return DeserializedData.Id; }
}
public string RealName
{
get
{
EnsureDeserialized();
return DeserializedData.RealName;
}
get { return DeserializedData.RealName; }
}
public string Culture
{
get
{
EnsureDeserialized();
return DeserializedData.Culture;
}
get { return DeserializedData.Culture; }
}
//public int SessionTimeout
@@ -85,24 +67,42 @@ namespace Umbraco.Core.Security
public string[] Roles
{
get
{
EnsureDeserialized();
return DeserializedData.Roles;
}
get { return DeserializedData.Roles; }
}
/// <summary>
/// This will ensure we only deserialize once
/// </summary>
/// <remarks>
/// For performance reasons, we'll also check if there's an http context available,
/// if so, we'll chuck our instance in there so that we only deserialize once per request.
/// </remarks>
protected void EnsureDeserialized()
{
if (DeserializedData != null)
return;
if (string.IsNullOrEmpty(UserData))
if (HttpContext.Current != null)
{
DeserializedData = new UserData();
//check if we've already done this in this request
var data = HttpContext.Current.Items[typeof(UmbracoBackOfficeIdentity)] as UserData;
if (data != null)
{
DeserializedData = data;
return;
}
}
if (string.IsNullOrEmpty(UserData))
{
throw new NullReferenceException("The " + typeof(UserData) + " found in the ticket cannot be empty");
}
DeserializedData = JsonConvert.DeserializeObject<UserData>(UserData);
if (HttpContext.Current != null)
{
HttpContext.Current.Items[typeof (UmbracoBackOfficeIdentity)] = DeserializedData;
}
}
}
}

View File

@@ -1479,7 +1479,12 @@ namespace Umbraco.Core.Services
LogHelper.Info<ContentService>(
string.Format("Content '{0}' with Id '{1}' could not be published because of invalid properties.",
content.Name, content.Id));
result.Add(new Attempt<PublishStatus>(false, new PublishStatus(content, PublishStatusType.FailedContentInvalid)));
result.Add(
new Attempt<PublishStatus>(false,
new PublishStatus(content, PublishStatusType.FailedContentInvalid)
{
InvalidProperties = ((ContentBase) content).LastInvalidProperties
}));
return result;
}

View File

@@ -13,6 +13,7 @@ namespace Umbraco.Core
/// </summary>
public static class UriExtensions
{
/// <summary>
/// Checks if the current uri is a back office request
/// </summary>
@@ -20,11 +21,14 @@ namespace Umbraco.Core
/// <returns></returns>
internal static bool IsBackOfficeRequest(this Uri url)
{
var authority = url.GetLeftPart(UriPartial.Authority);
var afterAuthority = url.GetLeftPart(UriPartial.Query)
.TrimStart(authority)
.TrimStart("/");
//check if this is in the umbraco back office
return afterAuthority.InvariantStartsWith(GlobalSettings.Path.TrimStart("/"));
}

View File

@@ -0,0 +1,102 @@
using System;
using System.Diagnostics;
using System.Xml;
using NUnit.Framework;
using Rhino.Mocks;
using Rhino.Mocks.Interfaces;
using Umbraco.Core.Models;
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());
base.FreezeResolution();
}
[Test]
public void LoadValueFromDatabase_Is_Not_Called_When_SetValue_Is_Used()
{
// Arrange
var baseDataType = MockRepository.GenerateStub<BaseDataType>();
var dataTypeData = MockRepository.GenerateMock<DefaultData>(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<BaseDataType>();
var dataTypeData = MockRepository.GenerateMock<DefaultData>(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 dataTypeId = Guid.NewGuid();
var dataTypeData = MockRepository.GenerateMock<IData, IDataValueSetter>();
dataTypeData
.Stub(data => data.ToXMl(Arg<XmlDocument>.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<IDataType>();
dataType.Stub(type => type.Data).Return(dataTypeData);
var dataTypeSvc = MockRepository.GenerateStub<IDataTypeService>();
dataTypeSvc.Stub(service => service.GetDataTypeById(dataTypeId)).Return(dataType);
var property = new Property(
1234,
Guid.NewGuid(),
new PropertyType(dataTypeId, DataTypeDatabaseType.Nvarchar)
{
Alias = "test"
}, "Hello world");
// Act
var xml = property.ToXml(dataTypeSvc);
// Assert
((IDataValueSetter)dataTypeData).AssertWasCalled(setter => setter.SetValue("Hello world", DataTypeDatabaseType.Nvarchar.ToString()));
}
}
}

View File

@@ -0,0 +1,41 @@
using System;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Tests.TestHelpers.Entities;
namespace Umbraco.Tests.Services
{
//[TestFixture]
//public class PackagingServiceTests : BaseServiceTest
//{
// [Test]
// public void Export_Content()
// {
// var yesNo = DataTypesResolver.Current.GetById(new Guid(Constants.PropertyEditors.TrueFalse));
// var txtField = DataTypesResolver.Current.GetById(new Guid(Constants.PropertyEditors.Textbox));
// var contentWithDataType = MockedContentTypes.CreateSimpleContentType(
// "test",
// "Test",
// new PropertyTypeCollection(
// new PropertyType[]
// {
// new PropertyType(new DataTypeDefinition(-1, txtField.Id)
// {
// Name = "Testing Textfield", DatabaseType = DataTypeDatabaseType.Ntext
// }),
// new PropertyType(new DataTypeDefinition(-1, yesNo.Id)
// {
// Name = "Testing intfield", DatabaseType = DataTypeDatabaseType.Integer
// })
// }));
// var content = MockedContent.CreateSimpleContent(contentWithDataType);
// content.Name = "Test";
// var exported = ServiceContext.PackagingService.Export(content);
// }
//}
}

View File

@@ -42,28 +42,39 @@ namespace Umbraco.Tests.TestHelpers
private static volatile bool _firstRunInTestSession = true;
private static readonly object Locker = new object();
private bool _firstTestInFixture = true;
private DefaultDatabaseFactory _dbFactory;
//Used to flag if its the first test in the current session
private bool _isFirstRunInTestSession = false;
//Used to flag if its the first test in the current fixture
private bool _isFirstTestInFixture = false;
private ApplicationContext _appContext;
[SetUp]
public override void Initialize()
{
InitializeFirstRunFlags();
_dbFactory = new DefaultDatabaseFactory(
GetDbConnectionString(),
GetDbProviderName());
base.Initialize();
var path = TestHelper.CurrentAssemblyDirectory;
AppDomain.CurrentDomain.SetData("DataDirectory", path);
DatabaseContext.Initialize(_dbFactory.ProviderName, _dbFactory.ConnectionString);
var dbFactory = new DefaultDatabaseFactory(
GetDbConnectionString(),
GetDbProviderName());
_appContext = new ApplicationContext(
//assign the db context
new DatabaseContext(dbFactory),
//assign the service context
new ServiceContext(new PetaPocoUnitOfWorkProvider(dbFactory), new FileUnitOfWorkProvider(), new PublishingStrategy()),
//disable cache
false)
{
IsReady = true
};
base.Initialize();
DatabaseContext.Initialize(dbFactory.ProviderName, dbFactory.ConnectionString);
CreateSqlCeDatabase();
@@ -75,18 +86,7 @@ namespace Umbraco.Tests.TestHelpers
protected override void SetupApplicationContext()
{
//disable cache
var cacheHelper = new CacheHelper(new NullCacheProvider(), false);
ApplicationContext.Current = new ApplicationContext(
//assign the db context
new DatabaseContext(_dbFactory),
//assign the service context
new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy(), cacheHelper),
cacheHelper)
{
IsReady = true
};
ApplicationContext.Current = _appContext;
}
/// <summary>

View File

@@ -33,6 +33,7 @@ namespace Umbraco.Tests.TestHelpers
SetupPluginManager();
SetupApplicationContext();
InitializeMappers();
FreezeResolution();
}

View File

@@ -198,10 +198,12 @@
<Compile Include="Controllers\WebApiEditors\ContentControllerTests.cs" />
<Compile Include="CoreXml\FrameworkXmlTests.cs" />
<Compile Include="Integration\CreateContent.cs" />
<Compile Include="Models\DataValueSetterTests.cs" />
<Compile Include="Persistence\PetaPocoExtensionsTest.cs" />
<Compile Include="Persistence\Repositories\UserRepositoryTest.cs" />
<Compile Include="Persistence\Repositories\UserTypeRepositoryTest.cs" />
<Compile Include="Models\Mapping\ContentWebModelMappingTests.cs" />
<Compile Include="Services\PackagingServiceTests.cs" />
<Compile Include="Services\PerformanceTests.cs" />
<Compile Include="Services\UserServiceTests.cs" />
<Compile Include="Manifest\ManifestParserTests.cs" />

View File

@@ -937,6 +937,7 @@
<Content Include="Umbraco_Client\Tinymce3\Langs\no.js" />
<Content Include="Umbraco_Client\Tinymce3\Langs\pl.js" />
<Content Include="Umbraco_Client\Tinymce3\Langs\pt.js" />
<Content Include="Umbraco_Client\Tinymce3\Langs\ru.js" />
<Content Include="Umbraco_Client\Tinymce3\Langs\sv.js" />
<Content Include="Umbraco_Client\Tinymce3\Langs\zh.js" />
<Content Include="Umbraco_Client\Tinymce3\license.txt" />
@@ -957,6 +958,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advhr\rule.htm" />
@@ -979,6 +981,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advimage\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Css\advlink.css" />
@@ -998,6 +1001,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Advlink\link.htm" />
@@ -1050,6 +1054,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Emotions\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Example\dialog.htm" />
@@ -1079,6 +1084,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullpage\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Fullscreen\editor_plugin.js" />
@@ -1112,6 +1118,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Layer\editor_plugin_src.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Legacyoutput\editor_plugin.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Legacyoutput\editor_plugin_src.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Media\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Lists\editor_plugin.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Lists\editor_plugin_src.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Media\Css\media.css" />
@@ -1161,6 +1168,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Paste\pastetext.htm" />
@@ -1191,6 +1199,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Searchreplace\searchreplace.htm" />
@@ -1215,6 +1224,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Style\props.htm" />
@@ -1244,6 +1254,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Table\merge_cells.htm" />
@@ -1267,6 +1278,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Template\template.htm" />
@@ -1281,8 +1293,12 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\en_us_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\it.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\it_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\ja.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\ja_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\ru.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\sv.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\zh.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracocss\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\dialog.htm" />
@@ -1291,6 +1307,8 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Img\ajax-loader.gif" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Img\embed.gif" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Js\dialog.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\da.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\da_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\de.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\de_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\en.js" />
@@ -1299,8 +1317,12 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\en_us_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\it.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\it_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\ja.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\ja_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\ru.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\sv.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\zh.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoembed\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\editor_plugin_src.js" />
@@ -1308,8 +1330,10 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\en_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\en_us_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\he_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\it_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\ja_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracoimg\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\editor_plugin_src.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Js\umbracolink.js" />
@@ -1318,6 +1342,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Langs\he_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Langs\ja_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracolink\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\dialog.htm" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\editor_plugin_src.js" />
@@ -1333,6 +1358,8 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\ja_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\ru.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\sv.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\zh.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracomacro\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Umbracopaste\editor_plugin_src.js" />
@@ -1374,6 +1401,7 @@
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\no_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\pl_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\pt_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\ru_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\sv_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Plugins\Xhtmlxtras\Langs\zh_dlg.js" />
<Content Include="Umbraco_Client\Tinymce3\Themes\Advanced\about.htm" />

View File

@@ -5,7 +5,7 @@
<user>0</user>
<startNode>1080</startNode>
<fullTree>False</fullTree>
<documentTypeAlias>Home</documentTypeAlias>
<documentTypeAlias>Base</documentTypeAlias>
<fields>
<categories>
</categories>
@@ -14,6 +14,6 @@
<excerpt>
</excerpt>
</fields>
<mediaObjectSupport enabled="True" folderId="-1" mediaTypeAlias="image" mediaTypeFileProperty="umbracoFile" />
<mediaObjectSupport enabled="True" folderId="-1" mediaTypeAlias="Image" mediaTypeFileProperty="umbracoFile" />
</channel>
</metablogapi>

View File

@@ -1,16 +1,34 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="passwordChanger.ascx.cs" Inherits="umbraco.controls.passwordChanger" %>
<a href="#" onclick="if (document.getElementById('umbPasswordChanger').style.display == '' || document.getElementById('umbPasswordChanger').style.display == 'none') {document.getElementById('umbPasswordChanger').style.display = 'block'; this.style.display = 'none';}">Change password</a><br />
<script type="text/javascript">
(function ($) {
Umbraco.Sys.registerNamespace("Umbraco.Controls");
Umbraco.Controls.PasswordChanger = {
toggle: function (e) {
if (!$("#umbPasswordChanger").is(":visible")) {
ValidatorEnable(document.getElementById('<%=CompareValidator1.ClientID %>'), true);
$(e).closest(".propertyItem").replaceWith($("#umbPasswordChanger"));
$("#umbPasswordChanger").show();
$(e).hide();
}
}
};
})(jQuery);
</script>
<div id="umbPasswordChanger" style="display: none;">
<table>
<tr><th style="width: 270px;"><%=umbraco.ui.GetText("user", "newPassword")%>:</th><td style="width: 359px">
<a href="#" onclick="Umbraco.Controls.PasswordChanger.toggle(this);">Change password</a><br />
<div class="propertyItem" id="umbPasswordChanger" style="display: none;">
<div class="propertyItemheader"><%=umbraco.ui.GetText("user", "newPassword")%></div>
<div class="propertyItemContent">
<asp:TextBox ID="umbPasswordChanger_passwordNew" autocomplete="off" AutoCompleteType="None" TextMode="password" runat="server"></asp:TextBox>
</td></tr>
<tr><th><%=umbraco.ui.GetText("user", "confirmNewPassword")%>:</th><td style="width: 359px">
</div>
<div class="propertyItemheader"><%=umbraco.ui.GetText("user", "confirmNewPassword")%></div>
<div class="propertyItemContent">
<asp:TextBox ID="umbPasswordChanger_passwordNewConfirm" autocomplete="off" AutoCompleteType="None" TextMode="password" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Passwords must match" ControlToValidate="umbPasswordChanger_passwordNew"
<asp:CompareValidator ID="CompareValidator1" runat="server" Enabled="False" ErrorMessage="Passwords must match" ControlToValidate="umbPasswordChanger_passwordNew"
ControlToCompare="umbPasswordChanger_passwordNewConfirm" Operator="Equal"></asp:CompareValidator>
</td></tr>
</table>
</div>
</div>

View File

@@ -52,14 +52,6 @@ namespace Umbraco.Web.UI.Pages
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(ui.Culture(Security.CurrentUser));
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
}
/// <summary>
/// Gets/sets the app that this page is assigned to
/// </summary>

View File

@@ -550,23 +550,40 @@ namespace umbraco.cms.presentation
}
menuItem.ImageURL = SystemDirectories.Umbraco + "/images/editor/vis.gif";
// Fix for U4-682, if there's no template, disable the preview button
if (_document.Template != -1)
if (EnablePreviewButton())
{
menuItem.AltText = ui.Text("buttons", "showPage", UmbracoUser);
menuItem.OnClickCommand = "window.open('dialogs/preview.aspx?id=" + id + "','umbPreview')";
}
else
{
string showPageDisabledText = ui.Text("buttons", "showPageDisabled", UmbracoUser);
var showPageDisabledText = ui.Text("buttons", "showPageDisabled", UmbracoUser);
if (showPageDisabledText.StartsWith("["))
showPageDisabledText = ui.GetText("buttons", "showPageDisabled", null, "en"); ;
showPageDisabledText = ui.GetText("buttons", "showPageDisabled", null, "en");
menuItem.AltText = showPageDisabledText;
((Image)menuItem).Attributes.Add("style", "opacity: 0.5");
((Image) menuItem).Attributes.Add("style", "opacity: 0.5");
}
}
private bool EnablePreviewButton()
{
// Fix for U4-862, if there's no template, disable the preview button
// Fixed again for U4-2587, apparently at some point "no template" changed from -1 to 0? -SJ
// Now also catches when template doesn't exist any more or is not allowed any more
// Don't think there's a better way to check if the template exists besides trying to instantiate it..
try
{
var template = new businesslogic.template.Template(_document.Template);
// If template is found check if it's in the list of allowed templates for this document
return _document.Content.ContentType.AllowedTemplates.ToList().Any(t => t.Id == template.Id);
}
catch (Exception) { }
return false;
}
/// <summary>
/// JsInclude1 control.
/// </summary>

View File

@@ -349,15 +349,11 @@ namespace umbraco.cms.presentation.user
}
}
#region Web Form Designer generated code
protected override void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
//lapps.SelectionMode = ListSelectionMode.Multiple;
lapps.RepeatLayout = RepeatLayout.Flow;
lapps.RepeatDirection = RepeatDirection.Vertical;
}
protected override void OnPreRender(EventArgs e)
@@ -367,22 +363,8 @@ namespace umbraco.cms.presentation.user
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/CMSNode.asmx"));
// ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//lapps.SelectionMode = ListSelectionMode.Multiple;
lapps.RepeatLayout = RepeatLayout.Flow;
lapps.RepeatDirection = RepeatDirection.Vertical;
}
#endregion
/// <summary>
/// Handles the Click event of the saveUser control.
/// </summary>

View File

@@ -115,9 +115,6 @@ namespace umbraco.BasePages
else
Response.Redirect(SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl), true);
}
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(ui.Culture(this.getUser()));
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
}
}
}

View File

@@ -850,7 +850,7 @@ namespace umbraco.cms.businesslogic
foreach (var i in value)
{
int id = i;
list.Add(new ContentTypeSort{Id = new Lazy<int>(() => id), SortOrder = sort});
list.Add(new ContentTypeSort { Id = new Lazy<int>(() => id), SortOrder = sort });
sort++;
}
@@ -1428,12 +1428,12 @@ namespace umbraco.cms.businesslogic
public List<PropertyType> GetAllPropertyTypes()
{
var db = ApplicationContext.Current.DatabaseContext.Database;
var propertyTypeDtos = db.Fetch<PropertyTypeDto>("WHERE propertyTypeGroupId = @Id", new {Id = _id});
var propertyTypeDtos = db.Fetch<PropertyTypeDto>("WHERE propertyTypeGroupId = @Id", new { Id = _id });
var tmp = propertyTypeDtos
.Select(propertyTypeDto => PropertyType.GetPropertyType(propertyTypeDto.Id))
.ToList();
var propertyTypeGroupDtos = db.Fetch<PropertyTypeGroupDto>("WHERE parentGroupId = @Id", new {Id = _id});
var propertyTypeGroupDtos = db.Fetch<PropertyTypeGroupDto>("WHERE parentGroupId = @Id", new { Id = _id });
foreach (var propertyTypeGroupDto in propertyTypeGroupDtos)
{
var inheritedPropertyTypeDtos = db.Fetch<PropertyTypeDto>("WHERE propertyTypeGroupId = @Id", new { Id = propertyTypeGroupDto.Id });
@@ -1504,6 +1504,24 @@ namespace umbraco.cms.businesslogic
}
}
/// <summary>
/// Gets the tab caption by id.
/// </summary>
/// <param name="id">The id.</param>
/// <returns></returns>
internal static string GetRawCaptionById(int id)
{
try
{
var tempCaption = SqlHelper.ExecuteScalar<string>("Select text from cmsPropertyTypeGroup where id = " + id);
return tempCaption;
}
catch
{
return null;
}
}
private readonly int _id;
private int? _sortOrder;
@@ -1645,6 +1663,5 @@ namespace umbraco.cms.businesslogic
}
}
#endregion
}
}

View File

@@ -15,7 +15,7 @@ namespace umbraco.cms.businesslogic.datatype
/// Default implementation of the <c>IData</c> interface that stores data inside the Umbraco database.
/// </summary>
[Obsolete("This class is no longer used and will be removed from the codebase in the future.")]
public class DefaultData : IData, IDataWithPreview
public class DefaultData : IData, IDataWithPreview, IDataValueSetter
{
private int _propertyId;
private object _value;
@@ -58,10 +58,29 @@ namespace umbraco.cms.businesslogic.datatype
_value = InitValue;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="val"></param>
/// <param name="strDbType"></param>
void IDataValueSetter.SetValue(object val, string strDbType)
{
_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;
}
/// <summary>
/// Loads the data value from the database.
/// </summary>
protected virtual void LoadValueFromDatabase()
protected internal virtual void LoadValueFromDatabase()
{
var sql = new Sql();
sql.Select("*")
@@ -244,5 +263,7 @@ namespace umbraco.cms.businesslogic.datatype
}
#endregion
}
}

View File

@@ -527,7 +527,7 @@ namespace umbraco.cms.businesslogic.web
//Datatype definition guid was added in v4 to enable datatype imports
ptx.AppendChild(XmlHelper.AddTextNode(xd, "Definition", pt.DataTypeDefinition.UniqueId.ToString()));
ptx.AppendChild(XmlHelper.AddTextNode(xd, "Tab", Tab.GetCaptionById(pt.TabId)));
ptx.AppendChild(XmlHelper.AddTextNode(xd, "Tab", Tab.GetRawCaptionById(pt.TabId)));
ptx.AppendChild(XmlHelper.AddTextNode(xd, "Mandatory", pt.Mandatory.ToString()));
ptx.AppendChild(XmlHelper.AddTextNode(xd, "Validation", pt.ValidationRegExp));
ptx.AppendChild(XmlHelper.AddCDataNode(xd, "Description", pt.GetRawDescription()));

View File

@@ -3,6 +3,15 @@ using System.Xml;
namespace umbraco.interfaces
{
/// <summary>
/// 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.
/// </summary>
internal interface IDataValueSetter
{
void SetValue(object val, string strDbType);
}
/// <summary>
/// The IData is part of the IDataType interface for creating new data types in the umbraco backoffice.

View File

@@ -10,3 +10,10 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyDescription("Core assembly containing legacy interfaces")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Umbraco CMS")]
[assembly: InternalsVisibleTo("cms")]
[assembly: InternalsVisibleTo("Umbraco.Core")]
[assembly: InternalsVisibleTo("Umbraco.Tests")]
//allow this to be mocked in our unit tests
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]