forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add content workflow tab action buttons in edit mode dnnsoftware#6115
- Loading branch information
Showing
15 changed files
with
460 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/CompleteStateMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Dnn.EditBar.UI.Items | ||
{ | ||
using System; | ||
|
||
using Dnn.EditBar.Library; | ||
using Dnn.EditBar.Library.Items; | ||
using DotNetNuke.Application; | ||
using DotNetNuke.Entities.Content.Common; | ||
using DotNetNuke.Entities.Content.Workflow; | ||
using DotNetNuke.Entities.Portals; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Security.Permissions; | ||
using DotNetNuke.Services.Personalization; | ||
|
||
[Serializable] | ||
public class CompleteStateMenu : BaseMenuItem | ||
{ | ||
/// <inheritdoc/> | ||
public override string Name { get; } = "CompleteState"; | ||
|
||
/// <inheritdoc/> | ||
public override string Text => "Submit"; | ||
|
||
/// <inheritdoc/> | ||
public override string CssClass => string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Template { get; } = string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Parent { get; } = Constants.LeftMenu; | ||
|
||
/// <inheritdoc/> | ||
public override string Loader { get; } = "CompleteState"; | ||
|
||
/// <inheritdoc/> | ||
public override int Order { get; } = 77; | ||
|
||
/// <inheritdoc/> | ||
public override bool Visible() | ||
{ | ||
var contentItem = Util.GetContentController().GetContentItem(TabController.CurrentPage.ContentItemId); | ||
return Personalization.GetUserMode() == PortalSettings.Mode.Edit | ||
&& DotNetNukeContext.Current.Application.SKU == "DNN" // IsPlatform | ||
&& TabWorkflowSettings.Instance.IsWorkflowEnabled(PortalSettings.Current.PortalId) // workflow is enabled | ||
&& ((WorkflowEngine.Instance.IsWorkflowOnDraft(contentItem) && PermissionProvider.Instance().CanAddContentToPage(TabController.CurrentPage)) | ||
|| (!WorkflowEngine.Instance.IsWorkflowCompleted(contentItem) && WorkflowSecurity.Instance.HasStateReviewerPermission(contentItem.StateID))); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/CompleteWorkflowMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Dnn.EditBar.UI.Items | ||
{ | ||
using System; | ||
|
||
using Dnn.EditBar.Library; | ||
using Dnn.EditBar.Library.Items; | ||
using DotNetNuke.Application; | ||
using DotNetNuke.Entities.Content.Common; | ||
using DotNetNuke.Entities.Content.Workflow; | ||
using DotNetNuke.Entities.Portals; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Services.Personalization; | ||
|
||
[Serializable] | ||
public class CompleteWorkflowMenu : BaseMenuItem | ||
{ | ||
/// <inheritdoc/> | ||
public override string Name { get; } = "CompleteWorkflow"; | ||
|
||
/// <inheritdoc/> | ||
public override string Text => "Approve"; | ||
|
||
/// <inheritdoc/> | ||
public override string CssClass => string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Template { get; } = string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Parent { get; } = Constants.LeftMenu; | ||
|
||
/// <inheritdoc/> | ||
public override string Loader { get; } = "CompleteWorkflow"; | ||
|
||
/// <inheritdoc/> | ||
public override int Order { get; } = 79; | ||
|
||
/// <inheritdoc/> | ||
public override bool Visible() | ||
{ | ||
var contentItem = Util.GetContentController().GetContentItem(TabController.CurrentPage.ContentItemId); | ||
return Personalization.GetUserMode() == PortalSettings.Mode.Edit | ||
&& DotNetNukeContext.Current.Application.SKU == "DNN" // IsPlatform | ||
&& TabWorkflowSettings.Instance.IsWorkflowEnabled(PortalSettings.Current.PortalId) // workflow is enabled | ||
&& !WorkflowEngine.Instance.IsWorkflowCompleted(contentItem) // tab has new version that is not published | ||
&& WorkflowSecurity.Instance.HasStateReviewerPermission(contentItem.StateID); // user has workflow approval permission | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/DiscardStateMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Dnn.EditBar.UI.Items | ||
{ | ||
using System; | ||
|
||
using Dnn.EditBar.Library; | ||
using Dnn.EditBar.Library.Items; | ||
using DotNetNuke.Application; | ||
using DotNetNuke.Entities.Content.Common; | ||
using DotNetNuke.Entities.Content.Workflow; | ||
using DotNetNuke.Entities.Portals; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Security.Permissions; | ||
using DotNetNuke.Services.Personalization; | ||
|
||
[Serializable] | ||
public class DiscardStateMenu : BaseMenuItem | ||
{ | ||
/// <inheritdoc/> | ||
public override string Name { get; } = "DiscardState"; | ||
|
||
/// <inheritdoc/> | ||
public override string Text => "Discard"; | ||
|
||
/// <inheritdoc/> | ||
public override string CssClass => string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Template { get; } = string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Parent { get; } = Constants.LeftMenu; | ||
|
||
/// <inheritdoc/> | ||
public override string Loader { get; } = "DiscardState"; | ||
|
||
/// <inheritdoc/> | ||
public override int Order { get; } = 78; | ||
|
||
/// <inheritdoc/> | ||
public override bool Visible() | ||
{ | ||
var contentItem = Util.GetContentController().GetContentItem(TabController.CurrentPage.ContentItemId); | ||
return Personalization.GetUserMode() == PortalSettings.Mode.Edit | ||
&& DotNetNukeContext.Current.Application.SKU == "DNN" // IsPlatform | ||
&& TabWorkflowSettings.Instance.IsWorkflowEnabled(PortalSettings.Current.PortalId) // workflow is enabled | ||
&& ((WorkflowEngine.Instance.IsWorkflowOnDraft(contentItem) && PermissionProvider.Instance().CanAddContentToPage(TabController.CurrentPage)) | ||
|| (!WorkflowEngine.Instance.IsWorkflowCompleted(contentItem) && WorkflowSecurity.Instance.HasStateReviewerPermission(contentItem.StateID))); | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Items/DiscardWorkflowMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information | ||
|
||
namespace Dnn.EditBar.UI.Items | ||
{ | ||
using System; | ||
|
||
using Dnn.EditBar.Library; | ||
using Dnn.EditBar.Library.Items; | ||
using DotNetNuke.Application; | ||
using DotNetNuke.Entities.Content.Common; | ||
using DotNetNuke.Entities.Content.Workflow; | ||
using DotNetNuke.Entities.Portals; | ||
using DotNetNuke.Entities.Tabs; | ||
using DotNetNuke.Security.Permissions; | ||
using DotNetNuke.Services.Personalization; | ||
|
||
[Serializable] | ||
public class DiscardWorkflowMenu : BaseMenuItem | ||
{ | ||
/// <inheritdoc/> | ||
public override string Name { get; } = "DiscardWorkflow"; | ||
|
||
/// <inheritdoc/> | ||
public override string Text => "Reject"; | ||
|
||
/// <inheritdoc/> | ||
public override string CssClass => string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Template { get; } = string.Empty; | ||
|
||
/// <inheritdoc/> | ||
public override string Parent { get; } = Constants.LeftMenu; | ||
|
||
/// <inheritdoc/> | ||
public override string Loader { get; } = "DiscardWorkflow"; | ||
|
||
/// <inheritdoc/> | ||
public override int Order { get; } = 80; | ||
|
||
/// <inheritdoc/> | ||
public override bool Visible() | ||
{ | ||
var contentItem = Util.GetContentController().GetContentItem(TabController.CurrentPage.ContentItemId); | ||
return Personalization.GetUserMode() == PortalSettings.Mode.Edit | ||
&& DotNetNukeContext.Current.Application.SKU == "DNN" // IsPlatform | ||
&& TabWorkflowSettings.Instance.IsWorkflowEnabled(PortalSettings.Current.PortalId) // workflow is enabled | ||
&& !WorkflowEngine.Instance.IsWorkflowCompleted(contentItem) // tab has new version that is not published | ||
&& WorkflowSecurity.Instance.HasStateReviewerPermission(contentItem.StateID); // user has workflow approval permission | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/editBar/css/CompleteState.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#menu-CompleteState button { | ||
width: auto; | ||
-ms-border-radius: 3px; | ||
border-radius: 3px; | ||
background-color: transparent; | ||
border-style: solid; | ||
border-width: 1px; | ||
text-indent: 0; | ||
} |
9 changes: 9 additions & 0 deletions
9
Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/editBar/css/CompleteWorkflow.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#menu-CompleteWorkflow button { | ||
width: auto; | ||
-ms-border-radius: 3px; | ||
border-radius: 3px; | ||
background-color: transparent; | ||
border-style: solid; | ||
border-width: 1px; | ||
text-indent: 0; | ||
} |
Oops, something went wrong.