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;
8
use tableViewer;
Line 15... Line 9...
15
use RollerCon;
9
use RollerCon;
16
use Spreadsheet::WriteExcel;
10
our $h = HTML::Tiny->new( mode => 'html' );
17
 
11
 
18
my $cookie_string = authenticate(2) || die;
12
my $cookie_string = authenticate (2) || die;
19
my ($EML, $PWD, $LVL) = split /&/, $cookie_string;
13
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
20
my $user = getUser($EML);
14
my $user = getUser ($EML);
-
 
15
my $username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
Line -... Line 16...
-
 
16
my $RCid = $user->{RCid};
-
 
17
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
21
my $username = $user->{derby_name};
18
my $YEAR;
-
 
19
 
-
 
20
my $pageTitle = "User Report";
-
 
21
my $prefscookie = "userreport";
-
 
22
our $DBTABLE = 'official';
-
 
23
my %COLUMNS = (
-
 
24
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
-
 
25
	RCid       => [qw(ID           5    number       )],
-
 
26
	derby_name => [qw(DerbyName   10    text        default )],
-
 
27
	email      => [qw(Email       15    text        default )],
-
 
28
	real_name  => [qw(RealName    20    text        default )],
-
 
29
	pronouns   => [qw(Pronouns    25    text        default )],
-
 
30
	tshirt     => [qw(TShirtSize  30    select        default )],
-
 
31
  phone      => [qw(Phone       35    text                )],
-
 
32
	access     => [qw(vOrcAccess  40    select              )],
-
 
33
	department => [qw(Department  45    select      default )],
-
 
34
	added      => [qw(Added       50    date         )],
-
 
35
	last_login => [qw(LastLogin   55    date         )]	
-
 
36
);
-
 
37
 
-
 
38
my $ROLE = getAccessLevels;
-
 
39
my $DepartmentNames = getDepartments ();
-
 
40
 
-
 
41
my $stylesheet = "/style.css";
-
 
42
my $homeURL = '/schedule/';
-
 
43
my @pagelimitoptions = ("All", 5, 10, 25);
-
 
44
 
-
 
45
# If we need to modify line item values, create a subroutine named "modify_$columnname"
-
 
46
#    It will receive a hashref to the object lineitem
-
 
47
# You can also create specific "filter_column" subroutines...
-
 
48
 
-
 
49
#sub modify_RCid {
-
 
50
#  my $li = shift // "";
-
 
51
#  return join "&nbsp;", $li->{RCid},
-
 
52
#         $h->a ({ href=>"manage_user.pl?RCid=$li->{RCid}" }, "[Edit]"),
-
 
53
#  ; 
-
 
54
#}
-
 
55
 
22
my $RCid = $user->{RCid};
56
sub modify_department {
-
 
57
  my $li = shift // "";
-
 
58
  if ($li->{"department"}) {
-
 
59
    my $Ds = convertDepartments $li->{"department"};
-
 
60
    return join $h->br, map { ($Ds->{$_} == 0 and ($ORCUSER->{department}->{$_} > 1 or $LVL > 4)) ? $h->a ({ onClick=>"event.stopPropagation(); window.open('activate_user.pl?RCid=$li->{RCid}&department=$_','Activating User','resizable,height=260,width=370');" }, "$DepartmentNames->{$_} - $ROLE->{$Ds->{$_}}") : "$DepartmentNames->{$_} - $ROLE->{$Ds->{$_}}" } sort keys %{$Ds};
-
 
61
  } else {
-
 
62
    return "";
-
 
63
  }
-
 
64
}
-
 
65
 
-
 
66
sub modify_access {
-
 
67
  my $li = shift // "";
-
 
68
  my @levels = ($li->{"access"});
-
 
69
  
-
 
70
  if ($li->{"department"}) {
-
 
71
    push @levels, values %{convertDepartments $li->{"department"}};
-
 
72
  }
-
 
73
  
-
 
74
  return $ROLE->{ max @levels };
-
 
75
}
-
 
76
 
-
 
