[%# 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): Ed Fuentetaja <efuentetaja@acm.org>
  #                 Greg Hendricks <ghendricks@novell.com>
  #                 Tyler Peterson <typeterson@novell.com>
  #%]

[%# INTERFACE:
  # ...
  #%]

[% IF case.canedit %]
<script src="testopia/js/DocumentManager.js" type="text/javascript"></script>
<script type="text/javascript">
    dojo.require("dojo.widget.Editor2");  
    dojo.require("dojo.widget.Editor2Plugin.DialogCommands");  
    setupDM     = new DocumentManager("tcsetup",     "[% action FILTER html %]", ["tcsetupHeading"]);
    breakdownDM = new DocumentManager("tcbreakdown", "[% action FILTER html %]", ["tcbreakdownHeading"]);
    actionDM    = new DocumentManager("tcaction",    "[% action FILTER html %]", ["tcactionHeading"]);
    effectDM    = new DocumentManager("tceffect",    "[% action FILTER html %]", ["tceffectHeading"]);
</script>
[% END %]
<a name="attributes"></a>
  <input type="hidden" name="case_id" value="[% case.id FILTER none %]"/>
<table border="0">
<tr><td>  
  <table border="0">
    <tr>
      <td valign="top" align="right"><b>Summary</b></td>
      <td colspan="3"><input name="summary" size="80" value="[% case.summary FILTER none %]"></td>
    </tr>
    <tr>
      <td align="right"><b>Default Tester</b></td>
      <td><input name="tester" id="tester" size="30" value="[% case.default_tester.login FILTER html %]" /></td>
      <td align="right"><b>Add Tags</b></td>
      <td><input name="addtags" size="30" /></td>
    </tr>
    
    <tr>
      <td align="right"><b>Alias</b></td>
      <td><input name="alias" size="30" value="[% case.alias FILTER none %]"></td>
      <td align="right"><b>Requirement:</b></td>
      <td><input name="requirement" size="30" value="[% case.requirement FILTER none %]"></td>
    </tr>
  
    <tr>
      <td align="right"><b>Status</b></td>
      <td>
        [% IF action == 'Add' %]
          [% status_default = Param('default-test-case-status') %]
        [% ELSE %]
          [% status_default = case.status %]
        [% END %]
        [% PROCESS select sel = { name      => 'status',
                                  accesskey => 's', 
                                  list      => case.get_status_list
                                  default   => status_default } %]
      </td>
      <td align="right"><b>Automatic</b></td>
      <td><select name="isautomated" id="isautomated">
            <option value="0">Manual</option>
            <option value="1" [% 'selected' IF case.isautomated %]>Automatic</option>
          </select>
      </td>
    </tr>

    <tr>
      <td align="right"><b>Priority<b></b></b></td>
      <td>
        [% PROCESS select sel = { name      => 'priority',
                                  accesskey => 'p', 
                                  list      => case.get_priority_list
                                  default   => case.priority ? case.priority : Param('defaultpriority')} %]
      </td>
      
      <td align="right"><b>Script</b></td>
      <td><input name="script" id="script" value="[% case.script FILTER none %]"></td>
    </tr>

    <tr>
      <td align="right"><b><a href="tr_categories.cgi?plan_id=[% case.plans.0.id %]" target="_blank">Category</a></b></td>
      <td>
        [% PROCESS select sel = { name      => 'category',
                                  accesskey => 'c', 
                                  list      => case.get_category_list
                                  default   => case.category.name } %]
      </td>
      <td align="right"><b>Arguments:</b></td>
      <td><input name="arguments" id="arguments" value="[% case.arguments FILTER none %]"></td>
    </tr>
    <tr>
      <th align="right">Add to Runs</th><td colspan="3"><input name="addruns" size="30"></td>
    </tr>  
  </table> 
 </td>
[% IF action == "Add" %]

  <td valign="top">
    <table>
      <tr><th align="center">Select Components From</th></tr>
      <tr>
      <td>
      [% PROCESS select sel = { name      => 'prod_pick',
                                list      => user.get_selectable_products,
                                default   => case.get_product_ids.0,
                                events    => 'onChange="getProdComps(this.value)"',
                                accesskey => 'p' } %]
      </td>
    </tr>
    <tr>
        <td>
    [% comps = [] %]
    [% FOREACH c = case.components %]
      [% comps.push(c.id) %]
    [% END %]
  
    [% PROCESS select sel = { name      => 'components',
                              accesskey => 'c', 
                              list      => case.get_selectable_components(1)
                              default   => comps
                              mult      => 1
                              deflist   => 1
                              elements  => 7 
                              events    => "onChange=\"chgTester(this)\""} %]

        </td>
      </tr>
    </table>
</td>
[% END %]
</tr> 
</table>
  <p align="right">
    <input type="SUBMIT" name="action" id="action" class="tr_button" value="[% action FILTER html %]">
  </p>
  
<br><br>
<h3>Dependencies</h3>
  <table align="center">
    <tr>
      <th> Depends on </th>
      <th> Blocks </th>
    </tr>
    <tr>
      <td> 
      [% FOREACH dep = case.dependson %]
        <a href="tr_show_case.cgi?case_id=[% dep.id FILTER none %]" title="[% dep.summary %]">[% dep.id FILTER none %]</a> 
      [% END %]
      </td>
      <td> 
      [% FOREACH dep = case.blocked %]
        <a href="tr_show_case.cgi?case_id=[% dep.id FILTER none %]" title="[% dep.summary %]">[% dep.id FILTER none %]</a> 
      [% END %]
      </td>
    </tr>
    <tr>
      <td> <input name="tcdependson" size="30" value="[% case.dependson_list %]"> </td>
      <td> <input name="tcblocks" size="30" value="[% case.blocked_list %]"> </td>
    </tr>
    <tr>
      <td>
<!-- 
        <a href="tr_showdependencytree.cgi?case_id=[% case.id FILTER none %]">Show dependency tree</a>
-->
      </td>
      <td>
<!-- 
        [% IF Param('webdotbase') %]
          <a href="tr_showdependencygraph.cgi?case_id=[% case.id FILTER none %]">Show dependency graph</a>
        [% END %]
-->
      </td>
    </tr>
  </table>      
  <p align="right">
    <input type="SUBMIT" name="action" id="action" class="tr_button" value="[% action FILTER html %]">
  </p>

[%# action, effect %]
  <h3 id="tcsetupHeading">Set Up</h3>
  <div id="tcsetupDiv">[% case.text.setup FILTER xss %]</div>
  <h3 id="tcbreakdownHeading">Break Down</h3>
  <div id="tcbreakdownDiv">[% case.text.breakdown FILTER xss %]</div>
  <h3 id="tcactionHeading">Action</h3>
  <div id="tcactionDiv">[% case.text.action FILTER xss %]</div>
  <h3 id="tceffectHeading">Expected Results</h3>
  <div id="tceffectDiv">[% case.text.effect FILTER xss %]</div>     
