Subversion Repositories PEEPS

Rev

Rev 2 | Rev 5 | 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});
36
push @everyone, $h->li ($h->a ( { href=>"people" }, "Look at a list of people." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));
37
push @everyone, $h->li ($h->a ( { href=>"organizations" }, "...or a list of leagues." )) if ($user->{SYSADMIN} or scalar isLeagueAdmin ($user->{person_id}));
38
my @leads;
39
 
40
my @insurance;
41
$user->{policy} = isPersonCovered ($user->{id});
42
if ($user->{policy}) {
43
  my $daysremaining = remainingPolicyDays ($user->{id}, $user->{policy});
44
  push @insurance, $h->li ("You are currently covered by Policy ID: $user->{policy}");
45
  push @insurance, $h->li ("You have $daysremaining days remaining in coverage.");
46
  if ($daysremaining <= 90) {
47
    push @insurance, $h->li ($h->a ( { href=>"attestation" }, "You're eligible to renew." ));
48
  }
49
 
50
} else {
51
  push @insurance, $h->li ($h->a ( { href=>"attestation" }, "Purchase Insurance." ));
52
}
53
push @insurance, $h->li ($h->a ( { href=>"insurance" }, "View Insurance History." ));
54
push @insurance, $h->li ($h->a ( { href=>"verify_insurance" }, "Verify Someone's Insurance Coverage." ));
55
 
56
 
57
my @managers;
58
 
59
my @sysadmins;
60
 
61
my @activity_log;
62
my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");
63
$alog->execute($user->{person_id});
64
while (my @logs = $alog->fetchrow_array) {
65
	my ($d, $t) = split /\s+/, $logs[0];
66
	push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);
67
}
68
 
69
my @reference;
70
 
71
printRCHeader("Home");
72
print $h->close ("table");
73
 
74
print $h->form ({ name => "Req", action => url });
75
 
76
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);
77
 
78
#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;
79
 
80
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);
81
 
82
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);
83
 
3 - 84
#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Lead:"), $h->ul ([ @leads ]) ]) if ($LVL > 1);
2 - 85
 
3 - 86
#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Manager:"), $h->ul ([ @managers ]) ]) if ($LVL > 2);
2 - 87
 
88
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);
89
 
90
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Your Latest Activity:"), $h->ul ([ @activity_log ]), $h->h5 ($h->a ({ href=>"log?excel=0&autoload=1&eventid=true&timestamp=true&event=true&filter-timestamp=&filter-event=&sortby=eventid&limit=25&page=1" }, "[Your entire log history]")) ]);
91
 
92
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]);
93
 
94
print $h->close ("body"), $h->close ("html");
95
 
96