diff --git a/build/NuSpecs/UmbracoCms.Core.AllBinaries.nuspec b/build/NuSpecs/UmbracoCms.Core.AllBinaries.nuspec index 517f0d441e..35839623e0 100644 --- a/build/NuSpecs/UmbracoCms.Core.AllBinaries.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.AllBinaries.nuspec @@ -36,7 +36,6 @@ - diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index eb6fabe720..27e2dea807 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -15,11 +15,11 @@ en-US umbraco - - - - - + + + + + @@ -48,7 +48,6 @@ - diff --git a/build/NuSpecs/tools/install.core.ps1 b/build/NuSpecs/tools/install.core.ps1 index 79133a9f6a..ad813a6248 100644 --- a/build/NuSpecs/tools/install.core.ps1 +++ b/build/NuSpecs/tools/install.core.ps1 @@ -27,7 +27,6 @@ if ($project) { if(Test-Path $umbracoBinFolder\interfaces.dll) { Remove-Item $umbracoBinFolder\interfaces.dll -Force -Confirm:$false } if(Test-Path $umbracoBinFolder\log4net.dll) { Remove-Item $umbracoBinFolder\log4net.dll -Force -Confirm:$false } if(Test-Path $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll) { Remove-Item $umbracoBinFolder\Microsoft.ApplicationBlocks.Data.dll -Force -Confirm:$false } - if(Test-Path $umbracoBinFolder\Microsoft.Web.Helpers.dll) { Remove-Item $umbracoBinFolder\Microsoft.Web.Helpers.dll -Force -Confirm:$false } if(Test-Path $umbracoBinFolder\SQLCE4Umbraco.dll) { Remove-Item $umbracoBinFolder\SQLCE4Umbraco.dll -Force -Confirm:$false } if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.dll -Force -Confirm:$false } if(Test-Path $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll) { Remove-Item $umbracoBinFolder\System.Data.SqlServerCe.Entity.dll -Force -Confirm:$false } diff --git a/src/Umbraco.Web.UI.Client/bower.json b/src/Umbraco.Web.UI.Client/bower.json index ceb4520ddc..19e458cdbf 100644 --- a/src/Umbraco.Web.UI.Client/bower.json +++ b/src/Umbraco.Web.UI.Client/bower.json @@ -34,7 +34,7 @@ "": "underscore-min.{js,map}" }, "jquery": { - "": "jquery.min.{js,map}" + "": "dist/jquery.min.{js,map}" }, "jquery-file-upload": { "": "**/jquery.{fileupload,fileupload-process,fileupload-angular,fileupload-image}.js" diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 9649ab9cc4..d102596130 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -158,9 +158,6 @@ ..\packages\Microsoft.Bcl.Async.1.0.165\lib\net45\Microsoft.Threading.Tasks.Extensions.dll - - ..\packages\Microsoft.Web.Helpers.1.0.0\lib\Microsoft.Web.Helpers.dll - True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll @@ -2549,7 +2546,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\" True True - 7210 + 7220 / http://localhost:7220 False diff --git a/src/Umbraco.Web.UI/Views/Web.config b/src/Umbraco.Web.UI/Views/Web.config index edcc9d4b62..0da8fd5ad1 100644 --- a/src/Umbraco.Web.UI/Views/Web.config +++ b/src/Umbraco.Web.UI/Views/Web.config @@ -20,7 +20,6 @@ - diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index e58593a7c9..e4198b22a2 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -19,7 +19,6 @@ - diff --git a/src/Umbraco.Web/Mvc/MvcVersionCheck.cs b/src/Umbraco.Web/Mvc/MvcVersionCheck.cs new file mode 100644 index 0000000000..348ce05d7d --- /dev/null +++ b/src/Umbraco.Web/Mvc/MvcVersionCheck.cs @@ -0,0 +1,10 @@ +namespace Umbraco.Web.Mvc +{ + internal class MvcVersionCheck + { + public static System.Version MvcVersion + { + get { return typeof (System.Web.Mvc.Controller).Assembly.GetName().Version; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/PluginViewEngine.cs b/src/Umbraco.Web/Mvc/PluginViewEngine.cs index 6c0d80d058..cc4174b76a 100644 --- a/src/Umbraco.Web/Mvc/PluginViewEngine.cs +++ b/src/Umbraco.Web/Mvc/PluginViewEngine.cs @@ -1,15 +1,16 @@ using System.IO; using System.Linq; using System.Web.Mvc; +using Lucene.Net.Util; using Microsoft.Web.Mvc; using Umbraco.Core.IO; namespace Umbraco.Web.Mvc { - /// + /// /// A view engine to look into the App_Plugins folder for views for packaged controllers /// - public class PluginViewEngine : FixedRazorViewEngine + public class PluginViewEngine : ReflectedFixedRazorViewEngine { /// @@ -47,9 +48,9 @@ namespace Umbraco.Web.Mvc }) .ToArray(); - AreaMasterLocationFormats = viewLocationsArray; + AreaMasterLocationFormats = viewLocationsArray; - AreaPartialViewLocationFormats = new[] + AreaPartialViewLocationFormats = new[] { //will be used when we have partial view and child action macros string.Concat(SystemDirectories.AppPlugins, "/{2}/Views/Partials/{0}.cshtml"), diff --git a/src/Umbraco.Web/Mvc/ReflectedFixedRazorViewEngine.cs b/src/Umbraco.Web/Mvc/ReflectedFixedRazorViewEngine.cs new file mode 100644 index 0000000000..5cb082c032 --- /dev/null +++ b/src/Umbraco.Web/Mvc/ReflectedFixedRazorViewEngine.cs @@ -0,0 +1,98 @@ +using System; +using System.Reflection; +using System.Web.Mvc; + +namespace Umbraco.Web.Mvc +{ + /// + /// This is here to support compatibility with both MVC4 and MVC5 + /// + public abstract class ReflectedFixedRazorViewEngine : IViewEngine + { + protected ReflectedFixedRazorViewEngine() + { + if (MvcVersionCheck.MvcVersion >= System.Version.Parse("5.0.0")) + { + _wrappedEngine = new RazorViewEngine(); + } + else + { + var assembly = Assembly.Load("Microsoft.Web.Mvc.FixedDisplayModes"); + var engineType = assembly.GetType("Microsoft.Web.Mvc.FixedRazorViewEngine"); + _wrappedEngine = (IViewEngine)Activator.CreateInstance(engineType); + } + } + + public string[] ViewLocationFormats + { + get { return _viewLocationFormats; } + set + { + _wrappedEngine.GetType().GetProperty("ViewLocationFormats").SetValue(_wrappedEngine, value); + _viewLocationFormats = value; + } + } + + public string[] PartialViewLocationFormats + { + get { return _partialViewLocationFormats; } + set + { + _wrappedEngine.GetType().GetProperty("PartialViewLocationFormats").SetValue(_wrappedEngine, value); + _partialViewLocationFormats = value; + } + } + + public string[] AreaViewLocationFormats + { + get { return _areaViewLocationFormats; } + set + { + _wrappedEngine.GetType().GetProperty("AreaViewLocationFormats").SetValue(_wrappedEngine, value); + _areaViewLocationFormats = value; + } + } + + public string[] AreaMasterLocationFormats + { + get { return _areaMasterLocationFormats; } + set + { + _wrappedEngine.GetType().GetProperty("AreaMasterLocationFormats").SetValue(_wrappedEngine, value); + _areaMasterLocationFormats = value; + } + } + + public string[] AreaPartialViewLocationFormats + { + get { return _areaPartialViewLocationFormats; } + set + { + _wrappedEngine.GetType().GetProperty("AreaPartialViewLocationFormats").SetValue(_wrappedEngine, value); + _areaPartialViewLocationFormats = value; + } + } + + private readonly IViewEngine _wrappedEngine; + private string[] _areaViewLocationFormats; + private string[] _areaMasterLocationFormats; + private string[] _areaPartialViewLocationFormats; + private string[] _viewLocationFormats; + private string[] _partialViewLocationFormats; + + public virtual ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) + { + return _wrappedEngine.FindPartialView(controllerContext, partialViewName, useCache); + } + + public virtual ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) + { + return _wrappedEngine.FindView(controllerContext, viewName, masterName, useCache); + } + + public void ReleaseView(ControllerContext controllerContext, IView view) + { + _wrappedEngine.ReleaseView(controllerContext, view); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/RenderViewEngine.cs b/src/Umbraco.Web/Mvc/RenderViewEngine.cs index 960ff1bb71..794eecf0ca 100644 --- a/src/Umbraco.Web/Mvc/RenderViewEngine.cs +++ b/src/Umbraco.Web/Mvc/RenderViewEngine.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Mvc /// A view engine to look into the template location specified in the config for the front-end/Rendering part of the cms, /// this includes paths to render partial macros and media item templates. /// - public class RenderViewEngine : FixedRazorViewEngine + public class RenderViewEngine : ReflectedFixedRazorViewEngine { private readonly IEnumerable _supplementedViewLocations = new[] { "/{0}.cshtml" }; @@ -33,7 +33,7 @@ namespace Umbraco.Web.Mvc var replacePartialWithUmbracoFolder = _supplementedPartialViewLocations.ForEach(location => templateFolder + location); //The Render view engine doesn't support Area's so make those blank - ViewLocationFormats = replaceWithUmbracoFolder.ToArray(); + ViewLocationFormats = replaceWithUmbracoFolder.ToArray(); PartialViewLocationFormats = replacePartialWithUmbracoFolder.ToArray(); AreaPartialViewLocationFormats = new string[] { }; diff --git a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs index 8142637d02..4ab3c12a51 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeExtensions.cs @@ -78,6 +78,7 @@ namespace Umbraco.Web.Trees var proxiedRouteData = new HttpRouteData( controllerContext.RouteData.Route, new HttpRouteValueDictionary(new {action = "GetRootNode", controller = ControllerExtensions.GetControllerName(instance.GetType())})); + //create a proxied controller context var proxiedControllerContext = new HttpControllerContext( controllerContext.Configuration, @@ -86,10 +87,31 @@ namespace Umbraco.Web.Trees { ControllerDescriptor = new HttpControllerDescriptor(controllerContext.ControllerDescriptor.Configuration, ControllerExtensions.GetControllerName(instance.GetType()), instance.GetType()) }; - + + if (WebApiVersionCheck.WebApiVersion >= Version.Parse("5.0.0")) + { + //In WebApi2, this is required to be set: + // proxiedControllerContext.RequestContext = controllerContext.RequestContext + // but we need to do this with reflection because of codebase changes between version 4/5 + //NOTE: Use TypeHelper here since the reflection is cached + var controllerContextRequestContext = TypeHelper.GetProperty(controllerContext.GetType(), "RequestContext").GetValue(controllerContext); + TypeHelper.GetProperty(proxiedControllerContext.GetType(), "RequestContext").SetValue(proxiedControllerContext, controllerContextRequestContext); + } + instance.ControllerContext = proxiedControllerContext; instance.Request = controllerContext.Request; - + + if (WebApiVersionCheck.WebApiVersion >= Version.Parse("5.0.0")) + { + //now we can change the request context's route data to be the proxied route data - NOTE: we cannot do this directly above + // because it will detect that the request context is different throw an exception. This is a change in webapi2 and we need to set + // this with reflection due to codebase changes between version 4/5 + // instance.RequestContext.RouteData = proxiedRouteData; + //NOTE: Use TypeHelper here since the reflection is cached + var instanceRequestContext = TypeHelper.GetProperty(typeof(ApiController), "RequestContext").GetValue(instance); + TypeHelper.GetProperty(instanceRequestContext.GetType(), "RouteData").SetValue(instanceRequestContext, proxiedRouteData); + } + //invoke auth filters for this sub request var result = await instance.ControllerContext.InvokeAuthorizationFiltersForRequest(); //if a result is returned it means they are unauthorized, just throw the response. diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e554b88b15..b9fac5162a 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -270,6 +270,8 @@ + + @@ -809,6 +811,7 @@ + diff --git a/src/Umbraco.Web/WebApi/MvcVersionCheck.cs b/src/Umbraco.Web/WebApi/MvcVersionCheck.cs new file mode 100644 index 0000000000..c2f2580c95 --- /dev/null +++ b/src/Umbraco.Web/WebApi/MvcVersionCheck.cs @@ -0,0 +1,10 @@ +namespace Umbraco.Web.WebApi +{ + internal class WebApiVersionCheck + { + public static System.Version WebApiVersion + { + get { return typeof(System.Web.Http.ApiController).Assembly.GetName().Version; } + } + } +} \ No newline at end of file diff --git a/src/umbraco.MacroEngines/Resources/Web.config b/src/umbraco.MacroEngines/Resources/Web.config index 163957b32e..d96172c0e4 100644 --- a/src/umbraco.MacroEngines/Resources/Web.config +++ b/src/umbraco.MacroEngines/Resources/Web.config @@ -12,7 +12,6 @@ -