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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
[%# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
#%]
[%# Define strings that will serve as the title and header of this page %]
[% title = BLOCK %]
Attachment [% attachment.id %] Details for [% terms.Bug %] [%+ attachment.bug_id %]
[% END %]
[% header = BLOCK %]
Attachment [% attachment.id %] Details for
[%+ "$terms.Bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]
[% END %]
[% subheader = BLOCK %][% attachment.bug.short_desc FILTER html %][% END %]
[% PROCESS global/header.html.tmpl
title = title
header = header
subheader = subheader
doc_section = "using.html#attachments"
javascript_urls = ['js/attachment.js', 'js/field.js']
style_urls = ['skins/standard/bug.css']
yui = [ 'autocomplete' ]
bodyclasses = "no_javascript"
%]
[%# No need to display the Diff button and iframe if the attachment is not a patch. %]
[% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) ? 1 : 0 %]
[% can_edit = attachment.validate_can_edit %]
[% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
<form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
<input type="hidden" name="id" value="[% attachment.id %]">
<input type="hidden" name="action" value="update">
<input type="hidden" name="contenttypemethod" value="manual">
<input type="hidden" name="delta_ts" value="[% attachment.modification_time FILTER html %]">
[% IF user.id %]
<input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]">
[% END %]
<div id="attachment_info" class="attachment_info [% IF can_edit %] edit[% ELSE %] read[% END%]">
<div id="attachment_attributes">
<div id="attachment_information_read_only" class="[% "bz_private" IF attachment.isprivate %]">
<div class="title">
[% "[patch]" IF attachment.ispatch%]
<span class="[% "bz_obsolete" IF attachment.isobsolete %]" title="[% "obsolete" IF attachment.isobsolete %]">
[% attachment.description FILTER html %]
</span>
[% IF can_edit %]
<span class="bz_edit">(<a href="javascript:toggle_attachment_details_visibility()">edit details</a>)</span>
[% END %]
</div>
<div class="details">
[% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]),
[% IF attachment.datasize %]
[%+ attachment.datasize FILTER unitconvert %]
[% ELSE %]
<em>deleted</em>
[% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] on [%+ attachment.attached FILTER time %]
[% IF attachment.isprivate %];
<span class="bz_private">only visible to <strong>[% Param('insidergroup') FILTER html %]</strong> members</span>
[% END %]
</div>
</div>
<div id="attachment_information_edit">
<span class="bz_hide">
(<a href="javascript:toggle_attachment_details_visibility();">hide</a>)
</span>
<div id="attachment_description">
<label for="description">Description:</label>
[% INCLUDE global/textarea.html.tmpl
id = 'description'
name = 'description'
minrows = 3
cols = 25
wrap = 'soft'
classes = 'block' _ editable_or_hide
defaultcontent = attachment.description
%]
</div>
<div id="attachment_filename">
<label for="filename">Filename:</label>
<input type="text" size="20" class="text block[% editable_or_hide %]"
id="filename" name="filename"
value="[% attachment.filename FILTER html %]">
</div>
<div id="attachment_mimetype">
<label for="contenttypeentry">MIME Type:</label>
<input type="text" size="20" class="text block[% editable_or_hide %]"
id="contenttypeentry" name="contenttypeentry"
value="[% attachment.contenttype FILTER html %]">
</div>
<div id="attachment_creator">
<span class="label">Creator:</span>
[%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
</div>
<div id="attachment_created">
<span class="label">Created:</span>
[%+ attachment.attached FILTER time %]
</div>
<div id="attachment_size">
<span class="label">Size:</span>
[% IF attachment.datasize %]
[%+ attachment.datasize FILTER unitconvert %]
[% ELSE %]
<em>deleted</em>
[% END %]
</div>
<div id="attachment_ispatch">
<input type="checkbox" id="ispatch" name="ispatch" value="1"
[%+ 'checked="checked"' IF attachment.ispatch %]>
<label for="ispatch">patch</label>
</div>
<div class="readonly">
<div class="checkboxes">
<div id="attachment_isobsolete">
<input type="checkbox" id="isobsolete" name="isobsolete" value="1"
[%+ 'checked="checked"' IF attachment.isobsolete %]>
<label for="isobsolete">obsolete</label>
</div>
[% IF user.is_insider %]
<div id="attachment_isprivate">
<input type="checkbox" id="isprivate" name="isprivate" value="1"
[%+ 'checked="checked"' IF attachment.isprivate %]>
[% IF can_edit %]
<label for="isprivate">private (only visible to
<strong>[% Param('insidergroup') FILTER html %]</strong>)
</label>
[% ELSE %]
<span class="label">Is Private:</span>
[%+ attachment.isprivate ? "yes" : "no" %]
[% END %]
</div>
[% END %]
</div>
</div>
</div>
<div id="attachment_view_window">
[% IF !attachment.datasize %]
<div><b>The content of this attachment has been deleted.</b></div>
[% ELSIF !Param("allow_attachment_display") %]
<div id="view_disabled">
<p><b>
The attachment is not viewable in your browser due to security
restrictions enabled by your [% terms.Bugzilla %] administrator.
</b></p>
<p><b>
In order to view the attachment, you first have to
<a href="attachment.cgi?id=[% attachment.id %]">download it</a>.
</b></p>
</div>
[% ELSIF attachment.is_viewable %]
<div>
[% INCLUDE global/textarea.html.tmpl
id = 'editFrame'
name = 'comment'
classes = 'bz_default_hidden'
minrows = 10
cols = 80
wrap = 'soft'
disabled = 'disabled'
defaultcontent = (attachment.contenttype.match('^text\/')) ?
attachment.data.replace('(.*\n|.+)', '>$1') : undef
%]
[% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %]
<p>
<a href="[% attachment.data FILTER html %]">
[% IF attachment.datasize < 120 %]
[% attachment.data FILTER html %]
[% ELSE %]
[% attachment.data FILTER truncate(80) FILTER html %]
...
[% attachment.data.match('.*(.{20})$').0 FILTER html %]
[% END %]
</a>
</p>
[% ELSIF attachment.contenttype == "text/html" %]
[%# For security reasons (clickjacking, embedded scripts), we never
# render HTML pages from here. The source code is displayed instead. %]
[% INCLUDE global/textarea.html.tmpl
id = 'viewFrame'
minrows = 10
cols = 80
defaultcontent = attachment.data
readonly = 'readonly'
%]
[% ELSE %]
<iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]" sandbox>
<b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
<a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>
</iframe>
[% END %]
[% IF use_patchviewer %]
<iframe id="viewDiffFrame" class="bz_default_hidden"></iframe>
[% END %]
[% IF user.id %]
<button type="button" id="editButton" class="bz_default_hidden"
onclick="editAsComment([% use_patchviewer %]);">Edit Attachment As Comment</button>
<button type="button" id="undoEditButton" class="bz_default_hidden"
onclick="undoEditAsComment([% use_patchviewer %]);">Undo Edit As Comment</button>
<button type="button" id="redoEditButton" class="bz_default_hidden"
onclick="redoEditAsComment([% use_patchviewer %]);">Redo Edit As Comment</button>
[% END %]
[% IF use_patchviewer %]
<button type="button" id="viewDiffButton" class="bz_default_hidden"
onclick="viewDiff([% attachment.id %], [% use_patchviewer %]);">View Attachment As Diff</button>
[% END %]
<button type="button" id="viewRawButton" class="bz_default_hidden"
onclick="viewRaw([% use_patchviewer %]);">View Attachment As Raw</button>
<script type="text/javascript">
[% IF user.id %]
document.getElementById('editFrame').disabled = false;
YAHOO.util.Dom.removeClass("editButton", "bz_default_hidden");
[% END %]
YAHOO.util.Dom.removeClass("viewDiffButton", "bz_default_hidden");
</script>
</div>
[% ELSE %]
<div id="noview">
<p><b>
Attachment is not viewable in your browser because its MIME type
([% attachment.contenttype FILTER html %]) is not one that your browser is
able to display.
</b></p>
<p><b>
<a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>.
</b></p>
</div>
[% END %]
</div>
<div id="attachment_comments_and_flags">
[% IF user.id %]
<div id="smallCommentFrame" >
<label for="comment">Comment (on the [% terms.bug %]):</label>
[% classNames = 'block' %]
[% classNames = "$classes bz_private" IF attachment.isprivate %]
[% INCLUDE bug/comment.html.tmpl
bug = attachment.bug
minrows = 10
cols = 80
classes = classNames
wrap = 'soft'
%]
[% IF NOT attachment.bug.cc.contains(user.login) %]
<input type="checkbox" id="addselfcc" name="addselfcc"
[%~ ' checked="checked"'
IF user.settings.state_addselfcc.value == 'always'
|| (!attachment.bug.user.has_any_role
&& user.settings.state_addselfcc.value == 'cc_unless_role') %]>
<label for="addselfcc">Add me to CC list</label>
[% END %]
</div>
[% END %]
<div id="attachment_flags">
[% IF attachment.flag_types.size > 0 %]
[% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types
read_only_flags = !can_edit
%]
[% END %]
</div>
[% Hook.process('form_before_submit') %]
[% IF user.id %]
<div id="update_container">
<input type="submit" value="Submit" id="update">
</div>
[% END %]
</div>
</div>
</div>
</form>
<div id="attachment_actions">
<span class="label">Actions:</span>
<a href="attachment.cgi?id=[% attachment.id %]">View</a>
[% IF use_patchviewer %]
| <a href="attachment.cgi?id=[% attachment.id %]&action=diff">Diff</a>
[% END %]
[% IF Param("allow_attachment_deletion")
&& user.in_group('admin')
&& attachment.datasize > 0 %]
| <a href="attachment.cgi?id=[% attachment.id %]&action=delete">Delete</a>
[% END %]
[% Hook.process('action') %]
</div>
<div id="attachment_list">
Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
[% FOREACH a = attachments %]
[% IF a.isobsolete %]
<span class="bz_obsolete">
[% END %]
[% IF a.id == attachment.id %]
[%+ a.id FILTER html %]
[% ELSE %]
<a href="attachment.cgi?id=[% a.id FILTER uri %]&action=edit"
title="[% a.description FILTER html %]">[% a.id FILTER html %]</a>
[% END %]
[% IF a.isobsolete %]
</span>
[% END %]
[% " |" UNLESS loop.last() %]
[% END %]
</div>
[% IF can_edit %]
<script type="text/javascript">
<!--
YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
toggle_attachment_details_visibility( );
-->
</script>
[% END %]
[% Hook.process('end') %]
[% PROCESS global/footer.html.tmpl %]
|