[Rt-commit] r17455 - in rt/3.8/trunk: share/html/NoAuth/RichText share/html/NoAuth/css/web2/images share/html/NoAuth/js
falcone at bestpractical.com
falcone at bestpractical.com
Tue Dec 30 16:39:53 EST 2008
Author: falcone
Date: Tue Dec 30 16:39:53 2008
New Revision: 17455
Modified:
rt/3.8/trunk/ (props changed)
rt/3.8/trunk/share/html/NoAuth/RichText/dhandler
rt/3.8/trunk/share/html/NoAuth/css/web2/images/dhandler
rt/3.8/trunk/share/html/NoAuth/js/autohandler
Log:
r43001 at ketch: falcone | 2008-12-30 15:50:02 -0500
* remove more duplicated file reading/writing code and
use the method in RT::Interface::Web
Modified: rt/3.8/trunk/share/html/NoAuth/RichText/dhandler
==============================================================================
--- rt/3.8/trunk/share/html/NoAuth/RichText/dhandler (original)
+++ rt/3.8/trunk/share/html/NoAuth/RichText/dhandler Tue Dec 30 16:39:53 2008
@@ -51,8 +51,6 @@
my $file = dirname($m->current_comp->source_file) . '/FCKeditor/' . $arg;
return $m->decline unless -f $file && -r _;
-&RT::Interface::Web::StaticFileHeaders();
-
my $suffix = $1 if $file =~ /([^.]+)$/;
my $type = {qw(
@@ -65,14 +63,7 @@
png image/png
)}->{$suffix} || 'application/octet-stream';
-$r->content_type($type);
-open my $fh, '<:utf8', $file or die "couldn't open file: $!";
-binmode($fh);
-{
- local $/ = \16384;
- $m->out($_) while (<$fh>);
- $m->flush_buffer;
-}
-close $fh;
+RT::Interface::Web->SendStaticFile( File => $file, Type => $type );
+
$m->abort;
</%INIT>
Modified: rt/3.8/trunk/share/html/NoAuth/css/web2/images/dhandler
==============================================================================
--- rt/3.8/trunk/share/html/NoAuth/css/web2/images/dhandler (original)
+++ rt/3.8/trunk/share/html/NoAuth/css/web2/images/dhandler Tue Dec 30 16:39:53 2008
@@ -1,25 +1,8 @@
<%INIT>
-&RT::Interface::Web::StaticFileHeaders();
use File::Basename;
my $arg = $m->dhandler_arg;
my $file = dirname($m->current_comp->source_file) . '/source/'. $arg;
+RT::Interface::Web->SendStaticFile( File => $file );
-my $type = "application/octet-stream";
-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;
</%INIT>
Modified: rt/3.8/trunk/share/html/NoAuth/js/autohandler
==============================================================================
--- rt/3.8/trunk/share/html/NoAuth/js/autohandler (original)
+++ rt/3.8/trunk/share/html/NoAuth/js/autohandler Tue Dec 30 16:39:53 2008
@@ -46,29 +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 {
+ &RT::Interface::Web::StaticFileHeaders();
$r->content_type('application/x-javascript');
$m->call_next();
return();
More information about the Rt-commit
mailing list