[% statusmap_header = BLOCK %]
  <script language="javascript" type="text/javascript">
  <!--
  var img_src="[% url_prefix %]thruk/plugins/shinken_features/images/";
  -->
  </script>
[% END %]
[% PROCESS _header.tt
    extra_header => statusmap_header
    js           => "thruk/plugins/shinken_features/businessview.js"
    css          => "thruk/plugins/shinken_features/businessview.css"
%]


    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" width="33%">
          [% PROCESS _infobox.tt %]
        </td>
        <td align="center" valign="top" width="33%"></td>
        <td align="right" valign="bottom" width="33%">
          [% PROCESS _help.tt topic = "outagespbimp" %]
        </td>
      </tr>
    </table>
    <div align="center">
      <br>
      <div class='dataTitle'>Business Rule Elements</div>
      <br>


    [% FOREACH crit IN prios.reverse %]
    [% NEXT IF crit.count == 0 %]
    <table style="min-width: 600px;"><tr><td>
    <div class='dataTitle blockHead blockHeadBorder'>Priority: [% crit.text %] <img src="[% url_prefix %]thruk/themes/[% theme %]/images/criticity_[% crit.value %].png" height="16" alt="[% crit.text %]" title="[% crit.text %]"></div>
    [%# Global table %]
    <table class='data' style="min-width: 600px;">
      <tr>
        <td>
          [%# Higer level List %]
          <ul>
            [% i=0 %]
          [% FOREACH service = srv_pbs %]
          [% IF service.criticity == crit.value %]
            [% i = i + 1 %]
            [% j=0 %]
               [% IF service.has_been_checked == 0 %]
               [% SET s_status = 'servicePENDING' %]
               [% SET s_status_text = 'PENDING' %]
               [% ELSIF service.state == 0 %]
               [% SET s_status = 'serviceOK' %]
               [% SET s_status_text = 'OK' %]
               [% ELSIF service.state == 1 %]
               [% SET s_status = 'serviceWARNING' %]
               [% SET s_status_text = 'WARNING' %]
               [% ELSIF service.state == 2 %]
               [% SET s_status = 'serviceCRITICAL' %]
               [% SET s_status_text = 'CRITICAL' %]
               [% ELSIF service.state == 3 %]
               [% SET s_status = 'serviceUNKNOWN' %]
               [% SET s_status_text = 'UNKNOWN' %]
               [% END %]
               [%# Global table %]
            <li>
              <table>
                <tr class='dataOdd'>
                  <td class='[% s_status %]' width="80">[% s_status_text %]</td>
                  <td><div class='elementTitle'><a href='extinfo.cgi?type=2&amp;host=[% service.host_name | uri %]&amp;service=[% service.description | uri %]&amp;backend=[% service.peer_key %]'>[% service.host_name %]/[% service.description %]</a></div></td>
              <td class='void'>
              [%# Sublevel list %]
                <a id="togglelink-son-[% crit.value %]-[% i %]" class="internal" href="#" onclick="return toggleToc('son-[% crit.value %]-[% i %]')"><img id="img-son-[% crit.value %]-[% i %]" src="[% url_prefix %]thruk/plugins/shinken_features/images/go-next.png" alt="Expand/Reduce"> </a>
              </td></tr></table>
              <ul id="son-[% crit.value %]-[% i %]" style="display: none;">
                [% parents = service.services_parents %]
                [% FOREACH parent = parents %]
                  [% j = j + 1 %]
                  [% k=0 %]
                  [% subparents = parent.services_parents %]

                  [% IF parent.has_been_checked == 0 %]
                  [% SET s_status = 'servicePENDING' %]
                  [% SET s_status_text = 'PENDING' %]
                  [% ELSIF parent.state == 0 %]
                  [% SET s_status = 'serviceOK' %]
                  [% SET s_status_text = 'OK' %]
                  [% ELSIF parent.state == 1 %]
                  [% SET s_status = 'serviceWARNING' %]
                  [% SET s_status_text = 'WARNING' %]
                  [% ELSIF parent.state == 2 %]
                  [% SET s_status = 'serviceCRITICAL' %]
                  [% SET s_status_text = 'CRITICAL' %]
                  [% ELSIF parent.state == 3 %]
                  [% SET s_status = 'serviceUNKNOWN' %]
                  [% SET s_status_text = 'UNKNOWN' %]
                  [% END %]

                  [%# Sublevel Element %]
                  <li>
                    <table><tr class='dataOdd'><td class='[% s_status %]' width="80">[% s_status_text %]</td><td><div class='elementTitle2'><a href='extinfo.cgi?type=2&amp;host=[% parent.host_name | uri %]&amp;service=[% parent.description | uri %]&amp;backend=[% parent.peer_key %]'>[% parent.host_name %]/[% parent.description %]</a></div></td>
                    [% IF subparents.size > 0 %]
                        <td class='void'><a id="togglelink-son-[% crit.value %]-[% i %]-[% j %]" class="internal" href="#" onclick="return toggleToc('son-[% crit.value %]-[% i %]-[% j %]')">
                            <img id="img-son-[% crit.value %]-[% i %]-[% j %]" src="[% url_prefix %]thruk/plugins/shinken_features/images/go-next.png" alt="Expand/Reduce"></a>
                          </td>
                    </tr></table>
                    [% ELSE %]            [%# Fin du sub level item %]
                    </tr></table>
                    </li>
                    [% END %]

                    [%# if subparent, print them %]
                    [% IF subparents.size >= 1 %]

                      <ul id="son-[% crit.value %]-[% i %]-[% j %]" style="display: none;">
                      [% FOREACH subparent = subparents %]
                        [% k = k + 1 %]
                        [% IF subparent.has_been_checked == 0 %]
                        [% SET s_status = 'servicePENDING' %]
                        [% SET s_status_text = 'PENDING' %]
                        [% ELSIF subparent.state == 0 %]
                        [% SET s_status = 'serviceOK' %]
                        [% SET s_status_text = 'OK' %]
                        [% ELSIF subparent.state == 1 %]
                        [% SET s_status = 'serviceWARNING' %]
                        [% SET s_status_text = 'WARNING' %]
                        [% ELSIF subparent.state == 2 %]
                        [% SET s_status = 'serviceCRITICAL' %]
                        [% SET s_status_text = 'CRITICAL' %]
                        [% ELSIF subparent.state == 3 %]
                        [% SET s_status = 'serviceUNKNOWN' %]
                        [% SET s_status_text = 'UNKNOWN' %]
                        [% END %]
                         [%# subsub element %]
                         <li><table><tr class='dataOdd'><td class='[% s_status %]' width="80">[% s_status_text %]</td><td><div class='elementTitle3'><a href='extinfo.cgi?type=2&amp;host=[% subparent.host_name | uri %]&amp;service=[% subparent.description | uri %]&amp;backend=[% subparent.peer_key %]'>[% subparent.host_name %]/[% subparent.description %]</a></div></td></tr></table></li>
                      [% END %]
                      [%# End of subsub parent listing%]
                      </ul>
                      [%# end of the sub element item %]
                    </li>
                [%# end parent loop %]
                [% END %]
            [% END %]
            </ul>
     </li>
    [% END %]


    [%# end of the test for this service criticity %]
    [% END %]

     </ul></td></tr></table>
    [%# end of the main foreach on criticities, and the look for void criticity %]
</td></tr></table>
<br>
    [% END %]

    </div>

<script language="javascript" type="text/javascript">
<!--
  set_initial_toc_states();
-->
</script>

[% PROCESS _footer.tt %]
