Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Integration of Content Workflow API #6115

Open
3 of 4 tasks
tvatavuk opened this issue Aug 20, 2024 · 8 comments
Open
3 of 4 tasks

[Enhancement]: Integration of Content Workflow API #6115

tvatavuk opened this issue Aug 20, 2024 · 8 comments

Comments

@tvatavuk
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description of problem

The Content Workflow API within DNN Platform has been developed but remains underutilized because it is not fully integrated and user interface is missing. This limits the ability of Content Editors and Content Managers to efficiently manage and publish content.

Description of solution

@iJungleboy and @tvatavuk have been analyzing the current state of the Content Workflow API within the DNN Platform and determining what is needed for minimal integration to allow users to utilize the Content Workflow API, enhancing the overall content management experience within DNN Platform.

Key aspects of the solution include:

  1. Workflow Configuration:

    • Enable the configuration of workflows at both the portal and tab levels through the UI.
    • Provide options for enabling/disabling workflows and setting default workflows for specific content types.
  2. TabActions - Implement IWorkflowAction:

    • StartWorkflow
    • CompleteState
    • DiscardState
    • CompleteWorkflow
    • DiscardWorkflow
  3. Web API

    • Configuration
    • Info
    • TabActions
  4. User Interface Development:

    • Design and implement a user-friendly UI that allows Content Editors and Managers to interact with the Content Workflow API.
    • Integrate workflow management features directly into the DNN PersonaBar, ensuring easy access and intuitive controls.
    • Configuration UI
    • Info UI
    • TabActions UI
    • Localization

The proposed enhancement focuses on making the Content Workflow API accessible and usable by Content Editors and Content Managers through a user interface within DNN Platform. This will empower these users to effectively manage and publish pages, streamlining the content management process.

Description of alternatives considered

No response

Anything else?

Here is some info related to Content Workflow API implemented in DNN Platform.

Introduction

DNN Platorm includes a content workflow system primarily reliant on a ContentItem that may be associated with a Tab, Module, or File. Additionally, there is a standalone workflow engine in the Html module, which currently does not integrate with the general DNN workflow system and needs to be integrated.

Standard Workflows

Three primary workflows are pre-configured in DNN for immediate use in any new portal setup:

  1. Direct Publish: Instantly publishes content (default).
  2. Save Draft: Saves content as a draft for later publication.
  3. Content Approval: Requires content to undergo a review process before publication.

Workflow Management Classes

System and Workflow Managers

  • ISystemWorkflowManager: Provides methods to create and retrieve all system workflows, tailoring them to the portal’s needs.
  • IWorkflowManager: Allows for comprehensive CRUD operations on workflows and provides insights into their usage across the portal.

Detailed Workflow Types

Direct Publish

Enables immediate content publication without intermediate steps.

States:

  1. Published

Save Draft

Allows content to be saved as a draft, undergoing further edits before final publication.

States:

  1. Draft
  2. Published

Content Approval

Allows an author to manage content and then have it reviewed by other users before it is published.

States:

  1. Draft
  2. Ready For Review
  3. Published

Workflow Engine Features

Core Classes and Interfaces

  • IWorkflowEngine: Manages the progression and regression of content through its lifecycle.
  • IWorkflowStateManager: Oversees state transitions within workflows, ensuring that each move is logged and executed according to predefined rules.
  • IWorkflowSecurity: Ensures that workflow transitions and actions adhere to the assigned permissions and security protocols.
  • IWorkflowLogger: Captures and logs all workflow-related activities for auditing and troubleshooting purposes.

Workflow Actions and Extensions

  • IWorkflowAction: Allows for the extension of workflow functionalities, where third-party developers can implement custom actions for state and workflow management.
  • IWorkflowActionManager: Manages the registration and execution of custom workflow actions, enhancing the workflow capabilities through third-party integration.

Workflow Action Types

WorkflowActionTypes Enum

