From 00f2afe454ed534e724a88fb15547516baf81304 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 26 Feb 2014 04:15:14 +1100 Subject: [PATCH 01/37] Creates Install MVC Area, creates new installer api controllers, moves old installer files to the new Area folder so that the /install path can route properly. --- .../Configuration/GlobalSettings.cs | 2 +- .../UmbracoInstall}/InstallerRestService.aspx | 0 .../InstallerRestService.aspx.cs | 250 ++--- .../InstallerRestService.aspx.designer.cs | 30 +- .../UmbracoInstall}/Title.ascx | 4 +- .../UmbracoInstall}/Title.ascx.cs | 22 +- .../UmbracoInstall}/Title.ascx.designer.cs | 30 +- .../UmbracoInstall/Views/Install/Index.cshtml | 16 + .../Areas/UmbracoInstall/Views/Web.config | 58 ++ .../UmbracoInstall/default_old.aspx} | 322 +++---- .../UmbracoInstall/default_old.aspx.cs} | 170 ++-- .../default_old.aspx.designer.cs} | 102 +- .../UmbracoInstall}/steps/Database.ascx.cs | 544 +++++------ .../steps/Database.ascx.designer.cs | 498 +++++----- .../UmbracoInstall}/steps/DefaultUser.ascx.cs | 186 ++-- .../steps/DefaultUser.ascx.designer.cs | 174 ++-- .../UmbracoInstall}/steps/License.ascx.cs | 24 +- .../steps/License.ascx.designer.cs | 48 +- .../UmbracoInstall}/steps/Renaming.ascx.cs | 156 ++-- .../steps/Renaming.ascx.designer.cs | 156 ++-- .../steps/RenderingEngine.ascx | 54 +- .../steps/RenderingEngine.ascx.cs | 42 +- .../steps/RenderingEngine.ascx.designer.cs | 66 +- .../steps/Skinning/LoadStarterKits.ascx.cs | 206 ++-- .../Skinning/LoadStarterKits.ascx.designer.cs | 120 +-- .../steps/Skinning/loadStarterKits.ascx | 194 ++-- .../UmbracoInstall}/steps/StarterKits.ascx | 244 ++--- .../UmbracoInstall}/steps/StarterKits.ascx.cs | 62 +- .../steps/StarterKits.ascx.designer.cs | 120 +-- .../UmbracoInstall}/steps/StepUserControl.cs | 38 +- .../UmbracoInstall}/steps/TheEnd.ascx.cs | 70 +- .../steps/TheEnd.ascx.designer.cs | 30 +- .../UmbracoInstall}/steps/UpgradeReport.ascx | 146 +-- .../steps/UpgradeReport.ascx.cs | 190 ++-- .../steps/UpgradeReport.ascx.designer.cs | 120 +-- .../steps/ValidatePermissions.ascx.cs | 360 +++---- .../ValidatePermissions.ascx.designer.cs | 264 +++--- .../UmbracoInstall}/steps/Welcome.ascx.cs | 88 +- .../steps/Welcome.ascx.designer.cs | 84 +- .../UmbracoInstall}/steps/database.ascx | 882 +++++++++--------- .../UmbracoInstall}/steps/defaultUser.ascx | 178 ++-- .../UmbracoInstall}/steps/license.ascx | 46 +- .../UmbracoInstall}/steps/renaming.ascx | 48 +- .../UmbracoInstall}/steps/theend.ascx | 126 +-- .../steps/validatePermissions.ascx | 176 ++-- .../UmbracoInstall}/steps/welcome.ascx | 108 +-- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 95 +- .../Controllers/InstallApiController.cs | 28 + .../Install/Controllers/InstallController.cs | 53 ++ .../InstallPackageController.cs | 378 ++++---- .../Install/HttpInstallAuthorizeAttribute.cs | 80 ++ ...ribute.cs => InstallAuthorizeAttribute.cs} | 172 ++-- .../Install/Models/InstallStatus.cs | 28 + src/Umbraco.Web/Install/UmbracoInstallArea.cs | 50 + src/Umbraco.Web/Mvc/BackOfficeArea.cs | 9 +- src/Umbraco.Web/Umbraco.Web.csproj | 10 +- src/Umbraco.Web/UmbracoModule.cs | 2 +- src/Umbraco.Web/WebBootManager.cs | 81 +- 58 files changed, 4089 insertions(+), 3751 deletions(-) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/InstallerRestService.aspx (100%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/InstallerRestService.aspx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/InstallerRestService.aspx.designer.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/Title.ascx (99%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/Title.ascx.cs (95%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/Title.ascx.designer.cs (96%) create mode 100644 src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml create mode 100644 src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config rename src/Umbraco.Web.UI/{install/default.aspx => Areas/UmbracoInstall/default_old.aspx} (94%) rename src/Umbraco.Web.UI/{install/Default.aspx.cs => Areas/UmbracoInstall/default_old.aspx.cs} (97%) rename src/Umbraco.Web.UI/{install/Default.aspx.designer.cs => Areas/UmbracoInstall/default_old.aspx.designer.cs} (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Database.ascx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Database.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/DefaultUser.ascx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/DefaultUser.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/License.ascx.cs (94%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/License.ascx.designer.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Renaming.ascx.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Renaming.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/RenderingEngine.ascx (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/RenderingEngine.ascx.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/RenderingEngine.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Skinning/LoadStarterKits.ascx.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Skinning/LoadStarterKits.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Skinning/loadStarterKits.ascx (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/StarterKits.ascx (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/StarterKits.ascx.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/StarterKits.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/StepUserControl.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/TheEnd.ascx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/TheEnd.ascx.designer.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/UpgradeReport.ascx (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/UpgradeReport.ascx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/UpgradeReport.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/ValidatePermissions.ascx.cs (96%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/ValidatePermissions.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Welcome.ascx.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/Welcome.ascx.designer.cs (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/database.ascx (98%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/defaultUser.ascx (98%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/license.ascx (98%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/renaming.ascx (98%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/theend.ascx (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/validatePermissions.ascx (97%) rename src/Umbraco.Web.UI/{install => Areas/UmbracoInstall}/steps/welcome.ascx (98%) create mode 100644 src/Umbraco.Web/Install/Controllers/InstallApiController.cs create mode 100644 src/Umbraco.Web/Install/Controllers/InstallController.cs rename src/Umbraco.Web/Install/{ => Controllers}/InstallPackageController.cs (61%) create mode 100644 src/Umbraco.Web/Install/HttpInstallAuthorizeAttribute.cs rename src/Umbraco.Web/Install/{UmbracoInstallAuthorizeAttribute.cs => InstallAuthorizeAttribute.cs} (53%) create mode 100644 src/Umbraco.Web/Install/Models/InstallStatus.cs create mode 100644 src/Umbraco.Web/Install/UmbracoInstallArea.cs diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 3c16377a8f..dc2675bd58 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -41,7 +41,7 @@ namespace Umbraco.Core.Configuration private static string _reservedUrls; //ensure the built on (non-changeable) reserved paths are there at all times private const string StaticReservedPaths = "~/app_plugins/,~/install/,"; - private const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; + private const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; #endregion diff --git a/src/Umbraco.Web.UI/install/InstallerRestService.aspx b/src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx similarity index 100% rename from src/Umbraco.Web.UI/install/InstallerRestService.aspx rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx diff --git a/src/Umbraco.Web.UI/install/InstallerRestService.aspx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.cs similarity index 97% rename from src/Umbraco.Web.UI/install/InstallerRestService.aspx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.cs index 8b197d75f0..a7a95805e6 100644 --- a/src/Umbraco.Web.UI/install/InstallerRestService.aspx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.cs @@ -1,126 +1,126 @@ -using System; -using System.Configuration; -using System.Security.Authentication; -using System.Web; -using System.Web.Script.Serialization; -using System.Web.Script.Services; -using System.Web.Services; -using Umbraco.Core; -using Umbraco.Core.Logging; -using Umbraco.Web.Install; -using umbraco; -using umbraco.businesslogic.Exceptions; - -namespace Umbraco.Web.UI.Install -{ - public partial class InstallerRestService : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - LogHelper.Info(string.Format("Hitting Page_Load on InstallerRestService.aspx for the requested '{0}' feed", Request.QueryString["feed"])); - - // Stop Caching in IE - Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); - - // Stop Caching in Firefox - Response.Cache.SetNoStore(); - - string feed = Request.QueryString["feed"]; - string url = "http://our.umbraco.org/html/twitter"; - - if (feed == "progress") - { - Response.ContentType = "application/json"; - Response.Write(InstallHelper.GetProgress()); - } - else - { - if (feed == "blogs") - url = "http://our.umbraco.org/html/blogs"; - - if (feed == "sitebuildervids") - url = "http://umbraco.org/feeds/videos/site-builder-foundation-html"; - - if (feed == "developervids") - url = "http://umbraco.org/feeds/videos/developer-foundation-html"; - - string xmlResponse = library.GetXmlDocumentByUrl(url).Current.OuterXml; - - if (!xmlResponse.Contains("System.Net.WebException")) - { - Response.Write(library.GetXmlDocumentByUrl(url).Current.OuterXml); - } - else - { - Response.Write("We can't connect to umbraco.tv right now. Click Set up your new website above to continue."); - } - } - } - - - [WebMethod] - [ScriptMethod(ResponseFormat = ResponseFormat.Json)] - public static string Install() - { - //if its not configured then we can continue - if (ApplicationContext.Current == null || ApplicationContext.Current.IsConfigured) - { - throw new AuthenticationException("The application is already configured"); - } - - LogHelper.Info("Running 'Install' service"); - - var result = ApplicationContext.Current.DatabaseContext.CreateDatabaseSchemaAndData(); - - if (result.RequiresUpgrade == false) - { - HandleConnectionStrings(); - } - - var js = new JavaScriptSerializer(); - var jsonResult = js.Serialize(result); - return jsonResult; - } - - [WebMethod] - [ScriptMethod(ResponseFormat = ResponseFormat.Json)] - public static string Upgrade() - { - //if its not configured then we can continue - if (ApplicationContext.Current == null || ApplicationContext.Current.IsConfigured) - { - throw new AuthenticationException("The application is already configured"); - } - - LogHelper.Info("Running 'Upgrade' service"); - - var result = ApplicationContext.Current.DatabaseContext.UpgradeSchemaAndData(); - - HandleConnectionStrings(); - - //After upgrading we must restart the app pool - the reason is because PetaPoco caches a lot of the mapping logic - // and after we upgrade a db, some of the mapping needs to be updated so we restart the app pool to clear it's cache or - // else we can end up with YSODs - ApplicationContext.Current.RestartApplicationPool(new HttpContextWrapper(HttpContext.Current)); - - var js = new JavaScriptSerializer(); - var jsonResult = js.Serialize(result); - return jsonResult; - } - - private static void HandleConnectionStrings() - { - // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists - if (ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName] != null) - { - Core.Configuration.GlobalSettings.RemoveSetting(Core.Configuration.GlobalSettings.UmbracoConnectionName); - } - else - { - var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", Core.Configuration.GlobalSettings.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); - LogHelper.Error("", ex); - throw ex; - } - } - } +using System; +using System.Configuration; +using System.Security.Authentication; +using System.Web; +using System.Web.Script.Serialization; +using System.Web.Script.Services; +using System.Web.Services; +using Umbraco.Core; +using Umbraco.Core.Logging; +using Umbraco.Web.Install; +using umbraco; +using umbraco.businesslogic.Exceptions; + +namespace Umbraco.Web.UI.Install +{ + public partial class InstallerRestService : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + LogHelper.Info(string.Format("Hitting Page_Load on InstallerRestService.aspx for the requested '{0}' feed", Request.QueryString["feed"])); + + // Stop Caching in IE + Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); + + // Stop Caching in Firefox + Response.Cache.SetNoStore(); + + string feed = Request.QueryString["feed"]; + string url = "http://our.umbraco.org/html/twitter"; + + if (feed == "progress") + { + Response.ContentType = "application/json"; + Response.Write(InstallHelper.GetProgress()); + } + else + { + if (feed == "blogs") + url = "http://our.umbraco.org/html/blogs"; + + if (feed == "sitebuildervids") + url = "http://umbraco.org/feeds/videos/site-builder-foundation-html"; + + if (feed == "developervids") + url = "http://umbraco.org/feeds/videos/developer-foundation-html"; + + string xmlResponse = library.GetXmlDocumentByUrl(url).Current.OuterXml; + + if (!xmlResponse.Contains("System.Net.WebException")) + { + Response.Write(library.GetXmlDocumentByUrl(url).Current.OuterXml); + } + else + { + Response.Write("We can't connect to umbraco.tv right now. Click Set up your new website above to continue."); + } + } + } + + + [WebMethod] + [ScriptMethod(ResponseFormat = ResponseFormat.Json)] + public static string Install() + { + //if its not configured then we can continue + if (ApplicationContext.Current == null || ApplicationContext.Current.IsConfigured) + { + throw new AuthenticationException("The application is already configured"); + } + + LogHelper.Info("Running 'Install' service"); + + var result = ApplicationContext.Current.DatabaseContext.CreateDatabaseSchemaAndData(); + + if (result.RequiresUpgrade == false) + { + HandleConnectionStrings(); + } + + var js = new JavaScriptSerializer(); + var jsonResult = js.Serialize(result); + return jsonResult; + } + + [WebMethod] + [ScriptMethod(ResponseFormat = ResponseFormat.Json)] + public static string Upgrade() + { + //if its not configured then we can continue + if (ApplicationContext.Current == null || ApplicationContext.Current.IsConfigured) + { + throw new AuthenticationException("The application is already configured"); + } + + LogHelper.Info("Running 'Upgrade' service"); + + var result = ApplicationContext.Current.DatabaseContext.UpgradeSchemaAndData(); + + HandleConnectionStrings(); + + //After upgrading we must restart the app pool - the reason is because PetaPoco caches a lot of the mapping logic + // and after we upgrade a db, some of the mapping needs to be updated so we restart the app pool to clear it's cache or + // else we can end up with YSODs + ApplicationContext.Current.RestartApplicationPool(new HttpContextWrapper(HttpContext.Current)); + + var js = new JavaScriptSerializer(); + var jsonResult = js.Serialize(result); + return jsonResult; + } + + private static void HandleConnectionStrings() + { + // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists + if (ConfigurationManager.ConnectionStrings[Core.Configuration.GlobalSettings.UmbracoConnectionName] != null) + { + Core.Configuration.GlobalSettings.RemoveSetting(Core.Configuration.GlobalSettings.UmbracoConnectionName); + } + else + { + var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", Core.Configuration.GlobalSettings.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); + LogHelper.Error("", ex); + throw ex; + } + } + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/InstallerRestService.aspx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.designer.cs similarity index 96% rename from src/Umbraco.Web.UI/install/InstallerRestService.aspx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.designer.cs index 390aeeeaeb..02541e7b03 100644 --- a/src/Umbraco.Web.UI/install/InstallerRestService.aspx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/InstallerRestService.aspx.designer.cs @@ -1,15 +1,15 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install { - - - public partial class InstallerRestService { - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install { + + + public partial class InstallerRestService { + } +} diff --git a/src/Umbraco.Web.UI/install/Title.ascx b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx similarity index 99% rename from src/Umbraco.Web.UI/install/Title.ascx rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx index 748e05dfe8..3bcec8e343 100644 --- a/src/Umbraco.Web.UI/install/Title.ascx +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx @@ -1,3 +1,3 @@ -<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="Title.ascx.cs" Inherits="Umbraco.Web.UI.Install.Title" %> -<%@ Import Namespace="Umbraco.Core.Configuration" %> +<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="Title.ascx.cs" Inherits="Umbraco.Web.UI.Install.Title" %> +<%@ Import Namespace="Umbraco.Core.Configuration" %> Umbraco <%=UmbracoVersion.Current.ToString(3)%> <%=UmbracoVersion.CurrentComment%> Configuration Wizard \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/Title.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.cs similarity index 95% rename from src/Umbraco.Web.UI/install/Title.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.cs index ae4881e776..c52fedc17f 100644 --- a/src/Umbraco.Web.UI/install/Title.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Umbraco.Web.UI.Pages; - -namespace Umbraco.Web.UI.Install -{ - public partial class Title : System.Web.UI.UserControl - { - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Umbraco.Web.UI.Pages; + +namespace Umbraco.Web.UI.Install +{ + public partial class Title : System.Web.UI.UserControl + { + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/Title.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.designer.cs similarity index 96% rename from src/Umbraco.Web.UI/install/Title.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.designer.cs index b5999c18bb..65fb4f16e9 100644 --- a/src/Umbraco.Web.UI/install/Title.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Title.ascx.designer.cs @@ -1,15 +1,15 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install { - - - public partial class Title { - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install { + + + public partial class Title { + } +} diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml new file mode 100644 index 0000000000..00bc03b40c --- /dev/null +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Install/Index.cshtml @@ -0,0 +1,16 @@ +@{ + Layout = null; +} + + + + + + + + +
+ Hello world +
+ + diff --git a/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config new file mode 100644 index 0000000000..a4def2a3db --- /dev/null +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/Views/Web.config @@ -0,0 +1,58 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Umbraco.Web.UI/install/default.aspx b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx similarity index 94% rename from src/Umbraco.Web.UI/install/default.aspx rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx index 20deecb43f..d14b45bf10 100644 --- a/src/Umbraco.Web.UI/install/default.aspx +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx @@ -1,161 +1,161 @@ -<%@ Page Language="c#" CodeBehind="Default.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Install.Default" EnableViewState="False" %> - -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - -<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %> - - - - - - - - " /> - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- -
- - - - - - - -
- - - - - - - -
- -
-
-
-
- - - - - - - - - - -
- - - - +<%@ Page Language="c#" CodeBehind="default_old.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Install.Default" EnableViewState="False" %> + +<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> + +<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %> + + + + + + + + " /> + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + + + + +
+ + + + + + + +
+ +
+
+
+
+ + + + + + + + + + +
+ + + + diff --git a/src/Umbraco.Web.UI/install/Default.aspx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.cs similarity index 97% rename from src/Umbraco.Web.UI/install/Default.aspx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.cs index 75e701d250..e191323b5d 100644 --- a/src/Umbraco.Web.UI/install/Default.aspx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.cs @@ -1,86 +1,86 @@ -using System; -using System.Web; -using System.Web.UI.WebControls; -using Umbraco.Core.IO; -using Umbraco.Web.Install; -using Umbraco.Web.Security; -using Umbraco.Web.UI.Pages; -using umbraco; - -namespace Umbraco.Web.UI.Install -{ - public partial class Default : BasePage - { - private string _installStep = ""; - - protected string CurrentStepClass = ""; - - protected void Page_Load(object sender, System.EventArgs e) - { - rp_steps.DataSource = InstallHelper.InstallerSteps.Values; - rp_steps.DataBind(); - } - - private void LoadContent(InstallerStep currentStep) - { - PlaceHolderStep.Controls.Clear(); - PlaceHolderStep.Controls.Add(LoadControl(IOHelper.ResolveUrl(currentStep.UserControl))); - step.Value = currentStep.Alias; - CurrentStepClass = currentStep.Alias; - } - - int _stepCounter = 0; - protected void BindStep(object sender, RepeaterItemEventArgs e) - { - - if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) - { - var i = (InstallerStep)e.Item.DataItem; - - if (!i.HideFromNavigation) - { - var _class = (Literal)e.Item.FindControl("lt_class"); - var name = (Literal)e.Item.FindControl("lt_name"); - - if (i.Alias == CurrentStepClass) - _class.Text = "active"; - - _stepCounter++; - name.Text = (_stepCounter).ToString() + " - " + i.Name; - } - else - e.Item.Visible = false; - } - } - - override protected void OnInit(EventArgs e) - { - base.OnInit(e); - - _installStep = Request.GetItemAsString("installStep"); - - //if this is not an upgrade we will log in with the default user. - // It's not considered an upgrade if the ConfigurationStatus is missing or empty. - if (string.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false) - { - var result = Security.ValidateCurrentUser(false); - - switch (result) - { - case ValidateRequestAttempt.FailedNoPrivileges: - case ValidateRequestAttempt.FailedTimedOut: - case ValidateRequestAttempt.FailedNoContextId: - Response.Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl)); - break; - } - } - - var s = string.IsNullOrEmpty(_installStep) - ? InstallHelper.InstallerSteps["welcome"] - : InstallHelper.InstallerSteps[_installStep]; - - LoadContent(s); - } - - } +using System; +using System.Web; +using System.Web.UI.WebControls; +using Umbraco.Core.IO; +using Umbraco.Web.Install; +using Umbraco.Web.Security; +using Umbraco.Web.UI.Pages; +using umbraco; + +namespace Umbraco.Web.UI.Install +{ + public partial class Default : BasePage + { + private string _installStep = ""; + + protected string CurrentStepClass = ""; + + protected void Page_Load(object sender, System.EventArgs e) + { + rp_steps.DataSource = InstallHelper.InstallerSteps.Values; + rp_steps.DataBind(); + } + + private void LoadContent(InstallerStep currentStep) + { + PlaceHolderStep.Controls.Clear(); + PlaceHolderStep.Controls.Add(LoadControl(IOHelper.ResolveUrl(currentStep.UserControl))); + step.Value = currentStep.Alias; + CurrentStepClass = currentStep.Alias; + } + + int _stepCounter = 0; + protected void BindStep(object sender, RepeaterItemEventArgs e) + { + + if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) + { + var i = (InstallerStep)e.Item.DataItem; + + if (!i.HideFromNavigation) + { + var _class = (Literal)e.Item.FindControl("lt_class"); + var name = (Literal)e.Item.FindControl("lt_name"); + + if (i.Alias == CurrentStepClass) + _class.Text = "active"; + + _stepCounter++; + name.Text = (_stepCounter).ToString() + " - " + i.Name; + } + else + e.Item.Visible = false; + } + } + + override protected void OnInit(EventArgs e) + { + base.OnInit(e); + + _installStep = Request.GetItemAsString("installStep"); + + //if this is not an upgrade we will log in with the default user. + // It's not considered an upgrade if the ConfigurationStatus is missing or empty. + if (string.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false) + { + var result = Security.ValidateCurrentUser(false); + + switch (result) + { + case ValidateRequestAttempt.FailedNoPrivileges: + case ValidateRequestAttempt.FailedTimedOut: + case ValidateRequestAttempt.FailedNoContextId: + Response.Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl)); + break; + } + } + + var s = string.IsNullOrEmpty(_installStep) + ? InstallHelper.InstallerSteps["welcome"] + : InstallHelper.InstallerSteps[_installStep]; + + LoadContent(s); + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/Default.aspx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/Default.aspx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.designer.cs index 37e8062070..74f8188a66 100644 --- a/src/Umbraco.Web.UI/install/Default.aspx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/default_old.aspx.designer.cs @@ -1,51 +1,51 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install { - - - public partial class Default - { - /// - /// ScriptManager1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.ScriptManager ScriptManager1; - - /// - /// rp_steps control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rp_steps; - - /// - /// PlaceHolderStep control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder PlaceHolderStep; - - /// - /// step control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - public global::System.Web.UI.HtmlControls.HtmlInputHidden step; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install { + + + public partial class Default + { + /// + /// ScriptManager1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.ScriptManager ScriptManager1; + + /// + /// rp_steps control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater rp_steps; + + /// + /// PlaceHolderStep control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder PlaceHolderStep; + + /// + /// step control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + public global::System.Web.UI.HtmlControls.HtmlInputHidden step; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/Database.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/Database.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.cs index 45eab19d45..6491c2aa0c 100644 --- a/src/Umbraco.Web.UI/install/steps/Database.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.cs @@ -1,273 +1,273 @@ -using System; -using System.Configuration; -using System.Data.Common; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Core.IO; -using Umbraco.Core.Logging; -using System.IO; -using Umbraco.Core.Persistence; -using Umbraco.Web.Install; -using umbraco.DataLayer; - -namespace Umbraco.Web.UI.Install.Steps -{ - /// - /// Database detection step in the installer wizard. - /// - public partial class Database : StepUserControl - { - /// - /// Returns whether the selected database is an embedded database. - /// - protected bool IsEmbeddedDatabase - { - get - { - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; - var configuredDatabaseIsEmbedded = databaseSettings != null && databaseSettings.ProviderName.ToLower().Contains("SqlServerCe".ToLower()); - - return Request["database"] == "embedded" || configuredDatabaseIsEmbedded; - } - } - - protected bool IsConfigured - { - get { return DatabaseType.SelectedValue != ""; } - } - - protected bool IsNewInstall - { - get - { - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; - if (databaseSettings != null && ( - databaseSettings.ConnectionString.Trim() == string.Empty - && databaseSettings.ProviderName.Trim() == string.Empty - && GlobalSettings.ConfigurationStatus == string.Empty)) - { - return true; - } - - return false; - } - } - - /// - /// Returns whether the connection string is set by direct text input. - /// - protected bool ManualConnectionString - { - get { return Request["database"] == "advanced"; } - } - - /// - /// Shows the right panel to the user. - /// - /// The sender. - /// The event arguments. - protected void Page_Load(object sender, System.EventArgs e) - { - // Does the user have to enter a connection string? - if (settings.Visible && !Page.IsPostBack) - { - //If the connection string is already present in web.config we don't need to show the settings page and we jump to installing/upgrading. - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; - - var dbIsSqlCe = false; - if(databaseSettings != null && databaseSettings.ProviderName != null) - dbIsSqlCe = databaseSettings.ProviderName == "System.Data.SqlServerCe.4.0"; - var sqlCeDatabaseExists = false; - if (dbIsSqlCe) - { - var datasource = databaseSettings.ConnectionString.Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory").ToString()); - var filePath = datasource.Replace("Data Source=", string.Empty); - sqlCeDatabaseExists = File.Exists(filePath); - } - - // Either the connection details are not fully specified or it's a SQL CE database that doesn't exist yet - if (databaseSettings == null - || string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) || string.IsNullOrWhiteSpace(databaseSettings.ProviderName) - || (dbIsSqlCe && sqlCeDatabaseExists == false)) - { - installProgress.Visible = true; - upgradeProgress.Visible = false; - ShowDatabaseSettings(); - } - else - { - //Since a connection string was present we verify whether this is an upgrade or an empty db - var result = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema(); - var determinedVersion = result.DetermineInstalledVersion(); - if (determinedVersion.Equals(new Version(0, 0, 0))) - { - //Fresh install - installProgress.Visible = true; - upgradeProgress.Visible = false; - } - else - { - //Upgrade - installProgress.Visible = false; - upgradeProgress.Visible = true; - } - - settings.Visible = false; - installing.Visible = true; - } - } - } - - /// - /// Prepares and shows the database settings panel. - /// - protected void ShowDatabaseSettings() - { - // Parse the connection string - var connectionStringBuilder = new DbConnectionStringBuilder(); - - var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; - if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false) - { - var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false); - connectionStringBuilder.ConnectionString = dataHelper.ConnectionString; - - // Prepare data layer type - var datalayerType = GetConnectionStringValue(connectionStringBuilder, "datalayer"); - if (datalayerType.Length > 0) - { - foreach (ListItem item in DatabaseType.Items) - if (item.Value != string.Empty && datalayerType.Contains(item.Value)) - DatabaseType.SelectedValue = item.Value; - } - else if (dataHelper.ConnectionString != "server=.\\SQLEXPRESS;database=DATABASE;user id=USER;password=PASS") - DatabaseType.SelectedValue = "SqlServer"; - } - else - { - DatabaseType.SelectedValue = "SqlServer"; - } - - DatabaseType_SelectedIndexChanged(this, new EventArgs()); - - // Prepare other fields - DatabaseServer.Text = GetConnectionStringValue(connectionStringBuilder, "server"); - if (string.IsNullOrEmpty(DatabaseServer.Text)) DatabaseServer.Text = GetConnectionStringValue(connectionStringBuilder, "Data Source"); - DatabaseName.Text = GetConnectionStringValue(connectionStringBuilder, "database"); - if (string.IsNullOrEmpty(DatabaseName.Text)) DatabaseName.Text = GetConnectionStringValue(connectionStringBuilder, "Initial Catalog"); - DatabaseUsername.Text = GetConnectionStringValue(connectionStringBuilder, "user id"); - DatabasePassword.Text = GetConnectionStringValue(connectionStringBuilder, "password"); - if (string.IsNullOrEmpty(DatabasePassword.Text)) DatabasePassword.Text = GetConnectionStringValue(connectionStringBuilder, "pwd"); - - ToggleVisible(DatabaseServerItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabaseUsernameItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabasePasswordItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabaseNameItem, !ManualConnectionString && !IsEmbeddedDatabase); - - if (IsNewInstall || IsEmbeddedDatabase) - dbinit.Text = "$('#databaseOptionEmbedded').click();$('#databaseOptionEmbedded').change();"; - else if (ManualConnectionString) - dbinit.Text = "$('#databaseOptionAdvanced').click();$('#databaseOptionAdvanced').change();"; - else if (DatabaseType.SelectedValue == "SqlServer") - dbinit.Text = "$('#databaseOptionBlank').click();$('#databaseOptionBlank').change();"; - else if (DatabaseType.SelectedValue == "SqlAzure") - dbinit.Text = "$('#databaseOptionBlank').click();$('#databaseOptionBlank').change();"; - //toggleVisible(DatabaseConnectionString, ManualConnectionString); - - // Make sure ASP.Net displays the password text - DatabasePassword.Attributes["value"] = DatabasePassword.Text; - } - - /// - /// Shows the installation/upgrade panel. - /// - protected void SaveDbConfig(object sender, EventArgs e) - { - try - { - var dbContext = ApplicationContext.Current.DatabaseContext; - - if (string.IsNullOrEmpty(ConnectionString.Text) == false) - { - dbContext.ConfigureDatabaseConnection(ConnectionString.Text); - } - else if (IsEmbeddedDatabase) - { - dbContext.ConfigureEmbeddedDatabaseConnection(); - } - else - { - var server = DatabaseServer.Text; - var databaseName = DatabaseName.Text; - - if (DatabaseType.SelectedValue == "SqlServer" && DatabaseIntegratedSecurity.Checked == true) - { - dbContext.ConfigureIntegratedSecurityDatabaseConnection(server, databaseName); - } - else - { - dbContext.ConfigureDatabaseConnection(server, databaseName, - DatabaseUsername.Text, DatabasePassword.Text, DatabaseType.SelectedValue - ); - } - } - } - catch (Exception ex) - { - LogHelper.Error("Exception was thrown during the setup of the database in 'saveDBConfig'.", ex); - } - - settings.Visible = false; - installing.Visible = true; - } - - /// - /// Gets the value of the specified item in the connection string. - /// - /// The connection string. - /// Name of the item. - /// The value of the item, or an empty string if not found. - protected string GetConnectionStringValue(DbConnectionStringBuilder connectionStringBuilder, string keyword) - { - object value = null; - connectionStringBuilder.TryGetValue(keyword, out value); - return (string)value ?? String.Empty; - } - - /// - /// Show the needed fields according to the database type. - /// - /// The sender. - /// The event arguments. - protected void DatabaseType_SelectedIndexChanged(object sender, EventArgs e) - { - ToggleVisible(DatabaseServerItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabaseUsernameItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabasePasswordItem, !ManualConnectionString && !IsEmbeddedDatabase); - ToggleVisible(DatabaseNameItem, !ManualConnectionString && !IsEmbeddedDatabase); - - //toggleVisible(DatabaseConnectionString, ManualConnectionString); - } - - private static void ToggleVisible(HtmlGenericControl div, bool visible) - { - if (!visible) - div.Attributes["style"] = "display: none;"; - else - div.Attributes["style"] = "display: block;"; - } - - protected void GotoSettings(object sender, EventArgs e) - { - settings.Visible = true; - installing.Visible = false; - - ShowDatabaseSettings(); - - jsVars.Text = "showDatabaseSettings();"; - } - - } +using System; +using System.Configuration; +using System.Data.Common; +using System.Web.UI.WebControls; +using System.Web.UI.HtmlControls; +using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using System.IO; +using Umbraco.Core.Persistence; +using Umbraco.Web.Install; +using umbraco.DataLayer; + +namespace Umbraco.Web.UI.Install.Steps +{ + /// + /// Database detection step in the installer wizard. + /// + public partial class Database : StepUserControl + { + /// + /// Returns whether the selected database is an embedded database. + /// + protected bool IsEmbeddedDatabase + { + get + { + var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + var configuredDatabaseIsEmbedded = databaseSettings != null && databaseSettings.ProviderName.ToLower().Contains("SqlServerCe".ToLower()); + + return Request["database"] == "embedded" || configuredDatabaseIsEmbedded; + } + } + + protected bool IsConfigured + { + get { return DatabaseType.SelectedValue != ""; } + } + + protected bool IsNewInstall + { + get + { + var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + if (databaseSettings != null && ( + databaseSettings.ConnectionString.Trim() == string.Empty + && databaseSettings.ProviderName.Trim() == string.Empty + && GlobalSettings.ConfigurationStatus == string.Empty)) + { + return true; + } + + return false; + } + } + + /// + /// Returns whether the connection string is set by direct text input. + /// + protected bool ManualConnectionString + { + get { return Request["database"] == "advanced"; } + } + + /// + /// Shows the right panel to the user. + /// + /// The sender. + /// The event arguments. + protected void Page_Load(object sender, System.EventArgs e) + { + // Does the user have to enter a connection string? + if (settings.Visible && !Page.IsPostBack) + { + //If the connection string is already present in web.config we don't need to show the settings page and we jump to installing/upgrading. + var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + + var dbIsSqlCe = false; + if(databaseSettings != null && databaseSettings.ProviderName != null) + dbIsSqlCe = databaseSettings.ProviderName == "System.Data.SqlServerCe.4.0"; + var sqlCeDatabaseExists = false; + if (dbIsSqlCe) + { + var datasource = databaseSettings.ConnectionString.Replace("|DataDirectory|", AppDomain.CurrentDomain.GetData("DataDirectory").ToString()); + var filePath = datasource.Replace("Data Source=", string.Empty); + sqlCeDatabaseExists = File.Exists(filePath); + } + + // Either the connection details are not fully specified or it's a SQL CE database that doesn't exist yet + if (databaseSettings == null + || string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) || string.IsNullOrWhiteSpace(databaseSettings.ProviderName) + || (dbIsSqlCe && sqlCeDatabaseExists == false)) + { + installProgress.Visible = true; + upgradeProgress.Visible = false; + ShowDatabaseSettings(); + } + else + { + //Since a connection string was present we verify whether this is an upgrade or an empty db + var result = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema(); + var determinedVersion = result.DetermineInstalledVersion(); + if (determinedVersion.Equals(new Version(0, 0, 0))) + { + //Fresh install + installProgress.Visible = true; + upgradeProgress.Visible = false; + } + else + { + //Upgrade + installProgress.Visible = false; + upgradeProgress.Visible = true; + } + + settings.Visible = false; + installing.Visible = true; + } + } + } + + /// + /// Prepares and shows the database settings panel. + /// + protected void ShowDatabaseSettings() + { + // Parse the connection string + var connectionStringBuilder = new DbConnectionStringBuilder(); + + var databaseSettings = ConfigurationManager.ConnectionStrings[GlobalSettings.UmbracoConnectionName]; + if (databaseSettings != null && string.IsNullOrWhiteSpace(databaseSettings.ConnectionString) == false) + { + var dataHelper = DataLayerHelper.CreateSqlHelper(databaseSettings.ConnectionString, false); + connectionStringBuilder.ConnectionString = dataHelper.ConnectionString; + + // Prepare data layer type + var datalayerType = GetConnectionStringValue(connectionStringBuilder, "datalayer"); + if (datalayerType.Length > 0) + { + foreach (ListItem item in DatabaseType.Items) + if (item.Value != string.Empty && datalayerType.Contains(item.Value)) + DatabaseType.SelectedValue = item.Value; + } + else if (dataHelper.ConnectionString != "server=.\\SQLEXPRESS;database=DATABASE;user id=USER;password=PASS") + DatabaseType.SelectedValue = "SqlServer"; + } + else + { + DatabaseType.SelectedValue = "SqlServer"; + } + + DatabaseType_SelectedIndexChanged(this, new EventArgs()); + + // Prepare other fields + DatabaseServer.Text = GetConnectionStringValue(connectionStringBuilder, "server"); + if (string.IsNullOrEmpty(DatabaseServer.Text)) DatabaseServer.Text = GetConnectionStringValue(connectionStringBuilder, "Data Source"); + DatabaseName.Text = GetConnectionStringValue(connectionStringBuilder, "database"); + if (string.IsNullOrEmpty(DatabaseName.Text)) DatabaseName.Text = GetConnectionStringValue(connectionStringBuilder, "Initial Catalog"); + DatabaseUsername.Text = GetConnectionStringValue(connectionStringBuilder, "user id"); + DatabasePassword.Text = GetConnectionStringValue(connectionStringBuilder, "password"); + if (string.IsNullOrEmpty(DatabasePassword.Text)) DatabasePassword.Text = GetConnectionStringValue(connectionStringBuilder, "pwd"); + + ToggleVisible(DatabaseServerItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabaseUsernameItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabasePasswordItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabaseNameItem, !ManualConnectionString && !IsEmbeddedDatabase); + + if (IsNewInstall || IsEmbeddedDatabase) + dbinit.Text = "$('#databaseOptionEmbedded').click();$('#databaseOptionEmbedded').change();"; + else if (ManualConnectionString) + dbinit.Text = "$('#databaseOptionAdvanced').click();$('#databaseOptionAdvanced').change();"; + else if (DatabaseType.SelectedValue == "SqlServer") + dbinit.Text = "$('#databaseOptionBlank').click();$('#databaseOptionBlank').change();"; + else if (DatabaseType.SelectedValue == "SqlAzure") + dbinit.Text = "$('#databaseOptionBlank').click();$('#databaseOptionBlank').change();"; + //toggleVisible(DatabaseConnectionString, ManualConnectionString); + + // Make sure ASP.Net displays the password text + DatabasePassword.Attributes["value"] = DatabasePassword.Text; + } + + /// + /// Shows the installation/upgrade panel. + /// + protected void SaveDbConfig(object sender, EventArgs e) + { + try + { + var dbContext = ApplicationContext.Current.DatabaseContext; + + if (string.IsNullOrEmpty(ConnectionString.Text) == false) + { + dbContext.ConfigureDatabaseConnection(ConnectionString.Text); + } + else if (IsEmbeddedDatabase) + { + dbContext.ConfigureEmbeddedDatabaseConnection(); + } + else + { + var server = DatabaseServer.Text; + var databaseName = DatabaseName.Text; + + if (DatabaseType.SelectedValue == "SqlServer" && DatabaseIntegratedSecurity.Checked == true) + { + dbContext.ConfigureIntegratedSecurityDatabaseConnection(server, databaseName); + } + else + { + dbContext.ConfigureDatabaseConnection(server, databaseName, + DatabaseUsername.Text, DatabasePassword.Text, DatabaseType.SelectedValue + ); + } + } + } + catch (Exception ex) + { + LogHelper.Error("Exception was thrown during the setup of the database in 'saveDBConfig'.", ex); + } + + settings.Visible = false; + installing.Visible = true; + } + + /// + /// Gets the value of the specified item in the connection string. + /// + /// The connection string. + /// Name of the item. + /// The value of the item, or an empty string if not found. + protected string GetConnectionStringValue(DbConnectionStringBuilder connectionStringBuilder, string keyword) + { + object value = null; + connectionStringBuilder.TryGetValue(keyword, out value); + return (string)value ?? String.Empty; + } + + /// + /// Show the needed fields according to the database type. + /// + /// The sender. + /// The event arguments. + protected void DatabaseType_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleVisible(DatabaseServerItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabaseUsernameItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabasePasswordItem, !ManualConnectionString && !IsEmbeddedDatabase); + ToggleVisible(DatabaseNameItem, !ManualConnectionString && !IsEmbeddedDatabase); + + //toggleVisible(DatabaseConnectionString, ManualConnectionString); + } + + private static void ToggleVisible(HtmlGenericControl div, bool visible) + { + if (!visible) + div.Attributes["style"] = "display: none;"; + else + div.Attributes["style"] = "display: block;"; + } + + protected void GotoSettings(object sender, EventArgs e) + { + settings.Visible = true; + installing.Visible = false; + + ShowDatabaseSettings(); + + jsVars.Text = "showDatabaseSettings();"; + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/Database.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/Database.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.designer.cs index 2c41a8968e..2e2a2c9de1 100644 --- a/src/Umbraco.Web.UI/install/steps/Database.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Database.ascx.designer.cs @@ -1,249 +1,249 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps { - - - public partial class Database { - - /// - /// settings control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder settings; - - /// - /// DatabaseType control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList DatabaseType; - - /// - /// ph_dbError control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder ph_dbError; - - /// - /// lt_dbError control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal lt_dbError; - - /// - /// DatabaseServerItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseServerItem; - - /// - /// DatabaseServerLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label DatabaseServerLabel; - - /// - /// DatabaseServer control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox DatabaseServer; - - /// - /// DatabaseNameItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseNameItem; - - /// - /// DatabaseNameLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label DatabaseNameLabel; - - /// - /// DatabaseName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox DatabaseName; - - /// - /// DatabaseIntegratedSecurity control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox DatabaseIntegratedSecurity; - - /// - /// DatabaseUsernameItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseUsernameItem; - - /// - /// DatabaseUsernameLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label DatabaseUsernameLabel; - - /// - /// DatabaseUsername control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox DatabaseUsername; - - /// - /// DatabasePasswordItem control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabasePasswordItem; - - /// - /// DatabasePasswordLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label DatabasePasswordLabel; - - /// - /// DatabasePassword control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox DatabasePassword; - - /// - /// embeddedFilesMissing control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl embeddedFilesMissing; - - /// - /// DatabaseConnectionString control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseConnectionString; - - /// - /// ConnectionStringLabel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label ConnectionStringLabel; - - /// - /// ConnectionString control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox ConnectionString; - - /// - /// jsVars control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal jsVars; - - /// - /// dbinit control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal dbinit; - - /// - /// installing control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder installing; - - /// - /// installProgress control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder installProgress; - - /// - /// upgradeProgress control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder upgradeProgress; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps { + + + public partial class Database { + + /// + /// settings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder settings; + + /// + /// DatabaseType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList DatabaseType; + + /// + /// ph_dbError control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder ph_dbError; + + /// + /// lt_dbError control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal lt_dbError; + + /// + /// DatabaseServerItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseServerItem; + + /// + /// DatabaseServerLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label DatabaseServerLabel; + + /// + /// DatabaseServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox DatabaseServer; + + /// + /// DatabaseNameItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseNameItem; + + /// + /// DatabaseNameLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label DatabaseNameLabel; + + /// + /// DatabaseName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox DatabaseName; + + /// + /// DatabaseIntegratedSecurity control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox DatabaseIntegratedSecurity; + + /// + /// DatabaseUsernameItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseUsernameItem; + + /// + /// DatabaseUsernameLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label DatabaseUsernameLabel; + + /// + /// DatabaseUsername control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox DatabaseUsername; + + /// + /// DatabasePasswordItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabasePasswordItem; + + /// + /// DatabasePasswordLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label DatabasePasswordLabel; + + /// + /// DatabasePassword control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox DatabasePassword; + + /// + /// embeddedFilesMissing control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl embeddedFilesMissing; + + /// + /// DatabaseConnectionString control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl DatabaseConnectionString; + + /// + /// ConnectionStringLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label ConnectionStringLabel; + + /// + /// ConnectionString control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox ConnectionString; + + /// + /// jsVars control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal jsVars; + + /// + /// dbinit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal dbinit; + + /// + /// installing control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder installing; + + /// + /// installProgress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder installProgress; + + /// + /// upgradeProgress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder upgradeProgress; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.cs index 9df2a3798a..6835c1e8fe 100644 --- a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.cs @@ -1,94 +1,94 @@ -using System; -using System.Web.Security; -using Umbraco.Core.Configuration; -using Umbraco.Core.Logging; -using Umbraco.Core.Security; -using Umbraco.Web.Install; -using Umbraco.Web.Security; -using umbraco.BusinessLogic; -using umbraco.providers; -using System.Collections.Specialized; - -namespace Umbraco.Web.UI.Install.Steps -{ - /// - /// Summary description for defaultUser. - /// - public partial class DefaultUser : StepUserControl - { - - protected MembershipProvider CurrentProvider - { - get - { - var provider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; - if (provider == null) - { - throw new InvalidOperationException("No MembershipProvider found with name " + UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider); - } - return provider; - } - } - - protected void ChangePasswordClick(object sender, EventArgs e) - { - Page.Validate(); - - if (Page.IsValid) - { - var user = User.GetUser(0); - - var membershipUser = CurrentProvider.GetUser(0, true); - if (membershipUser == null) - { - throw new InvalidOperationException("No user found in membership provider with id of 0"); - } - - try - { - var success = membershipUser.ChangePassword(user.GetPassword(), tb_password.Text.Trim()); - if (success == false) - { - PasswordValidator.IsValid = false; - PasswordValidator.ErrorMessage = "Password must be at least " + CurrentProvider.MinRequiredPasswordLength + " characters long and contain at least " + CurrentProvider.MinRequiredNonAlphanumericCharacters + " symbols"; - return; - } - } - catch (Exception ex) - { - PasswordValidator.IsValid = false; - PasswordValidator.ErrorMessage = "Password must be at least " + CurrentProvider.MinRequiredPasswordLength + " characters long and contain at least " + CurrentProvider.MinRequiredNonAlphanumericCharacters + " symbols"; - return; - } - - user.Email = tb_email.Text.Trim(); - user.Name = tb_name.Text.Trim(); - user.LoginName = tb_login.Text; - - user.Save(); - - if (cb_newsletter.Checked) - { - try - { - var client = new System.Net.WebClient(); - var values = new NameValueCollection {{"name", tb_name.Text}, {"email", tb_email.Text}}; - - client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values); - } - catch (Exception ex) - { - LogHelper.Error("An error occurred subscribing user to newsletter", ex); - } - } - - - if (String.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus)) - UmbracoContext.Current.Security.PerformLogin(user.Id); - - InstallHelper.RedirectToNextStep(Page, GetCurrentStep()); - } - } - - } +using System; +using System.Web.Security; +using Umbraco.Core.Configuration; +using Umbraco.Core.Logging; +using Umbraco.Core.Security; +using Umbraco.Web.Install; +using Umbraco.Web.Security; +using umbraco.BusinessLogic; +using umbraco.providers; +using System.Collections.Specialized; + +namespace Umbraco.Web.UI.Install.Steps +{ + /// + /// Summary description for defaultUser. + /// + public partial class DefaultUser : StepUserControl + { + + protected MembershipProvider CurrentProvider + { + get + { + var provider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider]; + if (provider == null) + { + throw new InvalidOperationException("No MembershipProvider found with name " + UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider); + } + return provider; + } + } + + protected void ChangePasswordClick(object sender, EventArgs e) + { + Page.Validate(); + + if (Page.IsValid) + { + var user = User.GetUser(0); + + var membershipUser = CurrentProvider.GetUser(0, true); + if (membershipUser == null) + { + throw new InvalidOperationException("No user found in membership provider with id of 0"); + } + + try + { + var success = membershipUser.ChangePassword(user.GetPassword(), tb_password.Text.Trim()); + if (success == false) + { + PasswordValidator.IsValid = false; + PasswordValidator.ErrorMessage = "Password must be at least " + CurrentProvider.MinRequiredPasswordLength + " characters long and contain at least " + CurrentProvider.MinRequiredNonAlphanumericCharacters + " symbols"; + return; + } + } + catch (Exception ex) + { + PasswordValidator.IsValid = false; + PasswordValidator.ErrorMessage = "Password must be at least " + CurrentProvider.MinRequiredPasswordLength + " characters long and contain at least " + CurrentProvider.MinRequiredNonAlphanumericCharacters + " symbols"; + return; + } + + user.Email = tb_email.Text.Trim(); + user.Name = tb_name.Text.Trim(); + user.LoginName = tb_login.Text; + + user.Save(); + + if (cb_newsletter.Checked) + { + try + { + var client = new System.Net.WebClient(); + var values = new NameValueCollection {{"name", tb_name.Text}, {"email", tb_email.Text}}; + + client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values); + } + catch (Exception ex) + { + LogHelper.Error("An error occurred subscribing user to newsletter", ex); + } + } + + + if (String.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus)) + UmbracoContext.Current.Security.PerformLogin(user.Id); + + InstallHelper.RedirectToNextStep(Page, GetCurrentStep()); + } + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.designer.cs index e785e804e3..1f708ce16d 100644 --- a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/DefaultUser.ascx.designer.cs @@ -1,87 +1,87 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps { - - - public partial class DefaultUser { - - /// - /// identify control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder identify; - - /// - /// tb_name control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox tb_name; - - /// - /// tb_email control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox tb_email; - - /// - /// tb_login control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox tb_login; - - /// - /// tb_password control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox tb_password; - - /// - /// PasswordValidator control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CustomValidator PasswordValidator; - - /// - /// tb_password_confirm control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox tb_password_confirm; - - /// - /// cb_newsletter control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox cb_newsletter; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps { + + + public partial class DefaultUser { + + /// + /// identify control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder identify; + + /// + /// tb_name control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tb_name; + + /// + /// tb_email control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tb_email; + + /// + /// tb_login control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tb_login; + + /// + /// tb_password control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tb_password; + + /// + /// PasswordValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CustomValidator PasswordValidator; + + /// + /// tb_password_confirm control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tb_password_confirm; + + /// + /// cb_newsletter control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cb_newsletter; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/License.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.cs similarity index 94% rename from src/Umbraco.Web.UI/install/steps/License.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.cs index ff6a6c6c50..69e0a3e4e3 100644 --- a/src/Umbraco.Web.UI/install/steps/License.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using Umbraco.Web.Install; - -namespace Umbraco.Web.UI.Install.Steps -{ - public partial class License : StepUserControl - { - - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Umbraco.Web.Install; + +namespace Umbraco.Web.UI.Install.Steps +{ + public partial class License : StepUserControl + { + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/License.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.designer.cs similarity index 96% rename from src/Umbraco.Web.UI/install/steps/License.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.designer.cs index 76f8b87c8f..25590c60a3 100644 --- a/src/Umbraco.Web.UI/install/steps/License.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/License.ascx.designer.cs @@ -1,24 +1,24 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps { - - - public partial class License { - - /// - /// btnNext control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton btnNext; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps { + + + public partial class License { + + /// + /// btnNext control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton btnNext; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/Renaming.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.cs similarity index 96% rename from src/Umbraco.Web.UI/install/steps/Renaming.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.cs index 496690a715..8deb109514 100644 --- a/src/Umbraco.Web.UI/install/steps/Renaming.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.cs @@ -1,79 +1,79 @@ -using System; -using System.IO; -using System.Xml; -using Umbraco.Core.IO; - -namespace Umbraco.Web.UI.Install.Steps -{ - public partial class Renaming : StepUserControl - { - private readonly string _oldAccessFilePath = IOHelper.MapPath(SystemDirectories.Data + "/access.xml"); - private readonly string _newAccessFilePath = IOHelper.MapPath(SystemDirectories.Data + "/access.config"); - private bool _changesNeeded = false; - - protected void Page_Load(object sender, EventArgs e) - { - // check access.xml file - identifyResult.Text += CheckAccessFile(); - - if (_changesNeeded) - { - changesNeeded.Visible = true; - } - else - { - noChangedNeeded.Visible = true; - changesNeeded.Visible = false; - } - } - - private string CheckAccessFile() - { - if (!NewAccessFileExist() && OldAccessFileExist()) - { - _changesNeeded = true; - return "
  • Access.xml found. Needs to be renamed to access.config
  • "; - } - return "
  • Public Access file is all good. No changes needed
  • "; - } - - private bool OldAccessFileExist() - { - return File.Exists(_oldAccessFilePath); - } - - private bool NewAccessFileExist() - { - return File.Exists(_newAccessFilePath); - } - - protected void UpdateChangesClick(object sender, EventArgs e) - { - bool succes = true; - string progressText = ""; - - // rename access file - if (OldAccessFileExist()) - { - try - { - File.Move(_oldAccessFilePath, IOHelper.MapPath(SystemFiles.AccessXml)); - progressText += String.Format("
  • Public Access file renamed
  • "); - } - catch (Exception ee) - { - progressText += String.Format("
  • Error renaming access file: {0}
  • ", ee.ToString()); - succes = false; - } - } - - string resultClass = succes ? "success" : "error"; - resultText.Text = String.Format("

    {1}

    ", - resultClass, - progressText); - result.Visible = true; - init.Visible = false; - } - - } +using System; +using System.IO; +using System.Xml; +using Umbraco.Core.IO; + +namespace Umbraco.Web.UI.Install.Steps +{ + public partial class Renaming : StepUserControl + { + private readonly string _oldAccessFilePath = IOHelper.MapPath(SystemDirectories.Data + "/access.xml"); + private readonly string _newAccessFilePath = IOHelper.MapPath(SystemDirectories.Data + "/access.config"); + private bool _changesNeeded = false; + + protected void Page_Load(object sender, EventArgs e) + { + // check access.xml file + identifyResult.Text += CheckAccessFile(); + + if (_changesNeeded) + { + changesNeeded.Visible = true; + } + else + { + noChangedNeeded.Visible = true; + changesNeeded.Visible = false; + } + } + + private string CheckAccessFile() + { + if (!NewAccessFileExist() && OldAccessFileExist()) + { + _changesNeeded = true; + return "
  • Access.xml found. Needs to be renamed to access.config
  • "; + } + return "
  • Public Access file is all good. No changes needed
  • "; + } + + private bool OldAccessFileExist() + { + return File.Exists(_oldAccessFilePath); + } + + private bool NewAccessFileExist() + { + return File.Exists(_newAccessFilePath); + } + + protected void UpdateChangesClick(object sender, EventArgs e) + { + bool succes = true; + string progressText = ""; + + // rename access file + if (OldAccessFileExist()) + { + try + { + File.Move(_oldAccessFilePath, IOHelper.MapPath(SystemFiles.AccessXml)); + progressText += String.Format("
  • Public Access file renamed
  • "); + } + catch (Exception ee) + { + progressText += String.Format("
  • Error renaming access file: {0}
  • ", ee.ToString()); + succes = false; + } + } + + string resultClass = succes ? "success" : "error"; + resultText.Text = String.Format("

    {1}

    ", + resultClass, + progressText); + result.Visible = true; + init.Visible = false; + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/Renaming.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/Renaming.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.designer.cs index 90743813a4..5aab34af89 100644 --- a/src/Umbraco.Web.UI/install/steps/Renaming.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Renaming.ascx.designer.cs @@ -1,78 +1,78 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps { - - - public partial class Renaming { - - /// - /// init control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel init; - - /// - /// noChangedNeeded control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel noChangedNeeded; - - /// - /// changesNeeded control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel changesNeeded; - - /// - /// identifyResult control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal identifyResult; - - /// - /// updateChanges control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button updateChanges; - - /// - /// result control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel result; - - /// - /// resultText control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal resultText; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps { + + + public partial class Renaming { + + /// + /// init control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel init; + + /// + /// noChangedNeeded control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel noChangedNeeded; + + /// + /// changesNeeded control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel changesNeeded; + + /// + /// identifyResult control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal identifyResult; + + /// + /// updateChanges control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button updateChanges; + + /// + /// result control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel result; + + /// + /// resultText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal resultText; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx similarity index 97% rename from src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx index 1b94e7ebd9..713af0460d 100644 --- a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx @@ -1,27 +1,27 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RenderingEngine.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.RenderingEngine" %> - -
    -
    -

    - Chose how you like to work with Templates

    -

    - Umbraco works with both ASP.NET WebForms (also known as MasterPages) and ASP.NET MVC (called Views). If you're not sure, we recommend using the MVC templates. You can of course use both but let's select a default one to get started. -

    -
    -
    -
    -

    - Choose a default template type: -

    - - MVC - Web forms - -
    -
    - -
    -
     
    - Continue -
    -
    +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RenderingEngine.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.RenderingEngine" %> + +
    +
    +

    + Chose how you like to work with Templates

    +

    + Umbraco works with both ASP.NET WebForms (also known as MasterPages) and ASP.NET MVC (called Views). If you're not sure, we recommend using the MVC templates. You can of course use both but let's select a default one to get started. +

    +
    +
    +
    +

    + Choose a default template type: +

    + + MVC + Web forms + +
    +
    + +
    +
     
    + Continue +
    +
    diff --git a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.cs similarity index 96% rename from src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.cs index b47830ecbe..64f2fedb27 100644 --- a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.cs @@ -1,22 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Umbraco.Core.Configuration; - -namespace Umbraco.Web.UI.Install.Steps -{ - public partial class RenderingEngine : StepUserControl - { - protected override void GotoNextStep(object sender, EventArgs e) - { - ////set the default engine - //UmbracoSettings.DefaultRenderingEngine = Core.RenderingEngine.Mvc; - //UmbracoSettings.Save(); - - base.GotoNextStep(sender, e); - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Umbraco.Core.Configuration; + +namespace Umbraco.Web.UI.Install.Steps +{ + public partial class RenderingEngine : StepUserControl + { + protected override void GotoNextStep(object sender, EventArgs e) + { + ////set the default engine + //UmbracoSettings.DefaultRenderingEngine = Core.RenderingEngine.Mvc; + //UmbracoSettings.Save(); + + base.GotoNextStep(sender, e); + } + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.designer.cs index 44e5bc8d04..e7c63a8e58 100644 --- a/src/Umbraco.Web.UI/install/steps/RenderingEngine.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/RenderingEngine.ascx.designer.cs @@ -1,33 +1,33 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps { - - - public partial class RenderingEngine { - - /// - /// EngineSelection control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RadioButtonList EngineSelection; - - /// - /// btnNext control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton btnNext; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps { + + + public partial class RenderingEngine { + + /// + /// EngineSelection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList EngineSelection; + + /// + /// btnNext control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton btnNext; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.cs similarity index 96% rename from src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.cs index c27ce02c2f..ddfd544035 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.cs @@ -1,104 +1,104 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; -using Umbraco.Core.Logging; -using Umbraco.Web.Install; - -namespace Umbraco.Web.UI.Install.Steps.Skinning -{ - public delegate void StarterKitInstalledEventHandler(); - - public partial class LoadStarterKits : StepUserControl - { - /// - /// Returns the string for the package installer web service base url - /// - protected string PackageInstallServiceBaseUrl { get; private set; } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - //Get the URL for the package install service base url - var umbracoPath = Core.Configuration.GlobalSettings.UmbracoMvcArea; - var urlHelper = new UrlHelper(Context.Request.RequestContext); - PackageInstallServiceBaseUrl = urlHelper.Action("Index", "InstallPackage", new { area = umbracoPath }); - } - - /// - /// Flag to show if we can connect to the repo or not - /// - protected bool CannotConnect { get; private set; } - - public event StarterKitInstalledEventHandler StarterKitInstalled; - - protected virtual void OnStarterKitInstalled() - { - StarterKitInstalled(); - } - - - private readonly global::umbraco.cms.businesslogic.packager.repositories.Repository _repo; - private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; - - public LoadStarterKits() - { - _repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid); - } - - protected void Page_Load(object sender, EventArgs e) - { - - } - - protected void NextStep(object sender, EventArgs e) - { - var p = (Default)this.Page; - InstallHelper.RedirectToNextStep(Page, Request.GetItemAsString("installStep")); - } - - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - - if (_repo == null) - { - throw new InvalidOperationException("Could not find repository with id " + RepoGuid); - } - - //clear progressbar cache - InstallHelper.ClearProgress(); - - if (_repo.HasConnection()) - { - try - { - var r = new org.umbraco.our.Repository(); - - rep_starterKits.DataSource = r.Modules(); - rep_starterKits.DataBind(); - } - catch (Exception ex) - { - LogHelper.Error("Cannot connect to package repository", ex); - CannotConnect = true; - - } - } - else - { - CannotConnect = true; - } - } - - - protected void GotoLastStep(object sender, EventArgs e) - { - InstallHelper.RedirectToLastStep(Page); - } - - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; +using Umbraco.Core.Logging; +using Umbraco.Web.Install; + +namespace Umbraco.Web.UI.Install.Steps.Skinning +{ + public delegate void StarterKitInstalledEventHandler(); + + public partial class LoadStarterKits : StepUserControl + { + /// + /// Returns the string for the package installer web service base url + /// + protected string PackageInstallServiceBaseUrl { get; private set; } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + //Get the URL for the package install service base url + var umbracoPath = Core.Configuration.GlobalSettings.UmbracoMvcArea; + var urlHelper = new UrlHelper(Context.Request.RequestContext); + PackageInstallServiceBaseUrl = urlHelper.Action("Index", "InstallPackage", new { area = umbracoPath }); + } + + /// + /// Flag to show if we can connect to the repo or not + /// + protected bool CannotConnect { get; private set; } + + public event StarterKitInstalledEventHandler StarterKitInstalled; + + protected virtual void OnStarterKitInstalled() + { + StarterKitInstalled(); + } + + + private readonly global::umbraco.cms.businesslogic.packager.repositories.Repository _repo; + private const string RepoGuid = "65194810-1f85-11dd-bd0b-0800200c9a66"; + + public LoadStarterKits() + { + _repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid); + } + + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void NextStep(object sender, EventArgs e) + { + var p = (Default)this.Page; + InstallHelper.RedirectToNextStep(Page, Request.GetItemAsString("installStep")); + } + + protected override void OnInit(EventArgs e) + { + base.OnInit(e); + + if (_repo == null) + { + throw new InvalidOperationException("Could not find repository with id " + RepoGuid); + } + + //clear progressbar cache + InstallHelper.ClearProgress(); + + if (_repo.HasConnection()) + { + try + { + var r = new org.umbraco.our.Repository(); + + rep_starterKits.DataSource = r.Modules(); + rep_starterKits.DataBind(); + } + catch (Exception ex) + { + LogHelper.Error("Cannot connect to package repository", ex); + CannotConnect = true; + + } + } + else + { + CannotConnect = true; + } + } + + + protected void GotoLastStep(object sender, EventArgs e) + { + InstallHelper.RedirectToLastStep(Page); + } + + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.designer.cs similarity index 97% rename from src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.designer.cs index 3af8ec681c..f9f25ad3a1 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/LoadStarterKits.ascx.designer.cs +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/LoadStarterKits.ascx.designer.cs @@ -1,60 +1,60 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Install.Steps.Skinning { - - - public partial class LoadStarterKits { - - /// - /// pl_loadStarterKits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder pl_loadStarterKits; - - /// - /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// rep_starterKits control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater rep_starterKits; - - /// - /// LinkButton1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton LinkButton1; - - /// - /// LinkButton2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.LinkButton LinkButton2; - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Umbraco.Web.UI.Install.Steps.Skinning { + + + public partial class LoadStarterKits { + + /// + /// pl_loadStarterKits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder pl_loadStarterKits; + + /// + /// JsInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; + + /// + /// rep_starterKits control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Repeater rep_starterKits; + + /// + /// LinkButton1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton LinkButton1; + + /// + /// LinkButton2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.LinkButton LinkButton2; + } +} diff --git a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/loadStarterKits.ascx similarity index 97% rename from src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx rename to src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/loadStarterKits.ascx index 586162a2fd..6ad0d173f9 100644 --- a/src/Umbraco.Web.UI/install/steps/Skinning/loadStarterKits.ascx +++ b/src/Umbraco.Web.UI/Areas/UmbracoInstall/steps/Skinning/loadStarterKits.ascx @@ -1,98 +1,98 @@ -<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="LoadStarterKits.ascx.cs" Inherits="Umbraco.Web.UI.Install.Steps.Skinning.LoadStarterKits" %> -<%@ Import Namespace="Umbraco.Web.org.umbraco.our" %> - -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - - - - - - <% if (!CannotConnect) { %> - - <% } %> - - - - - - No thanks, do not install a starterkit! - - - - - - -
    "> - -
    -

    Oops...the installer can't connect to the repository

    - Starter Kits could not be fetched from the repository as there was no connection - which can occur if you are using a proxy server or firewall with certain configurations, - or if you are not currently connected to the internet. -
    - Click Continue to complete the installation then navigate to the Developer section of your Umbraco installation - where you will find the Starter Kits listed in the Packages tree. -
    - - -
    -
     
    - Continue -
    - -
    - -