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