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