]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 302669 (2nd part): show_bug.cgi?ctype=xml should allow the option of exporting...
authorlpsolit%gmail.com <>
Wed, 7 Sep 2005 19:05:10 +0000 (19:05 +0000)
committerlpsolit%gmail.com <>
Wed, 7 Sep 2005 19:05:10 +0000 (19:05 +0000)
Bugzilla/Template.pm
show_bug.cgi
t/004template.t
t/008filter.t
template/en/default/bug/knob.html.tmpl
template/en/default/bug/show.xml.tmpl
template/en/default/list/list.html.tmpl

index 91b98f5b89fcf85d7897216257a708e190dde89c..92201507ff50ab41ed55a65528b6116ca4cd163b 100644 (file)
@@ -26,6 +26,7 @@
 #                 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;
@@ -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 &#013;
index ddb6b2313eafa2795ce454060e388b74c9857b3f..31619800b4fcd2398e1c104e310b7182b9e5ffbb 100755 (executable)
@@ -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")) {
index 4edb6a3acbbad869c17c75e991d56fb8334bc84a..9cbfadf6e31215c5daa6ff8a45220a34e387d77b 100644 (file)
@@ -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] ,
index 59d3a2bd708835d8b2621ee639819cfa566e6067..61b3dc2b6360c887b8a743ebf88d12bcc0b006dd 100644 (file)
@@ -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;
index 2ade9a3737938e3fff985cdc31672d1d02645493..c76251ae97918cb6da74fb2c22624928fc1fd577 100644 (file)
         &nbsp; | &nbsp;
         <a href="show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">Format For Printing</a>
         &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>
 
         [%# Links to more things users can do with this bug. %]
index 2555600ed65246574b7cf07326e41e59c1a5ea1b..0a09668903dbce427202ccffa9a765de75541a5d 100644 (file)
@@ -77,6 +77,9 @@
             <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 %]"
index a7b2b344cc9fe61434231010ee502c387684b3f4..dfe57b75572819ece92c831760b5072084a9916b 100644 (file)
           <input type="hidden" name="format" value="multiple">
           <input type="submit" value="&nbsp;&nbsp;Long Format&nbsp;">
         </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">