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

[%# INTERFACE:
  # ...
  #%]
  
[%############################################################################%]
[%# Template Initialization                                                  #%]
[%############################################################################%]

[% PROCESS global/variables.none.tmpl %]

[% IF attachment.case_id %]
    [% SET item = "Test Case $attachment.case_id" %]
[% ELSE %]
    [% SET item = "Test Plan $attachment.plan_id" %]
[% END %]
[% title = "Edit Attachment $attachment.description for $item" %]

[%############################################################################%]
[%# Page Header                                                              #%]
[%############################################################################%]

[% PROCESS global/header.html.tmpl %]
<p><a href="[% attachment.plan_id ? "tr_show_plan.cgi?plan_id=$attachment.plan_id" : "tr_show_case.cgi?case_id=$attachment.case_id" %]">Back</a> to  [% attachment.plan_id ? "test plan" : "test case" %]</p>
<form method="POST" action="tr_attachment.cgi">
  <input type="hidden" name="action" value="do_edit" />
  <input type="hidden" name="attach_id" value="[% attachment.id FILTER none %]" />
<table border="0">
  <tr>
    <th class="bz_row_header" align="right">Description:</th>
    <td colspan="3"><input name="description" value="[% attachment.description %]" size="30" /></td>
  </tr>
  <tr>
    <th class="bz_row_header" align="right">Filename:</th>
    <td><input name="filename" value="[% attachment.filename %]" size="30" /></td>
    <th class="bz_row_header" align="right">Mime Type:</th>
    <td><input name="mime_type" value="[% attachment.mime_type %]" size="30" /></td>
  </tr>
  <tr>
    <td colspan="4">
      <table  width="100%">       
        <tr class="bz_row_header">
          <th>Submitter</th>
          <th>Created</th>
          <th>Size</th>
        </tr>
        <tr>
          <td>[% attachment.submitter.identity FILTER html %]</td>
          <td>[% attachment.creation_ts FILTER time %]</td>
          <td>[% attachment.datasize FILTER unitconvert %]</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>  
[% IF isviewable %]
    <td colspan="4" width="75%">
      <iframe id="viewFrame" src="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]&action=view" style="height: 400px; width: 100%;">
        <b>You cannot view the attachment while editing it because your browser does not support IFRAMEs.
        <a href="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]&action=view">View the attachment on a separate page</a>.</b>
      </iframe>
    [% ELSE %]
    <td colspan="4" >
      <div style="margin:20px; padding: 5px; border: solid 1px #000; font-weight: bold;">
        This attachment is not viewable in your browser because its MIME type 
        (<span style="color: #990000;">[% attachment.mime_type FILTER html %]</span>) 
        is not one that your browser is able to display.
      <p>
        You can however, <a href="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]&action=view">download the attachment</a>.
      </p>
      </div>
    </td>
  [% END %]
  </tr>
</table>  
<input type="submit" value="Submit">
</form>
[% IF Param("allow-test-deletion") %]
<p><a href="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]&action=delete">Delete Attachment</a></p>
<p><a href="[% attachment.plan_id ? "tr_show_plan.cgi?plan_id=$attachment.plan_id" : "tr_show_case.cgi?case_id=$attachment.case_id" %]">Back</a> to  [% attachment.plan_id ? "test plan" : "test case" %]</p>
[% END %]

[% PROCESS global/footer.html.tmpl %]
