Subversion Repositories ORC

Rev

Rev 29 | Rev 39 | 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");
7 - 23
my $YEAR = "2022";
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";
88
  }
89
 
90
 	my ($yyyy, $mm, $dd) = split /\-/, $t->{date};
91
	my $cutoff = DateTime->new(
92
        year => $yyyy,
93
        month => $mm,
94
        day => $dd,
95
        hour => 5,
96
        minute => 0,
97
        second => 0,
98
        time_zone => 'America/Los_Angeles'
99
  );
100
 
35 - 101
 	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 - 102
 	  if ($t->{dept} eq "PER") {
103
 	    # DEL Personal Block
104
 	    $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]");
105
 	  } else {
106
   		# DROP
107
 	    $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 - 108
   		if ($user->{department}->{$t->{dept}} >= 2 or $LVL >= 5 or $user->{department}->{VCI} >= 2) {
109
   		  # NO SHOW and MOD TIME
7 - 110
   		  $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]");
111
   		  $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]");
112
   		}
113
 	  }
114
 	} elsif (!$t->{derby_name}) {
115
 		if (signUpEligible ($ORCUSER, $t, "vol") and $now < $cutoff) {
116
 			# SIGN UP
117
 			$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]");
118
 		}
35 - 119
 		if ($user->{department}->{$t->{dept}} >= 2 or $LVL > 4 or $user->{department}->{VCI} >= 2) {
7 - 120
 			# ADD USER
121
 			$t->{derby_name} ? $t->{derby_name} .= " | " : {};
122
 			$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]");
123
 		}
124
 	}
125
 	return $t->{derby_name};
126
}
127
 
128
my $DEPTS = getDepartments;
129
sub modify_dept {
130
  my $hr = shift;
131
  return $DEPTS->{$hr->{dept}};
132
}
133
 
134
sub filter_dept {
135
  my $colName = shift;
136
	my $filter = shift;
137
 
138
	if (defined $filter)	{
139
		if ($filter eq "-blank-") {
140
			return "($colName = '' or isNull($colName) = 1)";
141
		}
142
		return "$colName = \"$filter\"";
143
	}	else {
144
		my $thing = "filter-${colName}";
145
    my $categories = join "", map { $FORM{$thing} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $DEPTS->{$_}) : $h->option ({ value=>$_ }, $DEPTS->{$_}) } grep { $LVL > 4 or exists $user->{department}->{$_} } sort keys %{$DEPTS};
146
		my $Options = "<OPTION></OPTION>".$categories;
147
 
148
		$Options =~ s/>($FORM{$thing})/ selected>$1/;
149
		return "<SELECT name=filter-${colName} $onChange>$Options</SELECT>";
150
	}
151
}
152
 
153
 
154
# Ideally, nothing below this comment needs to change
155
#-------------------------------------------------------------------------------
156
 
157
 
