| 2 |
- |
1 |
#!/usr/bin/perl
|
|
|
2 |
|
|
|
3 |
######################################
|
|
|
4 |
#
|
|
|
5 |
#
|
|
|
6 |
# $Log: req.pl,v $
|
|
|
7 |
#
|
|
|
8 |
######################################
|
|
|
9 |
|
|
|
10 |
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
|
|
|
11 |
|
|
|
12 |
use CGI qw/:standard/;
|
|
|
13 |
use lib "/home/rollerco/perl5/lib/perl5";
|
|
|
14 |
use scanFunctions;
|
|
|
15 |
use RollerCon;
|
|
|
16 |
use Spreadsheet::WriteExcel;
|
|
|
17 |
use DateTime;
|
|
|
18 |
use DateTime::Duration;
|
|
|
19 |
|
|
|
20 |
my $cookie_string = authenticate(1) || die;
|
|
|
21 |
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
|
|
22 |
my $username = $ORCUSER->{derby_name};
|
|
|
23 |
my $RCid = $ORCUSER->{RCid};
|
|
|
24 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
|
|
25 |
my $YEAR = 1900 + (localtime)[5]; #which year of data to display, default to current
|
|
|
26 |
|
|
|
27 |
our $DBTABLE = 'v_shift_admin_view';
|
|
|
28 |
our %NAME = qw(
|
|
|
29 |
id ID
|
|
|
30 |
teams Teams
|
|
|
31 |
date Date
|
|
|
32 |
dayofweek Day
|
|
|
33 |
time Time
|
|
|
34 |
track Track
|
|
|
35 |
level Level
|
|
|
36 |
restrictions Rs
|
|
|
37 |
gtype Type
|
|
|
38 |
notes Notes
|
|
|
39 |
role Role
|
|
|
40 |
tla TLA
|
|
|
41 |
name Position
|
|
|
42 |
type Class
|
|
|
43 |
RCid RCid
|
|
|
44 |
derby_name Assignee
|
|
|
45 |
);
|
|
|
46 |
our %colOrderHash = qw(id 1 track 2 date 3 dayofweek 4 time 5 teams 6 level 7 restrictions 8 gtype 9 notes 10 role 11 tla 12 name 13 type 14 RCid 15 derby_name 16);
|
|
|
47 |
my $orderby = "date, track, time, gtype, type, tla, derby_name";
|
|
|
48 |
our @allFields = sort { $colOrderHash{$a} <=> $colOrderHash{$b} } keys %NAME;
|
|
|
49 |
our @defaultFields = (qw(date time track teams level gtype tla type derby_name));
|
|
|
50 |
our @displayFields = ();
|
|
|
51 |
our @hideFields = ();
|
|
|
52 |
our %colFilterTypeHash = qw(
|
|
|
53 |
id number
|
|
|
54 |
teams text
|
|
|
55 |
date date
|
|
|
56 |
dayofweek select
|
|
|
57 |
time text
|
|
|
58 |
track select
|
|
|
59 |
level select
|
|
|
60 |
restrictions select
|
|
|
61 |
gtype select
|
|
|
62 |
notes text
|
|
|
63 |
role select
|
|
|
64 |
tla select
|
|
|
65 |
name text
|
|
|
66 |
type select
|
|
|
67 |
RCid number
|
|
|
68 |
derby_name select
|
|
|
69 |
);
|
|
|
70 |
|
|
|
71 |
if ($LVL > 1) {
|
|
|
72 |
# Add:
|
|
|
73 |
# real_name RealName
|
|
|
74 |
# email Email
|
|
|
75 |
|
|
|
76 |
$NAME{'real_name'} = "RealName";
|
|
|
77 |
$NAME{'email'} = "EMail";
|
|
|
78 |
$colOrderHash{'real_name'} = 17;
|
|
|
79 |
$colOrderHash{'email'} = 18;
|
|
|
80 |
push @allFields, qw(real_name email);
|
|
|
81 |
$colFilterTypeHash{'real_name'} = 'text';
|
|
|
82 |
$colFilterTypeHash{'email'} = 'text';
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
foreach (param())
|
|
|
87 |
{
|
|
|
88 |
if (/^year$/) { #
|
|
|
89 |
$YEAR = param($_);
|
|
|
90 |
next;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
$FORM{$_} = param($_); # Retrieve all of the FORM data submitted
|
|
|
94 |
|
|
|
95 |
if ((/^filter/) and ($FORM{$_} ne '')) # Build a set of filters to apply
|
|
|
96 |
{
|
|
|
97 |
my ($filter,$field) = split /-/, $_;
|
|
|
98 |
|
|
|
99 |
$FILTER->{$field} = $FORM{$_};
|
|
|
100 |
}
|
|
|
101 |
elsif ($FORM{$_} eq "true") { # Compile list of fields to display
|
|
|
102 |
if ($_ ne "shiftinclude") {
|
|
|
103 |
push @displayFields, $_;
|
|
|
104 |
}
|
|
|
105 |
} # @displayFields is declared in scanFunctions.pm
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
if (exists $FORM{autoload}) # If the FORM was submitted (i.e. the page is being redisplayed),
|
|
|
110 |
{ # build the data for the cookie that remembers the page setup
|
|
|
111 |
my $disFields = join ":", @displayFields;
|
|
|
112 |
my @filters;
|
|
|
113 |
my @f = keys %{$FILTER};
|
|
|
114 |
foreach $key (@f)
|
|
|
115 |
{ push @filters, "$key=$FILTER->{$key}"; }
|
|
|
116 |
my $fils = join ":", @filters;
|
|
|
117 |
|
|
|
118 |
$QUERY_STRING = "$disFields\&$fils\&$FORM{autoload}&$FORM{shiftinclude}";
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
if (!(exists $FORM{autoload})) # No FORM was submitted, suppply a default list of columns
|
|
|
123 |
{
|
|
|
124 |
if (my $prefs = cookie('RCSHIFTS')) # Has this user been here before and saved a cookie?
|
|
|
125 |
{
|
|
|
126 |
my ($disF, $filts, $al, $si) = split /&/,$prefs;
|
|
|
127 |
@displayFields = split /:/,$disF;
|
|
|
128 |
|
|
|
129 |
foreach $pair (split /:/, $filts)
|
|
|
130 |
{
|
|
|
131 |
my ($key, $value) = split /=/, $pair;
|
|
|
132 |
$FORM{"filter-$key"} = $value;
|
|
|
133 |
$FILTER->{$key} = $value;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
$FORM{autoload} = $al;
|
|
|
137 |
$FORM{shiftinclude} = $si;
|
|
|
138 |
$QUERY_STRING = $prefs;
|
|
|
139 |
}
|
|
|
140 |
else
|
|
|
141 |
{ @displayFields = @defaultFields; }
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
# Build the field lists to display and hide columns.
|
|
|
146 |
# If the field isn't in the displayFields list,
|
|
|
147 |
# then add it to the hideFields list.
|
|
|
148 |
#
|
|
|
149 |
@displayFields = sort byfield @displayFields;
|
|
|
150 |
foreach $field (@allFields) { if (! &inArray($field, \@displayFields)) { push @hideFields, $field; } }
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
my @whereClause = ("year(date) = '$YEAR'"); # Process the filters to build the components of the where clause
|
|
|
154 |
foreach $field (@allFields)
|
|
|
155 |
{
|
|
|
156 |
if (! &inArray($field, \@hideFields))
|
|
|
157 |
{
|
|
|
158 |
if ($FILTER->{$field})
|
|
|
159 |
{
|
|
|
160 |
push @whereClause, &generica($field, $FILTER->{$field});
|
|
|
161 |
delete $FILTER->{$field};
|
|
|
162 |
}
|
|
|
163 |
}
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
# Given the fields to display and the where conditions,
|
|
|
167 |
# "getData" will return a reference to an array of
|
|
|
168 |
# hash references of the results.
|
|
|
169 |
my @ProductList = @{&getData(\@displayFields, \@whereClause, $DBTABLE, $orderby)};
|
|
|
170 |
my $x = scalar @ProductList;
|
|
|
171 |
|
|
|
172 |
my @shifts;
|
|
|
173 |
if ($FORM{shiftinclude} eq "true") {
|
|
|
174 |
my @SIWhere = ("year(date) = '$YEAR'");
|
|
|
175 |
push @SIWhere, "RCid = $ORCUSER->{RCid}";
|
|
|
176 |
@shifts = @{&getData(\@displayFields, \@SIWhere, $DBTABLE, $orderby)};
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
if ($FORM{excel})
|
|
|
181 |
{
|
|
|
182 |
my $date = `date +"%m%d%y%H%M%S"`; chomp $date;
|
|
|
183 |
# $filename = `dirname $ENV{REQUEST_URI}`; chomp $filename; $filename .= "/schedule/xls/${date}_$$.xls";
|
|
|
184 |
$filename = "/schedule/xls/${date}_$$.xls";
|
|
|
185 |
|
|
|
186 |
# Create a new Excel workbook
|
|
|
187 |
# my $workbook = Spreadsheet::WriteExcel->new("/var/www/html${filename}");
|
|
|
188 |
my $workbook = Spreadsheet::WriteExcel->new("/home/rollerco/officials.rollercon.com${filename}");
|
|
|
189 |
|
|
|
190 |
# Add a worksheet
|
|
|
191 |
my $worksheet = $workbook->add_worksheet();
|
|
|
192 |
|
|
|
193 |
# open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
|
|
|
194 |
# my $workbook = Spreadsheet::WriteExcel->new($fh);
|
|
|
195 |
# my $worksheet = $workbook->add_worksheet();
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
my $format = $workbook->add_format();
|
|
|
199 |
$format->set_bold();
|
|
|
200 |
|
|
|
201 |
my $col = $row = 0;
|
|
|
202 |
|
|
|
203 |
foreach $f (@displayFields)
|
|
|
204 |
{ $worksheet->write($row, $col++, "$NAME{$f}", $format); }
|
|
|
205 |
|
|
|
206 |
foreach $t (sort @ProductList) # Unt now we print the tickets!
|
|
|
207 |
{
|
|
|
208 |
$col = 0;
|
|
|
209 |
$row++;
|
|
|
210 |
foreach $f (@displayFields)
|
|
|
211 |
{
|
|
|
212 |
$f =~ s/^HOST\.//;
|
|
|
213 |
$f =~ s/^FRAME\.//;
|
|
|
214 |
$t->{$f} =~ s/<br>/\n/ig; $worksheet->write($row, $col++, "$t->{$f}");
|
|
|
215 |
}
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
$workbook->close();
|
|
|
219 |
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
my $path = `dirname $ENV{REQUEST_URI}`; chomp $path; $path .= '/';
|
|
|
225 |
my $queryCookie = cookie(-NAME=>'RCSHIFTS',
|
|
|
226 |
-VALUE=>"$QUERY_STRING",
|
|
|
227 |
-PATH=>"$path",
|
|
|
228 |
-EXPIRES=>'+365d');
|
|
|
229 |
#my $Auth_Cook = cookie(-NAME=>'RequestToolAuthorized',
|
|
|
230 |
# -VALUE=>"$authCookie",
|
|
|
231 |
# -PATH=>'/cbrt/cgi-bin/');
|
|
|
232 |
|
|
|
233 |
print header(-cookie=>[$RCAUTH_cookie,$queryCookie]);
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
print "<!-- FORM \n\n"; # Debug code to dump the FORM to a html comment
|
|
|
237 |
print "I'm catching updates!!!\n\n";
|
|
|
238 |
foreach $key (sort (keys %FORM)) # Must be done after the header is written!
|
|
|
239 |
{ print "\t$key: $FORM{$key}\n"; }
|
|
|
240 |
print "--> \n\n";
|
|
|
241 |
#
|
|
|
242 |
#
|
|
|
243 |
# print "<!-- ENV \n\n"; # Debug code to dump the ENV to a html comment
|
|
|
244 |
# foreach $key (sort (keys %ENV)) # Must be done after the header is written!
|
|
|
245 |
# { print "\t$key: $ENV{$key}\n"; }
|
|
|
246 |
# print "--> \n\n";
|
|
|
247 |
#
|
|
|
248 |
# print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
#------------------
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
if ($FORM{autoload}) # Toggle the autoload fields within the table elements
|
|
|
255 |
{ $auto = "onClick='submit();'";
|
|
|
256 |
$auto2 = "onChange='submit();'"; }
|
|
|
257 |
else
|
|
|
258 |
{ $auto = "";
|
|
|
259 |
$auto2 = ""; }
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
my $signedOnAs = $username ? "You are currently signed in as $username. <font size=-2><a href='index.pl' onClick=\"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;\">[Log Out]</a></font>" : "You are not signed in.";
|
|
|
263 |
my $xlsLink = $filename ? " <A href='$filename'><FONT color='#0077BD'>Download Now.</FONT></a>" : "";
|
|
|
264 |
my $yearoptions;
|
|
|
265 |
foreach (@{&getYears()}) {
|
|
|
266 |
$yearoptions .= $YEAR eq $_ ? "<option selected>$_</option>" : "<option>$_</option>";
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
print<<header;
|
|
|
270 |
<html><head><title>RollerCon Officials Schedule Manager - $YEAR Game Assignments</title></head>
|
|
|
271 |
<body text="#000000" bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#FF0000">
|
|
|
272 |
<form action="$ENV{SCRIPT_NAME}" method=POST name=Req>
|
|
|
273 |
<input type=hidden name=excel value=0>
|
|
|
274 |
|
|
|
275 |
<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
|
|
|
276 |
<TR>
|
|
|
277 |
<TD>
|
|
|
278 |
<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
|
|
|
279 |
<TR>
|
|
|
280 |
<TD width=680 bgcolor="#0077BD" height=60><FONT color=white face=verdana size=6><i><strong> RollerCon Game Assignments - $YEAR</strong></i></font></TD>
|
|
|
281 |
<TD><img SRC="/images/headerblank.gif" NOSAVE height=38 width=165></TD>
|
|
|
282 |
</TR>
|
|
|
283 |
</TABLE>
|
|
|
284 |
</TD>
|
|
|
285 |
<TR>
|
|
|
286 |
<TD> </TD>
|
|
|
287 |
</TR>
|
|
|
288 |
<TR>
|
|
|
289 |
<TD>
|
|
|
290 |
<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
|
|
|
291 |
<TR>
|
|
|
292 |
<TD rowspan=2 align=left width=610>
|
|
|
293 |
<TABLE border=0 cellspacing=0>
|
|
|
294 |
header
|
|
|
295 |
|
|
|
296 |
# Print the Hidden fields' check boxes
|
|
|
297 |
|
|
|
298 |
my $tc = 1;
|
|
|
299 |
foreach $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields)
|
|
|
300 |
{
|
|
|
301 |
if ($tc == 1)
|
|
|
302 |
{print "\t\t\t\t\t\t<TR>\n\t\t\t\t\t\t\t<TD width=25% nowrap><FONT face=verdana size=1><b><INPUT type=checkbox name=$field value=true $auto>$NAME{$field}</TD>\n"; $tc++;}
|
|
|
303 |
elsif ($tc == 4)
|
|
|
304 |
{print "\t\t\t\t\t\t\t<TD width=25% nowrap><FONT face=verdana size=1><b><INPUT type=checkbox name=$field value=true $auto>$NAME{$field}</TD>\n\t\t\t\t\t\t</TR>\n"; $tc=1;}
|
|
|
305 |
else
|
|
|
306 |
{print "\t\t\t\t\t\t\t<TD width=25% nowrap><FONT face=verdana size=1><b><INPUT type=checkbox name=$field value=true $auto>$NAME{$field}</TD>\n"; $tc++;}
|
|
|
307 |
}
|
|
|
308 |
|
|
|
309 |
if ($FORM{autoload})
|
|
|
310 |
{
|
|
|
311 |
$trueChecked = "checked";
|
|
|
312 |
$falseChecked = "";
|
|
|
313 |
}
|
|
|
314 |
else
|
|
|
315 |
{
|
|
|
316 |
$trueChecked = "";
|
|
|
317 |
$falseChecked = "checked";
|
|
|
318 |
}
|
|
|
319 |
my $SIChecked="";
|
|
|
320 |
if ($FORM{shiftinclude}) { $SIChecked = "checked"; }
|
|
|
321 |
|
|
|
322 |
print<<header3;
|
|
|
323 |
<TR>
|
|
|
324 |
<TD colspan=2 align=left><FONT face=verdana size=1 color=#0077BD><B>
|
|
|
325 |
Autoload: <INPUT type=radio name=autoload value=1 onClick='Req.submit();' $trueChecked>On <INPUT type=radio name=autoload value=0 onClick='Req.submit();' $falseChecked>Off
|
|
|
326 |
</TD>
|
|
|
327 |
<TD colspan=2 align=right><FONT face=verdana size=1 color=#0077BD><B>
|
|
|
328 |
Show my shifts: <input type=checkbox name=shiftinclude value=true $SIChecked $auto>
|
|
|
329 |
</TD>
|
|
|
330 |
</TR>
|
|
|
331 |
</TABLE>
|
|
|
332 |
</TD>
|
|
|
333 |
<TD nowrap>
|
|
|
334 |
<A HREF='' onClick="window.document.Req.submit(); return false;"><IMG SRC='/images/refresh.button.gif' border=0></A><br>
|
|
|
335 |
<strong><a href='' onClick="window.document.Req.excel.value=1; window.document.Req.submit(); return false;"><FONT face=verdana size=1>Export Displayed Data as Excel Document.</a>$xlsLink</font>
|
|
|
336 |
</TD>
|
|
|
337 |
</TR>
|
|
|
338 |
<TR>
|
|
|
339 |
<TD align=left><B><FONT face=verdana size=1>$signedOnAs<br>
|
|
|
340 |
Display <A HREF='' onClick="window.document.Req.method = 'GET'; window.document.Req.submit(); return false;">Full URL</a> : <select name=year onchange='Req.submit();'>$yearoptions</select> : <a href=/schedule/>[Go HOME]</a></TD>
|
|
|
341 |
</TR>
|
|
|
342 |
|
|
|
343 |
</TABLE>
|
|
|
344 |
</TD>
|
|
|
345 |
</TR>
|
|
|
346 |
<TR>
|
|
|
347 |
<TD> </TD>
|
|
|
348 |
</TR>
|
|
|
349 |
<TR>
|
|
|
350 |
<TD>
|
|
|
351 |
<TABLE border=0 cellspacing=2 cellpadding=4 width=100\%>
|
|
|
352 |
<TR bgcolor=#0077BD>
|
|
|
353 |
header3
|
|
|
354 |
|
|
|
355 |
# Print the Column headings
|
|
|
356 |
foreach $f (@displayFields)
|
|
|
357 |
{ print "\t\t\t\t\t<TD align=left nowrap><FONT face=verdana color=white size=1><B><INPUT type=checkbox name=$f value=true checked $auto>$NAME{$f}</TD>\n"; }
|
|
|
358 |
|
|
|
359 |
print "\t\t\t\t</TR>\n\t\t\t\t<TR>\n";
|
|
|
360 |
# and now the filter boxes
|
|
|
361 |
|
|
|
362 |
foreach $f (@displayFields)
|
|
|
363 |
{
|
|
|
364 |
print "\t\t\t\t\t<TD align=left bgcolor=#E6E6E6><FONT size=1 face=verdana>";
|
|
|
365 |
print &generica($f);
|
|
|
366 |
# print " ";
|
|
|
367 |
print "</TD>\n";
|
|
|
368 |
}
|
|
|
369 |
print "\t\t\t\t</TR></FORM>\n";
|
|
|
370 |
|
|
|
371 |
my $cw = scalar @displayFields;
|
|
|
372 |
|
|
|
373 |
print<<header2;
|
|
|
374 |
</TR>
|
|
|
375 |
header2
|
|
|
376 |
|
|
|
377 |
my $co = '#FFFFFF';
|
|
|
378 |
my $now = DateTime->now;
|
|
|
379 |
$now->set_time_zone('America/Los_Angeles');
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
if ($SIChecked) {
|
|
|
383 |
print "<TR style='border:solid 1px #555'>";
|
|
|
384 |
|
|
|
385 |
foreach my $t (@shifts) # Unt now we print the tickets!
|
|
|
386 |
{
|
|
|
387 |
my ($yyyy, $mm, $dd) = split /\-/, $t->{date};
|
|
|
388 |
my $cutoff = DateTime->new(
|
|
|
389 |
year => $yyyy,
|
|
|
390 |
month => $mm,
|
|
|
391 |
day => $dd,
|
|
|
392 |
hour => 5,
|
|
|
393 |
minute => 0,
|
|
|
394 |
second => 0,
|
|
|
395 |
time_zone => 'America/Los_Angeles'
|
|
|
396 |
);
|
|
|
397 |
|
|
|
398 |
if (($t->{RCid} == $RCid and $t->{gtype} ne "selected staffing" and $now < $cutoff) or ($LVL >= 2 and $t->{derby_name})) {
|
|
|
399 |
# DROP
|
|
|
400 |
$t->{derby_name} = "$t->{derby_name} <A HREF='#' onClick=\"window.open('make_shift_change.pl?change=del&RCid=$t->{RCid}&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[DROP]</a>";
|
|
|
401 |
if ($LVL >= 2) {
|
|
|
402 |
$t->{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=$t->{RCid}&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }\">[NO SHOW]</a>";
|
|
|
403 |
}
|
|
|
404 |
} elsif (!$t->{derby_name}) {
|
|
|
405 |
if (signUpEligible($ORCUSER, $t) and $now < $cutoff) {
|
|
|
406 |
# SIGN UP
|
|
|
407 |
$t->{derby_name} = "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=add&RCid=$RCid&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[SIGN UP]</a>";
|
|
|
408 |
}
|
|
|
409 |
if ($LVL >= 2) {
|
|
|
410 |
# ADD USER
|
|
|
411 |
$t->{derby_name} ? $t->{derby_name} .= " | " : {};
|
|
|
412 |
$t->{derby_name} .= "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=lookup&RCid=$RCid&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[ADD USER]</a>";
|
|
|
413 |
}
|
|
|
414 |
}
|
|
|
415 |
|
|
|
416 |
print "\t\t\t\t<TR>\n";
|
|
|
417 |
foreach $f (@displayFields)
|
|
|
418 |
{
|
|
|
419 |
print "\t\t\t\t\t<TD align=left valign=top bgcolor='#ffff99'><FONT face=verdana size=1>".$t->{$f}." </TD>\n";
|
|
|
420 |
}
|
|
|
421 |
print "\t\t\t\t</TR>\n";
|
|
|
422 |
}
|
|
|
423 |
print "</tr><TR><td colspan=$cw><hr></td></tr>";
|
|
|
424 |
}
|
|
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
foreach $t (@ProductList) # Unt now we print the tickets!
|
|
|
429 |
{
|
|
|
430 |
my ($yyyy, $mm, $dd) = split /\-/, $t->{date};
|
|
|
431 |
my $cutoff = DateTime->new(
|
|
|
432 |
year => $yyyy,
|
|
|
433 |
month => $mm,
|
|
|
434 |
day => $dd,
|
|
|
435 |
hour => 5,
|
|
|
436 |
minute => 0,
|
|
|
437 |
second => 0,
|
|
|
438 |
time_zone => 'America/Los_Angeles'
|
|
|
439 |
);
|
|
|
440 |
|
|
|
441 |
if (($t->{RCid} == $RCid and $t->{gtype} ne "selected staffing" and $now < $cutoff) or ($LVL >= 2 and $t->{derby_name})) {
|
|
|
442 |
# DROP
|
|
|
443 |
$t->{derby_name} = "$t->{derby_name} <A HREF='#' onClick=\"window.open('make_shift_change.pl?change=del&RCid=$t->{RCid}&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[DROP]</a>";
|
|
|
444 |
if ($LVL >= 2) {
|
|
|
445 |
$t->{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=$t->{RCid}&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false; }\">[NO SHOW]</a>";
|
|
|
446 |
}
|
|
|
447 |
} elsif (!$t->{derby_name}) {
|
|
|
448 |
if (signUpEligible($ORCUSER, $t) and $now < $cutoff) {
|
|
|
449 |
# SIGN UP
|
|
|
450 |
$t->{derby_name} = "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=add&RCid=$RCid&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[SIGN UP]</a>";
|
|
|
451 |
} # else { $t->{derby_name} = signUpEligible($ORCUSER, $t); }
|
|
|
452 |
if ($LVL >= 2) {
|
|
|
453 |
# ADD USER
|
|
|
454 |
$t->{derby_name} ? $t->{derby_name} .= " | " : {};
|
|
|
455 |
$t->{derby_name} .= "<A HREF='#' onClick=\"window.open('make_shift_change.pl?change=lookup&RCid=$RCid&id=$t->{id}&role=$t->{role}','Confirm Shift Change','resizable,height=260,width=370'); return false;\">[ADD USER]</a>";
|
|
|
456 |
}
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
print "\t\t\t\t<TR>\n";
|
|
|
460 |
foreach $f (@displayFields)
|
|
|
461 |
{
|
|
|
462 |
if ($t->{RCid} eq $ORCUSER->{RCid}) {
|
|
|
463 |
print "\t\t\t\t\t<TD align=left valign=top bgcolor='#ffff99'><FONT face=verdana size=1>".$t->{$f}." </TD>\n";
|
|
|
464 |
} else {
|
|
|
465 |
print "\t\t\t\t\t<TD align=left valign=top bgcolor='$co'><FONT face=verdana size=1>".$t->{$f}." </TD>\n";
|
|
|
466 |
}
|
|
|
467 |
}
|
|
|
468 |
print "\t\t\t\t</TR>\n";
|
|
|
469 |
|
|
|
470 |
if ($co eq '#FFFFFF')
|
|
|
471 |
{ $co = '#F9F9F9'; }
|
|
|
472 |
else
|
|
|
473 |
{ $co = '#FFFFFF'; }
|
|
|
474 |
|
|
|
475 |
}
|
|
|
476 |
|
|
|
477 |
print<<tail;
|
|
|
478 |
</TABLE>
|
|
|
479 |
</TD>
|
|
|
480 |
</TR>
|
|
|
481 |
</TABLE>
|
|
|
482 |
<br><br>
|
|
|
483 |
<FONT face=verdana size=2><B>$x Record(s) Displayed</font>
|
|
|
484 |
<BR><BR>
|
|
|
485 |
<FONT face=verdana size=1><B>This page was displayed on $now<BR>
|
|
|
486 |
Please direct questions, problems, and concerns to <FONT face=verdana color=#0077BD>officials.rollercon.schedule\@gmail.com</FONT>
|
|
|
487 |
|
|
|
488 |
<SCRIPT language="JavaScript">
|
|
|
489 |
<!--
|
|
|
490 |
|
|
|
491 |
var ticket_window, severity_window, user_window;
|
|
|
492 |
|
|
|
493 |
function NewWindow () {
|
|
|
494 |
if ((ticket_window == null) || (ticket_window.closed == true))
|
|
|
495 |
ticket_window = open(\"\",\"Details\",\"width=650,height=650,menubar,scrollbars,resizable\");
|
|
|
496 |
ticket_window.focus();
|
|
|
497 |
return true;
|
|
|
498 |
}
|
|
|
499 |
|
|
|
500 |
function SevWindow () {
|
|
|
501 |
if ((severity_window == null) || (severity_window.closed == true))
|
|
|
502 |
severity_window = open(\"\",\"SevDetails\",\"width=500,height=300,menubar\");
|
|
|
503 |
severity_window.focus();
|
|
|
504 |
return true;
|
|
|
505 |
}
|
|
|
506 |
|
|
|
507 |
function UserWindow () {
|
|
|
508 |
if ((user_window == null) || (user_window.closed == true))
|
|
|
509 |
user_window = open(\"\",\"UserDetails\",\"width=310,height=115,menubar\");
|
|
|
510 |
user_window.focus();
|
|
|
511 |
return true;
|
|
|
512 |
}
|
|
|
513 |
|
|
|
514 |
//-->
|
|
|
515 |
</SCRIPT>
|
|
|
516 |
|
|
|
517 |
</body></html>
|
|
|
518 |
tail
|
|
|
519 |
|