Adds the dashboard alerts feature: banner messages shown at the top or bottom of the admin dashboard or a website, targeted by organisation, group and time window. Registers the "manageAlerts" admin page and the per-alert DashboardAlertPage under a website branch, contributes the alerts KEditor component and a journey-builder node for activating an alert from a journey, and renders the dashboard alert portlets by delegating to AlertsManager for lookup. createAdminAlert and createAlert are called from server-side scripts (kcode) to raise alerts programmatically. Also backs up and restores an organisation's alerts as part of account configuration export/import.
Implements: MenuApplication, ChildPageApplication, PortletApplication, ComponentApplication, JourneyBuilderApplication, FieldProviderApplication, DependentApplication, TemplatingApplication, BackupableApplication
Properties
| Property | Returns | Description |
|---|---|---|
| bottomMessages | List<AlertBean> | The alerts positioned at the bottom of the dashboard for the current user and root folder. |
| instanceId | String | The app's registration id, "alerts", used to key its config and stored data in account backup/restore. |
| roles | List<Role> | The roles this app contributes. Always null; the alerts app does not register any of its own roles. |
| topMessages | List<AlertBean> | The alerts positioned at the top of the dashboard for the current user and root folder. |
Methods
getInstanceId() · getTopMessages() · getBottomMessages() · getMessages(RootFolder rootFolder, Profile p, String forPosition) · getAcknowledgedMessages(RootFolder rootFolder, Profile p, String forPosition) · getAlertAckDateForProfile(Alert alert, Profile profile) · getAlertActivationDateForProfile(Alert alert, Profile profile) · createAdminAlert(String title, String message) · createAdminAlert(String title, String message, int days) · createAdminAlert(String title, String message, String type, int days) · createAlert(OrgData org, String websiteName, String title, String message, String type, String groupName) · createAlert(OrgData org, String websiteName, String title, String message, String groupName, String type, Date start, Date end) · getRoles()
getInstanceId()
Returns: String
The app's registration id, "alerts", used to key its config and stored data in account backup/restore.
getTopMessages()
Returns: List<AlertBean>
The alerts positioned at the top of the dashboard for the current user and root folder.
getBottomMessages()
Returns: List<AlertBean>
The alerts positioned at the bottom of the dashboard for the current user and root folder.
getMessages(RootFolder rootFolder, Profile p, String forPosition)
Returns: List<AlertBean>
Finds the alerts, current and legacy, that apply to the given profile at the given dashboard position. Merges alerts found through AlertsManager with any matching legacy dashboard messages read from group properties.
| Parameter | Description |
|---|---|
rootFolder | the root folder whose website and organisation scope the search |
p | the profile the alerts are targeted at; if null, an empty list is returned |
forPosition | the dashboard position to filter by, Alert.POS_TOP or Alert.POS_BOTTOM |
getAcknowledgedMessages(RootFolder rootFolder, Profile p, String forPosition)
Returns: List<AlertBean>
The alerts the given profile has already acknowledged at the given dashboard position.
| Parameter | Description |
|---|---|
rootFolder | unused; the search is scoped by the profile alone |
p | the profile whose acknowledged alerts are looked up |
forPosition | the dashboard position to filter by, Alert.POS_TOP or Alert.POS_BOTTOM |
getAlertAckDateForProfile(Alert alert, Profile profile)
Returns: Date
The date the given profile acknowledged the given alert, or null if they have not acknowledged it.
| Parameter | Description |
|---|---|
alert | the alert to check |
profile | the profile whose acknowledgement is looked up |
getAlertActivationDateForProfile(Alert alert, Profile profile)
Returns: Date
The date the given alert became active for the given profile: their acknowledgement date if they have acknowledged it, otherwise the alert's start date.
| Parameter | Description |
|---|---|
alert | the alert to check |
profile | the profile the activation date is calculated for |
createAdminAlert(String title, String message)
Returns: String
Creates an info-type alert for the current organisation's admin dashboard, active for 30 days from now.
| Parameter | Description |
|---|---|
title | the alert's title |
message | the alert body |
createAdminAlert(String title, String message, int days)
Returns: String
Creates an info-type alert for the current organisation's admin dashboard, active for the given number of days from now.
| Parameter | Description |
|---|---|
title | the alert's title |
message | the alert body |
days | how many days from now the alert stays active |
createAdminAlert(String title, String message, String type, int days)
Returns: String
Creates a dismissable, enabled alert for the current organisation's admin dashboard, active for the given number of days from now, authored by the current user.
| Parameter | Description |
|---|---|
title | the alert's title |
message | the alert body |
type | the display type, one of the Alert.TYPE constants |
days | how many days from now the alert stays active |
createAlert(OrgData org, String websiteName, String title, String message, String type, String groupName)
Returns: String
Creates a dismissable, enabled alert targeted at the given group, with no start or end date, either on a website (if websiteName is given) or on the organisation's admin dashboard.
| Parameter | Description |
|---|---|
org | the organisation the alert is created in |
websiteName | the name of the website to target, or null to target the admin dashboard |
title | the alert's title |
message | the alert body |
type | the display type, one of the Alert.TYPE constants |
groupName | the name of the group the alert is targeted at |
createAlert(OrgData org, String websiteName, String title, String message, String groupName, String type, Date start, Date end)
Returns: String
Creates a dismissable, enabled alert targeted at the given group, either on a website (if websiteName is given) or on the organisation's admin dashboard, active over the given date range.
| Parameter | Description |
|---|---|
org | the organisation the alert is created in |
websiteName | the name of the website to target, or null to target the admin dashboard |
title | the alert's title |
message | the alert body |
groupName | the name of the group the alert is targeted at |
type | the display type, one of the Alert.TYPE constants |
start | the date the alert becomes active, may be null |
end | the date the alert stops being active, may be null |
getRoles()
Returns: List<Role>
The roles this app contributes. Always null; the alerts app does not register any of its own roles.