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