# Myk Melez <myk@mozilla.org>
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Frédéric Buclin <LpSolit@gmail.com>
+# Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Template;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
+use MIME::Base64;
# for time2str - replace by TT Date plugin??
use Date::Format ();
$var =~ s/\@/\\x40/g; # anti-spam for email addresses
return $var;
},
-
+
+ # Converts data to base64
+ base64 => sub {
+ my ($data) = @_;
+ return encode_base64($data);
+ },
+
# HTML collapses newlines in element attributes to a single space,
# so form elements which may have whitespace (ie comments) need
# to be encoded using 
# If no explicit list is defined, we show all fields. We then exclude any
# on the exclusion list. This is so you can say e.g. "Everything except
# attachments" without listing almost all the fields.
-my @fieldlist = (Bugzilla::Bug::fields(), 'group', 'long_desc', 'attachment');
+my @fieldlist = (Bugzilla::Bug::fields(), 'group', 'long_desc',
+ 'attachment', 'attachmentdata');
my %displayfields;
if ($cgi->param("field")) {
html_linebreak => sub { return $_; },
no_break => sub { return $_; } ,
js => sub { return $_ } ,
+ base64 => sub { return $_ } ,
inactive => [ sub { return sub { return $_; } }, 1] ,
closed => [ sub { return sub { return $_; } }, 1] ,
obsolete => [ sub { return sub { return $_; } }, 1] ,
# Things which are already filtered
# Note: If a single directive prints two things, and only one is
# filtered, we may not catch that case.
- return 1 if $directive =~ /FILTER\ (html|csv|js|url_quote|css_class_quote|
+ return 1 if $directive =~ /FILTER\ (html|csv|js|base64|url_quote|css_class_quote|
ics|quoteUrls|time|uri|xml|lower|
obsolete|inactive|closed|unitconvert|
none)/x;
|
<a href="show_bug.cgi?format=multiple&id=[% bug.bug_id %]">Format For Printing</a>
|
+ <a href="show_bug.cgi?ctype=xml&id=[% bug.bug_id %]">XML</a>
+ |
<a href="enter_bug.cgi?cloned_bug_id=[% bug.bug_id %]">Clone This [% terms.Bug %]</a>
[%# Links to more things users can do with this bug. %]
<date>[% a.attached FILTER time FILTER xml %]</date>
<desc>[% a.description FILTER xml %]</desc>
<ctype>[% a.contenttype FILTER xml %]</ctype>
+ [% IF displayfields.attachmentdata %]
+ <data>[% a.data FILTER base64 %]</data>
+ [% END %]
[% FOREACH flag = a.flags %]
<flag name="[% flag.type.name FILTER xml %]"
status="[% flag.status FILTER xml %]"
<input type="hidden" name="format" value="multiple">
<input type="submit" value=" Long Format ">
</form>
+ <form method="post" action="show_bug.cgi">
+ <input type="hidden" name="ctype" value="xml">
+ [% FOREACH id = buglist %]
+ <input type="hidden" name="id" value="[% id FILTER html %]">
+ [% END %]
+ <input type="hidden" name="excludefield" value="attachmentdata">
+ <input type="submit" value="XML">
+ </form>
[% IF UserInGroup(Param('timetrackinggroup')) %]
<form method="post" action="summarize_time.cgi">