| 8 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
use strict;
|
|
|
4 |
use cPanelUserConfig;
|
|
|
5 |
use RollerCon;
|
| 38 |
- |
6 |
use tableViewer;
|
|
|
7 |
use WebDB;
|
| 8 |
- |
8 |
use CGI;
|
|
|
9 |
use CGI::Cookie;
|
|
|
10 |
use DateTime;
|
|
|
11 |
|
|
|
12 |
my $cookie_string = authenticate(2) || die;
|
|
|
13 |
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
|
|
14 |
my $user = getUser($EML);
|
|
|
15 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
|
|
16 |
|
| 25 |
- |
17 |
my $dt = DateTime->now (time_zone => 'America/Los_Angeles');
|
|
|
18 |
#$dt->subtract( hours => 7 );
|
| 8 |
- |
19 |
my $day = $dt->day_name;
|
|
|
20 |
my $date = $dt->date;
|
|
|
21 |
my $curtime = $dt->hms;
|
|
|
22 |
|
|
|
23 |
#$day = "Wednesday";
|
| 38 |
- |
24 |
#$date = "2022-07-13";
|
| 8 |
- |
25 |
|
|
|
26 |
my %class = qw(
|
|
|
27 |
U Unrestricted
|
|
|
28 |
M Mens
|
|
|
29 |
W Womens
|
|
|
30 |
SS Single-Gender
|
|
|
31 |
);
|
|
|
32 |
|
| 38 |
- |
33 |
my $dbh = WebDB::connect ();
|
| 8 |
- |
34 |
|
|
|
35 |
print CGI::header(-cookie=>$RCAUTH_cookie);
|
|
|
36 |
|
|
|
37 |
my $query = new CGI;
|
|
|
38 |
my $track = $query->param('t') || 'ALL';
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
print<<output;
|
|
|
42 |
<html><head><title>ORC Right Now - $day ($date) $curtime - Track $track</title>
|
|
|
43 |
<link rel="stylesheet" type="text/css" href="/rollercon.css">
|
|
|
44 |
</head>
|
|
|
45 |
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
|
|
|
46 |
output
|
|
|
47 |
|
| 25 |
- |
48 |
my $rnh = $dbh->prepare("select * from v_shift_admin_view where id = (select id from game where date = ? and track = ? and time < CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles') and end_time > CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles'))");
|
|
|
49 |
my $nuh = $dbh->prepare("select * from v_shift_admin_view where id = (select id from game where date = ? and track = ? and time > CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles') order by time limit 1)");
|
| 8 |
- |
50 |
|
| 38 |
- |
51 |
my $lrnh = $dbh->prepare("select * from v_shift where id in (select id from v_shift where dept = ? and date = ? and start_time < CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles') and end_time > CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles')) order by location");
|
|
|
52 |
my $lnuh = $dbh->prepare("select * from v_shift where id in (select id from v_shift where dept = ? and date = ? and start_time > CONVERT_TZ(now(), 'America/Chicago', 'America/Los_Angeles') order by location, start_time)");
|
| 8 |
- |
53 |
|
|
|
54 |
#my $gcount = 1; my $tcount = '';
|
|
|
55 |
#my $sth = $dbh->prepare("select distinct teams, track, level, time, gtype, restrictions from v_shift where date = ? order by track, time");
|
|
|
56 |
#my $crewhan = $dbh->prepare("select role, derby_name from v_shift where date = ? and track = ? and time = ?");
|
|
|
57 |
#my $leadhan = $dbh->prepare("select track, time, derby_name from v_lead_shift where date = ? order by track, time");
|
|
|
58 |
#my $openshifthan = $dbh->prepare("select time, level, restrictions, gtype, teams, tla, name from v_shift where tla <> 'ALT' and isNull(derby_name) = 1 and date = ? and track = ? order by time");
|
|
|
59 |
|
|
|
60 |
print "<table>\n<tr><td colspan=5><b>Right Now [$day $curtime Track $track]</b></td></tr></table><br>\n";
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
print "<table>\n<tr><td colspan=5><b>All Leads On Duty</b></td></tr>\n";
|
| 38 |
- |
64 |
$lrnh->execute("OFF", $date);
|
| 8 |
- |
65 |
while (my $lshift = $lrnh->fetchrow_hashref()) {
|
| 38 |
- |
66 |
print "<tr><td>$lshift->{location}</td><td> </td><td>$lshift->{time}</td><td> </td><td>$lshift->{derby_name}</td></tr>\n";
|
| 8 |
- |
67 |
}
|
|
|
68 |
print "</table>\n";
|
|
|
69 |
print "<br><br>\n";
|
|
|
70 |
|
|
|
71 |
my %crew;
|
|
|
72 |
my $g;
|
|
|
73 |
my $c = 1;
|
|
|
74 |
$rnh->execute($date, $track);
|
|
|
75 |
while (my $tg = $rnh->fetchrow_hashref()) {
|
|
|
76 |
if ($c) {
|
|
|
77 |
$g = $tg;
|
|
|
78 |
$c=0;
|
|
|
79 |
}
|
|
|
80 |
if ($tg->{derby_name}) {
|
|
|
81 |
$tg->{derby_name} .= " <A HREF='#' onClick=\"window.open('make_shift_change.pl?change=del&RCid=$tg->{RCid}&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[DROP]</a>";
|
|
|
82 |
$tg->{derby_name} .= " | <A HREF='#' onClick=\"if (confirm('Really? They were a no show?')==true) { window.open('make_shift_change.pl?noshow=true&change=del&RCid=$tg->{RCid}&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }\">[NO SHOW]</a>";
|
|
|
83 |
} else {
|
|
|
84 |
$tg->{derby_name} = "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=lookup&RCid=$tg->RCid&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[ADD USER]</a>";
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
$crew{$tg->{role}} = $tg->{derby_name};
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
$g->{gtype} = join '', map { ucfirst lc } split /(\s+)/, $g->{gtype}; # Capitalize the game type to look nicer
|
|
|
91 |
|
|
|
92 |
my $P1 = "PLT-1";
|
|
|
93 |
my $P2 = "PLT-2";
|
|
|
94 |
my $PH = "PLT";
|
|
|
95 |
if ($g->{gtype} eq "Full Length" or $g->{gtype} eq "Selected Staffing") {
|
|
|
96 |
$P1 = 'PLT/H';
|
|
|
97 |
$P2 = 'PLT';
|
|
|
98 |
$PH = $P1;
|
|
|
99 |
}
|
|
|
100 |
my $A = '';
|
|
|
101 |
if (defined $crew{'ALT'}) {
|
|
|
102 |
$A = "ALT:";
|
|
|
103 |
} else {
|
|
|
104 |
$crew{'ALT'} = '';
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
if ($g->{teams}) {
|
|
|
108 |
print<<game;
|
|
|
109 |
<table>
|
|
|
110 |
<tr><td>Date:</td><td>$day ($date)</td><td> </td><td>Track:</td><td>$g->{track}</td></tr>
|
|
|
111 |
<tr><td>Time:</td><td>$g->{time}</td><td> </td><td>Class:</td><td>$class{$g->{restrictions}} $g->{level} $g->{gtype}</td></tr>
|
|
|
112 |
<tr><td>Game:</td><td colspan=4>$g->{teams}</td></tr>
|
|
|
113 |
<tr><td colspan=5> </td></tr>
|
|
|
114 |
<tr><td>HR:</td><td>$crew{'HR'}</td><td> </td><td>$PH:</td><td>$crew{$P1}</td></tr>
|
|
|
115 |
<tr><td>IPR:</td><td>$crew{'IPR'}</td><td> </td><td>PLT:</td><td>$crew{$P2}</td></tr>
|
|
|
116 |
<tr><td>JR:</td><td>$crew{'JR-1'}</td><td> </td><td>SK:</td><td>$crew{'SK-1'}</td></tr>
|
|
|
117 |
<tr><td>JR:</td><td>$crew{'JR-2'}</td><td> </td><td>SK:</td><td>$crew{'SK-2'}</td></tr>
|
|
|
118 |
<tr><td>OPR:</td><td>$crew{'OPR-1'}</td><td> </td><td>PBM:</td><td>$crew{'PBM'}</td></tr>
|
|
|
119 |
<tr><td>OPR:</td><td>$crew{'OPR-2'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-1'}</td></tr>
|
|
|
120 |
<tr><td>OPR:</td><td>$crew{'OPR-3'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-2'}</td></tr>
|
|
|
121 |
<tr><td>$A</td><td>$crew{'ALT'}</td><td> </td><td>JT:</td><td>$crew{'JT'}</td></tr>
|
|
|
122 |
<tr><td> </td><td> </td><td> </td><td>SO:</td><td>$crew{'SO'}</td></tr>
|
|
|
123 |
</table><br>
|
|
|
124 |
game
|
|
|
125 |
} else {
|
|
|
126 |
print "<table>\n<tr><td colspan=5>There doesn't seem to be a game on this track right now.</td></tr></table><br>\n";
|
|
|
127 |
}
|
|
|
128 |
# $gcount++ % 2 == 0 ? print "<div class='pagebreak'><hr></div>\n" : { };
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
print "<table>\n<tr><td colspan=5><b>Next Up...</b></td></tr></table>\n";
|
|
|
132 |
|
|
|
133 |
print "<table>\n<tr><td colspan=5><b>Leads On Duty Later</b></td></tr>\n";
|
| 38 |
- |
134 |
$lnuh->execute("OFF", $date);
|
| 8 |
- |
135 |
while (my $lshift = $lnuh->fetchrow_hashref()) {
|
| 38 |
- |
136 |
print "<tr><td>$lshift->{location}</td><td> </td><td>$lshift->{time}</td><td> </td><td>$lshift->{derby_name}</td></tr>\n";
|
| 8 |
- |
137 |
}
|
|
|
138 |
print "</table>\n";
|
|
|
139 |
print "<br><br>\n";
|
|
|
140 |
|
|
|
141 |
my %crew;
|
|
|
142 |
my $g;
|
|
|
143 |
my $c = 1;
|
|
|
144 |
$nuh->execute($date, $track);
|
|
|
145 |
while (my $tg = $nuh->fetchrow_hashref()) {
|
|
|
146 |
if ($c) {
|
|
|
147 |
$g = $tg;
|
|
|
148 |
$c=0;
|
|
|
149 |
}
|
|
|
150 |
if ($tg->{derby_name}) {
|
|
|
151 |
$tg->{derby_name} .= " <A HREF='#' onClick=\"window.open('make_shift_change.pl?change=del&RCid=$tg->{RCid}&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[DROP]</a>";
|
|
|
152 |
$tg->{derby_name} .= " | <A HREF='#' onClick=\"if (confirm('Really? They were a no show?')==true) { window.open('make_shift_change.pl?noshow=true&change=del&RCid=$tg->{RCid}&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }\">[NO SHOW]</a>";
|
|
|
153 |
} else {
|
|
|
154 |
$tg->{derby_name} = "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=lookup&RCid=$tg->RCid&id=$tg->{id}&role=$tg->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[ADD USER]</a>";
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
$crew{$tg->{role}} = $tg->{derby_name};
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
$g->{gtype} = join '', map { ucfirst lc } split /(\s+)/, $g->{gtype}; # Capitalize the game type to look nicer
|
|
|
161 |
|
|
|
162 |
my $P1 = "PLT-1";
|
|
|
163 |
my $P2 = "PLT-2";
|
|
|
164 |
my $PH = "PLT";
|
|
|
165 |
if ($g->{gtype} eq "Full Length" or $g->{gtype} eq "Selected Staffing") {
|
|
|
166 |
$P1 = 'PLT/H';
|
|
|
167 |
$P2 = 'PLT';
|
|
|
168 |
$PH = $P1;
|
|
|
169 |
}
|
|
|
170 |
my $A = '';
|
|
|
171 |
if (defined $crew{'ALT'}) {
|
|
|
172 |
$A = "ALT:";
|
|
|
173 |
} else {
|
|
|
174 |
$crew{'ALT'} = '';
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
if ($g->{teams}) {
|
|
|
178 |
print<<game;
|
|
|
179 |
<table>
|
|
|
180 |
<tr><td>Date:</td><td>$day ($date)</td><td> </td><td>Track:</td><td>$g->{track}</td></tr>
|
|
|
181 |
<tr><td>Time:</td><td>$g->{time}</td><td> </td><td>Class:</td><td>$class{$g->{restrictions}} $g->{level} $g->{gtype}</td></tr>
|
|
|
182 |
<tr><td>Game:</td><td colspan=4>$g->{teams}</td></tr>
|
|
|
183 |
<tr><td colspan=5> </td></tr>
|
|
|
184 |
<tr><td>HR:</td><td>$crew{'HR'}</td><td> </td><td>$PH:</td><td>$crew{$P1}</td></tr>
|
|
|
185 |
<tr><td>IPR:</td><td>$crew{'IPR'}</td><td> </td><td>PLT:</td><td>$crew{$P2}</td></tr>
|
|
|
186 |
<tr><td>JR:</td><td>$crew{'JR-1'}</td><td> </td><td>SK:</td><td>$crew{'SK-1'}</td></tr>
|
|
|
187 |
<tr><td>JR:</td><td>$crew{'JR-2'}</td><td> </td><td>SK:</td><td>$crew{'SK-2'}</td></tr>
|
|
|
188 |
<tr><td>OPR:</td><td>$crew{'OPR-1'}</td><td> </td><td>PBM:</td><td>$crew{'PBM'}</td></tr>
|
|
|
189 |
<tr><td>OPR:</td><td>$crew{'OPR-2'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-1'}</td></tr>
|
|
|
190 |
<tr><td>OPR:</td><td>$crew{'OPR-3'}</td><td> </td><td>PBT:</td><td>$crew{'PBT-2'}</td></tr>
|
|
|
191 |
<tr><td>$A</td><td>$crew{'ALT'}</td><td> </td><td>JT:</td><td>$crew{'JT'}</td></tr>
|
|
|
192 |
<tr><td> </td><td> </td><td> </td><td>SO:</td><td>$crew{'SO'}</td></tr>
|
|
|
193 |
</table><br>
|
|
|
194 |
game
|
|
|
195 |
} else {
|
|
|
196 |
print "<table>\n<tr><td colspan=5>There don't seem to be any more games on this track today.</td></tr></table><br>\n";
|
|
|
197 |
}
|
|
|
198 |
|
|
|
199 |
print "<table>\n<tr><td colspan=5><a href='/schedule/'>[ go home ]</td></tr></table><br>\n";
|
|
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
print<<tail;
|
|
|
204 |
</BODY>
|
|
|
205 |
</HTML>
|
|
|
206 |
tail
|