Represents the workflow action types.

  • StartWorkflow = 4: Starts a workflow for a Content Item.
  • CompleteState = 3: Completes a state, moving the workflow forward to the next state. If the next state is not the last one, it sends notifications to the reviewers of the next state; otherwise, it sends a notification to the user who submitted the draft once the workflow is complete.
  • DiscardState = 2: Discards a state, moving the workflow backward to the previous state. If the previous state is not the first one, it sends notifications to the reviewers of the previous state; otherwise, it sends a notification to the user who submitted the draft when the workflow is in the draft state.
  • CompleteWorkflow = 1: Completes the workflow, no matter what the current state is. It also sends a system notification to the user who submitted the workflow to inform them about the complete workflow action.
  • DiscardWorkflow = 0: Discards the workflow, no matter what the current state is. It also sends a system notification to the user who submitted the workflow to inform them about the discard workflow action.

Tab Workflow Settings

ITabWorkflowSettings

Manages workflow settings at the tab level, providing methods to enable/disable workflows and set default workflows for specific tabs or the entire portal.

  • SetWorkflowEnabled (int portalId, bool enabled): Enables or disables the tab workflow for the entire portal. Corresponds to TabWorkflowEnableKey in Portal Settings.
  • SetWorkflowEnabled (int portalId, int tabId, bool enabled): Enables or disables the tab workflow for a specific tab. This won't enable the workflow of a tab if the tab workflow is disabled at the portal level. Corresponds to TabWorkflowEnableKey in Tab Settings.
  • SetDefaultTabWorkflowId (int portalId, int workflowId): Sets the default workflow for a portal. Corresponds to DefaultTabWorkflowKey in Portal Settings.
  • GetDefaultTabWorkflowId: Returns the default tab workflow of the portal. If no default workflow is defined for a portal, the method returns the Direct Publish system workflow.
  • IsWorkflowEnabled (int portalId)
  • IsWorkflowEnabled (int portalId, int tabId)

Tab Workflow Tracker

ITabChangeTracker

  • TrackModuleAddition: Tracks a change when a module is added to a page.
  • TrackModuleModification: Tracks a change when a module is modified on a page.
  • TrackModuleDeletion: Tracks a change when a module is deleted from a page.
  • TrackModuleCopy: Tracks a change when a module is copied from an existing page.
  • TrackModuleUncopy: Tracks a change when a copied module is deleted from an existing page.

Tab Version Builder

ITabVersionBuilder

  • CreateNewVersion: Creates a new Tab Version, checking current portal settings.
  • Publish: Publishes a Tab Version.
  • Discard: Discards a Tab Version. If the tab only has an unpublished version, the page will keep it but with no content and not published.
  • RollBackVersion: Rolls back an existing version.
  • DeleteVersion: Deletes an existing Tab Version.
  • SetupFirstVersionForExistingTab: Sets up a first version for an existing tab with modules. This method is used to create version 1 for pages created when versioning was not enabled.
  • GetVersionModules: Gets all Modules Info associated with a specific version.
  • GetCurrentVersion: Gets the current published version of the page.
  • GetCurrentModules: Gets all Modules Info associated with the last published version of the page.
  • GetUnPublishedVersion: Gets the unpublished version or Null if the Tab has no unpublished version.
  • GetUnPublishedVersionModules: Gets all ModuleInfo objects associated with the unpublished version of a page.
  • GetModuleContentLatestVersion: Gets the latest version or 1 if the module is not versionable.

Content Workflow Service Controller

  • Approve (NotificationDTO postData)
  • Reject (NotificationDTO postData)

Note: This controller is not very useful due to complications related to Notification.

Model

ContentItems

  • StateID
  • TabID
  • ModuleID

Tabs

  • ContentItemID
  • HasBeenPublished

Modules

  • ContentItemID

Files

  • ContentItemID
  • HasBeenPublished

Data Model and Database Schema

A comprehensive data model supports the workflow system, detailing the associations between ContentItems and their respective Tabs, Modules, or Files, including publication states.

dnn-content-workflow

Future Enhancements and Research

To fully realize the potential of the DNN workflow system, further enhancements are necessary, particularly in UI development and the integration of orchestrated job functions. These would provide a more intuitive and automated workflow experience.

Other Info

Do you be plan to contribute code for this enhancement?

  • Yes

Would you be interested in sponsoring this enhancement?

  • Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct
tvatavuk added a commit to tvatavuk/Dnn.Platform that referenced this issue Sep 2, 2024
@tvatavuk
Copy link
Author

WIP. In the dnn-workflow feature branch, I’ve implemented minimal code to enable content workflow on the site:

  • TabActions implementation for content workflow.
  • Control content workflow settings in site settings.
  • Enable page search related to content workflow.