158
our %NAME              = map  { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
159
our %colOrderHash      = map  { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
160
our %colFilterTypeHash = map  { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
161
our @staticFields      = sort byfield grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
162
our @defaultFields     = sort byfield grep { defined $COLUMNS{$_}->[3] } keys %COLUMNS;
163
#our @defaultFields     = grep { $COLUMNS{$_}->[3] eq 'default' or inArray ($_, \@staticFields) } keys %COLUMNS;
164
 
165
our @allFields = sort byfield keys %NAME;
166
our @displayFields = ();
167
our @hideFields = ();
168
my $QUERY_STRING;
169
 
170
my $pagelimit = param ("limit") // $pagelimitoptions[$#pagelimitoptions];
171
my $curpage = param ("page") // 1;
172
 
173
our %FORM;
174
my $FILTER;
175
foreach (param()) {
176
 	if (/^year$/) { #
2 - 177
		$YEAR = param($_);
178
		next;
179
	}
7 - 180
 
2 - 181
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
182
 
7 - 183
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
184
		my ($filter,$field) = split /-/, $_;
2 - 185
		$FILTER->{$field} = $FORM{$_};
7 - 186
	}	elsif ($FORM{$_} eq "true")	{		# Compile list of fields to display
2 - 187
	  if ($_ ne "shiftinclude") {
188
		  push @displayFields, $_;
189
		}
7 - 190
	}
2 - 191
}
192
 
193
 
7 - 194
if (exists $FORM{autoload})	{			# If the FORM was submitted (i.e. the page is being redisplayed),
195
							                    #  	build the data for the cookie that remembers the page setup
2 - 196
	my $disFields = join ":", @displayFields;
7 - 197
	my $fils = join ":", map { "$_=$FILTER->{$_}" } keys %{$FILTER};
2 - 198
 
7 - 199
	$QUERY_STRING = $disFields.'&'.$fils.'&'.$FORM{sortby}.'&'.$FORM{autoload}.'&'.$FORM{shiftinclude};
2 - 200
}
201
 
202
 
7 - 203
if (!(exists $FORM{autoload}))	{			# No FORM was submitted...
204
	if (my $prefs = cookie ($prefscookie) and !defined param ("ignoreCookie"))	{ # Check for cookies from previous visits.
35 - 205
		my ($disF, $filts, $sb, $al, $si) = split /&/,$prefs;
2 - 206
		@displayFields = split /:/,$disF;
207
 
7 - 208
		foreach my $pair (split /:/, $filts)	{
2 - 209
			my ($key, $value) = split /=/, $pair;
210
			$FORM{"filter-$key"} = $value;
211
			$FILTER->{$key} = $value;
212
		}
213
 
7 - 214
		$FORM{sortby} = $sb;
2 - 215
		$FORM{autoload} = $al;
216
		$FORM{shiftinclude} = $si;
217
		$QUERY_STRING = $prefs;
7 - 218
	}	else {
219
	  @displayFields = sort byfield @defaultFields; # Otherwise suppply a default list of columns.
220
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
221
	}
2 - 222
}
223
 
7 - 224
# let's just make sure the columns are in the right order (and there aren't any missing)
225
@displayFields = sort byfield uniq @displayFields, @staticFields;
2 - 226
 
7 - 227
# If the field isn't in the displayFields list,	then add it to the hideFields list
228
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
2 - 229
 
7 - 230
# Process any filters provided in the form to pass to the database
231
push @whereClause, map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
2 - 232
 
7 - 233
							#  Given the fields to display and the where conditions,
234
							#	  "getData" will return a reference to an array of
235
							#	  hash references of the results.
236
my ($data, $datacount) = getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit);
237
my @ProductList = @{ $data };
238
 
239
#my @ProductList = @{ getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit) };
240
my $x = scalar @ProductList; # How many results were returned?
241
 
242
# If the user is trying to download the Excel file, send it to them and then exit out.
243
if ($FORM{excel}) {
244
  exportExcel (\@ProductList, "RC_Officiating_Shifts");
245
  exit;
2 - 246
}
247
 
248
my @shifts;
249
if ($FORM{shiftinclude} eq "true") {
250
  my @SIWhere = ("year(date) = '$YEAR'");
251
  push @SIWhere, "RCid = $ORCUSER->{RCid}";
7 - 252
  my ($d, $c) = getData (\@displayFields, \@SIWhere, $DBTABLE, $FORM{sortby});
253
  @shifts = @{ $d };
2 - 254
}
255
 
256
 
7 - 257
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 - 258
 
7 - 259
# Set some cookie stuff...
260
my $path = `dirname $ENV{REQUEST_URI}`; chomp $path; $path .= '/' unless $path eq "/";
261
my $queryCookie = cookie(-NAME=>$prefscookie,
2 - 262
			-VALUE=>"$QUERY_STRING",
263
			-PATH=>"$path",
264
			-EXPIRES=>'+365d');
265
 
7 - 266
my $SIChecked;
267
if ($FORM{shiftinclude}) {
268
  $SIChecked = $h->input ({ type=>"checkbox", name=>"shiftinclude", value=>"true", checked=>[], onClick=>'submit();' });
269
} else {
270
  $SIChecked = $h->input ({ type=>"checkbox", name=>"shiftinclude", value=>"true", onClick=>'submit();' });
271
}
2 - 272
 
7 - 273
# Print the header
274
print header (-cookie=> [ $queryCookie, $RCAUTH_cookie ] );
2 - 275
 
7 - 276
# 	print "<!-- FORM \n\n";				# Debug code to dump the FORM to a html comment
277
#	print "I'm catching updates!!!\n\n";
278
#	foreach $key (sort (keys %FORM))		#	Must be done after the header is written!
279
# 		{ print "\t$key:  $FORM{$key}\n"; }
280
# 	print "--> \n\n";
2 - 281
#
282
#
283
# 	print "<!-- ENV \n\n";				# Debug code to dump the ENV to a html comment
284
# 	foreach $key (sort (keys %ENV))			#	Must be done after the header is written!
285
# 		{ print "\t$key:  $ENV{$key}\n"; }
286
# 	print "--> \n\n";
287
#
288
# 	print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
289
 
290
 
291
#------------------
292
 
7 - 293
# Toggle the autoload fields within the table elements
294
our ($onClick, $onChange);   # (also used in scanFunctions)
295
my ($radiobutton, $refreshbutton, $sortby);
296
if ($FORM{autoload}) {
297
	$onClick = "onClick='submit();'";
298
	$onChange = "onChange='page.value = 1; submit();'";
299
  $radiobutton = $h->div ({ class=>'autoload' },
300
    ["Autoload Changes: ",
301
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ",
302
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
303
    ]);
304
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
305
} else {
306
  $onClick = "";
307
	$onChange = "onChange='page.value = 1;'";
308
  $radiobutton = $h->div ({ class=>'autoload' },
309
    ["Autoload Changes: ",
310
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();' }), "On ",
311
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();', checked=>[] }), "Off ",
312
    ]);
11 - 313
  $refreshbutton = $h->input ({ type=>"button", value=>"Refresh", onClick=>"submit(); return false;" });
7 - 314
  $sortby = $h->select ({name=>"sortby" }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
2 - 315
}
316
 
317
 
318
 
7 - 319
 
320
print start_html (-title => $pageTitle, -style => {'src' => $stylesheet} );
8 - 321
#printRCHeader ($pageTitle);
2 - 322
 
7 - 323
print $h->open ('form', { action=>url, method=>'POST', name=>'Req' });
324
print $h->input ({ type=>"hidden", name=>"excel", value=>0 });
325
print $h->div ({ class => "accent pageheader" }, [
326
  $h->h1 ($pageTitle),
327
  $h->div ({ class=>"sp0" }, [
328
    $h->div ({ class=>"spLeft" }, [
329
      $radiobutton
330
    ]),
331
    $h->div ({ class=>"spRight" }, [
332
      $h->input ({ type=>"button", value=>"Home", onClick=>"window.location.href='$homeURL'" }),
333
      $refreshbutton
334
    ]),
335
  ]),
336
]);
2 - 337
 
7 - 338
# Print the Hidden fields' check boxes (if there are any)
2 - 339
 
7 - 340
my $c = 1;
341
my @hiddencheckboxes;
342
my @hiddenrows;
343
foreach my $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
344
  if ($FORM{autoload}) {
345
    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} ]);
