%# Message will arrive in the mail.  Destroy, before the FBI sees it.
<%INIT>
delete $INC{'DBIx/ReportBuilder/Attribute.pm'};
require DBIx::ReportBuilder::Attribute;
use RTx::Reports;
use RTx::ReportSources;
use DBIx::ReportBuilder;

our ($RG, $DB, $Conf);
$session{'dsn'} ||= $session{'CurrentUser'}->UserObj->Attribute('Company');

*NOTHING::AUTOLOAD = sub {''} unless ($RT::Nothing);
$RT::Nothing ||= bless(\(my $x), 'NOTHING');
$RT::IsMSIE = ($ENV{HTTP_USER_AGENT} =~ /MSIE/);
$RG ||= $RT::Nothing;
$DB = RTx::Reports->new($session{'CurrentUser'});

undef $Conf;
*CONF::AUTOLOAD = sub {'dbi:mysql:89390142', 'root', ''} unless ($Conf);
$Conf ||= bless({}, 'CONF');

my $Action = $ARGS{Action} || (
    grep defined, map { /^Action-(.+?)(?:\.[xyXY])?[012]?$/ ? $1 : undef }
    grep length $ARGS{$_}, keys %ARGS
)[0];

local $RT::Stylesheet unless $m->is_subrequest;
$m->notes( BGColor => '#ADD6D6' );
$m->notes( HIColor => '#CBEDED' );
$m->notes( Stylesheet => ($RT::Stylesheet ||= '/RG/styles.css') );
$m->call_next( %ARGS, DB => $DB, Conf => $Conf, dsn => $session{'dsn'}, Action => $Action );
$m->abort;
</%INIT>
