mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{50B779EA-EC00-4699-84C0-03B395C365D2}</ProjectGuid>
|
<ProjectGuid>{50B779EA-EC00-4699-84C0-03B395C365D2}</ProjectGuid>
|
||||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Orchard.Web</RootNamespace>
|
<RootNamespace>Orchard.Web</RootNamespace>
|
||||||
|
@@ -60,7 +60,7 @@ namespace Orchard.Data {
|
|||||||
public ISessionFactory GetSessionFactory() {
|
public ISessionFactory GetSessionFactory() {
|
||||||
lock (this) {
|
lock (this) {
|
||||||
if (_sessionFactory == null) {
|
if (_sessionFactory == null) {
|
||||||
_sessionFactory = BuildSessionFactory(false /*createDatabase*/, false /*updateSchema*/);
|
_sessionFactory = BuildSessionFactory(false /*createDatabase*/, true /*updateSchema*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _sessionFactory;
|
return _sessionFactory;
|
||||||
|
@@ -18,6 +18,7 @@ namespace Orchard.Mvc.AntiForgery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnAuthorization(AuthorizationContext filterContext) {
|
public void OnAuthorization(AuthorizationContext filterContext) {
|
||||||
|
#if false
|
||||||
if ((filterContext.HttpContext.Request.HttpMethod != "POST" ||
|
if ((filterContext.HttpContext.Request.HttpMethod != "POST" ||
|
||||||
_authenticationService.GetAuthenticatedUser() == null) && !ShouldValidateGet(filterContext)) {
|
_authenticationService.GetAuthenticatedUser() == null) && !ShouldValidateGet(filterContext)) {
|
||||||
return;
|
return;
|
||||||
@@ -29,6 +30,7 @@ namespace Orchard.Mvc.AntiForgery {
|
|||||||
|
|
||||||
if (filterContext.HttpContext is HackHttpContext)
|
if (filterContext.HttpContext is HackHttpContext)
|
||||||
filterContext.HttpContext = ((HackHttpContext)filterContext.HttpContext).OriginalHttpContextBase;
|
filterContext.HttpContext = ((HackHttpContext)filterContext.HttpContext).OriginalHttpContextBase;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ShouldValidateGet(AuthorizationContext context) {
|
private static bool ShouldValidateGet(AuthorizationContext context) {
|
||||||
|
@@ -8,6 +8,7 @@ using System.Web.Mvc;
|
|||||||
using System.Web.Mvc.Html;
|
using System.Web.Mvc.Html;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.Extensions;
|
using Orchard.Extensions;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
using Orchard.Services;
|
using Orchard.Services;
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
using Orchard.Utility;
|
using Orchard.Utility;
|
||||||
@@ -297,5 +298,38 @@ namespace Orchard.Mvc.Html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region AddRenderAction
|
||||||
|
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, null);
|
||||||
|
}
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, object routeValues) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, new RouteValueDictionary(routeValues));
|
||||||
|
}
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, RouteValueDictionary routeValues) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, routeValues);
|
||||||
|
}
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, controllerName, null/*RouteValueDictionary*/);
|
||||||
|
}
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName, object routeValues) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, controllerName, new RouteValueDictionary(routeValues));
|
||||||
|
}
|
||||||
|
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||||
|
AddRenderActionHelper(html, location, actionName, controllerName, routeValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddRenderActionHelper(this HtmlHelper html, string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||||
|
// Retrieve the "BaseViewModel" for zones if we have one
|
||||||
|
var baseViewModel = BaseViewModel.From(html.ViewData);
|
||||||
|
if (baseViewModel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
baseViewModel.Zones.AddRenderAction(location, actionName, controllerName, routeValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -310,7 +310,9 @@
|
|||||||
<Compile Include="UI\Zones\IZoneManager.cs" />
|
<Compile Include="UI\Zones\IZoneManager.cs" />
|
||||||
<Compile Include="UI\Zones\ContentPartDisplayZoneItem.cs" />
|
<Compile Include="UI\Zones\ContentPartDisplayZoneItem.cs" />
|
||||||
<Compile Include="UI\Zones\ContentPartEditorZoneItem.cs" />
|
<Compile Include="UI\Zones\ContentPartEditorZoneItem.cs" />
|
||||||
|
<Compile Include="UI\Zones\RenderActionZoneItem.cs" />
|
||||||
<Compile Include="UI\Zones\RenderPartialZoneItem.cs" />
|
<Compile Include="UI\Zones\RenderPartialZoneItem.cs" />
|
||||||
|
<Compile Include="UI\Zones\RenderStaticZoneItem.cs" />
|
||||||
<Compile Include="UI\Zones\ZoneCollection.cs" />
|
<Compile Include="UI\Zones\ZoneCollection.cs" />
|
||||||
<Compile Include="UI\Zones\ZoneEntry.cs" />
|
<Compile Include="UI\Zones\ZoneEntry.cs" />
|
||||||
<Compile Include="UI\Zones\ZoneItem.cs" />
|
<Compile Include="UI\Zones\ZoneItem.cs" />
|
||||||
|
15
src/Orchard/UI/Zones/RenderActionZoneItem.cs
Normal file
15
src/Orchard/UI/Zones/RenderActionZoneItem.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using System.Web.Mvc.Html;
|
||||||
|
using System.Web.Routing;
|
||||||
|
|
||||||
|
namespace Orchard.UI.Zones {
|
||||||
|
public class RenderActionZoneItem : ZoneItem {
|
||||||
|
public string ActionName { get; set; }
|
||||||
|
public string ControllerName { get; set; }
|
||||||
|
public RouteValueDictionary RouteValues { get; set; }
|
||||||
|
|
||||||
|
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||||
|
html.RenderAction(ActionName, ControllerName, RouteValues);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
src/Orchard/UI/Zones/RenderStaticZoneItem.cs
Normal file
13
src/Orchard/UI/Zones/RenderStaticZoneItem.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Web.Mvc;
|
||||||
|
using System.Web.Mvc.Html;
|
||||||
|
|
||||||
|
namespace Orchard.UI.Zones {
|
||||||
|
public class RenderStaticZoneItem : ZoneItem {
|
||||||
|
public object Model { get; set; }
|
||||||
|
public string TemplateName { get; set; }
|
||||||
|
|
||||||
|
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||||
|
html.RenderPartial(TemplateName, Model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using System.Web.Routing;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.UI.Zones {
|
namespace Orchard.UI.Zones {
|
||||||
@@ -15,6 +16,11 @@ namespace Orchard.UI.Zones {
|
|||||||
public void AddRenderPartial(string location, string templateName, object model) {
|
public void AddRenderPartial(string location, string templateName, object model) {
|
||||||
AddZoneItem(location, new RenderPartialZoneItem { Model = model, TemplateName = templateName });
|
AddZoneItem(location, new RenderPartialZoneItem { Model = model, TemplateName = templateName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRenderStatic(string location, string templateName, object model) {
|
||||||
|
AddZoneItem(location, new RenderStaticZoneItem { Model = model, TemplateName = templateName });
|
||||||
|
}
|
||||||
|
|
||||||
public void AddDisplayItem(string location, ContentItemViewModel viewModel) {
|
public void AddDisplayItem(string location, ContentItemViewModel viewModel) {
|
||||||
AddZoneItem(location, new ContentItemDisplayZoneItem { ViewModel = viewModel });
|
AddZoneItem(location, new ContentItemDisplayZoneItem { ViewModel = viewModel });
|
||||||
}
|
}
|
||||||
@@ -25,6 +31,25 @@ namespace Orchard.UI.Zones {
|
|||||||
AddZoneItem(location, new ContentPartEditorZoneItem { Model = model, TemplateName = templateName, Prefix = prefix });
|
AddZoneItem(location, new ContentPartEditorZoneItem { Model = model, TemplateName = templateName, Prefix = prefix });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddRenderAction(string location, string actionName) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName });
|
||||||
|
}
|
||||||
|
public void AddRenderAction(string location, string actionName, object routeValues) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, RouteValues = new RouteValueDictionary(routeValues) });
|
||||||
|
}
|
||||||
|
public void AddRenderAction(string location, string actionName, RouteValueDictionary routeValues) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, RouteValues = routeValues });
|
||||||
|
}
|
||||||
|
public void AddRenderAction(string location, string actionName, string controllerName) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName });
|
||||||
|
}
|
||||||
|
public void AddRenderAction(string location, string actionName, string controllerName, object routeValues) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName, RouteValues = new RouteValueDictionary(routeValues) });
|
||||||
|
}
|
||||||
|
public void AddRenderAction(string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||||
|
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName, RouteValues = routeValues });
|
||||||
|
}
|
||||||
|
|
||||||
private void AddZoneItem(string location, ZoneItem item) {
|
private void AddZoneItem(string location, ZoneItem item) {
|
||||||
string zoneName;
|
string zoneName;
|
||||||
var position = string.Empty;
|
var position = string.Empty;
|
||||||
|
Reference in New Issue
Block a user