[% USE date %]
[% PROCESS _header.tt %]
[% PROCESS _message.tt %]
[% PROCESS _sounds.tt %]

    <table border="0" width="100%" cellspacing="0" cellpadding="0" id="top_pane"[% IF hidetop == 1 %]style="visibility:hidden; display:none;"[% END %]>
      <tr>
        <td align="left" valign="top" width="33%">
          [% PROCESS _infobox.tt %]
        </td>
        <td align="center" valign="top" width="33%">[% PROCESS _host_status_details_box.tt %]</td>
        <td align="center" valign="top" width="33%">[% PROCESS _service_status_details_box.tt %]</td>
        <td align="right" valign="bottom">
          [% PROCESS _help.tt topic = "mine_map" %]
        </td>
      </tr>
    </table>
    <br>
    <table border="0" width="100%" cellpadding=0 cellspacing=0>
      <tr>
        <td valign="top" align="left" width="33%" nowrap>
          [% PROCESS _status_filter.tt %]
          <br>
        </td>
        <td valign="top" align="center" width="33%" nowrap>
          <div align="center" class='statusTitle'>
            [% IF custom_title != '' %][% custom_title %]
            [% ELSIF hostgroup != '' %]Mine Map For Host Group '[% hostgroup %]'
            [% ELSIF servicegroup %]Mine Map For Service Group '[% servicegroup %]'
            [% ELSIF host == 'all' %]Mine Map For All Host
            [% ELSIF host != '' %]Mine Map For Host '[% host %]'
            [% ELSE %]
            Mine Map
            [% END %]
          </div>
          <br>
        </td>
        <td valign="bottom" align="right" width="33%">
          [% PROCESS _add_bookmark.tt %]
          [% PROCESS _show_link.tt %]
        </td>
      </tr>
    </table>

    <div align="center">[% PROCESS _pager.tt %]</div>

<table class='status servicestatus minemap' id="statusTable" style="background: transparent; border: 0px; width: auto;">
<tr>
  <td style="background: transparent; border: 0px;"></td>
  [% FOREACH svc = services.keys.sort %]
  [% SET class = 'statusEven' IF loop.even %]
  [% SET class = 'statusOdd'  IF loop.odd %]
  <td class='[% class %] minemap_head' title="[% svc %]" style="height:[% head_height %]px;"><div class="vertical"><a href='[% uri_with(c, service => svc).replace("minemap.cgi", "status.cgi") %]'>[% svc %]</a></div></td>
  [% END %]
</tr>
[% FOREACH hstname = hostnames.keys.sort %]
[% SET hst       = hostnames.$hstname %]
[% SET hostclass = 'statusEven' IF loop.even %]
[% SET hostclass = 'statusOdd'  IF loop.odd %]
[% SET loopclass = hostclass %]
[% IF hst.host_state == 1 %]
  [% hostclass = 'statusHOSTDOWN' %]
[% ELSIF hst.host_state == 2 %]
  [% hostclass = 'statusHOSTUNREACHABLE' %]
