From 55cf2bd790d50c41326b557e617640bd2a433d29 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 17 Sep 2013 12:31:39 +1000 Subject: [PATCH] Fixes new aspx inline config references. --- .../ChangeControlIdColumn.cs | 70 ++++--------------- .../UpdateControlIdToPropertyEditorAlias.cs | 61 ++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../Modules/SkinModule/ModuleInjector.aspx | 7 +- .../umbraco/dialogs/editMacro.aspx | 3 +- .../umbraco/settings/editTemplate.aspx | 3 +- .../Modules/SkinModule/ModuleInjector.aspx | 7 +- 7 files changed, 88 insertions(+), 64 deletions(-) create mode 100644 src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs index 3e18ac3835..554f985fdc 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/ChangeControlIdColumn.cs @@ -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 - /// - /// Updates the data in the changed propertyEditorAlias column after it has been changed by ChangeControlIdColumn - /// - [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("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"); + // } + //} } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs new file mode 100644 index 0000000000..74bc2591af --- /dev/null +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSeven/UpdateControlIdToPropertyEditorAlias.cs @@ -0,0 +1,61 @@ +using System; +using Umbraco.Core.Configuration; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSeven +{ + /// + /// Updates the data in the changed propertyEditorAlias column after it has been changed by ChangeControlIdColumn + /// + [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("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"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 32941531c3..a0f7f0af55 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -394,6 +394,7 @@ + diff --git a/src/Umbraco.Web.UI/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx b/src/Umbraco.Web.UI/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx index 7f40248e9c..8909fc1f36 100644 --- a/src/Umbraco.Web.UI/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx +++ b/src/Umbraco.Web.UI/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx @@ -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" %> @@ -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\">"; <%} else { %> macroString += ">"; diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx index 9995b2fa9a..88b62a4e2b 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/editMacro.aspx @@ -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" %> @@ -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 %>' diff --git a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx index e500b23f5d..0356f4fe07 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx +++ b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx @@ -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 %>"), diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx index 7f40248e9c..8909fc1f36 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/LiveEditing/Modules/SkinModule/ModuleInjector.aspx @@ -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" %> @@ -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\">"; <%} else { %> macroString += ">";