Subversion Repositories PEEPS

Rev

Rev 22 | Rev 38 | 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."));
14 - 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" }, "Leagues / Organizations in PEEPS." ));# if ($user->{SYSADMIN} or scalar @{isLeagueAdmin ($user->{person_id})});
2 - 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) {
22 - 48
    push @insurance, $h->li ($h->a ( { href=>"attestation?policy=1" }, "You're eligible to renew." ));
2 - 49
  }
50
 
51
} else {
22 - 52
  push @insurance, $h->li ($h->a ( { href=>"attestation?policy=1" }, "Purchase Insurance." ));
2 - 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 ($_) ));
36 - 61
  my ($pending) = $dbh->selectrow_array ("select count(id) from full_person where league_id = ? and role = ?", undef, $_, "Pending");
62
  if ($pending) {
63
    my $lid = $_;
64
    push @league_admin, $h->li ($h->a ( { href=>"/people?filter-league_id=$lid&filter-role=Pending" }, "There are Pending Member Request(s)." ));
65
    push @league_admin, $h->ul ([map { $h->li ($h->a ({href=>"/manage_role?league_id=$lid&person_id=$_->[0]"}, $_->[1])) } @{$dbh->selectall_arrayref ("select id, derby_name from full_person where league_id = ? and role = ?", undef, $_, "Pending")}]);
66
  }
67
 
8 - 68
}
69
 
2 - 70
my @managers;
71
 
72
my @sysadmins;
8 - 73
if ($user->{SYSADMIN}) {
74
  push @sysadmins, $h->li ($h->a ( { href=>"org_log" }, "View Org Change Logs." ));
75
}
2 - 76
 
77
my @activity_log;
78
my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");
79
$alog->execute($user->{person_id});
80
while (my @logs = $alog->fetchrow_array) {
81
	my ($d, $t) = split /\s+/, $logs[0];
82
	push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);
83
}
84
 
85
my @reference;
86
 
87
printRCHeader("Home");
88
print $h->close ("table");
89
 
90
print $h->form ({ name => "Req", action => url });
91
 
92
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);
93
 
94
#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;
95
 
96
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);
97
 
98
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);
99
 
8 - 100
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "League Business:"), $h->ul ([ @league_admin ]) ]) if (scalar @league_admin);
2 - 101
 
3 - 102
#print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Manager:"), $h->ul ([ @managers ]) ]) if ($LVL > 2);
2 - 103
 
104
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);
105
 
9 - 106
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 - 107
 
12 - 108
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]) if (scalar @reference);
2 - 109
 
110
print $h->close ("body"), $h->close ("html");
111
 
112
 
5 - 113