@@ -310,6 +342,8 @@
if (json.Success) {
$(".btn-box").show();
$('.ui-progressbar-value').css("background-image", "url(../umbraco_client/installer/images/pbar.gif)");
+ $(".result-status-container").show();
+ $(".progress-status-container").hide();
} else {
$(".btn-continue").hide();
$(".btn-back").show();
@@ -320,32 +354,4 @@
});
-
-
-
-
- Database installed
-
-
- Umbraco
- <%=UmbracoVersion.Current.ToString(3)%>
- has now been copied to your database. Press Continue to proceed.
-
-
-
-
- Database upgraded
-
-
- Your database has been upgraded to version:
- <%=UmbracoVersion.Current.ToString(3)%>.
- Press Continue to proceed.
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config
index e1934cd61c..d83c0e0cef 100644
--- a/src/Umbraco.Web.UI/web.Template.config
+++ b/src/Umbraco.Web.UI/web.Template.config
@@ -66,7 +66,7 @@
-
+
diff --git a/src/Umbraco.Web/CacheHelperExtensions.cs b/src/Umbraco.Web/CacheHelperExtensions.cs
index 6e81bd844d..9ecc14e785 100644
--- a/src/Umbraco.Web/CacheHelperExtensions.cs
+++ b/src/Umbraco.Web/CacheHelperExtensions.cs
@@ -24,31 +24,31 @@ namespace Umbraco.Web
///
public sealed class CacheHelperApplicationEventListener : IApplicationEventHandler
{
- public void OnApplicationInitialized(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
- if (ApplicationContext.Current != null)
+ if (applicationContext != null)
{
//bind to events to clear the cache, after publish, after media save and after member save
Document.AfterPublish
+= (sender, args) =>
- ApplicationContext.Current.ApplicationCache.ClearPartialViewCache();
+ applicationContext.ApplicationCache.ClearPartialViewCache();
global::umbraco.cms.businesslogic.media.Media.AfterSave
+= (sender, args) =>
- ApplicationContext.Current.ApplicationCache.ClearPartialViewCache();
+ applicationContext.ApplicationCache.ClearPartialViewCache();
global::umbraco.cms.businesslogic.member.Member.AfterSave
+= (sender, args) =>
- ApplicationContext.Current.ApplicationCache.ClearPartialViewCache();
+ applicationContext.ApplicationCache.ClearPartialViewCache();
}
}
- public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
- public void OnApplicationStarted(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
}
diff --git a/src/Umbraco.Web/LegacyScheduledTasks.cs b/src/Umbraco.Web/LegacyScheduledTasks.cs
index 1ebf9d7903..f79b383b06 100644
--- a/src/Umbraco.Web/LegacyScheduledTasks.cs
+++ b/src/Umbraco.Web/LegacyScheduledTasks.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading;
using System.Web;
using System.Web.Caching;
+using Umbraco.Core;
using Umbraco.Core.Logging;
using global::umbraco.BusinessLogic;
@@ -17,17 +18,20 @@ namespace Umbraco.Web
internal sealed class LegacyScheduledTasks : IApplicationEventHandler
{
- Timer pingTimer;
- Timer publishingTimer;
- CacheItemRemovedCallback OnCacheRemove;
+ Timer _pingTimer;
+ Timer _publishingTimer;
+ CacheItemRemovedCallback _onCacheRemove;
- public void OnApplicationInitialized(UmbracoApplication httpApplication, Core.ApplicationContext applicationContext)
+ public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, Core.ApplicationContext applicationContext)
{
// nothing yet
}
- public void OnApplicationStarting(UmbracoApplication httpApplication, Core.ApplicationContext applicationContext)
- {
+ public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, Core.ApplicationContext applicationContext)
+ {
+ if (umbracoApplication.Context == null)
+ return;
+
// time to setup the tasks
// these are the legacy tasks
@@ -35,16 +39,16 @@ namespace Umbraco.Web
// of course we should have a proper scheduler, see #U4-809
// ping/keepalive
- pingTimer = new Timer(new TimerCallback(global::umbraco.presentation.keepAliveService.PingUmbraco), httpApplication.Context, 60000, 300000);
+ _pingTimer = new Timer(new TimerCallback(global::umbraco.presentation.keepAliveService.PingUmbraco), umbracoApplication.Context, 60000, 300000);
// (un)publishing _and_ also run scheduled tasks (!)
- publishingTimer = new Timer(new TimerCallback(global::umbraco.presentation.publishingService.CheckPublishing), httpApplication.Context, 30000, 60000);
+ _publishingTimer = new Timer(new TimerCallback(global::umbraco.presentation.publishingService.CheckPublishing), umbracoApplication.Context, 30000, 60000);
// log scrubbing
AddTask(LOG_SCRUBBER_TASK_NAME, GetLogScrubbingInterval());
}
- public void OnApplicationStarted(UmbracoApplication httpApplication, Core.ApplicationContext applicationContext)
+ public void OnApplicationStarted(UmbracoApplicationBase httpApplication, Core.ApplicationContext applicationContext)
{
// nothing
}
@@ -88,10 +92,10 @@ namespace Umbraco.Web
private void AddTask(string name, int seconds)
{
- OnCacheRemove = new CacheItemRemovedCallback(CacheItemRemoved);
+ _onCacheRemove = new CacheItemRemovedCallback(CacheItemRemoved);
HttpRuntime.Cache.Insert(name, seconds, null,
DateTime.Now.AddSeconds(seconds), System.Web.Caching.Cache.NoSlidingExpiration,
- CacheItemPriority.NotRemovable, OnCacheRemove);
+ CacheItemPriority.NotRemovable, _onCacheRemove);
}
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r)
diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs
index c5ce441bba..92e2715a0b 100644
--- a/src/Umbraco.Web/Mvc/RenderMvcController.cs
+++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs
@@ -3,6 +3,7 @@ using System.IO;
using System.Web.Mvc;
using Umbraco.Core;
using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Core.Models;
using Umbraco.Web.Models;
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 5ce59b214e..24cc484f92 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -245,7 +245,6 @@
Properties\SolutionInfo.cs
-
@@ -290,7 +289,6 @@
ASPXCodeBehind
-
diff --git a/src/Umbraco.Web/UmbracoApplication.cs b/src/Umbraco.Web/UmbracoApplication.cs
index c3d32c2ce2..7a47847b5e 100644
--- a/src/Umbraco.Web/UmbracoApplication.cs
+++ b/src/Umbraco.Web/UmbracoApplication.cs
@@ -15,99 +15,12 @@ namespace Umbraco.Web
///
/// The Umbraco global.asax class
///
- public class UmbracoApplication : System.Web.HttpApplication
+ public class UmbracoApplication : UmbracoApplicationBase
{
- public UmbracoApplication()
- {
- _bootManager = new WebBootManager(this);
- }
-
- private readonly IBootManager _bootManager;
-
- public static event EventHandler ApplicationStarting;
- public static event EventHandler ApplicationStarted;
-
- ///
- /// Initializes the Umbraco application
- ///
- ///
- ///
- protected void Application_Start(object sender, EventArgs e)
- {
- //boot up the application
- _bootManager
- .Initialize()
- .Startup(appContext => OnApplicationStarting(sender, e))
- .Complete(appContext => OnApplicationStarted(sender, e));
- }
-
- ///
- /// Developers can override this method to modify objects on startup
- ///
- ///
- ///
- protected virtual void OnApplicationStarting(object sender, EventArgs e)
- {
- if (ApplicationStarting != null)
- ApplicationStarting(sender, e);
- }
-
- ///
- /// Developers can override this method to do anything they need to do once the application startup routine is completed.
- ///
- ///
- ///
- protected virtual void OnApplicationStarted(object sender, EventArgs e)
- {
- if (ApplicationStarted != null)
- ApplicationStarted(sender, e);
- }
-
- ///
- /// A method that can be overridden to invoke code when the application has an error.
- ///
- ///
- ///
- protected virtual void OnApplicationError(object sender, EventArgs e)
- {
-
- }
-
- protected void Application_Error(object sender, EventArgs e)
- {
- // Code that runs when an unhandled error occurs
-
- // Get the exception object.
- var exc = Server.GetLastError();
-
- // Ignore HTTP errors
- if (exc.GetType() == typeof(HttpException))
- {
- return;
- }
-
- LogHelper.Error
("An unhandled exception occurred", exc);
-
- OnApplicationError(sender, e);
- }
-
- ///
- /// A method that can be overridden to invoke code when the application shuts down.
- ///
- ///
- ///
- protected virtual void OnApplicationEnd(object sender, EventArgs e)
- {
-
- }
-
- protected void Application_End(object sender, EventArgs e)
- {
- if (SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted)
- {
- LogHelper.Info("Application shutdown. Reason: " + HostingEnvironment.ShutdownReason);
- }
- OnApplicationEnd(sender, e);
- }
+
+ protected override IBootManager GetBootManager()
+ {
+ return new WebBootManager(this);
+ }
}
}
diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs
index 6983392782..2c7fd2d023 100644
--- a/src/Umbraco.Web/WebBootManager.cs
+++ b/src/Umbraco.Web/WebBootManager.cs
@@ -7,6 +7,7 @@ using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Dynamics;
+using Umbraco.Core.ObjectResolution;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Dictionary;
using Umbraco.Web.Media;
@@ -27,9 +28,8 @@ namespace Umbraco.Web
public class WebBootManager : CoreBootManager
{
private readonly bool _isForTesting;
- private readonly UmbracoApplication _umbracoApplication;
- public WebBootManager(UmbracoApplication umbracoApplication)
+ public WebBootManager(UmbracoApplicationBase umbracoApplication)
: this(umbracoApplication, false)
{
@@ -40,11 +40,10 @@ namespace Umbraco.Web
///
///
///
- internal WebBootManager(UmbracoApplication umbracoApplication, bool isForTesting)
+ internal WebBootManager(UmbracoApplicationBase umbracoApplication, bool isForTesting)
+ : base(umbracoApplication)
{
- _isForTesting = isForTesting;
- _umbracoApplication = umbracoApplication;
- if (umbracoApplication == null) throw new ArgumentNullException("umbracoApplication");
+ _isForTesting = isForTesting;
}
///
@@ -71,42 +70,17 @@ namespace Umbraco.Web
//set model binder
ModelBinders.Binders.Add(new KeyValuePair(typeof(RenderModel), new RenderModelBinder()));
-
- //find and initialize the application startup handlers, we need to initialize this resolver here because
- //it is a special resolver where they need to be instantiated first before any other resolvers in order to bind to
- //events and to call their events during bootup.
- //ApplicationStartupHandler.RegisterHandlers();
- //... and set the special flag to let us resolve before frozen resolution
- ApplicationEventsResolver.Current = new ApplicationEventsResolver(
- PluginManager.Current.ResolveApplicationStartupHandlers())
- {
- CanResolveBeforeFrozen = true
- };
- //add the internal types since we don't want to mark these public
- ApplicationEventsResolver.Current.AddType();
- ApplicationEventsResolver.Current.AddType();
-
- //now we need to call the initialize methods
- ApplicationEventsResolver.Current.ApplicationEventHandlers
- .ForEach(x => x.OnApplicationInitialized(_umbracoApplication, ApplicationContext));
-
return this;
}
///
- /// Ensure that the OnApplicationStarting methods of the IApplicationEvents are called
+ /// Adds custom types to the ApplicationEventsResolver
///
- ///
- ///
- public override IBootManager Startup(Action afterStartup)
+ protected override void InitializeApplicationEventsResolver()
{
- base.Startup(afterStartup);
-
- //call OnApplicationStarting of each application events handler
- ApplicationEventsResolver.Current.ApplicationEventHandlers
- .ForEach(x => x.OnApplicationStarting(_umbracoApplication, ApplicationContext));
-
- return this;
+ base.InitializeApplicationEventsResolver();
+ ApplicationEventsResolver.Current.AddType();
+ ApplicationEventsResolver.Current.AddType();
}
///
@@ -121,13 +95,6 @@ namespace Umbraco.Web
base.Complete(afterComplete);
- //call OnApplicationStarting of each application events handler
- ApplicationEventsResolver.Current.ApplicationEventHandlers
- .ForEach(x => x.OnApplicationStarted(_umbracoApplication, ApplicationContext));
-
- // we're ready to serve content!
- ApplicationContext.IsReady = true;
-
return this;
}
diff --git a/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs b/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
index 4fa5d515a1..553abb1589 100644
--- a/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
+++ b/src/Umbraco.Web/umbraco.presentation/EnsureSystemPathsApplicationStartupHandler.cs
@@ -13,8 +13,10 @@ namespace umbraco.presentation
{
public EnsureSystemPathsApplicationStartupHandler()
{
+ EnsurePathExists("~/App_Code");
+ EnsurePathExists("~/App_Data");
+ EnsurePathExists(SystemDirectories.AppPlugins);
EnsurePathExists(SystemDirectories.Css);
- EnsurePathExists(SystemDirectories.Data);
EnsurePathExists(SystemDirectories.MacroScripts);
EnsurePathExists(SystemDirectories.Masterpages);
EnsurePathExists(SystemDirectories.Media);
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs
index 315e80b805..f5a695e8cf 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Database.cs
@@ -1,4 +1,5 @@
using System;
+using Umbraco.Core;
using Umbraco.Core.Configuration;
using umbraco.cms.businesslogic.installer;
using umbraco.IO;
@@ -35,8 +36,16 @@ namespace umbraco.presentation.install.steps.Definitions
public override bool Completed()
{
// Fresh installs don't have a version number so this step cannot be complete yet
- if (string.IsNullOrEmpty(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus))
- return false;
+ if (string.IsNullOrEmpty(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus))
+ {
+ //Even though the ConfigurationStatus is blank we try to determine the version if we can connect to the database
+ var result = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema();
+ var determinedVersion = result.DetermineInstalledVersion();
+ if (determinedVersion.Equals(new Version(0, 0, 0)))
+ return false;
+
+ return UmbracoVersion.Current < determinedVersion;
+ }
var configuredVersion = new Version(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus);
var targetVersion = UmbracoVersion.Current;
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Welcome.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Welcome.cs
index 868f5c6ab5..944eaf4e89 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Welcome.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/Definitions/Welcome.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using umbraco.cms.businesslogic.installer;
+using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
{
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx
index d3446f49cb..3234698de5 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx
@@ -269,10 +269,42 @@
-
Installing Umbraco
-
- The Umbraco database is being configured. This process populates your chosen database with a blank Umbraco instance.
-
+
+
+
Installing Umbraco
+
+ The Umbraco database is being configured. This process populates your chosen database with a blank Umbraco instance.
+
+
+
+
Database installed
+
+
+ Umbraco
+ <%=UmbracoVersion.Current.ToString(3)%>
+ has now been copied to your database. Press Continue to proceed.
+
+
+
+
+
+
+
Upgrading Umbraco
+
+ The Umbraco database is being configured. This process upgrades your Umbraco database.
+
+
+
+
Database upgraded
+
+
+ Your database has been upgraded to version:
+ <%=UmbracoVersion.Current.ToString(3)%>.
+ Press Continue to proceed.
+
+
+
+
@@ -310,6 +342,8 @@
if (json.Success) {
$(".btn-box").show();
$('.ui-progressbar-value').css("background-image", "url(../umbraco_client/installer/images/pbar.gif)");
+ $(".result-status-container").show();
+ $(".progress-status-container").hide();
} else {
$(".btn-continue").hide();
$(".btn-back").show();
@@ -320,32 +354,4 @@
});
-
-
-
-
- Database installed
-
-
- Umbraco
- <%=UmbracoVersion.Current.ToString(3)%>
- has now been copied to your database. Press Continue to proceed.
-
-
-
-
- Database upgraded
-
-
- Your database has been upgraded to version:
- <%=UmbracoVersion.Current.ToString(3)%>.
- Press Continue to proceed.
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.cs
index d05f87af9a..a7a564e904 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.cs
@@ -71,8 +71,29 @@ namespace umbraco.presentation.install.steps
{
// Does the user have to enter a connection string?
if (settings.Visible && !Page.IsPostBack)
- ShowDatabaseSettings();
+ {
+ //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.
+ if (
+ ConfigurationManager.ConnectionStrings[
+ Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName] == null
+ ||
+ string.IsNullOrEmpty(
+ ConfigurationManager.ConnectionStrings[
+ Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName].ConnectionString))
+ {
+ installProgress.Visible = true;
+ upgradeProgress.Visible = false;
+ ShowDatabaseSettings();
+ }
+ else
+ {
+ installProgress.Visible = false;
+ upgradeProgress.Visible = true;
+ settings.Visible = false;
+ installing.Visible = true;
+ }
+ }
}
///
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.designer.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.designer.cs
index d54355b647..35cc3f8879 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.designer.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/database.ascx.designer.cs
@@ -220,30 +220,21 @@ namespace umbraco.presentation.install.steps {
protected global::System.Web.UI.WebControls.PlaceHolder installing;
///
- /// confirms control.
+ /// installProgress control.
///
///
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
///
- protected global::System.Web.UI.WebControls.Panel confirms;
+ protected global::System.Web.UI.WebControls.PlaceHolder installProgress;
///
- /// installConfirm control.
+ /// upgradeProgress control.
///
///
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
///
- protected global::System.Web.UI.WebControls.PlaceHolder installConfirm;
-
- ///
- /// upgradeConfirm control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder upgradeConfirm;
+ protected global::System.Web.UI.WebControls.PlaceHolder upgradeProgress;
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/install/steps/welcome.ascx.cs b/src/Umbraco.Web/umbraco.presentation/install/steps/welcome.ascx.cs
index b69ab00bf3..bb5b765a8c 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/steps/welcome.ascx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/steps/welcome.ascx.cs
@@ -1,14 +1,8 @@
-using umbraco;
+using System;
+using Umbraco.Core;
namespace umbraco.presentation.install
{
- using System;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
-
///
/// Summary description for welcome.
///
@@ -17,24 +11,24 @@ namespace umbraco.presentation.install
protected void Page_Load(object sender, System.EventArgs e)
{
+ var result = ApplicationContext.Current.DatabaseContext.ValidateDatabaseSchema();
+ var determinedVersion = result.DetermineInstalledVersion();
+
// Display the Umbraco upgrade message if Umbraco is already installed
- if (String.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false)
+ if (String.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false || determinedVersion.Equals(new Version(0, 0, 0)) == false)
{
ph_install.Visible = false;
ph_upgrade.Visible = true;
}
-
- // Check for config!
- if (GlobalSettings.Configured)
- {
- Application.Lock();
- Application["umbracoNeedConfiguration"] = null;
- Application.UnLock();
- Response.Redirect(Request.QueryString["url"] ?? "/", true);
- }
-
-
-
+
+ // Check for config!
+ if (GlobalSettings.Configured)
+ {
+ Application.Lock();
+ Application["umbracoNeedConfiguration"] = null;
+ Application.UnLock();
+ Response.Redirect(Request.QueryString["url"] ?? "/", true);
+ }
}
protected void gotoNextStep(object sender, EventArgs e) {
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Search/ExamineEvents.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Search/ExamineEvents.cs
index f122e2013b..1f1471bc7e 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/Search/ExamineEvents.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Search/ExamineEvents.cs
@@ -15,20 +15,20 @@ namespace umbraco.presentation.umbraco.Search
public class ExamineEvents : IApplicationEventHandler
{
- public void OnApplicationInitialized(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
- public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
}
///
/// Once the app has booted, then bind to the events
///
- ///
+ ///
///
- public void OnApplicationStarted(UmbracoApplication httpApplication, ApplicationContext applicationContext)
+ public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//do not continue if the app context or database is not ready
if (!applicationContext.IsConfigured || !applicationContext.DatabaseContext.IsDatabaseConfigured)
diff --git a/src/umbraco.businesslogic/ApplicationTree.cs b/src/umbraco.businesslogic/ApplicationTree.cs
index fdebf70488..da9e5f3d69 100644
--- a/src/umbraco.businesslogic/ApplicationTree.cs
+++ b/src/umbraco.businesslogic/ApplicationTree.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Web;
using System.Xml.Linq;
+using Umbraco.Core;
using umbraco.DataLayer;
using umbraco.IO;
@@ -395,7 +396,18 @@ namespace umbraco.BusinessLogic
return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
}))
{
- list.Add(new ApplicationTree(
+
+ var applicationAlias = (string)addElement.Attribute("application");
+ var type = (string)addElement.Attribute("type");
+ var assembly = (string)addElement.Attribute("assembly");
+
+ //check if the tree definition (applicationAlias + type + assembly) is already in the list
+
+ if (!list.Any(tree => tree.ApplicationAlias.InvariantEquals(applicationAlias)
+ && tree.Type.InvariantEquals(type)
+ && tree.AssemblyName.InvariantEquals(assembly)))
+ {
+ list.Add(new ApplicationTree(
addElement.Attribute("silent") != null ? Convert.ToBoolean(addElement.Attribute("silent").Value) : false,
addElement.Attribute("initialize") != null ? Convert.ToBoolean(addElement.Attribute("initialize").Value) : true,
addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
@@ -404,9 +416,12 @@ namespace umbraco.BusinessLogic
addElement.Attribute("title").Value,
addElement.Attribute("iconClosed").Value,
addElement.Attribute("iconOpen").Value,
- (string)addElement.Attribute("assembly"), //this could be empty: http://issues.umbraco.org/issue/U4-1360
+ (string)addElement.Attribute("assembly"), //this could be empty: http://issues.umbraco.org/issue/U4-1360
addElement.Attribute("type").Value,
addElement.Attribute("action") != null ? addElement.Attribute("action").Value : ""));
+ }
+
+
}
}, false);
diff --git a/src/umbraco.businesslogic/ApplicationTreeRegistrar.cs b/src/umbraco.businesslogic/ApplicationTreeRegistrar.cs
index 67c07ff025..e12eb2f21b 100644
--- a/src/umbraco.businesslogic/ApplicationTreeRegistrar.cs
+++ b/src/umbraco.businesslogic/ApplicationTreeRegistrar.cs
@@ -13,8 +13,10 @@ namespace umbraco.BusinessLogic
{
public ApplicationTreeRegistrar()
{
- //don't do anything if the application is not configured!
- if (ApplicationContext.Current == null || !ApplicationContext.Current.IsConfigured)
+ //don't do anything if the application or database is not configured!
+ if (ApplicationContext.Current == null
+ || !ApplicationContext.Current.IsConfigured
+ || !ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured)
return;
// Load all Trees by attribute and add them to the XML config
diff --git a/src/umbraco.businesslogic/PluginManagerExtensions.cs b/src/umbraco.businesslogic/PluginManagerExtensions.cs
index da8fdea46b..7a61414315 100644
--- a/src/umbraco.businesslogic/PluginManagerExtensions.cs
+++ b/src/umbraco.businesslogic/PluginManagerExtensions.cs
@@ -10,16 +10,6 @@ namespace umbraco.businesslogic
///
public static class PluginManagerExtensions
{
- ///
- /// Returns all available IApplicationStartupHandler objects
- ///
- ///
- ///
- internal static IEnumerable
ResolveApplicationStartupHandlers(this PluginManager resolver)
- {
- return resolver.ResolveTypes();
- }
-
///
/// Returns all available IApplication in application
///
diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs
index 2b75d3e244..7a7289dd6d 100644
--- a/src/umbraco.cms/businesslogic/CMSNode.cs
+++ b/src/umbraco.cms/businesslogic/CMSNode.cs
@@ -48,6 +48,7 @@ namespace umbraco.cms.businesslogic
private bool _hasChildrenInitialized;
private string m_image = "default.png";
private bool? _isTrashed = null;
+ private IUmbracoEntity _entity;
#endregion
@@ -55,6 +56,7 @@ namespace umbraco.cms.businesslogic
private static readonly string m_DefaultIconCssFile = IOHelper.MapPath(SystemDirectories.Umbraco_client + "/Tree/treeIcons.css");
private static List m_DefaultIconClasses = new List();
+
private static void initializeIconClasses()
{
StreamReader re = File.OpenText(m_DefaultIconCssFile);
@@ -394,9 +396,10 @@ namespace umbraco.cms.businesslogic
PopulateCMSNodeFromReader(reader);
}
- protected internal CMSNode(IEntity entity)
+ protected internal CMSNode(IUmbracoEntity entity)
{
_id = entity.Id;
+ _entity = entity;
}
#endregion
@@ -578,6 +581,7 @@ order by level,sortOrder";
/// Moves the CMSNode from the current position in the hierarchy to the target
///
/// Target CMSNode id
+ [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.Move() or Umbraco.Core.Services.MediaService.Move()", false)]
public virtual void Move(int newParentId)
{
CMSNode parent = new CMSNode(newParentId);
@@ -707,6 +711,9 @@ order by level,sortOrder";
{
_sortOrder = value;
SqlHelper.ExecuteNonQuery("update umbracoNode set sortOrder = '" + value + "' where id = " + this.Id.ToString());
+
+ if (_entity != null)
+ _entity.SortOrder = value;
}
}
@@ -768,6 +775,9 @@ order by level,sortOrder";
{
_parentid = value.Id;
SqlHelper.ExecuteNonQuery("update umbracoNode set parentId = " + value.Id.ToString() + " where id = " + this.Id.ToString());
+
+ if (_entity != null)
+ _entity.ParentId = value.Id;
}
}
@@ -783,6 +793,9 @@ order by level,sortOrder";
{
_path = value;
SqlHelper.ExecuteNonQuery("update umbracoNode set path = '" + _path + "' where id = " + this.Id.ToString());
+
+ if (_entity != null)
+ _entity.Path = value;
}
}
@@ -798,6 +811,9 @@ order by level,sortOrder";
{
_level = value;
SqlHelper.ExecuteNonQuery("update umbracoNode set level = " + _level.ToString() + " where id = " + this.Id.ToString());
+
+ if (_entity != null)
+ _entity.Level = value;
}
}
@@ -917,6 +933,8 @@ order by level,sortOrder";
SqlHelper.CreateParameter("@text", value.Trim()),
SqlHelper.CreateParameter("@id", this.Id));
+ if (_entity != null)
+ _entity.Name = value;
}
}
@@ -968,6 +986,9 @@ order by level,sortOrder";
protected void SetText(string txt)
{
_text = txt;
+
+ if (_entity != null)
+ _entity.Name = txt;
}
///
@@ -1088,6 +1109,7 @@ order by level,sortOrder";
_userId = content.CreatorId;
_createDate = content.CreateDate;
_isTrashed = content.Trashed;
+ _entity = content;
}
internal protected void PopulateCMSNodeFromContentTypeBase(IContentTypeBase contentType, Guid objectType)
@@ -1102,6 +1124,7 @@ order by level,sortOrder";
_userId = contentType.CreatorId;
_createDate = contentType.CreateDate;
_isTrashed = false;
+ _entity = contentType;
}
#endregion
diff --git a/src/umbraco.cms/businesslogic/Content.cs b/src/umbraco.cms/businesslogic/Content.cs
index 9ec92fcdf8..012b2759ef 100644
--- a/src/umbraco.cms/businesslogic/Content.cs
+++ b/src/umbraco.cms/businesslogic/Content.cs
@@ -157,7 +157,7 @@ namespace umbraco.cms.businesslogic
{
if (_contentTypeIcon == null && this.ContentType != null)
_contentTypeIcon = this.ContentType.IconUrl;
- return _contentTypeIcon;
+ return _contentTypeIcon ?? string.Empty;
}
set
{
diff --git a/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs b/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs
index 067bef6626..b19ca3f14a 100644
--- a/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs
+++ b/src/umbraco.cms/businesslogic/datatype/FileHandlerData.cs
@@ -18,38 +18,41 @@ namespace umbraco.cms.businesslogic.datatype
_thumbnailSizes = thumbnailSizes;
}
- ///
- /// Gets/sets the loaded Conent object which we can resolve from other classes since this class sets it's properties
- ///
- internal Content LoadedContentItem { get; set; }
+ ///
+ /// Gets/sets the loaded Conent object which we can resolve from other classes since this class sets it's properties
+ ///
+ internal Content LoadedContentItem { get; set; }
- ///
- /// Called to ensure we have a valid LoadedContentItem.
- ///
- ///
- private void EnsureLoadedContentItem(Guid version)
- {
- if (LoadedContentItem == null)
- {
- LoadedContentItem = Content.GetContentFromVersion(Version);
- }
- }
+ ///
+ /// Called to ensure we have a valid LoadedContentItem.
+ ///
+ ///
+ private void EnsureLoadedContentItem(Guid version)
+ {
+ if (LoadedContentItem == null)
+ {
+ LoadedContentItem = Content.GetContentFromVersion(Version);
+ }
+ }
public override object Value
{
get { return base.Value; }
set
{
- if (value is HttpPostedFile || value is HttpPostedFileBase)
+ if (value is HttpPostedFile || value is HttpPostedFileBase)
{
- Stream fileStream = null;
+ var postedFileName = value is HttpPostedFile
+ ? ((HttpPostedFile)value).FileName
+ : ((HttpPostedFileBase)value).FileName;
- var file = value as HttpPostedFile;
- var name = IOHelper.SafeFileName(file.FileName.Substring(file.FileName.LastIndexOf(IOHelper.DirSepChar) + 1, file.FileName.Length - file.FileName.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower());
- fileStream = file.InputStream;
+ var name = IOHelper.SafeFileName(postedFileName.Substring(postedFileName.LastIndexOf(IOHelper.DirSepChar) + 1, postedFileName.Length - postedFileName.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower());
- // handle upload
+ var fileStream = value is HttpPostedFile
+ ? ((HttpPostedFile)value).InputStream
+ : ((HttpPostedFileBase)value).InputStream;
+ // handle upload
if (name != String.Empty)
{
string fileName = UmbracoSettings.UploadAllowDirectories
@@ -91,8 +94,8 @@ namespace umbraco.cms.businesslogic.datatype
if (uploadFieldConfigNode != null)
{
- EnsureLoadedContentItem(Version);
- FillProperties(uploadFieldConfigNode, LoadedContentItem, um);
+ EnsureLoadedContentItem(Version);
+ FillProperties(uploadFieldConfigNode, LoadedContentItem, um);
}
}
@@ -127,12 +130,12 @@ namespace umbraco.cms.businesslogic.datatype
{
// get the current document
//Content legacy = Content.GetContentFromVersion(Version);
- EnsureLoadedContentItem(Version);
+ EnsureLoadedContentItem(Version);
// only add dimensions to web images
UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "widthFieldAlias", String.Empty);
- UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "heightFieldAlias", String.Empty);
- UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "lengthFieldAlias", String.Empty);
- UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "extensionFieldAlias", String.Empty);
+ UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "heightFieldAlias", String.Empty);
+ UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "lengthFieldAlias", String.Empty);
+ UpdateContentProperty(uploadFieldConfigNode, LoadedContentItem, "extensionFieldAlias", String.Empty);
}
}
}
diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs
index 07f30049e4..3855363702 100644
--- a/src/umbraco.cms/businesslogic/web/Document.cs
+++ b/src/umbraco.cms/businesslogic/web/Document.cs
@@ -1302,6 +1302,12 @@ namespace umbraco.cms.businesslogic.web
[Obsolete("Obsolete", false)]
protected override void setupNode()
{
+ if (Id == -1 || Id == -20)
+ {
+ base.setupNode();
+ return;
+ }
+
var content = Version == Guid.Empty
? ApplicationContext.Current.Services.ContentService.GetById(Id)
: ApplicationContext.Current.Services.ContentService.GetByVersion(Version);
diff --git a/src/umbraco.editorControls/Slider/SliderControl.cs b/src/umbraco.editorControls/Slider/SliderControl.cs
index b8c4fb5006..a1a060c604 100644
--- a/src/umbraco.editorControls/Slider/SliderControl.cs
+++ b/src/umbraco.editorControls/Slider/SliderControl.cs
@@ -174,6 +174,13 @@ namespace umbraco.editorControls.Slider
(hasMultipleValues ? "{ allow: ',' }" : string.Empty));
var javascript = string.Concat("");
writer.WriteLine(javascript);
+
+ if (this.Options.EnableRange || !string.IsNullOrEmpty(this.Options.RangeValue))
+ {
+ // add CSS to override the default style for '.ui-slider-range' (which is used for the DateTime Picker)
+ var css = string.Format("", this.ClientID);
+ writer.WriteLine(css);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/umbraco.editorControls/Slider/SliderDataType.cs b/src/umbraco.editorControls/Slider/SliderDataType.cs
index ccd7ecc6e9..5ad6919821 100644
--- a/src/umbraco.editorControls/Slider/SliderDataType.cs
+++ b/src/umbraco.editorControls/Slider/SliderDataType.cs
@@ -149,7 +149,7 @@ namespace umbraco.editorControls.Slider
}
else
{
- this.Data.Value = value1;
+ this.Data.Value = value1.ToString();
}
}
}
diff --git a/src/umbraco.editorControls/Slider/SliderOptions.cs b/src/umbraco.editorControls/Slider/SliderOptions.cs
index 4d628d2779..b7c84a7bf1 100644
--- a/src/umbraco.editorControls/Slider/SliderOptions.cs
+++ b/src/umbraco.editorControls/Slider/SliderOptions.cs
@@ -3,90 +3,90 @@ using umbraco.cms.businesslogic.datatype;
namespace umbraco.editorControls.Slider
{
- ///
- /// The options for the Slider data-type.
- ///
- public class SliderOptions : AbstractOptions
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public SliderOptions()
- : base()
- {
- }
+ ///
+ /// The options for the Slider data-type.
+ ///
+ public class SliderOptions : AbstractOptions
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public SliderOptions()
+ : base()
+ {
+ }
- ///
- /// Initializes a new instance of the class.
- ///
- /// if set to true [loads defaults].
- public SliderOptions(bool loadDefaults)
- : base(loadDefaults)
- {
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// if set to true [loads defaults].
+ public SliderOptions(bool loadDefaults)
+ : base(loadDefaults)
+ {
+ }
- ///
- /// Gets or sets a value indicating whether [enable range].
- ///
- /// true if [enable range]; otherwise, false.
- [DefaultValue(false)]
- public bool EnableRange { get; set; }
+ ///
+ /// Gets or sets a value indicating whether [enable range].
+ ///
+ /// true if [enable range]; otherwise, false.
+ [DefaultValue(false)]
+ public bool EnableRange { get; set; }
- ///
- /// Gets or sets a value indicating whether [enable step].
- ///
- /// true if [enable step]; otherwise, false.
- [DefaultValue(true)]
- public bool EnableStep { get; set; }
+ ///
+ /// Gets or sets a value indicating whether [enable step].
+ ///
+ /// true if [enable step]; otherwise, false.
+ [DefaultValue(true)]
+ public bool EnableStep { get; set; }
- ///
- /// Gets or sets the max value.
- ///
- /// The max value.
- [DefaultValue(100)]
+ ///
+ /// Gets or sets the max value.
+ ///
+ /// The max value.
+ [DefaultValue(100)]
public double MaxValue { get; set; }
- ///
- /// Gets or sets the min value.
- ///
- /// The min value.
- [DefaultValue(0)]
+ ///
+ /// Gets or sets the min value.
+ ///
+ /// The min value.
+ [DefaultValue(0)]
public double MinValue { get; set; }
- ///
- /// Gets or sets the orientation.
- ///
- /// The orientation.
- [DefaultValue("hortizontal")]
- public string Orientation { get; set; }
+ ///
+ /// Gets or sets the orientation.
+ ///
+ /// The orientation.
+ [DefaultValue("hortizontal")]
+ public string Orientation { get; set; }
- ///
- /// Gets or sets the range value.
- ///
- /// The range value.
- [DefaultValue("")]
- public string RangeValue { get; set; }
+ ///
+ /// Gets or sets the range value.
+ ///
+ /// The range value.
+ [DefaultValue("")]
+ public string RangeValue { get; set; }
- ///
- /// Gets or sets the step.
- ///
- /// The step.
- [DefaultValue(5)]
+ ///
+ /// Gets or sets the step.
+ ///
+ /// The step.
+ [DefaultValue(5)]
public double StepValue { get; set; }
//public int StepValue { get; set; }
- ///
- /// Gets or sets the value.
- ///
- /// The value.
- [DefaultValue(50)]
+ ///
+ /// Gets or sets the value.
+ ///
+ /// The value.
+ [DefaultValue(50)]
public double Value { get; set; }
- ///
- /// Gets or sets the second value.
- ///
- /// The second value.
- [DefaultValue(0)]
+ ///
+ /// Gets or sets the second value.
+ ///
+ /// The second value.
+ [DefaultValue(0)]
public double Value2 { get; set; }
///
@@ -94,5 +94,5 @@ namespace umbraco.editorControls.Slider
///
[DefaultValue(DBTypes.Integer)]
public DBTypes DBType { get; set; }
- }
+ }
}
diff --git a/src/umbraco.editorControls/Slider/SliderPrevalueEditor.cs b/src/umbraco.editorControls/Slider/SliderPrevalueEditor.cs
index fd95b67a9d..706ffee468 100644
--- a/src/umbraco.editorControls/Slider/SliderPrevalueEditor.cs
+++ b/src/umbraco.editorControls/Slider/SliderPrevalueEditor.cs
@@ -220,41 +220,41 @@ namespace umbraco.editorControls.Slider
var javascriptMethod = string.Format(
@"
$('#{0}').click(function(){{
- var disable = !$(this).attr('checked');
- $('#{1},#{3}').attr('disabled', disable);
- $('#{6}').val(disable && !checkDecimals() ? 'Integer' : 'Nvarchar');
- if(!disable) disable = $('#{1}').val() != '';
+ var disable = !$(this).attr('checked');
+ $('#{1},#{3}').attr('disabled', disable);
+ $('#{6}').val(disable && !checkDecimals() ? 'Integer' : 'Nvarchar');
+ if(!disable) disable = $('#{1}').val() != '';
}});
$('#{1}').change(function(){{
- var disable = $(this).val() != '';
- $('#{3}').attr('disabled', disable);
+ var disable = $(this).val() != '';
+ $('#{3}').attr('disabled', disable);
}});
$('#{4}').click(function(){{
- var disable = !$(this).attr('checked');
- $('#{5}').attr('disabled', disable);
+ var disable = !$(this).attr('checked');
+ $('#{5}').attr('disabled', disable);
}});
$('#{6}').change(function(){{
- var disable = $(this).val() == 'Integer';
+ var disable = $(this).val() == 'Integer';
if (checkDecimals() && disable) {{
$('#{6}').val('Nvarchar');
alert('Please remove decimal points below if you wish to use the Integer datatype');
}}
else {{
- $('#{0}').removeAttr('checked');
- $('#{1},#{3}').attr('disabled', disable);
+ $('#{0}').removeAttr('checked');
+ $('#{1},#{3}').attr('disabled', disable);
}}
}});
$('.slider-numeric').keydown(function(event) {{
- // Allow only backspace and delete
- if ( event.keyCode == 46 || event.keyCode == 8 || ($(this).hasClass('slider-decimal') && (event.keyCode == 110 || event.keyCode == 190))) {{
- // let it happen, don't do anything
- }} else {{
- // Ensure that it is a number and stop the keypress
- if ( (event.keyCode < 48 || event.keyCode > 57 ) && (event.keyCode < 96 || event.keyCode > 105 ) ) {{
- event.preventDefault();
- }}
- }}
+ // Allow only backspace and delete
+ if ( event.keyCode == 46 || event.keyCode == 8 || ($(this).hasClass('slider-decimal') && (event.keyCode == 110 || event.keyCode == 190))) {{
+ // let it happen, don't do anything
+ }} else {{
+ // Ensure that it is a number and stop the keypress
+ if ( (event.keyCode < 48 || event.keyCode > 57 ) && (event.keyCode < 96 || event.keyCode > 105 ) ) {{
+ event.preventDefault();
+ }}
+ }}
}});
$('.slider-numeric').keyup(function(event) {{
if ($('#{6}').val() != 'Nvarchar' && checkDecimals()) {{