[%# which one is authorized? #%]
[% IF !c.check_cmd_permissions('service', c.request.parameters.service, 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 add a service comment'
   description = 'This command is used to add a comment for the specified service. If you work with other administrators, you may find it useful to share information about a host or service that is having problems if more than one of you may be working on it. If you do not check the "persistent" option, the comment will automatically be deleted the next time your Monitoring is restarted.'
%]

[%# definition of the command send to your backend #%]
[% BLOCK action%]
    [% IF c.request.parameters.persistent %][% persistent_comment = 1 %][% ELSE %][% persistent_comment = 0 %][% END %]
    [% comment_data         = c.request.parameters.com_data %]
    [% service_desc         = c.request.parameters.service %]
    [% host_name            = c.request.parameters.host %]
    [% comment_author       = c.request.parameters.com_author %]

    ADD_SVC_COMMENT;[% sprintf("%s;%s;%d;%s;%s",host_name,service_desc,persistent_comment,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='optBoxRequiredItem'>Service:</td><td><b><input type='text' name='service' value='[% c.request.parameters.service %]'></b></td></tr>
<tr><td class='optBoxItem'>Persistent:</td><td><b><input type='checkbox' name='persistent'[% IF c.config.cmd_defaults.persistent_comments %] 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 %]
