[%# 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 %] – [% attachment.description FILTER html %] [% 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 generate_api_token = 1 doc_section = "using/editing.html#attachments" yui = ['json', 'connection'] javascript_urls = ['js/attachment.js', 'js/field.js'] style_urls = ['skins/standard/bug.css'] 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" %]
[% IF user.id %] [% END %]
[% IF attachment.ispatch %][patch][% END %] [%~ attachment.description FILTER html ~%] [% IF can_edit %] (edit details) [% END %]
[% attachment.filename FILTER html %] ([% attachment.contenttype FILTER html %]), [% IF attachment.datasize %] [%+ attachment.datasize FILTER unitconvert %] [% ELSE %] deleted [% END %], created by [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %] on [%+ attachment.attached FILTER time %] [% IF attachment.isprivate %]; only visible to [% Param('insidergroup') FILTER html %] members [% END %]
(hide)
  [% INCLUDE global/textarea.html.tmpl id = 'description' name = 'description' minrows = 3 cols = 25 wrap = 'soft' classes = 'block' _ editable_or_hide defaultcontent = attachment.description %]
Creator: [%+ INCLUDE global/user.html.tmpl who = attachment.attacher %]
Created: [%+ attachment.attached FILTER time %]
Size: [% IF attachment.datasize %] [%+ attachment.datasize FILTER unitconvert %] [% ELSE %] deleted [% END %]
[% IF user.is_insider %]
[% IF can_edit %] [% ELSE %] Is Private: [%+ attachment.isprivate ? "yes" : "no" %] [% END %]
[% END %]
[% IF !attachment.datasize %]
The content of this attachment has been deleted.
[% ELSIF !Param("allow_attachment_display") %]

The attachment is not viewable in your browser due to security restrictions enabled by your [% terms.Bugzilla %] administrator.

In order to view the attachment, you first have to download it.

[% ELSIF attachment.is_viewable %]
[% 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) %]

[% IF attachment.datasize < 120 %] [% attachment.data FILTER html %] [% ELSE %] [% attachment.data FILTER truncate(80) FILTER html %] ... [% attachment.data.match('.*(.{20})$').0 FILTER html %] [% END %]

[% ELSIF attachment.contenttype.match('^text/') %] [%# For security reasons (clickjacking, embedded scripts), we never # render HTML, XML or SVG pages directly. The source code for all # text/* MIME types is displayed instead. If someone tries to abuse # Bugzilla by manually editing the MIME type, it will be caught # by the iframe below, thanks to its 'sandbox' attribute. %] [% INCLUDE global/textarea.html.tmpl id = 'viewFrame' minrows = 10 cols = 80 defaultcontent = attachment.data readonly = 'readonly' %] [% ELSE %] [%# The 'sandbox' attribute causes all scripts and form submissions # embedded in the attachment to be disabled, for security reasons. %] [% END %] [% IF use_patchviewer %] [% END %] [% IF user.id %] [% END %] [% IF use_patchviewer %] [% END %]
[% ELSE %]

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.

Download the attachment.

[% END %]
[% IF user.id %]
[% 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) %] [% END %] [% Hook.process('after_comment_textarea') %]
[% END %]
[% IF attachment.flag_types.size > 0 %] [% PROCESS "flag/list.html.tmpl" flag_types = attachment.flag_types read_only_flags = !can_edit %] [% END %]
[% Hook.process('form_before_submit') %] [% IF user.id %]
[% IF Param('minor_update_group') && user.in_group(Param('minor_update_group')) %]
[% END %]
[% END %]
[% IF attachment.datasize %]
Actions: [% IF attachment.is_viewable %]View[% ELSE %]Download[% END %] [% IF use_patchviewer %] | Diff [% END %] [% IF Param("allow_attachment_deletion") && user.in_group('admin') %] | Delete [% END %] [% Hook.process('action') %]
[% END %]
Attachments on [% "$terms.bug ${attachment.bug_id}" FILTER bug_link(attachment.bug_id) FILTER none %]: [% FOREACH a = attachments %] [% IF a.isobsolete %] [% END %] [% IF a.id == attachment.id %] [%+ a.id FILTER html %] [% ELSE %] [% a.id FILTER html %] [% END %] [% IF a.isobsolete %] [% END %] [% " |" UNLESS loop.last() %] [% END %]
[% IF can_edit %] [% END %] [% Hook.process('end') %] [% PROCESS global/footer.html.tmpl %]