From: ivan Date: Mon, 30 Jul 2001 08:02:51 +0000 (+0000) Subject: template stuffs X-Git-Tag: merged-freeside_vpopmail_support~25 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=31157731e271ad7c672ec09e756a73304f646b62 template stuffs --- diff --git a/htetc/global.asa b/htetc/global.asa new file mode 100644 index 000000000..beb6d02f0 --- /dev/null +++ b/htetc/global.asa @@ -0,0 +1,20 @@ +use strict; +use vars qw( $cgi $p ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearch qsearchs fields); +use FS::part_svc; +use FS::CGI qw(header menubar popurl table); + +sub Script_OnStart { + $cgi = new CGI; + &cgisuidsetup($cgi); + $p = popurl(2); + #print $cgi->header( '-expires' => 'now' ); +} + +sub Script_OnFlush { + my $ref = $Response->{BinaryRef}; + $$ref = $cgi->header( '-expires' => 'now' ) .$$ref; +} diff --git a/htetc/handler.pl b/htetc/handler.pl new file mode 100644 index 000000000..145529a06 --- /dev/null +++ b/htetc/handler.pl @@ -0,0 +1,78 @@ +#!/usr/bin/perl +# +# This is a basic, fairly fuctional Mason handler.pl. +# +# For something a little more involved, check out session_handler.pl + +package HTML::Mason; + +# Bring in main Mason package. +use HTML::Mason; + +# Bring in ApacheHandler, necessary for mod_perl integration. +# Uncomment the second line (and comment the first) to use +# Apache::Request instead of CGI.pm to parse arguments. +use HTML::Mason::ApacheHandler; +# use HTML::Mason::ApacheHandler (args_method=>'mod_perl'); + +# Uncomment the next line if you plan to use the Mason previewer. +#use HTML::Mason::Preview; + +use strict; + +# List of modules that you want to use from components (see Admin +# manual for details) +#{ package HTML::Mason::Commands; +# use CGI; +#} + +# Create Mason objects +# +my $parser = new HTML::Mason::Parser; +my $interp = new HTML::Mason::Interp (parser=>$parser, + comp_root=>'/var/www/masondocs', + data_dir=>'/home/ivan/freeside_current/masondata', + out_mode=>'stream', + ); +my $ah = new HTML::Mason::ApacheHandler (interp=>$interp); + +# Activate the following if running httpd as root (the normal case). +# Resets ownership of all files created by Mason at startup. +# +chown (Apache->server->uid, Apache->server->gid, $interp->files_written); + +sub handler +{ + my ($r) = @_; + + # If you plan to intermix images in the same directory as + # components, activate the following to prevent Mason from + # evaluating image files as components. + # + #return -1 if $r->content_type && $r->content_type !~ m|^text/|i; + + #rar + { package HTML::Mason::Commands; + use strict; + use vars qw( $cgi $p ); + use CGI; + #use CGI::Carp qw(fatalsToBrowser); + use FS::UID qw(cgisuidsetup); + use FS::Record qw(qsearch qsearchs fields); + use FS::part_svc; + use FS::CGI qw(header menubar popurl table); + + $cgi = new CGI; + #&cgisuidsetup($cgi); + &cgisuidsetup($r); + $p = popurl(2); + } + $r->content_type('text/html'); + #eorar + + my $status = $ah->handle_request($r); + + return $status; +} + +1;