torrus, RT#10574
authorivan <ivan>
Thu, 30 Dec 2010 07:25:30 +0000 (07:25 +0000)
committerivan <ivan>
Thu, 30 Dec 2010 07:25:30 +0000 (07:25 +0000)
torrus/perllib/Torrus/Freeside.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/Freeside.pm
torrus/perllib/Torrus/ReportOutput/Freeside.pm [new file with mode: 0644]
torrus/perllib/Torrus/ReportOutput/HTML.pm

diff --git a/torrus/perllib/Torrus/Freeside.pm b/torrus/perllib/Torrus/Freeside.pm
new file mode 100644 (file)
index 0000000..1b0a281
--- /dev/null
@@ -0,0 +1,66 @@
+package Torrus::Freeside;
+
+use strict;
+use warnings;
+
+#Freeside
+use FS::Mason qw( mason_interps );
+use FS::UID qw(cgisuidsetup);
+use FS::TicketSystem;
+
+my $outbuf;
+my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf);
+
+sub freesideHeader {
+  my($self, $title, $stylesheet) = @_;
+
+  #from html-incblocks.txt
+  my $head =
+  #  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+  #  [% IF expires %]<META HTTP-EQUIV="Refresh" CONTENT="[% expires %]"/>[% END %]
+    '<STYLE type="text/css" media="all">
+     @import url( '. $Torrus::Renderer::plainURL. $stylesheet. ' );
+     </STYLE>
+    ';
+
+  $self->freesideComponent('/elements/header.html',
+                             {
+                               'title' => $title,
+                               'head'  => $head,
+                               #'etc'   => $etc,
+                               #'nobr'  => 1,
+                               #'nocss' => 1,
+                             }
+                          );
+}
+
+sub freesideFooter {
+  my $self = shift;
+  $self->freesideComponent('/elements/footer.html');
+}
+
+our $FSURL;
+
+sub freesideComponent {
+  my($self, $comp) = (shift, shift);
+
+#  my $conf = new FS::Conf;
+  $FS::Mason::Request::FSURL = $FSURL;
+  $FS::Mason::Request::FSURL .= '/' unless $FS::Mason::Request::FSURL =~ /\/$/;
+#  $FS::Mason::Request::QUERY_STRING = $packet->{'query_string'} || '';
+
+  cgisuidsetup($Torrus::CGI::q);
+  FS::TicketSystem->init();
+
+  $outbuf = '';
+  #$fs_interp->exec($comp, @args); #only FS for now alas...
+  $fs_interp->exec($comp, @_); #only FS for now alas...
+
+  #errors? (turn off in-line error reporting?)
+
+  return $outbuf;
+
+}
+
+1;
+
index 8d999e8..837147f 100644 (file)
@@ -1,65 +1,6 @@
 package Torrus::Renderer::Freeside;
 
-use strict;
-
-#Freeside
-use FS::Mason qw( mason_interps );
-use FS::UID qw(cgisuidsetup);
-use FS::TicketSystem;
-
-my $outbuf;
-my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf);
-
-sub freesideHeader {
-  my($self, $title, $stylesheet) = @_;
-
-  #from html-incblocks.txt
-  my $head =
-  #  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
-  #  [% IF expires %]<META HTTP-EQUIV="Refresh" CONTENT="[% expires %]"/>[% END %]
-    '<STYLE type="text/css" media="all">
-     @import url( '. $Torrus::Renderer::plainURL. $stylesheet. ' );
-     </STYLE>
-    ';
-
-  $self->freesideComponent('/elements/header.html',
-                             {
-                               'title' => $title,
-                               'head'  => $head,
-                               #'etc'   => $etc,
-                               #'nobr'  => 1,
-                               #'nocss' => 1,
-                             }
-                          );
-}
-
-sub freesideFooter {
-  my $self = shift;
-  $self->freesideComponent('/elements/footer.html');
-}
-
-our $FSURL;
-
-sub freesideComponent {
-  my($self, $comp) = (shift, shift);
-
-#  my $conf = new FS::Conf;
-  $FS::Mason::Request::FSURL = $FSURL;
-  $FS::Mason::Request::FSURL .= '/' unless $FS::Mason::Request::FSURL =~ /\/$/;
-#  $FS::Mason::Request::QUERY_STRING = $packet->{'query_string'} || '';
-
-  cgisuidsetup($Torrus::CGI::q);
-  FS::TicketSystem->init();
-
-  $outbuf = '';
-  #$fs_interp->exec($comp, @args); #only FS for now alas...
-  $fs_interp->exec($comp, @_); #only FS for now alas...
-
-  #errors? (turn off in-line error reporting?)
-
-  return $outbuf;
-
-}
+use base 'Torrus::Freeside';
 
 1;
 
diff --git a/torrus/perllib/Torrus/ReportOutput/Freeside.pm b/torrus/perllib/Torrus/ReportOutput/Freeside.pm
new file mode 100644 (file)
index 0000000..95daa06
--- /dev/null
@@ -0,0 +1,6 @@
+package Torrus::ReportOutput::Freeside;
+
+use base 'Torrus::Freeside';
+
+1;
+
index 40348a6..910f4db 100644 (file)
@@ -14,7 +14,7 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 
-# $Id: HTML.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
+# $Id: HTML.pm,v 1.2 2010-12-30 07:25:30 ivan Exp $
 # Stanislav Sinyagin <ssinyagin@yahoo.com>
 
 package Torrus::ReportOutput::HTML;
@@ -27,7 +27,7 @@ use Torrus::Log;
 use Torrus::ReportOutput;
 use Torrus::SiteConfig;
 
-use base 'Torrus::ReportOutput';
+use base qw( Torrus::ReportOutput::Freeside Torrus::ReportOutput );
 
 our @monthNames = qw
     (January February March April May June
@@ -225,6 +225,10 @@ sub render
             }},
         'timestamp'  => sub { return time2str($Torrus::Renderer::timeFormat,
                                               time()); },
+
+        #Freeside
+        'freesideHeader' => sub { return $self->freesideHeader(@_); },
+        'freesideFooter' => sub { return $self->freesideFooter(); },
     };
     
     my $result = $self->{'tt'}->process( $tmplfile, $ttvars, $outfile );