77
sub filter_department {
-
 
78
  my $colName = shift;
-
 
79
  my $filter = shift // "";
-
 
80
  
-
 
81
	if ($filter)	{
-
 
82
		if ($filter eq "-blank-") {
-
 
83
			return "($colName = '' or isNull($colName) = 1)";
-
 
84
		}
-
 
85
		return "$colName like \"%$filter%\"";
-
 
86
	} else {
-
 
87
    my @options = ("");
-
 
88
    push @options, "-blank-" unless $LVL < 4;
-
 
89
    push @options, $LVL < 4 ? grep { $ORCUSER->{department}->{$_} >= 2 } sort keys %{$ORCUSER->{department}} : sort keys %{$DepartmentNames};
-
 
90
    
-
 
91
    @options = map { $FORM{"filter-department"} eq $_ ?
-
 
92
                       ( $h->option ({ selected=>[], value=>$_ }, $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) ) :
-
 
93
                       ( $h->option ({ value=>$_ },               $_ eq "-blank-" ? $_ : $DepartmentNames->{$_}) )  } @options;
-
 
94
    
-
 
95
    return $FORM{autoload} ? $h->select ({ name=>"filter-department", onChange=>"page.value = 1; submit();" }, [@options]) : $h->select ({ name=>"filter-department" }, [$h->option (), @options]);
-
 
96
  }
-
 
97
}
-
 
98
 
-
 
99
sub filter_access {
-
 
100
  my $colName = shift;
-
 
101
  my $filter = shift // "";
-
 
102
  
-
 
103
	if ($filter ne "")	{
-
 
104
		return $filter eq "-1" ? "$colName = $filter" : "($colName = $filter or department like '%$filter%')";
-
 
105
	} else {
-
 
106
    my @options = ("", -1, 0, 1, 2, 3, 4, 5);
-
 
107
    
-
 
108
    @options = map { $FORM{"filter-access"} eq $_ ?
-
 
109
                       ( $h->option ({ selected=>[], value=>$_ }, $ROLE->{$_}) ) :
-
 
110
                       ( $h->option ({ value=>$_ },               $ROLE->{$_}) )  } @options;
-
 
111
    
-
 
112
    return $FORM{autoload} ? $h->select ({ name=>"filter-access", onChange=>"page.value = 1; submit();" }, [@options]) : $h->select ({ name=>"filter-access" }, [$h->option (), @options]);
-
 
113
  }
-
 
114
}
-
 
115
 
-
 
116
# Ideally, nothing below this comment needs to change
-
 
117
#-------------------------------------------------------------------------------
-
 
118
 
-
 
119
 
23
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
120
our %NAME              = map  { $_ => $COLUMNS{$_}->[0] } keys %COLUMNS;
-
 
121
our %colOrderHash      = map  { $_ => $COLUMNS{$_}->[1] } keys %COLUMNS;
-
 
122
our %colFilterTypeHash = map  { $_ => $COLUMNS{$_}->[2] } keys %COLUMNS;
-
 
123
our @staticFields      = sort byfield grep { $COLUMNS{$_}->[3] eq 'static' } keys %COLUMNS;
24
 
124
our @defaultFields     = sort byfield grep { defined $COLUMNS{$_}->[3] } keys %COLUMNS;
25
our $DBTABLE = 'official';
125
#our @defaultFields     = grep { $COLUMNS{$_}->[3] eq 'default' or inArray ($_, \@staticFields) } keys %COLUMNS;
26
our @allFields = (qw(RCid derby_name email real_name level phone type access clinic_pass));
-
 
27
our @defaultFields = (qw(RCid derby_name email real_name level phone type access clinic_pass));
126
 
28
our @displayFields = ();
-
 
29
our @hideFields = ();
-
 
30
our %NAME = (
-
 
31
	"RCid" => "ID",
-
 
32
	"derby_name" => "Derby Name",
-
 
33
	email => EMail,
-
 
34
	real_name => "Real Name",
-
 
35
	level => Level,
-
 
36
	phone => Phone,
127
our @allFields = sort byfield keys %NAME;
37
	type => Type,
-
 
38
	access => "Role",
-
 
39
	clinic_pass => "Clinic Pass"
-
 
40
	);
-
 
41
our %colOrderHash = (
-
 
42
	"RCid" => 5,
-
 
43
	access => 7,
-
 
44
	"derby_name" => 10,
-
 
45
	real_name => 15,
-
 
46
	email => 20,
-
 
47
	phone => 25,
-
 
48
	level => 30,
128
our @displayFields = ();
49
	type => 35,
-
 
50
	clinic_pass => 40,
-
 
51
		);
-
 
