--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-10-15 18:27:39 -07:00
110 changed files with 658 additions and 509 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,8 +7,8 @@ using Orchard.Core.Common.Models;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
namespace Orchard.Core.Common.DataMigrations {
public class CommonDataMigration : DataMigrationImpl {
namespace Orchard.Core.Common {
public class Migrations : DataMigrationImpl {
public int Create() {
//CREATE TABLE Common_BodyPartRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id));
SchemaBuilder.CreateTable("BodyPartRecord", table => table

View File

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

View File

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

View File

@@ -5,6 +5,10 @@ namespace Orchard.Core.Contents {
public class Shapes : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
builder.Describe("Content")
.OnCreated(created => {
var content = created.Shape;
content.Child.Add(created.New.PlaceChildContent(Source: content));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
@@ -16,6 +20,9 @@ namespace Orchard.Core.Contents {
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType);
//Content.Summary-Page
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.ContentType);
if (!displaying.ShapeMetadata.DisplayType.Contains("Admin"))
displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
}
});

View File

@@ -0,0 +1,11 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Contents;
@if (AuthorizedFor(Permissions.EditContent)) {
<div class="content-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Child)
</div>
}
else {
@Display(Model.Child)
}

View File

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

View File

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

View File

@@ -6,8 +6,8 @@ using Orchard.Core.Contents.Extensions;
using Orchard.Core.Localization.Models;
using Orchard.Data.Migration;
namespace Orchard.Core.Localization.DataMigrations {
public class LocalizationDataMigration : DataMigrationImpl {
namespace Orchard.Core.Localization {
public class Migrations : DataMigrationImpl {
public int Create() {
//CREATE TABLE Localization_LocalizedRecord (Id INTEGER not null, CultureId INTEGER, MasterContentItemId INTEGER, primary key (Id));

View File

@@ -1,7 +1,7 @@
using Orchard.Data.Migration;
namespace Orchard.Core.Messaging.DataMigrations {
public class MessagingDataMigration : DataMigrationImpl {
namespace Orchard.Core.Messaging {
public class Migrations : DataMigrationImpl {
public int Create() {
SchemaBuilder.CreateTable("MessageSettingsPartRecord", table => table

View File

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

View File

@@ -6,8 +6,8 @@ using Orchard.Core.Contents.Extensions;
using Orchard.Core.Navigation.Models;
using Orchard.Data.Migration;
namespace Orchard.Core.Navigation.DataMigrations {
public class NavigationDataMigration : DataMigrationImpl {
namespace Orchard.Core.Navigation {
public class Migrations : DataMigrationImpl {
public int Create() {
//CREATE TABLE Navigation_MenuItemRecord (Id INTEGER not null, Url TEXT, primary key (Id));

View File

@@ -66,7 +66,7 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Common\DataMigrations\CommonDataMigration.cs" />
<Compile Include="Common\Migrations.cs" />
<Compile Include="Common\Drivers\BodyPartDriver.cs" />
<Compile Include="Common\Drivers\CommonPartDriver.cs" />
<Compile Include="Common\Drivers\TextFieldDriver.cs" />
@@ -100,7 +100,7 @@
<Compile Include="Dashboard\Controllers\HelperController.cs" />
<Compile Include="Localization\ResourceManifest.cs" />
<Compile Include="Localization\ViewModels\EditLocalizationViewModel.cs" />
<Compile Include="Messaging\DataMigrations\MessagingDataMigration.cs" />
<Compile Include="Messaging\Migrations.cs" />
<Compile Include="Messaging\Drivers\MessageSettingsPartDriver.cs" />
<Compile Include="Messaging\Handlers\MessageSettingsPartHandler.cs" />
<Compile Include="Messaging\Models\MessageSettingsPart.cs" />
@@ -109,7 +109,7 @@
<Compile Include="Messaging\ViewModels\MessageSettingsPartViewModel.cs" />
<Compile Include="Navigation\Services\MainMenuNavigationProvider.cs" />
<Compile Include="PublishLater\ResourceManifest.cs" />
<Compile Include="PublishLater\DataMigrations\PublishLaterDataMigration.cs" />
<Compile Include="PublishLater\Migrations.cs" />
<Compile Include="PublishLater\Drivers\PublishLaterPartDriver.cs" />
<Compile Include="PublishLater\Models\PublishLaterPart.cs" />
<Compile Include="PublishLater\Handlers\PublishLaterPartHandler.cs" />
@@ -127,10 +127,10 @@
<Compile Include="Reports\Controllers\AdminController.cs" />
<Compile Include="Reports\Routes.cs" />
<Compile Include="Localization\Controllers\AdminController.cs" />
<Compile Include="Localization\DataMigrations\LocalizationDataMigration.cs" />
<Compile Include="Localization\Migrations.cs" />
<Compile Include="Localization\ViewModels\AddLocalizationViewModel.cs" />
<Compile Include="Localization\Drivers\LocalizationPartDriver.cs" />
<Compile Include="Navigation\DataMigrations\NavigationDataMigration.cs" />
<Compile Include="Navigation\Migrations.cs" />
<Compile Include="Reports\ViewModels\DisplayReportViewModel.cs" />
<Compile Include="Reports\ViewModels\ReportsAdminIndexViewModel.cs" />
<Compile Include="Routable\Controllers\ItemController.cs" />
@@ -204,7 +204,7 @@
<Compile Include="Routable\Services\RoutableService.cs" />
<Compile Include="Routable\ViewModels\RoutableEditorViewModel.cs" />
<Compile Include="Routable\ViewModels\RoutableDisplayViewModel.cs" />
<Compile Include="Scheduling\DataMigrations\SchedulingDataMigration.cs" />
<Compile Include="Scheduling\Migrations.cs" />
<Compile Include="Scheduling\Models\ScheduledTaskRecord.cs" />
<Compile Include="PublishLater\Handlers\PublishingTaskHandler.cs" />
<Compile Include="PublishLater\Services\PublishingTaskManager.cs" />
@@ -212,7 +212,7 @@
<Compile Include="Scheduling\Services\ScheduledTaskExecutor.cs" />
<Compile Include="Scheduling\Models\Task.cs" />
<Compile Include="Settings\ResourceManifest.cs" />
<Compile Include="Settings\DataMigrations\SettingsDataMigration.cs" />
<Compile Include="Settings\Migrations.cs" />
<Compile Include="Settings\Drivers\SiteSettingsPartDriver.cs" />
<Compile Include="Settings\ViewModels\SiteCulturesViewModel.cs" />
<Compile Include="Settings\Metadata\ContentDefinitionManager.cs" />
@@ -390,6 +390,7 @@
<Content Include="Dashboard\Views\Helper\Index.cshtml" />
<None Include="Common\Placement.info" />
<None Include="Contents\Placement.info" />
<None Include="Contents\Views\Content.ControlWrapper.cshtml" />
<None Include="Localization\Placement.info" />
<None Include="PublishLater\Placement.info" />
<None Include="Routable\Views\Parts\RoutableTitle.cshtml" />

View File

@@ -33,7 +33,7 @@ namespace Orchard.Core.PublishLater.Drivers {
protected override DriverResult Display(PublishLaterPart part, string displayType, dynamic shapeHelper) {
return Combined(
ContentShape("Parts_PublishLater_Metadata",
() => shapeHelper.Parts_PublishLater_Metadata(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
() => shapeHelper.Parts_PublishLater_Metadata(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
ContentShape("Parts_PublishLater_Metadata_Summary",
() => shapeHelper.Parts_PublishLater_Metadata_Summary(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
ContentShape("Parts_PublishLater_Metadata_SummaryAdmin",

View File

@@ -6,8 +6,8 @@ using Orchard.Core.Contents.Extensions;
using Orchard.Core.PublishLater.Models;
using Orchard.Data.Migration;
namespace Orchard.Core.PublishLater.DataMigrations {
public class PublishLaterDataMigration : DataMigrationImpl {
namespace Orchard.Core.PublishLater {
public class Migrations : DataMigrationImpl {
public int Create() {
ContentDefinitionManager.AlterPartDefinition(typeof(PublishLaterPart).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {

View File

@@ -0,0 +1,10 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Common.Models;
@using Orchard.Core.PublishLater.Models;
@{
PublishLaterPart publishLaterPart = Model.ContentPart;
DateTime? versionPublishedUtc = publishLaterPart.As<CommonPart>() == null ? null : publishLaterPart.As<CommonPart>().VersionPublishedUtc;
}
@if (publishLaterPart.IsPublished() && versionPublishedUtc.HasValue) {
@T("Published: {0}", Html.DateTimeRelative(versionPublishedUtc.Value, T)) @T(" | ")
}

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
using System;
using Orchard.Data.Migration;
namespace Orchard.Core.Scheduling.DataMigrations {
public class SchedulingDataMigration : DataMigrationImpl {
namespace Orchard.Core.Scheduling {
public class Migrations : DataMigrationImpl {
public int Create() {
//CREATE TABLE Scheduling_ScheduledTaskRecord (Id integer, TaskType TEXT, ScheduledUtc DATETIME, ContentItemVersionRecord_id INTEGER, primary key (Id));

View File

@@ -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) {

View File

@@ -1,8 +1,8 @@
using System.Data;
using Orchard.Data.Migration;
namespace Orchard.Core.Settings.DataMigrations {
public class SettingsDataMigration : DataMigrationImpl {
namespace Orchard.Core.Settings {
public class Migrations : DataMigrationImpl {
public int Create() {
//CREATE TABLE Settings_ContentFieldDefinitionRecord (Id integer, Name TEXT, primary key (Id));

View File

@@ -4,7 +4,7 @@ Author: The Orchard Team
Website: http://orchardproject.net
Version: 0.5.0
OrchardVersion: 0.5.0
Description: The Lucene module enables the site to be indexed usin Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site.
Description: The Lucene module enables the site to be indexed using Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site.
Features:
Lucene:
Description: Lucene indexing services.

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Data;
using Orchard.Blogs.Models;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
@@ -95,5 +96,13 @@ namespace Orchard.Blogs {
cfg => cfg.WithPart("BlogPagerPart"));
return 6;
}
public int UpdateFrom6() {
SchemaBuilder.AlterTable("BlogPartRecord", table => table
.AlterColumn("Description", c => c.WithType(DbType.String).Unlimited())
);
return 7;
}
}
}

View File

@@ -1,7 +1,9 @@
using Orchard.ContentManagement.Records;
using Orchard.Data.Conventions;
namespace Orchard.Blogs.Models {
public class BlogPartRecord : ContentPartRecord {
[StringLengthMax]
public virtual string Description { get; set; }
public virtual int PostCount { get; set; }
}

View File

@@ -21,6 +21,7 @@
<a href="@Url.BlogPostCreate((BlogPart)Model.ContentItem.Get(typeof(BlogPart)))" title="@T("New Post")">@T("New Post")</a>@T(" | ")
<a href="@Url.BlogEdit((string)Model.Slug)" title="@T("Edit")">@T("Edit")</a>@T(" | ")
<a href="Url.BlogRemove((string)Model.Slug)" title="@T("Remove")" itemprop="RemoveUrl UnsafeUrl">@T("Remove")</a>
<br />@Display(Model.Secondary)
</div>
@if (Model.Content != null) {
<div class="primary">@Display(Model.Content)</div>

View File

@@ -4,5 +4,5 @@
@using Orchard.Core.Common.Models;
@using Orchard.Core.Common.ViewModels;
<h2>@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h2>
<div class="meta">@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T) | @Display(Model.meta)</div>
<div class="meta">@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T) | @Display(Model.Meta)</div>
<div class="content">@Display(Model.Content)</div>

View File

@@ -10,12 +10,12 @@
<div class="properties">
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
<h3>@Html.Link((string)Model.Title, Url.BlogPostEdit((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h3>
<div class="metadata">@Display(Model.Meta)</div> <!-- was: metadata -->
<div class="metadata">@Display(Model.Meta)</div>
</div>
<div class="related">@Display(Model.Related) <!-- was: secondary -->
<div class="related">@Display(Model.Related)
@Html.Link(T("Edit").Text, Url.BlogPostEdit((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart)))) @T(" | ")
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
<br />@Display(Model.Secondary) <!-- was: meta -->
<br />@Display(Model.Secondary)
</div>
<div class="primary">@Display(Model.Content)</div>
</div>

View File

@@ -14,7 +14,8 @@ namespace Orchard.Comments.Drivers {
protected override string Prefix { get { return "CommentSettings"; } }
protected override DriverResult Editor(CommentSettingsPart part, dynamic shapeHelper) {
return ContentPartTemplate(part.Record, "Parts/Comments.SiteSettings");
return ContentShape("Parts_Comments_SiteSettings",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Comments.SiteSettings", Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(CommentSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -1,31 +1,40 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Orchard.Comments.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Models;
using Orchard.Core.ContentsLocation.Models;
namespace Orchard.Comments.Drivers {
[UsedImplicitly]
public class CommentsContainerPartDriver : ContentPartDriver<CommentsContainerPart> {
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
if (displayType.Contains("Summary")) {
// Find all contents item with this part as the container
var parts = part.ContentItem.ContentManager.Query()
.Where<CommonPartRecord>(rec => rec.Container == part.ContentItem.Record).List();
return Combined(
ContentShape("Parts_Comments_Count",
() => {
var childItems = GetChildItems(part);
return shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: GetCount(childItems), PendingCount: GetPendingCount(childItems));
}),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => {
var childItems = GetChildItems(part);
return shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: GetCount(childItems), PendingCount: GetPendingCount(childItems));
})
);
}
// Count comments and create template
int count = parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().Comments.Count : 0));
int pendingCount = parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().PendingComments.Count : 0));
private static IEnumerable<ContentItem> GetChildItems(CommentsContainerPart part) {
return part.ContentItem.ContentManager.Query()
.Where<CommonPartRecord>(rec => rec.Container == part.ContentItem.Record).List();
}
if (displayType == "SummaryAdmin")
return ContentShape(shapeHelper.Parts_Comments_CountAdmin(ContentPart: part, CommentCount: count, PendingCount: pendingCount)).Location(part.GetLocation("SummaryAdmin"));
private static int GetPendingCount(IEnumerable<ContentItem> parts) {
return parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().PendingComments.Count : 0));
}
return ContentShape(shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: count, PendingCount: pendingCount)).Location(part.GetLocation("Summary"));
}
return null;
private static int GetCount(IEnumerable<ContentItem> parts) {
return parts.Aggregate(0, (seed, item) => seed + (item.Has<CommentsPart>() ? item.As<CommentsPart>().Comments.Count : 0));
}
}
}

View File

@@ -2,7 +2,6 @@
using Orchard.Comments.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.ContentsLocation.Models;
namespace Orchard.Comments.Drivers {
[UsedImplicitly]
@@ -11,28 +10,24 @@ namespace Orchard.Comments.Drivers {
if (part.CommentsShown == false)
return null;
if (displayType.StartsWith("Detail"))
return ContentShape(shapeHelper.Parts_Comments_Comments(ContentPart: part)).Location("Content:10");
if (displayType == "SummaryAdmin")
return ContentShape(shapeHelper.Parts_Comments_CountAdmin(ContentPart: part, CommentCount: part.Comments.Count, PendingCount: part.PendingComments.Count))
.Location(part.GetLocation("SummaryAdmin"));
var location = displayType.Contains("Summary")
? part.GetLocation("Summary")
: part.GetLocation(displayType);
return ContentShape(shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: part.Comments.Count, PendingCount: part.PendingComments.Count))
.Location(location);
return Combined(
ContentShape("Parts_Comments",
() => shapeHelper.Parts_Comments(ContentPart: part)),
ContentShape("Parts_Comments_Count",
() => shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: part.Comments.Count, PendingCount: part.PendingComments.Count)),
ContentShape("Parts_Comments_Count_SummaryAdmin",
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: part.Comments.Count, PendingCount: part.PendingComments.Count))
);
}
protected override DriverResult Editor(CommentsPart part, dynamic shapeHelper) {
return ContentPartTemplate(part, "Parts/Comments.Comments").Location(part.GetLocation("Editor"));
return ContentShape("Parts_Comments_Enable",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Comments.Comments", Model: part, Prefix: Prefix));
}
protected override DriverResult Editor(CommentsPart part, IUpdateModel updater, dynamic shapeHelper) {
updater.TryUpdateModel(part, Prefix, null, null);
return ContentPartTemplate(part, "Parts/Comments.Comments").Location(part.GetLocation("Editor"));
return Editor(part, shapeHelper);
}
}
}

View File

@@ -127,13 +127,18 @@
<Content Include="Views\Admin\Details.cshtml" />
<Content Include="Views\Admin\Edit.cshtml" />
<Content Include="Views\Admin\Index.cshtml" />
<Content Include="Views\Parts\Comments.Comments.cshtml" />
<Content Include="Views\Parts\Comments.cshtml" />
<Content Include="Views\Parts\Comments.Count.cshtml" />
<Content Include="Views\Parts\Comments.CountAdmin.cshtml" />
<Content Include="Views\Parts\Comments.Count.SummaryAdmin.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Comments.Comments.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Comments.SiteSettings.cshtml" />
<Content Include="Views\ListOfComments.cshtml" />
</ItemGroup>
<ItemGroup>
<None Include="Placement.info">
<SubType>Designer</SubType>
</None>
</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.

View File

@@ -0,0 +1,20 @@
<Placement>
<!-- available display shapes -->
<!--
Parts_Comments
Parts_Comments_Count
Parts_Comments_Count_SummaryAdmin
-->
<!-- widget and edit shapes just get default placement -->
<!-- edit "shapes" -->
<Place Parts_Comments_Enable="Primary:10"/>
<Match DisplayType="Detail">
<Place Parts_Comments="Content:10" />
</Match>
<Match DisplayType="Summary">
<Place Parts_Comments_Count="Meta:5"/>
</Match>
<Match DisplayType="SummaryAdmin">
<Place Parts_Comments_Count_SummaryAdmin="Secondary"/>
</Match>
</Placement>

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
<Placement>
<Place Parts_Search_SiteSettings="Primary:1"/>
</Placement>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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) { }

View File

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

View File

@@ -8,13 +8,13 @@ namespace Orchard.Widgets {
builder.Describe("Widget")
.Configure(descriptor => {
// todo: have "alternates" for chrome
//todo: (heskew) something...this still doesn't feel right
descriptor.Wrappers.Add("Widget_ControlWrapper");
// todo: (heskew) something...this still doesn't feel right
descriptor.Wrappers.Add("Widget_Wrapper");
descriptor.Wrappers.Add("Widget_ControlWrapper");
})
.OnCreated(created => {
var widget = created.Shape;
widget.Main.Add(created.New.PlaceChildContent(Source: widget));
widget.Child.Add(created.New.PlaceChildContent(Source: widget));
})
.OnDisplaying(displaying => {
ContentItem contentItem = displaying.Shape.ContentItem;

View File

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

View File

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

View File

@@ -1,2 +1 @@
@Display(Model.Header)
@Display(Model.Content)
@Display(Model.Content)

View File

@@ -3,9 +3,9 @@
@if (AuthorizedFor(Permissions.ManageWidgets)) {
<div class="widget-control">
<div class="manage-actions">@Html.ItemEditLinkWithReturnUrl(T("Edit").Text, (ContentItem)Model.ContentItem)</div>
@Display(Model.Main)
@Display(Model.Child)
</div>
}
else {
@Display(Model.Main)
@Display(Model.Child)
}

View File

@@ -1,3 +1,17 @@
<div class="widget">
@Display.PlaceChildContent(Source: Model)
</div>
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<article class="widget">
<header>
<h1>@title</h1>
@Display(Model.Header)
</header>
@Display(Model.Child)
@if(Model.Footer != null) {
<footer>
@Display(Model.Footer)
</footer>
}
</article>

View File

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

View File

@@ -64,7 +64,6 @@
<Content Include="TheThemeMachine\Styles\Site.css" />
<Content Include="TheThemeMachine\Theme.png" />
<Content Include="TheThemeMachine\Theme.txt" />
<Content Include="TheThemeMachine\Views\Items\Widget-HtmlWidget.cshtml" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@@ -218,8 +217,10 @@
<Content Include="TheAdmin\Theme.png" />
<Content Include="TheAdmin\Views\User.cshtml" />
<Content Include="TheAdmin\Views\Header.cshtml" />
<Content Include="TheThemeMachine\Views\Items\Content.Blog.cshtml" />
<Content Include="TheThemeMachine\Views\Items\Widget-Content.cshtml" />
<Content Include="TheThemeMachine\Views\Items\BlogPost.Summary.cshtml" />
<Content Include="TheThemeMachine\Views\Items\BlogPost.cshtml">
<SubType>Designer</SubType>
</Content>
<None Include="TheThemeMachine\Views\Layout.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@@ -7,6 +7,7 @@ Copyright: 2010, Orchard. All Rights Reserved
/* Color Palette
**************************************************************
Background: #fff
Borders: #dbdbdb
Text: #434343
@@ -61,28 +62,30 @@ header, footer, aside, nav, article { display: block; }
/* Clearing Floats
***************************************************************/
.group:after
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.zone-asidethird:after
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* General
***************************************************************/
/* Default font settings.
The font-size 62.5% sets the base font to 10px */
body {
@@ -154,9 +157,10 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
/* Structure
***************************************************************/
#layout-wrapper
{
}
#layout-header, #layout-before-main, #layout-main, #layout-footer, #layout-after-main, #layout-tripel {
@@ -166,28 +170,33 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
#layout-header
{
margin: 30px auto;
margin: 30px auto;
}
#branding
{
font-family: 'Lobster', Tahoma, Arial, Helvetica, sans-serif;
font-size: 3.4em;
padding: 0;
margin: 0;
}
#branding
{
font-family: 'Lobster', Tahoma, Arial, Helvetica, sans-serif;
font-size: 3.4em;
padding: 0;
margin: 0;
}
#branding a
{
text-decoration:none;
color: #434343;
}
#branding a
{
text-decoration:none;
color: #434343;
}
#layout-tripel
{
border-top: 1px solid #dbdbdb;
}
#layout-before-main
{
border-bottom: 1px solid #dbdbdb;
}
#layout-main
{
border-top: 1px solid #fff;
@@ -195,17 +204,17 @@ pre,code,tt { font: 1em 'andale mono', 'lucida console', monospace; line-height:
#layout-after-main
{
border-top: 1px solid #dbdbdb;
}
/* Navigation */
#layout-navigation
{
width: 960px;
width: 960px;
margin: 0 auto;
display: block;
border-bottom: 1px solid #dbdbdb;
border-bottom: 1px solid #dbdbdb;
}
nav ul
@@ -213,41 +222,45 @@ nav ul
padding: 0px;
margin: 0px;
}
nav ul li
{
border:1px solid #dbdbdb;
background:#f6f6f6;
display:block;
float:left;
margin:0 2px -1px 0;
}
nav ul li.current
{
border-bottom: 1px solid #fff;
background:#fff;
}
nav ul a
{
padding:0 18px;
display:block;
float:left;
color: #333;
font-size:1.4em;
text-decoration:none;
line-height:24px;
}
nav ul li
{
border:1px solid #dbdbdb;
background:#f6f6f6;
display:block;
float:left;
margin:0 2px -1px 0;
}
nav ul li.current
{
border-bottom: 1px solid #fff;
background:#fff;
}
nav ul a
{
padding:0 18px;
display:block;
float:left;
color: #333;
font-size:1.4em;
text-decoration:none;
line-height:24px;
}
#layout-footer
{
border-top: 1px solid #dbdbdb;
border-top: 1px solid #dbdbdb;
}
#footer-sig
{
}
/* Zones */
/*.zone {
background-color: yellow;
box-shadow:inset 0 0 1px red;
-moz-box-shadow:inset 0 0 1px red;
-webkit-box-shadow:inset 0 0 1px red;
background-color: yellow;
box-shadow:inset 0 0 1px red;
-moz-box-shadow:inset 0 0 1px red;
-webkit-box-shadow:inset 0 0 1px red;
} Used for visualizing zones */
.zone-header { }
.zone-footer { padding: 24px 0 12px 0px; float: left; font-size: 1.3em; color: #999999; }
@@ -255,6 +268,7 @@ nav ul
.zone-asidethird { padding: 0 0 6px 0; }
/* Main
***************************************************************/
@@ -267,7 +281,7 @@ nav ul
.has-aside-two .aside-second
{
width: 360px;
width: 360px;
float: right;
}
@@ -287,69 +301,64 @@ nav ul
}
.has-asides .aside-first, .has-asides .aside-second
{
width: 180px;
width: 180px;
}
.has-asides .aside-first, .has-asides .aside-second, .has-asides #layout-content
{
float:left;
float:left;
}
/* Blogs */
.blog-post {}
.blog-post-title {}
.meta {}
/* 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;
display: block;
padding:6px;
width:50%;
input[type="text"], input[type="password"] {
display: block;
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;
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;
background:#F5F5F5;
background: -webkit-gradient(linear, left top, left bottom, from(#F5F5F5), to(#cbcbcb));
background:-moz-linear-gradient(top , #F5F5F5, #cbcbcb);
border:1px solid #999;
cursor:pointer;
margin:.2em 0 2em 0;
margin:.2em 0 2em 0;
padding:.3em 1.8em;
text-align:center;
}
@@ -360,11 +369,12 @@ input[type="submit"]:focus, input[type="button"]:focus,
button:hover, .button:hover,
button:active, .button:active,
button:focus, .button:focus {
text-decoration:none;
background: #ebebeb;
background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#ebebeb));
text-decoration:none;
background: #ebebeb;
background: -webkit-gradient(linear, left top, left bottom, from(#e1e1e1), to(#ebebeb));
background:-moz-linear-gradient(top , #e1e1e1, #ebebeb);
}
*/
@@ -402,81 +412,62 @@ 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;
}
article.comment a {
color:#484848;
text-decoration:none;
color:#484848;
text-decoration:none;
}
article.comment span.who {
font-weight:600;
font-style:normal;
text-transform:capitalize;
color:#333;
font-weight:600;
font-style:normal;
text-transform:capitalize;
color:#333;
}
article.comment p.text {
margin:.6em 0 2.4em 0;
margin:.6em 0 2.4em 0;
}
.user-display {
display:inline;
display:inline;
}
.aside.third {
border-top:1px solid #dbdbdb;
clear:both;
}
/*.aside.third {
border-top:1px solid #dbdbdb;
clear:both;
}*/
#layout-tripel div > div {
float:left;
width:316px;
/*padding:12px 6px 0 6px;*/
}
#footer-quad div.zone {
float:left;
width:240px;
/*padding:12px 6px 0 6px;*/
float:left;
width:240px;
/*padding:12px 6px 0 6px;*/
}
/* Featured Zone - switch to an image */
.featuredimage {
float:left;
border: 1px solid #dbdbdb;
width: 462px;
height: 240px;
margin: 6px;
float:left;
border: 1px solid #dbdbdb;
width: 462px;
height: 240px;
margin: 6px;
}
/* Recent Zone */
#zone-recent ul li {
float:left;
width: 462px;
margin: 6px;
float:left;
width: 462px;
margin: 6px;
}
.clearfix {
@@ -484,17 +475,81 @@ article.comment p.text {
}
#footer div {
/*border:1px solid #ff0000;*/
/*border:1px solid #ff0000;*/
}
/* If zone 1 is empty and 2, 3, 4 are not */
/* Tripel */
#layout-tripel div {
float:left;
width:960px;
/*padding:12px 6px 0 6px;*/
}
/*2 zones on */
/* If zones 1, 2 are on */
.tripel-12 #layout-tripel div { width:480px; }
/* If zones 2, 3 are on */
.tripel-23 #layout-tripel div { width:480px; }
/* If zones 1, 3 are on */
.tripel-13 #layout-tripel div { width:480px; }
/*3 zones on */
/* If zones 1, 2, 3 are on */
.tripel-123 #layout-tripel div { width:320px; }
/* Quad */
/*1 zone on */
/* If zone 1 is on */
.split-1 #footer-quad-first div.zone { width:960px; }
/* If zone 2 is on */
.split-2 #footer-quad-second div.zone { width:960px; }
/* If zone 3 is on */
.split-3 #footer-quad-third div.zone { width:960px; }
/* If zone 4 is on */
.split-4 #footer-quad-fourth div.zone { width:960px; }
/*2 zones on */
/* If zones 1, 2 are on */
.split-12 #footer-quad-first div.zone, .split-12 #footer-quad-second div.zone { width:480px; }
/* If zones 1, 3 are on */
.split-13 #footer-quad-first div.zone, .split-13 #footer-quad-third div.zone { width:480px; }
/* If zones 1, 4 are on */
.split-14 #footer-quad-first div.zone, .split-14 #footer-quad-fourth div.zone { width:480px; }
/* If zones 2, 3 are on */
.split-23 #footer-quad-second div.zone, .split-23 #footer-quad-third div.zone { width:480px; }
/* If zones 2, 4 are on */
.split-24 #footer-quad-second div.zone, .split-24 #footer-quad-fourth div.zone { width:480px; }
/* If zones 3, 4 are on */
.split-34 #footer-quad-third div.zone, .split-34 #footer-quad-fourth div.zone { width:480px; }
/*3 zones on */
/* If zones 2, 3, 4 are on */
.split-234 #footer-quad-second div.zone { width:480px; }
/* If zone 2 is empty and 1, 3, 4 are not */
/* If zones 1, 3, 4 are on */
.split-134 #footer-quad-first div.zone { width:480px; }
/* If zone 3 is empty and 1, 2, 4 are not */
/* If zones 1, 2, 4 are on */
.split-124 #footer-quad-fourth div.zone { width:480px; }
/* If zone 4 is empty and 1, 2, 3 are not */
/* If zones 1, 2, 3 are on */
.split-123 #footer-quad-third div.zone { width:480px; }

View File

@@ -4,4 +4,4 @@ Description: It's a *really* good theme, yo.
Version: 0.1
Tags: Awesome
Website: http://orchardproject.net
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond, AsideThird
Zones: Header, Navigation, Featured, BeforeMain, Messages, BeforeContent, Content, AfterContent, AfterMain, TripelFirst, TripelSecond, TripelThird, FooterQuadFirst, FooterQuadSecond, FooterQuadThird, FooterQuadFourth, Footer, AsideFirst, AsideSecond

View File

@@ -0,0 +1,15 @@
@using Orchard.Blogs.Extensions;
@using Orchard.Blogs.Models;
@using Orchard.Core.Common.Extensions;
@using Orchard.Core.Common.Models;
@using Orchard.Core.Common.ViewModels;
<h2>@Html.Link((string)Model.Title, Url.BlogPost((BlogPostPart)Model.ContentItem.Get(typeof(BlogPostPart))))</h2>
<!-- TODO: Meta should be it's own shape and not part of the blog summary view. Theme authors will need access to it. -->
<div class="meta">
@Html.PublishedState(new CommonMetadataViewModel((CommonPart)Model.ContentItem.Get(typeof(CommonPart))), T)
@Display(Model.meta)
</div>
<div class="content">@Display(Model.Content)</div>

View File

@@ -0,0 +1,11 @@
<div class="blog-post @Display(Model.Slug)">
<h1 class="blog-post-title">@Html.TitleForPage((string)Model.Title)</h1>
@if (Model.Meta != null) {
<div class="meta">
@Display(Model.Meta)
</div>
}
<div class="content">
@Display(Model.Content)
</div>
</div>

View File

@@ -1,10 +0,0 @@
@using Orchard.Blogs.Extensions;
@using Orchard.UI.Resources;
@{
RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest((string)Model.Slug) });
RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd((string)Model.Slug) });
}
<h1>@Html.TitleForPage((string)Model.Title)</h1>
@Display(Model.manage)
@Display(Model.metadata)
@Display(Model.Primary)

View File

@@ -1,17 +0,0 @@
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<article>
<header>
<h1>@title</h1>
@Display(Model.Header)
</header>
@Display(Model.Content)
@if(Model.Footer != null) {
<footer>
@Display(Model.Footer)
</footer>
}
</article>

View File

@@ -1,11 +0,0 @@
@using Orchard.ContentManagement;
@using Orchard.Widgets.Models;
@{
var title = ((IContent)Model.ContentItem).As<WidgetPart>().Title;
}
<div>
<h1>@title</h1>
@Display(Model.Header)
@Display(Model.Content)
@Display(Model.Footer)
</div>

View File

@@ -47,10 +47,6 @@
Model.Classes.Add(footerQuadClass);
}
@*<span>debug: </span>*@
@*<span>tripelClass:@tripelClass</span>*@
@*<span>footerQuadClass:@footerQuadClass</span>*@
Model.Id = "layout-wrapper";
var tag = Tag (Model, "div");

View File

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

View File

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

View File

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

View File

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

View File

@@ -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) {
}
}
}

View File

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

View File

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

View File

@@ -1,5 +0,0 @@
namespace Orchard.DisplayManagement {
public interface IShapeHelperFactory : IDependency {
dynamic CreateHelper();
}
}

View File

@@ -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>>()

View File

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

View File

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

View File

@@ -81,10 +81,9 @@ namespace Orchard.Environment {
return _lifetimeScope.BeginLifetimeScope("work", configurationAction);
}
class WorkContextImplementation : WorkContext {
readonly IComponentContext _componentContext;
readonly ConcurrentDictionary<string, object> _state = new ConcurrentDictionary<string, object>();
readonly ConcurrentDictionary<string, Func<object>> _stateResolvers = new ConcurrentDictionary<string, Func<object>>();
readonly IEnumerable<IWorkContextStateProvider> _workContextStateProviders;
public WorkContextImplementation(IComponentContext componentContext) {
@@ -97,19 +96,27 @@ namespace Orchard.Environment {
}
public override T GetState<T>(string name) {
return (T)_state.GetOrAdd(name, x => GetStateInternal<T>(x));
var resolver = _stateResolvers.GetOrAdd(name, FindResolverForState<T>);
return (T)resolver();
}
private T GetStateInternal<T>(string name) {
return _workContextStateProviders.Select(wcsp => wcsp.Get<T>(name))
Func<object> FindResolverForState<T>(string name) {
var resolver = _workContextStateProviders.Select(wcsp => wcsp.Get<T>(name))
.FirstOrDefault(value => !Equals(value, default(T)));
if (resolver == null) {
return () => default(T);
}
return () => resolver();
}
public override void SetState<T>(string name, T value) {
_state[name] = value;
_stateResolvers[name] = () => value;
}
}
class HttpContextScopeImplementation : IWorkContextScope {
readonly WorkContext _workContext;
readonly Action _disposer;

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,6 +14,7 @@ namespace Orchard.Mvc {
ScriptRegister Script { get; }
ResourceRegister Style { get; }
dynamic Display { get; }
dynamic Layout { get; }
IHtmlString DisplayChildren(object shape);
WorkContext WorkContext { get; }
IDisposable Capture(Action<IHtmlString> callback);

Some files were not shown because too many files have changed in this diff Show More