--HG--
branch : dev
This commit is contained in:
Sebastien Ros 2011-02-09 15:02:58 -08:00
commit bade5cc81c
3 changed files with 10 additions and 0 deletions

View File

@ -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;

View File

@ -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; }
}
}

View File

@ -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;
}