Subversion Repositories VORC

Rev

Rev 50 | Rev 56 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/usr/bin/perl
2
 
3
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
4
 
7 - 5
#use strict;
8 - 6
use cPanelUserConfig;
7 - 7
use CGI qw/param cookie header start_html url/;
8
use HTML::Tiny;
9
use tableViewer;
2 - 10
use RollerCon;
11
use DateTime;
12
use DateTime::Duration;
25 - 13
my $now = DateTime->now (time_zone => 'America/Los_Angeles');
7 - 14
our $h = HTML::Tiny->new( mode => 'html' );
2 - 15
 
7 - 16
my $cookie_string = authenticate (1) || die;
17
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
18
my $user = getUser ($EML);
19
$user->{department} = convertDepartments $user->{department};
20
my $username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
21
my $RCid = $user->{RCid};
2 - 22
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
53 bgadell 23
my $YEAR = 1900 + (localtime)[5];
2 - 24
 
29 - 25
if (!scalar (grep { $user->{department}->{$_} > 0 } grep { !/^(ANN|OFF)$/ } keys %{$user->{department}}) and
26
    $user->{department}->{ANN} < 2 and
27
    $user->{department}->{OFF} < 2 and
28
    $LVL < 4) {
7 - 29
	print header(-cookie=>$RCAUTH_cookie);
30
	printRCHeader("Unauthorized Page");
31
	print $h->div ({ class=>"error" }, "No Access");
32
	print $h->div ("Your user account is not registered as a Volunteer in a department that uses this view, so you can't see these shifts.  It's possible that your access is still being reviewed.  Please be patient.");
8 - 33
	print $h->a ({ href=>"/schedule/" }, "[Go Home]");
7 - 34
	print $h->close ("html");
35
	exit;
36
}
2 - 37
 
38
 
7 - 39
my $pageTitle = "Volunteer Shifts";
40
my $prefscookie = "vorcshifts";
41
our $DBTABLE = 'v_shift';
42
my %COLUMNS = (
43
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
44
	id          => [qw(ShiftID        5    number       )],
45
	dept        => [qw(Department    10    select      default )],
35 - 46
	role        => [qw(Role          15    text      default )],
7 - 47
	type        => [qw(Type          20    select      default )],
48
	date        => [qw(Date          25    date        default )],
16 - 49
  dayofweek   => [qw(Day           27    select              )],
7 - 50
	location    => [qw(Location      30    select      default )],
51
	time        => [qw(Time          35    text        default )],
52
	start_time  => [qw(Start         36    text         )],
53
	end_time    => [qw(End           40    text         )],
54
	mod_time    => [qw(ModTime       45    number         )],
29 - 55
	doubletime  => [qw(DoubleTime    47    boolean         )],
7 - 56
	volhours    => [qw(VolHours      50    number         )],
57
	note        => [qw(Notes         55    text        default )],
58
	RCid        => [qw(AssigneeID    60    text         )],
59
	derby_name  => [qw(DerbyName     65    select      default   )],
60
);
61
my $stylesheet = "/style.css";
8 - 62
my $homeURL = '/schedule/';
7 - 63
my @pagelimitoptions = ("All", 5, 10, 25);
64
 
65
my @whereClause;
35 - 66
if ($LVL <= 3 and $user->{department}->{VCI} < 2) {
29 - 67
  my $string = "dept in (".join ",", map { '"'.$_.'"' } grep { $ORCUSER->{department}->{$_} > 0 } keys %{$ORCUSER->{department}};
7 - 68
  $string .= ")";
29 - 69
#   warn $string;
7 - 70
  push @whereClause, $string;
2 - 71
}
7 - 72
push @whereClause, "(dept != 'PER' or RCid = $RCid)";
2 - 73
 
74
 
7 - 75
# If we need to modify line item values, create a subroutine named "modify_$columnname"
76
#    It will receive a hashref to the object lineitem
77
 
29 - 78
sub modify_doubletime {
79
  my $thing = shift;
80
  return $thing->{doubletime} ? "True" : "False";
81
}
82
 
