mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Creating Close Comment activity
--HG-- branch : 1.x
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Workflows.Models;
|
||||
using Orchard.Workflows.Services;
|
||||
|
||||
namespace Orchard.Workflows.Activities {
|
||||
public class CloseCommentsActivity : Task {
|
||||
|
||||
public CloseCommentsActivity() {
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
public override string Name {
|
||||
get { return "CloseComments"; }
|
||||
}
|
||||
|
||||
public override LocalizedString Category {
|
||||
get { return T("Comments"); }
|
||||
}
|
||||
|
||||
public override LocalizedString Description {
|
||||
get { return T("Closes the comments on the currently processed content item."); }
|
||||
}
|
||||
|
||||
public override string Form {
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override IEnumerable<LocalizedString> GetPossibleOutcomes(WorkflowContext workflowContext, ActivityContext activityContext) {
|
||||
return new[] {T("Done")};
|
||||
}
|
||||
|
||||
public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
|
||||
var content = workflowContext.Content;
|
||||
|
||||
if (content != null) {
|
||||
var comments = content.As<CommentsPart>();
|
||||
if (comments != null) {
|
||||
comments.CommentsActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
yield return T("Done");
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,4 +9,4 @@ Description: Description for the module
|
||||
Features:
|
||||
Orchard.Workflows:
|
||||
Description: Description for feature Orchard.Workflows.
|
||||
Dependencies: Orchard.Tokens, Orchard.Forms, Orchard.jQuery, Orchard.Roles
|
||||
Dependencies: Orchard.Tokens, Orchard.Forms, Orchard.jQuery, Orchard.Roles, Orchard.Comments
|
@@ -71,6 +71,7 @@
|
||||
<Content Include="Scripts\jquery.jsPlumb-1.3.16-all-min.js" />
|
||||
<Content Include="Scripts\orchard-workflows-serialize.js" />
|
||||
<Content Include="Scripts\orchard-workflows.js" />
|
||||
<Content Include="Styles\workflows-activity.css" />
|
||||
<Content Include="Styles\images\cog.png" />
|
||||
<Content Include="Styles\workflows-activity-delete-publish.css" />
|
||||
<Content Include="Styles\workflows-activity-timer.css" />
|
||||
@@ -103,6 +104,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Comments\Orchard.Comments.csproj">
|
||||
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||
<Name>Orchard.Comments</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Forms\Orchard.Forms.csproj">
|
||||
<Project>{642a49d7-8752-4177-80d6-bfbbcfad3de0}</Project>
|
||||
<Name>Orchard.Forms</Name>
|
||||
@@ -120,6 +125,7 @@
|
||||
<Compile Include="Activities\ContentActivity.cs" />
|
||||
<Compile Include="Activities\BranchActivity.cs" />
|
||||
<Compile Include="Activities\AssignRoleActivity.cs" />
|
||||
<Compile Include="Activities\CloseCommentsActivity.cs" />
|
||||
<Compile Include="Activities\MergeBranchActivity.cs" />
|
||||
<Compile Include="Activities\DeleteActivity.cs" />
|
||||
<Compile Include="Activities\ExclusiveBranchActivity.cs" />
|
||||
|
Reference in New Issue
Block a user