52
our %colFilterTypeHash = qw(
-
 
53
	RCid  number
-
 
54
	derby_name  text
-
 
55
	email  text
-
 
56
	real_name  text
-
 
57
	level  select
-
 
58
	phone  text
-
 
59
	type  select
129
our @hideFields = ();
Line -... Line 130...
-
 
130
my $QUERY_STRING;
-
 
131
 
-
 
132
my $pagelimit = param ("limit") // $pagelimitoptions[$#pagelimitoptions];
-
 
133
my $curpage = param ("page") // 1;
-
 
134
 
-
 
135
our %FORM;
-
 
136
my $FILTER;
Line 60... Line -...
60
	access  select
-
 
61
	clinic_pass select
-
 
62
		);
137
foreach (param()) {
Line 63... Line 138...
63
my %ROLE = ( qw(-1 Locked 0 None 1 User 2 Lead 3 Manager 4 Admin));
138
 	if (/^year$/) { #
64
 
-
 
65
 
139
		$YEAR = param($_);
66
foreach (param())
-
 
67
{
140
		next;
68
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
-
 
69
	
141
	}
70
	if ((/^filter/) and ($FORM{$_} ne ''))		# Build a set of filters to apply
142
 
71
		{		
143
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
Line 72... Line 144...
72
		my ($filter,$field) = split /-/, $_;
144
	
73
		
145
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
74
		$FILTER->{$field} = $FORM{$_};
146
		my ($filter,$field) = split /-/, $_;		
75
		}
-
 
76
	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
-
 
77
		{ push @displayFields, $_; }			# @displayFields is declared in scanFunctions.pm
-
 
78
}
147
		$FILTER->{$field} = $FORM{$_};
79
 
-
 
Line 80... Line 148...
80
 
148
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
81
if (exists $FORM{autoload})				# If the FORM was submitted (i.e. the page is being redisplayed),
149
		{ push @displayFields, $_; }
Line 82... Line 150...
82
{							#	build the data for the cookie that remembers the page setup
150
}
83
	my $disFields = join ":", @displayFields;
-
 
84
	my @filters;
151
 
85
	my @f = keys %{$FILTER};
-
 
86
	foreach $key (@f)
152
 
87
		{ push @filters, "$key=$FILTER->{$key}"; }
153
if (exists $FORM{autoload})	{			# If the FORM was submitted (i.e. the page is being redisplayed),
Line 88... Line 154...
88
	my $fils = join ":", @filters;
154
							                    #  	build the data for the cookie that remembers the page setup
89
		
-
 
90
	$QUERY_STRING = "$disFields\&$fils\&$FORM{autoload}";
155
	my $disFields = join ":", @displayFields;
91
}
156
	my $fils = join ":", map { "$_=$FILTER->{$_}" } keys %{$FILTER};
92
 
157
		
93
 
158
	$QUERY_STRING = $disFields.'&'.$fils.'&'.$FORM{sortby}.'&'.$FORM{autoload};
Line -... Line 159...
-
 
159
}
94
if (!(exists $FORM{autoload}))				# No FORM was submitted, suppply a default list of columns
160
 
