Moving content rules to the rules module

This commit is contained in:
Sebastien Ros 2013-09-05 16:46:53 -07:00
parent 887e02c38a
commit 0ea0077fa3
4 changed files with 106 additions and 112 deletions

View File

@ -113,8 +113,6 @@
<Compile Include="Containers\ViewModels\ContainerViewModel.cs" /> <Compile Include="Containers\ViewModels\ContainerViewModel.cs" />
<Compile Include="Contents\ControlWrapper.cs" /> <Compile Include="Contents\ControlWrapper.cs" />
<Compile Include="Contents\Handlers\RulesHandler.cs" /> <Compile Include="Contents\Handlers\RulesHandler.cs" />
<Compile Include="Contents\Rules\ContentEvents.cs" />
<Compile Include="Contents\Rules\ContentForms.cs" />
<Compile Include="Contents\Security\AuthorizationEventHandler.cs" /> <Compile Include="Contents\Security\AuthorizationEventHandler.cs" />
<Compile Include="Common\Services\BbcodeFilter.cs" /> <Compile Include="Common\Services\BbcodeFilter.cs" />
<Compile Include="Common\Services\ICommonService.cs" /> <Compile Include="Common\Services\ICommonService.cs" />

View File

@ -138,6 +138,8 @@
<Compile Include="Models\TypeDescriptor.cs" /> <Compile Include="Models\TypeDescriptor.cs" />
<Compile Include="Migrations.cs" /> <Compile Include="Migrations.cs" />
<Compile Include="Models\RuleRecord.cs" /> <Compile Include="Models\RuleRecord.cs" />
<Compile Include="Providers\ContentEvents.cs" />
<Compile Include="Providers\ContentForms.cs" />
<Compile Include="Providers\ScheduleForms.cs" /> <Compile Include="Providers\ScheduleForms.cs" />
<Compile Include="Providers\ScheduleActions.cs" /> <Compile Include="Providers\ScheduleActions.cs" />
<Compile Include="Providers\NotificationForms.cs" /> <Compile Include="Providers\NotificationForms.cs" />

View File

@ -1,14 +1,11 @@
using System; using System;
using System.Linq; using System.Linq;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Events;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Rules.Models;
using Orchard.Rules.Services;
namespace Orchard.Core.Contents.Rules { namespace Orchard.Rules.Providers {
public interface IEventProvider : IEventHandler {
void Describe(dynamic describe);
}
public class ContentEvents : IEventProvider { public class ContentEvents : IEventProvider {
public ContentEvents() { public ContentEvents() {
T = NullLocalizer.Instance; T = NullLocalizer.Instance;
@ -16,7 +13,7 @@ namespace Orchard.Core.Contents.Rules {
public Localizer T { get; set; } public Localizer T { get; set; }
public void Describe(dynamic describe) { public void Describe(DescribeEventContext describe) {
Func<dynamic, bool> contentHasPart = ContentHasPart; Func<dynamic, bool> contentHasPart = ContentHasPart;
describe.For("Content", T("Content Items"), T("Content Items")) describe.For("Content", T("Content Items"), T("Content Items"))

View File

@ -3,13 +3,10 @@ using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using Orchard.ContentManagement.MetaData; using Orchard.ContentManagement.MetaData;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Events; using Orchard.Forms.Services;
using Orchard.Localization; using Orchard.Localization;
namespace Orchard.Core.Contents.Rules { namespace Orchard.Rules.Providers {
public interface IFormProvider : IEventHandler {
void Describe(dynamic context);
}
public class ContentForms : IFormProvider { public class ContentForms : IFormProvider {
private readonly IContentDefinitionManager _contentDefinitionManager; private readonly IContentDefinitionManager _contentDefinitionManager;
@ -24,14 +21,14 @@ namespace Orchard.Core.Contents.Rules {
T = NullLocalizer.Instance; T = NullLocalizer.Instance;
} }
public void Describe(dynamic context) { public void Describe(DescribeContext context) {
Func<IShapeFactory, dynamic> form = Func<IShapeFactory, dynamic> form =
shape => { shape => {
var f = Shape.Form( var f = Shape.Form(
Id: "AnyOfContentTypes", Id: "AnyOfContentTypes",
_Parts: Shape.SelectList( _Parts: Shape.SelectList(
Id: "contenttypes", Name: "contenttypes", Id: "contenttypes", Name: "ContentTypes",
Title: T("Content types"), Title: T("Content types"),
Description: T("Select some content types."), Description: T("Select some content types."),
Size: 10, Size: 10,