From 870e9e3cbde5fdff854f2e1b2a9c822e8be1caba Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Wed, 7 Sep 2005 12:05:13 +0000 Subject: [PATCH] Bug 302669 (2nd part): show_bug.cgi?ctype=xml should allow the option of exporting attachment data - Patch by Greg Hendricks r/a=myk git-svn-id: svn://10.0.0.236/trunk@179788 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Template.pm | 10 +++++++++- mozilla/webtools/bugzilla/show_bug.cgi | 3 ++- mozilla/webtools/bugzilla/t/004template.t | 1 + mozilla/webtools/bugzilla/t/008filter.t | 2 +- .../bugzilla/template/en/default/bug/knob.html.tmpl | 2 ++ .../bugzilla/template/en/default/bug/show.xml.tmpl | 3 +++ .../bugzilla/template/en/default/list/list.html.tmpl | 8 ++++++++ 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Template.pm b/mozilla/webtools/bugzilla/Bugzilla/Template.pm index 91b98f5b89f..92201507ff5 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Template.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Template.pm @@ -26,6 +26,7 @@ # Myk Melez # Max Kanat-Alexander # Frédéric Buclin +# Greg Hendricks package Bugzilla::Template; @@ -37,6 +38,7 @@ use Bugzilla::Config qw(:DEFAULT $templatedir $datadir); use Bugzilla::Util; use Bugzilla::User; use Bugzilla::Error; +use MIME::Base64; # for time2str - replace by TT Date plugin?? use Date::Format (); @@ -319,7 +321,13 @@ sub create { $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 diff --git a/mozilla/webtools/bugzilla/show_bug.cgi b/mozilla/webtools/bugzilla/show_bug.cgi index ddb6b2313ea..31619800b4f 100755 --- a/mozilla/webtools/bugzilla/show_bug.cgi +++ b/mozilla/webtools/bugzilla/show_bug.cgi @@ -108,7 +108,8 @@ $vars->{'bug_list'} = \@bug_list; # 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")) { diff --git a/mozilla/webtools/bugzilla/t/004template.t b/mozilla/webtools/bugzilla/t/004template.t index 4edb6a3acbb..9cbfadf6e31 100644 --- a/mozilla/webtools/bugzilla/t/004template.t +++ b/mozilla/webtools/bugzilla/t/004template.t @@ -96,6 +96,7 @@ foreach my $include_path (@include_paths) { 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] , diff --git a/mozilla/webtools/bugzilla/t/008filter.t b/mozilla/webtools/bugzilla/t/008filter.t index 59d3a2bd708..61b3dc2b636 100644 --- a/mozilla/webtools/bugzilla/t/008filter.t +++ b/mozilla/webtools/bugzilla/t/008filter.t @@ -218,7 +218,7 @@ sub directive_ok { # 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; diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/knob.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/knob.html.tmpl index 2ade9a37379..c76251ae979 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/knob.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/knob.html.tmpl @@ -170,6 +170,8 @@   |   Format For Printing   |   + XML +   |   Clone This [% terms.Bug %] [%# Links to more things users can do with this bug. %] diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl index 2555600ed65..0a09668903d 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl @@ -77,6 +77,9 @@ [% a.attached FILTER time FILTER xml %] [% a.description FILTER xml %] [% a.contenttype FILTER xml %] + [% IF displayfields.attachmentdata %] + [% a.data FILTER base64 %] + [% END %] [% FOREACH flag = a.flags %] +
+ + [% FOREACH id = buglist %] + + [% END %] + + +
[% IF UserInGroup(Param('timetrackinggroup')) %]