95
{
161
 
96
	if (my $prefs = cookie('RCUserReport'))	# Has this user been here before and saved a cookie?
-
 
97
	{
162
if (!(exists $FORM{autoload}))	{			# No FORM was submitted...
98
		my ($disF, $filts, $al) = split /&/,$prefs;
163
	if (my $prefs = cookie ($prefscookie) and !defined param ("ignoreCookie"))	{ # Check for cookies from previous visits.
99
		@displayFields = split /:/,$disF;
-
 
100
		
-
 
101
		foreach $pair (split /:/, $filts)
-
 
102
		{
164
		my ($disF, $filts, $sb, $al) = split /&/,$prefs;
103
			my ($key, $value) = split /=/, $pair;
-
 
104
			$FORM{"filter-$key"} = $value;
-
 
105
			$FILTER->{$key} = $value;
-
 
106
		}
-
 
107
		
-
 
108
		$FORM{autoload} = $al;
-
 
109
		$QUERY_STRING = $prefs;
-
 
110
	}
-
 
111
	else
-
 
112
		{ @displayFields = @defaultFields; }
-
 
113
}
-
 
114
 
-
 
115
 
-
 
116
							# Build the field lists to display and hide columns.
-
 
117
							#	If the field isn't in the displayFields list,
-
 
118
							#	then add it to the hideFields list.
-
 
119
							#
-
 
120
@displayFields = sort byfield @displayFields;
165
		@displayFields = split /:/,$disF;
121
foreach $field (@allFields) { if (! &inArray($field, \@displayFields)) { push @hideFields, $field; } }
166
		
Line 122... Line 167...
122
 
167
		foreach my $pair (split /:/, $filts)	{
123
 
-
 
124
my @whereClause = ();					# Process the filters to build the components of the where clause
-
 
125
foreach $field (@allFields)
168
			my ($key, $value) = split /=/, $pair;
126
{
-
 
Line -... Line 169...
-
 
169
			$FORM{"filter-$key"} = $value;
-
 
170
			$FILTER->{$key} = $value;
Line 127... Line -...
127
	if (! &inArray($field, \@hideFields))
-
 
128
	{
-
 
129
		if (defined $FILTER->{$field})
171
		}
130
		{
172
		
-
 
173
		$FORM{sortby} = $sb;
131
			push @whereClause, &generica($field, $FILTER->{$field});
174
		$FORM{autoload} = $al;
132
			delete $FILTER->{$field};
175
		$QUERY_STRING = $prefs;
133
		}
176
	}	else {
134
	}
-
 
135
}
177
	  @displayFields = @defaultFields; # Otherwise suppply a default list of columns.
-
 
178
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
136
 
179
	} 
137
							#  Given the fields to display and the where conditions,
180
}
138
							#	"getData" will return a reference to an array of
-
 
139
							#	hash references of the results.
-
 
140
my @ProductList = @{&getData(\@displayFields, \@whereClause, $DBTABLE)};
181
 
Line 141... Line -...
141
my $x = scalar @ProductList;
-
 
142
 
-
 
143
 
-
 
144
if ($FORM{excel})
-
 
145
{
-
 
146
	my $date = `date +"%m%d%y%H%M%S"`; chomp $date;
-
 
147
	$filename = `dirname $ENV{REQUEST_URI}`; chomp $filename; $filename .= "/xls/${date}_$$.xls";
-
 
148
	
-
 
149
        # Create a new Excel workbook
-
 
150
	my $workbook = Spreadsheet::WriteExcel->new("/home/rollerco/officials.rollercon.com${filename}");
-
 
151
	
-
 
152
        # Add a worksheet
-
 
153
        my $worksheet = $workbook->add_worksheet();
-
 
154
        
-
 
155
#	open my $fh, '>', \my $str or die "Failed to open filehandle: $!";
-
 
156
#	my $workbook  = Spreadsheet::WriteExcel->new($fh);
-
 
157
#	my $worksheet = $workbook->add_worksheet();
-
 
158
 
-
 
159
	
-
 
160
	my $format = $workbook->add_format();
-
 
161
	$format->set_bold();
-
 
162
	
-
 
Line -... Line 182...
-
 
182
# let's just make sure the columns are in the right order (and there aren't any missing)
-
 
183
@displayFields = sort byfield uniq @displayFields, @staticFields;
-
 
184
 
-
 
185
# If the field isn't in the displayFields list,	then add it to the hideFields list
-
 
186
@hideFields = grep { notInArray ($_, \@displayFields) } @allFields;
-
 
187
 
-
 
188
# Process any filters provided in the form to pass to the database
-
 
189
my @whereClause = map { filter ($_, $FILTER->{$_}) } grep { defined $FILTER->{$_} } @displayFields;
-
 
190
#warn @whereClause;
-
 
191
if ($LVL < 4) {
-
 
192
  warn keys %{$ORCUSER->{department}};
-
 
193
  my $string = join " or ", map { 'department like "%'.$_.'%"' } grep { $ORCUSER->{department}->{$_} >= 2 } keys %{$ORCUSER->{department}};
-
 
194
  $string = "($string)";
163
	my $col = $row = 0;
195
  warn $string;
Line -... Line 196...
-
 
196
  push @whereClause, $string;
Line 164... Line -...
164
	
-
 
-
 
197
}
165
	foreach $f (@displayFields)
198
#push @whereClause, "year(date) = '$YEAR'";
166
		{ $worksheet->write($row, $col++, "$NAME{$f}", $format); }
199
 
167
	
200
 
168
	foreach $t (sort @ProductList)			# Unt now we print the tickets!
201
							#  Given the fields to display and the where conditions,
169
	{
202
							#	  "getData" will return a reference to an array of
170
		$col = 0;
-
 
171
		$row++;
-
 
172
		foreach $f (@displayFields)
-
 
173
			{
-
 
174
				$f =~ s/^HOST\.//;
-
 
Line -... Line 203...
-
 
203
							#	  hash references of the results.
-
 
204
my ($data, $datacount) = getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit);
Line 175... Line 205...
175
				$f =~ s/^FRAME\.//;
205
my @ProductList = @{ $data };
176
				$t->{$f} =~ s/<br>/\n/ig; $worksheet->write($row, $col++, "$t->{$f}");
206
 
177
			}
207
#my @ProductList = @{ getData (\@displayFields, \@whereClause, $DBTABLE, $FORM{sortby}, $curpage, $pagelimit) };
178
	}
