viernes, 22 de enero de 2016

How to see the status of timed activations

This article is for Magnolia 5.x versions.

The Need

It happens that when you decide to send a page for publication, you don't know what is going on until you see the green status dot, things could happen like you may forget you already sent that page for publication and you send it again.

In order to keep track at all times of the tasks in progress there is a little development you could implement, and I will show you how.

The aim is to add a new column to the pages app that will show the information like in the image below.

As you can see there is a new column named "Publication Date", in that column we will see either the date of publication, or if is an immediate publication that someone is reviewing we will see "InProgress". We could add the other status like "rejected" but I will just display this two.

The Code

There is only one class that we need to create, that will extend from AbstractColumnFormatter, we will query the "tasks" workspace and display the status. Right now there is API method to get a task directly from the identifier of the node, that is why you will see 2 queries instead of one.

The Configuration

Once you have the class in your project the only thing left is to add it to the treeView of the pages app

The last thing to do is to add read permissions on tasks workspace to the users/groups you want to be able to use this functionality.

The code is available here.

To Improve

Right now it works just for the website workspace, it can be improved to read the workspace name in the configuration. 
It could be good the show if the activation is recursive.
In case there are more than one activation scheduled for one item it should be displayed.
Supper cool addition would be a button to stop an scheduled activation.