rev 1887 - trunk/buscador/lib/Buscador

[prev] [thread] [next] [lurker] [Date index for 2005/02/15]

From: simon
Subject: rev 1887 - trunk/buscador/lib/Buscador
Date: 16:18 on 15 Feb 2005
Author: simon
Date: 2005-02-15 16:18:54 +0000 (Tue, 15 Feb 2005)
New Revision: 1887

Modified:
   trunk/buscador/lib/Buscador/Thread.pm
Log:
Check to see if we can accept SVG and default to xml otherwise


Modified: trunk/buscador/lib/Buscador/Thread.pm
===================================================================
--- trunk/buscador/lib/Buscador/Thread.pm	2005-02-15 16:08:20 UTC (rev 1886)
+++ trunk/buscador/lib/Buscador/Thread.pm	2005-02-15 16:18:54 UTC (rev 1887)
@@ -72,11 +72,11 @@
 package Email::Store::Mail;
 use strict;
 use Mail::Thread::Chronological;
+use Apache;
 
-
 sub arc :Exported {
     my ($self,$r)  = @_;
-       my $mail       = $r->objects->[0];
+    my $mail       = $r->objects->[0];
     my $root       = $mail->container->root;
     my $arc        = Email::Store::Thread::Arc::Link->new;
     while (1) {
@@ -87,7 +87,8 @@
     }
     my $svg = $arc->selected_message( undef )->render( $root);
 
-    $r->{content_type} = 'image/svg+xml';
+    
+    $r->{content_type} = (Apache->request->headers_in->get('Accept') =~ m!svg+xml!) ? 'image/svg+xml' : 'text/xml';
     $r->{output}       = $svg->xmlify;
 }
 

Generated at 17:00 on 15 Feb 2005 by mariachi 0.52