Publish Flow

This plugin is the default plugin for handling the article workflow, including saving, setting article statuses and scheduling articles for publication.

Plugin configuration

A workflow consists of a number of workflow items (states). These are defined in the plugins configuration.

{
    "id": "io.infomaker.publishflow",
    "name": "im-publishflow",
    "url": "https://plugins.writer.infomaker.io/v1/infomaker/im-publishflow/{PLUGIN_VERSION}/index.js",
    "style": "https://plugins.writer.infomaker.io/v1/infomaker/im-publishflow/{PLUGIN_VERSION}/style.css",
    "enabled": true,
    "mandatory": true,
    "data": {
        "workflow": {
            "draft": {
                ...
            },
            "done": {
                ...
            },
            "publish": {
                ...
            }
        }
    }
}

Changing calendar locale

In the Writer client configuration, set the property calendarLocale to override the browsers default locale.

Workflow item

Each workflow item defines properties for that state, actions to perform when entering the state and all allowed transitions to other states.

Example

Below is a workflow item named "publish" for the stat:usable pubStatus. The name is used to reference this workflow item, state, from other transitions.

"publish": {
    "pubStatus": "stat:usable",
    "title": "Artikeln är publicerad",
    "description": "Du jobbar direkt mot den publicerade artikeln",
    "saveActionLabel": "Uppdatera",
    "icon": "fa-upload",
    "color": "#288dc0",
    "permissions": [
        "writer:group/admin",
        "dashboard:group/admin"
    ],
    "transitions": [
        {
            "nextState": "republish",
            "title": "Republish",
            "preCondition": {
                "permissions": [
                    "writer:group/admin",
                    "dashboard:group/admin"
                ]
            }
        },
        {
            "nextState": "draft",
            "priority": "secondary",
            "title": "Fortsätt arbeta med utkast"
        },
        {
            "nextState": "cancel",
            "title": "Avpublicera"
        }
    ],
    "actions": [{
        "pubStart": "set",
        "pubStop": "clear",
        "pubStatus": "stat:usable",
        "hasPublishedVersion": true
    }]
}

Top level properties

These are the top level properties for a workflow item.

The properties pubStatus, title, description, saveActionLabel can be left out when you want to have a workflow item that handles specific actions without keeping its own state. An example is "republish" that should appear in the menu and resets the pubStart value but then leaves the state to be handled by the "publish" workflow item.

Property Description
pubStatus The pubStatus value for this item.
title Main title displayed to the user directly in the writer top bar
description Longer description displayed in the publish flow popout dialog
saveActionLabel Specify the label for the default save button in the Writer
icon Icon displayed in menu for the menu option to move to this state, uses Font Awesome icon classes
color Icon background color, normally Infomaker standard colors
permissions Optional array of permissions, determines who is allowed to save changes to article in current status
transitions An array of available transitions to other states, see additional documentation below
actions Array with actions to perform when entering this state

Transitions

An array of available transitions to other states.

"transitions": [{
        "nextState": "publish",
        "title": "Publicera",
        "preCondition": {
            "hasPublishedVersion": false,
            "permissions": [
                "writer:group/powerUser",
                "dashboard:group/admin"
            ]
        },
    },
    {
        "nextState": "withhold",
        "title": "Tidspublicera",
        "preCondition": {
            "hasPubStart": true,
            "hasPublishedVersion": false
        }
    },
    ...
]
Property Description
nextState The name of a workflow item to transition to
title The title of the menu option displayed to the user (icon from next state is used automatically)
priority Optional, can be either "primary" or "secondary", will display this as a more visible call to action button above all other transition menu items
preCondition A condition for this transition. For example preCondition{ "hasPublishedVersion": true } will make this transition visible only if the article has a published (public) version. hasPubStart:true will render the option disabled. Naviga ID Permissions can be specified inside a permissions array like: "permissions": ["writer:group/powerUser"] this will only be available for users with Naviga ID permission writer:group/powerUser (assigned to role powerUser or admin). The permissions property needs to be an array even if there is only one permission added.

Actions

An array of actions to perform when first transitioning into this workflow item.

All action properties are optional.

"actions": [{
    "pubStart": "set",
    "pubStop": "clear",
    "pubStatus": "stat:usable",
    "hasPublishedVersion": true
}]
Property Description
pubStart required, set or clear. Required requires the users to choose a valid time before this transition can be made. Set and clear sets or clears the pubStart.
pubStop required, set or clear. Required requires the users to choose a valid time before this transition can be made. Set and clear sets or clears the pubStop.
pubStatus The most commonly used. A string that defines the pubStatus value to set in the NewsML when first transitioning into this state.
hasPublishedVersion Set NewsML flag to either true or false

Output

The plugin updates the article depending on selections made in the plugin. The status selected updates the
qcode attribute of newsItem > itemMeta > pubStatus element. Changes to publications start and end dates
update corresponding dates in newsItem > itemMeta, e.g.

<newsItem ...>
    ...
    <itemMeta>
        <pubStatus qcode="stat:usable"/>
        <itemMetaExtProperty value="2017-10-12T00:00:00+02:00" type="imext:pubstart"/>
        <itemMetaExtProperty value="2017-10-11T00:00:00+02:00" type="imext:pubstop"/>
        <itemMetaExtProperty type="imext:haspublishedversion" value="true"/>
        ...
    </itemMeta>
    ...
</newsItem>

Implicit rules

When the article has status 'stat:usable' it is not possible to change the pubStart property in the UI, because when an article is published it should not
be possible to change the publication date. An exception to this rule is the state where the action 'pubstart:set' is issued, which can be used to re-publish
an article.