346
  } else {
347
    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} ]);
348
  }
349
  if ($c++ % 4 == 0) {
350
    push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
351
    @hiddencheckboxes = [];
352
  }
353
}
354
push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]) unless --$c % 4 == 0;
2 - 355
 
356
 
7 - 357
if (scalar @hideFields) {
358
  my @topleft;
359
  push @topleft, $h->div ({ class=>"nowrap" }, "Hidden Columns:");
360
  push @topleft, $h->div ({ class=>'rTable' }, [ @hiddenrows ]);
361
 
362
  print $h->div ({ class=>"sp0" }, [
363
    $h->div ({ class=>"spLeft"  }, [ @topleft ]),
364
    $h->div ({ class=>"spRight" }, [
365
      $signedOnAs, $h->br,
366
      "Show my shifts: ", $SIChecked, $h->br,
367
      $h->input ({ type=>"button", value=>"Block Personal Time", onClick=>"window.location.href='manage_personal_time.pl'" }),
368
    ])
369
  ]);
370
}
2 - 371
 
7 - 372
# Print the main table...............................................
2 - 373
 
7 - 374
print $h->open ('div', { class=>'rTable' });
2 - 375
 
7 - 376
my @tmptitlerow;
377
foreach my $f (@displayFields)	{  # Print the Column headings
378
  if (inArray ($f, \@staticFields)) {
379
    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'" }) ]);
380
  } else {
381
    if ($FORM{autoload}) {
382
      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} ]);
