summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/ClientAPI.pm37
-rw-r--r--FS/FS/Mason.pm11
-rw-r--r--FS/bin/freeside-selfservice-server4
3 files changed, 32 insertions, 20 deletions
diff --git a/FS/FS/ClientAPI.pm b/FS/FS/ClientAPI.pm
index 902f58b..1677fcc 100644
--- a/FS/FS/ClientAPI.pm
+++ b/FS/FS/ClientAPI.pm
@@ -1,29 +1,34 @@
package FS::ClientAPI;
use strict;
-use vars qw(%handler $domain $DEBUG);
+use base 'Exporter';
+use vars qw( @EXPORT_OK %handler $domain $DEBUG );
+
+@EXPORT_OK = qw( load_clientapi_modules );
$DEBUG = 0;
%handler = ();
-#find modules
-foreach my $INC ( @INC ) {
- my $glob = "$INC/FS/ClientAPI/*.pm";
- warn "FS::ClientAPI: searching $glob" if $DEBUG;
- foreach my $file ( glob($glob) ) {
- $file =~ /\/(\w+)\.pm$/ or do {
- warn "unrecognized ClientAPI file: $file";
- next
- };
- my $mod = $1;
- warn "using FS::ClientAPI::$mod" if $DEBUG;
- eval "use FS::ClientAPI::$mod;";
- die "error using FS::ClientAPI::$mod: $@" if $@;
+sub load_clientapi_modules {
+
+ #find modules
+ foreach my $INC ( @INC ) {
+ my $glob = "$INC/FS/ClientAPI/*.pm";
+ warn "FS::ClientAPI: searching $glob" if $DEBUG;
+ foreach my $file ( glob($glob) ) {
+ $file =~ /\/(\w+)\.pm$/ or do {
+ warn "unrecognized ClientAPI file: $file";
+ next
+ };
+ my $mod = $1;
+ warn "using FS::ClientAPI::$mod" if $DEBUG;
+ eval "use FS::ClientAPI::$mod;";
+ die "error using FS::ClientAPI::$mod: $@" if $@;
+ }
}
-}
-#---
+}
sub dispatch {
my ( $self, $name ) = ( shift, shift );
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm
index c5b68f5..7e9827c 100644
--- a/FS/FS/Mason.pm
+++ b/FS/FS/Mason.pm
@@ -388,12 +388,17 @@ if ( -e $addl_handler_use_file ) {
=over 4
-=item mason_interps [ MODE ]
+=item mason_interps [ MODE [ OPTION => VALUE ... ] ]
Returns a list consisting of two HTML::Mason::Interp objects, the first for
Freeside pages, and the second for RT pages.
-#MODE can be 'apache' or 'standalone'. If not specified, defaults to 'apache'.
+MODE can be 'apache' or 'standalone'. If not specified, defaults to 'apache'.
+
+Options and values can be passed following mode. Currently available options
+are:
+
+I<outbuf> should be set to a scalar reference in standalone mode.
=cut
@@ -406,7 +411,7 @@ sub mason_interps {
my $request_class = 'FS::Mason::Request';
#not entirely sure it belongs here, but what the hey
- if ( %%%RT_ENABLED%%% ) {
+ if ( %%%RT_ENABLED%%% && $mode ne 'standalone' ) {
RT::LoadConfig();
}
diff --git a/FS/bin/freeside-selfservice-server b/FS/bin/freeside-selfservice-server
index f72d0ab..1c2086e 100644
--- a/FS/bin/freeside-selfservice-server
+++ b/FS/bin/freeside-selfservice-server
@@ -13,7 +13,7 @@ use Storable 2.09 qw(nstore_fd fd_retrieve);
use Net::SSH qw(sshopen2);
use FS::Daemon qw(daemonize1 drop_root logfile daemonize2 sigint sigterm);
use FS::UID qw(adminsuidsetup forksuidsetup);
-use FS::ClientAPI;
+use FS::ClientAPI qw( load_clientapi_modules );
use FS::ClientAPI_SessionCache;
use FS::Record qw( qsearch qsearchs );
@@ -52,6 +52,8 @@ drop_root();
$ENV{HOME} = (getpwuid($>))[7]; #for ssh
+load_clientapi_modules;
+
adminsuidsetup $user;
#logfile("/usr/local/etc/freeside/selfservice.". $FS::UID::datasrc); #MACHINE