| 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 ();
|
| 4 |
- |
15 |
$ENV{HTTPS} = 'ON' if $ENV{SERVER_NAME} =~ /^peeps/;
|
| 2 |
- |
16 |
|
|
|
17 |
my $cookie_string = authenticate (1) || die;
|
|
|
18 |
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
|
|
19 |
my $user = $ORCUSER;
|
|
|
20 |
#my $activated = $ORCUSER->{access};
|
|
|
21 |
|
|
|
22 |
print header (-cookie=>CGI::Cookie->new(-name=>'PEEPSAUTH',-value=>"$cookie_string"));
|
|
|
23 |
|
|
|
24 |
#foreach (sort keys %ENV) {
|
|
|
25 |
# print "$_: $ENV{$_}\n<br>";
|
|
|
26 |
#}
|
|
|
27 |
|
|
|
28 |
use DateTime;
|
|
|
29 |
my $dt = DateTime->today;
|
|
|
30 |
$dt =~ s/T00\:00\:00$//;
|
|
|
31 |
|
|
|
32 |
my @announcements;
|
|
|
33 |
my @everyone;
|
|
|
34 |
my @leads;
|
|
|
35 |
|
|
|
36 |
my @insurance;
|
|
|
37 |
$user->{policy} = isPersonCovered ($user->{id});
|
|
|
38 |
if ($user->{policy}) {
|
|
|
39 |
my $daysremaining = remainingPolicyDays ($user->{id}, $user->{policy});
|
|
|
40 |
push @insurance, $h->li ("You are currently covered by Policy ID: $user->{policy}");
|
|
|
41 |
push @insurance, $h->li ("You have $daysremaining days remaining in coverage.");
|
|
|
42 |
if ($daysremaining <= 90) {
|
|
|
43 |
push @insurance, $h->li ($h->a ( { href=>"attestation" }, "You're eligible to renew." ));
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
} else {
|
|
|
47 |
push @insurance, $h->li ($h->a ( { href=>"attestation" }, "Purchase Insurance." ));
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
my @policyhistory = ($h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableHead", style=>"font-size: smaller;" }, qw(ID Policy Start End) ) ]));
|
|
|
52 |
my @policy_columns = qw(id person_id member_org_id policy_name fee created start end terminated active);
|
|
|
53 |
|
|
|
54 |
my @policies = @{ $dbh->selectall_arrayref ("select * from coverage where person_id = ? order by start desc, end", undef, $user->{id}) };
|
|
|
55 |
my $active_policy = isPersonCovered ($user->{id});
|
|
|
56 |
foreach (@policies) {
|
|
|
57 |
my %policy;
|
|
|
58 |
@policy{@policy_columns} = @{$_};
|
|
|
59 |
|
|
|
60 |
push @policyhistory, $h->div ({ class=>"rTableRow ".($policy{id} == $active_policy ? "highlighted" : "shaded"), onClick=>"window.location.href='view_policy?id=$policy{id}'" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: smaller;" }, $policy{id}, $policy{policy_name}, $policy{start}, $policy{end}) ]);
|
|
|
61 |
|
|
|
62 |
# push @classes, $h->div ({ class=>"rTableRow ".($classhash->{signedup} ? "highlighted" : "shaded"), onClick=>"window.location.href='view_class?id=$classid'" },[ $h->div ({ class=>"rTableCellr", style=>"font-size: smaller;" }, @{$class}) ]);
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
my @managers;
|
|
|
66 |
|
|
|
67 |
my @sysadmins;
|
|
|
68 |
|
|
|
69 |
my @activity_log;
|
|
|
70 |
my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");
|
|
|
71 |
$alog->execute($user->{person_id});
|
|
|
72 |
while (my @logs = $alog->fetchrow_array) {
|
|
|
73 |
my ($d, $t) = split /\s+/, $logs[0];
|
|
|
74 |
push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
my @reference;
|
|
|
78 |
|
|
|
79 |
printRCHeader("Home");
|
|
|
80 |
print $h->close ("table");
|
|
|
81 |
|
|
|
82 |
print $h->form ({ name => "Req", action => url });
|
|
|
83 |
|
|
|
84 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);
|
|
|
85 |
|
|
|
86 |
#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;
|
|
|
87 |
|
|
|
88 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);
|
|
|
89 |
|
|
|
90 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);
|
|
|
91 |
|
|
|
92 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Policy History:"), $h->ul ([ @policyhistory ]) ]) if (scalar @policyhistory);
|
|
|
93 |
|
|
|
94 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Lead:"), $h->ul ([ @leads ]) ]) if ($LVL > 1);
|
|
|
95 |
|
|
|
96 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a Manager:"), $h->ul ([ @managers ]) ]) if ($LVL > 2);
|
|
|
97 |
|
|
|
98 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);
|
|
|
99 |
|
|
|
100 |
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×tamp=true&event=true&RCid=true&derby_name=true&filter-timestamp=&filter-event=&filter-RCid=".$user->{RCid}."&filter-derby_name=&sortby=eventid&limit=25&page=1" }, "[Your entire log history]")) ]);
|
|
|
101 |
|
|
|
102 |
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]);
|
|
|
103 |
|
|
|
104 |
print $h->close ("body"), $h->close ("html");
|
|
|
105 |
|
|
|
106 |
|
| 5 |
- |
107 |
|