blob: d57c0aea6671c9667af77e94f36344cc4bee0a5a [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001[define category_css]css/ph_detail.css[end]
2[include "../framework/header.ezt" "hidetabs"]
3
4[# Note: base permission for this page is EditIssue]
5
6[if-any read_only][include "../framework/read-only-rejection.ezt"]
7[else]
8
9
10<div style="margin-top: 0; padding: 3px;" class="closed">
11 <form action="bulkedit.do" method="POST" style="margin: 0; padding: 0" enctype="multipart/form-data"
12 id="bulk_form">
13
14 <input type="hidden" name="can" value=[can] >
15 <input type="hidden" name="start" value=[start] >
16 <input type="hidden" name="num" value=[num] >
17 <input type="hidden" name="q" value="[query]">
18 <input type="hidden" id="sort" name="sort" value="[sortspec]">
19 <input type="hidden" name="groupby" value="[groupby]">
20 <input type="hidden" name="colspec" value="[colspec]">
21 <input type="hidden" name="x" value="[grid_x_attr]">
22 <input type="hidden" name="y" value="[grid_y_attr]">
23 <input type="hidden" name="mode" value="[if-any grid_mode]grid[end]">
24 <input type="hidden" name="cells" value="[grid_cell_mode]">
25
26 <input type="hidden" name="ids"
27 value="[for issues][issues.local_id][if-index issues last][else], [end][end]">
28 <input type="hidden" name="token" value="[form_token]">
29 <table cellpadding="0" cellspacing="0" border="0">
30 <tr><td>
31
32 <table cellspacing="0" cellpadding="3" border="0" class="rowmajor vt">
33 <tr><th>Issues:</th>
34 <td colspan="2">
35 [for issues]
36 <a href="detail?id=[issues.local_id]" title="[issues.summary]"
37 [if-any issues.closed]class=closed_ref[end]
38 >[if-any issues.closed]&nbsp;[end][issues.local_id][if-any issues.closed]&nbsp;[end]</a>[if-index issues last][else], [end]
39 [end]
40 </td>
41 </tr>
42
43 <tr>
44 <th>Comment:</th>
45 <td colspan="2">
46 <textarea cols="75" rows="6" name="comment" id="comment" class="issue_text">[initial_comment]</textarea>
47 [if-any errors.comment]
48 <div class="fielderror">[errors.comment]</div>
49 [end]
50 </td>
51 </tr>
52
53 <tr><th width="10%"><label for="statusenter">Status:</label></th><td colspan="2">
54 <select id="statusenter" name="status">
55 <option style="display: none" value="[initial_status]"></option>
56 </select>
57 <span id="merge_area" style="margin-left:2em;">
58 Merge into issue:
59 <input type="text" id="merge_into" name="merge_into" style="width: 5em"
60 value="[is initial_merge_into "0"][else][initial_merge_into][end]">
61 </span>
62 [if-any errors.merge_into_id]
63 <div class="fielderror">[errors.merge_into_id]</div>
64 [end]
65 </td>
66 </tr>
67 <tr><th width="10%">Owner:</th><td colspan="2">
68 [include "issue-bulk-operator-part.ezt" "ownerenter" ""]
69 <input id="ownerenter" type="text" autocomplete="off" style="width: 12em"
70 name="owner" value="[initial_owner]">
71 [if-any errors.owner]
72 <div class="fielderror">[errors.owner]</div>
73 [end]
74 </td>
75 </tr>
76 <tr><th>Cc:</th><td colspan="2">
77 [include "issue-bulk-operator-part.ezt" "memberenter" "multi"]
78 <input type="text" multiple id="memberenter" autocomplete="off" style="width: 30em"
79 name="cc" value="[initial_cc]">
80 [if-any errors.cc]
81 <div class="fielderror">[errors.cc]</div>
82 [end]
83 </td>
84 </tr>
85
86 <tr><th>Components:</th><td colspan="2">
87 [include "issue-bulk-operator-part.ezt" "componententer" "multi"]
88 <input type="text" id="componententer" style="width:30em"
89 name="components" value="[initial_components]">
90 [if-any errors.components]
91 <div class="fielderror">[errors.components]</div>
92 [end]
93 </td></tr>
94
95 <tbody class="collapse">
96 [# Show some field editing elements immediately, others can be revealed.]
97 [define any_fields_to_reveal]No[end]
98 [for fields]
99 [if-any fields.applicable][if-any fields.is_editable]
100 [# TODO(jrobbins): determine applicability dynamically and update fields in JS]
101 <tr [if-any fields.display][else]class="ifExpand"[define any_fields_to_reveal]Yes[end][end]>
102 <th>[fields.field_name]:</th>
103 <td colspan="2">
104 [define widget_id]custom_[fields.field_id][end]
105 [define multi][if-any fields.field_def.is_multivalued_bool]multi[end][end]
106 [include "issue-bulk-operator-part.ezt" widget_id multi]
107 [include "field-value-widgets.ezt" False "" fields.field_def.is_required_bool ""]
108 <div class="fielderror" style="display:none" id="error_custom_[fields.field_id]"></div>
109 </td>
110 <tr>
111 [end][end]
112 [end]
113 [is any_fields_to_reveal "Yes"]
114 <tr class="ifCollapse">
115 <td colspan="2"><a href="#" class="toggleCollapse">Show all fields</a><t/td>
116 </tr>
117 [end]
118 </tbody>
119
120 [for issue_phase_names]
121 [for fields]
122 [is fields.phase_name issue_phase_names][if-any fields.is_editable]
123 [# TODO(jojwang): monorail:5154, bulk-editing single phase values not supported]
124 [if-any fields.field_def.is_multivalued_bool]
125 <tr><th>[issue_phase_names].[fields.field_name]:</th>
126 <td colspan="2">
127 [define widget_id]custom_[fields.field_id]_[issue_phase_names][end]
128 [include "issue-bulk-operator-part.ezt" widget_id "multi"]
129 [include "field-value-widgets.ezt" False "" fields.field_def.is_required_bool issue_phase_names]
130 <div class="fielderror" style="display:none" id="error_custom_[issue_phase_names]_[fields.field_id]"></div>
131 </td>
132 </tr>
133 [end]
134 [end][end]
135 [end]
136 [end]
137
138 <tr><th>Labels:</th>
139 <td colspan="2" class="labelediting">
140 <div id="enterrow1">
141 <input type="text" class="labelinput" id="label0" size="20" autocomplete="off"
142 name="label" value="[label0]">
143 <input type="text" class="labelinput" id="label1" size="20" autocomplete="off"
144 name="label" value="[label1]">
145 <input type="text" class="labelinput" id="label2" size="20" autocomplete="off"
146 data-show-id="enterrow2" data-hide-id="addrow1"
147 name="label" value="[label2]"> <span id="addrow1" class="fakelink" data-instead="enterrow2">Add a row</span>
148 </div>
149 <div id="enterrow2" style="display:none">
150 <input type="text" class="labelinput" id="label3" size="20" autocomplete="off"
151 name="label" value="[label3]">
152 <input type="text" class="labelinput" id="label4" size="20" autocomplete="off"
153 name="label" value="[label4]">
154 <input type="text" class="labelinput" id="label5" size="20" autocomplete="off"
155 data-show-id="enterrow3" data-hide-id="addrow2"
156 name="label" value="[label5]"> <span id="addrow2" class="fakelink" data-instead="enterrow3">Add a row</span>
157 </div>
158 <div id="enterrow3" style="display:none">
159 <input type="text" class="labelinput" id="label6" size="20" autocomplete="off"
160 name="label" value="[label6]">
161 <input type="text" class="labelinput" id="label7" size="20" autocomplete="off"
162 name="label" value="[label7]">
163 <input type="text" class="labelinput" id="label8" size="20" autocomplete="off"
164 data-show-id="enterrow4" data-hide-id="addrow3"
165 name="label" value="[label8]"> <span id="addrow3" class="fakelink" data-instead="enterrow4">Add a row</span>
166 </div>
167 <div id="enterrow4" style="display:none">
168 <input type="text" class="labelinput" id="label9" size="20" autocomplete="off"
169 name="label" value="[label9]">
170 <input type="text" class="labelinput" id="label10" size="20" autocomplete="off"
171 name="label" value="[label10]">
172 <input type="text" class="labelinput" id="label11" size="20" autocomplete="off"
173 data-show-id="enterrow5" data-hide-id="addrow4"
174 name="label" value="[label11]"> <span id="addrow4" class="fakelink" data-instead="enterrow5">Add a row</span>
175 </div>
176 <div id="enterrow5" style="display:none">
177 <input type="text" class="labelinput" id="label12" size="20" autocomplete="off"
178 name="label" value="[label12]">
179 <input type="text" class="labelinput" id="label13" size="20" autocomplete="off"
180 name="label" value="[label13]">
181 <input type="text" class="labelinput" id="label14" size="20" autocomplete="off"
182 data-show-id="enterrow6" data-hide-id="addrow5"
183 name="label" value="[label14]"> <span id="addrow5" class="fakelink" data-instead="enterrow6">Add a row</span>
184 </div>
185 <div id="enterrow6" style="display:none">
186 <input type="text" class="labelinput" id="label15" size="20" autocomplete="off"
187 name="label" value="[label15]">
188 <input type="text" class="labelinput" id="label16" size="20" autocomplete="off"
189 name="label" value="[label16]">
190 <input type="text" class="labelinput" id="label17" size="20" autocomplete="off"
191 data-show-id="enterrow7" data-hide-id="addrow6"
192 name="label" value="[label17]"> <span id="addrow6" class="fakelink" data-instead="enterrow7">Add a row</span>
193 </div>
194 <div id="enterrow7" style="display:none">
195 <input type="text" class="labelinput" id="label18" size="20" autocomplete="off"
196 name="label" value="[label18]">
197 <input type="text" class="labelinput" id="label19" size="20" autocomplete="off"
198 name="label" value="[label19]">
199 <input type="text" class="labelinput" id="label20" size="20" autocomplete="off"
200 data-show-id="enterrow8" data-hide-id="addrow7"
201 name="label" value="[label20]"> <span id="addrow7" class="fakelink" data-instead="enterrow8">Add a row</span>
202 </div>
203 <div id="enterrow8" style="display:none">
204 <input type="text" class="labelinput" id="label21" size="20" autocomplete="off"
205 name="label" value="[label21]">
206 <input type="text" class="labelinput" id="label22" size="20" autocomplete="off"
207 name="label" value="[label22]">
208 <input type="text" class="labelinput" id="label23" size="20" autocomplete="off"
209 name="label" value="[label23]">
210 </div>
211 </td>
212 </tr>
213
214 <tr><th>Blocked on:</th><td colspan="2">
215 [include "issue-bulk-operator-part.ezt" "blockedonenter" "multi"]
216 <input type="text" multiple id="blockedonenter" style="width: 30em"
217 name="blocked_on" value="[initial_blocked_on]">
218 [if-any errors.blocked_on]
219 <div class="fielderror">[errors.blocked_on]</div>
220 [end]
221 </td>
222 </tr>
223
224 <tr><th>Blocking:</th><td colspan="2">
225 [include "issue-bulk-operator-part.ezt" "blockingenter" "multi"]
226 <input type="text" multiple id="blockingenter" style="width: 30em"
227 name="blocking" value="[initial_blocking]">
228 [if-any errors.blocking]
229 <div class="fielderror">[errors.blocking]</div>
230 [end]
231 </td>
232 </tr>
233
234 [if-any page_perms.DeleteIssue]
235 <tr><th width="10%">Move to project:</th><td colspan="2">
236 <input id="move_toenter" type="text" autocomplete="off" style="width: 12em"
237 name="move_to">
238 [if-any errors.move_to]
239 <div class="fielderror">[errors.move_to]</div>
240 [end]
241 </td>
242 </tr>
243 [end]
244
245 <tr>
246 <td colspan="3"><span id="confirmarea" class="novel" style="padding-top:5px; margin:0">
247 <span id="confirmmsg"></span>
248 [# TODO(jrobbins): <a href="TODO" target="_new">Learn more</a>]
249 </span>
250 </td>
251 </tr>
252 </table>
253
254
255
256[# TODO(jrobbins): <a class="ifClosed toggleHidden" href="#">More options</a>]
257[# <a class="ifOpened" href="#" class="toggleHidden" style="background:#ccc; padding: 4px;">Hide options</a>]
258[# <div class="ifOpened" style="background:#ccc; padding: 8px"><a href="#autmatically-generated">Bookmarkable link to these values</a></div>]
259[# <br><br>]
260
261
262
263
264 <div style="padding:6px">
265 <input type="submit" id="submit_btn" name="btn" value="Update [num_issues] Issue[is num_issues "1"][else]s[end]">
266 <input type="button" id="discard" name="nobtn" value="Discard">
267
268 <input type="checkbox" checked="checked" name="send_email" id="send_email" style="margin-left:1em">
269 <label for="send_email" title="Send issue change notifications to interested users">Send email</label>
270
271 </div>
272
273
274
275[if-any show_progress]
276 <div>Note: Updating [num_issues] issues will take approximately [num_seconds] seconds.</div>
277 <div id="progress">
278 </div>
279[end]
280
281 </td>
282 <td>
283 <div class="tip">
284 <b>Usage:</b> This form allows you to update several issues at one
285 time.<br><br>
286 The same comment will be applied to all issues.<br><br>
287
288 If specified, the status or owner you enter will be applied to all
289 issues.<br><br>
290
291 You may append or remove values in multi-valued fields by choosing the += or -= operators.
292 To remove labels, preceed the label with a leading dash. (You may also use a leading dash
293 to remove individual items when using the += operator.)
294 </div>
295 </td>
296 </tr>
297 </table>
298
299
300 </form>
301</div>
302
303<mr-bulk-approval-update
304 projectName="[projectname]"
305 localIdsStr="[local_ids_str]"
306></mr-bulk-approval-update>
307
308<script type="text/javascript" nonce="[nonce]">
309runOnLoad(function() {
310 document.getElementById('comment').select();
311 _lfidprefix = 'label';
312 setTimeout(_forceProperTableWidth, 100);
313
314 _exposeExistingLabelFields();
315
316 [if-any errors.custom_fields]
317 var field_error;
318 [for errors.custom_fields]
319 field_error = document.getElementById('error_custom_' + [errors.custom_fields.field_id]);
320 field_error.textContent = "[errors.custom_fields.message]";
321 field_error.style.display = "";
322 [end]
323 [end]
324
325 checksubmit();
326 setInterval(checksubmit, 700); [# catch changes that were not keystrokes, e.g., paste menu item.]
327
328
329
330function checksubmit() {
331 var submit = document.getElementById('submit_btn');
332 var cg = document.getElementById('cg');
333 if (cg != undefined) { submit.disabled='disabled'; }
334
335 submit.disabled='disabled';
336 var restrict_to_known = [if-any restrict_to_known]true[else]false[end];
337 var confirmmsg = document.getElementById('confirmmsg');
338 var statusenter = $('statusenter');
339 var merge_area = $('merge_area');
340 var statuses_offer_merge = [[] [for statuses_offer_merge]"[statuses_offer_merge]"[if-index statuses_offer_merge last][else],[end][end] ];
341 if (restrict_to_known && confirmmsg && confirmmsg.textContent.length > 0) {
342 return;
343 }
344 if (cg == undefined || cg.value.length > 1) {
345 submit.disabled='';
346 }
347
348 if (statusenter) {
349 var offer_merge = 'none';
350 for (var i = 0; i < statuses_offer_merge.length; i++) {
351 if (statusenter.value == statuses_offer_merge[[]i]) offer_merge = '';
352 }
353 merge_area.style.display = offer_merge;
354 }
355}
356
357
358function disableFormElement(el) {
359 el.readOnly = 'yes';
360 el.style.background = '#eee';
361 [# TODO(jrobbins): disable auto-complete ]
362}
363
364
365function bulkOnSubmit() {
366 var inputs = document.getElementsByTagName('input');
367 for (var i = 0; i < inputs.length; i++) {
368 disableFormElement(inputs[[]i]);
369 }
370 disableFormElement(document.getElementById('comment'));
371 [if-any show_progress]
372 var progress = document.getElementById('progress');
373 progress.textContent = 'Processing...';
374 [end]
375}
376
377
378function _checkAutoClear(inputEl, selectID) {
379 var val = inputEl.value;
380 var sel = document.getElementById(selectID);
381 if (val.match(/^--+$/)) {
382 sel.value = 'clear';
383 inputEl.value = '';
384 } else if (val) {
385 sel.value = 'set';
386 }
387}
388
389
390$("bulk_form").addEventListener("submit", bulkOnSubmit);
391
392if ($("statusenter")) {
393 _loadStatusSelect("[projectname]", "statusenter", "[initial_status]", isBulkEdit=true);
394 $("statusenter").addEventListener("focus", function(event) {
395 _acrob(null);
396 });
397 $("statusenter").addEventListener("keyup", function(event) {
398 _checkAutoClear(event.target, "op_statusenter");
399 return _confirmNovelStatus(event.target);
400 });
401}
402if ($("ownerenter")) {
403 $("ownerenter").addEventListener("focus", function(event) {
404 _acof(event);
405 });
406 $("ownerenter").addEventListener("keyup", function(event) {
407 _checkAutoClear(event.target, "op_ownerenter");
408 return true;
409 });
410}
411if ($("memberenter")) {
412 $("memberenter").addEventListener("focus", function(event) {
413 _acof(event);
414 });
415}
416if ($("componententer")) {
417 $("componententer").addEventListener("focus", function(event) {
418 _acof(event);
419 });
420}
421
422if ($("move_toenter")) {
423 $("move_toenter").addEventListener("focus", function(event) {
424 _acof(event);
425 });
426}
427
428if ($("submit_btn")) {
429 $("submit_btn").addEventListener("focus", function(event) {
430 _acrob(null);
431 });
432 $("submit_btn").addEventListener("mousedown", function(event) {
433 _acrob(null);
434 });
435 $("submit_btn").addEventListener("click", function(event) {
436 _trimCommas();
437 });
438}
439if ($("discard")) {
440 $("discard").addEventListener("click", function(event) {
441 _confirmDiscardEntry(this);
442 event.preventDefault();
443 });
444}
445
446var labelInputs = document.getElementsByClassName("labelinput");
447for (var i = 0; i < labelInputs.length; ++i) {
448 var labelInput = labelInputs[[]i];
449 labelInput.addEventListener("keyup", function (event) {
450 if (event.target.getAttribute("data-show-id") &&
451 event.target.getAttribute("data-hide-id") &&
452 event.target.value) {
453 _showID(event.target.getAttribute("data-show-id"));
454 _hideID(event.target.getAttribute("data-hide-id"));
455 }
456 return _vallab(event.target);
457 });
458 labelInput.addEventListener("blur", function (event) {
459 return _vallab(event.target);
460 });
461 labelInput.addEventListener("focus", function (event) {
462 return _acof(event);
463 });
464}
465
466var addRowLinks = document.getElementsByClassName("fakelink");
467for (var i = 0; i < addRowLinks.length; ++i) {
468 var rowLink = addRowLinks[[]i];
469 rowLink.addEventListener("click", function (event) {
470 _acrob(null);
471 var insteadID = event.target.getAttribute("data-instead");
472 if (insteadID)
473 _showInstead(insteadID, this);
474 });
475}
476
477});
478</script>
479
480[end]
481
482[include "field-value-widgets-js.ezt"]
483[include "../framework/footer.ezt"]