208
my $x = scalar @ProductList; # How many results were returned?
179
	
209
 
180
	$workbook->close();
210
# If the user is trying to download the Excel file, send it to them and then exit out.
181
 
211
if ($FORM{excel}) {
182
}
212
  exportExcel (\@ProductList, "RC_Officiating_Shifts");
183
 
213
  exit;
184
 
214
}
Line 210... Line 240...
210
# 	print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
240
# 	print "\n\n\n\n<!-- $QUERY_STRING --> \n\n\n\n";
Line 211... Line 241...
211
 
241
 
Line -... Line 242...
-
 
242
 
-
 
243
#------------------
-
 
244
 
-
 
245
# Toggle the autoload fields within the table elements 
-
 
246
our ($onClick, $onChange);   # (also used in scanFunctions)
-
 
247
my ($radiobutton, $refreshbutton, $sortby);
-
 
248
if ($FORM{autoload}) {					  
-
 
249
	$onClick = "onClick='submit();'";
-
 
250
	$onChange = "onChange='page.value = 1; submit();'";
-
 
251
  $radiobutton = $h->div ({ class=>'autoload' },
-
 
252
    ["Autoload Changes: ",
-
 
253
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
-
 
254
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
-
 
255
    ]);
-
 
256
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
-
 
257
} else {
-
 
258
  $onClick = "";
-
 
259
	$onChange = "onChange='page.value = 1;'";
-
 
260
  $radiobutton = $h->div ({ class=>'autoload' }, 
-
 
261
    ["Autoload Changes: ",
-
 
262
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();' }), "On ", 
-
 
263
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();', checked=>[] }), "Off ",
-
 
264
    ]);
Line 212... Line -...
212
 
-
 
213
#------------------
-
 
214
 
-
 
215
 
-
 
216
if ($FORM{autoload})					  # Toggle the autoload fields within the table elements
-
 
217
	{ $auto = "onClick='submit();'";
-
 
218
	 $auto2 = "onChange='submit();'"; }
-
 
219
else
-
 
220
	{ $auto = "";
-
 
221
	 $auto2 = ""; }
-
 
222
 
-
 
223
 
-
 
224
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.";
-
 
225
my $xlsLink = $filename ? "&nbsp; &nbsp; <A href='$filename'><FONT color='#0077BD'>Download Now.</FONT></a>" : "";
-
 
226
 
-
 
227
print<<header;
-
 
228
	<html><head><title>Officiating RollerCon  - User Report</title></head>
-
 
229
	<body text="#000000" bgcolor="#FFFFFF" link="#000000" vlink="#000000" alink="#FF0000">
-
 
230
	<form action="user_report.pl" method=POST name=Req>
-
 
231
	<input type=hidden name=excel value=0>
-
 
232
	
-
 
233
	<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
-
 
234
		<TR>
-
 
235
			<TD>
-
 
236
			<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
-
 
237
				<TR>
-
 
238
					<TD width=610 bgcolor="#0077BD" height=60><FONT color=white face=verdana size=6><i><strong>&nbsp;ORC User Report</strong></i></font></TD>
-
 
239
					<TD><img SRC="/images/headerblank.gif" NOSAVE height=38 width=165></TD>
-
 
240
				</TR>
-
 
241
			</TABLE>
-
 
242
			</TD>
-
 
243
		<TR>
-
 
244
			<TD>&nbsp</TD>
-
 
245
		</TR>
-
 
246
		<TR>
-
 
247
			<TD>
-
 
248
			<TABLE cellpadding=0 cellspacing=0 hspace=0 vspace=0 border=0>
-
 
249
				<TR>
-
 
250
					<TD rowspan=2 align=left width=610>
-
 
251
					<TABLE border=0 cellspacing=0>
-
 
252
header
-
 
253
 
-
 
254
							# Print the Hidden fields' check boxes
-
 
255
 
-
 
256
					my $tc = 1;
-
 
257
					foreach $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields)
