| Line 1... |
Line 1... |
| 1 |
#!/usr/bin/perl
|
1 |
#!/usr/bin/perl
|
| Line -... |
Line 2... |
| - |
|
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";
|
| 2 |
|
8 |
|
| 3 |
use strict;
|
9 |
use strict;
|
| 4 |
use cPanelUserConfig;
|
10 |
use cPanelUserConfig;
|
| 5 |
use RollerCon;
|
11 |
use RollerCon;
|
| 6 |
use CGI qw/param header start_html url/;
|
12 |
use CGI qw/param header start_html url/;
|
| Line 31... |
Line 37... |
| 31 |
my $dt = DateTime->today;
|
37 |
my $dt = DateTime->today;
|
| 32 |
$dt =~ s/T00\:00\:00$//;
|
38 |
$dt =~ s/T00\:00\:00$//;
|
| Line 33... |
Line 39... |
| 33 |
|
39 |
|
| 34 |
my @announcements;
|
40 |
my @announcements;
|
| - |
|
41 |
push @announcements, $h->li ($h->a ({ href=>'__LINK__?'.$user->{discount_code} }, "THANK YOU! You've earned a discounted pass for next year. Click here to redeem.")) if $user->{discount_code};
|
| - |
|
42 |
my ($announcement) = $dbh->selectrow_array ("select value from setting where setting.key = ?", undef, "ANNOUNCEMENT");
|
| - |
|
43 |
push @announcements, $h->li ($announcement) if $announcement;
|
| Line 35... |
Line 44... |
| 35 |
push @announcements, $h->li ($h->a ({ href=>'__LINK__?'.$user->{discount_code} }, "THANK YOU! You've earned a discounted pass for next year. Click here to redeem.")) if $user->{discount_code};
|
44 |
|
| Line 36... |
Line 45... |
| 36 |
|
45 |
|
| 37 |
my $schedule = getSchedule ($user->{RCid});
|
46 |
my $schedule = getSchedule ($user->{RCid});
|
| 38 |
|
47 |
|
| 39 |
my @everyone;
|
48 |
my @everyone;
|
| 40 |
my @printDEPTS = map { $DEPTS->{$_} } grep { $user->{department}->{$_} > 0 } grep { !/(ANN)|(OFF)/ } sort keys %{$user->{department}};
|
49 |
my @printDEPTS = map { $DEPTS->{$_} } grep { $user->{department}->{$_} > 0 } grep { !/(ANN)|(OFF)/ } sort keys %{$user->{department}};
|
| 41 |
push @printDEPTS, "Officiating Lead" if $user->{department}->{"OFF"} > 1;
|
50 |
push @printDEPTS, "Officiating Lead" if $user->{department}->{"OFF"} > 1;
|
| 42 |
my $printDEPTS = join ", ", @printDEPTS;
|
51 |
my $printDEPTS = join ", ", @printDEPTS;
|
| - |
|
52 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/shifts.pl" }, "View and Sign Up for $printDEPTS Shifts")) if $printDEPTS;
|
| 43 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/shifts.pl" }, "View and Sign Up for $printDEPTS Shifts")) if $printDEPTS;
|
53 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/officiating_shifts.pl" }, "View and Sign Up for Officiating Shifts")) if $user->{department}->{OFF} > 0;
|
| 44 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/officiating_shifts.pl" }, "View and Sign Up for Officiating Shifts")) if $user->{department}->{OFF} > 0;
|
54 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/announcer_shifts.pl" }, "View and Sign Up to Announce Games")) if $user->{department}->{ANN} > 0;
|
| Line 45... |
Line 55... |
| 45 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/announcer_shifts.pl" }, "View and Sign Up to Announce Games")) if $user->{department}->{ANN} > 0;
|
55 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "View Games"));
|
| 46 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/manage_personal_time.pl" }, "Block Personal Time"));
|
56 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/personal_time.pl" }, "Block Personal Time"));
|
| 47 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/manage_user.pl?submit=Edit&RCid=$user->{RCid}" }, "Edit your profile"));
|
57 |
push @everyone, $h->li ($h->a ({ href=>"/schedule/view_user.pl?submit=Edit&RCid=$user->{RCid}" }, "Edit your profile"));
|
| 48 |
|
58 |
|
| Line 49... |
Line 59... |
| 49 |
my @mvppass;
|
59 |
my @mvppass;
|
| 50 |
if ($user->{department}->{CLA} > 0) {
|
60 |
if ($user->{mvp_pass}) {
|
| 51 |
push @mvppass, $h->li ($h->a ({ href=>"/schedule/mvpclasses.pl" }, "View and Sign Up for MVP Classes"))
|
61 |
push @mvppass, $h->li ($h->a ({ href=>"/schedule/classes.pl" }, "View and Sign Up for MVP Classes"))
|
| 52 |
}
|
62 |
}
|
| Line 53... |
Line 63... |
| 53 |
|
63 |
|
| 54 |
my @leads = ();
|
64 |
my @leads = ();
|
| 55 |
if ($LVL > 1) {
|
65 |
if ($LVL > 1) {
|
| Line 74... |
Line 84... |
| 74 |
if ($LVL >= 3) {
|
84 |
if ($LVL >= 3) {
|
| 75 |
my $manager_departments = join " or ", map { "department like '%$_-0%'" } grep { $user->{department}->{$_} > 2 } keys %{$user->{department}};
|
85 |
my $manager_departments = join " or ", map { "department like '%$_-0%'" } grep { $user->{department}->{$_} > 2 } keys %{$user->{department}};
|
| 76 |
if ($manager_departments) {
|
86 |
if ($manager_departments) {
|
| 77 |
my ($count) = $dbh->selectrow_array ("select count(*) from official where $manager_departments");
|
87 |
my ($count) = $dbh->selectrow_array ("select count(*) from official where $manager_departments");
|
| 78 |
my $counttxt = $count == 1 ? "is 1 user" : "are $count users";
|
88 |
my $counttxt = $count == 1 ? "is 1 user" : "are $count users";
|
| 79 |
push @managers, $h->li ($h->a ({ href=>"user_report.pl?autoload=1&RCid=true&derby_name=true&email=true&real_name=true&access=true&department=true&added=true&filter-RCid=&filter-derby_name=&filter-email=&filter-real_name=&filter-access=0&filter-department=&filter-added=&sortby=derby_name&limit=25&page=1" }, "There $counttxt waiting to be activated")) if $count;
|
89 |
push @managers, $h->li ($h->a ({ href=>"users.pl?autoload=1&RCid=true&derby_name=true&email=true&real_name=true&access=true&department=true&added=true&filter-RCid=&filter-derby_name=&filter-email=&filter-real_name=&filter-access=0&filter-department=&filter-added=&sortby=derby_name&limit=25&page=1" }, "There $counttxt waiting to be activated")) if $count;
|
| 80 |
}
|
90 |
}
|
| 81 |
push @managers, $h->li ($h->a ({ href=>"/schedule/log.pl" }, "Activity Log"));
|
91 |
push @managers, $h->li ($h->a ({ href=>"/schedule/log.pl" }, "Activity Log"));
|
| 82 |
push @managers, $h->li ($h->a ({ href=>"/schedule/volhours.pl" }, "View Volunteer Hours by Department"));
|
92 |
push @managers, $h->li ($h->a ({ href=>"/schedule/volhours.pl" }, "View Volunteer Hours by Department"));
|
| Line 83... |
Line 93... |
| 83 |
|
93 |
|
| 84 |
foreach (grep { $user->{department}->{$_} > 2 } keys %{$user->{department}}) {
|
94 |
foreach (grep { $user->{department}->{$_} > 2 } keys %{$user->{department}}) {
|
| 85 |
push @managers, $h->li ($h->a ({ href=>"/schedule/shifts.pl?autoload=1&dept=true&role=true&dayofweek=true&location=true&time=true¬e=true&derby_name=true&filter-dept=$_&sortby=dayofweek&limit=All&page=1" }, "$DEPTS->{$_} Staff Schedule"));
|
95 |
push @managers, $h->li ($h->a ({ href=>"/schedule/shifts.pl?autoload=1&dept=true&role=true&dayofweek=true&location=true&time=true¬e=true&derby_name=true&filter-dept=$_&sortby=dayofweek&limit=All&page=1" }, "$DEPTS->{$_} Staff Schedule"));
|
| Line 86... |
Line 96... |
| 86 |
}
|
96 |
}
|
| - |
|
97 |
|
| 87 |
|
98 |
if ($user->{department}->{VCI} > 2 or $user->{department}->{MVP} > 2 or $LVL > 4) {
|
| 88 |
if ($user->{department}->{VCI} > 2 or $user->{department}->{MVP} > 2 or $LVL > 4) {
|
99 |
push @managers, $h->li ($h->a ({ href=>"/schedule/classes.pl" }, "View MVP Classes"));
|
| 89 |
push @managers, $h->li ($h->a ({ href=>"/schedule/mvp_class_report.pl", target=>"_new" }, "Daily MVP Class Report (for print)"));
|
100 |
push @managers, $h->li ($h->a ({ href=>"/schedule/mvp_class_report.pl", target=>"_new" }, "Daily MVP Class Report (for print)"));
|
| 90 |
push @managers, $h->li ($h->a ({ href=>"/schedule/daily_print.pl", target=>"_new" }, "Daily Officiating Report (for print)"));
|
101 |
push @managers, $h->li ($h->a ({ href=>"/schedule/daily_print.pl", target=>"_new" }, "Daily Officiating Report (for print)"));
|
| 91 |
push @managers, $h->li ($h->a ({ href=>"/schedule/daily_print_announcers.pl", target=>"_new" }, "Daily Announcers Report (for print)"));
|
102 |
push @managers, $h->li ($h->a ({ href=>"/schedule/daily_print_announcers.pl", target=>"_new" }, "Daily Announcers Report (for print)"));
|
| Line 97... |
Line 108... |
| 97 |
|
108 |
|
| 98 |
my @sysadmins;
|
109 |
my @sysadmins;
|
| 99 |
if ($LVL >= 5) {
|
110 |
if ($LVL >= 5) {
|
| 100 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/bulk_upload.pl" }, "Upload a CSV of Department Shifts"));
|
111 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/bulk_upload.pl" }, "Upload a CSV of Department Shifts"));
|
| - |
|
112 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/manage_shifts.pl" }, "Update department shift schedule"));
|
| - |
|
113 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/classes.pl" }, "Manage MVP Classes"));
|
| - |
|
114 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/games.pl" }, "Manage Games"));
|
| - |
|
115 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/departments.pl" }, "Manage Department Settings"));
|
| 101 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/manage_shifts.pl" }, "Update department shift schedule"));
|
116 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/settings.pl" }, "System Settings"));
|
| Line 102... |
Line 117... |
| 102 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/volhours_report.pl?limit=All" }, "YEAR END VOLUNTEER HOURS REPORT"));
|
117 |
push @sysadmins, $h->li ($h->a ({ href=>"/schedule/volhours_report.pl?limit=All" }, "YEAR END VOLUNTEER HOURS REPORT"));
|
| 103 |
|
118 |
|
| Line 104... |
Line 119... |
| 104 |
my ($signupcount) = $dbh->selectrow_array ("select count(*) from v_shift where dept = ? and RCid <> ''", undef, "CLA");
|
119 |
my ($signupcount) = $dbh->selectrow_array ("select count(*) from v_shift where dept = ? and RCid <> '' and year(date) = year(now())", undef, "CLA");
|
| Line 105... |
Line 120... |
| 105 |
my ($mvpcount) = $dbh->selectrow_array ("select count(*) from official where department REGEXP ?", undef, "CLA-1");
|
120 |
my ($mvpcount) = $dbh->selectrow_array ("select count(*) from official where mvp_pass = true");
|