mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#18788: Fixing admin placement leak to other contnet types
Work Item: 18788 --HG-- branch : 1.x
This commit is contained in:
+19
-14
@@ -6,7 +6,6 @@ using Orchard.ContentTypes.Settings;
|
|||||||
using Orchard.DisplayManagement.Descriptors;
|
using Orchard.DisplayManagement.Descriptors;
|
||||||
using Orchard.ContentTypes.Extensions;
|
using Orchard.ContentTypes.Extensions;
|
||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Configuration;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
|
|
||||||
namespace Orchard.ContentTypes.Services {
|
namespace Orchard.ContentTypes.Services {
|
||||||
@@ -40,27 +39,33 @@ namespace Orchard.ContentTypes.Services {
|
|||||||
// there are some custom placements, build a predicate
|
// there are some custom placements, build a predicate
|
||||||
var placement = descriptor.Placement;
|
var placement = descriptor.Placement;
|
||||||
|
|
||||||
foreach(var customPlacement in customPlacements) {
|
if(!customPlacements.Any()) {
|
||||||
// create local variables to prevent LINQ issues
|
continue;
|
||||||
var placementShapeType = customPlacement.Placement.ShapeType;
|
|
||||||
var type = customPlacement.ContentType;
|
|
||||||
var differentiator = customPlacement.Placement.Differentiator;
|
|
||||||
var location = customPlacement.Placement.Zone;
|
|
||||||
if(!String.IsNullOrEmpty(customPlacement.Placement.Position)) {
|
|
||||||
location = String.Concat(location, ":", customPlacement.Placement.Position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptor.Placement = ctx => {
|
descriptor.Placement = ctx => {
|
||||||
var nextPlacement = placement(ctx);
|
if(ctx.DisplayType != null) {
|
||||||
if(ctx.DisplayType == null && ((ctx.Differentiator ?? "") == (differentiator ?? "")) && ctx.ContentType == type) {
|
foreach(var customPlacement in customPlacements) {
|
||||||
nextPlacement.Location = location;
|
|
||||||
|
var type = customPlacement.ContentType;
|
||||||
|
var differentiator = customPlacement.Placement.Differentiator;
|
||||||
|
|
||||||
|
if (((ctx.Differentiator ?? String.Empty) == (differentiator ?? String.Empty)) && ctx.ContentType == type) {
|
||||||
|
|
||||||
|
var location = customPlacement.Placement.Zone;
|
||||||
|
if (!String.IsNullOrEmpty(customPlacement.Placement.Position)) {
|
||||||
|
location = String.Concat(location, ":", customPlacement.Placement.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nextPlacement;
|
return new PlacementInfo { Location = location };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return placement(ctx);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user