-
 
258
						{
-
 
259
						if ($tc == 1)
-
 
260
							{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++;}
-
 
261
						elsif ($tc == 4)
-
 
262
							{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;}
-
 
263
						else 
-
 
264
							{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++;}
-
 
265
						}
-
 
266
 
-
 
267
 					if ($FORM{autoload}) 
-
 
268
 						{
-
 
269
 						$trueChecked = "checked";
-
 
270
 						$falseChecked = "";
-
 
271
 						}
-
 
272
 					else 
-
 
273
 						{
-
 
274
 						$trueChecked = "";
-
 
275
 						$falseChecked = "checked";
-
 
276
 	 					}
-
 
277
 
-
 
278
					print<<header3;
-
 
279
						<TR>
-
 
280
							<TD colspan=4 align=center><FONT face=verdana size=1 color=#0077BD><B>
-
 
281
							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
-
 
282
							</TD>
-
 
283
						</TR>
-
 
284
					</TABLE>
-
 
285
					</TD>
-
 
286
					<TD nowrap>
-
 
287
						<A HREF='' onClick="window.document.Req.submit(); return false;"><IMG SRC='/images/refresh.button.gif' border=0></A><br>
-
 
288
						<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>
-
 
289
					</TD>
-
 
290
				</TR>
-
 
291
				<TR>
-
 
292
					<TD align=left><B><FONT face=verdana size=1>$signedOnAs<br>
-
 
293
					Display <A HREF='' onClick="window.document.Req.method = 'GET'; window.document.Req.submit(); return false;">Full URL</a> : <a href=/schedule/>[Go HOME]</a></TD>
-
 
294
				</TR>
-
 
295
 
-
 
296
			</TABLE>
-
 
297
			</TD>
-
 
298
		</TR>
-
 
299
		<TR>
-
 
300
			<TD>&nbsp</TD>
-
 
301
		</TR>
-
 
302
		<TR>
-
 
303
			<TD>
-
 
304
			<TABLE border=0 cellspacing=2 cellpadding=4 width=100\%>
-
 
305
				<TR bgcolor=#0077BD>
-
 
306
header3
-
 
307
 
-
 
308
							# Print the Column headings
-
 
309
				foreach $f (@displayFields)
-
 
310
					{ 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"; }
-
 
311
 
-
 
312
				print "\t\t\t\t</TR>\n\t\t\t\t<TR>\n";
-
 
313
							# and now the filter boxes
-
 
314
							
-
 
315
				foreach $f (@displayFields)
-
 
316
					{
-
 
317
					print "\t\t\t\t\t<TD align=left bgcolor=#E6E6E6><FONT size=1 face=verdana>";
-
 
318
					print &generica($f);
-
 
319
#					print "&nbsp;";
-
 
320
					print "</TD>\n";
-
 
321
					}
-
 
322
				print "\t\t\t\t</TR></FORM>\n";
-
 
323
 
-
 
324
				my $cw = scalar @displayFields;
-
 
325
 
-
 
326
				print<<header2;
-
 
327
				</TR>
-
 
Line -... Line 265...
-
 
265
  $refreshbutton = $h->input ({ type=>"button", value=>"Apply Changes", onClick=>"submit(); return false;" });
328
				<TR>
266
  $sortby = $h->select ({name=>"sortby" }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
Line -... Line 267...
-
 
267
}
329
					<TD colspan=$cw><P><P></TD>
268
 
-
 
269
 
-
 
270
 
-
 
271
	 
-
 
272
print start_html (-title => $pageTitle, -style => {'src' => $stylesheet} );
-
 
273
 
-
 
274
print $h->open ('form', { action=>url, method=>'POST', name=>'Req' });
-
 
275
print $h->input ({ type=>"hidden", name=>"excel", value=>0 });
-
 
276
print $h->div ({ class => "accent pageheader" }, [
-
 
277
  $h->h1 ($pageTitle),
-
 
278
  $h->div ({ class=>"sp0" }, [
-
 
279
    $h->div ({ class=>"spLeft" }, [
-
 
280
      $radiobutton
330
				</TR>
281
    ]),
-
 
282
    $h->div ({ class=>"spRight" }, [
331
header2
283
      $h->input ({ type=>"button", value=>"Home", onClick=>"window.location.href='$homeURL'" }),
332
 
284
      $refreshbutton
333
 
285
    ]),
334
my $co = '#FFFFFF';
286
  ]),
-
 
287
]);
335
 
288
 
336
foreach $t (@ProductList)			# Unt now we print the tickets!
289
# Print the Hidden fields' check boxes (if there are any)
337
{
290
 
338
	
291
my $c = 1;
339
	print "\t\t\t\t<TR>\n";
292
my @hiddencheckboxes;
340
	foreach $f (@displayFields)
293
my @hiddenrows;
-
 
294
foreach my $field (sort { $NAME{$a} cmp $NAME{$b}; } @hideFields) {
341
		{
295
  if ($FORM{autoload}) {
342
			if ($f eq "access")	{ 
-
 
343
				$t->{$f} = $ROLE{$t->{$f}};
296
    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} ]);
-
 
297
  } else {
344
			} elsif ($f eq "RCid") {
298
    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 299...
-
 
299
  }
345
				$t->{$f} = "<a href=/schedule/manage_user.pl?RCid=$t->{$f}&submit=View>$t->{$f}</a>";
300
  if ($c++ % 4 == 0) {
346
			}
301
    push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]);
