Commit 25385f53 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 302669 (2nd part): show_bug.cgi?ctype=xml should allow the option of…

Bug 302669 (2nd part): show_bug.cgi?ctype=xml should allow the option of exporting attachment data - Patch by Greg Hendricks <ghendricks@novell.com> r/a=myk
parent e679c186
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
# Myk Melez <myk@mozilla.org> # Myk Melez <myk@mozilla.org>
# Max Kanat-Alexander <mkanat@bugzilla.org> # Max Kanat-Alexander <mkanat@bugzilla.org>
# Frédéric Buclin <LpSolit@gmail.com> # Frédéric Buclin <LpSolit@gmail.com>
# Greg Hendricks <ghendricks@novell.com>
package Bugzilla::Template; package Bugzilla::Template;
...@@ -37,6 +38,7 @@ use Bugzilla::Config qw(:DEFAULT $templatedir $datadir); ...@@ -37,6 +38,7 @@ use Bugzilla::Config qw(:DEFAULT $templatedir $datadir);
use Bugzilla::Util; use Bugzilla::Util;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Error; use Bugzilla::Error;
use MIME::Base64;
# for time2str - replace by TT Date plugin?? # for time2str - replace by TT Date plugin??
use Date::Format (); use Date::Format ();
...@@ -319,7 +321,13 @@ sub create { ...@@ -319,7 +321,13 @@ sub create {
$var =~ s/\@/\\x40/g; # anti-spam for email addresses $var =~ s/\@/\\x40/g; # anti-spam for email addresses
return $var; return $var;
}, },
# Converts data to base64
base64 => sub {
my ($data) = @_;
return encode_base64($data);
},
# HTML collapses newlines in element attributes to a single space, # HTML collapses newlines in element attributes to a single space,
# so form elements which may have whitespace (ie comments) need # so form elements which may have whitespace (ie comments) need
# to be encoded using &#013; # to be encoded using &#013;
......
...@@ -108,7 +108,8 @@ $vars->{'bug_list'} = \@bug_list; ...@@ -108,7 +108,8 @@ $vars->{'bug_list'} = \@bug_list;
# If no explicit list is defined, we show all fields. We then exclude any # 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 # on the exclusion list. This is so you can say e.g. "Everything except
# attachments" without listing almost all the fields. # 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; my %displayfields;
if ($cgi->param("field")) { if ($cgi->param("field")) {
......
...@@ -96,6 +96,7 @@ foreach my $include_path (@include_paths) { ...@@ -96,6 +96,7 @@ foreach my $include_path (@include_paths) {
html_linebreak => sub { return $_; }, html_linebreak => sub { return $_; },
no_break => sub { return $_; } , no_break => sub { return $_; } ,
js => sub { return $_ } , js => sub { return $_ } ,
base64 => sub { return $_ } ,
inactive => [ sub { return sub { return $_; } }, 1] , inactive => [ sub { return sub { return $_; } }, 1] ,
closed => [ sub { return sub { return $_; } }, 1] , closed => [ sub { return sub { return $_; } }, 1] ,
obsolete => [ sub { return sub { return $_; } }, 1] , obsolete => [ sub { return sub { return $_; } }, 1] ,
......
...@@ -218,7 +218,7 @@ sub directive_ok { ...@@ -218,7 +218,7 @@ sub directive_ok {
# Things which are already filtered # Things which are already filtered
# Note: If a single directive prints two things, and only one is # Note: If a single directive prints two things, and only one is
# filtered, we may not catch that case. # 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| ics|quoteUrls|time|uri|xml|lower|
obsolete|inactive|closed|unitconvert| obsolete|inactive|closed|unitconvert|
none)/x; none)/x;
......
...@@ -170,6 +170,8 @@ ...@@ -170,6 +170,8 @@
&nbsp; | &nbsp; &nbsp; | &nbsp;
<a href="show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">Format For Printing</a> <a href="show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">Format For Printing</a>
&nbsp; | &nbsp; &nbsp; | &nbsp;
<a href="show_bug.cgi?ctype=xml&amp;id=[% bug.bug_id %]">XML</a>
&nbsp; | &nbsp;
<a href="enter_bug.cgi?cloned_bug_id=[% bug.bug_id %]">Clone This [% terms.Bug %]</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. %] [%# Links to more things users can do with this bug. %]
......
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
<date>[% a.attached FILTER time FILTER xml %]</date> <date>[% a.attached FILTER time FILTER xml %]</date>
<desc>[% a.description FILTER xml %]</desc> <desc>[% a.description FILTER xml %]</desc>
<ctype>[% a.contenttype FILTER xml %]</ctype> <ctype>[% a.contenttype FILTER xml %]</ctype>
[% IF displayfields.attachmentdata %]
<data>[% a.data FILTER base64 %]</data>
[% END %]
[% FOREACH flag = a.flags %] [% FOREACH flag = a.flags %]
<flag name="[% flag.type.name FILTER xml %]" <flag name="[% flag.type.name FILTER xml %]"
status="[% flag.status FILTER xml %]" status="[% flag.status FILTER xml %]"
......
...@@ -140,6 +140,14 @@ ...@@ -140,6 +140,14 @@
<input type="hidden" name="format" value="multiple"> <input type="hidden" name="format" value="multiple">
<input type="submit" value="&nbsp;&nbsp;Long Format&nbsp;"> <input type="submit" value="&nbsp;&nbsp;Long Format&nbsp;">
</form> </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')) %] [% IF UserInGroup(Param('timetrackinggroup')) %]
<form method="post" action="summarize_time.cgi"> <form method="post" action="summarize_time.cgi">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment