1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
[%#
# 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 Splinter Bugzilla Extension.
#
# The Initial Developer of the Original Code is Red Hat, Inc.
# Portions created by Red Hat, Inc. are Copyright (C) 2008
# Red Hat, Inc. All Rights Reserved.
#
# Contributor(s): Owen Taylor <otaylor@redhat.com>
#%]
[% bodyclasses = [] %]
[% FOREACH group = bug.groups_in %]
[% bodyclasses.push("bz_group_$group.name") %]
[% END %]
[% PROCESS global/header.html.tmpl
title = "Patch Review"
generate_api_token = 1
header = "Patch Review"
style_urls = [ "extensions/Splinter/web/splinter.css",
"skins/standard/bug_groups.css" ]
javascript_urls = [ "js/yui.js",
"extensions/Splinter/web/splinter.js",
"js/field.js" ]
bodyclasses = bodyclasses
%]
[% can_edit = 0 %]
<script [% script_nonce FILTER none %]>
Splinter.configBase = '[% Bugzilla.splinter_review_base FILTER js %]';
Splinter.configBugUrl = '[% urlbase FILTER js %]';
Splinter.configHaveExtension = true;
Splinter.configHelp = '[% urlbase FILTER js %]page.cgi?id=splinter/help.html';
Splinter.configNote = '';
Splinter.readOnly = [% user.id FILTER none %] == 0;
Splinter.configAttachmentStatuses = [
[% FOREACH status = attachment_statuses %]
'[% status FILTER js %]',
[% END %]
];
Splinter.bugId = Splinter.Utils.isDigits('[% bug_id FILTER js %]') ? parseInt('[% bug_id FILTER js %]') : NaN;
Splinter.attachmentId = Splinter.Utils.isDigits('[% attach_id FILTER html %]') ? parseInt('[% attach_id FILTER js %]') : NaN;
if (!isNaN(Splinter.bugId)) {
var theBug = new Splinter.Bug.Bug();
theBug.id = parseInt('[% bug.id FILTER js %]');
theBug.token = '[% update_token FILTER js %]';
theBug.shortDesc = Splinter.Utils.strip('[% bug.short_desc FILTER js %]');
theBug.creationDate = Splinter.Bug.parseDate('[% bug.creation_ts FILTER time("%Y-%m-%d %T %z") FILTER js %]');
theBug.reporterEmail = Splinter.Utils.strip('[% bug.reporter.email FILTER js %]');
theBug.reporterName = Splinter.Utils.strip('[% bug.reporter.name FILTER js %]');
[% FOREACH comment = bug.comments %]
[% NEXT IF comment.is_private && !user.is_insider %]
[% IF comment.type == constants.CMT_ATTACHMENT_CREATED && comment.extra_data == attach_id %]
Splinter.attachmentComment = '[% comment.body FILTER html FILTER js %]';
[% END %]
[% NEXT UNLESS comment.thetext.match('(?i)^\s*review\s+of\s+attachment\s+\d+\s*:') %]
var comment = new Splinter.Bug.Comment();
comment.whoName = Splinter.Utils.strip('[% comment.author.name FILTER js %]');
comment.whoEmail = Splinter.Utils.strip('[% comment.author.email FILTER js %]');
comment.date = Splinter.Bug.parseDate('[% comment.creation_ts FILTER time("%Y-%m-%d %T %z") FILTER js %]');
comment.text = '[% comment.thetext FILTER js %]';
theBug.comments.push(comment);
[% END %]
[% FOREACH attachment = bug.attachments %]
[% NEXT IF attachment.isprivate && !user.is_insider && attachment.attacher.id != user.id %]
[% NEXT IF !attachment.ispatch && !(attachment.mimetype == "text/x-github-pull-request" && attachment.external_redirect) %]
var attachid = parseInt('[% attachment.id FILTER js %]');
var attachment = new Splinter.Bug.Attachment('', attachid);
[% IF attachment.id == attach_id %]
[% flag_types = attachment.flag_types %]
[% can_edit = attachment.validate_can_edit %]
attachment.data = '[% attach_data FILTER js %]';
attachment.token = '[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER js %]';
[% END %]
attachment.description = Splinter.Utils.strip('[% attachment.description FILTER js %]');
attachment.filename = Splinter.Utils.strip('[% attachment.filename FILTER js %]');
attachment.contenttypeentry = Splinter.Utils.strip('[% attachment.contenttypeentry FILTER js %]');
attachment.date = Splinter.Bug.parseDate('[% attachment.attached FILTER time("%Y-%m-%d %T %z") FILTER js %]');
attachment.whoName = Splinter.Utils.strip('[% attachment.attacher.name FILTER js %]');
attachment.whoEmail = Splinter.Utils.strip('[% attachment.attacher.email FILTER js %]');
attachment.isPatch = [% attachment.ispatch || (attachment.mimetype == "text/x-github-pull-request" && attachment.external_redirect) ? 1 : 0 %];
attachment.isObsolete = [% attachment.isobsolete ? 1 : 0 %];
attachment.isPrivate = [% attachment.isprivate ? 1 : 0 %];
attachment.isCRLF = [% attach_is_crlf ? 1 : 0 %];
theBug.attachments.push(attachment);
[% END %]
Splinter.theBug = theBug;
}
</script>
<!--[if lt IE 7]>
<p style="border: 1px solid #880000; padding: 1em; background: #ffee88; font-size: 120%;">
Splinter Patch Review requires a modern browser, such as
<a href="https://www.mozilla.org/firefox/">Firefox</a>, for correct operation.
</p>
<![endif]-->
<div id="helpful-links">
[% IF user.id %]
<a id="allReviewsLink" href="[% Bugzilla.splinter_review_base FILTER none %]">
[reviews]</a>
[% END %]
<a id='helpLink' target='splinterHelp'
href="[% urlbase FILTER none %]page.cgi?id=splinter/help.html">
[help]</a>
</div>
<div id="bugInfo" style="display: none;">
<b>[% terms.Bug %] <a id="bugLink"><span id="bugId"></span></a>:</b>
<span id="bugShortDesc"></span> -
<span id="bugReporter"></span> -
<span id="bugCreationDate"></span>
</div>
<div id="attachInfo" style="display:none;">
<span id="attachWarning"></span>
<b>Attachment <a id="attachLink"><span id="attachId"></span></a>:</b>
<span id="attachDesc"></span> -
<span id="attachCreator"></span> -
<span id="attachDate"></span>
[% IF feature_enabled('patch_viewer') %]
<a href="[% urlbase FILTER none %]attachment.cgi?id=[% attach_id FILTER uri %]&action=diff"
target="_blank">[diff]</a>
[% END %]
<a href="[% urlbase FILTER none %]attachment.cgi?id=[% attach_id FILTER uri %]&action=edit"
target="_blank">[details]</a>
<p>
<b>Comment:</b><br>
<span id="attachComment"></span>
</p>
</div>
<div id="error" style="display: none;"> </div>
<div id="enterBug" style="display: none;">
[% terms.Bug %] to review:
<input id="enterBugInput">
<input id="enterBugGo" type="button" value="Go">
<div id="chooseReview" style="display: none;">
Drafts and published reviews:
<div id="chooseReviewTable"></div>
</div>
</div>
<div id="chooseAttachment" style="display: none;">
<div id="chooseAttachmentTable"></div>
</div>
<div id="quickHelpShow" style="display:none;">
<p>
<a href="javascript:Splinter.quickHelpToggle();" title="Show the quick help section" id="quickHelpToggle">
Show Quick Help</a>
</p>
</div>
<div id="quickHelpContent" style="display:none;">
<p>
<a href="javascript:Splinter.quickHelpToggle();" title="Hide the quick help section" id="quickHelpToggle">Close Quick Help</a>
</p>
<ul id="quickHelpList">
<li>From the Overview page, you can add a more generic overview comment that will appear at the beginning of your review.</li>
<li>To comment on a specific lines in the patch, first select the filename from the file navigation links.</li>
<li>Then double click the line you want to review and a comment box will appear below the line.</li>
<li>When the review is complete and you publish it, the overview comment and all line specific comments with their context,
will be combined together into a single review comment on the [% terms.bug %] report.</li>
<li>For more detailed instructions, read the Splinter
<a id='helpLink' target='splinterHelp' href="[% urlbase FILTER none %]page.cgi?id=splinter/help.html">help page</a>.
</li>
</ul>
</div>
<div id="navigationContainer" style="display: none;">
<b>Navigation:</b> <span id="navigation"></span>
</div>
<div id="overview" style="display: none;">
<div id="patchIntro"></div>
<div>
<span id="restored" style="display: none;">
(Restored from draft; last edited <span id="restoredLastModified"></span>)
</span>
</div>
[% IF user.id %]
<div>
<div id="myCommentFrame">
<textarea id="myComment"></textarea>
<div id="emptyCommentNotice"><Overall Comment></div>
</div>
<div id="myPatchComments"></div>
<form id="publish" method="post" action="attachment.cgi" onsubmit="normalizeComments();">
<input type="hidden" id="publish_token" name="token" value="">
<input type="hidden" id="publish_action" name="action" value="update">
<input type="hidden" id="publish_review" name="comment" value="">
<input type="hidden" id="publish_attach_id" name="id" value="">
<input type="hidden" id="publish_attach_desc" name="description" value="">
<input type="hidden" id="publish_attach_filename" name="filename" value="">
<input type="hidden" id="publish_attach_contenttype" name="contenttypeentry" value="">
<input type="hidden" id="publish_attach_ispatch" name="ispatch" value="">
<input type="hidden" id="publish_attach_isobsolete" name="isobsolete" value="">
<input type="hidden" id="publish_attach_isprivate" name="isprivate" value="">
<div id="attachment_flags">
[% any_flags_requesteeble = 0 %]
[% FOREACH flag_type = flag_types %]
[% NEXT UNLESS flag_type.is_active %]
[% SET any_flags_requesteeble = 1 IF flag_type.is_requestable && flag_type.is_requesteeble %]
[% END %]
[% IF flag_types.size > 0 %]
[% PROCESS "flag/list.html.tmpl" bug_id = bug_id
attach_id = attach_d
flag_types = flag_types
read_only_flags = !can_edit
any_flags_requesteeble = any_flags_requesteeble
%]
[% END %]
<script [% script_nonce FILTER none %]>
[% FOREACH flag_type = flag_types %]
[% NEXT UNLESS flag_type.is_active %]
Event.addListener('flag_type-[% flag_type.id FILTER js %]', 'change',
function() { Splinter.flagChanged = 1;
Splinter.queueUpdateHaveDraft(); });
[% FOREACH flag = flag_type.flags %]
Event.addListener('flag-[% flag.id FILTER js %]', 'change',
function() { Splinter.flagChanged = 1;
Splinter.queueUpdateHaveDraft(); });
[% END %]
[% END %]
</script>
</div>
</form>
<div id="buttonBox">
<span id="attachmentStatusSpan">Patch Status:
<select id="attachmentStatus"> </select>
</span>
<input id="publishButton" type="button" value="Publish">
<input id="cancelButton" type="button" value="Cancel">
</div>
<div class="clear"></div>
</div>
[% ELSE %]
<div>
You must be logged in to review patches.
</div>
[% END %]
<div id="oldReviews" style="display: none;">
<div class="review-title">
Previous Reviews
</div>
</div>
</div>
<div id="splinter-files" style="display: none;">
<div id="file-collapse-all" style="display:none;">
<a href="javascript:void(0);" onclick="Splinter.toggleCollapsed('', 'none')">Collapse All</a> |
<a href="javascript:void(0);" onclick="Splinter.toggleCollapsed('', 'block')">Expand All</a>
</div>
</div>
<div id="credits">
Powered by <a href="http://fishsoup.net/software/splinter">Splinter</a>
</div>
<div id="saveDraftNotice" style="display: none;"></div>
[% PROCESS global/footer.html.tmpl %]
|