7 - 83
sub modify_derby_name {
84
  my $t = shift;
85
 
86
  if ($user->{department}->{$t->{dept}} < 2 and $t->{derby_name} and $t->{RCid} != $RCid and $LVL < 5) {
87
    $t->{derby_name} = "FILLED";
39 - 88
  } elsif (($user->{department}->{$t->{dept}} > 1  or $LVL > 4) and $t->{derby_name}) {
89
    $t->{derby_name} = $h->a ({ href=>"/schedule/manage_user.pl?RCid=$t->{RCid}" }, $t->{derby_name});
7 - 90
  }
91
 
92
 	my ($yyyy, $mm, $dd) = split /\-/, $t->{date};
93
	my $cutoff = DateTime->new(
94
        year => $yyyy,
95
        month => $mm,
96
        day => $dd,
97
        hour => 5,
98
        minute => 0,
99
        second => 0,
100
        time_zone => 'America/Los_Angeles'
101
  );
102
 
35 - 103
 	if (($t->{RCid} == $RCid and $t->{type} ne "selected" and $now < $cutoff) or ($t->{derby_name} and ($user->{department}->{$t->{dept}} >= 2 or $LVL >= 5 or $user->{department}->{VCI} >= 2))) {
7 - 104
 	  if ($t->{dept} eq "PER") {
105
 	    # DEL Personal Block
106
 	    $t->{derby_name} .= " ".$h->a ({ onClick=>"if (confirm('Really? You want to delete this personal time?')==true) { window.open('manage_personal_time.pl?choice=Delete&id=$s[0]','Confirm Change','resizable,height=260,width=370'); return false; }" }, "[DEL]");
107
 	  } else {
108
   		# DROP
109
 	    $t->{derby_name} .= " ".$h->a ({ onClick=>"if (confirm('Really? You want to drop this shift?')==true) { window.open('make_shift_change.pl?change=del&RCid=$t->{RCid}&id=$t->{id}','Confirm Change','resizable,height=260,width=370'); return false; }" }, "[DROP]");
35 - 110
   		if ($user->{department}->{$t->{dept}} >= 2 or $LVL >= 5 or $user->{department}->{VCI} >= 2) {
111
   		  # NO SHOW and MOD TIME
7 - 112
   		  $t->{derby_name} .= " | ".$h->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}','Confirm Shift Change','resizable,height=260,width=370'); return false; }" }, "[NO SHOW]");
113
   		  $t->{derby_name} .= " | ".$h->a ({ onClick=>"window.open('mod_shift_time.pl?RCid=$t->{RCid}&shiftid=$t->{id}','Mod Vol Hours','resizable,height=260,width=370');" }, "[MOD]");
114
   		}
115
 	  }
116
 	} elsif (!$t->{derby_name}) {
117
 		if (signUpEligible ($ORCUSER, $t, "vol") and $now < $cutoff) {
118
 			# SIGN UP
119
 			$t->{derby_name} = $h->a ({ onClick=>"window.open('make_shift_change.pl?change=add&RCid=$RCid&id=$t->{id}','Confirm Shift Change','resizable,height=260,width=370'); return false;" }, "[SIGN UP]");
120
 		}
35 - 121
 		if ($user->{department}->{$t->{dept}} >= 2 or $LVL > 4 or $user->{department}->{VCI} >= 2) {
7 - 122
 			# ADD USER
123
 			$t->{derby_name} ? $t->{derby_name} .= " | " : {};
124
 			$t->{derby_name} .= $h->a ({ onClick=>"window.open('make_shift_change.pl?change=lookup&RCid=$RCid&id=$t->{id}','Confirm Shift Change','resizable,height=260,width=370'); return false;" }, "[ADD USER]");
125
 		}
126
 	}
127
 	return $t->{derby_name};
128
}
129
 
130
my $DEPTS = getDepartments;
131
sub modify_dept {
132
  my $hr = shift;
133
  return $DEPTS->{$hr->{dept}};
134
}
135
 