347
			$f =~ s/^HOST\.//;
-
 
-
 
302
    @hiddencheckboxes = [];
348
			$f =~ s/^FRAME\.//;
303
  }
349
			print "\t\t\t\t\t<TD align=left valign=top bgcolor='$co'><FONT face=verdana size=1>".$t->{$f}."&nbsp</TD>\n";
304
}
-
 
305
push @hiddenrows, $h->div ({ class=>'rTableRow' }, [ @hiddencheckboxes ]) unless --$c % 4 == 0;
-
 
306
 
-
 
307
 
-
 
308
if (scalar @hideFields) {
-
 
309
  my @topleft;
-
 
310
  push @topleft, $h->div ({ class=>"nowrap" }, "Hidden Columns:");
350
		}
311
  push @topleft, $h->div ({ class=>'rTable' }, [ @hiddenrows ]);
Line 351... Line -...
351
	print "\t\t\t\t</TR>\n";
-
 
352
 
-
 
353
	if ($co eq '#FFFFFF')
-
 
354
		{ $co = '#F9F9F9'; }
-
 
355
	else
-
 
356
		{ $co = '#FFFFFF'; }
-
 
357
	
-
 
358
}
-
 
359
 
312
  
360
print<<tail;
-
 
Line 361... Line 313...
361
			</TABLE>
313
  print $h->div ({ class=>"sp0" }, [
362
			</TD>
-
 
Line 363... Line 314...
363
		</TR>
314
    $h->div ({ class=>"spLeft"  }, [ @topleft ]),
364
	</TABLE>
-
 
365
	<br><br>
315
    $h->div ({ class=>"spRight" }, [
366
	<FONT face=verdana size=2><B>$x Record(s) Displayed</font>
316
      $signedOnAs
367
	<BR><BR>
317
    ])
-
 
318
  ]);
368
	<FONT face=verdana size=1><B>This page was displayed on $now<BR>
319
}
-
 
320
 
369
	Please direct questions, problems, and concerns to <FONT face=verdana color=#0077BD>officials.rollercon.schedule\@gmail.com</FONT>
321
# Print the main table...............................................
-
 
322
 
-
 
323
print $h->open ('div', { class=>'rTable' });
370
 
324
 
-
 
325
my @tmptitlerow;
Line 371... Line 326...
371
	<SCRIPT language="JavaScript">
326
foreach my $f (@displayFields)	{  # Print the Column headings
372
	<!--
327
  if (inArray ($f, \@staticFields)) {
373
 
-
 
-
 
328
    push @tmptitlerow, $h->div ({ class=>'rTableHead' }, [ $h->input ({ type=>"hidden", name=>$f, value=>"true" }), $NAME{$f} ]);
374
	var ticket_window, severity_window, user_window;
329
  } else {
375
	
330
    if ($FORM{autoload}) {
-
 
331
      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} ]);
