[Rt-commit] r17489 - in rt/3.8/branches/3.8.2-releng: lib/RT/Interface/Web lib/RT/Interface/Web/Mason share/html/NoAuth/css share/html/NoAuth/images t/web
falcone at bestpractical.com
falcone at bestpractical.com
Wed Dec 31 12:00:33 EST 2008
Author: falcone
Date: Wed Dec 31 12:00:32 2008
New Revision: 17489
Removed:
rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Mason/
Modified:
rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web.pm
rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Handler.pm
rt/3.8/branches/3.8.2-releng/share/html/NoAuth/css/autohandler
rt/3.8/branches/3.8.2-releng/share/html/NoAuth/images/autohandler
rt/3.8/branches/3.8.2-releng/t/web/basic.t
Log:
merge down Mason/*Handler removal
Modified: rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web.pm
==============================================================================
--- rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web.pm (original)
+++ rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web.pm Wed Dec 31 12:00:32 2008
@@ -237,6 +237,36 @@
# $HTML::Mason::Commands::r->headers_out->{'Last-Modified'} = $date->RFC2616;
}
+=head2 SendStaticFile
+
+=cut
+
+sub SendStaticFile {
+ my $self = shift;
+ my %args = @_;
+ my $file = $args{File};
+ my $type = $args{Type};
+
+ $self->StaticFileHeaders();
+
+ unless ( $type ) {
+ if ($file =~ /\.(gif|png|jpe?g)$/i) {
+ $type = "image/$1";
+ $type =~ s/jpg/jpeg/gi;
+ }
+ $type ||= "application/octet-stream";
+ }
+ $HTML::Mason::Commands::r->content_type($type);
+ open my $fh, "<$file" or die "couldn't open file: $!";
+ binmode($fh);
+ {
+ local $/ = \16384;
+ $HTML::Mason::Commands::m->out($_) while (<$fh>);
+ $HTML::Mason::Commands::m->flush_buffer;
+ }
+ close $fh;
+}
+
sub StripContent {
my %args = @_;
my $content = $args{Content};
Modified: rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Handler.pm (original)
+++ rt/3.8/branches/3.8.2-releng/lib/RT/Interface/Web/Handler.pm Wed Dec 31 12:00:32 2008
@@ -137,12 +137,8 @@
=cut
sub NewApacheHandler {
- require RT::Interface::Web::Mason::ApacheHandler;
- return NewHandler(
- 'RT::Interface::Web::Mason::ApacheHandler',
- args_method => "CGI",
- @_
- );
+ require HTML::Mason::ApacheHandler;
+ return NewHandler('HTML::Mason::ApacheHandler', args_method => "CGI", @_);
}
# }}}
@@ -156,8 +152,8 @@
=cut
sub NewCGIHandler {
- require RT::Interface::Web::Mason::CGIHandler;
- return NewHandler('RT::Interface::Web::Mason::CGIHandler', @_);
+ require HTML::Mason::CGIHandler;
+ return NewHandler('HTML::Mason::CGIHandler', @_);
}
sub NewHandler {
Modified: rt/3.8/branches/3.8.2-releng/share/html/NoAuth/css/autohandler
==============================================================================
--- rt/3.8/branches/3.8.2-releng/share/html/NoAuth/css/autohandler (original)
+++ rt/3.8/branches/3.8.2-releng/share/html/NoAuth/css/autohandler Wed Dec 31 12:00:32 2008
@@ -46,32 +46,14 @@
%#
%# END BPS TAGGED BLOCK }}}
<%init>
-RT::Interface::Web::StaticFileHeaders();
-my $type;
my $file = $m->base_comp->source_file;
if ($file =~ /\.(gif|png|jpe?g)$/i) {
- $type = "image/$1";
- $type =~ s/jpg/jpeg/gi;
-
-
-die "file $file not found" unless -f $file && -r _;
-
-$r->content_type($type);
-open my $fh, "<$file" or die "couldn't open file: $!";
-binmode($fh);
-{
- local $/ = \16384;
- $m->out($_) while (<$fh>);
- $m->flush_buffer;
-}
-close $fh;
-$m->abort;
+ RT::Interface::Web->SendStaticFile( File => $file );
} else {
-
-$r->content_type('text/css') ;
-$m->call_next();
-return();
+ RT::Interface::Web::StaticFileHeaders();
+ $r->content_type('text/css') ;
+ $m->call_next();
+ return();
}
-
</%init>
Modified: rt/3.8/branches/3.8.2-releng/share/html/NoAuth/images/autohandler
==============================================================================
--- rt/3.8/branches/3.8.2-releng/share/html/NoAuth/images/autohandler (original)
+++ rt/3.8/branches/3.8.2-releng/share/html/NoAuth/images/autohandler Wed Dec 31 12:00:32 2008
@@ -1,28 +1,7 @@
<%INIT>
-&RT::Interface::Web::StaticFileHeaders();
-
# This autohandler will spit out RT's images if the user hasn't
# properly configured their webserver to stop RT from passing
# images through the mason handler.
my $file = $m->base_comp->source_file;
-
-
-my $type = "application/octet-stream";
-if ($file =~ /\.(gif|png|jpe?g)$/i) {
- $type = "image/$1";
- $type =~ s/jpg/jpeg/gi;
-}
-
-die "file not found" unless -f $file && -r _;
-
-$r->content_type($type);
-open my $fh, "<$file" or die "couldn't open file: $!";
-binmode($fh);
-{
- local $/ = \16384;
- $m->out($_) while (<$fh>);
- $m->flush_buffer;
-}
-close $fh;
-$m->abort;
+RT::Interface::Web->SendStaticFile( File => $file );
</%INIT>
Modified: rt/3.8/branches/3.8.2-releng/t/web/basic.t
==============================================================================
--- rt/3.8/branches/3.8.2-releng/t/web/basic.t (original)
+++ rt/3.8/branches/3.8.2-releng/t/web/basic.t Wed Dec 31 12:00:32 2008
@@ -73,6 +73,8 @@
# {{{ test an image
+TODO: {
+ todo_skip("Need to handle mason trying to compile images",1);
$agent->get( $url."NoAuth/images/test.png" );
my $file = RT::Test::get_relocatable_file(
File::Spec->catfile(
@@ -84,6 +86,7 @@
-s $file,
"got a file of the correct size ($file)",
);
+}
# }}}
# {{{ Query Builder tests
More information about the Rt-commit
mailing list