[%# which one is authorized? #%]
[% IF !c.check_cmd_permissions('host', c.request.parameters.host) %]
  [% WRAPPER error.tt errorMessage = "you are not authorized for this command" errorDescription = "check your configuration if you believe this is an error" %][% END %]
[% ELSE %]

[%# description used by the commands page #%]
[% WRAPPER $cmd_tt
   request     = 'You are requesting to send a custom host notification'
   description = 'This command is used to send a custom notification about the specified host. Useful in emergencies when you need to notify admins of an issue regarding a monitored system or service. Custom notifications normally follow the regular notification logic in your Monitoring. Selecting the <i>Forced</i> option will force the notification to be sent out, regardless of the time restrictions, whether or not notifications are enabled, etc. Selecting the <i>Broadcast</i> option causes the notification to be sent out to all normal (non-escalated) and escalated contacts. These options allow you to override the normal notification logic if you need to get an important message out.'
%]

[%# definition of the command send to your backend #%]
[% BLOCK action%]
    [% IF c.request.parameters.broadcast_notification %][% broadcast_notification = 1 %][% ELSE %][% broadcast_notification = 0 %][% END %]
    [% IF c.request.parameters.force_notification %][% force_notification = 1 %][% ELSE %][% force_notification = 0 %][% END %]
    [% comment_data         = c.request.parameters.com_data %]
    [% host_name            = c.request.parameters.host %]
    [% comment_author       = c.request.parameters.com_author %]
    [% options              = 0 + force_notification * 2 + broadcast_notification * 1 %]

    SEND_CUSTOM_HOST_NOTIFICATION;[% sprintf("%s;%d;%s;%s",host_name,options,comment_author,comment_data) %]
[% END %]

[%# definition of the html form data #%]
<tr><td class='optBoxRequiredItem'>Host Name:</td><td><b><input type='text' name='host' value='[% c.request.parameters.host %]'></b></td></tr>
<tr><td class='optBoxItem'>Forced:</td><td><b><input type='checkbox' name='force_notification'[% IF c.config.cmd_defaults.force_notification %] checked[% END %]></b></td></tr>
<tr><td class='optBoxItem'>Broadcast:</td><td><b><input type='checkbox' name='broadcast_notification'[% IF c.config.cmd_defaults.broadcast_notification %] checked[% END %]></b></td></tr>
<tr><td class='optBoxRequiredItem'>Author (Your Name):</td><td><b><input type='text' name='com_author' value='[% comment_author %]'[% IF c.config.cgi_cfg.lock_author_names %] readonly disabled[% END %]></b></td></tr>
<tr><td class='optBoxRequiredItem'>Comment:</td><td><b><input type='text' name='com_data' value='' size= "40"></b></td></tr>

[% END %]
[% END %]