383
    } else {
384
      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} ]);
385
    }
386
  }
387
}
2 - 388
 
7 - 389
# Print the filter boxes...
390
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
2 - 391
 
7 - 392
if ($FORM{shiftinclude}) {  # Include all of the user's shifts at the top
393
  foreach my $t (@shifts)	{
394
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
395
  }
396
  print $h->hr ({ width=>"500%" });
397
}
2 - 398
 
7 - 399
# Print the things
400
#foreach my $t (@ProductList)	{
401
#  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
402
#}
403
foreach my $t (@ProductList)	{
404
  if ($t->{RCid} eq $ORCUSER->{RCid}) {
405
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
406
  } else {
407
	  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
2 - 408
  }
409
}
410
 
7 - 411
print $h->close ('div');
2 - 412
 
7 - 413
# close things out................................................
2 - 414
 
7 - 415
my $pages = $pagelimit eq "All" ? 1 : int( $datacount / $pagelimit + 0.99 );
416
if ($curpage > $pages) { $curpage = $pages; }
2 - 417
 
7 - 418
my @pagerange;
419
if ($pages <= 5 ) {
420
  @pagerange = 1 .. $pages;
421
} else {
422
  if ($curpage <= 3) {
423
    @pagerange = (1, 2, 3, 4, ">>");
424
  } elsif ($curpage >= $pages - 2) {
425
    @pagerange = ("<<", $pages-3, $pages-2, $pages-1, $pages);
426
  } else {
427
    @pagerange = ("<<", $curpage-1, $curpage, $curpage+1, ">>");
428
  }
2 - 429
}
430
 
7 - 431
print $h->br; # print $h->br;
432
print $h->div ({ class=>"sp0" }, [
433
    $h->div ({ class=>"spLeft" }, [
434
      $h->div ({ class=>"footer" }, [
435
        "To bookmark, save, or send this exact view, use the ",
436
        $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
437
        $h->br,
438
        "If this page is displaying oddly, ", $h->a ({ href=>url ()."?ignoreCookie=1" }, "[Reset Your View]"),
439
        $h->br,
440
        $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.]"),
441
        $h->br,
442
        "This page was displayed on ", currentTime (),
443
        $h->br,
24 - 444
        "Please direct questions, problems, and concerns to Officials.RollerCon.Schedule\@gmail.com"
7 - 445
      ])
446
    ]),
447
    $h->div ({ class=>"spRight" }, [
448
      $h->h5 ([
449
               "$x of $datacount Record". ($x == 1 ? "" : "s") ." Displayed", $h->br,
450
               "Sorted by ", $sortby, $h->br,
451
               "Displaying ", $h->select ({ name=>"limit", onChange=>"page.value = 1; submit();" }, [ map { $pagelimit == $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @pagelimitoptions ]), " Per Page", $h->br,
452
               ( $pages > 1 ? ( join " ", map { $_ == $curpage ? "<B>$_</b>" :
453
                                                $_ eq "<<"     ? $h->a ({ onClick=>qq{Req.page.value=1; Req.submit();} }, "$_") :
454
                                                $_ eq ">>"     ? $h->a ({ onClick=>qq{Req.page.value=$pages; Req.submit();} }, "$_") :
455
                                                                 $h->a ({ onClick=>qq{Req.page.value=$_; Req.submit();} }, "[$_]") } @pagerange ) : "" ), $h->br,
456
               $h->input ({ type=>"hidden", name=>"page", value=>$curpage })
457
      ])
458
    ]),
459
]);
2 - 460
 
7 - 461
#print $h->br; # print $h->br;
462
#print $h->h5 ("$x Record(s) Displayed");
463
#print $h->div ({ class=>"footer" }, [
464
#  "To bookmark, save, or send this exact view, use the ",
465
#  $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
466
#  $h->br,
467
#  "This page was displayed on $now",
468
#  $h->br,
469
#  "Please direct questions, problems, and concerns to noone\@gmail.com"
470
#]);
2 - 471
 
472
 
7 - 473
print $h->close('form');
474
print $h->close('html');