136
sub filter_dept {
137
  my $colName = shift;
138
	my $filter = shift;
139
 
140
	if (defined $filter)	{
141
		if ($filter eq "-blank-") {
142
			return "($colName = '' or isNull($colName) = 1)";
143
		}
144
		return "$colName = \"$filter\"";
145
	}	else {
146
		my $thing = "filter-${colName}";
42 - 147
    my $categories = join "", map { $FORM{$thing} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $DEPTS->{$_}) : $h->option ({ value=>$_ }, $DEPTS->{$_}) } grep { $LVL > 4 or $user->{department}->{VCI} >= 2 or exists $user->{department}->{$_} } sort keys %{$DEPTS};
7 - 148
		my $Options = "<OPTION></OPTION>".$categories;
149
 
150
		$Options =~ s/>($FORM{$thing})/ selected>$1/;
151
		return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
152
	}
153
}
154
 
50 bgadell 155
sub modify_time {
156
  my $t = shift;
157
  return convertTime $t->{time};
158
}
7 - 159
 
50 bgadell 160
 
7 - 161
# Ideally, nothing below this comment needs to change
162
#-------------------------------------------------------------------------------
163
 
164
 
165
our %NAME              = map  { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
166
our %colOrderHash      = map  { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
167
our %colFilterTypeHash = map  { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
168
our @staticFields      = sort byfield grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
169
our @defaultFields     = sort byfield grep { defined $COLUMNS{$_}->[3] } keys %COLUMNS;
170
#our @defaultFields     = grep { $COLUMNS{$_}->[3] eq 'default' or inArray ($_, \@staticFields) } keys %COLUMNS;
171
 
172
our @allFields = sort byfield keys %NAME;
173
our @displayFields = ();
174
our @hideFields = ();
175
my $QUERY_STRING;
176
 
177
my $pagelimit = param ("limit") // $pagelimitoptions[$#pagelimitoptions];
178
my $curpage = param ("page") // 1;
179
 
180
our %FORM;
181
my $FILTER;
182
foreach (param()) {
183
 	if (/^year$/) { #
2 - 184
		$YEAR = param($_);
185
		next;
186
	}
7 - 187
 
2 - 188
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
189
 
7 - 190
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
191
		my ($filter,$field) = split /-/, $_;
2 - 192
		$FILTER->{$field} = $FORM{$_};
7 - 193
	}	elsif ($FORM{$_} eq "true")	{		# Compile list of fields to display
2 - 194
	  if ($_ ne "shiftinclude") {
195
		  push @displayFields, $_;
196
		}
7 - 197
	}
2 - 198
}
199
 
50 bgadell 200
my @addToWhereClause = ("year(date) = '$YEAR'", "type != 'announcer'");
2 - 201
 
7 - 202
if (exists $FORM{autoload})	{			# If the FORM was submitted (i.e. the page is being redisplayed),
203
							                    #  	build the data for the cookie that remembers the page setup
2 - 204
	my $disFields = join ":", @displayFields;
7 - 205
	my $fils = join ":", map { "$_=$FILTER->{$_}" } keys %{$FILTER};
2 - 206
 
7 - 207
	$QUERY_STRING = $disFields.'&'.$fils.'&'.$FORM{sortby}.'&'.$FORM{autoload}.'&'.$FORM{shiftinclude};
2 - 208
}
209
 
210
 
7 - 211
if (!(exists $FORM{autoload}))	{			# No FORM was submitted...
212
	if (my $prefs = cookie ($prefscookie) and !defined param ("ignoreCookie"))	{ # Check for cookies from previous visits.
50 bgadell 213
		my ($disF, $filts, $sb, $al, $si) = split /&/, $prefs;
2 - 214
		@displayFields = split /:/,$disF;
215
 
7 - 216
		foreach my $pair (split /:/, $filts)	{
2 - 217
			my ($key, $value) = split /=/, $pair;
218
			$FORM{"filter-$key"} = $value;
219
			$FILTER->{$key} = $value;
220
		}
221
 
7 - 222
		$FORM{sortby} = $sb;
2 - 223
		$FORM{autoload} = $al;
224
		$FORM{shiftinclude} = $si;
225
		$QUERY_STRING = $prefs;
7 - 226
	}	else {
227
	  @displayFields = sort byfield @defaultFields; # Otherwise suppply a default list of columns.
228
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
229
	}
2 - 230
}
231
 
7 - 232
# let's just make sure the columns are in the right order (and there aren't any missing)
233
@displayFields = sort byfield uniq @displayFields, @staticFields;
2 - 234
 
7 - 235
# If the field isn't in the displayFields list,	then add it to the hideFields list
236
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
2 - 237
 
7 - 238
# Process any filters provided in the form to pass to the database
239
push @whereClause, map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
50 bgadell 240
push @whereClause, @addToWhereClause;
2 - 241
 
7 - 242
							#  Given the fields to display and the where conditions,
243
							#	  "getData" will return a reference to an array of
244
							#	  hash references of the results.
245
my ($data, $datacount) = getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit);
246
my @ProductList = @{ $data };
247
 
248
#my @ProductList = @{ getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit) };
249
my $x = scalar @ProductList; # How many results were returned?
250
 
251
# If the user is trying to download the Excel file, send it to them and then exit out.
252
if ($FORM{excel}) {
253
  exportExcel (\@ProductList, "RC_Officiating_Shifts");
254
  exit;
2 - 255
}
256
 
257
my @shifts;
258
if ($FORM{shiftinclude} eq "true") {
259
  my @SIWhere = ("year(date) = '$YEAR'");
260
  push @SIWhere, "RCid = $ORCUSER->{RCid}";
7 - 261
  my ($d, $c) = getData (\@displayFields, \@SIWhere, $DBTABLE, $FORM{sortby});
262
  @shifts = @{ $d };
2 - 263
}
264
 
265
 
7 - 266
my $signedOnAs = $username ? "Welcome, $username. ".$h->a ({ href=>"index.pl", onClick=>"document.cookie = 'RCAUTH=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/';return true;" }, "[Log Out]") : "You are not signed in.";
2 - 267
 
7 - 268
# Set some cookie stuff...
39 - 269
my ($uri) = split /\?/, $ENV{REQUEST_URI};
270
my $path = `dirname $uri`; chomp $path; $path .= '/' unless $path eq "/";
7 - 271
my $queryCookie = cookie(-NAME=>$prefscookie,
2 - 272
			-VALUE=>"$QUERY_STRING",
273
			-PATH=>"$path",
274
			-EXPIRES=>'+365d');
275
 
7 - 276
my $SIChecked;
277
if ($FORM{shiftinclude}) {
278
  $SIChecked = $h->input ({ type=>"checkbox", name=>"shiftinclude", value=>"true", checked=>[], onClick=>'submit();' });
279
} else {
280
  $SIChecked = $h->input ({ type=>"checkbox", name=>"shiftinclude", value=>"true", onClick=>'submit();' });
281
}
2 - 282
 
7 - 283
# Print the header
284
print header (-cookie=> [ $queryCookie, $RCAUTH_cookie ] );
2 - 285
 
7 - 286
# 	print "<!-- FORM \n\n";				# Debug code to dump the FORM to a html comment
287
#	print "I'm catching updates!!!\n\n";
288
#	foreach $key (sort (keys %FORM))		#	Must be done after the header is written!
289
# 		{ print "\t$key:  $FORM{$key}\n"; }
290
# 	print "--> \n\n";
2 - 291
#
292
#
293
# 	print "<!-- ENV \n\n";				# Debug code to dump the ENV to a html comment
294
# 	foreach $key (sort (keys %ENV))			#	Must be done after the header is written!
295
# 		{ print "\t$key:  $ENV{$key}\n"; }
296
# 	print "--> \n\n";
297
#
298
# 	print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
299
 
300
 
301
#------------------
7 - 302
# Toggle the autoload fields within the table elements
303
our ($onClick, $onChange);   # (also used in scanFunctions)
304
my ($radiobutton, $refreshbutton, $sortby);
305
if ($FORM{autoload}) {
306
	$onClick = "onClick='submit();'";
307
	$onChange = "onChange='page.value = 1; submit();'";
308
  $radiobutton = $h->div ({ class=>'autoload' },
309
    ["Autoload Changes: ",
310
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ",
311
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
312
    ]);
313
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
314
} else {
315
  $onClick = "";
316
	$onChange = "onChange='page.value = 1;'";
317
  $radiobutton = $h->div ({ class=>'autoload' },
318
    ["Autoload Changes: ",
319
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();' }), "On ",
320
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();', checked=>[] }), "Off ",
321
    ]);
11 - 322
  $refreshbutton = $h->input ({ type=>"button", value=>"Refresh", onClick=>"submit(); return false;" });
7 - 323
  $sortby = $h->select ({name=>"sortby" }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
2 - 324
}
325
 
326
 
327
 
7 - 328
print start_html (-title => $pageTitle, -style => {'src' => $stylesheet} );
8 - 329
#printRCHeader ($pageTitle);
2 - 330
 
7 - 331
print $h->open ('form', { action=>url, method=>'POST', name=>'Req' });
332
print $h->input ({ type=>"hidden", name=>"excel", value=>0 });
333
print $h->div ({ class => "accent pageheader" }, [
334
  $h->h1 ($pageTitle),
335
  $h->div ({ class=>"sp0" }, [
336
    $h->div ({ class=>"spLeft" }, [
337
      $radiobutton
338
    ]),
339
    $h->div ({ class=>"spRight" }, [
340
      $h->input ({ type=>"button", value=>"Home", onClick=>"window.location.href='$homeURL'" }),
341
      $refreshbutton
342
    ]),
343
  ]),
344
]);
2 - 345
 
7 - 346
# Print the Hidden fields' check boxes (if there are any)
2 - 347
 
7 - 348
my $c = 1;
349
my @hiddencheckboxes;
350
my @hiddenrows;
351
foreach my $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
352
  if ($FORM{autoload}) {
353
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters nowrap', onClick=>"Req.$field.click();" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true', onClick=>"event.stopPropagation(); submit();" }), $NAME{$field} ]);
354
  } else {
355
    push @hiddencheckboxes, $h->div ({ class=>'rTableCell quarters nowrap', onClick=>"Req.$field.checked=!Req.$field.checked;" }, [ $h->input ({ type=>'checkbox', class=>'accent', name=>$field, value=>'true', onClick=>"event.stopPropagation();" }), $NAME{$field} ]);
356
  }
