| Line 6... |
Line 6... |
| 6 |
open STDERR, '>>', $error_log_path.'vorc_error.log' or warn "Failed to open redirected logfile ($0): $!";
|
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";
|
7 |
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
|
| Line 8... |
Line 8... |
| 8 |
|
8 |
|
| Line 9... |
Line 9... |
| 9 |
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
|
9 |
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
|
| 10 |
|
10 |
|
| 11 |
#use strict;
|
11 |
use strict;
|
| 12 |
use cPanelUserConfig;
|
12 |
use cPanelUserConfig;
|
| 13 |
use CGI qw/param cookie header start_html url/;
|
13 |
use CGI qw/param cookie header start_html url/;
|
| 14 |
use HTML::Tiny;
|
14 |
use HTML::Tiny;
|
| 15 |
use tableViewer;
|
15 |
use tableViewer;
|
| Line 16... |
Line 16... |
| 16 |
use RollerCon;
|
16 |
use RollerCon;
|
| 17 |
our $h = HTML::Tiny->new( mode => 'html' );
|
17 |
our $h = HTML::Tiny->new( mode => 'html' );
|
| 18 |
|
- |
|
| 19 |
my $cookie_string = authenticate (RollerCon::USER) || die;
|
- |
|
| 20 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
- |
|
| 21 |
my $user = getUser ($EML);
|
- |
|
| 22 |
$user->{department} = convertDepartments $user->{department};
|
18 |
|
| 23 |
my $username = $h->a ({ href=>"/schedule/view_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
|
- |
|
| 24 |
my $RCid = $user->{RCid};
|
- |
|
| Line 25... |
Line 19... |
| 25 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
19 |
my $cookie_string = authenticate (RollerCon::USER) || die;
|
| 26 |
my $YEAR = 1900 + (localtime)[5];
|
- |
|
| 27 |
|
20 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
| 28 |
|
21 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
| 29 |
my $pageTitle = "Games";
|
22 |
|
| 30 |
my $prefscookie = "games";
|
23 |
my $pageTitle = "Games";
|
| 31 |
our $DBTABLE = 'v_games';
|
24 |
our $DBTABLE = 'v_games';
|
| 32 |
my %COLUMNS = (
|
25 |
my %COLUMNS = (
|
| 33 |
# colname => [qw(DisplayName N type status)], status -> static | default | <blank>
|
26 |
# colname => [qw(DisplayName N type status)], status -> static | default | <blank>
|
| 34 |
# id => [qw(Change 5 none static )],
|
27 |
# id => [qw(Change 5 none static )],
|
| 35 |
teams => [qw(Teams 10 text default )],
|
28 |
teams => [qw(Teams 10 text default )],
|
| 36 |
date => [qw(Date 15 date default )],
|
29 |
date => [qw(Date 15 date default )],
|
| 37 |
dayofweek => [qw(Day 20 select )],
|
30 |
dayofweek => [qw(Day 20 select )],
|
| 38 |
time => [qw(Time 25 text default )],
|
31 |
time => [qw(Time 25 text default )],
|
| 39 |
start_time => [qw(Start 30 text )],
|
32 |
start_time => [qw(Start 30 text )],
|
| 40 |
end_time => [qw(End 35 text )],
|
33 |
end_time => [qw(End 35 text )],
|
| 41 |
volhours => [qw(Length 40 number )],
|
34 |
volhours => [qw(Length 40 number )],
|
| 42 |
track => [qw(Track 45 select default )],
|
35 |
track => [qw(Track 45 select default )],
|
| 43 |
level => [qw(Level 50 select default )],
|
36 |
level => [qw(Level 50 select default )],
|
| Line 44... |
Line 37... |
| 44 |
restrictions => [qw(R 60 select default )],
|
37 |
restrictions => [qw(R 60 select default )],
|
| 45 |
gtype => [qw(Type 65 select default )],
|
38 |
gtype => [qw(Type 65 select default )],
|
| 46 |
notes => [qw(Notes 70 text )],
|
39 |
notes => [qw(Notes 70 text )],
|
| 47 |
);
|
- |
|
| 48 |
|
- |
|
| 49 |
if ($LVL >= RollerCon::ADMIN) {
|
- |
|
| Line 50... |
Line 40... |
| 50 |
$COLUMNS{id} = [qw(Change 5 none static )];
|
40 |
);
|
| Line 51... |
Line 41... |
| 51 |
}
|
41 |
|
| 52 |
my $stylesheet = "/style.css";
|
42 |
if ($LVL >= RollerCon::ADMIN) {
|
| Line 82... |
Line 72... |
| 82 |
sub modify_end_time {
|
72 |
sub modify_end_time {
|
| 83 |
my $t = shift;
|
73 |
my $t = shift;
|
| 84 |
return convertTime $t->{end_time};
|
74 |
return convertTime $t->{end_time};
|
| 85 |
}
|
75 |
}
|
| Line -... |
Line 76... |
| - |
|
76 |
|
| - |
|
77 |
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
|
| Line 86... |
Line -... |
| 86 |
|
- |
|
| 87 |
|
- |
|
| 88 |
# Ideally, nothing below this comment needs to change
|
- |
|
| 89 |
#-------------------------------------------------------------------------------
|
- |
|
| 90 |
|
- |
|
| 91 |
|
- |
|
| 92 |
our %NAME = map { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
|
- |
|
| 93 |
our %colOrderHash = map { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
|
- |
|
| 94 |
our %colFilterTypeHash = map { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
|
- |
|
| 95 |
our @staticFields = sort byfield grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
|
- |
|
| 96 |
our @defaultFields = sort byfield grep { defined $COLUMNS{$_}->[3] } keys %COLUMNS;
|
- |
|
| 97 |
#our @defaultFields = grep { $COLUMNS{$_}->[3] eq 'default' or inArray ($_, \@staticFields) } keys %COLUMNS;
|
- |
|
| 98 |
|
- |
|
| 99 |
our @allFields = sort byfield keys %NAME;
|
- |
|
| 100 |
our @displayFields = ();
|
- |
|
| 101 |
our @hideFields = ();
|
- |
|
| 102 |
my $QUERY_STRING;
|
- |
|
| 103 |
|
- |
|
| 104 |
my $pagelimit = param ("limit") // $pagelimitoptions[$#pagelimitoptions];
|
- |
|
| 105 |
my $curpage = param ("page") // 1;
|
- |
|
| 106 |
|
- |
|
| 107 |
our %FORM;
|
- |
|
| 108 |
my $FILTER;
|
- |
|
| 109 |
foreach (param()) {
|
- |
|
| 110 |
if (/^year$/) { #
|
- |
|
| 111 |
$YEAR = param($_);
|
- |
|
| 112 |
next;
|
- |
|
| 113 |
}
|
- |
|
| 114 |
|
- |
|
| 115 |
$FORM{$_} = param($_); # Retrieve all of the FORM data submitted
|
- |
|
| 116 |
|
- |
|
| 117 |
if ((/^filter/) and ($FORM{$_} ne '')) { # Build a set of filters to apply
|
- |
|
| 118 |
my ($filter,$field) = split /-/, $_;
|
- |
|
| 119 |
$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
|
- |
|
| 120 |
} elsif ($FORM{$_} eq "true") # Compile list of fields to display
|
- |
|
| 121 |
{ push @displayFields, $_; }
|
- |
|
| 122 |
}
|
- |
|
| 123 |
push @whereClause, "year(date) = '$YEAR'";
|
- |
|
| 124 |
|
- |
|
| 125 |
if (exists $FORM{autoload}) { # If the FORM was submitted (i.e. the page is being redisplayed),
|
- |
|
| 126 |
# build the data for the cookie that remembers the page setup
|
- |
|
| 127 |
my $disFields = join ":", @displayFields;
|
- |
|
| 128 |
my $fils = join ":", map { "$_=$FILTER->{$_}" } keys %{$FILTER};
|
- |
|
| 129 |
|
- |
|
| 130 |
$QUERY_STRING = $disFields.'&'.$fils.'&'.$FORM{sortby}.'&'.$FORM{autoload};
|
- |
|
| 131 |
}
|
- |
|
| 132 |
|
- |
|
| 133 |
|
- |
|
| 134 |
if (!(exists $FORM{autoload})) { # No FORM was submitted...
|
- |
|
| 135 |
if (my $prefs = cookie ($prefscookie) and !defined param ("ignoreCookie")) { # Check for cookies from previous visits.
|
- |
|
| 136 |
my ($disF, $filts, $sb, $al) = split /&/,$prefs;
|
- |
|
| 137 |
@displayFields = split /:/,$disF;
|
- |
|
| 138 |
|
- |
|
| 139 |
foreach my $pair (split /:/, $filts) {
|
- |
|
| 140 |
my ($key, $value) = split /=/, $pair;
|
- |
|
| 141 |
$FORM{"filter-$key"} = $value;
|
- |
|
| 142 |
$FILTER->{$key} = $value;
|
- |
|
| 143 |
}
|
- |
|
| 144 |
|
- |
|
| 145 |
$FORM{sortby} = $sb;
|
- |
|
| 146 |
$FORM{autoload} = $al;
|
- |
|
| 147 |
$QUERY_STRING = $prefs;
|
- |
|
| 148 |
} else {
|
- |
|
| 149 |
@displayFields = @defaultFields; # Otherwise suppply a default list of columns.
|
- |
|
| 150 |
$FORM{sortby} = $displayFields[1];
|
- |
|
| 151 |
$FORM{autoload} = 1; # And turn aut0load on by default.
|
- |
|
| 152 |
}
|
- |
|
| 153 |
}
|
- |
|
| 154 |
|
- |
|
| 155 |
# let's just make sure the columns are in the right order (and there aren't any missing)
|
- |
|
| 156 |
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
|
- |
|
| 157 |
|
- |
|
| 158 |
# If the field isn't in the displayFields list, then add it to the hideFields list
|
- |
|
| 159 |
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
|
78 |
# It will receive two fields, the field name and the current filter value (if any)
|
| 160 |
|
- |
|
| 161 |
# Process any filters provided in the form to pass to the database
|
- |
|
| 162 |
push @whereClause, map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
|
- |
|
| 163 |
|
- |
|
| 164 |
# Given the fields to display and the where conditions,
|
- |
|
| 165 |
# "getData" will return a reference to an array of
|
- |
|
| 166 |
# hash references of the results.
|
- |
|
| 167 |
my ($data, $datacount) = getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit);
|
- |
|
| 168 |
my @ProductList = @{ $data };
|
- |
|
| 169 |
|
- |
|
| 170 |
#my @ProductList = @{ getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit) };
|
- |
|
| 171 |
my $x = scalar @ProductList; # How many results were returned?
|
- |
|
| 172 |
|
- |
|
| 173 |
# If the user is trying to download the Excel file, send it to them and then exit out.
|
- |
|
| 174 |
if ($FORM{excel}) {
|
- |
|
| 175 |
exportExcel (\@ProductList, "RC_Officiating_Shifts");
|
- |
|
| 176 |
exit;
|
- |
|
| 177 |
}
|
- |
|
| 178 |
|
- |
|
| 179 |
my $signedOnAs = $username ? "Welcome, $username. ".$h->a ({ href=>"index.pl?LOGOUT" }, "[Log Out]") : "You are not signed in.";
|
- |
|
| 180 |
|
- |
|
| 181 |
# Set some cookie stuff...
|
- |
|
| 182 |
my $path = `dirname $ENV{SCRIPT_NAME}`; chomp $path; $path .= '/' unless $path eq "/";
|
- |
|
| 183 |
my $queryCookie = cookie(-NAME=>$prefscookie,
|
- |
|
| 184 |
-VALUE=>"$QUERY_STRING",
|
- |
|
| 185 |
-PATH=>"$path",
|
- |
|
| 186 |
-EXPIRES=>'+365d');
|
- |
|
| 187 |
|
- |
|
| 188 |
# Print the header
|
- |
|
| 189 |
print header (-cookie=> [ $queryCookie, $RCAUTH_cookie ] );
|
- |
|
| 190 |
|
- |
|
| 191 |
# print "<!-- FORM \n\n"; # Debug code to dump the FORM to a html comment
|
- |
|
| 192 |
# print "I'm catching updates!!!\n\n";
|
- |
|
| 193 |
# foreach $key (sort (keys %FORM)) # Must be done after the header is written!
|
- |
|
| 194 |
# { print "\t$key: $FORM{$key}\n"; }
|
- |
|
| 195 |
# print "--> \n\n";
|
- |
|
| 196 |
#
|
- |
|
| 197 |
#
|
- |
|
| 198 |
# print "<!-- ENV \n\n"; # Debug code to dump the ENV to a html comment
|
- |
|
| 199 |
# foreach $key (sort (keys %ENV)) # Must be done after the header is written!
|
- |
|
| 200 |
# { print "\t$key: $ENV{$key}\n"; }
|
79 |
|
| 201 |
# print "--> \n\n";
|
- |
|
| 202 |
#
|
- |
|
| 203 |
# print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
|
- |
|
| 204 |
|
- |
|
| 205 |
|
- |
|
| 206 |
#------------------
|
- |
|
| 207 |
|
- |
|
| 208 |
# Toggle the autoload fields within the table elements
|
- |
|
| 209 |
our ($onClick, $onChange); # (also used in scanFunctions)
|
- |
|
| 210 |
my ($radiobutton, $refreshbutton, $sortby);
|
- |
|
| 211 |
if ($FORM{autoload}) {
|
- |
|
| 212 |
$onClick = "onClick='submit();'";
|
- |
|
| 213 |
$onChange = "onChange='page.value = 1; submit();'";
|
- |
|
| 214 |
$radiobutton = $h->div ({ class=>'autoload' },
|
- |
|
| 215 |
["Autoload Changes: ",
|
- |
|
| 216 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ",
|
- |
|
| 217 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
|
- |
|
| 218 |
]);
|
- |
|
| 219 |
$refreshbutton = "";
|
- |
|
| 220 |
$sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } grep { $_ ne "id" } @displayFields ]);
|
80 |
# Uncomment and update if we want to enable clicking on a row to open a new page.
|
| 221 |
} else {
|
- |
|
| 222 |
$onClick = "";
|
- |
|
| 223 |
$onChange = "onChange='page.value = 1;'";
|
- |
|
| 224 |
$radiobutton = $h->div ({ class=>'autoload' },
|
- |
|
| 225 |
["Autoload Changes: ",
|
- |
|
| 226 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();' }), "On ",
|
- |
|
| 227 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();', checked=>[] }), "Off ",
|
- |
|
| 228 |
]);
|
- |
|
| 229 |
$refreshbutton = $h->input ({ type=>"button", value=>"Refresh", onClick=>"submit(); return false;" });
|
- |
|
| 230 |
$sortby = $h->select ({name=>"sortby" }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
|
- |
|
| 231 |
}
|
- |
|
| 232 |
|
- |
|
| 233 |
|
- |
|
| 234 |
|
- |
|
| 235 |
|
- |
|
| 236 |
print start_html (-title => $pageTitle, -style => {'src' => $stylesheet} );
|
- |
|
| 237 |
|
- |
|
| 238 |
print $h->open ('form', { action=>url, method=>'POST', name=>'Req' });
|
- |
|
| 239 |
print $h->input ({ type=>"hidden", name=>"excel", value=>0 });
|
- |
|
| 240 |
print $h->div ({ class => "accent pageheader" }, [
|
- |
|
| 241 |
$h->h1 ($pageTitle),
|
- |
|
| 242 |
$h->div ({ class=>"sp0" }, [
|
- |
|
| 243 |
$h->div ({ class=>"spLeft" }, [
|
- |
|
| 244 |
$radiobutton
|
- |
|
| 245 |
]),
|
- |
|
| 246 |
$h->div ({ class=>"spRight" }, [
|
- |
|
| 247 |
$h->input ({ type=>"button", value=>"Home", onClick=>"window.location.href='$homeURL'" }),
|
- |
|
| 248 |
$refreshbutton
|
- |
|
| 249 |
]),
|
- |
|
| 250 |
]),
|
- |
|
| 251 |
]);
|
- |
|
| 252 |
|
- |
|
| 253 |
# Print the Hidden fields' check boxes (if there are any)
|
- |
|
| 254 |
|
- |
|
| 255 |
my $c = 1;
|
- |
|
| 256 |
my @hiddencheckboxes;
|
- |
|
| 257 |
my @hiddenrows;
|
- |
|
| 258 |
foreach my $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
|
81 |
#
|
| 259 |
if ($FORM{autoload}) {
|
- |
|
| 260 |
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} ]);
|
82 |
sub addRowClick {
|
| 261 |
} else {
|
- |
|
| 262 |
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} ]);
|
- |
|
| 263 |
}
|
- |
|
| 264 |
if ($c++ % 4 == 0) {
|
- |
|
| 265 |
push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
|
- |
|
| 266 |
@hiddencheckboxes = [];
|
- |
|
| 267 |
}
|
- |
|
| 268 |
}
|
- |
|
| 269 |
push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]) unless --$c % 4 == 0;
|
- |
|
| 270 |
|
- |
|
| 271 |
my @yearoptions;
|
- |
|
| 272 |
foreach (@{&getYears()}) {
|
- |
|
| 273 |
push @yearoptions, $YEAR eq $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_);
|
- |
|
| 274 |
}
|
- |
|
| 275 |
|
- |
|
| 276 |
if (scalar @hideFields) {
|
- |
|
| 277 |
my @topleft;
|
- |
|
| 278 |
push @topleft, $h->div ({ class=>"nowrap" }, "Hidden Columns:");
|
- |
|
| 279 |
push @topleft, $h->div ({ class=>'rTable' }, [ @hiddenrows ]);
|
- |
|
| 280 |
|
- |
|
| 281 |
print $h->div ({ class=>"sp0" }, [
|
- |
|
| 282 |
$h->div ({ class=>"spLeft" }, [ @topleft ]),
|
- |
|
| 283 |
$h->div ({ class=>"spRight" }, [
|
- |
|
| 284 |
$signedOnAs
|
- |
|
| 285 |
])
|
- |
|
| 286 |
]);
|
- |
|
| 287 |
}
|
- |
|
| 288 |
|
- |
|
| 289 |
# Print the main table...............................................
|
- |
|
| 290 |
|
- |
|
| 291 |
print $h->open ('div', { class=>'rTable' });
|
- |
|
| 292 |
|
- |
|
| 293 |
my @tmptitlerow;
|
- |
|
| 294 |
foreach my $f (@displayFields) { # Print the Column headings
|
- |
|
| 295 |
if (inArray ($f, \@staticFields)) {
|
- |
|
| 296 |
push @tmptitlerow, $h->div ({ class=>'rTableHead' }, [ $h->input ({ type=>"hidden", name=>$f, value=>"true" }), $NAME{$f}, " ", $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) ]);
|
- |
|
| 297 |
} else {
|
- |
|
| 298 |
if ($FORM{autoload}) {
|
- |
|
| 299 |
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} ]);
|
- |
|
| 300 |
} else {
|
- |
|
| 301 |
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} ]);
|
- |
|
| 302 |
}
|
- |
|
| 303 |
}
|
- |
|
| 304 |
}
|
- |
|
| 305 |
|
- |
|
| 306 |
# Print the filter boxes...
|
- |
|
| 307 |
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
|
- |
|
| 308 |
|
- |
|
| 309 |
# Print the things
|
- |
|
| 310 |
foreach my $t (@ProductList) {
|
- |
|
| 311 |
print $h->div ({ class=>'rTableRow shaded', onclick=>"location.href='view_game.pl?id=$t->{id}&choice=View'" }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);
|
- |
|
| 312 |
}
|
- |
|
| 313 |
|
- |
|
| 314 |
print $h->close ('div');
|
- |
|
| 315 |
|
- |
|
| 316 |
# close things out................................................
|
- |
|
| 317 |
|
- |
|
| 318 |
my $pages = $pagelimit eq "All" ? 1 : int( $datacount / $pagelimit + 0.99 );
|
- |
|
| 319 |
if ($curpage > $pages) { $curpage = $pages; }
|
- |
|
| 320 |
|
- |
|
| 321 |
my @pagerange;
|
- |
|
| 322 |
if ($pages <= 5 ) {
|
- |
|
| 323 |
@pagerange = 1 .. $pages;
|
- |
|
| 324 |
} else {
|
- |
|
| 325 |
if ($curpage <= 3) {
|
- |
|
| 326 |
@pagerange = (1, 2, 3, 4, ">>");
|
- |
|
| 327 |
} elsif ($curpage >= $pages - 2) {
|
- |
|
| 328 |
@pagerange = ("<<", $pages-3, $pages-2, $pages-1, $pages);
|
- |
|
| 329 |
} else {
|
- |
|
| 330 |
@pagerange = ("<<", $curpage-1, $curpage, $curpage+1, ">>");
|
83 |
my $t = shift;
|
| Line 331... |
Line -... |
| 331 |
}
|
- |
|
| 332 |
}
|
- |
|
| 333 |
|
- |
|
| 334 |
print $h->br; # print $h->br;
|
- |
|
| 335 |
print $h->div ({ class=>"sp0" }, [
|
- |
|
| 336 |
$h->div ({ class=>"spLeft" }, [
|
- |
|
| 337 |
$h->div ({ class=>"footer" }, [
|
- |
|
| 338 |
"To bookmark, save, or send this exact view, use the ",
|
- |
|
| 339 |
$h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
|
- |
|
| 340 |
$h->br,
|
- |
|
| 341 |
"If this page is displaying oddly, ", $h->a ({ href=>url ()."?ignoreCookie=1" }, "[Reset Your View]"),
|
- |
|
| 342 |
$h->br,
|
- |
|
| 343 |
$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.]"),
|
- |
|
| 344 |
$h->br,
|
- |
|
| 345 |
"This page was displayed on ", currentTime (),
|
- |
|
| 346 |
$h->br,
|
- |
|
| 347 |
"Please direct questions, problems, and concerns to $SYSTEM_EMAIL",
|
- |
|
| 348 |
$h->br,
|
- |
|
| 349 |
"Displaying: ", $h->select ({ name=>"year", onchange=>"Req.submit();" }, [ @yearoptions ])
|
- |
|
| 350 |
])
|
- |
|
| 351 |
]),
|
- |
|
| 352 |
$h->div ({ class=>"spRight" }, [
|
- |
|
| 353 |
$h->h5 ([
|
- |
|
| 354 |
"$x of $datacount Record". ($x == 1 ? "" : "s") ." Displayed", $h->br,
|
- |
|
| 355 |
"Sorted by ", $sortby, $h->br,
|
- |
|
| 356 |
"Displaying ", $h->select ({ name=>"limit", onChange=>"page.value = 1; submit();" }, [ map { $pagelimit == $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @pagelimitoptions ]), " Per Page", $h->br,
|
- |
|
| 357 |
( $pages > 1 ? ( join " ", map { $_ == $curpage ? "<B>$_</b>" :
|
- |
|
| 358 |
$_ eq "<<" ? $h->a ({ onClick=>qq{Req.page.value=1; Req.submit();} }, "$_") :
|
- |
|
| 359 |
$_ eq ">>" ? $h->a ({ onClick=>qq{Req.page.value=$pages; Req.submit();} }, "$_") :
|
- |
|
| 360 |
$h->a ({ onClick=>qq{Req.page.value=$_; Req.submit();} }, "[$_]") } @pagerange ) : "" ), $h->br,
|
- |
|
| 361 |
$h->input ({ type=>"hidden", name=>"page", value=>$curpage })
|
- |
|
| 362 |
])
|
- |
|
| 363 |
]),
|
- |
|
| 364 |
]);
|
- |
|
| 365 |
|
- |
|
| 366 |
#print $h->br; # print $h->br;
|
- |
|
| 367 |
#print $h->h5 ("$x Record(s) Displayed");
|
- |
|
| 368 |
#print $h->div ({ class=>"footer" }, [
|
- |
|
| 369 |
# "To bookmark, save, or send this exact view, use the ",
|
- |
|
| 370 |
# $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
|
- |
|
| 371 |
# $h->br,
|
- |
|
| 372 |
# "This page was displayed on $now",
|
- |
|
| 373 |
# $h->br,
|
- |
|
| 374 |
# "Please direct questions, problems, and concerns to noone\@gmail.com"
|
- |
|
| 375 |
#]);
|
- |
|
| 376 |
|
- |
|
| 377 |
|
84 |
return "location.href='view_game.pl?id=$t->{id}&choice=View'"
|
| - |
|
85 |
}
|
| - |
|
86 |
|
| - |
|
87 |
# Call the function to print the table view page (with available options)
|
| - |
|
88 |
printTablePage ({ Title => $pageTitle,
|
| - |
|
89 |
Table => $DBTABLE,
|
| - |
|
90 |
Columns => \%COLUMNS,
|
| - |
|
91 |
RCAuth => $RCAUTH_cookie,
|
| - |
|
92 |
DisplayYearSelect => 1,
|
| - |
|
93 |
PersonalTimeButton => 1,
|
| - |
|
94 |
HeaderButton => { field => "id",
|