[%# 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 Novell.
  # All Rights Reserved.
  #
  # Contributor(s): Greg Hendricks <ghendricks@novell.com>
  #%]
  
<form method="GET" action="[% table.url_loc FILTER none %]" id="filter_form">
<input type="hidden" name="run_id" value="[% run.id FILTER none %]" />
<input type="hidden" name="expand_filter" id="expand_filter" value="[% expand_filter FILTER none %]" />
<script type="text/javascript">
  function toggleExp(obj){
    if (obj.value == 1){
      obj.value = 0;
    }
    else {
      obj.value = 1;
    }
  } 
</script>
[% query = table.get_query_part %]
[% IF table.url_loc == 'tr_show_run.cgi' %]
<input type="hidden" name="expand_report" id="expand_report" value="[% expand_report FILTER none %]" />
<div class="bz_row_header" style="font-size:12pt; font-weight: bold;">
  <img src="[% query.match('assignee') AND expand_report ? 'testopia/img/td.gif' : 'testopia/img/tr.gif' %]" id="cft" onclick="_sr(document.getElementById('caserun_report'),document.getElementById('cft')); toggleExp(document.getElementById('expand_report'))">
  <a href="javascript:_sr(document.getElementById('caserun_report'),document.getElementById('cft'));  toggleExp(document.getElementById('expand_report'))" style="text-decoration:none;">Reports</a>
</div>
<div id="caserun_report" [% query.match('assignee') AND expand_report ? 'style="display:block"' : 'style="display:none"' %]>
[% PROCESS "testopia/search/report-matrix.html.tmpl" 
   obj = table.list.0
%]
<p align="right">
  <input type="button" value="Report" onclick="document.getElementById('filter_form').action='tr_caserun_reports.cgi';document.getElementById('filter_form').submit();">
</p>
</div>
[% END %]
<div class="bz_row_header" style="font-size:12pt; font-weight: bold;">
  <img src="[% query.match('assignee') AND expand_filter ? 'testopia/img/td.gif' : 'testopia/img/tr.gif' %]" id="ft" onclick="_sr(document.getElementById('filter'),document.getElementById('ft')); toggleExp(document.getElementById('expand_filter'))">
  <a href="javascript:_sr(document.getElementById('filter'),document.getElementById('ft')); toggleExp(document.getElementById('expand_filter'))" style="text-decoration:none;">Filter</a>
</div>
<div id="filter" [% query.match('assignee') AND expand_filter ? 'style="display:block"' : 'style="display:none"' %]>
<table>
  <tr class="bz_row_header">
    <th>Status</th>
    <th>Category</th>
    <th>Build</th>
    <th>Priority</th>
    <th>Component</th>
    <th>Automatic</th>
    <td rowspan="2">
      <table>
        <tr>
          <th align="right">Assignee Contains</th>
          <td><input type="hidden" name="assignee_type" value="substring" />
              <input name="assignee">
          </td>
        </tr>
        <tr>
          <th align="right">Tested By Contains</th>
          <td><input type="hidden" name="testedby_type" value="substring" />
              <input name="testedby">
          </td>
        </tr>
        <tr>
          <th align="right">Summary Contains</th>
          <td><input type="hidden" name="case_summary_type" value="allwordssubstr" />
              <input name="case_summary">
          </td>
        </tr>
        <tr>
          <th align="right">Requirement</th>
          <td><input type="hidden" name="requirement_type" value="substring" />
              <input name="requirement">
          </td>
        </tr>
        <tr>
          <th align="right">Environment</th>
          <td><input type="hidden" name="environment_type" value="anyexact" />
              <input name="environment">
          </td>
        </tr>
        <tr>
          <th align="right">Case Tags</th>
          <td><input type="hidden" name="tags_type" value="anywords" />
              <input name="tags">
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td valign="top">
      [% PROCESS select sel = { name => "case_run_status_id", 
                                list => table.list.0.get_status_list,
                                elements => 6,
                                mult => 1, }
      %]
    </td>
    <td valign="top">
      [% PROCESS select sel = { name => "category", 
                                list => run.filter_case_categories,
                                byname => 1,
                                elements => 6,
                                mult => 1, }
      
      %]
    </td>
    <td valign="top">
      [% PROCESS select sel = { name => "build", 
                                list => run.filter_builds,
                                byname => 1,
                                elements => 6,
                                mult => 1, }
      %]
    </td>
    <td valign="top">
      [% PROCESS select sel = { name => "priority_id", 
                                list => table.list.0.case.get_priority_list,
                                elements => 6,
                                mult => 1, }
      %]
    </td>
    <td valign="top">
      [% PROCESS select sel = { name => "component", 
                                list => run.filter_components,
                                byname => 1,
                                elements => 6,
                                mult => 1, }
      %]
    </td>
    <td valign="top">
    [% PROCESS select sel = { name  => 'isautomated',
                  accesskey => 'a', 
                  list      => 
                    [   { id => "0", name => "Manual" },
                        { id => "1", name => "Automatic" }  ]
                  elements  => 5,
                  mult      => 1 } %]
    </td>
    <td valign="bottom">
      <input type="button" value="Clear" onclick="document.location='[% table.url_loc FILTER none %]?run_id=[% run.id FILTER none %]'"/><br/>
      <input type="submit" value="Filter" /></td>
  </tr>
</table>
</div>
</form>