X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fautohandler;h=bdea50534232e66a6d310e37b8ceae1e9b4a3f7f;hb=c648976f0b7975f2328ebd7ba8c711fad0ca4195;hp=e6e50d5bd17cc89cefc7ade2af895f3adf0cc150;hpb=abf5c5442afce5198f6289840791c96f58254e85;p=freeside.git diff --git a/httemplate/autohandler b/httemplate/autohandler index e6e50d5bd..bdea50534 100644 --- a/httemplate/autohandler +++ b/httemplate/autohandler @@ -1,23 +1,35 @@ % $m->call_next; - <%init> dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); - <%filter> my $profile = ''; if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { - #if contenttype is text/html!! **FIXME** + if ( lc($r->content_type) eq 'text/html' ) { + + ## barely worth it, just in case someone tries to use profiling on a + ## non-RT install + #eval "use Text::Wrapper;"; + #die $@ if $@; - $profile = '
'. ("\n"x4096). encode_entities(dbh->sprintProfile()).
+    my $wrapper = new Text::Wrapper( columns => 80 );
+    my $text = dbh->sprintProfile();
+    #my $text = $wrapper->wrap( dbh->sprintProfile() );
+    $text =~ s/^/                                                          /mg;
+    
+    $profile = '
'.
+               encode_entities( $text ).
                #"\n\n". &sprintAutoProfile(). '
'; "\n\n". '
'; - #endif + } dbh->{'private_profile'} = {}; } s/(<\/BODY>[\s\n]*<\/HTML>[\s\n]*)$/$profile$1/i; +<%cleanup> + dbh->commit(); +