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

[4.0] Workflow enhancement #29235

Merged
merged 110 commits into from
May 29, 2020
Merged

[4.0] Workflow enhancement #29235

merged 110 commits into from
May 29, 2020

Conversation

bembelimen
Copy link
Contributor

@bembelimen bembelimen commented May 26, 2020

In September 2019 a small working group (@wilsonge , @HLeithner , @marcodings and me) discussed about the current status of the Publishing Workflow in Joomla! 4.

We asserted, that the current implementation works for publishing, but has a lot of limitations in regards of additional functionality like featured, notification etc. So we decided to go in the direction of a state machine-alike to bring in more flexibility.

We implemented the following changes:

  • No Joomla! 3 pseudo-default-workflow anymore. If you don't need the workflow, you can now disable it and Joomla! behaves exactly like in version 3.
  • No conditions anymore. The article visibility is now back to the "state" of the article itself (published, unpublished, trashed, archived) and not based on any "conditions" in the workflow.
  • The leading elements in the workflow are now the transitions, which triggers different workflow plugins to change state/features/etc. of items and not the stages anymore => you can create own workflow plugins to manage nearly everything with the workflow (like check for intro images and auto-resize,cut, manage permissions via workflow, ...)
  • We ship per default three plugins:
    publishing => Change status of items via the workflow
    featured => change featured state of items via the workflow (Thanks to @HLeithner )
    notification => send internal messages to people based on executed transitions (Thanks to @chmst )

Video preview

https://www.youtube.com/watch?v=5ibAhPkVadc

Testing Instructions

