3 # This is a basic, fairly fuctional Mason handler.pl.
5 # For something a little more involved, check out session_handler.pl
9 # Bring in main Mason package.
12 # Bring in ApacheHandler, necessary for mod_perl integration.
13 # Uncomment the second line (and comment the first) to use
14 # Apache::Request instead of CGI.pm to parse arguments.
15 use HTML::Mason::ApacheHandler;
16 # use HTML::Mason::ApacheHandler (args_method=>'mod_perl');
18 # Uncomment the next line if you plan to use the Mason previewer.
19 #use HTML::Mason::Preview;
23 # List of modules that you want to use from components (see Admin
25 #{ package HTML::Mason::Commands;
29 # Create Mason objects
31 my $parser = new HTML::Mason::Parser;
32 my $interp = new HTML::Mason::Interp (parser=>$parser,
33 comp_root=>'/var/www/masondocs',
34 data_dir=>'/home/ivan/freeside_current/masondata',
37 my $ah = new HTML::Mason::ApacheHandler ( interp => $interp,
38 #auto_send_headers => 0,
41 # Activate the following if running httpd as root (the normal case).
42 # Resets ownership of all files created by Mason at startup.
44 chown (Apache->server->uid, Apache->server->gid, $interp->files_written);
50 # If you plan to intermix images in the same directory as
51 # components, activate the following to prevent Mason from
52 # evaluating image files as components.
54 #return -1 if $r->content_type && $r->content_type !~ m|^text/|i;
57 { package HTML::Mason::Commands;
59 use vars qw( $cgi $p );
61 #use CGI::Carp qw(fatalsToBrowser);
68 use String::Approx qw(amatch);
69 use HTML::Widgets::SelectLayers;
70 use FS::UID qw(cgisuidsetup dbh getotaker datasrc driver_name);
71 use FS::Record qw(qsearch qsearchs fields dbdef);
73 use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
74 small_custview myexit);
75 use FS::Msgcat qw(gettext geterror);
79 use FS::domain_record;
81 use FS::cust_bill_pay;
83 use FS::cust_credit_bill;
85 use FS::cust_main_county;
91 use FS::part_bill_event;
93 use FS::part_referral;
97 use FS::queue qw(joblisting);
101 use FS::svc_acct_pop qw(popselector);
108 use FS::part_export_option;
112 *CGI::redirect = sub {
113 my( $self, $location ) = @_;
115 #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect
117 # The next two lines are necessary to stop Apache from re-reading
120 $r->headers_in->unset('Content-length');
121 $r->content_type('text/html');
122 #$r->err_header_out('Location' => $location);
123 $r->header_out('Location' => $location);
124 $r->header_out('Content-Type' => 'text/html');
136 $r->content_type('text/html');
139 my $headers = $r->headers_out;
140 $headers->{'Pragma'} = $headers->{'Cache-control'} = 'no-cache';
142 $headers->{'Expires'} = '0';
144 # $r->send_http_header;
146 my $status = $ah->handle_request($r);