Subversion Repositories PEEPS

Rev

Rev 6 | 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 ();
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});
22 - 38
($user->{RCPolicy}) = $dbh->selectrow_array ("select id from coverage where policy_id = 4 and person_id = ?", undef, $user->{id});
39
 
2 - 40
if ($user->{policy}) {
41
  my $daysremaining = remainingPolicyDays ($user->{id}, $user->{policy});
42
  push @insurance, $h->li ("You are currently covered by Policy ID: $user->{policy}");
43
  push @insurance, $h->li ("You have $daysremaining days remaining in coverage.");
44
  if ($daysremaining <= 90) {
22 - 45
    push @insurance, $h->li ($h->a ( { href=>"attestation?policy=1" }, "You're eligible to renew." ));
2 - 46
  }
47
 
22 - 48
  push @insurance, $h->li ($h->a ( { href=>"attestation?policy=4" }, "Purchase Insurance Coverage for RollerCon 2026." )) unless (isPersonCovered ($user->{id}, "2026-07-11") or $user->{RCPolicy});
49
 
2 - 50
} else {
22 - 51
  push @insurance, $h->li ($h->a ( { href=>"attestation?policy=1" }, "Purchase Insurance." ));
52
  push @insurance, $h->li ($h->a ( { href=>"attestation?policy=4" }, "Purchase Insurance Coverage for RollerCon 2026." )) unless $user->{RCPolicy};
2 - 53
}
54
 
55
 
56
my @policyhistory = ($h->div ({ class=>"rTableRow" },[ $h->div ({ class=>"rTableHead", style=>"font-size: smaller;" }, qw(ID Policy Start End) ) ]));
22 - 57
my @policy_columns = qw(id person_id member_org_id policy_id policy_name fee created start end terminated active);
2 - 58
 
59
my @policies = @{ $dbh->selectall_arrayref ("select * from coverage where person_id = ? order by start desc, end", undef, $user->{id}) };
60
my $active_policy = isPersonCovered ($user->{id});
61
foreach (@policies) {
62
  my %policy;
63
  @policy{@policy_columns} = @{$_};
64
 
65
  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}) ]);
66
 
67
#  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}) ]);
68
}
69
 
70
my @managers;
71
 
72
my @sysadmins;
73
 
74
my @activity_log;
75
my $alog = $dbh->prepare("select timestamp, event from log where person_id = ? order by timestamp desc limit 10");
76
$alog->execute($user->{person_id});
77
while (my @logs = $alog->fetchrow_array) {
78
	my ($d, $t) = split /\s+/, $logs[0];
79
	push @activity_log, $h->li ({ class=>"shaded" }, join " ", @logs);
80
}
81
 
82
my @reference;
83
 
84
printRCHeader("Home");
85
print $h->close ("table");
86
 
87
print $h->form ({ name => "Req", action => url });
88
 
89
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Announcement:"), $h->ul ([ @announcements ]) ]) if (scalar @announcements);
90
 
91
#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;
92
 
93
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do:"), $h->ul ([ @everyone ]) ]);
94
 
95
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Insurance:"), $h->ul ([ @insurance ]) ]);
96
 
97
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Personal Policy History:"), $h->ul ([ @policyhistory ]) ]) if (scalar @policyhistory);
98
 
99
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Things you can do as a SysAdmin:"), $h->ul ([ @sysadmins ]) ]) if ($LVL >= 5);
100
 
101
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&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]")) ]);
102
 
103
print $h->div ({ class=>"index" }, [$h->p ({ class=>"heading" }, "Reference:"), $h->ul ([ @reference ]) ]);
104
 
105
print $h->close ("body"), $h->close ("html");
106
 
107
 
5 - 108