[%# 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 Test Runner System.
  #
  # The Initial Developer of the Original Code is Maciej Maczynski.
  # Portions created by Maciej Maczynski are Copyright (C) 2001
  # Maciej Maczynski. All Rights Reserved.
  #
  # Contributor(s): Greg Hendricks <ghendricks@novell.com>
  #%]


[% IF report %]
<form id="caserun_search_form" action="tr_caserun_reports.cgi" method="GET"> 
[% PROCESS "testopia/search/report-matrix.html.tmpl" 
   obj = caserun
%]   
[% ELSE %]
<form id="caserun_search_form" action="tr_list_caseruns.cgi" method="GET">
[% END %]
  <input type="hidden" name="current_tab" value="[% current_tab FILTER none %]" />
<fieldset>
    <legend><strong>Product</strong></legend>
<table>
  <tr class="bz_row_header">
    <th>Status</th>
    <th>Run Status</th>
    <th>Priority</th>
    <th>Automatic</th>
  [% IF Param('useclassification') %]
    <th>Classification</th>
  [% END %]
    <th>Product</th>
  </tr>
  <tr>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name => "case_run_status_id", 
                              list => caserun.get_status_list,
                              elements => 6,
                              mult => 1, }
    %]
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'run_status',
                              accesskey => 's', 
                              list      => run.get_status_list
                              elements  => 5,
                              mult      => 1 } %]
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'priority_id',
                              accesskey => 'p', 
                              list      => case.get_priority_list
                              elements  => 5,
                              mult      => 1 } %]
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'isautomated',
                  accesskey => 'a', 
                  list      => 
                    [   { id => "0", name => "Manual" },
                        { id => "1", name => "Automatic" }  ]
                  elements  => 5,
                  mult      => 1 } %]
    </td>
  [% IF Param('useclassification') %]
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'classification',
                  accesskey => 'p', 
                  list      => user.get_selectable_classifications,
                  elements  => 5,
                  byname    => 1,
                  mult      => 1  
                  events    => 'onChange="document.getElementById(\'component\').disabled=true;
                                          document.getElementById(\'version\').disabled=true;
                                          document.getElementById(\'milestone\').disabled=true;
                                          document.getElementById(\'category\').disabled=true;
                                          document.getElementById(\'build\').disabled=true;
                                          document.getElementById(\'environment\').disabled=true;
                                          document.getElementById(\'product\').disabled=true; 
                                          t.onProductSelection(this)"'  } %]

    </td>
    [% END %]
    <td colspan="3" align="center" >
    [% PROCESS select sel = { name  => 'product',
                              accesskey => 'p', 
                              list      => user.get_selectable_products,
                              elements  => 5,
                              byname    => 1,
                              mult      => 1  
                              events    => 'onChange="document.getElementById(\'component\').disabled=true;
                                                      document.getElementById(\'version\').disabled=true;
                                                      document.getElementById(\'milestone\').disabled=true;
                                                      document.getElementById(\'category\').disabled=true;
                                                      document.getElementById(\'build\').disabled=true;
                                                      document.getElementById(\'environment\').disabled=true;
                                                      t.onProductSelection(this)"' } %]
    </td>
  </tr>
</table>
<table>
  <tr class="bz_row_header">
    <th>Component</th>
    <th>Version</th>
    <th>Milestone</th>
  </tr>
  <tr>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'component',
                              accesskey => 'm', 
                              list      => components
                              elements  => 5,
                              mult      => 1 } %]
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'version',
                              accesskey => 'v', 
                              list      => versions,
                              elements  => 5,
                              mult      => 1 } %]   
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'milestone',
                              accesskey => 'm', 
                              list      => milestones,
                              elements  => 5,
                              mult      => 1 } %] 
    </td>
  <tr class="bz_row_header">
    <th>Category</th>
    <th>Build</th>
    <th>Environment</th>
  </tr>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'category',
                              accesskey => 't', 
                              list      => categories,
                              elements  => 5,
                              mult      => 1 } %]   
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'build',
                              accesskey => 't', 
                              list      => builds,
                              elements  => 5,
                              mult      => 1 } %]   
    </td>
    <td style="padding-right: 30px;">
    [% PROCESS select sel = { name  => 'environment',
                              accesskey => 'e', 
                              list      => environments,
                              elements  => 5,
                              mult      => 1 } %] 
    </td>  

  </tr>
</table>

</fieldset>
<fieldset>
    <legend><strong>Roles</strong></legend>
<table>
  <tr>
    <th align="right">Assignee</th>
    <td>
    [% PROCESS select sel = { name => 'assignee_type',
                              list => email_variants } %]</td>
    <td>
        <input name="assignee">
    </td>
  </tr>
  <tr>
    <th colspan="2"><input type="radio" style="border: none" name="andor" value="1"/>AND
      <input type="radio" style="border: none" name="andor" value="0"  checked="checked"/>OR</th>

  </tr>
  <tr>
    <th align="right">Tested By</th>
    <td>
    [% PROCESS select sel = { name => 'testedby_type',
                              list => email_variants } %]</td>
    <td>
        <input name="testedby">
    </td>
  </tr>
</table>
</fieldset>
<fieldset>
    <legend><strong>Attributes</strong></legend>
<table>

  <tr>
    <th align="right">Case Summary</th>
    <td>
    [% PROCESS select sel = { name => 'case_summary_type',
                              list => query_variants } %]</td>
    <td>
        <input name="case_summary">
    </td>
  </tr>
  <tr>
    <th align="right">Requirement</th>
    <td>
    [% PROCESS select sel = { name => 'requirement_type',
                              list => query_variants } %]</td>
    <td>
        <input name="requirement">
    </td>
  </tr>
  <tr>
    <th align="right">Case Tags</th>
    <td>
    [% PROCESS select sel = { name => 'tags_type',
                              list => tag_variants } %]</td>
    <td>
        <input name="tags">
    </td>
  </tr>
  <tr>
    <th align="right">Notes</th>
    <td>
    [% PROCESS select sel = { name => 'notes_type',
                              list => query_variants } %]</td>
    <td>
        <input name="notes">
    </td>
  </tr>
</table>
<table>
  <tr>
    <th align="right">Environment Categories:</th>
    <td>
    [% PROCESS select sel = { name => 'env_category_type',
                              list => query_variants } %]</td>
    <td><input name="env_category"></td>
  </tr>
  <tr>
    <th align="right">Environment Elements:</th>
    <td>
    [% PROCESS select sel = { name => 'env_element_type',
                              list => query_variants } %]</td>
    <td><input name="env_element"></td>
  </tr>
  <tr>
    <th align="right">Environment Properties:</th>
    <td>
    [% PROCESS select sel = { name => 'env_property_type',
                              list => query_variants } %]</td>
    <td><input name="env_property"></td>
  </tr>
  <tr>
    <th align="right">Environment Value:</th>
    <td>
    [% PROCESS select sel = { name => 'env_value_type',
                              list => query_variants } %]</td>
    <td><input name="env_value"></td>
  </tr>
</table>

</fieldset>
<legend><strong>Linked Bug Attributes</strong></legend>
<table>
  <tr>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="bug_status" accesskey="a">St<u>a</u>tus</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_status',
                                    list => bug_status,
                                    elements  => 5,
                                    mult      => 1 } %]
        </tr>
      </table>
    </td>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="resolution" accesskey="r"><u>R</u>esolution</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_resolution',
                                    list => resolution,
                                    elements  => 5,
                                    mult      => 1 } %]
        </tr>
      </table>
    </td>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="bug_severity">Severity</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_severity',
                                    list => bug_severity,
                                    elements  => 5,
                                    mult      => 1}%]
        </tr>
      </table>
    </td>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="priority" accesskey="i">Pr<u>i</u>ority</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_priority',
                                    list => bug_priority,
                                    elements  => 5,
                                    mult      => 1 } %]
        </tr>
      </table>
    </td>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="rep_platform" accesskey="h"><u>H</u>ardware</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_rep_platform',
                                    list => rep_platform,
                                    elements  => 5,
                                    mult      => 1 } %]
        </tr>
      </table>
    </td>
    <td>
      <table>
        <tr>
          <th align="left">
            <label for="op_sys" accesskey="o"><u>O</u>S</label>:
          </th>
        </tr>
        <tr valign="top">
          [% PROCESS select sel = { name => 'bug_op_sys',
                                    list => op_sys,
                                    elements  => 5,
                                    mult      => 1 } %]
        </tr>
      </table>
    </td>
  </tr>
