Rev 8 | Rev 12 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/perl# Redirect error messages to a log of my choosing. (it's annoying to filter for errors in the shared env)#my $error_log_path = $ENV{SERVER_NAME} eq "volunteers.rollercon.com" ? "/home3/rollerco/logs/" : "/tmp/";#close STDERR;#open STDERR, '>>', $error_log_path.'vorc_error.log' or warn "Failed to open redirected logfile ($0): $!";#warn "Redirecting errors to ${error_log_path}vorc_error.log";use strict;use PEEPS;use CGI qw/param header start_html url/;use CGI::Cookie;our $h = HTML::Tiny->new( mode => 'html' );my $dbh = getRCDBH ();my $cookie_string = authenticate (1) || die;my ($EML, $PWD, $LVL) = split /&/, $cookie_string;my $user = $ORCUSER;#my $activated = $ORCUSER->{access};print header (-cookie=>CGI::Cookie->new(-name=>'PEEPSAUTH',-value=>"$cookie_string"));#foreach (sort keys %ENV) {# warn "$_: $ENV{$_}";#}use DateTime;my $dt = DateTime->today;$dt =~ s/T00\:00\:00$//;my @announcements;push @announcements, $h->div ({class=>"error"}, "You're logged in as a WFTDA System Admin!") if $user->{SYSADMIN};my @everyone;push @everyone, $h->li ("Your Member ID is ".$user->{id});push @everyone, $h->li ($h->a ( { href=>"people" }, "Look at a list of people." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));push @everyone, $h->li ($h->a ( { href=>"organizations" }, "...or a list of leagues." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));my @leads;my @insurance;$user->{policy} = isPersonCovered ($user->{id});if ($user->{policy}) {my $daysremaining = remainingPolicyDays ($user->{id}, $user->{policy});push @insurance, $h->li ("You are currently covered by Policy ID: $user->{policy}");push @insurance, $h->li ("You have $daysremaining days remaining in coverage.");if ($daysremaining <= 90) {push @insurance, $h->li ($h->a ( { href=>"attestation" }, "You're eligible to renew." ));}} else {push @insurance, $h->li ($h->a ( { href=>"attestation" }, "Purchase Insurance." ));}push @insurance, $h->li ($h->a ( { href=>"insurance" }, "View Insurance History." ));push @insurance, $h->li ($h->a ( { href=>"verify_insurance" }, "Verify Someone's Insurance Coverage." ));my @league_admin;foreach (@{isLeagueAdmin ($user->{person_id})}) {push @league_admin, $h->li ($h->a ( { href=>"view_league?id=".$_ }, "View ".getLeagueName ($_) ));}my @managers;my @sysadmins;if ($user->{SYSADMIN}) {push @sysadmins, $h->li ($h->a ( { href=>"org_log" }, "View Org Change Logs." ));}my @activity_log;my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");$alog->execute($user->{person_id});while (my @logs = $alog->fetchrow_array) {my ($d, $t) = split /\s+/, $logs[0];push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);}my @reference;printRCHeader("Home");print $h->close ("table");print $h->form ({ name => "Req", action => url });print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Note:"), "<b>Your account is being reviewed.</b>", $h->br, "You won't have access to view or sign-up for things until you've been approved / added to a department.", $h->br, "Please watch your email for notifications." ]) unless $activated;print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "League Business:"), $h->ul ([ @league_admin ]) ]) if (scalar @league_admin);#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Manager:"), $h->ul ([ @managers ]) ]) if ($LVL > 2);print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Your Latest Activity:"), $h->ul ([ @activity_log ]), $h->h5 ($h->a ({ href=>"log" }, "[Your entire log history]")) ]);print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]);print $h->close ("body"), $h->close ("html");