Subversion Repositories ORC

Rev

Rev 2 | Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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