torrus, RT#10574
[freeside.git] / torrus / perllib / Torrus / Freeside.pm
1 package Torrus::Freeside;
2
3 use strict;
4 use warnings;
5
6 #Freeside
7 use FS::Mason qw( mason_interps );
8
9 my $outbuf;
10 my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf);
11
12 sub freesideHeader {
13   my($self, $title, $stylesheet) = @_;
14
15   #from html-incblocks.txt
16   my $head =
17   #  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
18   #  [% IF expires %]<META HTTP-EQUIV="Refresh" CONTENT="[% expires %]"/>[% END %]
19     '<STYLE type="text/css" media="all">
20      @import url( '. $Torrus::Renderer::plainURL. $stylesheet. ' );
21      </STYLE>
22     ';
23
24   $self->freesideComponent('/elements/header.html',
25                              {
26                                'title' => $title,
27                                'head'  => $head,
28                                #'etc'   => $etc,
29                                #'nobr'  => 1,
30                                #'nocss' => 1,
31                              }
32                           );
33 }
34
35 sub freesideFooter {
36   my $self = shift;
37   $self->freesideComponent('/elements/footer.html');
38 }
39
40 our $FSURL;
41
42 sub freesideComponent {
43   my($self, $comp) = (shift, shift);
44
45 #  my $conf = new FS::Conf;
46   $FS::Mason::Request::FSURL = $FSURL;
47   $FS::Mason::Request::FSURL .= '/' unless $FS::Mason::Request::FSURL =~ /\/$/;
48 #  $FS::Mason::Request::QUERY_STRING = $packet->{'query_string'} || '';
49
50   $self->freesideSetup;
51
52   $outbuf = '';
53   #$fs_interp->exec($comp, @args); #only FS for now alas...
54   $fs_interp->exec($comp, @_); #only FS for now alas...
55
56   #errors? (turn off in-line error reporting?)
57
58   return $outbuf;
59
60 }
61
62 1;
63