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