This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / httemplate / autohandler
1 % $m->call_next;
2 <%init>
3   dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile');
4 </%init>
5 <%filter>
6
7 my $profile = '';
8 if ( UNIVERSAL::can(dbh, 'sprintProfile') ) {
9
10   if ( lc($r->content_type) eq 'text/html' ) {
11
12     ## barely worth it, just in case someone tries to use profiling on a
13     ## non-RT install
14     #eval "use Text::Wrapper;";
15     #die $@ if $@;
16
17     my $wrapper = new Text::Wrapper( columns => 80 );
18     my $text = dbh->sprintProfile();
19     #my $text = $wrapper->wrap( dbh->sprintProfile() );
20     $text =~ s/^/                                                          /mg;
21     
22     $profile = '<PRE>'.
23                encode_entities( $text ).
24                #"\n\n". &sprintAutoProfile(). '</PRE>';
25                "\n\n".                        '</PRE>';
26   } 
27
28   dbh->{'private_profile'} = {};
29 }
30
31 s/(<\/BODY>[\s\n]*<\/HTML>[\s\n]*)$/$profile$1/i;
32 </%filter>
33 <%cleanup>
34    dbh->commit();
35 </%cleanup>