[%# 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>
  #%]


<script src="testopia/js/DocumentManager.js" type="text/javascript"></script>
<script type="text/javascript">
    dojo.require('dojo.io.*');
    dojo.require("dojo.widget.Editor2");
    plandocDM = new DocumentManager("plandoc", "[% action FILTER html %]", ["plandocHeading"]);

    [% IF action =='Add' %]
    plandocDM.setDirectEdit(true);
    [% END %]
</script>
<a name="attributes"></a>
<input type="hidden" name="plan_id" value="[% plan.id FILTER none %]">
<!--input type="hidden" name="action" value="[% action FILTER none %]"-->
[% IF form_action == "tr_show_plan.cgi" %]
  [% versions = plan.product.versions %]
[% END %]
<table width="100%">
  <tr>
    <th class="bz_row_header" align="right" width="100">Name</th>
    <td><input name="plan_name" value="[% plan.name FILTER html %]" style="width:300px;"></td>
    <th class="bz_row_header" align="right" width="100">Product</th>
    <td>[% IF plan.test_case_count OR plan.test_run_count %]
        <input type="hidden" name='product_id' value="[% plan.product_id FILTER none %]" />
        [% plan.product.name FILTER html %]
        [% ELSE %]
        [% PROCESS select sel = { name      => 'product_id',
                                  list      =>  user.get_selectable_products,
                                  accesskey => 'p' 
                                  default   => plan.product_id 
                                  events    => "onChange='getProdVers(this.value)'"} %]</td>
        [% END %]
  </tr>
  <tr>
    <th class="bz_row_header" align="right" width="100">
    [% IF user.in_group('admin') %]
    <a href="tr_admin.cgi?item=plan_type">Type</a>
    [% ELSE %]
    Type
    [% END %]
    </th>
    <td>[% PROCESS select sel = { name      => 'type',
                                  list      =>  plan.get_plan_types,
                                  accesskey => 't' 
                                  default   => plan.plan_type } %]</td>

    <th class="bz_row_header" align="right" width="100">Product Version</th>
    <td>[% PROCESS select sel = { name      => 'prod_version',
                                  list      =>  versions,
                                  accesskey => 'v' 
                                  default   => plan.product_version } %]</td>

  </tr>
</table>
[% UNLESS plan.test_case_count OR plan.test_run_count %]
<script type="text/javascript">
  getProdVers(document.getElementById('product_id').value,"[% plan.product_version FILTER html %]");
</script>
[% END %]
<p style="text-align: right">
  <input type="submit" name="action" value="[% action FILTER html %]">
</p>
<h3 id="plandocHeading">Plan Document</h3>
<div id="plandocDiv">[% plan.text FILTER xss %]</div>
<textarea id="plandocText" name="plandoc">[% plan.text FILTER xss %]</textarea>
  