357
  if ($c++ % 4 == 0) {
358
    push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
359
    @hiddencheckboxes = [];
360
  }
361
}
362
push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]) unless --$c % 4 == 0;
2 - 363
 
50 bgadell 364
my @yearoptions;
365
foreach (@{&getYears()}) {
366
	push @yearoptions, $YEAR eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_);
367
}
2 - 368
 
7 - 369
if (scalar @hideFields) {
370
  my @topleft;
371
  push @topleft, $h->div ({ class=>"nowrap" }, "Hidden Columns:");
372
  push @topleft, $h->div ({ class=>'rTable' }, [ @hiddenrows ]);
373
 
374
  print $h->div ({ class=>"sp0" }, [
375
    $h->div ({ class=>"spLeft"  }, [ @topleft ]),
376
    $h->div ({ class=>"spRight" }, [
377
      $signedOnAs, $h->br,
378
      "Show my shifts: ", $SIChecked, $h->br,
379
      $h->input ({ type=>"button", value=>"Block Personal Time", onClick=>"window.location.href='manage_personal_time.pl'" }),
380
    ])
381
  ]);
382
}
2 - 383
 
7 - 384
# Print the main table...............................................
2 - 385
 
7 - 386
print $h->open ('div', { class=>'rTable' });
2 - 387
 
