joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.2] [GSoC 21] Feature - Implement Workflows for com_modules

Open YatharthVyas opened this issue 4 years ago • 12 comments

Project Repo PR: https://github.com/joomla-projects/gsoc21_core-enhancements/pull/10

Summary of Changes

Access

  • The corresponding access.xml actions have been added.

Articles Model

  • The getListQuery() method joins the old query with workflow_associations to also consider the workflow stages that belong to com_content.articles only.

SQL Changes:

  • The following have been added to the Database Tables:
    • 1 new workflow: COM_WORKFLOW_BASIC_WORKFLOW_MODULES
    • 1 new stage: COM_WORKFLOW_BASIC_STAGE
    • 3 new transitions: Publish, Unpublish, and Trash
  • Workflow Associations have been created for all existing modules via an update script / a query during Installation.

Introduce a new Backend Menu Item

  • A new menu item for Modules: Workflows to execute CRUD for com_modules

Option to Enable Workflow Integration

  • This can be toggled from Global Configuration

Searchtools Filtering

  • Option to filter modules via their stage

ModulesComponent.php

  • Added necessary functions that are used by Workflow Plugins (Workflows, Featuring and Publishing)

Module Model

  • The get query now takes into account the workflow stage associated with each module.
  • Added Workflow before and after Save events
  • Added a function to get the initial stage for a module (default workflow and default stage)
  • Added a query to create workflow association while duplicating modules
  • Added a function that prepares the workflow field

Modules Model

  • Join the query with workflow associations
  • Add a filterForm function to filter based on workflow stage

Modules Template:

  • Added workflows column to the table
  • This column is conditionally rendered when workflows are enabled
  • Added workflows field to default batch body

The Flow:

  1. When creating new modules you have to select a workflow and when you save, the default stage under this workflow_id is set as the initial stage of the module.
  2. When editing exiting modules, the workflow transition field is shown instead of the workflow_id field, which works similarly to com_content.

New Modules: Select Workflow

(Permanent similar to workflow assignment for com_content)

image

Edit Existing Modules: Transition Field

image

Testing Instructions

After a fresh install: 1, Go to Modules (Site or Admin) -> Options -> Integrations -> Enable Workflows 2. Test the transitions in modules view 3. Test CRUD for workflows, stages, and transitions in Modules: Workflows 4. Test Batch and Duplicate

Expected result AFTER applying this Pull Request

Workflows are integrated into Modules and work as expected.

https://user-images.githubusercontent.com/53610833/129226377-79bddb17-7968-4bf7-9599-f206ff9853e2.mp4

Documentation Changes Required

Possibly yes. Something on the lines of https://docs.joomla.org/Publishing_Workflow_Implementation#Implement_com_workflow_into_your_extension

Mentors

@chmst @nibra @bembelimen (And special thanks to @richard67)

YatharthVyas avatar Aug 12 '21 15:08 YatharthVyas

Thanks for this PR.

bembelimen avatar Aug 12 '21 15:08 bembelimen

Will test once 4,0 is out of the way

brianteeman avatar Aug 12 '21 16:08 brianteeman

This cannot be merged until the the PHP level issue with heredoc is fixed.

PhilETaylor avatar Dec 24 '21 21:12 PhilETaylor

I have tested this item :red_circle: unsuccessfully on ab406a35ea8aa6087d6ef6f476d2dd6a68efc064

Not compatible with PHP 7.2 - see: https://github.com/joomla/joomla-cms/pull/35101/files#r775081165


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35101.

PhilETaylor avatar Dec 24 '21 21:12 PhilETaylor

Oops, I rebased to 4.2-dev instead of 4.1 I'll revert and fix this. Also, sorry for the review requests. I'm unable to remove them from my end.

YatharthVyas avatar Apr 02 '22 12:04 YatharthVyas

Oops, I rebased to 4.2-dev instead of 4.1 I'll revert and fix this. Also, sorry for the review requests. I'm unable to remove them from my end.

@YatharthVyas You can remove review requests after having reverted the rebase (or rebased back) and then using the cog icon near the reviewers list on github.

richard67 avatar Apr 02 '22 12:04 richard67

Update: I have changed the base branch after discussing this with my mentors to 4.2-dev since being a new feature, this wont be going into 4.1

@richard67 Unfortunately, I'm still unable to remove the review requests. I dont know if I'm doing something wrong but the cog icon isnt visible for me

YatharthVyas avatar Apr 02 '22 12:04 YatharthVyas

This pull requests has been automatically converted to the PSR-12 coding standard.

joomla-bot avatar Jun 27 '22 21:06 joomla-bot

This pull request has been automatically rebased to 5.0-dev.

HLeithner avatar May 02 '23 16:05 HLeithner

This pull request has been automatically rebased to 5.1-dev.

HLeithner avatar Sep 30 '23 22:09 HLeithner

This pull request has been automatically rebased to 5.2-dev.

HLeithner avatar Apr 24 '24 09:04 HLeithner

I have tested this item :red_circle: unsuccessfully on 1c3ad7682e7cd2e18a2c2006c5c741c9bf1f601f

Applying the patch gave me a 500 error after saving and closing the module options. I am doing this on a live stream one of my viewers said "soo it look like the patch is out of date and needs to be updated before it's ready to test again."

Layout default_batch_footer not found. Call Stack

Function Location

1 () JROOT/libraries/src/MVC/View/HtmlView.php:425 2 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/administrator/components/com_modules/tmpl/modules/default.php:284 3 include() JROOT/libraries/src/MVC/View/HtmlView.php:416 4 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:204


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35101.

cybersalt avatar Aug 21 '24 19:08 cybersalt

@cybersalt At the end of the page you find this information: 0 This means that the pull request can not be test until the conflicts are solved and the failed test is expected why it should be changed to "not tested" at the issue tracker.

ghost avatar Sep 02 '24 07:09 ghost

This pull request has been automatically rebased to 5.3-dev.

HLeithner avatar Sep 02 '24 08:09 HLeithner

This pull request has been automatically rebased to 6.0-dev.

HLeithner avatar Mar 04 '25 17:03 HLeithner

This pull request has been automatically rebased to 6.1-dev.

HLeithner avatar Aug 31 '25 12:08 HLeithner