Banners

From ISPWiki

Jump to: navigation, search

A banner is an interface element that appears at the top of a page. It provides a user with various information regardless of the module he is in.

To form a banner with your handler, you need to create the following XML element:

<xs:element name="banner">
  <xs:complexType>
      <xs:attribute name="id" use="required"/>
      <xs:attribute name="status" use="required"/>
      <xs:attribute name="infotype"/>
      <xs:attribute name="info"/>
      <xs:attribute name="nodismiss"/>
  </xs:complexType>
</xs:element>

The banner element contains a message that will be shown to a user:

the id attribute
Banner name, unique identifier.
the status attribute
Priority, importance of the information.
the infotype attribute
Type of the information that can be found by following the "More information" link on the banner.
the info attribute
Information for the "More information" link.
the nodismiss attribute
If any, the "Hide" link is not displayed.

The status attribute can have the following values:

1
Critical information, the red banner will be displayed.
2
Warnings, the yellow banner will be displayed.
3
Useful information, the green banner will be displayed.

The infotype attribute can have the following values:

help
link to a Documentation page, the info attribute contains the name of a documentation section.
url
random link that is specified in the info attribute.
func
link to the control panel's module, which name is specified in the info attribute.
formfunc
link to the control panel's form, which name is specified in the info attribute.

If several banners were formed, the one with higher priority will be shown (the least value of the status attribute). If banners have the same priority, the one that was formed first will be shown.

Use the functions below for managing banners from external applications in ISPmanager 4.3.53 and later:

  • banner.new - installing a banner:
    • elid - banner unique identifier;
    • status - see above. The default value is 2;
    • infotype - see above. The default value is;
    • info - see above;
    • param - additional parameters;
  • banner.del - deleting a banner:
    • elid - banner unique identifier;
  • dismiss - hiding a banner:
    • elid - banner unique identifier;

A banner will be set for the current authorized user. For example, if you wish to set a banner for root, you need to execute the following command as root:

/usr/local/ispmgr/sbin/mgrctl banner.new elid=oldpasswd status=1

in order to hide the banner

/usr/local/ispmgr/sbin/mgrctl dismiss elid=oldpasswd

A text should be put into the XML description file, the same way you do it for plug-ins, for example the etc/ispmgr_mod_customalert.xml file

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
  <lang name="en">
    <messages name="alert">
      <msg name="myalert">My alert message</msg>
    </messages>
  </lang>
  <lang name="ru">
    <messages name="alert">
      <msg name="myalert">Text of my message</msg>
    </messages>
  </lang>
</mgrdata>


The example above shows the message for the banner (id) myalert.

Was this helpful? Yes | No
Personal tools