7 - 388
my @tmptitlerow;
389
foreach my $f (@displayFields)	{  # Print the Column headings
390
  if (inArray ($f, \@staticFields)) {
391
    push @tmptitlerow, $h->div ({ class=>'rTableHead' }, [ $h->input ({ type=>"hidden", name=>$f, value=>"true" }), $NAME{$f}, "&nbsp;", $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='manage_shift.pl'" }) ]);
392
  } else {
393
    if ($FORM{autoload}) {
394
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.click();" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[], onClick=>'event.stopPropagation(); submit();' }), $NAME{$f} ]);
395
    } else {
396
      push @tmptitlerow, $h->div ({ class=>'rTableHead', onClick=>"Req.$f.checked=!Req.$f.checked;" }, [ $h->input ({ type=>"checkbox", class=>"accent", name=>$f, value=>"true", checked=>[], onClick=>"event.stopPropagation();" }), $NAME{$f} ]);
397
    }
398
  }
399
}
2 - 400
 
7 - 401
# Print the filter boxes...
402
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
2 - 403
 
7 - 404
if ($FORM{shiftinclude}) {  # Include all of the user's shifts at the top
405
  foreach my $t (@shifts)	{
406
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
407
  }
408
  print $h->hr ({ width=>"500%" });
409
}
2 - 410
 
7 - 411
# Print the things
412
#foreach my $t (@ProductList)	{
413
#  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
414
#}
415
foreach my $t (@ProductList)	{
416
  if ($t->{RCid} eq $ORCUSER->{RCid}) {
417
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
418
  } else {
419
	  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
2 - 420
  }
421
}
422
 
7 - 423
print $h->close ('div');
2 - 424
 
7 - 425
# close things out................................................
2 - 426
 
7 - 427
my $pages = $pagelimit eq "All" ? 1 : int( $datacount / $pagelimit + 0.99 );
428
if ($curpage > $pages) { $curpage = $pages; }
2 - 429
 
7 - 430
my @pagerange;
431
if ($pages <= 5 ) {
432
  @pagerange = 1 .. $pages;
433
} else {
434
  if ($curpage <= 3) {
435
    @pagerange = (1, 2, 3, 4, ">>");
436
  } elsif ($curpage >= $pages - 2) {
437
    @pagerange = ("<<", $pages-3, $pages-2, $pages-1, $pages);
438
  } else {
439
    @pagerange = ("<<", $curpage-1, $curpage, $curpage+1, ">>");
440
  }
2 - 441
}
442
 
7 - 443
print $h->br; # print $h->br;
444
print $h->div ({ class=>"sp0" }, [
445
    $h->div ({ class=>"spLeft" }, [
446
      $h->div ({ class=>"footer" }, [
447
        "To bookmark, save, or send this exact view, use the ",
448
        $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
449
        $h->br,
450
        "If this page is displaying oddly, ", $h->a ({ href=>url ()."?ignoreCookie=1" }, "[Reset Your View]"),
451
        $h->br,
452
        $h->a ({ href=>"", target=>"_new", onClick=>"window.document.Req.excel.value=1; window.document.Req.submit(); window.document.Req.excel.value=0; return false;" }, "[Export Displayed Data as an Excel Document.]"),
453
        $h->br,
454
        "This page was displayed on ", currentTime (),
455
        $h->br,
50 bgadell 456
        "Please direct questions, problems, and concerns to Officials.RollerCon.Schedule\@gmail.com",
457
        $h->br,
458
        "Displaying: ", $h->select ({ name=>"year", onchange=>"Req.submit();" }, [ @yearoptions ])
7 - 459
      ])
460
    ]),
461
    $h->div ({ class=>"spRight" }, [
462
      $h->h5 ([
463
               "$x of $datacount Record". ($x == 1 ? "" : "s") ." Displayed", $h->br,
464
               "Sorted by ", $sortby, $h->br,
465
               "Displaying ", $h->select ({ name=>"limit", onChange=>"page.value = 1; submit();" }, [ map { $pagelimit == $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @pagelimitoptions ]), " Per Page", $h->br,
466
               ( $pages > 1 ? ( join " ", map { $_ == $curpage ? "<B>$_</b>" :
467
                                                $_ eq "<<"     ? $h->a ({ onClick=>qq{Req.page.value=1; Req.submit();} }, "$_") :
468
                                                $_ eq ">>"     ? $h->a ({ onClick=>qq{Req.page.value=$pages; Req.submit();} }, "$_") :
469
                                                                 $h->a ({ onClick=>qq{Req.page.value=$_; Req.submit();} }, "[$_]") } @pagerange ) : "" ), $h->br,
470
               $h->input ({ type=>"hidden", name=>"page", value=>$curpage })
471
      ])
472
    ]),
473
]);
2 - 474
 
7 - 475
#print $h->br; # print $h->br;
476
#print $h->h5 ("$x Record(s) Displayed");
477
#print $h->div ({ class=>"footer" }, [
478
#  "To bookmark, save, or send this exact view, use the ",
479
#  $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
480
#  $h->br,
481
#  "This page was displayed on $now",
482
#  $h->br,
483
#  "Please direct questions, problems, and concerns to noone\@gmail.com"
484
#]);
2 - 485
 
486
 
7 - 487
print $h->close('form');
488
print $h->close('html');