rt 4.2.13 ticket#13852
[freeside.git] / rt / share / html / NoAuth / css / dhandler
index 2472a9f..61c9cb4 100644 (file)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -50,28 +50,15 @@ my $squisher;
 </%ONCE>
 <%INIT>
 my $arg = $m->dhandler_arg;
-my $path;
-if ( $arg =~ m{^(.*)-squished(\.[^\.]+)$} ) {
-    $path = $m->current_comp->dir_path .'/'. $1 . $2;
+if ( $arg =~ m{(.*)/squished-[0-9a-f]{32}\.css$} ) {
+    my $style = $1;
+    my $squished = RT::Interface::Web::SquishedCSS( $style );
+    # Don't send Last-Modified since we don't handle If-Modified-Since
+    #$r->header_out( 'Last-Modified'  => $squished->ModifiedTimeString );
+    $m->out( $squished->Content );
 }
 else {
     return $m->decline;
 }
 
-$squisher = new RT::CSS::Squish unless $squisher;
-$squisher->{'mason'} = $m;
-
-$m->out( $squisher->concatenate( $path ) );
-
-package RT::CSS::Squish;
-use CSS::Squish '0.06';
-use base qw(CSS::Squish);
-sub file_handle {
-    my $self = shift;
-    my $file = shift;
-    my $content = $self->{'mason'}->scomp($file) || '';
-    open( my $fh, '<', \$content ) or die "$!";
-    return $fh;
-}
-
 </%INIT>