mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Overloading ContentPart to optionally have new shape passed in
If lambda takes an argument, it is dynamic, and is an uninitialized shape of the named type ShapeHelper and IShapeHelperFactory are obsolete - IShapeFactory itself is now dynamic --HG-- branch : dev
This commit is contained in:
@@ -38,7 +38,6 @@ namespace Orchard.Core.Tests.Body {
|
|||||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
|
|
||||||
builder.RegisterType<ThingHandler>().As<IContentHandler>();
|
builder.RegisterType<ThingHandler>().As<IContentHandler>();
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ namespace Orchard.Core.Tests.Common.Providers {
|
|||||||
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
|
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||||
<Reference Include="Moq, Version=4.0.812.4, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.0.812.4, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ namespace Orchard.Core.Tests.Routable.Services {
|
|||||||
builder.RegisterType<RoutablePathConstraint>().As<IRoutablePathConstraint>();
|
builder.RegisterType<RoutablePathConstraint>().As<IRoutablePathConstraint>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
|
|
||||||
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
|
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
|
||||||
builder.RegisterInstance(new UrlHelper(new RequestContext(new StubHttpContext("~/"), new RouteData()))).As<UrlHelper>();
|
builder.RegisterInstance(new UrlHelper(new RequestContext(new StubHttpContext("~/"), new RouteData()))).As<UrlHelper>();
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ namespace Orchard.Core.Tests.Scheduling {
|
|||||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ namespace Orchard.Core.Tests.Scheduling {
|
|||||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
|
<Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||||
<Reference Include="FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
|
<Reference Include="FluentNHibernate, Version=1.0.0.593, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
|
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ namespace Orchard.Tests.Modules.Themes.Services {
|
|||||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||||
builder.RegisterType<ContentDefinitionManager>().As<IContentDefinitionManager>();
|
builder.RegisterType<ContentDefinitionManager>().As<IContentDefinitionManager>();
|
||||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
|||||||
builder.RegisterType<TransactionManager>().As<ITransactionManager>();
|
builder.RegisterType<TransactionManager>().As<ITransactionManager>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
builder.RegisterInstance(new Mock<INotifier>().Object);
|
builder.RegisterInstance(new Mock<INotifier>().Object);
|
||||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ namespace Orchard.Tests.Modules.Users.Services {
|
|||||||
builder.RegisterType<DefaultMessageManager>().As<IMessageManager>();
|
builder.RegisterType<DefaultMessageManager>().As<IMessageManager>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ namespace Orchard.Tests.Modules.Widgets.Services {
|
|||||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<WidgetsService>().As<IWidgetsService>();
|
builder.RegisterType<WidgetsService>().As<IWidgetsService>();
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
Theme theme1 = new Theme { Zones = ThemeZoneName1 };
|
Theme theme1 = new Theme { Zones = ThemeZoneName1 };
|
||||||
@@ -242,8 +241,24 @@ namespace Orchard.Tests.Modules.Widgets.Services {
|
|||||||
Assert.That(widgetPart3.Position, Is.EqualTo(Position3), "Widget remained in the same position");
|
Assert.That(widgetPart3.Position, Is.EqualTo(Position3), "Widget remained in the same position");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Ignore("Fix when possible")]
|
[Test, Ignore("Fix when possible")]
|
||||||
public void GetLayerWidgetsTest() {
|
public void GetLayerWidgetsTest() {
|
||||||
|
LayerPart layerPart = _widgetService.CreateLayer(LayerName1, LayerDescription1, "");
|
||||||
|
_contentManager.Flush();
|
||||||
|
|
||||||
|
// same zone widgets
|
||||||
|
WidgetPart widgetPart1 = _widgetService.CreateWidget(layerPart.Id, "HtmlWidget", WidgetTitle1, Position1, Zone1);
|
||||||
|
WidgetPart widgetPart2 = _widgetService.CreateWidget(layerPart.Id, "HtmlWidget", WidgetTitle2, Position2, Zone1);
|
||||||
|
|
||||||
|
// different zone widget
|
||||||
|
_widgetService.CreateWidget(layerPart.Id, "HtmlWidget", WidgetTitle3, Position3, Zone2);
|
||||||
|
|
||||||
|
// test 1 - moving first widget up will have no effect
|
||||||
|
IEnumerable<WidgetPart> layerWidgets = _widgetService.GetWidgets(layerPart.Id);
|
||||||
|
Assert.That(layerWidgets.Count(), Is.EqualTo(2));
|
||||||
|
Assert.That(layerWidgets.Contains(widgetPart1));
|
||||||
|
Assert.That(layerWidgets.Contains(widgetPart2));
|
||||||
|
}
|
||||||
|
|
||||||
public class StubLayerPartHandler : ContentHandler {
|
public class StubLayerPartHandler : ContentHandler {
|
||||||
public StubLayerPartHandler(IRepository<LayerPartRecord> layersRepository) {
|
public StubLayerPartHandler(IRepository<LayerPartRecord> layersRepository) {
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ namespace Orchard.Tests.ContentManagement {
|
|||||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
|
|
||||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ namespace Orchard.Tests.ContentManagement {
|
|||||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||||
|
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
|||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
//builder.RegisterModule(new ImplicitCollectionSupportModule());
|
//builder.RegisterModule(new ImplicitCollectionSupportModule());
|
||||||
builder.RegisterType<ContentPartDriverCoordinator>().As<IContentHandler>();
|
builder.RegisterType<ContentPartDriverCoordinator>().As<IContentHandler>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||||
_container = builder.Build();
|
_container = builder.Build();
|
||||||
@@ -45,7 +44,7 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
|||||||
var contentHandler = _container.Resolve<IContentHandler>();
|
var contentHandler = _container.Resolve<IContentHandler>();
|
||||||
|
|
||||||
var contentItem = new ContentItem();
|
var contentItem = new ContentItem();
|
||||||
var context = new BuildDisplayContext(null, contentItem, "", new ShapeHelperFactory(null));
|
var context = new BuildDisplayContext(null, contentItem, "", new Mock<IShapeFactory>().Object);
|
||||||
|
|
||||||
driver1.Verify(x => x.BuildDisplay(context), Times.Never());
|
driver1.Verify(x => x.BuildDisplay(context), Times.Never());
|
||||||
driver2.Verify(x => x.BuildDisplay(context), Times.Never());
|
driver2.Verify(x => x.BuildDisplay(context), Times.Never());
|
||||||
@@ -61,13 +60,13 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
|||||||
builder.RegisterInstance(driver).As<IContentPartDriver>();
|
builder.RegisterInstance(driver).As<IContentPartDriver>();
|
||||||
builder.Update(_container);
|
builder.Update(_container);
|
||||||
var contentHandler = _container.Resolve<IContentHandler>();
|
var contentHandler = _container.Resolve<IContentHandler>();
|
||||||
var shapeHelperFactory = _container.Resolve<IShapeHelperFactory>();
|
dynamic shapeFactory = _container.Resolve<IShapeFactory>();
|
||||||
|
|
||||||
var contentItem = new ContentItem();
|
var contentItem = new ContentItem();
|
||||||
contentItem.Weld(new StubPart { Foo = new[] { "a", "b", "c" } });
|
contentItem.Weld(new StubPart { Foo = new[] { "a", "b", "c" } });
|
||||||
|
|
||||||
var ctx = new BuildDisplayContext(null, null, "", null);
|
var ctx = new BuildDisplayContext(null, null, "", null);
|
||||||
var context = shapeHelperFactory.CreateHelper().Context(ctx);
|
var context = shapeFactory.Context(ctx);
|
||||||
Assert.That(context.TopMeta, Is.Null);
|
Assert.That(context.TopMeta, Is.Null);
|
||||||
contentHandler.BuildDisplay(ctx);
|
contentHandler.BuildDisplay(ctx);
|
||||||
Assert.That(context.TopMeta, Is.Not.Null);
|
Assert.That(context.TopMeta, Is.Not.Null);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
_container = builder.Build();
|
_container = builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init() {
|
public void Init() {
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||||
@@ -29,7 +28,7 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CreatingNewShapeTypeByName() {
|
public void CreatingNewShapeTypeByName() {
|
||||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||||
|
|
||||||
var alpha = shape.Alpha();
|
var alpha = shape.Alpha();
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CreatingShapeWithAdditionalNamedParameters() {
|
public void CreatingShapeWithAdditionalNamedParameters() {
|
||||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||||
|
|
||||||
var alpha = shape.Alpha(one: 1, two: "dos");
|
var alpha = shape.Alpha(one: 1, two: "dos");
|
||||||
|
|
||||||
@@ -49,7 +48,7 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void WithPropertyBearingObjectInsteadOfNamedParameters() {
|
public void WithPropertyBearingObjectInsteadOfNamedParameters() {
|
||||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||||
|
|
||||||
var alpha = shape.Alpha(new { one = 1, two = "dos" });
|
var alpha = shape.Alpha(new { one = 1, two = "dos" });
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
builder.RegisterInstance(new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext)).As<IWorkContextAccessor>();
|
builder.RegisterInstance(new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext)).As<IWorkContextAccessor>();
|
||||||
builder.RegisterInstance(new SimpleShapes()).WithMetadata("Feature", testFeature);
|
builder.RegisterInstance(new SimpleShapes()).WithMetadata("Feature", testFeature);
|
||||||
@@ -72,7 +71,7 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
[Test]
|
[Test]
|
||||||
public void RenderingSomething() {
|
public void RenderingSomething() {
|
||||||
dynamic displayHelperFactory = _container.Resolve<IDisplayHelperFactory>().CreateHelper(new ViewContext(), null);
|
dynamic displayHelperFactory = _container.Resolve<IDisplayHelperFactory>().CreateHelper(new ViewContext(), null);
|
||||||
dynamic shapeHelperFactory = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
dynamic shapeHelperFactory = _container.Resolve<IShapeFactory>();
|
||||||
|
|
||||||
var result1 = displayHelperFactory.Something();
|
var result1 = displayHelperFactory.Something();
|
||||||
var result2 = ((DisplayHelper)displayHelperFactory).ShapeExecute((Shape)shapeHelperFactory.Pager());
|
var result2 = ((DisplayHelper)displayHelperFactory).ShapeExecute((Shape)shapeHelperFactory.Pager());
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
IContentDefinitionManager contentDefinitionManager,
|
IContentDefinitionManager contentDefinitionManager,
|
||||||
ITransactionManager transactionManager,
|
ITransactionManager transactionManager,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_contentDefinitionManager = contentDefinitionManager;
|
_contentDefinitionManager = contentDefinitionManager;
|
||||||
_transactionManager = transactionManager;
|
_transactionManager = transactionManager;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
public class ItemController : Controller {
|
public class ItemController : Controller {
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
|
|
||||||
public ItemController(IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
public ItemController(IContentManager contentManager, IShapeFactory shapeFactory) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -9,10 +9,13 @@ namespace Orchard.Core.Feeds.Services {
|
|||||||
private readonly IFeedManager _feedManager;
|
private readonly IFeedManager _feedManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
|
|
||||||
public FeedFilter(IFeedManager feedManager, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public FeedFilter(
|
||||||
|
IFeedManager feedManager,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_feedManager = feedManager;
|
_feedManager = feedManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ namespace Orchard.Core.Localization.Controllers {
|
|||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
ICultureManager cultureManager,
|
ICultureManager cultureManager,
|
||||||
ILocalizationService localizationService,
|
ILocalizationService localizationService,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_cultureManager = cultureManager;
|
_cultureManager = cultureManager;
|
||||||
_localizationService = localizationService;
|
_localizationService = localizationService;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ namespace Orchard.Core.Navigation.Controllers {
|
|||||||
IMenuService menuService,
|
IMenuService menuService,
|
||||||
IOrchardServices services,
|
IOrchardServices services,
|
||||||
INavigationManager navigationManager,
|
INavigationManager navigationManager,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
_menuService = menuService;
|
_menuService = menuService;
|
||||||
_services = services;
|
_services = services;
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ namespace Orchard.Core.Reports.Controllers {
|
|||||||
public class AdminController : Controller {
|
public class AdminController : Controller {
|
||||||
private readonly IReportsManager _reportsManager;
|
private readonly IReportsManager _reportsManager;
|
||||||
|
|
||||||
public AdminController(IReportsManager reportsManager, IShapeHelperFactory shapeHelperFactory) {
|
public AdminController(IReportsManager reportsManager) {
|
||||||
_reportsManager = reportsManager;
|
_reportsManager = reportsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() };
|
var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() };
|
||||||
|
|||||||
@@ -16,11 +16,15 @@ namespace Orchard.Core.Routable.Controllers {
|
|||||||
private readonly ITransactionManager _transactionManager;
|
private readonly ITransactionManager _transactionManager;
|
||||||
private readonly IRoutablePathConstraint _routablePathConstraint;
|
private readonly IRoutablePathConstraint _routablePathConstraint;
|
||||||
|
|
||||||
public ItemController(IContentManager contentManager, ITransactionManager transactionManager, IRoutablePathConstraint routablePathConstraint, IShapeHelperFactory shapeHelperFactory) {
|
public ItemController(
|
||||||
|
IContentManager contentManager,
|
||||||
|
ITransactionManager transactionManager,
|
||||||
|
IRoutablePathConstraint routablePathConstraint,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_transactionManager = transactionManager;
|
_transactionManager = transactionManager;
|
||||||
_routablePathConstraint = routablePathConstraint;
|
_routablePathConstraint = routablePathConstraint;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -12,11 +12,14 @@ namespace Orchard.Core.Routable.Services {
|
|||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
public const string Name = "RoutableHomePageProvider";
|
public const string Name = "RoutableHomePageProvider";
|
||||||
|
|
||||||
public RoutableHomePageProvider(IOrchardServices services, IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
public RoutableHomePageProvider(
|
||||||
|
IOrchardServices services,
|
||||||
|
IContentManager contentManager,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
Services = services;
|
Services = services;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -21,15 +21,13 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
public AdminController(
|
public AdminController(
|
||||||
ISiteService siteService,
|
ISiteService siteService,
|
||||||
IOrchardServices services,
|
IOrchardServices services,
|
||||||
ICultureManager cultureManager,
|
ICultureManager cultureManager) {
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
|
||||||
_siteService = siteService;
|
_siteService = siteService;
|
||||||
_cultureManager = cultureManager;
|
_cultureManager = cultureManager;
|
||||||
Services = services;
|
Services = services;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
public ActionResult Index(string tabName) {
|
public ActionResult Index(string tabName) {
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
private readonly ITransactionManager _transactionManager;
|
private readonly ITransactionManager _transactionManager;
|
||||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||||
|
|
||||||
public BlogAdminController(IOrchardServices services,
|
public BlogAdminController(
|
||||||
|
IOrchardServices services,
|
||||||
IBlogService blogService,
|
IBlogService blogService,
|
||||||
IBlogPostService blogPostService,
|
IBlogPostService blogPostService,
|
||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
ITransactionManager transactionManager,
|
ITransactionManager transactionManager,
|
||||||
IBlogSlugConstraint blogSlugConstraint,
|
IBlogSlugConstraint blogSlugConstraint) {
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
|
||||||
Services = services;
|
Services = services;
|
||||||
_blogService = blogService;
|
_blogService = blogService;
|
||||||
_blogPostService = blogPostService;
|
_blogPostService = blogPostService;
|
||||||
@@ -35,10 +35,8 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
_transactionManager = transactionManager;
|
_transactionManager = transactionManager;
|
||||||
_blogSlugConstraint = blogSlugConstraint;
|
_blogSlugConstraint = blogSlugConstraint;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
|
||||||
@@ -123,7 +121,7 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult List() {
|
public ActionResult List() {
|
||||||
var list = Shape.List();
|
var list = Services.New.List();
|
||||||
list.AddRange(_blogService.Get()
|
list.AddRange(_blogService.Get()
|
||||||
.Select(b => {
|
.Select(b => {
|
||||||
var blog = Services.ContentManager.BuildDisplay(b, "SummaryAdmin");
|
var blog = Services.ContentManager.BuildDisplay(b, "SummaryAdmin");
|
||||||
@@ -131,7 +129,7 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
return blog;
|
return blog;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var viewModel = Shape.ViewModel()
|
var viewModel = Services.New.ViewModel()
|
||||||
.ContentItems(list);
|
.ContentItems(list);
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
|
|||||||
@@ -20,14 +20,20 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||||
private readonly RouteCollection _routeCollection;
|
private readonly RouteCollection _routeCollection;
|
||||||
|
|
||||||
public BlogController(IOrchardServices services, IBlogService blogService, IBlogPostService blogPostService, IBlogSlugConstraint blogSlugConstraint, RouteCollection routeCollection, IShapeHelperFactory shapeHelperFactory) {
|
public BlogController(
|
||||||
|
IOrchardServices services,
|
||||||
|
IBlogService blogService,
|
||||||
|
IBlogPostService blogPostService,
|
||||||
|
IBlogSlugConstraint blogSlugConstraint,
|
||||||
|
RouteCollection routeCollection,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_services = services;
|
_services = services;
|
||||||
_blogService = blogService;
|
_blogService = blogService;
|
||||||
_blogPostService = blogPostService;
|
_blogPostService = blogPostService;
|
||||||
_blogSlugConstraint = blogSlugConstraint;
|
_blogSlugConstraint = blogSlugConstraint;
|
||||||
_routeCollection = routeCollection;
|
_routeCollection = routeCollection;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
IBlogService blogService,
|
IBlogService blogService,
|
||||||
IBlogPostService blogPostService,
|
IBlogPostService blogPostService,
|
||||||
IFeedManager feedManager,
|
IFeedManager feedManager,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
_services = services;
|
_services = services;
|
||||||
_blogService = blogService;
|
_blogService = blogService;
|
||||||
_blogPostService = blogPostService;
|
_blogPostService = blogPostService;
|
||||||
_feedManager = feedManager;
|
_feedManager = feedManager;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -18,16 +18,19 @@ namespace Orchard.Blogs.Drivers {
|
|||||||
private readonly IBlogPostService _blogPostService;
|
private readonly IBlogPostService _blogPostService;
|
||||||
private readonly IFeedManager _feedManager;
|
private readonly IFeedManager _feedManager;
|
||||||
|
|
||||||
public BlogPartDriver(IOrchardServices services, IContentManager contentManager, IBlogPostService blogPostService, IFeedManager feedManager, IShapeHelperFactory shapeHelperFactory) {
|
public BlogPartDriver(
|
||||||
|
IOrchardServices services,
|
||||||
|
IContentManager contentManager,
|
||||||
|
IBlogPostService blogPostService,
|
||||||
|
IFeedManager feedManager) {
|
||||||
Services = services;
|
Services = services;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_blogPostService = blogPostService;
|
_blogPostService = blogPostService;
|
||||||
_feedManager = feedManager;
|
_feedManager = feedManager;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
protected override string Prefix { get { return ""; } }
|
protected override string Prefix { get { return ""; } }
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ namespace Orchard.Experimental.Controllers {
|
|||||||
public ContentController(
|
public ContentController(
|
||||||
IRepository<ContentTypeRecord> contentTypeRepository,
|
IRepository<ContentTypeRecord> contentTypeRepository,
|
||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
_contentTypeRepository = contentTypeRepository;
|
_contentTypeRepository = contentTypeRepository;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ namespace Orchard.Experimental.Controllers {
|
|||||||
public class HomeController : Controller {
|
public class HomeController : Controller {
|
||||||
private readonly INotifier _notifier;
|
private readonly INotifier _notifier;
|
||||||
|
|
||||||
public HomeController(INotifier notifier, IShapeHelperFactory shapeHelperFactory) {
|
public HomeController(INotifier notifier, IShapeFactory shapeFactory) {
|
||||||
_notifier = notifier;
|
_notifier = notifier;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ namespace Orchard.Setup {
|
|||||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
|
||||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||||
|
|
||||||
builder.RegisterType<ThemeAwareViewEngine>().As<IThemeAwareViewEngine>();
|
builder.RegisterType<ThemeAwareViewEngine>().As<IThemeAwareViewEngine>();
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ namespace Orchard.Tags.Controllers {
|
|||||||
public class HomeController : Controller {
|
public class HomeController : Controller {
|
||||||
private readonly ITagService _tagService;
|
private readonly ITagService _tagService;
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public HomeController(ITagService tagService, IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
public HomeController(
|
||||||
|
ITagService tagService,
|
||||||
|
IContentManager contentManager,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_tagService = tagService;
|
_tagService = tagService;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
_shapeFactory = shapeFactory;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,8 +47,7 @@ namespace Orchard.Tags.Controllers {
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
var shape = _shapeHelperFactory.CreateHelper();
|
var list = _shapeFactory.List();
|
||||||
var list = shape.List();
|
|
||||||
foreach (var taggedContentItem in _tagService.GetTaggedContentItems(tag.Id)) {
|
foreach (var taggedContentItem in _tagService.GetTaggedContentItems(tag.Id)) {
|
||||||
list.Add(_contentManager.BuildDisplay(taggedContentItem, "Summary"));
|
list.Add(_contentManager.BuildDisplay(taggedContentItem, "Summary"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ namespace Orchard.Themes.Controllers {
|
|||||||
IThemeService themeService,
|
IThemeService themeService,
|
||||||
IPreviewTheme previewTheme,
|
IPreviewTheme previewTheme,
|
||||||
IAuthorizer authorizer,
|
IAuthorizer authorizer,
|
||||||
INotifier notifier,
|
INotifier notifier) {
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
|
||||||
Services = services;
|
Services = services;
|
||||||
_dataMigrationManager = dataMigraitonManager;
|
_dataMigrationManager = dataMigraitonManager;
|
||||||
_reportsCoordinator = reportsCoordinator;
|
_reportsCoordinator = reportsCoordinator;
|
||||||
@@ -36,7 +35,6 @@ namespace Orchard.Themes.Controllers {
|
|||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
|
||||||
public IOrchardServices Services{ get; set; }
|
public IOrchardServices Services{ get; set; }
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,17 @@ namespace Orchard.Themes.Preview {
|
|||||||
private readonly IThemeService _themeService;
|
private readonly IThemeService _themeService;
|
||||||
private readonly IPreviewTheme _previewTheme;
|
private readonly IPreviewTheme _previewTheme;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public PreviewThemeFilter(IThemeService themeService, IPreviewTheme previewTheme, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public PreviewThemeFilter(
|
||||||
|
IThemeService themeService,
|
||||||
|
IPreviewTheme previewTheme,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_themeService = themeService;
|
_themeService = themeService;
|
||||||
_previewTheme = previewTheme;
|
_previewTheme = previewTheme;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
_shapeFactory = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
@@ -33,8 +37,8 @@ namespace Orchard.Themes.Preview {
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
var shape = _shapeHelperFactory.CreateHelper();
|
|
||||||
_workContextAccessor.GetContext(filterContext).Layout.Zones["Body"].Add(shape.ThemePreview(Themes: themeListItems), ":before");
|
_workContextAccessor.GetContext(filterContext).Layout.Zones["Body"].Add(_shapeFactory.ThemePreview(Themes: themeListItems), ":before");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuted(ResultExecutedContext filterContext) { }
|
public void OnResultExecuted(ResultExecutedContext filterContext) { }
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ namespace Orchard.Users.Controllers {
|
|||||||
IOrchardServices services,
|
IOrchardServices services,
|
||||||
IMembershipService membershipService,
|
IMembershipService membershipService,
|
||||||
IUserService userService,
|
IUserService userService,
|
||||||
IShapeHelperFactory shapeHelperFactory) {
|
IShapeFactory shapeFactory) {
|
||||||
Services = services;
|
Services = services;
|
||||||
_membershipService = membershipService;
|
_membershipService = membershipService;
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
Shape = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic Shape { get; set; }
|
dynamic Shape { get; set; }
|
||||||
|
|||||||
@@ -128,10 +128,6 @@
|
|||||||
<None Include="Themes\Classic\Placement.info">
|
<None Include="Themes\Classic\Placement.info">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<Content Include="Themes\Contoso\Styles\search.css" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Footer.html" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\Orchard.Search\Search\Index.ascx" />
|
|
||||||
<Content Include="Themes\TheAdmin\Scripts\admin.js" />
|
<Content Include="Themes\TheAdmin\Scripts\admin.js" />
|
||||||
<Content Include="Themes\TheAdmin\Styles\ie.css" />
|
<Content Include="Themes\TheAdmin\Styles\ie.css" />
|
||||||
<Content Include="Themes\TheAdmin\Styles\images\menuClosed.gif" />
|
<Content Include="Themes\TheAdmin\Styles\images\menuClosed.gif" />
|
||||||
@@ -176,16 +172,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Config\Sample.Host.config" />
|
<Content Include="Config\Sample.Host.config" />
|
||||||
<Content Include="Themes\ClassicDark\Views\Footer.cshtml" />
|
|
||||||
<Content Include="Themes\ClassicDark\Views\Layout.cshtml" />
|
|
||||||
<None Include="Themes\TheAdmin\Styles\images\icons.psd" />
|
<None Include="Themes\TheAdmin\Styles\images\icons.psd" />
|
||||||
<Content Include="Themes\ClassicDark\Content\Images\bodyBackgroundgrey.gif" />
|
|
||||||
<Content Include="Themes\ClassicDark\Content\Images\sidebarBackground.gif" />
|
|
||||||
<Content Include="Themes\ClassicDark\Styles\blog.css" />
|
|
||||||
<Content Include="Themes\ClassicDark\Styles\site.css" />
|
|
||||||
<Content Include="Themes\ClassicDark\Theme.png" />
|
|
||||||
<Content Include="Themes\ClassicDark\Theme.txt" />
|
|
||||||
<Content Include="Themes\ClassicDark\Zones\Sidebar.html" />
|
|
||||||
<Content Include="Themes\Classic\Content\Images\sidebarBackground.gif" />
|
<Content Include="Themes\Classic\Content\Images\sidebarBackground.gif" />
|
||||||
<Content Include="Themes\Classic\Zones\Sidebar.html" />
|
<Content Include="Themes\Classic\Zones\Sidebar.html" />
|
||||||
<Content Include="Themes\Classic\Styles\blog.css" />
|
<Content Include="Themes\Classic\Styles\blog.css" />
|
||||||
@@ -194,111 +181,6 @@
|
|||||||
<Content Include="Themes\Classic\Theme.txt" />
|
<Content Include="Themes\Classic\Theme.txt" />
|
||||||
<Content Include="Themes\Classic\Views\Footer.cshtml" />
|
<Content Include="Themes\Classic\Views\Footer.cshtml" />
|
||||||
<Content Include="Themes\Classic\Views\Layout.cshtml" />
|
<Content Include="Themes\Classic\Views\Layout.cshtml" />
|
||||||
<Content Include="Themes\Contoso\Content\Images\bkg.jpg" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\comment-arrow.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\content-bkg.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\content-bottom.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\content-top.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\feature-bkg-bottom.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\feature-bkg-top.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\Gallery\feature01.jpg" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\Gallery\feature02.jpg" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\Gallery\feature03.jpg" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\icon-location.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\menu-divider.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\menu-hover-left.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\menu-hover.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\menu-left.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\menu-right.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\nav-arrow-left.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\nav-arrow-right.png" />
|
|
||||||
<Content Include="Themes\Contoso\Content\Images\sub-header.png" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Sidebar-w2.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Sidebar-w3.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Highlights.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Home-Headline.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Home-Hero-Gallery.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Home-Hero.html" />
|
|
||||||
<Content Include="Themes\Contoso\Zones\Sidebar-w1.html" />
|
|
||||||
<Content Include="Themes\Contoso\Scripts\easySlider.js" />
|
|
||||||
<Content Include="Themes\Contoso\Styles\site.css" />
|
|
||||||
<Content Include="Themes\Contoso\Theme.png" />
|
|
||||||
<Content Include="Themes\Contoso\Theme.txt" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\bkg.jpg" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\consult-bkg.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\content-bkg.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\content-bottom.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\content-top.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\footer-bkg.jpg" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\footer-bkg.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\hm-divider.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\hm-header.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\icons\icon-5.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\icons\icon-4.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\icons\icon-3.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\icons\icon-2.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\icons\icon-1.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\jumping-people.jpg" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\logo.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\menu-left-over.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\menu-left.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\menu-right-over.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\menu-right.png" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\menu_bkg.jpg" />
|
|
||||||
<Content Include="Themes\Corporate\Content\Images\notepad.png" />
|
|
||||||
<Content Include="Themes\Corporate\Scripts\easySlider.js" />
|
|
||||||
<Content Include="Themes\Corporate\Styles\site.css" />
|
|
||||||
<Content Include="Themes\Corporate\Theme.png" />
|
|
||||||
<Content Include="Themes\Corporate\Theme.txt" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ListByArchive.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Comments.Comments.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Common.Metadata.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Tags.ShowTags.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\Footer.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\Header.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\Layout.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\Layout.HomePage.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\ListOfComments.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\LogOn.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Views\User.ascx" />
|
|
||||||
<Content Include="Themes\Corporate\Zones\Home-Headline.html" />
|
|
||||||
<Content Include="Themes\Corporate\Zones\Home-Hero.html" />
|
|
||||||
<Content Include="Themes\Corporate\Zones\Sidebar-w1.html" />
|
|
||||||
<Content Include="Themes\Corporate\Zones\Sidebar-w2.html" />
|
|
||||||
<Content Include="Themes\Corporate\Zones\Sidebar-w3.html" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\bodyBackground.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\bodyBackground.png" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\commentpointer.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\logo.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\logo.png" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\tabLeftOff.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\tabLeftOn.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\tabRightOff.gif" />
|
|
||||||
<Content Include="Themes\Green\Content\Images\tabRightOn.gif" />
|
|
||||||
<Content Include="Themes\Green\Views\Archives.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
|
|
||||||
<Content Include="Themes\Green\Zones\sideBarZone1.html" />
|
|
||||||
<Content Include="Themes\Green\Zones\sideBarZone2.html" />
|
|
||||||
<Content Include="Themes\Green\Zones\User2.html" />
|
|
||||||
<Content Include="Themes\Green\Zones\User3.html" />
|
|
||||||
<Content Include="Themes\Green\Zones\User1.html" />
|
|
||||||
<Content Include="Themes\Green\Styles\blog.css" />
|
|
||||||
<Content Include="Themes\Green\Styles\site.css" />
|
|
||||||
<Content Include="Themes\Green\Styles\yui.css" />
|
|
||||||
<Content Include="Themes\Green\Theme.png" />
|
|
||||||
<Content Include="Themes\Green\Theme.txt" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Parts\Common.Metadata.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\Layout.HomePage.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\Footer.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\Layout.ascx" />
|
|
||||||
<Content Include="Themes\Green\Views\ListOfComments.ascx" />
|
|
||||||
<Content Include="Themes\SafeMode\Content\orchard.ico" />
|
<Content Include="Themes\SafeMode\Content\orchard.ico" />
|
||||||
<Content Include="Themes\SafeMode\Styles\ie6.css" />
|
<Content Include="Themes\SafeMode\Styles\ie6.css" />
|
||||||
<Content Include="Themes\SafeMode\Styles\images\backgroundHeader.gif" />
|
<Content Include="Themes\SafeMode\Styles\images\backgroundHeader.gif" />
|
||||||
@@ -322,7 +204,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
<Folder Include="Themes\ClassicDark\DesignerNotes\" />
|
|
||||||
<Folder Include="Themes\SafeMode\Content\Images\" />
|
<Folder Include="Themes\SafeMode\Content\Images\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ using Orchard.UI.Zones;
|
|||||||
namespace Orchard.ContentManagement {
|
namespace Orchard.ContentManagement {
|
||||||
public class DefaultContentDisplay : IContentDisplay {
|
public class DefaultContentDisplay : IContentDisplay {
|
||||||
private readonly Lazy<IEnumerable<IContentHandler>> _handlers;
|
private readonly Lazy<IEnumerable<IContentHandler>> _handlers;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
|
||||||
private readonly IShapeFactory _shapeFactory;
|
private readonly IShapeFactory _shapeFactory;
|
||||||
private readonly IShapeTableManager _shapeTableManager;
|
private readonly IShapeTableManager _shapeTableManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
@@ -27,7 +26,6 @@ namespace Orchard.ContentManagement {
|
|||||||
|
|
||||||
public DefaultContentDisplay(
|
public DefaultContentDisplay(
|
||||||
Lazy<IEnumerable<IContentHandler>> handlers,
|
Lazy<IEnumerable<IContentHandler>> handlers,
|
||||||
IShapeHelperFactory shapeHelperFactory,
|
|
||||||
IShapeFactory shapeFactory,
|
IShapeFactory shapeFactory,
|
||||||
IShapeTableManager shapeTableManager,
|
IShapeTableManager shapeTableManager,
|
||||||
IWorkContextAccessor workContextAccessor,
|
IWorkContextAccessor workContextAccessor,
|
||||||
@@ -35,7 +33,6 @@ namespace Orchard.ContentManagement {
|
|||||||
Lazy<IThemeService> themeService,
|
Lazy<IThemeService> themeService,
|
||||||
RequestContext requestContext) {
|
RequestContext requestContext) {
|
||||||
_handlers = handlers;
|
_handlers = handlers;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
|
||||||
_shapeFactory = shapeFactory;
|
_shapeFactory = shapeFactory;
|
||||||
_shapeTableManager = shapeTableManager;
|
_shapeTableManager = shapeTableManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
@@ -68,7 +65,7 @@ namespace Orchard.ContentManagement {
|
|||||||
itemShape.ContentItem = content.ContentItem;
|
itemShape.ContentItem = content.ContentItem;
|
||||||
itemShape.Metadata.DisplayType = actualDisplayType;
|
itemShape.Metadata.DisplayType = actualDisplayType;
|
||||||
|
|
||||||
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, _shapeHelperFactory);
|
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, _shapeFactory);
|
||||||
BindPlacement(context, actualDisplayType);
|
BindPlacement(context, actualDisplayType);
|
||||||
|
|
||||||
_handlers.Value.Invoke(handler => handler.BuildDisplay(context), Logger);
|
_handlers.Value.Invoke(handler => handler.BuildDisplay(context), Logger);
|
||||||
@@ -86,7 +83,7 @@ namespace Orchard.ContentManagement {
|
|||||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||||
itemShape.ContentItem = content.ContentItem;
|
itemShape.ContentItem = content.ContentItem;
|
||||||
|
|
||||||
var context = new BuildEditorContext(itemShape, content, _shapeHelperFactory);
|
var context = new BuildEditorContext(itemShape, content, _shapeFactory);
|
||||||
BindPlacement(context, null);
|
BindPlacement(context, null);
|
||||||
|
|
||||||
_handlers.Value.Invoke(handler => handler.BuildEditor(context), Logger);
|
_handlers.Value.Invoke(handler => handler.BuildEditor(context), Logger);
|
||||||
@@ -104,7 +101,7 @@ namespace Orchard.ContentManagement {
|
|||||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||||
itemShape.ContentItem = content.ContentItem;
|
itemShape.ContentItem = content.ContentItem;
|
||||||
|
|
||||||
var context = new UpdateEditorContext(itemShape, content, updater, _shapeHelperFactory);
|
var context = new UpdateEditorContext(itemShape, content, updater, _shapeFactory);
|
||||||
BindPlacement(context, null);
|
BindPlacement(context, null);
|
||||||
|
|
||||||
_handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);
|
_handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);
|
||||||
|
|||||||
@@ -30,19 +30,33 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
|
|
||||||
[Obsolete("Provided while transitioning to factory variations")]
|
[Obsolete("Provided while transitioning to factory variations")]
|
||||||
public ContentShapeResult ContentShape(IShape shape) {
|
public ContentShapeResult ContentShape(IShape shape) {
|
||||||
return ContentShapeImplementation(shape.Metadata.Type, Zone, () => shape);
|
return ContentShapeImplementation(shape.Metadata.Type, Zone, ctx => shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentShapeResult ContentShape(string shapeType, Func<dynamic> factory) {
|
public ContentShapeResult ContentShape(string shapeType, Func<dynamic> factory) {
|
||||||
return ContentShapeImplementation(shapeType, null, factory);
|
return ContentShapeImplementation(shapeType, null, ctx => factory());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic> factory) {
|
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic> factory) {
|
||||||
|
return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentShapeResult ContentShape(string shapeType, Func<dynamic, dynamic> factory) {
|
||||||
|
return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic, dynamic> factory) {
|
||||||
return ContentShapeImplementation(shapeType, defaultLocation, factory);
|
return ContentShapeImplementation(shapeType, defaultLocation, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<object> factory) {
|
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<BuildShapeContext, object> shapeBuilder) {
|
||||||
return new ContentShapeResult(shapeType, Prefix, factory).Location(defaultLocation);
|
return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object CreateShape(BuildShapeContext context, string shapeType) {
|
||||||
|
IShapeFactory shapeFactory = context.New;
|
||||||
|
return shapeFactory.Create(shapeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
private string _defaultLocation;
|
private string _defaultLocation;
|
||||||
private readonly string _shapeType;
|
private readonly string _shapeType;
|
||||||
private readonly string _prefix;
|
private readonly string _prefix;
|
||||||
private readonly Func<dynamic> _shapeBuilder;
|
private readonly Func<BuildShapeContext, dynamic> _shapeBuilder;
|
||||||
|
|
||||||
public ContentShapeResult(string shapeType, string prefix, Func<dynamic> shapeBuilder) {
|
public ContentShapeResult(string shapeType, string prefix, Func<BuildShapeContext, dynamic> shapeBuilder) {
|
||||||
_shapeType = shapeType;
|
_shapeType = shapeType;
|
||||||
_prefix = prefix;
|
_prefix = prefix;
|
||||||
_shapeBuilder = shapeBuilder;
|
_shapeBuilder = shapeBuilder;
|
||||||
@@ -30,18 +30,19 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dynamic parentShape = context.Shape;
|
dynamic parentShape = context.Shape;
|
||||||
IShape contentShape = _shapeBuilder();
|
var newShape = _shapeBuilder(context);
|
||||||
contentShape.Metadata.Prefix = _prefix;
|
ShapeMetadata newShapeMetadata = newShape.Metadata;
|
||||||
contentShape.Metadata.DisplayType = displayType;
|
newShapeMetadata.Prefix = _prefix;
|
||||||
|
newShapeMetadata.DisplayType = displayType;
|
||||||
|
|
||||||
var delimiterIndex = location.IndexOf(':');
|
var delimiterIndex = location.IndexOf(':');
|
||||||
if (delimiterIndex < 0) {
|
if (delimiterIndex < 0) {
|
||||||
parentShape.Zones[location].Add(contentShape);
|
parentShape.Zones[location].Add(newShape);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var zoneName = location.Substring(0, delimiterIndex);
|
var zoneName = location.Substring(0, delimiterIndex);
|
||||||
var position = location.Substring(delimiterIndex + 1);
|
var position = location.Substring(delimiterIndex + 1);
|
||||||
parentShape.Zones[zoneName].Add(contentShape, position);
|
parentShape.Zones[zoneName].Add(newShape, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ using Orchard.DisplayManagement;
|
|||||||
|
|
||||||
namespace Orchard.ContentManagement.Handlers {
|
namespace Orchard.ContentManagement.Handlers {
|
||||||
public class BuildDisplayContext : BuildShapeContext {
|
public class BuildDisplayContext : BuildShapeContext {
|
||||||
public BuildDisplayContext(IShape model, IContent content, string displayType, IShapeHelperFactory shapeHelperFactory)
|
public BuildDisplayContext(IShape model, IContent content, string displayType, IShapeFactory shapeFactory)
|
||||||
: base(model, content, shapeHelperFactory) {
|
: base(model, content, shapeFactory) {
|
||||||
DisplayType = displayType;
|
DisplayType = displayType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using Orchard.DisplayManagement;
|
|||||||
|
|
||||||
namespace Orchard.ContentManagement.Handlers {
|
namespace Orchard.ContentManagement.Handlers {
|
||||||
public class BuildEditorContext : BuildShapeContext {
|
public class BuildEditorContext : BuildShapeContext {
|
||||||
public BuildEditorContext(IShape model, IContent content, IShapeHelperFactory shapeHelperFactory)
|
public BuildEditorContext(IShape model, IContent content, IShapeFactory shapeFactory)
|
||||||
: base(model, content, shapeHelperFactory) {
|
: base(model, content, shapeFactory) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,10 @@ using Orchard.DisplayManagement;
|
|||||||
|
|
||||||
namespace Orchard.ContentManagement.Handlers {
|
namespace Orchard.ContentManagement.Handlers {
|
||||||
public class BuildShapeContext {
|
public class BuildShapeContext {
|
||||||
protected BuildShapeContext(IShape shape, IContent content, IShapeHelperFactory shapeHelperFactory) {
|
protected BuildShapeContext(IShape shape, IContent content, IShapeFactory shapeFactory) {
|
||||||
Shape = shape;
|
Shape = shape;
|
||||||
ContentItem = content.ContentItem;
|
ContentItem = content.ContentItem;
|
||||||
New = shapeHelperFactory.CreateHelper();
|
New = shapeFactory;
|
||||||
FindPlacement = (partType, defaultLocation) => defaultLocation;
|
FindPlacement = (partType, defaultLocation) => defaultLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ using Orchard.DisplayManagement;
|
|||||||
|
|
||||||
namespace Orchard.ContentManagement.Handlers {
|
namespace Orchard.ContentManagement.Handlers {
|
||||||
public class UpdateEditorContext : BuildEditorContext {
|
public class UpdateEditorContext : BuildEditorContext {
|
||||||
public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, IShapeHelperFactory shapeHelperFactory)
|
public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, IShapeFactory shapeFactory)
|
||||||
: base(model, content, shapeHelperFactory) {
|
: base(model, content, shapeFactory) {
|
||||||
Updater = updater;
|
Updater = updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
namespace Orchard.DisplayManagement {
|
|
||||||
public interface IShapeHelperFactory : IDependency {
|
|
||||||
dynamic CreateHelper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,21 +7,21 @@ using Orchard.DisplayManagement.Shapes;
|
|||||||
|
|
||||||
namespace Orchard.DisplayManagement.Implementation {
|
namespace Orchard.DisplayManagement.Implementation {
|
||||||
|
|
||||||
|
public class DefaultShapeFactory : Clay, IShapeFactory {
|
||||||
|
|
||||||
|
|
||||||
public class DefaultShapeFactory : IShapeFactory {
|
|
||||||
private readonly IEnumerable<Lazy<IShapeFactoryEvents>> _events;
|
private readonly IEnumerable<Lazy<IShapeFactoryEvents>> _events;
|
||||||
private readonly IShapeTableManager _shapeTableManager;
|
private readonly IShapeTableManager _shapeTableManager;
|
||||||
private readonly Lazy<IShapeHelperFactory> _shapeHelperFactory;
|
|
||||||
|
|
||||||
public DefaultShapeFactory(
|
public DefaultShapeFactory(
|
||||||
IEnumerable<Lazy<IShapeFactoryEvents>> events,
|
IEnumerable<Lazy<IShapeFactoryEvents>> events,
|
||||||
IShapeTableManager shapeTableManager,
|
IShapeTableManager shapeTableManager) : base(new ShapeFactoryBehavior()) {
|
||||||
Lazy<IShapeHelperFactory> shapeHelperFactory) {
|
|
||||||
_events = events;
|
_events = events;
|
||||||
_shapeTableManager = shapeTableManager;
|
_shapeTableManager = shapeTableManager;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
}
|
||||||
|
|
||||||
|
class ShapeFactoryBehavior : ClayBehavior {
|
||||||
|
public override object InvokeMember(Func<object> proceed, object target, string name, INamedEnumerable<object> args) {
|
||||||
|
return ((DefaultShapeFactory)target).Create(name, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IShape Create(string shapeType, INamedEnumerable<object> parameters) {
|
public IShape Create(string shapeType, INamedEnumerable<object> parameters) {
|
||||||
@@ -34,7 +34,7 @@ namespace Orchard.DisplayManagement.Implementation {
|
|||||||
defaultShapeTable.Descriptors.TryGetValue(shapeType, out shapeDescriptor);
|
defaultShapeTable.Descriptors.TryGetValue(shapeType, out shapeDescriptor);
|
||||||
|
|
||||||
var creatingContext = new ShapeCreatingContext {
|
var creatingContext = new ShapeCreatingContext {
|
||||||
New = _shapeHelperFactory.Value.CreateHelper(),
|
New = this,
|
||||||
ShapeFactory = this,
|
ShapeFactory = this,
|
||||||
ShapeType = shapeType,
|
ShapeType = shapeType,
|
||||||
OnCreated = new List<Action<ShapeCreatedContext>>()
|
OnCreated = new List<Action<ShapeCreatedContext>>()
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
using ClaySharp;
|
|
||||||
|
|
||||||
namespace Orchard.DisplayManagement.Implementation {
|
|
||||||
public class ShapeHelper {
|
|
||||||
private readonly IShapeFactory _shapeFactory;
|
|
||||||
|
|
||||||
public ShapeHelper(IShapeFactory shapeFactory) {
|
|
||||||
_shapeFactory = shapeFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IShape CreateShapeType(string shapeType, INamedEnumerable<object> parameters) {
|
|
||||||
return _shapeFactory.Create(shapeType, parameters);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using ClaySharp;
|
|
||||||
|
|
||||||
namespace Orchard.DisplayManagement.Implementation {
|
|
||||||
public class ShapeHelperFactory : IShapeHelperFactory {
|
|
||||||
static private readonly ShapeHelperBehavior[] _behaviors = new[] { new ShapeHelperBehavior() };
|
|
||||||
private readonly IShapeFactory _shapeFactory;
|
|
||||||
|
|
||||||
public ShapeHelperFactory(IShapeFactory shapeFactory) {
|
|
||||||
_shapeFactory = shapeFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public dynamic CreateHelper() {
|
|
||||||
return ClayActivator.CreateInstance<ShapeHelper>(
|
|
||||||
_behaviors,
|
|
||||||
_shapeFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
class ShapeHelperBehavior : ClayBehavior {
|
|
||||||
public override object InvokeMember(Func<object> proceed, object target, string name, INamedEnumerable<object> args) {
|
|
||||||
return ((ShapeHelper)target).CreateShapeType(name, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +1,33 @@
|
|||||||
using JetBrains.Annotations;
|
using System;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.Environment {
|
namespace Orchard.Environment {
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class OrchardServices : IOrchardServices {
|
public class OrchardServices : IOrchardServices {
|
||||||
|
private readonly Lazy<IShapeFactory> _shapeFactory;
|
||||||
|
|
||||||
public OrchardServices(
|
public OrchardServices(
|
||||||
IContentManager contentManager,
|
IContentManager contentManager,
|
||||||
ITransactionManager transactionManager,
|
ITransactionManager transactionManager,
|
||||||
IAuthorizer authorizer,
|
IAuthorizer authorizer,
|
||||||
INotifier notifier) {
|
INotifier notifier,
|
||||||
|
Lazy<IShapeFactory> shapeFactory) {
|
||||||
|
_shapeFactory = shapeFactory;
|
||||||
ContentManager = contentManager;
|
ContentManager = contentManager;
|
||||||
TransactionManager = transactionManager;
|
TransactionManager = transactionManager;
|
||||||
Authorizer = authorizer;
|
Authorizer = authorizer;
|
||||||
Notifier = notifier;
|
Notifier = notifier;
|
||||||
}
|
}
|
||||||
public IContentManager ContentManager { get; set; }
|
|
||||||
public ITransactionManager TransactionManager {get;set;}
|
public IContentManager ContentManager { get; private set; }
|
||||||
public IAuthorizer Authorizer { get; set; }
|
public ITransactionManager TransactionManager { get; private set; }
|
||||||
public INotifier Notifier { get; set; }
|
public IAuthorizer Authorizer { get; private set; }
|
||||||
|
public INotifier Notifier { get; private set; }
|
||||||
|
public dynamic New { get { return _shapeFactory.Value; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ namespace Orchard {
|
|||||||
public interface IOrchardServices : IDependency {
|
public interface IOrchardServices : IDependency {
|
||||||
IContentManager ContentManager { get; }
|
IContentManager ContentManager { get; }
|
||||||
ITransactionManager TransactionManager { get; }
|
ITransactionManager TransactionManager { get; }
|
||||||
IAuthorizer Authorizer { get; set; }
|
IAuthorizer Authorizer { get; }
|
||||||
INotifier Notifier { get; }
|
INotifier Notifier { get; }
|
||||||
|
dynamic New { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ using Orchard.DisplayManagement;
|
|||||||
|
|
||||||
namespace Orchard.Mvc.Html {
|
namespace Orchard.Mvc.Html {
|
||||||
public class Shapes : IDependency {
|
public class Shapes : IDependency {
|
||||||
public Shapes(IShapeHelperFactory shapeHelperFactory) {
|
public Shapes(IShapeFactory shapeFactory) {
|
||||||
New = shapeHelperFactory.CreateHelper();
|
New = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic New { get; set; }
|
dynamic New { get; set; }
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
|||||||
public new dynamic Layout { get { return _layout; } }
|
public new dynamic Layout { get { return _layout; } }
|
||||||
public WorkContext WorkContext { get { return _workContext; } }
|
public WorkContext WorkContext { get { return _workContext; } }
|
||||||
|
|
||||||
public dynamic New { get { return _new; } }
|
public dynamic New { get { return ShapeFactory; } }
|
||||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
||||||
public IShapeHelperFactory ShapeHelperFactory { get; set; }
|
public IShapeFactory ShapeFactory { get; set; }
|
||||||
|
|
||||||
public IAuthorizer Authorizer { get; set; }
|
public IAuthorizer Authorizer { get; set; }
|
||||||
|
|
||||||
@@ -78,7 +78,6 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
|||||||
_localizer = LocalizationUtilities.Resolve(ViewContext, VirtualPath);
|
_localizer = LocalizationUtilities.Resolve(ViewContext, VirtualPath);
|
||||||
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
||||||
_layout = _workContext.Layout;
|
_layout = _workContext.Layout;
|
||||||
_new = ShapeHelperFactory.CreateHelper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AuthorizedFor(Permission permission) {
|
public bool AuthorizedFor(Permission permission) {
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ namespace Orchard.Mvc {
|
|||||||
|
|
||||||
public Localizer T { get { return _localizer; } }
|
public Localizer T { get { return _localizer; } }
|
||||||
public dynamic Display { get { return _display; } }
|
public dynamic Display { get { return _display; } }
|
||||||
public dynamic New { get { return _new; } }
|
public dynamic New { get { return ShapeFactory; } }
|
||||||
public dynamic Layout { get { return _layout; } }
|
public dynamic Layout { get { return _layout; } }
|
||||||
public WorkContext WorkContext { get { return _workContext; } }
|
public WorkContext WorkContext { get { return _workContext; } }
|
||||||
|
|
||||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
||||||
public IShapeHelperFactory ShapeHelperFactory { get; set; }
|
public IShapeFactory ShapeFactory { get; set; }
|
||||||
|
|
||||||
public IAuthorizer Authorizer { get; set; }
|
public IAuthorizer Authorizer { get; set; }
|
||||||
|
|
||||||
@@ -75,7 +75,6 @@ namespace Orchard.Mvc {
|
|||||||
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
||||||
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
||||||
_layout = _workContext.Layout;
|
_layout = _workContext.Layout;
|
||||||
_new = ShapeHelperFactory.CreateHelper();
|
|
||||||
|
|
||||||
base.RenderView(viewContext);
|
base.RenderView(viewContext);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -429,7 +429,6 @@
|
|||||||
<Compile Include="DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs" />
|
<Compile Include="DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs" />
|
||||||
<Compile Include="DisplayManagement\Implementation\DefaultDisplayManager.cs" />
|
<Compile Include="DisplayManagement\Implementation\DefaultDisplayManager.cs" />
|
||||||
<Compile Include="DisplayManagement\Implementation\DefaultShapeFactory.cs" />
|
<Compile Include="DisplayManagement\Implementation\DefaultShapeFactory.cs" />
|
||||||
<Compile Include="DisplayManagement\IShapeHelperFactory.cs" />
|
|
||||||
<Compile Include="DisplayManagement\IDisplayHelperFactory.cs" />
|
<Compile Include="DisplayManagement\IDisplayHelperFactory.cs" />
|
||||||
<Compile Include="DisplayManagement\IShape.cs" />
|
<Compile Include="DisplayManagement\IShape.cs" />
|
||||||
<Compile Include="DisplayManagement\Shapes\Shape.cs" />
|
<Compile Include="DisplayManagement\Shapes\Shape.cs" />
|
||||||
@@ -441,8 +440,6 @@
|
|||||||
<Compile Include="DisplayManagement\Implementation\IDisplayManager.cs" />
|
<Compile Include="DisplayManagement\Implementation\IDisplayManager.cs" />
|
||||||
<Compile Include="DisplayManagement\IShapeFactory.cs" />
|
<Compile Include="DisplayManagement\IShapeFactory.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\Interfaces.cs" />
|
<Compile Include="DisplayManagement\Descriptors\Interfaces.cs" />
|
||||||
<Compile Include="DisplayManagement\Implementation\ShapeHelper.cs" />
|
|
||||||
<Compile Include="DisplayManagement\Implementation\ShapeHelperFactory.cs" />
|
|
||||||
<Compile Include="Environment\DefaultWorkContextAccessor.cs" />
|
<Compile Include="Environment\DefaultWorkContextAccessor.cs" />
|
||||||
<Compile Include="Environment\IHostLocalRestart.cs" />
|
<Compile Include="Environment\IHostLocalRestart.cs" />
|
||||||
<Compile Include="Environment\IShellContainerRegistrations.cs" />
|
<Compile Include="Environment\IShellContainerRegistrations.cs" />
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ namespace Orchard.UI.Admin.Notification {
|
|||||||
public class AdminNotificationFilter : FilterProvider, IResultFilter {
|
public class AdminNotificationFilter : FilterProvider, IResultFilter {
|
||||||
private readonly INotificationManager _notificationManager;
|
private readonly INotificationManager _notificationManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public AdminNotificationFilter(INotificationManager notificationManager, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public AdminNotificationFilter(
|
||||||
|
INotificationManager notificationManager,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_notificationManager = notificationManager;
|
_notificationManager = notificationManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
_shapeFactory = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
@@ -27,10 +30,9 @@ namespace Orchard.UI.Admin.Notification {
|
|||||||
if (!messageEntries.Any())
|
if (!messageEntries.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var shape = _shapeHelperFactory.CreateHelper();
|
|
||||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
||||||
foreach(var messageEntry in messageEntries)
|
foreach(var messageEntry in messageEntries)
|
||||||
messagesZone = messagesZone.Add(shape.Message(messageEntry));
|
messagesZone = messagesZone.Add(_shapeFactory.Message(messageEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuted(ResultExecutedContext filterContext) {}
|
public void OnResultExecuted(ResultExecutedContext filterContext) {}
|
||||||
|
|||||||
@@ -9,17 +9,19 @@ namespace Orchard.UI.Navigation {
|
|||||||
public class MenuFilter : FilterProvider, IResultFilter {
|
public class MenuFilter : FilterProvider, IResultFilter {
|
||||||
private readonly INavigationManager _navigationManager;
|
private readonly INavigationManager _navigationManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public MenuFilter(INavigationManager navigationManager, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public MenuFilter(
|
||||||
|
INavigationManager navigationManager,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_navigationManager = navigationManager;
|
_navigationManager = navigationManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
_shapeFactory = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
var workContext = _workContextAccessor.GetContext(filterContext);
|
var workContext = _workContextAccessor.GetContext(filterContext);
|
||||||
var shape = _shapeHelperFactory.CreateHelper();
|
|
||||||
|
|
||||||
var menuName = "main";
|
var menuName = "main";
|
||||||
if (AdminFilter.IsApplied(filterContext.RequestContext))
|
if (AdminFilter.IsApplied(filterContext.RequestContext))
|
||||||
@@ -27,24 +29,24 @@ namespace Orchard.UI.Navigation {
|
|||||||
|
|
||||||
var menuItems = _navigationManager.BuildMenu(menuName);
|
var menuItems = _navigationManager.BuildMenu(menuName);
|
||||||
|
|
||||||
var menuShape = shape.Menu().MenuName(menuName);
|
var menuShape = _shapeFactory.Menu().MenuName(menuName);
|
||||||
PopulateMenu(shape, menuShape, menuItems);
|
PopulateMenu(_shapeFactory, menuShape, menuItems);
|
||||||
|
|
||||||
workContext.Layout.Navigation.Add(menuShape);
|
workContext.Layout.Navigation.Add(menuShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateMenu(dynamic shape, dynamic parentShape, IEnumerable<MenuItem> menuItems) {
|
private void PopulateMenu(dynamic shapeFactory, dynamic parentShape, IEnumerable<MenuItem> menuItems) {
|
||||||
foreach (var menuItem in menuItems) {
|
foreach (var menuItem in menuItems) {
|
||||||
var menuItemShape = shape.MenuItem()
|
var menuItemShape = shapeFactory.MenuItem()
|
||||||
.Text(menuItem.Text)
|
.Text(menuItem.Text)
|
||||||
.Href(menuItem.Href)
|
.Href(menuItem.Href)
|
||||||
.RouteValues(menuItem.RouteValues)
|
.RouteValues(menuItem.RouteValues)
|
||||||
.Item(menuItem)
|
.Item(menuItem)
|
||||||
.Menu(shape)
|
.Menu(shapeFactory)
|
||||||
.Parent(parentShape);
|
.Parent(parentShape);
|
||||||
|
|
||||||
if (menuItem.Items != null && menuItem.Items.Any()) {
|
if (menuItem.Items != null && menuItem.Items.Any()) {
|
||||||
PopulateMenu(shape, menuItemShape, menuItem.Items);
|
PopulateMenu(shapeFactory, menuItemShape, menuItem.Items);
|
||||||
}
|
}
|
||||||
|
|
||||||
parentShape.Add(menuItemShape, menuItem.Position);
|
parentShape.Add(menuItemShape, menuItem.Position);
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ namespace Orchard.UI.Notify {
|
|||||||
private const string TempDataMessages = "messages";
|
private const string TempDataMessages = "messages";
|
||||||
private readonly INotifier _notifier;
|
private readonly INotifier _notifier;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public NotifyFilter(INotifier notifier, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public NotifyFilter(
|
||||||
|
INotifier notifier,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_notifier = notifier;
|
_notifier = notifier;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
_shapeHelperFactory = shapeHelperFactory;
|
_shapeFactory = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||||
@@ -82,10 +85,9 @@ namespace Orchard.UI.Notify {
|
|||||||
if (!messageEntries.Any())
|
if (!messageEntries.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var shape = _shapeHelperFactory.CreateHelper();
|
|
||||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
||||||
foreach(var messageEntry in messageEntries)
|
foreach(var messageEntry in messageEntries)
|
||||||
messagesZone = messagesZone.Add(shape.Message(messageEntry));
|
messagesZone = messagesZone.Add(_shapeFactory.Message(messageEntry));
|
||||||
|
|
||||||
//todo: (heskew) probably need to keep duplicate messages from being pushed into the zone like the previous behavior
|
//todo: (heskew) probably need to keep duplicate messages from being pushed into the zone like the previous behavior
|
||||||
//baseViewModel.Messages = baseViewModel.Messages == null ? messageEntries .Messages.Union(messageEntries).ToList();
|
//baseViewModel.Messages = baseViewModel.Messages == null ? messageEntries .Messages.Union(messageEntries).ToList();
|
||||||
|
|||||||
@@ -7,24 +7,27 @@ namespace Orchard.UI.Resources {
|
|||||||
public class ResourceFilter : FilterProvider, IResultFilter {
|
public class ResourceFilter : FilterProvider, IResultFilter {
|
||||||
private readonly IResourceManager _resourceManager;
|
private readonly IResourceManager _resourceManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
|
private readonly dynamic _shapeFactory;
|
||||||
|
|
||||||
public ResourceFilter(IResourceManager resourceManager, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
public ResourceFilter(
|
||||||
|
IResourceManager resourceManager,
|
||||||
|
IWorkContextAccessor workContextAccessor,
|
||||||
|
IShapeFactory shapeFactory) {
|
||||||
_resourceManager = resourceManager;
|
_resourceManager = resourceManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
Shape = shapeHelperFactory.CreateHelper();
|
_shapeFactory = shapeFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private dynamic Shape { get; set; }
|
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
var ctx = _workContextAccessor.GetContext();
|
var ctx = _workContextAccessor.GetContext();
|
||||||
var head = ctx.Layout.Head;
|
var head = ctx.Layout.Head;
|
||||||
var tail = ctx.Layout.Tail;
|
var tail = ctx.Layout.Tail;
|
||||||
head.Add(Shape.Metas().ResourceManager(_resourceManager));
|
head.Add(_shapeFactory.Metas().ResourceManager(_resourceManager));
|
||||||
head.Add(Shape.HeadLinks().ResourceManager(_resourceManager));
|
head.Add(_shapeFactory.HeadLinks().ResourceManager(_resourceManager));
|
||||||
head.Add(Shape.StylesheetLinks().ResourceManager(_resourceManager));
|
head.Add(_shapeFactory.StylesheetLinks().ResourceManager(_resourceManager));
|
||||||
head.Add(Shape.HeadScripts().ResourceManager(_resourceManager));
|
head.Add(_shapeFactory.HeadScripts().ResourceManager(_resourceManager));
|
||||||
tail.Add(Shape.FootScripts().ResourceManager(_resourceManager));
|
tail.Add(_shapeFactory.FootScripts().ResourceManager(_resourceManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||||
|
|||||||
Reference in New Issue
Block a user