Install the Nightly build or download the ZIP file (https://github.com/bembelimen/joomla-cms/archive/workflow-v3.zip) and make a fresh installation. Afterwards go to the Article manager, there you'll find a new menu entry "Workflows", play with it around. You can also use the implemented default workflow.

Workflows will be assigned in the category parameters.

Update testing

Please also test the update path: #29235 (comment)

Documentation

https://docs.joomla.org/Publishing_Workflow

Things yet to come

Thank you

  • @HLeithner who was a very big help, wrote a lot of code (including feature plugin), spent hundred of hours giving feedback, creating concepts etc. Thank you!
  • @chmst was always there to fix and test things, wrote the notification plugin and so much more
  • @richard67 helped with database issues
  • @Hackwar helping with the tests and CS
  • @wilsonge had always a helping hand with code and supported the whole work from the beginnig. You rock!
  • Philip Walton + @uglyeoin for your support, the update of the documentation and getting testers on board.

bembelimen and others added 30 commits March 14, 2020 20:55
* Remove workflow from com_content frontend

* Remove workflow from content helper

* Remove workflow from modules

* Remove workflow from plugin pagenavigation
* Remove workflow from com_content frontend

* Remove workflow from content helper

* Remove workflow from modules

* Remove workflow from plugin pagenavigation

* Add workflow model interface and traid

* Set WorkflowBehaviorTrait function public
* Remove condition from workflow component

* Load Workflow plugins on transition generation

* Remove condition from com_content
* Remove condition from workflow component

* Load Workflow plugins on transition generation

* Remove condition from com_content

* Cleanup content from workflow
# Conflicts:
#	installation/sql/postgresql/joomla.sql
#	plugins/content/pagenavigation/pagenavigation.php
* Remove more conditions
Load transition field if component uses WorkflowModelTrait

* Revert publish method to Joomla! 3 version and add workflow plugin group

* Fix spelling error

* Execute transition if selected in the item
Add before/after item save for workflow
# Conflicts:
#	administrator/components/com_content/tmpl/articles/default.php
#	administrator/components/com_content/tmpl/featured/default.php
* Fix workflow batch
# Conflicts:
#	modules/mod_stats/src/Helper/StatsHelper.php
* Remove condition from workflow component

* Load Workflow plugins on transition generation

* First commit for the publishing plugin

* Prevent saving of publishing state if workflow + plugin is active and the function is supported

* Only enhance transition form, if plugin is supported

* Add options field for transition plugins
Fix support check for workflow publishing plugin

* Set transition default values when creating a new workflow

* Make publishing plugin support name generic

* Allow to kill transition execution

* Add missing variable assignment to kill transitions

* Prevent state change on publish events

* Implement finished version of the publishing plugin which now changes states of items
Fix wrong contexts

* Update the workflow model interface to respect all methods
Secure controller execution for runTransition

* Implement frontend transition with the new plugin method
* Calculate the ordering number in store

* Use getNextOrder of Table/table.php

* add casting for (int)
* Allow same and circle transitions again

* Implement transition in the articles dropdown
Make transition execution more generic
Fix publish tooltip when workflow is not enabled
Remove unused modal files
Implement onBeforeDisplay plugin trigger
Implement onAfterDisplay plugin trigger
Disable publish calls via workflow plugin
* Renaming workflows_enable parameter to workflow_enabled

* Add missing default values

Co-authored-by: Benjamin Trenkle <bembelimen@users.noreply.github.com>
Implement featured in workflow handling
# Conflicts:
#	administrator/components/com_workflow/forms/filter_stages.xml
@bembelimen
Copy link
Contributor Author

Remove Stage ascending/Stage descending from Sort Table By: dropdown when workflows is disabled.

781fab1

Fix wrong language

Co-authored-by: Quy <quy@fluxbb.org>
@Quy
Copy link
Contributor

Quy commented May 29, 2020

Editing an article on the frontend with workflows disabled.

29235

@bembelimen
Copy link
Contributor Author

Editing an article on the frontend with workflows disabled.

29235

That is a template problem, the colors are wrong

@Quy
Copy link
Contributor

Quy commented May 29, 2020

Current Stage and Target Stage options not in Sort Table By dropdown under Transitions.

29235-transitions

@Quy
Copy link
Contributor

Quy commented May 29, 2020

Is it ok for Stage ascending/Stage descending to be at the bottom of the list instead at the top where they would normally be?

@Quy
Copy link
Contributor

Quy commented May 29, 2020

Edit a stage. Is it correct with the Name field?

29235-edit-stage

bembelimen and others added 2 commits May 29, 2020 23:01
# Conflicts:
#	administrator/components/com_workflow/tmpl/transitions/default.php
#	installation/sql/mysql/base.sql
#	installation/sql/postgresql/base.sql
@bembelimen bembelimen marked this pull request as ready for review May 29, 2020 22:53
@wilsonge wilsonge merged commit fe0563c into joomla:4.0-dev May 29, 2020
@wilsonge
Copy link
Contributor

wilsonge commented May 29, 2020

Thankyou @bembelimen , @chmst and @HLeithner for your hard work!

@wilsonge wilsonge added this to the Joomla 4.0 milestone May 29, 2020
@bembelimen
Copy link
Contributor Author

Thank you @wilsonge

@geekonthepc
Copy link

Hi everyone,

Firstly, can I please thank everyone for their really hard work getting this together. My organisation wants to upgrade to Joomla 4 as soon as reasonably possible primarily for this feature. In our previous CMS (Liferay), we had a workflow functionality of sorts. We moved to Joomla 3 late last year and have so far got on with it very well, although we do miss the workflows.

I've just installed Joomla 4 Beta 1 on a test node so I can have a sneak peek at how this works.

One question though - and I hope that I'm writing this in the correct place.

All of the workflow functionality implemented thus far seems to work great for new articles. My question, however, is whether there is any functionality for moderating the edits of existing articles? Our approval team wants to be able to moderate changes to articles as well as new articles. In our old CMS, if an article was changed but a standard author, the last approved version remained published while the new version was sent of for approval. If it was approved, the latest version was published. If it was denied, the old version would remain published until a newer version was approved.

Do the new workflow states/transitions in Joomla 4 support this functionality?

Sorry to ask a question in this manner - I'm trying to understand what is likely to be possible in Joomla 4 and beyond.

Thanks in advance.

P.S. if this should be posted somewhere else, please let me know.


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

@richard67
Copy link
Member

@bembelimen Could you check the above questions? What is the best place to ask these questions?

@bembelimen
Copy link
Contributor Author

Hello @geekonthepc thank you for showing interested in the new workflow.

I think the best place is to ask in Glip. And feel free to contact me there for a deeper discussion.

But as I'm here, I try to answer your question.

In the core state a staging solution is not included, but there are plans to do it in coming releases.

So far the negative answer, the positive answer is: if you're capital to write your own plugin, you can write a workflow plugin to build this functionality. The idea could be, that you write a transition add-on which uses the versioning of Joomla for creating drafts. So saving a new version but reset the current version to the old one.
Does that help?

@geekonthepc
Copy link

Hi @bembelimen

Thanks so much for taking the time to respond.

That's really helpful - thanks. The fact that staging of some sort has been discussed for a potential future release is certainly encouraging - as you say in the meantime a custom plugin could be the way forward to bolt on that functionality.

It's certainly good to know the current state of play so we can determine which route to take.

Many thanks


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

@Hackwar
Copy link
Member

Hackwar commented Jun 8, 2020

@geekonthepc If you plan to create or order a custom plugin, you might want to consider if you can fund a developer to do that as a core contribution. I myself have done this for the Smart Search component. A customer of mine needed basically that search functionality and with their support, I was able to refactor com_finder not just for them, but for everyone. Such a staging feature could be another good case for such a funding.

@Quy
Copy link
Contributor

Quy commented Jun 16, 2020

In \administrator\components\com_workflow\forms\filter_workflows.xml, the following:

	<fieldset name="group">
		<field
			name="extension"
			type="workflowcontexts"
			filtermode="selector"
			onchange="this.form.submit();"
		/>
	</fieldset>

generates:


		<div class="js-stools-field-selector">
	<div class="sr-only">
		<label id="extension-lbl" for="extension">
	extension</label>
	</div>
	<input
	type="hidden"
	name="extension"
	id="extension"
	value="com_content.article"
	 onchange="this.form.submit();">
</div>

Resulting a hidden field causing extra padding:
29235

Is the code required here?

@bembelimen bembelimen deleted the workflow-v3 branch January 23, 2024 00:14
heelc29 added a commit to heelc29/joomla that referenced this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.