News Priority

Plugin handles the different newspriority information that can be attached to the article.

Plugin configuration

{
    "id": "io.infomaker.newspriority",
    "name": "im-newspriority",
    "url": "https://plugins.writer.infomaker.io/v1/infomaker/im-newspriority/{PLUGIN_VERSION}/index.js",
    "style": "https://plugins.writer.infomaker.io/v1/infomaker/im-newspriority/{PLUGIN_VERSION}/style.css",
    "enabled": true,
    "mandatory": false,
    "data": {
        "preventLifetime": false,
        "durationKey": "duration",
        "defaultLifetimesIndex": 1,
        "defaultScoresIndex": 1,
        "scores": [
            {
                "value": "1",
                "text": "Breaking news"
            },
            {
                "value": "2",
                "text": "High"
            },
            {
                "value": "3",
                "text": "Medium"
            },
            {
                "value": "4",
                "text": "Low"
            }
        ],
        "lifetimes": [
            {
                "value": "3600",
                "label": "6H",
                "text": "6 hours"
            },
            {
                "value": "86400",
                "label": "1D",
                "text": "1 day"
            },
            {
                "value": "604800",
                "label": "7D",
                "text": "7 days"
            },
            {
                "value": "",
                "label": "∞",
                "text": "Forever"
            },
            {
                "value": "custom",
                "label": "Tid",
                "text": "Custom"
            }
        ]
    }
}
Property Type Required Description
preventLifetime Boolean false Disable lifetime feature.
durationKey String false Override normal behaviour, only change these if you really need to.
defaultLifetimesIndex Integer false Override normal behaviour, only change these if you really need to.
defaultScoresIndex Integer false Override normal behaviour, only change these if you really need to.
scores Array true List of news score objects
lifetimes Array true List of lifetimes objects. Still needs to exist event if preventLifetime is true

scores configuration

[
    {
      "value": "1",
      "text": "Not very high"
    }
]
Property Type Required Description
value String true The value stored in the newsitem.
text String true The value displayed in the writer when hovering over a value.

lifetimes configuration

[
    {
        "value": "592200",
        "label": "7D",
        "text": "7 days"
    }
]
Property Type Required Description
value String true The value stored in the newsitem. Could be anything. In this example it's the number of seconds in 7 days for some reason.
label String true The value displayed in the writer.
text String true The value displayed in the writer when hovering over a label.

Output

In the article, the plugin will add the following xml block under newsItem > contentMeta > metadata:

<object id="RYaudnAJj8gQ" type="x-im/newsvalue">
    <data>
        <score>3</score>
        <description>1D</description>
        <format>lifetimecode</format>
        <end/>
        <duration>86400</duration>
    </data>
</object>

The description, end and duration maps to the keys in the lifetime array in the configuration.