#18871: Fixing root zone placement

Work Item: 18871

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-09-28 14:47:38 -07:00
parent 57c9ed5d8c
commit 929740c332
5 changed files with 13 additions and 6 deletions

View File

@@ -74,6 +74,9 @@ namespace Orchard.ContentTypes.Services {
itemShape.Metadata.DisplayType = actualDisplayType;
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, String.Empty, _shapeFactory);
var workContext = _workContextAccessor.GetContext(_requestContext.HttpContext);
context.Layout = workContext.Layout;
BindPlacement(context, actualDisplayType, "Content");
var placementSettings = new List<DriverResultPlacement>();

View File

@@ -54,6 +54,9 @@ namespace Orchard.ContentManagement {
itemShape.Metadata.DisplayType = actualDisplayType;
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, groupId, _shapeFactory);
var workContext = _workContextAccessor.GetContext(_requestContext.HttpContext);
context.Layout = workContext.Layout;
BindPlacement(context, actualDisplayType, stereotype);
_handlers.Value.Invoke(handler => handler.BuildDisplay(context), Logger);

View File

@@ -73,6 +73,12 @@ namespace Orchard.ContentManagement.Drivers {
newShapeMetadata.Wrappers.Add(wrapper);
}
// the zone name is in reference of Layout, e.g. /AsideSecond
if (placement.Location.StartsWith("/")) {
placement.Location = placement.Location.Substring(1);
parentShape = context.Layout;
}
var delimiterIndex = placement.Location.IndexOf(':');
if (delimiterIndex < 0) {
parentShape.Zones[placement.Location].Add(newShape);

View File

@@ -17,6 +17,7 @@ namespace Orchard.ContentManagement.Handlers {
public IContent Content { get; private set; }
public ContentItem ContentItem { get; private set; }
public dynamic New { get; private set; }
public IShape Layout { get; set; }
public string GroupId { get; private set; }
public ContentPart ContentPart { get; set; }

View File

@@ -75,12 +75,6 @@ namespace Orchard.UI.Zones {
if (keys.Count() == 1) {
var key = System.Convert.ToString(keys.Single());
// the zone name is in reference of Layout, e.g. /AsideSecond
if(_layoutShape != null && key.StartsWith("/")) {
key = key.Substring(1);
_parent = _layoutShape;
}
return GetMember(proceed, null, key);
}
return proceed();