mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-20 02:37:55 +08:00
Adding Comments Rules actions
--HG-- branch : 1.x
This commit is contained in:
@@ -5,6 +5,14 @@ Website: http://orchardproject.net
|
||||
Version: 1.2.0
|
||||
OrchardVersion: 1.2.0
|
||||
Description: The comments system implemented by this module can be applied to arbitrary Orchard content types, such as blogs and pages. It includes comment validation and spam protection through the Akismet service.
|
||||
FeatureDescription: Standard content item comments.
|
||||
Dependencies: Settings
|
||||
Category: Social
|
||||
Features:
|
||||
Orchard.Comments:
|
||||
Name: Comments
|
||||
Description: Standard content item comments.
|
||||
Dependencies: Settings
|
||||
Category: Social
|
||||
Orchard.Comments.Rules:
|
||||
Name: Comments Rules
|
||||
Description: Rules for the Comments modules
|
||||
Dependencies: Orchard.Rules, Orchard.Forms
|
||||
Category: Rules
|
||||
|
@@ -69,6 +69,8 @@
|
||||
<Compile Include="Drivers\CommentsPartDriver.cs" />
|
||||
<Compile Include="Annotations\CommentValidationAttributes.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Rules\CommentsActions.cs" />
|
||||
<Compile Include="Rules\CommentsForms.cs" />
|
||||
<Compile Include="Shapes.cs" />
|
||||
<Compile Include="Models\CommentPart.cs" />
|
||||
<Compile Include="Handlers\CommentPartHandler.cs" />
|
||||
@@ -115,6 +117,14 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Forms\Orchard.Forms.csproj">
|
||||
<Project>{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}</Project>
|
||||
<Name>Orchard.Forms</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Rules\Orchard.Rules.csproj">
|
||||
<Project>{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}</Project>
|
||||
<Name>Orchard.Rules</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\Edit.cshtml" />
|
||||
|
@@ -32,4 +32,3 @@ using System.Security;
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0")]
|
||||
[assembly: SecurityTransparent]
|
||||
|
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Rules.Models;
|
||||
using Orchard.Rules.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Comments.Rules
|
||||
{
|
||||
[OrchardFeature("Orchard.Comments.Rules")]
|
||||
public class CommentsActions : IActionProvider
|
||||
{
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public CommentsActions(IContentManager contentManager)
|
||||
{
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Describe(DescribeActionContext context)
|
||||
{
|
||||
context.For("Comments", T("Comments"), T("Comments"))
|
||||
.Element("Close", T("Close Comments"), T("Closes comments on a content item."), Close, actionContext => T("Close comments"), "ActionCloseComments");
|
||||
}
|
||||
|
||||
private void Close(ActionContext context)
|
||||
{
|
||||
var contentId = Convert.ToInt32(context.Properties["ContentId"]);
|
||||
var content = _contentManager.Get(contentId);
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
var comments = content.As<CommentsPart>();
|
||||
if (comments != null)
|
||||
{
|
||||
comments.CommentsActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Forms.Services;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Comments.Rules
|
||||
{
|
||||
[OrchardFeature("Orchard.Comments.Rules")]
|
||||
public class CommentsForms : IFormProvider
|
||||
{
|
||||
protected dynamic Shape { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public CommentsForms(IShapeFactory shapeFactory)
|
||||
{
|
||||
Shape = shapeFactory;
|
||||
}
|
||||
|
||||
public void Describe(DescribeContext context)
|
||||
{
|
||||
context.Form("ActionCloseComments",
|
||||
shape => Shape.Form(
|
||||
Id: "ActionCloseComments",
|
||||
_Type: Shape.Textbox(
|
||||
Id: "ContentId", Name: "ContentId",
|
||||
Title: T("Content Item Id"),
|
||||
Description: T("Content Item Id."))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -114,6 +114,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Warmup", "Orchard.W
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.WarmupStarter", "Orchard.Startup\Orchard.WarmupStarter.csproj", "{5C0D5249-AEF5-4BB6-8F5F-057B91AC2D7A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tokens", "Orchard.Web\Modules\Orchard.Tokens\Orchard.Tokens.csproj", "{6F759635-13D7-4E94-BCC9-80445D63F117}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Forms", "Orchard.Web\Modules\Orchard.Forms\Orchard.Forms.csproj", "{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Rules", "Orchard.Web\Modules\Orchard.Rules\Orchard.Rules.csproj", "{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CodeCoverage|Any CPU = CodeCoverage|Any CPU
|
||||
@@ -604,6 +610,36 @@ Global
|
||||
{5C0D5249-AEF5-4BB6-8F5F-057B91AC2D7A}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{5C0D5249-AEF5-4BB6-8F5F-057B91AC2D7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5C0D5249-AEF5-4BB6-8F5F-057B91AC2D7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -644,6 +680,9 @@ Global
|
||||
{FC1D74E8-7A4D-48F4-83DE-95C6173780C4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{FE5C5947-D2D5-42C5-992A-13D672946135} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{9CD5C81F-5828-4384-8474-2E2BE71D5EDD} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{6F759635-13D7-4E94-BCC9-80445D63F117} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{642A49D7-8752-4177-80D6-BFBBCFAD3DE0} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{966EC390-3C7F-4D98-92A6-F0F30D02E9B1} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
|
Reference in New Issue
Block a user