[%# 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 Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Myk Melez <myk@mozilla.org>
  #                 Joel Peshkin <bugreport@peshkin.net>
  #                 Erik Stambaugh <erik@dasbistro.com>
  #                 Marc Schumann <wurblzap@gmail.com>
  #                 Kohei Yoshino <kohei.yoshino@gmail.com>
  #%]

<tr id="att-selector">
  <th class="required"><label for="att-file">File</label>:</th>
  <td>
    <input hidden id="att-file" type="file" name="data" size="50">
    <input id="att-filename" type="hidden" name="filename">
    <section id="att-dropbox">
      <header>
        <span class="icon" aria-hidden="true"></span>
        <span>
          <label id="att-browse-label" tabindex="0" role="button">Browse a file</label>,
          drag &amp; drop it, paste text/link/image below, or
          <label id="att-capture-label" tabindex="0" role="button">take a screenshot</label>.
        </span>
      </header>
      <div>
        <textarea hidden id="att-data" name="data_base64" aria-hidden="true"></textarea>
        <textarea id="att-textarea" name="attach_text" cols="80" rows="10"
                  aria-label="Attachment Content" aria-invalid="false" aria-errormessage="att-error-message"
                  aria-description="Paste text, link or image to be added as an attachment"></textarea>
        <div hidden id="att-preview">
          <figure role="img" aria-labelledby="att-preview-name" itemscope itemtype="http://schema.org/MediaObject">
            <meta itemprop="encodingFormat">
            <pre itemprop="text"></pre>
            <img src="" alt="" itemprop="image">
            <figcaption id="att-preview-name" itemprop="name"></figcaption>
            <span class="icon" aria-hidden="true"></span>
          </figure>
          <span id="att-remove-button" tabindex="0" role="button" aria-label="Remove attachment">
            <span class="icon" aria-hidden="true"></span>
          </span>
        </div>
      </div>
    </section>
    <div id="att-error-message" class="warning" aria-live="assertive"></div>
  </td>
</tr>
<tr>
  <th class="required"><label for="att-description">Description</label>:</th>
  <td>
    <em>Describe the attachment briefly.</em><br>
    <input id="att-description" class="required" type="text" name="description" size="60" maxlength="200">
  </td>
</tr>
<tr[% ' class="expert_fields"' UNLESS bug.id %]>
  <th>Content Type:</th>
  <td>
    <em>If the attachment is a patch, check the box below.</em><br>
    [% Hook.process("patch_notes") %]
    <input id="att-ispatch" type="checkbox" name="ispatch">
    <label for="att-ispatch">patch</label><br><br>
    <em>If the attachment is not suitable for preview in the browser, check the box below.</em><br>
    <label><input id="att-hide-preview" type="checkbox" name="hide_preview"> hide preview</label><br><br>
    <div id="att-type-outer">
      <em>Otherwise, choose a method for determining the content type.</em>
      <div>
        <input id="att-type-list" type="radio" name="contenttypemethod" value="list" checked>
        <label for="att-type-list">select from list</label>:
        <select id="att-type-select" name="contenttypeselection" aria-label="Select Content Type">
          [% PROCESS content_types %]
        </select>
      </div>
      <div>
      <input id="att-type-manual" type="radio" name="contenttypemethod" value="manual">
        <label for="att-type-manual">enter manually</label>:
        <input id="att-type-input" type="text" name="contenttypeentry" size="30" maxlength="200"
               aria-label="Enter Content Type">
      </div>
    </div>
  </td>
</tr>
<tr[% ' class="expert_fields"' UNLESS bug.id %]>
  <td> </td>
  <td>
    [% IF flag_types && flag_types.size > 0 %]
      [% PROCESS "flag/list.html.tmpl" %]<br>
    [% END %]
  </td>
</tr>

[% BLOCK content_types %]
  [% mimetypes = [{type => "text/plain", desc => "plain text"},
                  {type => "text/html",  desc => "HTML source"},
                  {type => "application/xml", desc => "XML source"},
                  {type => "application/json", desc => "JSON source"},
                  {type => "image/gif",  desc => "GIF image"},
                  {type => "image/jpeg", desc => "JPEG image"},
                  {type => "image/png",  desc => "PNG image"},
                  {type => "image/svg+xml", desc => "SVG image"},
                  {type => "application/pdf", desc => "PDF document"},
                  {type => "application/octet-stream", desc => "binary file"}]
  %]
  [% Hook.process("mimetypes", "attachment/createformcontents.html.tmpl") %]

  [% FOREACH m = mimetypes %]
    <option value="[% m.type FILTER html %]">[% m.desc FILTER html %] ([% m.type FILTER html %])</option>
  [% END %]
[% END %]
