mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 21:13:35 +08:00
Fixing feature name for RulesHandler
--HG-- branch : 1.x
This commit is contained in:
@@ -7,16 +7,13 @@ using Orchard.Events;
|
||||
|
||||
namespace Orchard.Core.Contents.Handlers {
|
||||
|
||||
public interface IRulesManager : IEventHandler
|
||||
{
|
||||
public interface IRulesManager : IEventHandler {
|
||||
void TriggerEvent(string category, string type, Func<Dictionary<string, object>> tokensContext);
|
||||
}
|
||||
|
||||
[OrchardFeature("Orchard.Core.Contents.Rules")]
|
||||
public class RulePartHandler : ContentHandler
|
||||
{
|
||||
public RulePartHandler(IRulesManager rulesManager)
|
||||
{
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class RulePartHandler : ContentHandler {
|
||||
public RulePartHandler(IRulesManager rulesManager) {
|
||||
|
||||
OnPublished<ContentPart>(
|
||||
(context, part) =>
|
||||
|
@@ -14,4 +14,4 @@ Features:
|
||||
Name: Contents Rules
|
||||
Description: Rules for the Contents modules
|
||||
Category: Rules
|
||||
Dependency: Rules
|
||||
Dependency: Orchard.Rules, Contents
|
||||
|
@@ -5,20 +5,16 @@ using Orchard.Environment.Extensions;
|
||||
using Orchard.Events;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Contents.Rules
|
||||
{
|
||||
public interface IEventProvider : IEventHandler
|
||||
{
|
||||
namespace Orchard.Core.Contents.Rules {
|
||||
public interface IEventProvider : IEventHandler {
|
||||
void Describe(dynamic describe);
|
||||
}
|
||||
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class ContentEvents : IEventProvider
|
||||
{
|
||||
public class ContentEvents : IEventProvider {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Describe(dynamic describe)
|
||||
{
|
||||
public void Describe(dynamic describe) {
|
||||
Func<dynamic, bool> contentHasPart = ContentHasPart;
|
||||
|
||||
describe.For("Content", T("Content Items"), T("Content Items"))
|
||||
@@ -28,31 +24,26 @@ namespace Orchard.Core.Contents.Rules
|
||||
.Element("Removed", T("Content Removed"), T("Content is actually removed."), contentHasPart, (Func<dynamic, LocalizedString>)(context => T("When content with types ({0}) is removed.", FormatPartsList(context))), "SelectContentTypes");
|
||||
}
|
||||
|
||||
private string FormatPartsList(dynamic context)
|
||||
{
|
||||
private string FormatPartsList(dynamic context) {
|
||||
var contenttypes = context.Properties["contenttypes"];
|
||||
|
||||
if(String.IsNullOrEmpty(contenttypes))
|
||||
{
|
||||
if (String.IsNullOrEmpty(contenttypes)) {
|
||||
return T("Any").Text;
|
||||
}
|
||||
|
||||
return contenttypes;
|
||||
}
|
||||
|
||||
private static bool ContentHasPart(dynamic context)
|
||||
{
|
||||
private static bool ContentHasPart(dynamic context) {
|
||||
string contenttypes = context.Properties["contenttypes"];
|
||||
var content = context.Tokens["Content"] as IContent;
|
||||
|
||||
// "" means 'any'
|
||||
if(String.IsNullOrEmpty(contenttypes))
|
||||
{
|
||||
if (String.IsNullOrEmpty(contenttypes)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(content == null)
|
||||
{
|
||||
if (content == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -6,30 +6,25 @@ using Orchard.Environment.Extensions;
|
||||
using Orchard.Events;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Core.Contents.Rules
|
||||
{
|
||||
public interface IFormProvider : IEventHandler
|
||||
{
|
||||
namespace Orchard.Core.Contents.Rules {
|
||||
public interface IFormProvider : IEventHandler {
|
||||
void Describe(dynamic context);
|
||||
}
|
||||
|
||||
[OrchardFeature("Contents.Rules")]
|
||||
public class ContentForms : IFormProvider
|
||||
{
|
||||
public class ContentForms : IFormProvider {
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
protected dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ContentForms(
|
||||
IShapeFactory shapeFactory,
|
||||
IContentDefinitionManager contentDefinitionManager)
|
||||
{
|
||||
IContentDefinitionManager contentDefinitionManager) {
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
public void Describe(dynamic context)
|
||||
{
|
||||
public void Describe(dynamic context) {
|
||||
Func<IShapeFactory, dynamic> form =
|
||||
shape => {
|
||||
|
||||
@@ -46,8 +41,7 @@ namespace Orchard.Core.Contents.Rules
|
||||
|
||||
f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });
|
||||
|
||||
foreach (var contentType in _contentDefinitionManager.ListTypeDefinitions())
|
||||
{
|
||||
foreach (var contentType in _contentDefinitionManager.ListTypeDefinitions()) {
|
||||
f._Parts.Add(new SelectListItem { Value = contentType.Name, Text = contentType.DisplayName });
|
||||
}
|
||||
|
||||
|
@@ -15,4 +15,4 @@ Features:
|
||||
Name: Comments Rules
|
||||
Description: Rules for the Comments modules
|
||||
Category: Rules
|
||||
Dependency: Rules
|
||||
Dependency: Orchard.Comments, Orchard.Rules
|
Reference in New Issue
Block a user