mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -38,7 +38,6 @@ namespace Orchard.Core.Tests.Body {
|
||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
|
||||
builder.RegisterType<ThingHandler>().As<IContentHandler>();
|
||||
|
||||
|
@@ -47,7 +47,6 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
||||
|
@@ -59,6 +59,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</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">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
||||
|
@@ -53,7 +53,6 @@ namespace Orchard.Core.Tests.Routable.Services {
|
||||
builder.RegisterType<RoutablePathConstraint>().As<IRoutablePathConstraint>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
|
||||
builder.RegisterType<DefaultContentQuery>().As<IContentQuery>();
|
||||
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<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
||||
|
@@ -41,7 +41,6 @@ namespace Orchard.Core.Tests.Scheduling {
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
||||
|
@@ -60,6 +60,7 @@
|
||||
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<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">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
|
||||
|
@@ -77,7 +77,6 @@ namespace Orchard.Tests.Modules.Themes.Services {
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<ContentDefinitionManager>().As<IContentDefinitionManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
|
@@ -58,7 +58,6 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
builder.RegisterType<TransactionManager>().As<ITransactionManager>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterInstance(new Mock<INotifier>().Object);
|
||||
builder.RegisterInstance(new Mock<IContentDisplay>().Object);
|
||||
|
@@ -81,7 +81,6 @@ namespace Orchard.Tests.Modules.Users.Services {
|
||||
builder.RegisterType<DefaultMessageManager>().As<IMessageManager>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||
|
||||
|
@@ -85,7 +85,6 @@ namespace Orchard.Tests.Modules.Widgets.Services {
|
||||
builder.RegisterType<OrchardServices>().As<IOrchardServices>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<WidgetsService>().As<IWidgetsService>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
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");
|
||||
}
|
||||
|
||||
[Test, Ignore("Fix when possible")]
|
||||
public void GetLayerWidgetsTest() {
|
||||
[Test, Ignore("Fix when possible")]
|
||||
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 StubLayerPartHandler(IRepository<LayerPartRecord> layersRepository) {
|
||||
|
@@ -63,7 +63,6 @@ namespace Orchard.Tests.ContentManagement {
|
||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
|
||||
|
@@ -73,7 +73,6 @@ namespace Orchard.Tests.ContentManagement {
|
||||
builder.RegisterType<StyledHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
|
||||
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
|
@@ -22,7 +22,6 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
||||
var builder = new ContainerBuilder();
|
||||
//builder.RegisterModule(new ImplicitCollectionSupportModule());
|
||||
builder.RegisterType<ContentPartDriverCoordinator>().As<IContentHandler>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
|
||||
_container = builder.Build();
|
||||
@@ -45,7 +44,7 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
||||
var contentHandler = _container.Resolve<IContentHandler>();
|
||||
|
||||
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());
|
||||
driver2.Verify(x => x.BuildDisplay(context), Times.Never());
|
||||
@@ -61,13 +60,13 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
||||
builder.RegisterInstance(driver).As<IContentPartDriver>();
|
||||
builder.Update(_container);
|
||||
var contentHandler = _container.Resolve<IContentHandler>();
|
||||
var shapeHelperFactory = _container.Resolve<IShapeHelperFactory>();
|
||||
dynamic shapeFactory = _container.Resolve<IShapeFactory>();
|
||||
|
||||
var contentItem = new ContentItem();
|
||||
contentItem.Weld(new StubPart { Foo = new[] { "a", "b", "c" } });
|
||||
|
||||
var ctx = new BuildDisplayContext(null, null, "", null);
|
||||
var context = shapeHelperFactory.CreateHelper().Context(ctx);
|
||||
var context = shapeFactory.Context(ctx);
|
||||
Assert.That(context.TopMeta, Is.Null);
|
||||
contentHandler.BuildDisplay(ctx);
|
||||
Assert.That(context.TopMeta, Is.Not.Null);
|
||||
|
@@ -21,7 +21,6 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
_container = builder.Build();
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
[SetUp]
|
||||
public void Init() {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterType<StubExtensionManager>().As<IExtensionManager>();
|
||||
@@ -29,7 +28,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
|
||||
[Test]
|
||||
public void CreatingNewShapeTypeByName() {
|
||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
||||
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||
|
||||
var alpha = shape.Alpha();
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
|
||||
[Test]
|
||||
public void CreatingShapeWithAdditionalNamedParameters() {
|
||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
||||
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||
|
||||
var alpha = shape.Alpha(one: 1, two: "dos");
|
||||
|
||||
@@ -49,7 +48,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
|
||||
[Test]
|
||||
public void WithPropertyBearingObjectInsteadOfNamedParameters() {
|
||||
dynamic shape = _container.Resolve<IShapeHelperFactory>().CreateHelper();
|
||||
dynamic shape = _container.Resolve<IShapeFactory>();
|
||||
|
||||
var alpha = shape.Alpha(new { one = 1, two = "dos" });
|
||||
|
||||
|
@@ -44,7 +44,6 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
builder.RegisterInstance(new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext)).As<IWorkContextAccessor>();
|
||||
builder.RegisterInstance(new SimpleShapes()).WithMetadata("Feature", testFeature);
|
||||
@@ -72,7 +71,7 @@ namespace Orchard.Tests.DisplayManagement {
|
||||
[Test]
|
||||
public void RenderingSomething() {
|
||||
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 result2 = ((DisplayHelper)displayHelperFactory).ShapeExecute((Shape)shapeHelperFactory.Pager());
|
||||
|
@@ -29,14 +29,14 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
IContentManager contentManager,
|
||||
IContentDefinitionManager contentDefinitionManager,
|
||||
ITransactionManager transactionManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
Services = orchardServices;
|
||||
_contentManager = contentManager;
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
_transactionManager = transactionManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -8,9 +8,9 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
public class ItemController : Controller {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public ItemController(IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
||||
public ItemController(IContentManager contentManager, IShapeFactory shapeFactory) {
|
||||
_contentManager = contentManager;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -9,10 +9,13 @@ namespace Orchard.Core.Feeds.Services {
|
||||
private readonly IFeedManager _feedManager;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public FeedFilter(IFeedManager feedManager, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
|
||||
public FeedFilter(
|
||||
IFeedManager feedManager,
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
IShapeFactory shapeFactory) {
|
||||
_feedManager = feedManager;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -24,13 +24,13 @@ namespace Orchard.Core.Localization.Controllers {
|
||||
IContentManager contentManager,
|
||||
ICultureManager cultureManager,
|
||||
ILocalizationService localizationService,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
_contentManager = contentManager;
|
||||
_cultureManager = cultureManager;
|
||||
_localizationService = localizationService;
|
||||
T = NullLocalizer.Instance;
|
||||
Services = orchardServices;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -22,12 +22,12 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
IMenuService menuService,
|
||||
IOrchardServices services,
|
||||
INavigationManager navigationManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
_menuService = menuService;
|
||||
_services = services;
|
||||
_navigationManager = navigationManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -8,11 +8,10 @@ namespace Orchard.Core.Reports.Controllers {
|
||||
public class AdminController : Controller {
|
||||
private readonly IReportsManager _reportsManager;
|
||||
|
||||
public AdminController(IReportsManager reportsManager, IShapeHelperFactory shapeHelperFactory) {
|
||||
public AdminController(IReportsManager reportsManager) {
|
||||
_reportsManager = reportsManager;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
var model = new ReportsAdminIndexViewModel { Reports = _reportsManager.GetReports().ToList() };
|
||||
|
@@ -16,11 +16,15 @@ namespace Orchard.Core.Routable.Controllers {
|
||||
private readonly ITransactionManager _transactionManager;
|
||||
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;
|
||||
_transactionManager = transactionManager;
|
||||
_routablePathConstraint = routablePathConstraint;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -12,11 +12,14 @@ namespace Orchard.Core.Routable.Services {
|
||||
private readonly IContentManager _contentManager;
|
||||
public const string Name = "RoutableHomePageProvider";
|
||||
|
||||
public RoutableHomePageProvider(IOrchardServices services, IContentManager contentManager, IShapeHelperFactory shapeHelperFactory) {
|
||||
public RoutableHomePageProvider(
|
||||
IOrchardServices services,
|
||||
IContentManager contentManager,
|
||||
IShapeFactory shapeFactory) {
|
||||
_contentManager = contentManager;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -21,15 +21,13 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
public AdminController(
|
||||
ISiteService siteService,
|
||||
IOrchardServices services,
|
||||
ICultureManager cultureManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
ICultureManager cultureManager) {
|
||||
_siteService = siteService;
|
||||
_cultureManager = cultureManager;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ActionResult Index(string tabName) {
|
||||
|
@@ -21,13 +21,13 @@ namespace Orchard.Blogs.Controllers {
|
||||
private readonly ITransactionManager _transactionManager;
|
||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||
|
||||
public BlogAdminController(IOrchardServices services,
|
||||
public BlogAdminController(
|
||||
IOrchardServices services,
|
||||
IBlogService blogService,
|
||||
IBlogPostService blogPostService,
|
||||
IContentManager contentManager,
|
||||
ITransactionManager transactionManager,
|
||||
IBlogSlugConstraint blogSlugConstraint,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IBlogSlugConstraint blogSlugConstraint) {
|
||||
Services = services;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
@@ -35,10 +35,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
_transactionManager = transactionManager;
|
||||
_blogSlugConstraint = blogSlugConstraint;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
@@ -123,7 +121,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult List() {
|
||||
var list = Shape.List();
|
||||
var list = Services.New.List();
|
||||
list.AddRange(_blogService.Get()
|
||||
.Select(b => {
|
||||
var blog = Services.ContentManager.BuildDisplay(b, "SummaryAdmin");
|
||||
@@ -131,7 +129,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
return blog;
|
||||
}));
|
||||
|
||||
var viewModel = Shape.ViewModel()
|
||||
var viewModel = Services.New.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
return View(viewModel);
|
||||
|
@@ -20,14 +20,20 @@ namespace Orchard.Blogs.Controllers {
|
||||
private readonly IBlogSlugConstraint _blogSlugConstraint;
|
||||
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;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_blogSlugConstraint = blogSlugConstraint;
|
||||
_routeCollection = routeCollection;
|
||||
Logger = NullLogger.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -23,13 +23,13 @@ namespace Orchard.Blogs.Controllers {
|
||||
IBlogService blogService,
|
||||
IBlogPostService blogPostService,
|
||||
IFeedManager feedManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
_services = services;
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_feedManager = feedManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -18,16 +18,19 @@ namespace Orchard.Blogs.Drivers {
|
||||
private readonly IBlogPostService _blogPostService;
|
||||
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;
|
||||
_contentManager = contentManager;
|
||||
_blogPostService = blogPostService;
|
||||
_feedManager = feedManager;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
protected override string Prefix { get { return ""; } }
|
||||
|
@@ -22,7 +22,7 @@ using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, Fo
|
||||
if (!Request.IsAuthenticated) {
|
||||
|
||||
<fieldset class="who">
|
||||
<legend id="addacomment">@T("Add a Comment")</legend>
|
||||
<legend id="add-comment">@T("Add a Comment")</legend>
|
||||
<ol>
|
||||
<li>
|
||||
<label for="Name">@T("Name")</label>
|
||||
@@ -41,14 +41,15 @@ using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, Fo
|
||||
} else {
|
||||
@Html.Hidden("Name", WorkContext.CurrentUser.UserName ?? "")
|
||||
@Html.Hidden("Email", WorkContext.CurrentUser.Email ?? "")
|
||||
|
||||
<h2 id="comment-by">@if (Request.IsAuthenticated) { @T("Hi, {0}!", Html.Encode(WorkContext.CurrentUser.UserName))}</h2>
|
||||
}
|
||||
|
||||
<h2 id="commenter">@if (Request.IsAuthenticated) { @T("Hi, {0}!", Html.Encode(WorkContext.CurrentUser.UserName))}</h2>
|
||||
<fieldset class="what">
|
||||
<ol>
|
||||
<li>
|
||||
<label for="CommentText">@T("Comment")</label>
|
||||
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
||||
<label for="comment-text">@T("Comment")</label>
|
||||
<textarea id="comment-text" rows="10" cols="30" name="comment-text"></textarea>
|
||||
</li>
|
||||
<li>
|
||||
<input type="submit" class="button" value="@T("Submit Comment")" />
|
||||
|
@@ -16,9 +16,10 @@ namespace Orchard.Experimental.Controllers {
|
||||
public ContentController(
|
||||
IRepository<ContentTypeRecord> contentTypeRepository,
|
||||
IContentManager contentManager,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
_contentTypeRepository = contentTypeRepository;
|
||||
_contentManager = contentManager;
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -14,10 +14,10 @@ namespace Orchard.Experimental.Controllers {
|
||||
public class HomeController : Controller {
|
||||
private readonly INotifier _notifier;
|
||||
|
||||
public HomeController(INotifier notifier, IShapeHelperFactory shapeHelperFactory) {
|
||||
public HomeController(INotifier notifier, IShapeFactory shapeFactory) {
|
||||
_notifier = notifier;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -24,8 +24,8 @@ namespace Orchard.Search.Drivers {
|
||||
protected override string Prefix { get { return "SearchSettings"; } }
|
||||
|
||||
protected override DriverResult Editor(SearchSettingsPart part, dynamic shapeHelper) {
|
||||
var model = new SearchSettingsViewModel();
|
||||
var searchedFields = part.SearchedFields;
|
||||
SearchSettingsViewModel model = new SearchSettingsViewModel();
|
||||
String [] searchedFields = part.SearchedFields;
|
||||
|
||||
if (_indexManager.HasIndexProvider()) {
|
||||
model.Entries = new List<SearchSettingsEntry>();
|
||||
@@ -34,13 +34,14 @@ namespace Orchard.Search.Drivers {
|
||||
}
|
||||
}
|
||||
|
||||
return ContentPartTemplate(model, "Parts/Search.SiteSettings");
|
||||
return ContentShape("Parts_Search_SiteSettings",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Search.SiteSettings", Model: model));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(SearchSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var model = new SearchSettingsViewModel();
|
||||
|
||||
if(updater.TryUpdateModel(model, Prefix, null, null)) {
|
||||
SearchSettingsViewModel model = new SearchSettingsViewModel();
|
||||
|
||||
if (updater.TryUpdateModel(model, Prefix, null, null)) {
|
||||
part.SearchedFields = model.Entries.Where(e => e.Selected).Select(e => e.Field).ToArray();
|
||||
}
|
||||
|
||||
|
@@ -106,6 +106,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Parts\Search.SearchForm.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Placement.info" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
3
src/Orchard.Web/Modules/Orchard.Search/Placement.info
Normal file
3
src/Orchard.Web/Modules/Orchard.Search/Placement.info
Normal file
@@ -0,0 +1,3 @@
|
||||
<Placement>
|
||||
<Place Parts_Search_SiteSettings="Primary:1"/>
|
||||
</Placement>
|
@@ -4,18 +4,16 @@
|
||||
<fieldset>
|
||||
<legend>@T("Search")</legend>
|
||||
<div>
|
||||
@{var entryIndex = 0;}
|
||||
@if (Model.Entries != null && Model.Entries.Any()) {
|
||||
foreach(var modelEntry in Model.Entries) {
|
||||
if(Model.Entries[entryIndex].Selected) {
|
||||
<input type="checkbox" value="true" checked="checked" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/>
|
||||
foreach(SearchSettingsEntry modelEntry in Model.Entries) {
|
||||
if(modelEntry.Selected) {
|
||||
<input type="checkbox" value="true" checked="checked" name="@Html.FieldNameFor(m => modelEntry.Selected)" id="@Html.FieldIdFor(m => modelEntry.Selected)"/>
|
||||
}
|
||||
else {
|
||||
<input type="checkbox" value="true" name="@Html.FieldNameFor(m => m.Entries[entryIndex].Selected)" id="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)"/>
|
||||
<input type="checkbox" value="true" name="@Html.FieldNameFor(m => modelEntry.Selected)" id="@Html.FieldIdFor(m => modelEntry.Selected)"/>
|
||||
}
|
||||
@Html.HiddenFor(m => m.Entries[entryIndex].Field)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Entries[entryIndex].Selected)">@Model.Entries[entryIndex].Field</label>
|
||||
entryIndex = entryIndex + 1;
|
||||
@Html.HiddenFor(m => modelEntry.Field)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => modelEntry.Selected)">@modelEntry.Field</label>
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -43,6 +43,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ClaySharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
|
@@ -76,7 +76,6 @@ namespace Orchard.Setup {
|
||||
builder.RegisterType<DisplayHelperFactory>().As<IDisplayHelperFactory>();
|
||||
builder.RegisterType<DefaultDisplayManager>().As<IDisplayManager>();
|
||||
builder.RegisterType<DefaultShapeFactory>().As<IShapeFactory>();
|
||||
builder.RegisterType<ShapeHelperFactory>().As<IShapeHelperFactory>();
|
||||
builder.RegisterType<DefaultShapeTableManager>().As<IShapeTableManager>();
|
||||
|
||||
builder.RegisterType<ThemeAwareViewEngine>().As<IThemeAwareViewEngine>();
|
||||
@@ -139,10 +138,12 @@ namespace Orchard.Setup {
|
||||
|
||||
[UsedImplicitly]
|
||||
class SafeModeSiteWorkContextProvider : IWorkContextStateProvider {
|
||||
public T Get<T>(string name) {
|
||||
if (name == "CurrentSite")
|
||||
return (T)(ISite) new SafeModeSite();
|
||||
return default(T);
|
||||
public Func<T> Get<T>(string name) {
|
||||
if (name == "CurrentSite") {
|
||||
ISite safeModeSite = new SafeModeSite();
|
||||
return () => (T)safeModeSite;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,12 +17,15 @@ namespace Orchard.Tags.Controllers {
|
||||
public class HomeController : Controller {
|
||||
private readonly ITagService _tagService;
|
||||
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;
|
||||
_contentManager = contentManager;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@@ -44,8 +47,7 @@ namespace Orchard.Tags.Controllers {
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var shape = _shapeHelperFactory.CreateHelper();
|
||||
var list = shape.List();
|
||||
var list = _shapeFactory.List();
|
||||
foreach (var taggedContentItem in _tagService.GetTaggedContentItems(tag.Id)) {
|
||||
list.Add(_contentManager.BuildDisplay(taggedContentItem, "Summary"));
|
||||
}
|
||||
|
@@ -26,8 +26,7 @@ namespace Orchard.Themes.Controllers {
|
||||
IThemeService themeService,
|
||||
IPreviewTheme previewTheme,
|
||||
IAuthorizer authorizer,
|
||||
INotifier notifier,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
INotifier notifier) {
|
||||
Services = services;
|
||||
_dataMigrationManager = dataMigraitonManager;
|
||||
_reportsCoordinator = reportsCoordinator;
|
||||
@@ -36,7 +35,6 @@ namespace Orchard.Themes.Controllers {
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
public IOrchardServices Services{ get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
|
@@ -9,13 +9,17 @@ namespace Orchard.Themes.Preview {
|
||||
private readonly IThemeService _themeService;
|
||||
private readonly IPreviewTheme _previewTheme;
|
||||
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;
|
||||
_previewTheme = previewTheme;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
@@ -33,8 +37,8 @@ namespace Orchard.Themes.Preview {
|
||||
.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) { }
|
||||
|
@@ -22,12 +22,12 @@ namespace Orchard.Users.Controllers {
|
||||
IOrchardServices services,
|
||||
IMembershipService membershipService,
|
||||
IUserService userService,
|
||||
IShapeHelperFactory shapeHelperFactory) {
|
||||
IShapeFactory shapeFactory) {
|
||||
Services = services;
|
||||
_membershipService = membershipService;
|
||||
_userService = userService;
|
||||
T = NullLocalizer.Instance;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic Shape { get; set; }
|
||||
|
@@ -1,16 +1,16 @@
|
||||
@model Orchard.Widgets.Models.LayerPart
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(layer => layer.Name)
|
||||
@Html.TextBoxFor(layer => layer.Name)
|
||||
@Html.LabelFor(layer => layer.Name)
|
||||
@Html.TextBoxFor(layer => layer.Name)
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(layer => layer.Description)
|
||||
@Html.TextAreaFor(layer => layer.Description)
|
||||
@Html.LabelFor(layer => layer.Description)
|
||||
@Html.TextAreaFor(layer => layer.Description)
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(layer => layer.LayerRule)
|
||||
@Html.TextAreaFor(layer => layer.LayerRule)
|
||||
@Html.LabelFor(layer => layer.LayerRule)
|
||||
@Html.TextAreaFor(layer => layer.LayerRule)
|
||||
</fieldset>
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Zone)
|
||||
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
|
||||
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
|
@@ -298,7 +298,8 @@
|
||||
return match && match[0].toLowerCase() || typeof(i);
|
||||
},
|
||||
//+ Jonas Raoni Soares Silva
|
||||
//@ http://jsfromhell.com/string/pad [v1.0]
|
||||
// the @ sign next to "//" is interpreted by IE when using cc<underscore>on! Inserted a space.
|
||||
// @ http://jsfromhell.com/string/pad [v1.0]
|
||||
__pad: function(str, l, s, t){
|
||||
var p = s || ' ';
|
||||
var o = str;
|
||||
|
@@ -7,6 +7,7 @@ Copyright: 2010, Orchard. All Rights Reserved
|
||||
|
||||
/* Color Palette
|
||||
**************************************************************
|
||||
|
||||
Background: #fff
|
||||
Borders: #dbdbdb
|
||||
Text: #434343
|
||||
@@ -61,6 +62,7 @@ header, footer, aside, nav, article { display: block; }
|
||||
|
||||
/* Clearing Floats
|
||||
***************************************************************/
|
||||
|
||||
.group:after
|
||||
{
|
||||
content: ".";
|
||||
@@ -83,6 +85,7 @@ header, footer, aside, nav, article { display: block; }
|
||||
|
||||
/* General
|
||||
***************************************************************/
|
||||
|
||||
/* Default font settings.
|
||||
The font-size 62.5% sets the base font to 10px */
|
||||
body {
|
||||
@@ -154,6 +157,7 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
|
||||
|
||||
/* Structure
|
||||
***************************************************************/
|
||||
|
||||
#layout-wrapper
|
||||
{
|
||||
|
||||
@@ -255,6 +259,7 @@ nav ul
|
||||
.zone-asidethird { padding: 0 0 6px 0; }
|
||||
|
||||
|
||||
|
||||
/* Main
|
||||
***************************************************************/
|
||||
|
||||
@@ -299,49 +304,39 @@ nav ul
|
||||
/* Secondary
|
||||
***************************************************************/
|
||||
|
||||
/* Comments */
|
||||
.comment {}
|
||||
.comment .who {}
|
||||
.comment .what {}
|
||||
.comment #add-comment {}
|
||||
|
||||
.comment #comment-by { font-size: 1.6em; font-weight: normal; margin: 0 0 1.2em 0; border:none; }
|
||||
.comment #comment-text { width: 33.2em; }
|
||||
.comment input[type="text"] { width: 32em; }
|
||||
|
||||
|
||||
|
||||
/* Forms
|
||||
***************************************************************/
|
||||
label { font-weight: normal; display:block; }
|
||||
label.forcheckbox { margin:0 0 0 .4em; display:inline; }
|
||||
form { margin: 0; padding: 0; }
|
||||
legend { font-size: 1.6em; font-weight: normal; margin: 0 0 1.2em 0; border:none; }
|
||||
fieldset { padding:0em; margin: 0 0 0em 0; border: 0px solid #dbdbdb; }
|
||||
legend { font-weight: 600; font-size:1.2em; }
|
||||
label { font-size: 1.3em; font-weight: normal; display:block; padding: 0 0 0.3em 0; }
|
||||
label.forcheckbox { margin:0 0 0 .4em; display:inline; }
|
||||
|
||||
input[type="text"], #CommentText, #password, #confirmPassword {
|
||||
border:1px solid #999;
|
||||
input[type="text"], input[type="password"] {
|
||||
display: block;
|
||||
padding:6px;
|
||||
width:50%;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
form.search {
|
||||
margin-bottom:2em;
|
||||
}
|
||||
|
||||
.search input[type=text] {
|
||||
display:inline;
|
||||
width:17em;
|
||||
}
|
||||
|
||||
fieldset ol {list-style-type:none;}
|
||||
|
||||
fieldset ol li {margin:1.6em 0 0 0}
|
||||
|
||||
legend {
|
||||
font-size: 1.4em;
|
||||
border:none;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 1.3em;
|
||||
margin:0 0 .3em 0;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
margin:.2em 0 1.2em 0;
|
||||
}
|
||||
|
||||
fieldset ol { list-style-type:none; padding: 0; margin: 0; }
|
||||
fieldset ol li { margin: 0 0 6px 0; }
|
||||
|
||||
/*
|
||||
input[type="submit"], input[type="button"], button, .button, .button:link, .button:visited {
|
||||
color:#333;
|
||||
background:#F5F5F5;
|
||||
@@ -365,6 +360,7 @@ button:focus, .button:focus {
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#ebebeb));
|
||||
background:-moz-linear-gradient(top , #e1e1e1, #ebebeb);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -402,23 +398,8 @@ button:focus, .button:focus {
|
||||
/* CSS 3 Enhancements
|
||||
***************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/* For testing purposes */
|
||||
#comments, #commenter {
|
||||
font-size:1.6em;
|
||||
font-weight:600;
|
||||
margin:1.2em 0 1.8em 1.2em;
|
||||
}
|
||||
|
||||
#commenter {
|
||||
margin:1.2em 0 0 1em;
|
||||
}
|
||||
|
||||
ul.comments, form.comment {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
article.comment h4 {
|
||||
font-size:1.4em;
|
||||
|
@@ -17,7 +17,6 @@ using Orchard.UI.Zones;
|
||||
namespace Orchard.ContentManagement {
|
||||
public class DefaultContentDisplay : IContentDisplay {
|
||||
private readonly Lazy<IEnumerable<IContentHandler>> _handlers;
|
||||
private readonly IShapeHelperFactory _shapeHelperFactory;
|
||||
private readonly IShapeFactory _shapeFactory;
|
||||
private readonly IShapeTableManager _shapeTableManager;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
@@ -27,7 +26,6 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
public DefaultContentDisplay(
|
||||
Lazy<IEnumerable<IContentHandler>> handlers,
|
||||
IShapeHelperFactory shapeHelperFactory,
|
||||
IShapeFactory shapeFactory,
|
||||
IShapeTableManager shapeTableManager,
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
@@ -35,7 +33,6 @@ namespace Orchard.ContentManagement {
|
||||
Lazy<IThemeService> themeService,
|
||||
RequestContext requestContext) {
|
||||
_handlers = handlers;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
_shapeTableManager = shapeTableManager;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
@@ -68,7 +65,7 @@ namespace Orchard.ContentManagement {
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
itemShape.Metadata.DisplayType = actualDisplayType;
|
||||
|
||||
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, _shapeHelperFactory);
|
||||
var context = new BuildDisplayContext(itemShape, content, actualDisplayType, _shapeFactory);
|
||||
BindPlacement(context, actualDisplayType);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.BuildDisplay(context), Logger);
|
||||
@@ -86,7 +83,7 @@ namespace Orchard.ContentManagement {
|
||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
|
||||
var context = new BuildEditorContext(itemShape, content, _shapeHelperFactory);
|
||||
var context = new BuildEditorContext(itemShape, content, _shapeFactory);
|
||||
BindPlacement(context, null);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.BuildEditor(context), Logger);
|
||||
@@ -104,7 +101,7 @@ namespace Orchard.ContentManagement {
|
||||
dynamic itemShape = CreateItemShape(actualShapeType);
|
||||
itemShape.ContentItem = content.ContentItem;
|
||||
|
||||
var context = new UpdateEditorContext(itemShape, content, updater, _shapeHelperFactory);
|
||||
var context = new UpdateEditorContext(itemShape, content, updater, _shapeFactory);
|
||||
BindPlacement(context, null);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);
|
||||
|
@@ -30,19 +30,33 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
|
||||
[Obsolete("Provided while transitioning to factory variations")]
|
||||
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) {
|
||||
return ContentShapeImplementation(shapeType, null, factory);
|
||||
return ContentShapeImplementation(shapeType, null, ctx => 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);
|
||||
}
|
||||
|
||||
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<object> factory) {
|
||||
return new ContentShapeResult(shapeType, Prefix, factory).Location(defaultLocation);
|
||||
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<BuildShapeContext, object> shapeBuilder) {
|
||||
return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation);
|
||||
}
|
||||
|
||||
private object CreateShape(BuildShapeContext context, string shapeType) {
|
||||
IShapeFactory shapeFactory = context.New;
|
||||
return shapeFactory.Create(shapeType);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
|
@@ -8,9 +8,9 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
private string _defaultLocation;
|
||||
private readonly string _shapeType;
|
||||
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;
|
||||
_prefix = prefix;
|
||||
_shapeBuilder = shapeBuilder;
|
||||
@@ -30,18 +30,19 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
return;
|
||||
|
||||
dynamic parentShape = context.Shape;
|
||||
IShape contentShape = _shapeBuilder();
|
||||
contentShape.Metadata.Prefix = _prefix;
|
||||
contentShape.Metadata.DisplayType = displayType;
|
||||
var newShape = _shapeBuilder(context);
|
||||
ShapeMetadata newShapeMetadata = newShape.Metadata;
|
||||
newShapeMetadata.Prefix = _prefix;
|
||||
newShapeMetadata.DisplayType = displayType;
|
||||
|
||||
var delimiterIndex = location.IndexOf(':');
|
||||
if (delimiterIndex < 0) {
|
||||
parentShape.Zones[location].Add(contentShape);
|
||||
parentShape.Zones[location].Add(newShape);
|
||||
}
|
||||
else {
|
||||
var zoneName = location.Substring(0, delimiterIndex);
|
||||
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 {
|
||||
public class BuildDisplayContext : BuildShapeContext {
|
||||
public BuildDisplayContext(IShape model, IContent content, string displayType, IShapeHelperFactory shapeHelperFactory)
|
||||
: base(model, content, shapeHelperFactory) {
|
||||
public BuildDisplayContext(IShape model, IContent content, string displayType, IShapeFactory shapeFactory)
|
||||
: base(model, content, shapeFactory) {
|
||||
DisplayType = displayType;
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,8 @@ using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.ContentManagement.Handlers {
|
||||
public class BuildEditorContext : BuildShapeContext {
|
||||
public BuildEditorContext(IShape model, IContent content, IShapeHelperFactory shapeHelperFactory)
|
||||
: base(model, content, shapeHelperFactory) {
|
||||
public BuildEditorContext(IShape model, IContent content, IShapeFactory shapeFactory)
|
||||
: base(model, content, shapeFactory) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,10 +3,10 @@ using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.ContentManagement.Handlers {
|
||||
public class BuildShapeContext {
|
||||
protected BuildShapeContext(IShape shape, IContent content, IShapeHelperFactory shapeHelperFactory) {
|
||||
protected BuildShapeContext(IShape shape, IContent content, IShapeFactory shapeFactory) {
|
||||
Shape = shape;
|
||||
ContentItem = content.ContentItem;
|
||||
New = shapeHelperFactory.CreateHelper();
|
||||
New = shapeFactory;
|
||||
FindPlacement = (partType, defaultLocation) => defaultLocation;
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,8 @@ using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.ContentManagement.Handlers {
|
||||
public class UpdateEditorContext : BuildEditorContext {
|
||||
public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, IShapeHelperFactory shapeHelperFactory)
|
||||
: base(model, content, shapeHelperFactory) {
|
||||
public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, IShapeFactory shapeFactory)
|
||||
: base(model, content, shapeFactory) {
|
||||
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 {
|
||||
|
||||
|
||||
|
||||
|
||||
public class DefaultShapeFactory : IShapeFactory {
|
||||
public class DefaultShapeFactory : Clay, IShapeFactory {
|
||||
private readonly IEnumerable<Lazy<IShapeFactoryEvents>> _events;
|
||||
private readonly IShapeTableManager _shapeTableManager;
|
||||
private readonly Lazy<IShapeHelperFactory> _shapeHelperFactory;
|
||||
|
||||
public DefaultShapeFactory(
|
||||
IEnumerable<Lazy<IShapeFactoryEvents>> events,
|
||||
IShapeTableManager shapeTableManager,
|
||||
Lazy<IShapeHelperFactory> shapeHelperFactory) {
|
||||
IShapeTableManager shapeTableManager) : base(new ShapeFactoryBehavior()) {
|
||||
_events = events;
|
||||
_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) {
|
||||
@@ -34,7 +34,7 @@ namespace Orchard.DisplayManagement.Implementation {
|
||||
defaultShapeTable.Descriptors.TryGetValue(shapeType, out shapeDescriptor);
|
||||
|
||||
var creatingContext = new ShapeCreatingContext {
|
||||
New = _shapeHelperFactory.Value.CreateHelper(),
|
||||
New = this,
|
||||
ShapeFactory = this,
|
||||
ShapeType = shapeType,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -97,10 +97,10 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
public override T GetState<T>(string name) {
|
||||
return (T)_state.GetOrAdd(name, x => GetStateInternal<T>(x));
|
||||
return (T)_state.GetOrAdd(name, s => GetStateInternal<T>(s) == null ? default(T) : GetStateInternal<T>(s).Invoke());
|
||||
}
|
||||
|
||||
private T GetStateInternal<T>(string name) {
|
||||
private Func<T> GetStateInternal<T>(string name) {
|
||||
return _workContextStateProviders.Select(wcsp => wcsp.Get<T>(name))
|
||||
.FirstOrDefault(value => !Equals(value, default(T)));
|
||||
}
|
||||
|
@@ -1,25 +1,33 @@
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Data;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Environment {
|
||||
[UsedImplicitly]
|
||||
public class OrchardServices : IOrchardServices {
|
||||
private readonly Lazy<IShapeFactory> _shapeFactory;
|
||||
|
||||
public OrchardServices(
|
||||
IContentManager contentManager,
|
||||
ITransactionManager transactionManager,
|
||||
IAuthorizer authorizer,
|
||||
INotifier notifier) {
|
||||
INotifier notifier,
|
||||
Lazy<IShapeFactory> shapeFactory) {
|
||||
_shapeFactory = shapeFactory;
|
||||
ContentManager = contentManager;
|
||||
TransactionManager = transactionManager;
|
||||
Authorizer = authorizer;
|
||||
Notifier = notifier;
|
||||
}
|
||||
public IContentManager ContentManager { get; set; }
|
||||
public ITransactionManager TransactionManager {get;set;}
|
||||
public IAuthorizer Authorizer { get; set; }
|
||||
public INotifier Notifier { get; set; }
|
||||
|
||||
public IContentManager ContentManager { get; private set; }
|
||||
public ITransactionManager TransactionManager { get; private 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 {
|
||||
IContentManager ContentManager { get; }
|
||||
ITransactionManager TransactionManager { get; }
|
||||
IAuthorizer Authorizer { get; set; }
|
||||
IAuthorizer Authorizer { get; }
|
||||
INotifier Notifier { get; }
|
||||
dynamic New { get; }
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ namespace Orchard {
|
||||
}
|
||||
|
||||
public interface IWorkContextStateProvider : IDependency {
|
||||
T Get<T>(string name);
|
||||
Func<T> Get<T>(string name);
|
||||
}
|
||||
|
||||
public interface IWorkContextScope : IDisposable {
|
||||
|
@@ -10,8 +10,8 @@ using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public class Shapes : IDependency {
|
||||
public Shapes(IShapeHelperFactory shapeHelperFactory) {
|
||||
New = shapeHelperFactory.CreateHelper();
|
||||
public Shapes(IShapeFactory shapeFactory) {
|
||||
New = shapeFactory;
|
||||
}
|
||||
|
||||
dynamic New { get; set; }
|
||||
|
@@ -29,9 +29,9 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
public new dynamic Layout { get { return _layout; } }
|
||||
public WorkContext WorkContext { get { return _workContext; } }
|
||||
|
||||
public dynamic New { get { return _new; } }
|
||||
public dynamic New { get { return ShapeFactory; } }
|
||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
||||
public IShapeHelperFactory ShapeHelperFactory { get; set; }
|
||||
public IShapeFactory ShapeFactory { get; set; }
|
||||
|
||||
public IAuthorizer Authorizer { get; set; }
|
||||
|
||||
@@ -78,7 +78,6 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
||||
_localizer = LocalizationUtilities.Resolve(ViewContext, VirtualPath);
|
||||
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
||||
_layout = _workContext.Layout;
|
||||
_new = ShapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
public bool AuthorizedFor(Permission permission) {
|
||||
|
@@ -25,12 +25,12 @@ namespace Orchard.Mvc {
|
||||
|
||||
public Localizer T { get { return _localizer; } }
|
||||
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 WorkContext WorkContext { get { return _workContext; } }
|
||||
|
||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
||||
public IShapeHelperFactory ShapeHelperFactory { get; set; }
|
||||
public IShapeFactory ShapeFactory { get; set; }
|
||||
|
||||
public IAuthorizer Authorizer { get; set; }
|
||||
|
||||
@@ -75,7 +75,6 @@ namespace Orchard.Mvc {
|
||||
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
||||
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
||||
_layout = _workContext.Layout;
|
||||
_new = ShapeHelperFactory.CreateHelper();
|
||||
|
||||
base.RenderView(viewContext);
|
||||
}
|
||||
|
@@ -429,7 +429,6 @@
|
||||
<Compile Include="DisplayManagement\Descriptors\ShapeAttributeStrategy\ShapeAttributeBindingStrategy.cs" />
|
||||
<Compile Include="DisplayManagement\Implementation\DefaultDisplayManager.cs" />
|
||||
<Compile Include="DisplayManagement\Implementation\DefaultShapeFactory.cs" />
|
||||
<Compile Include="DisplayManagement\IShapeHelperFactory.cs" />
|
||||
<Compile Include="DisplayManagement\IDisplayHelperFactory.cs" />
|
||||
<Compile Include="DisplayManagement\IShape.cs" />
|
||||
<Compile Include="DisplayManagement\Shapes\Shape.cs" />
|
||||
@@ -441,8 +440,6 @@
|
||||
<Compile Include="DisplayManagement\Implementation\IDisplayManager.cs" />
|
||||
<Compile Include="DisplayManagement\IShapeFactory.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\IHostLocalRestart.cs" />
|
||||
<Compile Include="Environment\IShellContainerRegistrations.cs" />
|
||||
|
@@ -1,4 +1,6 @@
|
||||
namespace Orchard.Security {
|
||||
using System;
|
||||
|
||||
namespace Orchard.Security {
|
||||
public class CurrentUserWorkContext : IWorkContextStateProvider {
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
@@ -6,10 +8,10 @@
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
public T Get<T>(string name) {
|
||||
if (name == "CurrentUser")
|
||||
return (T)_authenticationService.GetAuthenticatedUser();
|
||||
return default(T);
|
||||
public Func<T> Get<T>(string name) {
|
||||
if (name == "CurrentUser")
|
||||
return () => (T)_authenticationService.GetAuthenticatedUser();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
namespace Orchard.Settings {
|
||||
using System;
|
||||
|
||||
namespace Orchard.Settings {
|
||||
public class CurrentSiteWorkContext : IWorkContextStateProvider {
|
||||
private readonly ISiteService _siteService;
|
||||
|
||||
@@ -6,10 +8,12 @@
|
||||
_siteService = siteService;
|
||||
}
|
||||
|
||||
public T Get<T>(string name) {
|
||||
if (name == "CurrentSite")
|
||||
return (T)_siteService.GetSiteSettings();
|
||||
return default(T);
|
||||
public Func<T> Get<T>(string name) {
|
||||
if (name == "CurrentSite") {
|
||||
var siteSettings = _siteService.GetSiteSettings();
|
||||
return () => (T)siteSettings;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,12 +7,15 @@ namespace Orchard.UI.Admin.Notification {
|
||||
public class AdminNotificationFilter : FilterProvider, IResultFilter {
|
||||
private readonly INotificationManager _notificationManager;
|
||||
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;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
@@ -27,10 +30,9 @@ namespace Orchard.UI.Admin.Notification {
|
||||
if (!messageEntries.Any())
|
||||
return;
|
||||
|
||||
var shape = _shapeHelperFactory.CreateHelper();
|
||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
||||
foreach(var messageEntry in messageEntries)
|
||||
messagesZone = messagesZone.Add(shape.Message(messageEntry));
|
||||
messagesZone = messagesZone.Add(_shapeFactory.Message(messageEntry));
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {}
|
||||
|
@@ -9,17 +9,19 @@ namespace Orchard.UI.Navigation {
|
||||
public class MenuFilter : FilterProvider, IResultFilter {
|
||||
private readonly INavigationManager _navigationManager;
|
||||
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;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
var workContext = _workContextAccessor.GetContext(filterContext);
|
||||
var shape = _shapeHelperFactory.CreateHelper();
|
||||
|
||||
var menuName = "main";
|
||||
if (AdminFilter.IsApplied(filterContext.RequestContext))
|
||||
@@ -27,24 +29,24 @@ namespace Orchard.UI.Navigation {
|
||||
|
||||
var menuItems = _navigationManager.BuildMenu(menuName);
|
||||
|
||||
var menuShape = shape.Menu().MenuName(menuName);
|
||||
PopulateMenu(shape, menuShape, menuItems);
|
||||
var menuShape = _shapeFactory.Menu().MenuName(menuName);
|
||||
PopulateMenu(_shapeFactory, menuShape, menuItems);
|
||||
|
||||
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) {
|
||||
var menuItemShape = shape.MenuItem()
|
||||
var menuItemShape = shapeFactory.MenuItem()
|
||||
.Text(menuItem.Text)
|
||||
.Href(menuItem.Href)
|
||||
.RouteValues(menuItem.RouteValues)
|
||||
.Item(menuItem)
|
||||
.Menu(shape)
|
||||
.Menu(shapeFactory)
|
||||
.Parent(parentShape);
|
||||
|
||||
if (menuItem.Items != null && menuItem.Items.Any()) {
|
||||
PopulateMenu(shape, menuItemShape, menuItem.Items);
|
||||
PopulateMenu(shapeFactory, menuItemShape, menuItem.Items);
|
||||
}
|
||||
|
||||
parentShape.Add(menuItemShape, menuItem.Position);
|
||||
|
@@ -12,12 +12,15 @@ namespace Orchard.UI.Notify {
|
||||
private const string TempDataMessages = "messages";
|
||||
private readonly INotifier _notifier;
|
||||
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;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shapeHelperFactory = shapeHelperFactory;
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||
@@ -82,10 +85,9 @@ namespace Orchard.UI.Notify {
|
||||
if (!messageEntries.Any())
|
||||
return;
|
||||
|
||||
var shape = _shapeHelperFactory.CreateHelper();
|
||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
||||
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
|
||||
//baseViewModel.Messages = baseViewModel.Messages == null ? messageEntries .Messages.Union(messageEntries).ToList();
|
||||
|
@@ -7,24 +7,27 @@ namespace Orchard.UI.Resources {
|
||||
public class ResourceFilter : FilterProvider, IResultFilter {
|
||||
private readonly IResourceManager _resourceManager;
|
||||
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;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
private dynamic Shape { get; set; }
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
var ctx = _workContextAccessor.GetContext();
|
||||
var head = ctx.Layout.Head;
|
||||
var tail = ctx.Layout.Tail;
|
||||
head.Add(Shape.Metas().ResourceManager(_resourceManager));
|
||||
head.Add(Shape.HeadLinks().ResourceManager(_resourceManager));
|
||||
head.Add(Shape.StylesheetLinks().ResourceManager(_resourceManager));
|
||||
head.Add(Shape.HeadScripts().ResourceManager(_resourceManager));
|
||||
tail.Add(Shape.FootScripts().ResourceManager(_resourceManager));
|
||||
head.Add(_shapeFactory.Metas().ResourceManager(_resourceManager));
|
||||
head.Add(_shapeFactory.HeadLinks().ResourceManager(_resourceManager));
|
||||
head.Add(_shapeFactory.StylesheetLinks().ResourceManager(_resourceManager));
|
||||
head.Add(_shapeFactory.HeadScripts().ResourceManager(_resourceManager));
|
||||
tail.Add(_shapeFactory.FootScripts().ResourceManager(_resourceManager));
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using ClaySharp.Implementation;
|
||||
using System;
|
||||
using ClaySharp.Implementation;
|
||||
using Orchard.DisplayManagement;
|
||||
|
||||
namespace Orchard.UI.Zones {
|
||||
@@ -9,11 +10,12 @@ namespace Orchard.UI.Zones {
|
||||
_shapeFactory = shapeFactory;
|
||||
}
|
||||
|
||||
public T Get<T>(string name) {
|
||||
public Func<T> Get<T>(string name) {
|
||||
if (name == "Layout") {
|
||||
return (dynamic)_shapeFactory.Create("Layout", Arguments.Empty());
|
||||
var layout = _shapeFactory.Create("Layout", Arguments.Empty());
|
||||
return () => (T)layout;
|
||||
}
|
||||
return default(T);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user