[%# 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): Gervase Markham <gerv@gerv.net>
  #%]

[%# INTERFACE:
  # classifications: array of hashes, with an 'object' key representing a
  #                  classification object and 'products' the list of
  #                  product objects the user can enter bugs into.
  # target:   the script that displays this template.
  # cloned_bug_id: ID of the bug being cloned.
  # cloned_comment: ID of the comment being cloned.
  # format:   the desired format to display the target.
  #%]

[% IF target == "enter_bug.cgi" %]
  [% title = "Enter $terms.Bug" %]
  [% subheader = BLOCK %]Choose a product for the new [% terms.bug %][% END %]
[% ELSIF target == "describecomponents.cgi" %]
  [% title = "Browse" %]
  [% subheader = "Select a product to browse" %]
[% END %]

[% DEFAULT title = "Choose a Product" %]
[% PROCESS global/header.html.tmpl %]

<h3>[% subheader || title | html %]:</h3>

<table class="choose_product">
[% FOREACH c = classifications %]

  [% IF !loop.first %]
  <tr class="all"><th colspan="2">&nbsp;</th></tr>
  [% END %]

  <tbody>
  [% IF c.object %]
    <tr><th colspan="2" style="border-bottom-color: gray; padding-bottom: 5px">[% c.object.name | html %]: [%+ c.object.description | html_light %]</th></tr>
    <tr><th colspan="2" style="height: 2px; border-bottom-width: 0px"></th></tr>
  [% END %]

  [% FOREACH p = c.products %]
    <tr>
      <th><a href="[% target %]?[% query_params | html %]product=[% p.name | url_quote -%]">[% p.name | html %]</a></th>
      <td>[% p.description | html_light %]</td>
    </tr>
  [% END %]
  </tbody>

[% END %]

</table>

[% IF target == "describecomponents.cgi" AND Bugzilla.get_field('classification').enabled %]
<p><a href="describecomponents.cgi">Select other classification</a></p>
[% END %]

[% IF target == "enter_bug.cgi" AND user AND NOT Bugzilla.get_field('classification').enabled AND NOT cloned_bug_id AND user.in_group('importxls') %]
<hr />
<p class="importxls_link"><span>See also:</span> <a href="importxls.cgi">Mass bug import from Excel files</a>.</p>
[% END %]

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