</table>
<table>
  <tr>
    <th align="right">
      <label for="short_desc" accesskey="s"><u>S</u>ummary</label>:
    </th>
    <td>
    [% PROCESS select sel = { name => 'bug_short_desc_type',
                              list => query_variants } %]
    </td>
    <td>
      <input name="bug_short_desc" id="bug_short_desc" size="40"
             value="[% default.bug_short_desc.0 FILTER html %]">
    </td>
  </tr>
  [% FOREACH field = [
    { name => "bug_long_desc", description => "A&nbsp;<u>C</u>omment",
      accesskey => 'c' },
    { name => "bug_file_loc", description => "The&nbsp;<u>U</u>RL",
      accesskey => 'u' },
    { name => "bug_status_whiteboard", description => "<u>W</u>hiteboard",
      accesskey => 'w' } ] %]

    [% UNLESS field.name == 'status_whiteboard' AND NOT Param('usestatuswhiteboard') %]
    <tr>
      <th align="right">
        <label for="[% field.name %]" accesskey="[% field.accesskey %]">[% field.description %]</label>:
      </th>
      <td>
        <select name="[% field.name %]_type">
        [% FOREACH qv = query_variants %]
          [% type = "${field.name}_type" %]
          <option value="[% qv.id %]"
            [% " selected" IF default.$type.0 == qv.id %]>[% qv.name %]</option>
        [% END %]
        </select>
      </td>
      <td><input name="[% field.name %]" id="[% field.name %]" size="40"
                 value="[% default.${field.name}.0 FILTER html %]">
      </td>
      <td></td>
    </tr>
    [% END %]
  [% END %]

    <tr>
      <th align="right">
        <label for="keywords" accesskey="k"><a href="describekeywords.cgi"><u>K</u>eywords</a></label>:
      </th>
      <td>
        <select name="keywords_type">
        [% FOREACH qv = [
          { name => "allwords", description => "contains all of the keywords" },
          { name => "anywords", description => "contains any of the keywords" },
          { name => "nowords",  description => "contains none of the keywords" } ] %]

          <option value="[% qv.name %]"
            [% " selected" IF default.keywords_type.0 == qv.name %]>
            [% qv.description %]</option>
        [% END %]
        </select>
      </td>
      <td>
        <input name="bug_keywords" id="bug_keywords" size="40"
               value="[% default.bug_keywords.0 FILTER html %]">
      </td>
    </tr>

  [%# Deadline %]
  [% IF user.in_group(Param("timetrackinggroup")) %]
    <tr>
      <th align="right">
        <label for="deadlinefrom" accesskey="l">Dead<u>l</u>ine</label>:
      </th>
      <td>
        from&nbsp;
        <input name="deadlinefrom" id="deadlinefrom" size="10" maxlength="10">&nbsp;
        to&nbsp;
        <input name="deadlineto" size="10" maxlength="10">
      </td>
      <td>
        <small>(YYYY-MM-DD)</small>
      </td>
    </tr>
  [% END %]
</table>
<table>
  <tr>
    <td>


<table cellspacing="0" cellpadding="0">
  <tr>
    <td>
      Any one of:
    </td>
  </tr>
  <tr>
    <td>
      <input type="checkbox" name="bug_emailassigned_to[% n %]"
             id="emailassigned_to[% n %]" value="1"
             [% " checked" IF default.bug_emailassigned_to.$n %]>
      <label for="emailassigned_to[% n %]">
        the [% terms.bug %] assignee
      </label>
    </td>
  </tr>
  <tr>
    <td>
      <input type="checkbox" name="bug_emailreporter[% n %]"
             id="emailreporter[% n %]" value="1"
             [% " checked" IF default.bug_emailreporter.$n %]>
      <label for="emailreporter[% n %]">
        the reporter
      </label>
    </td>
  </tr>
  [% IF Param('useqacontact') %]
  <tr>
    <td>
      <input type="checkbox" name="bug_emailqa_contact[% n %]"
             id="emailqa_contact[% n %]" value="1"
             [% " checked" IF default.bug_emailqa_contact.$n %]>
      <label for="emailqa_contact[% n %]">
        the QA contact
      </label>
    </td>
  </tr>
  [% END %]
  <tr>
    <td>
      <select name="bug_emailtype[% n %]">
      [% FOREACH qv = [
        { name => "substring", description => "contains" },
        { name => "exact", description => "is" },
        { name => "regexp", description => "matches regexp" },
        { name => "notregexp", description => "doesn't match regexp" } ] %]

        <option value="[% qv.name %]"
          [% " selected" IF default.bug_emailtype.$n == qv.name %]>[% qv.description %]</option>
      [% END %]
      </select>
    </td>
  </tr>
  <tr>
    <td>
      <input name="bug_email[% n %]" size="25" value="[% default.email.$n FILTER html %]">
    </td>
  </tr>
  <tr><td>Where attached bugs are numbered: <input name="bug_id"></td></tr>
</table>


    </td>
  </tr>
</table>   
</fieldset>

<p style="font-weight: bold;">
  <label for="case_id">
     Include case-runs from cases numbered: 
  </label>
  <input name="case_id" id="case_id">
  <br/><br/>
  <label for="plan_id">
     Include case-runs from plans numbered: 
  </label>
  <input name="plan_id" id="plan_id">
  <br/><br/>
  <label for="run_id">
     Include case-runs in runs numbered: 
  </label>
  <input name="run_id" id="run_id">
  <br/><br/>
  <label for="isactive">
     Consolidate results (unchecking will include only results from the latest build or environment): 
  </label>
  <input id="isactive" type="checkbox" name="isactive" value="1" checked="checked">
  <br/><br/>
  
</p>

</form>  
