Fixes new aspx inline config references.

This commit is contained in:
Shannon
2013-09-17 12:31:39 +10:00
parent 9054ec0125
commit 55cf2bd790
7 changed files with 88 additions and 64 deletions

View File

@@ -1,67 +1,11 @@
using System;
using Umbraco.Core.Configuration;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
{
//TODO: There's other migrations we need to run for v7 like:
// * http://issues.umbraco.org/issue/U4-2664
/// <summary>
/// Updates the data in the changed propertyEditorAlias column after it has been changed by ChangeControlIdColumn
/// </summary>
[Migration("7.0.0", 1, GlobalSettings.UmbracoMigrationName)]
public class UpdateControlIdToPropertyEditorAlias : MigrationBase
{
public override void Up()
{
//now that the controlId column is renamed and now a string we need to convert
if (Context == null || Context.Database == null) return;
//we need to get the data and create the migration scripts before we change the actual schema bits below!
var list = Context.Database.Fetch<dynamic>("SELECT pk, controlId FROM cmsDataType");
foreach (var item in list)
{
Guid legacyId = item.controlId;
var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(legacyId);
if (alias != null)
{
//check that the new property editor exists with that alias
var editor = PropertyEditorResolver.Current.GetByAlias(alias);
if (editor == null)
{
//We cannot find a map for this property editor so we're going to make it a label. This is because:
// * we want the upgrade to continue
// * we don't want any data loss
// * developers can change the property editor for the data type at a later time when there's a compatible one
// * editors cannot edit the value with an invalid editor
Update.Table("cmsDataType").Set(new { propertyEditorAlias = Constants.PropertyEditors.NoEditAlias }).Where(new { item.pk });
}
else
{
Update.Table("cmsDataType").Set(new { propertyEditorAlias = alias }).Where(new { item.pk });
}
}
else
{
//We cannot find a map for this property editor so we're going to make it a label. This is because:
// * we want the upgrade to continue
// * we don't want any data loss
// * developers can change the property editor for the data type at a later time when there's a compatible one
// * editors cannot edit the value with an invalid editor
Update.Table("cmsDataType").Set(new { propertyEditorAlias = Constants.PropertyEditors.NoEditAlias }).Where(new { item.pk });
}
}
}
public override void Down()
{
throw new NotSupportedException("Cannot downgrade from a version 7 database to a prior version");
}
}
[Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)]
public class ChangeControlIdColumn : MigrationBase
{
@@ -76,4 +20,18 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
throw new NotSupportedException("Cannot downgrade from a version 7 database to a prior version");
}
}
//[Migration("7.0.0", 0, GlobalSettings.UmbracoMigrationName)]
//public class RemoveDefaultPermissionUserColumn : MigrationBase
//{
// public override void Up()
// {
// Alter.Table("").AlterColumn()
// }
// public override void Down()
// {
// throw new NotSupportedException("Cannot downgrade from a version 7 database to a prior version");
// }
//}
}

View File

@@ -0,0 +1,61 @@
using System;
using Umbraco.Core.Configuration;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven
{
/// <summary>
/// Updates the data in the changed propertyEditorAlias column after it has been changed by ChangeControlIdColumn
/// </summary>
[Migration("7.0.0", 1, GlobalSettings.UmbracoMigrationName)]
public class UpdateControlIdToPropertyEditorAlias : MigrationBase
{
public override void Up()
{
//now that the controlId column is renamed and now a string we need to convert
if (Context == null || Context.Database == null) return;
//we need to get the data and create the migration scripts before we change the actual schema bits below!
var list = Context.Database.Fetch<dynamic>("SELECT pk, controlId FROM cmsDataType");
foreach (var item in list)
{
Guid legacyId = item.controlId;
var alias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(legacyId);
if (alias != null)
{
//check that the new property editor exists with that alias
var editor = PropertyEditorResolver.Current.GetByAlias(alias);
if (editor == null)
{
//We cannot find a map for this property editor so we're going to make it a label. This is because:
// * we want the upgrade to continue
// * we don't want any data loss
// * developers can change the property editor for the data type at a later time when there's a compatible one
// * editors cannot edit the value with an invalid editor
Update.Table("cmsDataType").Set(new { propertyEditorAlias = Constants.PropertyEditors.NoEditAlias }).Where(new { item.pk });
}
else
{
Update.Table("cmsDataType").Set(new { propertyEditorAlias = alias }).Where(new { item.pk });
}
}
else
{
//We cannot find a map for this property editor so we're going to make it a label. This is because:
// * we want the upgrade to continue
// * we don't want any data loss
// * developers can change the property editor for the data type at a later time when there's a compatible one
// * editors cannot edit the value with an invalid editor
Update.Table("cmsDataType").Set(new { propertyEditorAlias = Constants.PropertyEditors.NoEditAlias }).Where(new { item.pk });
}
}
}
public override void Down()
{
throw new NotSupportedException("Cannot downgrade from a version 7 database to a prior version");
}
}
}

