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

<script type="text/javascript">
    dojo.require("dojo.widget.ComboBox");
    dojo.addOnLoad(
      function() {
       dojo.widget.manager.getWidgetById('environment').setValue('[% run.environment.id FILTER none %]');
       dojo.widget.manager.getWidgetById('environment').setLabel('[% run.environment.name FILTER html %]');
       dojo.widget.manager.getWidgetById('manager').setValue('[% run.manager.login ? run.manager.login : user.login FILTER none %]');
       dojo.widget.manager.getWidgetById('manager').setLabel('[% run.manager.login ? run.manager.login : user.login FILTER none %]');
      }
    );
</script>

<a name="attributes"></a>
  <input type="hidden" name="run_id" value="[% run.id FILTER none %]"> 
  <table border="0" cellpadding="2" cellspacing="0">
    <tr>
      <th align="right">Product Version</td>

      <td>
        [% PROCESS select sel = { name => "product_version", 
                                  list => run.plan.product.versions, 
                                  default => run.product_version ? run.product_version : run.plan.product_version }
         %]
      </td>

      <th align="right">Plan Version</td>
      <td>
        [% PROCESS select sel = { name => "plan_version", 
                                  list => run.plan.get_plan_versions, 
                                  default => run.plan_text_version }
         %]
      </td>
    </tr>

    <tr>
      <th align="right">Manager</th>
      <td><input dojoType="select" 
                 dataUrl="tr_quicksearch.cgi?action=getuser&search=%{searchString}" 
                 mode="remote"
                 autoComplete="false"
                 id="manager"
                 name="manager"
                 maxListLength="10" 
                 style="width:200px; height:15px"
                 value="[% run.manager.login FILTER none %]" >
                 </td>
      <th align="right"><a href="tr_builds.cgi?product_id=[% run.plan.product_id FILTER none %]">Build</a></td>
      <td>
        [% PROCESS select sel = { name => "build",
                                  list => run.plan.product.builds(1),
                                  default => run.build.id }
         %]
       [% IF action == 'Add' %]
         <b>or New:</b> <input name="new_build">
       [% END %]
      </td>
      
    </tr>

    <tr>
      <th align="right" valign="top">Status</th>
      <td valign="top">
        [% SET statuslist = [{ id => 1, name => 'Running'}, {id => 0, name=> 'Stopped'}] %]
        [% PROCESS select sel = { name => "status", 
                                  list => statuslist, 
                                  default => run.stop_date ? 0 : 1 }
        %]

      </td>
      <th align="right" valign="top"><a href="tr_list_environments.cgi?product_id=[% run.plan.product_id FILTER none %]">Environment</a></th>
      <td valign="top">
          <input dojoType="select" 
                 dataUrl="tr_quicksearch.cgi?action=getenv&prod_id=[% run.plan.product.id FILTER none %]&search=%{searchString}"
                 mode="remote"
                 autoComplete="false"
                 id="environment"
                 name="environment"
                 maxListLength="10" 
                 style="width:200px; height:15px"
                 value="[% run.environment.id FILTER none %]" >
       [% IF action == 'Add' %]
         <b>or New:</b> <input name="new_env">
       [% END %]
      
      </td>
    </tr>
    <tr>
      <th align="right">Summary</th>
      <td  colspan="3"><input type="text" size="110" name="summary" value="[% run.summary FILTER html %]"></td>
    </tr>

    <tr>
      <th align="right" valign="top">Notes:</th>
      <td colspan="5">
<textarea rows="15" cols="80" name="notes">
[% run.notes FILTER none %]
</textarea> 
      </td>
    </tr>
  </table>
  <div class="submits">
    <input type="submit" name="action" id="action" value="[% action FILTER html %]" />
  </div>
