1 [%# The contents of this file are subject to the Mozilla Public
2 # License Version 1.1 (the "License"); you may not use this file
3 # except in compliance with the License. You may obtain a copy of
4 # the License at http://www.mozilla.org/MPL/
6 # Software distributed under the License is distributed on an "AS
7 # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 # implied. See the License for the specific language governing
9 # rights and limitations under the License.
11 # The Original Code is the Bugzilla Bug Tracking System.
13 # The Initial Developer of the Original Code is Netscape Communications
14 # Corporation. Portions created by Netscape are
15 # Copyright (C) 1998 Netscape Communications Corporation. All
18 # Contributor(s): Myk Melez <myk@mozilla.org>
21 [% IF user.id AND !read_only_flags %]
23 [%# We list flags by looping twice over the flag types relevant for the bug.
24 # In the first loop, we display existing flags and then, for active types,
25 # we display UI for adding new flags. In the second loop, we display UI
26 # for adding additional new flags for those types for which a flag already
27 # exists but which are multiplicable (can have multiple flags of the type
28 # on a single bug/attachment).
31 [% DEFAULT flag_table_id = "flags" %]
33 <script src="[% 'js/flag.js' FILTER mtime %]" type="text/javascript"></script>
35 <table id="[% flag_table_id FILTER html %]">
36 [% UNLESS flag_no_header %]
41 [% IF any_flags_requesteeble %]
49 [%# Step 1: Display every flag type (except inactive types with no flags). %]
50 [% FOREACH type = flag_types -%]
52 [%-# Step 1a: Display existing flag(s). %]
53 [% FOREACH flag = type.flags %]
54 [%# if WEBKIT_CHANGES %]
55 [% IF type.name == 'in-rietveld' %]
56 <tr style='display:none'>
60 [%# endif // WEBKIT_CHANGES %]
62 <span title="[% flag.setter.identity FILTER html %]">[% flag.setter.nick FILTER html %]</span>:
65 <label title="[% type.description FILTER html %]"
66 for="flag-[% flag.id %]">
67 [%- type.name FILTER html FILTER no_break -%]</label>
70 <select id="flag-[% flag.id %]" name="flag-[% flag.id %]"
71 title="[% type.description FILTER html %]"
72 onchange="toggleRequesteeField(this);"
73 class="flag_select flag_type-[% type.id %]">
74 [%# Only display statuses the user is allowed to set. %]
75 [% IF user.can_request_flag(type) || flag.setter_id == user.id %]
76 <option value="X"></option>
78 [% IF type.is_active %]
79 [% IF (type.is_requestable && user.can_request_flag(type)) || flag.status == "?" %]
80 <option value="?" [% "selected" IF flag.status == "?" %]>?</option>
82 [% IF user.can_set_flag(type) || flag.status == "+" %]
83 <option value="+" [% "selected" IF flag.status == "+" %]>+</option>
85 [% IF user.can_set_flag(type) || flag.status == "-" %]
86 <option value="-" [% "selected" IF flag.status == "-" %]>-</option>
89 <option value="[% flag.status %]" selected="selected">[% flag.status %]</option>
93 [% IF any_flags_requesteeble %]
95 [% IF (type.is_active && type.is_requestable && type.is_requesteeble) || flag.requestee %]
96 <span style="white-space: nowrap;">
97 [% SET flag_custom_list = [] %]
98 [% IF Param('usemenuforusers') %]
99 [% flag_custom_list = flag.type.grant_list %]
100 [% IF !(type.is_active && type.is_requestable && type.is_requesteeble) %]
101 [%# We are here only because there was already a requestee. In this case,
102 the only valid action is to remove the requestee or leave it alone;
104 [% flag_custom_list = [flag.requestee] %]
107 [% INCLUDE global/userselect.html.tmpl
108 name => "requestee-$flag.id"
109 id => "requestee-$flag.id"
110 value => flag.requestee.login
113 classes => ["requestee"]
114 custom_userlist => flag_custom_list
123 [%-# Step 1b: Display UI for setting flag. %]
124 [% IF (!type.flags || type.flags.size == 0) && type.is_active %]
126 [% PROCESS flag_row first_cell_empty = 1 addl_text = "" %]
130 [%# Step 2: Display flag type again (if type is multiplicable). %]
131 [% FOREACH type = flag_types %]
132 [% NEXT UNLESS type.flags && type.flags.size > 0 && type.is_multiplicable && type.is_active %]
133 [% IF !separator_displayed %]
134 <tr><td colspan="3"><hr></td></tr>
135 [% separator_displayed = 1 %]
138 [% PROCESS flag_row first_cell_empty = 0 addl_text = "addl." %]
143 [%# The user is logged out. Display flags as read-only. %]
144 [% header_displayed = 0 %]
145 [% FOREACH type = flag_types %]
146 [% FOREACH flag = type.flags %]
147 [% IF !flag_no_header AND !header_displayed %]
149 [% header_displayed = 1 %]
151 [% IF flag.setter.name %]
152 <span title="[% flag.setter.name FILTER html %]">[% flag.setter.nick FILTER html %]</span>:
154 [% flag.setter.nick FILTER html %]:
156 [%+ type.name FILTER html FILTER no_break %][% flag.status %]
157 [% IF flag.requestee %]
158 [% IF flag.requestee.name %]
159 (<span title="[% flag.requestee.name FILTER html %]">[% flag.requestee.nick FILTER html %]</span>)
161 ([% flag.requestee.nick FILTER html %])
168 [%# Display a table row for unset flags %]
171 [%# if WEBKIT_CHANGES %]
172 [% IF type.name == 'in-rietveld' %]
173 <tr style='display:none'>
177 [%# endif // WEBKIT_CHANGES %]
178 [% IF first_cell_empty %]
185 [% addl_text FILTER html %]
186 <label title="[% type.description FILTER html %]" for="flag_type-[% type.id %]">
187 [%- type.name FILTER html FILTER no_break %]</label>
190 <select id="flag_type-[% type.id %]" name="flag_type-[% type.id %]"
191 title="[% type.description FILTER html %]"
192 [% " disabled=\"disabled\"" UNLESS (type.is_requestable && user.can_request_flag(type)) || user.can_set_flag(type) %]
193 onchange="toggleRequesteeField(this);"
194 class="flag_select flag_type-[% type.id %]">
195 <option value="X"></option>
196 [% IF type.is_requestable && user.can_request_flag(type) %]
197 <option value="?">?</option>
199 [% IF user.can_set_flag(type) %]
200 <option value="+">+</option>
201 <option value="-">-</option>
205 [% IF any_flags_requesteeble %]
207 [% IF type.is_requestable && type.is_requesteeble %]
208 <span style="white-space: nowrap;">
209 [% SET grant_list = [] %]
210 [% IF Param('usemenuforusers') %]
211 [% grant_list = type.grant_list %]
213 [% INCLUDE global/userselect.html.tmpl
214 name => "requestee_type-$type.id"
215 id => "requestee_type-$type.id"
216 multiple => type.is_multiplicable * 3
217 emptyok => !type.is_multiplicable
219 custom_userlist => grant_list
220 classes => ["requestee"]