[%# 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 #%] [% IF user.id AND !read_only_flags %] [%# We list flags by looping twice over the flag types relevant for the bug. # In the first loop, we display existing flags and then, for active types, # we display UI for adding new flags. In the second loop, we display UI # for adding additional new flags for those types for which a flag already # exists but which are multiplicable (can have multiple flags of the type # on a single bug/attachment). #%] [% DEFAULT flag_table_id = "flags" %] [% UNLESS flag_no_header %] [% IF any_flags_requesteeble %] [% END %] [% END %] [%# Step 1: Display every flag type (except inactive types with no flags). %] [% FOREACH type = flag_types -%] [%-# Step 1a: Display existing flag(s). %] [% FOREACH flag = type.flags %] [% PROCESS flag_row flag = flag type = type %] [% END -%] [% SET flag = "" %] [%-# Step 1b: Display UI for setting flag. %] [% IF (!type.flags || type.flags.size == 0) && type.is_active %] [% PROCESS flag_row type = type %] [% END %] [% END %] [%# Step 2: Display flag type again (if type is multiplicable). %] [% FOREACH type = flag_types %] [% NEXT UNLESS type.flags && type.flags.size > 0 && type.is_multiplicable && type.is_active %] [% IF !separator_displayed %] [% separator_displayed = 1 %] [% END %] [% PROCESS flag_row type = type addl_text = "addl." %] [% END %]
Flags: Requestee:

[% ELSE %] [%# The user is logged out. Display flags as read-only. %] [% header_displayed = 0 %] [% FOREACH type = flag_types %] [% FOREACH flag = type.flags %] [% IF !flag_no_header AND !header_displayed %]

Flags:

[% header_displayed = 1 %] [% END %] [% IF flag.setter.name %] [% flag.setter.nick FILTER html %]: [% ELSE %] [% flag.setter.nick FILTER html %]: [% END %] [%+ type.name FILTER html FILTER no_break %][% flag.status %] [% IF flag.requestee %] [% IF flag.requestee.name %] ([% flag.requestee.nick FILTER html %]) [% ELSE %] ([% flag.requestee.nick FILTER html %]) [% END %] [% END %]
[% END %] [% END %] [% END %] [%# Display a table row for flags %] [% BLOCK flag_row %] [% SET fid = flag ? "flag-$flag.id" : "flag_type-$type.id" %] [% IF flag %] [% flag.setter.nick FILTER html %]: [% ELSE %] [% addl_text FILTER html %] [% END %] [% IF any_flags_requesteeble %] [% IF (type.is_active && type.is_requestable && type.is_requesteeble) || (flag && flag.requestee) %] [% SET grant_list = [] %] [% IF Param('usemenuforusers') %] [% grant_list = type.grant_list %] [% IF flag && !(type.is_active && type.is_requestable && type.is_requesteeble) %] [%# We are here only because there was already a requestee. In this case, the only valid action is to remove the requestee or leave it alone; nothing else. %] [% grant_list = [flag.requestee] %] [% END %] [% END %] [% SET flag_name = flag ? "requestee-$flag.id" : "requestee_type-$type.id" %] [% SET flag_requestee = (flag && flag.requestee) ? flag.requestee.login : '' %] [% SET flag_multiple = flag ? 0 : type.is_multiplicable * 3 %] [% SET flag_empty_ok = flag ? 1 : !type.is_multiplicable %] [% INCLUDE global/userselect.html.tmpl name => flag_name id => flag_name value => flag_requestee multiple => flag_multiple emptyok => flag_empty_ok classes => ["requestee"] custom_userlist => grant_list %] [% END %] [% END %] [% END %]