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>
19 # Frédéric Buclin <LpSolit@gmail.com>
20 # Guy Pyrzak <guy.pyrzak@gmail.com>
23 [% PROCESS global/variables.none.tmpl %]
25 [%# Define strings that will serve as the title and header of this page %]
27 Attachment [% attachment.id %] Details for [% terms.Bug %] [%+ attachment.bug_id %]
30 Attachment [% attachment.id %] Details for
31 [%+ "$terms.Bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]
33 [% subheader = BLOCK %][% attachment.bug.short_desc FILTER html %][% END %]
35 [% PROCESS global/header.html.tmpl
39 doc_section = "attachments.html"
40 javascript_urls = ['js/attachment.js', 'js/field.js']
41 style_urls = ['skins/standard/attachment.css']
42 yui = [ 'autocomplete' ]
43 bodyclasses = "no_javascript"
46 [%# No need to display the Diff button and iframe if the attachment is not a patch. %]
47 [% use_patchviewer = (feature_enabled('patch_viewer') && attachment.ispatch) %]
48 [% can_edit = attachment.validate_can_edit %]
49 [% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
51 <form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
52 <input type="hidden" name="id" value="[% attachment.id %]">
53 <input type="hidden" name="action" value="update">
54 <input type="hidden" name="contenttypemethod" value="manual">
55 <input type="hidden" name="delta_ts" value="[% attachment.modification_time FILTER html %]">
57 <input type="hidden" name="token" value="[% issue_hash_token([attachment.id, attachment.modification_time]) FILTER html %]">
60 <div id="attachment_info" class="attachment_info [% IF can_edit %] edit[% ELSE %] read[% END%]">
61 <div id="attachment_attributes">
62 <div id="attachment_information_read_only" class="[% "bz_private" IF attachment.isprivate %]">
64 [% "[patch]" IF attachment.ispatch%]
65 <span class="[% "bz_obsolete" IF attachment.isobsolete %]" title="[% "obsolete" IF attachment.isobsolete %]">
66 [% attachment.description FILTER html %]
69 <span class="bz_edit">(<a href="javascript:toggle_attachment_details_visibility()">edit details</a>)</span>
73 [% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]),
74 [% IF attachment.datasize %]
75 [%+ attachment.datasize FILTER unitconvert %]
78 [% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
79 [% IF attachment.isprivate %];
80 <span class="bz_private">only visible to <strong>[% Param('insidergroup') FILTER html %]</strong> members</span>
84 <div id="attachment_information_edit">
85 <span class="bz_hide">
86 (<a href="javascript:toggle_attachment_details_visibility();">hide</a>)
88 <div id="attachment_description">
89 <label for="description">Description:</label>
90 [% INCLUDE global/textarea.html.tmpl
96 classes = 'block' _ editable_or_hide
97 defaultcontent = attachment.description
101 <div id="attachment_filename">
102 <label for="filename">Filename:</label>
103 <input type="text" size="20" class="text block[% editable_or_hide %]"
104 id="filename" name="filename"
105 value="[% attachment.filename FILTER html %]">
108 <div id="attachment_mimetype">
109 <label for="contenttypeentry">MIME Type:</label>
110 <input type="text" size="20" class="text block[% editable_or_hide %]"
111 id="contenttypeentry" name="contenttypeentry"
112 value="[% attachment.contenttype FILTER html %]">
115 <div id="attachment_creator">
116 <span class="label">Creator:</span>
117 [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
120 <div id="attachment_size">
121 <span class="label">Size:</span>
122 [% IF attachment.datasize %]
123 [%+ attachment.datasize FILTER unitconvert %]
129 <div id="attachment_ispatch">
130 <input type="checkbox" id="ispatch" name="ispatch" value="1"
131 [%+ 'checked="checked"' IF attachment.ispatch %]>
132 <label for="ispatch">patch</label>
135 <div class="readonly">
136 <div class="checkboxes">
137 <div id="attachment_isobsolete">
138 <input type="checkbox" id="isobsolete" name="isobsolete" value="1"
139 [%+ 'checked="checked"' IF attachment.isobsolete %]>
140 <label for="isobsolete">obsolete</label>
143 [% IF user.is_insider %]
144 <div id="attachment_isprivate">
145 <input type="checkbox" id="isprivate" name="isprivate" value="1"
146 [%+ 'checked="checked"' IF attachment.isprivate %]>
148 <label for="isprivate">private (only visible to
149 <strong>[% Param('insidergroup') FILTER html %]</strong>)
152 <span class="label">Is Private:</span>
153 [%+ attachment.isprivate ? "yes" : "no" %]
161 <div id="attachment_view_window">
162 [% IF !attachment.datasize %]
163 <div><b>The content of this attachment has been deleted.</b></div>
164 [% ELSIF !Param("allow_attachment_display") %]
165 <div id="view_disabled">
167 The attachment is not viewable in your browser due to security
168 restrictions enabled by your [% terms.Bugzilla %] administrator.
171 In order to view the attachment, you first have to
172 <a href="attachment.cgi?id=[% attachment.id %]">download it</a>.
175 [% ELSIF attachment.is_viewable %]
177 [% INCLUDE global/textarea.html.tmpl
180 classes = 'bz_default_hidden'
184 disabled = 'disabled'
185 defaultcontent = (attachment.contenttype.match('^text\/')) ?
186 attachment.data.replace('(.*\n|.+)', '>$1') : undef
188 [% IF attachment.contenttype == 'text/plain' AND is_safe_url(attachment.data) %]
190 <a href="[% attachment.data FILTER html %]">
191 [% IF attachment.datasize < 120 %]
192 [% attachment.data FILTER html %]
194 [% attachment.data FILTER truncate(80) FILTER html %]
196 [% attachment.data.match('.*(.{20})$').0 FILTER html %]
200 [% ELSIF attachment.contenttype == "text/html" %]
201 [%# For security reasons (clickjacking, embedded scripts), we never
202 # render HTML pages from here. The source code is displayed instead. %]
203 [% INCLUDE global/textarea.html.tmpl
207 defaultcontent = attachment.data
208 readonly = 'readonly'
211 <iframe id="viewFrame" src="attachment.cgi?id=[% attachment.id %]">
212 <b>You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
213 <a href="attachment.cgi?id=[% attachment.id %]">View the attachment on a separate page</a>.</b>
216 <script type="text/javascript">
218 var patchviewerinstalled = 0;
219 var attachment_id = [% attachment.id %];
220 if (typeof document.getElementById == "function") {
221 [% IF use_patchviewer %]
222 var patchviewerinstalled = 1;
223 document.write('<iframe id="viewDiffFrame" class="bz_default_hidden"><\/iframe>');
226 [%# if WEBKIT_CHANGES %]
227 [% IF attachment.ispatch %]
228 document.write('<button type="button" id="viewPrettyPatchButton" onclick="viewPrettyPatch(attachment_id);">View Formatted Diff<\/button>');
230 [%# endif // WEBKIT_CHANGES %]
231 document.write('<button type="button" id="editButton" onclick="editAsComment(patchviewerinstalled);">Edit Attachment As Comment<\/button>');
232 document.write('<button type="button" id="undoEditButton" onclick="undoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Undo Edit As Comment<\/button>');
233 document.write('<button type="button" id="redoEditButton" onclick="redoEditAsComment(patchviewerinstalled);" class="bz_default_hidden">Redo Edit As Comment<\/button>');
234 var editFrame = document.getElementById('editFrame');
236 editFrame.disabled = false;
239 [% IF use_patchviewer %]
240 document.write('<button type="button" id="viewDiffButton" onclick="viewDiff(attachment_id, patchviewerinstalled);">View Attachment As Diff<\/button>');
242 document.write('<button type="button" id="viewRawButton" onclick="viewRaw(patchviewerinstalled);" class="bz_default_hidden">View Attachment As Raw<\/button>');
250 Attachment is not viewable in your browser because its MIME type
251 ([% attachment.contenttype FILTER html %]) is not one that your browser is
255 <a href="attachment.cgi?id=[% attachment.id %]">Download the attachment</a>.
260 <div id="attachment_comments_and_flags">
262 [%# if WEBKIT_CHANGES %]
263 [% IF attachment.ispatch %]
266 <div class="statusBubble">
267 <iframe src="https://webkit-queues.webkit.org/status-bubble/[% attachment.id %]"
268 style="width: 400px; height: 40px; border: none;" scrolling="no">
273 [%# endif // WEBKIT_CHANGES %]
274 <div id="smallCommentFrame" >
275 <label for="comment">Comment (on the [% terms.bug %]):</label>
276 [% classNames = 'block' %]
277 [% classNames = "$classes bz_private" IF attachment.isprivate %]
278 [% INCLUDE global/textarea.html.tmpl
288 <div id="attachment_flags">
289 [% IF attachment.flag_types.size > 0 %]
290 [% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types
291 read_only_flags = !can_edit
297 [% Hook.process('form_before_submit') %]
300 <div id="update_container">
301 <input type="submit" value="Submit" id="update">
309 <div id="attachment_actions">
310 <span class="label">Actions:</span>
311 <a href="attachment.cgi?id=[% attachment.id %]">View</a>
312 [%# if WEBKIT_CHANGES %]
313 [% IF attachment.ispatch %]
314 | <a href="attachment.cgi?id=[% attachment.id %]&action=prettypatch">Formatted Diff</a>
316 [%# endif // WEBKIT_CHANGES %]
317 [% IF use_patchviewer %]
318 | <a href="attachment.cgi?id=[% attachment.id %]&action=diff">Diff</a>
320 [% IF Param("allow_attachment_deletion")
321 && user.in_group('admin')
322 && attachment.datasize > 0 %]
323 | <a href="attachment.cgi?id=[% attachment.id %]&action=delete">Delete</a>
325 [% Hook.process('action') %]
328 <div id="attachment_list">
329 Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]:
330 [% FOREACH a = attachments %]
331 [% IF a == attachment.id %]
334 <a href="attachment.cgi?id=[% a %]&action=edit">[% a %]</a>
336 [% " |" UNLESS loop.last() %]
340 <script type="text/javascript">
342 YAHOO.util.Dom.removeClass( document.body, "no_javascript" );
343 // toggle_attachment_details_visibility( ); // WEBKIT_CHANGES
347 [% Hook.process('end') %]
349 [% PROCESS global/footer.html.tmpl %]