summaryrefslogtreecommitdiff
path: root/torrus
diff options
context:
space:
mode:
authorivan <ivan>2010-12-27 08:40:19 +0000
committerivan <ivan>2010-12-27 08:40:19 +0000
commit3f8ef5c72aa4fbfad5c320d91abdd4f2d547c029 (patch)
tree258c345f9d76c70dbc7fea6810fcaafaa47aadba /torrus
parent74e058c8a010ef6feb539248a550d0bb169c1e94 (diff)
torrus, RT#10574
Diffstat (limited to 'torrus')
-rw-r--r--torrus/FREESIDE_INSTALL11
-rw-r--r--torrus/configs/torrus-siteconfig.pl7
-rw-r--r--torrus/perllib/Torrus/CGI.pm8
-rw-r--r--torrus/perllib/Torrus/Renderer.pm6
-rw-r--r--torrus/perllib/Torrus/Renderer/Freeside.pm65
-rw-r--r--torrus/perllib/Torrus/Renderer/Frontpage.pm8
-rw-r--r--torrus/perllib/Torrus/Renderer/HTML.pm8
-rw-r--r--torrus/templates/html-incblocks.txt27
8 files changed, 108 insertions, 32 deletions
diff --git a/torrus/FREESIDE_INSTALL b/torrus/FREESIDE_INSTALL
new file mode 100644
index 0000000..fa49848
--- /dev/null
+++ b/torrus/FREESIDE_INSTALL
@@ -0,0 +1,11 @@
+i should move to the wiki once this is further along
+
+aptitude install rrdtool librrds-perl libxml-libxml-perl libberkeleydb-perl libtemplate-perl libproc-daemon-perl libnet-snmp-perl libapache-session-perl libjson-perl
+
+make configure-torrus
+make install-torrus
+
+#(and for the apache config)
+# in Makefile, set TORRUS_ENABLED = 1
+make install-apache
+
diff --git a/torrus/configs/torrus-siteconfig.pl b/torrus/configs/torrus-siteconfig.pl
index ed51c17..e5f30dc 100644
--- a/torrus/configs/torrus-siteconfig.pl
+++ b/torrus/configs/torrus-siteconfig.pl
@@ -7,7 +7,7 @@
(
'main' => {
'description' => 'The main tree',
- 'info' => 'some tree',
+ 'info' => 'main tree', #'some tree', #per-agent?
'xmlfiles' => [qw(routers.xml)],
'run' => { 'collector' => 1, 'monitor' => 0 } }
);
@@ -17,5 +17,10 @@
# $Torrus::Renderer::companyURL = 'http://torrus.sf.net';
# $Torrus::Renderer::siteInfo = `hostname`;
+#Freeside
+$Torrus::CGI::authorizeUsers = 0;
+$Torrus::Renderer::rendererURL = '/freeside/torrus';
+$Torrus::Renderer::plainURL = '/freeside/torrus/plain/';
+$Torrus::Renderer::Freeside::FSURL = '%%%FREESIDE_URL%%%';
1;
diff --git a/torrus/perllib/Torrus/CGI.pm b/torrus/perllib/Torrus/CGI.pm
index 574e872..88a434e 100644
--- a/torrus/perllib/Torrus/CGI.pm
+++ b/torrus/perllib/Torrus/CGI.pm
@@ -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: CGI.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# $Id: CGI.pm,v 1.2 2010-12-27 08:40:19 ivan Exp $
# Stanislav Sinyagin <ssinyagin@yahoo.com>
# Universal CGI handler for Apache mod_perl and FastCGI
@@ -37,9 +37,13 @@ use Torrus::ACL;
## Torrus::CGI->process($q)
## Expects a CGI object as input
+our $q;
+
sub process
{
- my($class, $q) = @_;
+ #my($class, $q) = @_;
+ my $class = shift;
+ $q = shift;
my $path_info = $q->url(-path => 1);
diff --git a/torrus/perllib/Torrus/Renderer.pm b/torrus/perllib/Torrus/Renderer.pm
index 803dd18..b1eddb0 100644
--- a/torrus/perllib/Torrus/Renderer.pm
+++ b/torrus/perllib/Torrus/Renderer.pm
@@ -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: Renderer.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# $Id: Renderer.pm,v 1.2 2010-12-27 08:40:19 ivan Exp $
# Stanislav Sinyagin <ssinyagin@yahoo.com>
package Torrus::Renderer;
@@ -36,7 +36,9 @@ use Torrus::Renderer::RRDtool;
use base qw(Torrus::Renderer::HTML
Torrus::Renderer::RRDtool
Torrus::Renderer::Frontpage
- Torrus::Renderer::AdmInfo);
+ Torrus::Renderer::AdmInfo
+ Torrus::Renderer::Freeside
+ );
sub new
{
diff --git a/torrus/perllib/Torrus/Renderer/Freeside.pm b/torrus/perllib/Torrus/Renderer/Freeside.pm
new file mode 100644
index 0000000..7b30474
--- /dev/null
+++ b/torrus/perllib/Torrus/Renderer/Freeside.pm
@@ -0,0 +1,65 @@
+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, $c) = (shift, shift);
+
+ #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;
+
diff --git a/torrus/perllib/Torrus/Renderer/Frontpage.pm b/torrus/perllib/Torrus/Renderer/Frontpage.pm
index 5a9d0a3..715a019 100644
--- a/torrus/perllib/Torrus/Renderer/Frontpage.pm
+++ b/torrus/perllib/Torrus/Renderer/Frontpage.pm
@@ -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: Frontpage.pm,v 1.1 2010-12-27 00:03:44 ivan Exp $
+# $Id: Frontpage.pm,v 1.2 2010-12-27 08:40:19 ivan Exp $
# Stanislav Sinyagin <ssinyagin@yahoo.com>
package Torrus::Renderer::Frontpage;
@@ -208,7 +208,11 @@ sub renderTreeChooser
hasPrivilege( $_[0], 'DisplayTree' ) }
,
'mayGlobalSearch' => sub { return $self->mayGlobalSearch(); },
- 'searchResults' => sub { return $self->doGlobalSearch($_[0]); }
+ 'searchResults' => sub { return $self->doGlobalSearch($_[0]); },
+
+ #Freeside
+ 'freesideHeader' => sub { return $self->freesideHeader(@_); },
+ 'freesideFooter' => sub { return $self->freesideFooter(); },
};
diff --git a/torrus/perllib/Torrus/Renderer/HTML.pm b/torrus/perllib/Torrus/Renderer/HTML.pm
index e9f72ac..296e699 100644
--- a/torrus/perllib/Torrus/Renderer/HTML.pm
+++ b/torrus/perllib/Torrus/Renderer/HTML.pm
@@ -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:44 ivan Exp $
+# $Id: HTML.pm,v 1.2 2010-12-27 08:40:19 ivan Exp $
# Stanislav Sinyagin <ssinyagin@yahoo.com>
package Torrus::Renderer::HTML;
@@ -112,7 +112,11 @@ sub render_html
'verifyDate' => sub { return verifyDate($_[0]); },
'markup' => sub{ return $self->translateMarkup( @_ ); },
'searchEnabled' => $Torrus::Renderer::searchEnabled,
- 'searchResults' => sub { return $self->doSearch($config_tree, $_[0]); }
+ 'searchResults' => sub { return $self->doSearch($config_tree, $_[0]); },
+
+ #Freeside
+ 'FreesideHeader' => sub { return $self->FreesideHeader(@_); },
+ 'freesideFooter' => sub { return $self->freesideFooter(); },
};
diff --git a/torrus/templates/html-incblocks.txt b/torrus/templates/html-incblocks.txt
index ca5540e..f2d55f6 100644
--- a/torrus/templates/html-incblocks.txt
+++ b/torrus/templates/html-incblocks.txt
@@ -1,5 +1,5 @@
[%#
- $Id: html-incblocks.txt,v 1.1 2010-12-27 00:04:03 ivan Exp $
+ $Id: html-incblocks.txt,v 1.2 2010-12-27 08:40:19 ivan Exp $
All BLOCK statements are defined here
%]
@@ -11,11 +11,9 @@
[% BLOCK htmlstart;
IF ! contentClass; contentClass="Content"; END %]
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<HTML>
-<!-- Torrus Copyright (c) 2003-2004 Stanislav Sinyagin -->
-<HEAD>
+
+[% freesideHeader(title, style('stylesheet')) %]
+
<SCRIPT language="JavaScript">
<!--
function helpwindow()
@@ -25,26 +23,9 @@ window.open('[%url(token) _ '&view=helptext-html'%]','helpwindow',
}
//-->
</SCRIPT>
-<TITLE>[% title %]</TITLE>
-<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( [% plainURL _ style('stylesheet') %] );
- [% cssoverlay = style('cssoverlay'); IF cssoverlay; %]
- @import url( [% cssoverlay %] );
- [% END %]
-</STYLE>
-</HEAD>
-<BODY>
<DIV CLASS="Header">
-<SPAN CLASS="CompanyInfo">
-<A TITLE="company info"
-HREF="[%companyURL%]">[% IF companyLogo %]<IMG SRC="[%companyLogo%]"
-ALT=[%companyName%] STYLE="border:0">[% ELSE; companyName; END %]</A>
-</SPAN>
-
[% IF siteInfo %]
<SPAN CLASS="SiteInfo">
[% siteInfo %]