[% END %]
<tr>
  [% SET host_comment_count = 0 %]
  [% SET host_comment_count = hst.host_comments.size IF hst.host_comments %]
  <td class='[% hostclass %]' style="height: 18px;">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
        <th align="left" class='[% hostclass %]' style="height: 18px;"><a href='[% uri_with(c, host => hst.host_name).replace("minemap.cgi", "status.cgi") %]' title='[% hst.host_address %]'>[% hst.host_name %]</a></th>
        <td align="right" class='[% hostclass %]' style="height: 18px;">
          [% PROCESS _status_host_attributes.tt hostprefix="host_" host=hst host_comment_count=host_comment_count with_status=0 imgsize=15 %]
        </td>
      </tr>
    </table>
  </td>
  [% FOREACH svcname = services.keys.sort %]
    [% svcbg = loopclass %]
    [% IF matrix.exists(hstname) && matrix.$hstname.exists(svcname) %]
        [% SET s = matrix.$hstname.$svcname %]
        [% SET size = 6 %]
        [% SET icon_bg_class = loopclass %]
        [% IF s.has_been_checked == 0 %]
            [% serviceclass = 'servicePENDING' %]
            [% state = 'PENDING' %]
        [% ELSIF s.state == 0 %]
            [% serviceclass = 'serviceOK' %]
            [% state = 'OK' %]
        [% ELSIF s.state == 1 %]
            [% serviceclass = 'serviceWARNING' %]
            [% state = 'WARNING' %]
            [% icon_bg_class = 'statusBGWARNING' %]
            [% size = 8 %]
        [% ELSIF s.state == 2 %]
            [% serviceclass = 'serviceCRITICAL' %]
            [% state = 'CRITICAL' %]
            [% size = 10 %]
            [% icon_bg_class = 'statusBGCRITICAL' %]
        [% ELSIF s.state == 3 %]
            [% serviceclass = 'serviceUNKNOWN' %]
            [% state = 'UNKNOWN' %]
            [% size = 10 %]
            [% icon_bg_class = 'statusBGUNKNOWN' %]
        [% END %]
        [% SET comment_count = s.comments.size %]
        [% SET peer_key      = s.peer_key %]
        [% SET program_start = pi_detail.$peer_key.program_start %]

        [% info = BLOCK %]
            <a href='extinfo.cgi?type=2&amp;host=[% s.host_name | uri %]&amp;service=[% s.description | uri %]'>View Full Service Details</a>
            <table border=0 class="extdetails">
            <tr><th class="dataVar">Status:</th><td class="dataVal"><div class="[% serviceclass %]">[% state %]</div>&nbsp;&nbsp;(since [% IF s.last_state_change %][% duration(date.now - s.last_state_change) %][% ELSE %][% duration(date.now - program_start) %]+[% END %])</td></tr>
            [% IF s.state != 0 %]
            <tr><th class="dataVar">Current Attempt:</th><td class="dataVal">[% s.current_attempt %]/[% s.max_check_attempts %]&nbsp;&nbsp;([% IF s.state_type == 1 %]HARD[% ELSE %]SOFT[% END%] state)</td></tr>
            <tr><th class="dataVar">Last Check Time:</th><td class="dataVal">[% IF s.has_been_checked == 0 %]never[% ELSE %][% date_format(c, s.last_check) %][% END %]</td></tr>
            <tr><th class="dataVar">Next Scheduled Check:</th><td class="dataVal">[% IF s.next_check %][% date_format(c, s.next_check) %][% ELSE %]N/A[% END %][% IF s.is_executing > 0 %]<img src="[% url_prefix %]thruk/themes/[% theme %]/images/waiting.gif" alt="This service is currently executing its servicecheck" title="This service is currently executing its servicecheck" border="0" height="20" width="20">[% END %]</td></tr>
            <tr><th class="dataVar">In Scheduled Downtime?</th><td class="dataVal">[% IF s.scheduled_downtime_depth > 0 %]<div class='downtimeACTIVE'>&nbsp;&nbsp;YES&nbsp;&nbsp;</div>[% ELSE %]<div class='downtimeINACTIVE'>&nbsp;&nbsp;NO&nbsp;&nbsp;</div>[% END %]</td></tr>
            <tr><th class="dataVar">Acknowledged?</th><td class="dataVal">[% IF s.acknowledged %]<div class='downtimeACTIVE'>&nbsp;&nbsp;YES&nbsp;&nbsp;</div>[% ELSE %]<div class='downtimeINACTIVE'>&nbsp;&nbsp;NO&nbsp;&nbsp;</div>[% END %]</td></tr>
            [% END %]
            <tr><th class="dataVar" nowrap valign="top">Plugin Output:<br></th><td class="dataVal">
            [% IF s.has_been_checked == 0 %]service has not been checked yet[% END %]
            [% IF escape_html_tags %]
                [% escape_html(s.plugin_output) %]<br>
                [% escape_html(nl2br(s.long_plugin_output)) %]
            [% ELSE %]
              [% s.plugin_output %]<br>
              [% nl2br(s.long_plugin_output) %]
            [% END %]
            </td></tr>
            </table>
        [% END %]

        [% content = BLOCK %]
          [% IF s.acknowledged %]
            <img src="[% url_prefix %]thruk/themes/[% theme %]/images/ack.gif" alt="acknowledged" height="15" width="15">
            [% svcbg = icon_bg_class %]
          [% ELSIF s.scheduled_downtime_depth > 0 %]
            <img src="[% url_prefix %]thruk/themes/[% theme %]/images/downtime.gif" alt="downtime" height="15" width="15">
            [% svcbg = icon_bg_class %]
          [% ELSE %]
          <div class="[% serviceclass %]" style="width:[% size %]px; height:[% size %]px; line-height:[% size %]px; border: 1px outset black;">&nbsp;</div>
          [% END %]
        [% END %]
        <td class='[% svcbg %] clickable' align="center" [% info_popup_event_type %]="return overlib(this.abbr,CAPTION,'[% s.host_name %] - [% s.description %]',WIDTH,600,[% c.config.info_popup_options %]);" abbr='[% escape_html(info.replace("\n", "")) %]'>[% content %]</td>
    [% ELSE %]
    <td class='[% svcbg %]' align="center">-</td>
    [% END %]
  [% END %]
</tr>
[% END %]
</table>


<div align="center">[% PROCESS _pager.tt %]</div>
<br>
<div class='itemTotalsTitle'>[% IF !has_error && data.size %][% data.size %] of [% pager.total_entries %][% ELSE %]0[% END %] Matching Host Entries Displayed</div>

[% PROCESS _footer.tt %]
