Merge branch '6.0.7' into 6.1.2
Conflicts: src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs src/Umbraco.Web/Mvc/PluginControllerArea.cs src/Umbraco.Web/Umbraco.Web.csproj src/Umbraco.Web/WebBootManager.cs
This commit is contained in:
@@ -36,7 +36,7 @@ namespace Umbraco.Web.Mvc
|
||||
bool isMvc = true)
|
||||
{
|
||||
Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName");
|
||||
Mandate.ParameterNotNullOrEmpty(controllerSuffixName, "controllerSuffixName");
|
||||
Mandate.ParameterNotNull(controllerSuffixName, "controllerSuffixName");
|
||||
|
||||
Mandate.ParameterNotNull(controllerType, "controllerType");
|
||||
Mandate.ParameterNotNull(routes, "routes");
|
||||
@@ -86,13 +86,18 @@ namespace Umbraco.Web.Mvc
|
||||
controllerPluginRoute.DataTokens.Add("Namespaces", new[] {controllerType.Namespace});
|
||||
}
|
||||
|
||||
//Don't look anywhere else except this namespace!
|
||||
controllerPluginRoute.DataTokens.Add("UseNamespaceFallback", false);
|
||||
|
||||
//constraints: only match controllers ending with 'controllerSuffixName' and only match this controller's ID for this route
|
||||
if (controllerSuffixName.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
controllerPluginRoute.Constraints = new RouteValueDictionary(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{"controller", @"(\w+)" + controllerSuffixName}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//match this area
|
||||
controllerPluginRoute.DataTokens.Add("area", area.AreaName);
|
||||
|
||||
44
src/Umbraco.Web/Mvc/BackOfficeArea.cs
Normal file
44
src/Umbraco.Web/Mvc/BackOfficeArea.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Web.Mvc;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.Install;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
/// <summary>
|
||||
/// An area registration for back office components
|
||||
/// </summary>
|
||||
internal class BackOfficeArea : AreaRegistration
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Create the routes for the area
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <remarks>
|
||||
/// By using the context to register the routes it means that the area is already applied to them all
|
||||
/// and that the namespaces searched for the controllers are ONLY the ones specified.
|
||||
/// </remarks>
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
//Create the install routes
|
||||
context.MapRoute(
|
||||
"Umbraco_install_packages",
|
||||
"Install/PackageInstaller/{action}/{id}",
|
||||
new {controller = "InstallPackage", action = "Index", id = UrlParameter.Optional},
|
||||
new[] {typeof (InstallPackageController).Namespace});
|
||||
|
||||
//Create the REST/web/script service routes
|
||||
context.MapRoute(
|
||||
"Umbraco_web_services",
|
||||
GlobalSettings.UmbracoMvcArea + "/RestServices/{controller}/{action}/{id}",
|
||||
new {controller = "SaveFileController", action = "Index", id = UrlParameter.Optional},
|
||||
//look in this namespace for controllers
|
||||
new[] {"Umbraco.Web.WebServices"});
|
||||
}
|
||||
|
||||
public override string AreaName
|
||||
{
|
||||
get { return GlobalSettings.UmbracoMvcArea; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,6 +355,7 @@
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionary.cs" />
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionaryFactory.cs" />
|
||||
<Compile Include="Mvc\MemberAuthorizeAttribute.cs" />
|
||||
<Compile Include="Mvc\BackOfficeArea.cs" />
|
||||
<Compile Include="Mvc\ControllerFactoryExtensions.cs" />
|
||||
<Compile Include="Mvc\SurfaceRouteHandler.cs" />
|
||||
<Compile Include="PublishedCache\XmlPublishedCache\RoutesCache.cs" />
|
||||
|
||||
@@ -39,10 +39,10 @@ namespace Umbraco.Web
|
||||
{
|
||||
private readonly bool _isForTesting;
|
||||
|
||||
public WebBootManager(UmbracoApplicationBase umbracoApplication)
|
||||
public WebBootManager(UmbracoApplicationBase umbracoApplication)
|
||||
: this(umbracoApplication, false)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,10 +50,10 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
/// <param name="umbracoApplication"></param>
|
||||
/// <param name="isForTesting"></param>
|
||||
internal WebBootManager(UmbracoApplicationBase umbracoApplication, bool isForTesting)
|
||||
internal WebBootManager(UmbracoApplicationBase umbracoApplication, bool isForTesting)
|
||||
: base(umbracoApplication)
|
||||
{
|
||||
_isForTesting = isForTesting;
|
||||
_isForTesting = isForTesting;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,7 +61,7 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override IBootManager Initialize()
|
||||
{
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
// Backwards compatibility - set the path and URL type for ClientDependency 1.5.1 [LK]
|
||||
@@ -155,26 +155,18 @@ namespace Umbraco.Web
|
||||
);
|
||||
defaultRoute.RouteHandler = new RenderRouteHandler(ControllerBuilder.Current.GetControllerFactory());
|
||||
|
||||
//Create the install routes
|
||||
var installPackageRoute = RouteTable.Routes.MapRoute(
|
||||
"Umbraco_install_packages",
|
||||
"Install/PackageInstaller/{action}/{id}",
|
||||
new { controller = "InstallPackage", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
installPackageRoute.DataTokens.Add("area", umbracoPath);
|
||||
|
||||
//Create the REST/web/script service routes
|
||||
var webServiceRoutes = RouteTable.Routes.MapRoute(
|
||||
"Umbraco_web_services",
|
||||
umbracoPath + "/RestServices/{controller}/{action}/{id}",
|
||||
new { controller = "SaveFileController", action = "Index", id = UrlParameter.Optional },
|
||||
//look in this namespace for controllers
|
||||
new string[] { "Umbraco.Web.WebServices" }
|
||||
);
|
||||
webServiceRoutes.DataTokens.Add("area", umbracoPath);
|
||||
//register all back office routes
|
||||
RouteBackOfficeControllers();
|
||||
|
||||
//plugin controllers must come first because the next route will catch many things
|
||||
RoutePluginControllers();
|
||||
}
|
||||
|
||||
private void RouteBackOfficeControllers()
|
||||
{
|
||||
var backOfficeArea = new BackOfficeArea();
|
||||
RouteTable.Routes.RegisterArea(backOfficeArea);
|
||||
}
|
||||
|
||||
private void RoutePluginControllers()
|
||||
{
|
||||
@@ -228,7 +220,6 @@ namespace Umbraco.Web
|
||||
route.DataTokens.Add("Namespaces", new[] {meta.ControllerNamespace}); //look in this namespace to create the controller
|
||||
route.DataTokens.Add("umbraco", "api"); //ensure the umbraco token is set
|
||||
}
|
||||
|
||||
private void RouteLocalSurfaceController(Type controller, string umbracoPath)
|
||||
{
|
||||
var meta = PluginController.GetMetadata(controller);
|
||||
|
||||
Reference in New Issue
Block a user