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

[% IF item %]
  [% SET tags = item.tags %]
[% END %]

<table>
  <tr class="bz_row_header">
    <th>Tag</a></th>
    <th>Cases</a></th>
    <th>Plans</a></th>
    <th>Runs</a></th>
  [% IF user.in_group("admin") %]
    <th>Actions</th>
  [% END %]
  </tr>
[% FOREACH tag = tags %]
  <tr class="[% loop.count % 2 == 0 ? "tr_row_odd" : "tr_row_even" %]"> 
    <td width="200">[% tag.name FILTER html %]</td>
    <td align="center"><a href="tr_list_cases.cgi?tags_type=anyexact&tags=[% tag.name FILTER uri %]">[% tag.case_count FILTER html %]</a></td>
    <td align="center"><a href="tr_list_plans.cgi?tags_type=anyexact&tags=[% tag.name FILTER uri %]">[% tag.plan_count FILTER html %]</a></td>
    <td align="center"><a href="tr_list_runs.cgi?tags_type=anyexact&tags=[% tag.name FILTER uri %]">[% tag.run_count FILTER html %]</a></td>
    <td>
  [% IF item AND item.type != 'product' %]
      <a href="tr_tags.cgi?tagid=[% tag.id FILTER none %]&action=removetag&id=[% item.id FILTER none %]&type=[% item.type FILTER uri %]&method=html">Remove</a>
  [% END %]
  [% IF user.in_group("admin") %]
      <a href="tr_tags.cgi?tagid=[% tag.id FILTER none %]&action=delete" title="Remove tag from all objects and delete from system">Delete</a>
  [% END %]
    </td>
  </tr>
[% END %]
</table>

[% IF item AND item.type != 'product' %]
<form action="tr_tags.cgi">
  <input name="tag">
  <input type="submit" value="Add">
  <input type="hidden" name="id" value="[% item.id FILTER none %]">
  <input type="hidden" name="type" value="[% item.type FILTER uri %]">
  <input type="hidden" name="action" value="addtag">
  <input type="hidden" name="method" value="html">
</form>
  [% IF user.in_group('admin') %]
<p><a href="tr_tags.cgi?action=show_all">Show All Tags</a></p>
  [% END %]

[% END %]