In Site Settings > Site Behavior > More, a new Workflow section has been added with options to:

  • Enable versions.
  • Set the maximum number of versions.
  • Enable workflow.
  • Select the default workflow type.

image

image

To demonstrate the Content Approval workflow, I’ve added a new HTML module with some text to the top of the Home page.

image

In View mode, the new HTML module is not visible to regular users until it's published.

image

Editors can now search for Draft pages using the advanced page search feature and filter results by Workflow type, Publish status, etc.

image

Workflow actions can be executed within notification messages.

image

image

Finally, the draft Home page was published, and the new text at the top of the page is now visible to all users.

image

image

TODO:

  • Add content workflow settings per tab.
  • Add content workflow tab action buttons in edit mode.
  • Update UI wording and localization.
  • Improve notification messages and localization.
  • Submit pull request based on the latest v10 code.

@valadas
Copy link
Contributor

valadas commented Sep 26, 2024

This is really impressive, great work!

@jeremy-farrance
Copy link
Contributor

I love this, very useful. We are really looking forward to this.

One thought I had - it might be there already but I am not sure - a common use case (step) in most workflow processes is to be able to send a Preview Link of the not-yet-Published page to someone so they can see it even if they are not logged in. Is that covered somehow?

@iJungleboy
Copy link
Contributor

@jeremy-farrance as of now and very likely the MVP scope of this work, this will not be possible.

The workflows (relevant for publish a draft) are tightly coupled with the permission system.

The versioning system is I guess a separate topic. This could theoretically be done with a link, but there would be quite a bit of effort to ensure that such a link is secure and can't be guessed (like when switching skins in DNN), since that would leak potentially vulnerable data.

Imagine a company which is preparing an stock-relevant update info on their website, where the release of information must be timed according to regulatory rules. If people could just preview the next version of the page with a ?version=draft or something, this could lead to serious problems.

So basically I believe it can be done, but would need a lot of consideration to figure out what should be done and how. This will take time and discussions, so should not be in the initial release - and could also be contributed by others ;)

@tvatavuk
Copy link
Author

This is really impressive, great work!

Sharing DNN love ❤️ and respecting the work of @valadas and other giants 🏆 since the beginning of DNN time. 👏

tvatavuk added a commit to tvatavuk/Dnn.Platform that referenced this issue Oct 1, 2024
tvatavuk added a commit to tvatavuk/Dnn.Platform that referenced this issue Oct 1, 2024
@tvatavuk
Copy link
Author

tvatavuk commented Oct 1, 2024

WIP

In the dnn-workflow feature branch, I’ve implemented workflow buttons in the Edit Bar, as well as workflow information and settings at the tab level.

  • Add content workflow settings and info per tab.
  • Add content workflow tab action buttons in edit mode.

Here is a demonstration:

  1. Log in as the editor user in the Content Editors role. When content workflow is enabled, the current page's Publish Status is visible in the Edit Bar.

    image

  2. The editor adds a new module at the top of the page. The Publish Status changes to Draft in the Edit Bar. Workflow buttons [Submit] and [Discard] are visible to the editor. There is one new notification for the editor user.

    image

  3. The editor clicks on [Submit] to request a review from the Content Managers. The Publish Status remains Draft, but the workflow buttons are now hidden.

    image

  4. Log in as the manager user in the Content Managers role. The workflow buttons [Submit], [Discard], [Approve], and [Reject] are visible to the manager.

    image

  5. Under Page > Details, there is more information related to Publish Status, Versioning, and Workflow.

    image

  6. Under Page > Advanced > More, there are new Workflow settings to control it at the page level.

    image

  7. The manager clicks on [Approve] to publish the new version to everyone. The Publish Status changes to Published, and the workflow buttons are hidden in the Edit Bar.

    image

TODO:

  • Update UI wording and localization.
  • Improve notification messages and localization.
  • Submit pull request based on the latest v10 code.

@mitchelsellers
Copy link
Contributor

This is AWESOME!

@iJungleboy
Copy link
Contributor

I would like to double down on @mitchelsellers comment - this is INSANE on so many levels (incl. the question: why did we wait so long!).

@tvatavuk this is amazing!

tvatavuk added a commit to tvatavuk/Dnn.Platform that referenced this issue Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants