Subversion Repositories VORC

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