diff --git a/src/Orchard/ContentManagement/DefaultContentDisplay.cs b/src/Orchard/ContentManagement/DefaultContentDisplay.cs index cb03ce034..2f59d16c5 100644 --- a/src/Orchard/ContentManagement/DefaultContentDisplay.cs +++ b/src/Orchard/ContentManagement/DefaultContentDisplay.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Web; using System.Web.Routing; using ClaySharp.Implementation; using Orchard.ContentManagement.Handlers; @@ -100,6 +101,7 @@ namespace Orchard.ContentManagement { //var theme = workContext.CurrentTheme; var theme = _themeService.Value.GetRequestTheme(_requestContext); var shapeTable = _shapeTableManager.GetShapeTable(theme.Id); + var request = _requestContext.HttpContext.Request; ShapeDescriptor descriptor; if (shapeTable.Descriptors.TryGetValue(partShapeType, out descriptor)) { @@ -107,6 +109,7 @@ namespace Orchard.ContentManagement { ContentType = context.ContentItem.ContentType, DisplayType = displayType, Differentiator = differentiator, + Path = request.Path.Substring((request.ApplicationPath ?? "").Length) }; var location = descriptor.Placement(placementContext); return location ?? defaultLocation; diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapeAlterationBuilder.cs b/src/Orchard/DisplayManagement/Descriptors/ShapeAlterationBuilder.cs index 5bb361e0f..f5799ac8d 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapeAlterationBuilder.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapeAlterationBuilder.cs @@ -111,5 +111,6 @@ namespace Orchard.DisplayManagement.Descriptors { public string ContentType { get; set; } public string DisplayType { get; set; } public string Differentiator { get; set; } + public string Path { get; set; } } } diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs index b7761a785..3275b32ae 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/ShapePlacementParsingStrategy.cs @@ -98,6 +98,12 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { return ctx => (ctx.DisplayType ?? "").StartsWith(prefix) && predicate(ctx); } return ctx => (ctx.DisplayType == expression) && predicate(ctx); + case "Path": + if (expression.EndsWith("*")) { + var prefix = expression.Substring(0, expression.Length - 1); + return ctx => (ctx.Path ?? "").StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && predicate(ctx); + } + return ctx => (ctx.Path.Equals(expression, StringComparison.OrdinalIgnoreCase)) && predicate(ctx); } return predicate; }