Notifications in COREmanager

From ISPWiki
Jump to: navigation, search

General description

A new Notifications bar is available on the COREmanager 5 toolbar (the block with icons is displayed in the upper left corner). By default it doesn't contain any information and is not displayed.



To add a custom icon into the Notification bar, add the notify event handler that will add elements description into the XML:

<doc ...>
    <item name="basket" action="longtask" img="p-newmsg" type="list">
    <item name="messages" action="journal" img="m-service" type="list">
    <item name="warning" action="problems" img="p-error" type="list">

The notify element

Contains a list of message elements.

The item element

Contains information about a notification element; the embedded msg element contains a text that should be shown before the icon.

the img attribute
the name of the image to display
the action attribute
the name of the function to call on button click event
the type attribute
a type of the action to call, i.e form, report or list
the name attribute
the name of the element, which is used for hint localisation. A hint is taken from localized messages of the <messages @name=notify/> section. The name consists of the element's name + the prefix hint_.

The timeout element

An interval in seconds to call the data update function.

Updating elements

Notifications are updated automatically at a specified interval. You can force updating of notifications when closing a form by passing the Session::okNotifyUp element to the Session::Ok method. Or you can also add the @notifyup attribute set to yes to the ok element.


In the example below you can see how to add a custom icon into the Notifications bar.

class EventNotify : public Event {
	EventNotify() : Event("notify", "test") {}
	virtual void BeforeExecute(Session &ses) const {
		auto notify = ses.NewNode("notify");
		auto item = notify.AppendChild("item");
		item.SetProp("name", "test");
		item.SetProp("action", "test.edit");
		item.SetProp("img", "p-camera");
		item.SetProp("type", "form"); 
		item.AppendChild("msg", "off");
		ses.NewNode("timeout", "10");

Add a hint to our button:

<?xml version="1.0"?>
  <lang name="ru">
    <messages name="notify">
      <msg name="hint_test">Hint example</msg>