376
	function NewWindow () {
332
    } else {
377
		if ((ticket_window == null) || (ticket_window.closed == true))
333
      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} ]);      
378
			ticket_window = open(\"\",\"Details\",\"width=650,height=650,menubar,scrollbars,resizable\");
334
    }
-
 
335
  }
379
		ticket_window.focus();
336
}
-
 
337
 
380
		return true;
338
# Print the filter boxes...
-
 
339
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
-
 
340
 
-
 
341
# Print the things
-
 
342
foreach my $t (@ProductList)	{
381
		}
343
  print $h->div ({ class=>'rTableRow shaded', onclick=>"location.href='manage_user.pl?RCid=$t->{RCid}'" }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
382
 
344
}
-
 
345
 
-
 
346
print $h->close ('div');
-
 
347
 
-
 
348
# close things out................................................
-
 
349
 
-
 
350
my $pages = $pagelimit eq "All" ? 1 : int( $datacount / $pagelimit + 0.99 );
383
	function SevWindow () {
351
if ($curpage > $pages) { $curpage = $pages; }
-
 
352
 
Line -... Line 353...
-
 
353
my @pagerange;
-
 
354
if ($pages <= 5 ) {
-
 
355
  @pagerange = 1 .. $pages;
-
 
356
} else {  
-
 
357
  if ($curpage <= 3) {
-
 
358
    @pagerange = (1, 2, 3, 4, ">>");
-
 
359
  } elsif ($curpage >= $pages - 2) {
-
 
360
    @pagerange = ("<<", $pages-3, $pages-2, $pages-1, $pages);
-
 
361
  } else {
-
 
362
    @pagerange = ("<<", $curpage-1, $curpage, $curpage+1, ">>");
-
 
363
  }
-
 
364
}
-
 
365
 
-
 
366
print $h->br; # print $h->br;
-
 
367
print $h->div ({ class=>"sp0" }, [
-
 
368
    $h->div ({ class=>"spLeft" }, [
-
 
369
      $h->div ({ class=>"footer" }, [
-
 
370
        "To bookmark, save, or send this exact view, use the ",
-
 
371
        $h->a ({ href=>'', onClick=>"window.document.Req.method = 'GET'; Req.submit(); return false;" }, "[Full URL]"),
-
 
372
        $h->br,
-
 
373
        "If this page is displaying oddly, ", $h->a ({ href=>url ()."?ignoreCookie=1" }, "[Reset Your View]"),
-
 
374
        $h->br,
-
 
375
        $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.]"),
-
 
376
        $h->br,
-
 
377
        "This page was displayed on ", currentTime (),
-
 
378
        $h->br,
-
 
379
        "Please direct questions, problems, and concerns to noone\@gmail.com"
-
 
380
      ])
-
 
381
    ]),
-
 
382
    $h->div ({ class=>"spRight" }, [
-
 
383
      $h->h5 ([
-
 
384
               "$x of $datacount Record". ($x == 1 ? "" : "s") ." Displayed", $h->br,               
-
 
385
               "Sorted by ", $sortby, $h->br,
-
 
386
               "Displaying ", $h->select ({ name=>"limit", onChange=>"page.value = 1; submit();" }, [ map { $pagelimit == $_ ? $h->option ({ selected=>[] }, $_) : $h->option ($_) } @pagelimitoptions ]), " Per Page", $h->br,
-
 
387
               ( $pages > 1 ? ( join " ", map { $_ == $curpage ? "<B>$_</b>" :
384
		if ((severity_window == null) || (severity_window.closed == true))
388
                                                $_ eq "<<"     ? $h->a ({ onClick=>qq{Req.page.value=1; Req.submit();} }, "$_") :
-
 
389
                                                $_ eq ">>"     ? $h->a ({ onClick=>qq{Req.page.value=$pages; Req.submit();} }, "$_") :
385
			severity_window = open(\"\",\"SevDetails\",\"width=500,height=300,menubar\");
390
                                                                 $h->a ({ onClick=>qq{Req.page.value=$_; Req.submit();} }, "[$_]") } @pagerange ) : "" ), $h->br,
-
 
391
               $h->input ({ type=>"hidden", name=>"page", value=>$curpage })
-
 
392
      ])
Line 386... Line -...
386
		severity_window.focus();
-
 
Line -... Line 393...
-
 
393
    ]),
-
 
394
]);
387
		return true;
395