[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Testopia System.
  #
  # The Initial Developer of the Original Code is Greg Hendricks.
  # Portions created by Greg Hendricks are Copyright (C) 2006
  # Greg Hendricks. All Rights Reserved.
  #
  # Contributor(s): Greg Hendricks <ghendricks@novell.com>
  #%]

<style type="text/css">
#completion_report td {
    font-weight: bold;
    width: 30px;
    text-align: center;
}
#completion_report a {
    color: black;
}
.report_header {
    font-weight: bold;
    background-color: #DCDCDC;
    text-align: left;
    padding: 2px;
}

.passed_cell{
    border: 1px solid black;
    background-color: #56e871;
    padding-left: 5px;
    padding-right: 5px;
}
.failed_cell{
    border: 1px solid black;
    background-color: #ed3f58;
    padding-left: 5px;
    padding-right: 5px;
}
.blocked_cell{
    border: 1px solid black;
    background-color: #e17a56;
    padding-left: 5px;
    padding-right: 5px;
}
.complete_cell{
    border: 1px solid black;
    background-color: #B8A0D2;
    padding-left: 5px;
    padding-right: 5px;
}
.idle_cell{
    border: 1px solid black;
    background-color: #858aef;
    padding-left: 5px;
    padding-right: 5px;
}

</style>
<h1>[% qname FILTER html %]</h1>
<h4>Priority Report for Runs: 
[% FOREACH r IN runs.split(',') %]
 <a href="tr_show_run.cgi?run_id=[% r FILTER html %]">[% r FILTER html %]</a>&nbsp;
[% END %] 
[% IF plans %]
 <br>In Plans: 
 [% FOREACH r IN plans.split(',') %]
   <a href="tr_show_plan.cgi?run_id=[% r FILTER html %]">[% r FILTER html %]</a>&nbsp;
 [% END %] 
[% END %]</h4>
<div id="completion_report">
  <table>
    <tr>
      <td>
      [% IF run_count > 1 %]
        <table style="cell-padding: 3px; border: 1px solid black">
          <tr>
            <th class="report_header" style="border-right: 2px solid black">PRIORITY</th>
            <th class="report_header">IDLE</th>
            <th class="report_header">PASSED</th>
            <th class="report_header">FAILED</th>
            <th class="report_header">BLOCKED</th>
            <th class="report_header">RUNNING</th>
            <th class="report_header">PAUSED</th>
            <th class="report_header">ERROR</th>
            <th class="report_header">Total</th>
          </tr>
          [% FOREACH p = priorities.keys.sort %]
          <tr>
            <td style="border-right: 2px solid black; font-weight: bold; text-align: left;">[% p FILTER no_break %]</td>
            <td class="idle_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=IDLE" target="_blank">[% priorities.$p.idle FILTER none %]</a></td>
            <td class="passed_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=PASSED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.passed FILTER none %]</a></td>
            <td class="failed_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=FAILED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.failed FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=BLOCKED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.blocked FILTER none %]</a></td>
            <td class="passed_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=RUNNING&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.running FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=PAUSED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.paused FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1&case_run_status=ERROR&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.error FILTER none %]</a></td>
            <td align="center"><a href="tr_list_caseruns.cgi?run_id=[% runs FILTER url_quote %]&build_id=[% builds FILTER url_quote %]&isactive=1" target="_blank">[% priorities.$p.total FILTER none %]</a></td>
          </tr>
          [% END %]
        </table>
      [% ELSE %]
        <table style="cell-padding: 3px; border: 1px solid black">
          <tr>
            <th class="report_header" style="border-right: 2px solid black">PRIORITY</th>
            <th class="report_header">IDLE</th>
            <th class="report_header">PASSED</th>
            <th class="report_header">FAILED</th>
            <th class="report_header">BLOCKED</th>
            <th class="report_header">RUNNING</th>
            <th class="report_header">PAUSED</th>
            <th class="report_header">ERROR</th>
            <th class="report_header">Total</th>
          </tr>
          [% FOREACH p = priorities.keys.sort %]
          <tr>
            <td style="border-right: 2px solid black; font-weight: bold; text-align: left;">[% p FILTER no_break %]</td>
            <td class="idle_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=IDLE&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.idle FILTER none %]</a></td>
            <td class="passed_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=PASSED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.passed FILTER none %]</a></td>
            <td class="failed_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=FAILED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.failed FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=BLOCKED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.blocked FILTER none %]</a></td>
            <td class="passed_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=RUNNING&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.running FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=PAUSED&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.paused FILTER none %]</a></td>
            <td class="blocked_cell"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]&case_run_status=PASSED&case_run_status=FAILED&case_run_status=ERROR&priority=[% p FILTER url_quote %]" target="_blank">[% priorities.$p.error FILTER none %]</a></td>
            <td align="center"><a href="tr_show_run.cgi?run_id=[% runs FILTER url_quote %]" target="_blank">[% priorities.$p.total FILTER none %]</a></td>
          </tr>
          [% END %]
        </table>
      [% END %]
      </td>
    </tr>
  </table>
</div>