Subversion Repositories PEEPS

Rev

Rev 9 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/usr/bin/perl
2
 
3
# Redirect error messages to a log of my choosing. (it's annoying to filter for errors in the shared env)
4
#my $error_log_path = $ENV{SERVER_NAME} eq "volunteers.rollercon.com" ? "/home3/rollerco/logs/" : "/tmp/";
5
#close STDERR;
6
#open STDERR, '>>', $error_log_path.'vorc_error.log' or warn "Failed to open redirected logfile ($0): $!";
7
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
8
 
9
use strict;
10
use PEEPS;
11
use CGI qw/param header start_html url/;
12
use CGI::Cookie;
13
our $h = HTML::Tiny->new( mode => 'html' );
14
my $dbh = getRCDBH ();
15
 
16
my $cookie_string = authenticate (1) || die;
17
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
18
my $user = $ORCUSER;
19
#my $activated = $ORCUSER->{access};
20
 
21
print header (-cookie=>CGI::Cookie->new(-name=>'PEEPSAUTH',-value=>"$cookie_string"));
22
 
23
#foreach (sort keys %ENV) {
24
#	warn "$_: $ENV{$_}";
25
#}
26
 
27
use DateTime;
28
my $dt = DateTime->today;
29
$dt =~ s/T00\:00\:00$//;
30
 
31
my @announcements;
32
push @announcements, $h->div ({class=>"error"}, "You're logged in as a WFTDA System Admin!") if $user->{SYSADMIN};
33
 
34
my @everyone;
35
push @everyone, $h->li ("Your Member ID is ".$user->{id});
12 - 36
push @everyone, $h->li ($h->a ( { href=>"view_user" }, "View your user information."));
2 - 37
push @everyone, $h->li ($h->a ( { href=>"people" }, "Look at a list of people." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));
38
push @everyone, $h->li ($h->a ( { href=>"organizations" }, "...or a list of leagues." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));
39
my @leads;
40
 
41
my @insurance;
42
$user->{policy} = isPersonCovered ($user->{id});
43
if ($user->{policy}) {
44
  my $daysremaining = remainingPolicyDays ($user->{id}, $user->{policy});
45
  push @insurance, $h->li ("You are currently covered by Policy ID: $user->{policy}");
46
  push @insurance, $h->li ("You have $daysremaining days remaining in coverage.");
47
  if ($daysremaining <= 90) {
48
    push @insurance, $h->li ($h->a ( { href=>"attestation" }, "You're eligible to renew." ));
49
  }
50
 
51
} else {
52
  push @insurance, $h->li ($h->a ( { href=>"attestation" }, "Purchase Insurance." ));
53
}
54
push @insurance, $h->li ($h->a ( { href=>"insurance" }, "View Insurance History." ));
55
push @insurance, $h->li ($h->a ( { href=>"verify_insurance" }, "Verify Someone's Insurance Coverage." ));
56
 
57
 
8 - 58
my @league_admin;
59
foreach (@{isLeagueAdmin ($user->{person_id})}) {
60
  push @league_admin, $h->li ($h->a ( { href=>"view_league?id=".$_ }, "View ".getLeagueName ($_) ));
61
}
62
 
2 - 63
my @managers;
64
 
65
my @sysadmins;
8 - 66
if ($user->{SYSADMIN}) {
67
  push @sysadmins, $h->li ($h->a ( { href=>"org_log" }, "View Org Change Logs." ));
68
}
2 - 69
 
70
my @activity_log;
71
my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");
72
$alog->execute($user->{person_id});
73
while (my @logs = $alog->fetchrow_array) {
74
	my ($d, $t) = split /\s+/, $logs[0];
75
	push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);
76
}
77
 
78
my @reference;
79
 
80
printRCHeader("Home");
81
print $h->close ("table");
82
 
83
print $h->form ({ name => "Req", action => url });
84
 
85
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);
86
 
87
#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;
88
 
89
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);
90
 
91
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);
92
 
8 - 93
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "League Business:"), $h->ul ([ @league_admin ]) ]) if (scalar @league_admin);
2 - 94
 
3 - 95
#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Manager:"), $h->ul ([ @managers ]) ]) if ($LVL > 2);
2 - 96
 
97
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);
98
 
9 - 99
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]")) ]);
2 - 100
 
12 - 101
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]) if (scalar @reference);
2 - 102
 
103
print $h->close ("body"), $h->close ("html");
104
 
105
 
5 - 106