View File

@@ -394,6 +394,7 @@
<Compile Include="Persistence\FaultHandling\Strategies\NetworkConnectivityErrorDetectionStrategy.cs" />
<Compile Include="Persistence\FaultHandling\Strategies\SqlAzureTransientErrorDetectionStrategy.cs" />
<Compile Include="Persistence\FaultHandling\ThrottlingCondition.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSeven\UpdateControlIdToPropertyEditorAlias.cs" />
<Compile Include="PropertyEditors\LegacyPropertyEditorIdToAliasConverter.cs" />
<Compile Include="Persistence\Mappers\MapperForAttribute.cs" />
<Compile Include="Persistence\Mappers\MemberMapper.cs" />

View File

@@ -1,5 +1,6 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInjector.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleInjector" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -34,7 +35,7 @@
var macroAliases = new Array();
var macroAlias = '<%= _macroAlias %>';
<%if (umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) { %>
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) { %>
var macroElement = "umbraco:Macro";
<%}else{ %>
var macroElement = "?UMBRACO_MACRO";
@@ -95,11 +96,11 @@
if (macroString.length > 1)
macroString = macroString.substr(0, macroString.length-1);
<%if (!umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
<%if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " macroAlias=\"" + macroAlias + "\"";
<%} %>
<%if (umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " Alias=\"" + macroAlias + "\" runat=\"server\"></" + macroElement + ">";
<%} else { %>
macroString += "></" + macroElement + ">";

View File

@@ -2,6 +2,7 @@
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Import Namespace="Umbraco.Web" %>
<%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
@@ -13,7 +14,7 @@
(function($) {
$(document).ready(function () {
Umbraco.Dialogs.EditMacro.getInstance().init({
useAspNetMasterPages: <%=umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower() %>,
useAspNetMasterPages: <%=UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower() %>,
codeEditorElementId: "<%=Request.GetItemAsString("objectId")%>",
renderingEngine: "<%=Request.GetItemAsString("renderingEngine", "Mvc")%>",
macroAlias: '<%= _macroAlias %>'

View File

@@ -1,6 +1,7 @@
<%@ Page MasterPageFile="../masterpages/umbracoPage.Master" Language="c#" CodeBehind="EditTemplate.aspx.cs"
ValidateRequest="false" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Settings.EditTemplate" %>
<%@ Import Namespace="Umbraco.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Import Namespace="Umbraco.Core.IO" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
@@ -23,7 +24,7 @@
restServiceLocation: "<%= Url.GetSaveFileServicePath() %>",
umbracoPath: '<%= IOHelper.ResolveUrl(SystemDirectories.Umbraco) %>',
editorClientId: '<%= editorSource.ClientID %>',
useMasterPages: <%=umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower()%>,
useMasterPages: <%=UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages.ToString().ToLower()%>,
templateId: <%= Request.QueryString["templateID"] %>,
masterTemplateId: jQuery('#<%= MasterTemplate.ClientID %>').val(),
masterPageDropDown: $("#<%= MasterTemplate.ClientID %>"),

View File

@@ -1,5 +1,6 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ModuleInjector.aspx.cs" Inherits="umbraco.presentation.umbraco.LiveEditing.Modules.SkinModule.ModuleInjector" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Import Namespace="Umbraco.Core.Configuration" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -34,7 +35,7 @@
var macroAliases = new Array();
var macroAlias = '<%= _macroAlias %>';
<%if (umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) { %>
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages) { %>
var macroElement = "umbraco:Macro";
<%}else{ %>
var macroElement = "?UMBRACO_MACRO";
@@ -95,11 +96,11 @@
if (macroString.length > 1)
macroString = macroString.substr(0, macroString.length-1);
<%if (!umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
<%if (!UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " macroAlias=\"" + macroAlias + "\"";
<%} %>
<%if (umbraco.UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
<%if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages){ %>
macroString += " Alias=\"" + macroAlias + "\" runat=\"server\"></" + macroElement + ">";
<%} else { %>
macroString += "></" + macroElement + ">";