Subversion Repositories VORC

Rev

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

Rev 53 Rev 56
Line 1... Line 1...
1
#!/usr/bin/perl
1
#!/usr/bin/perl
Line -... Line 2...
-
 
2
 
-
 
3
# Redirect error messages to a log of my choosing. (it's annoying to filter for errors in the shared env)
-
 
4
my $error_log_path = $ENV{SERVER_NAME} eq "volunteers.rollercon.com" ? "/home3/rollerco/logs/" : "/tmp/";
-
 
5
close STDERR;
-
 
6
open STDERR, '>>', $error_log_path.'vorc_error.log' or warn "Failed to open redirected logfile ($0): $!";
-
 
7
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
2
 
8
 
Line 3... Line 9...
3
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
9
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
4
 
10
 
5
#use strict;
11
#use strict;
Line 27... Line 33...
27
 
33
 
28
if ($secure) {
34
if ($secure) {
29
	$cookie_string = authenticate(2) || die;
35
	$cookie_string = authenticate(2) || die;
30
	($EML, $PWD, $LVL) = split /&/, $cookie_string;
36
	($EML, $PWD, $LVL) = split /&/, $cookie_string;
31
	$user = getUser($EML);
37
	$user = getUser($EML);
32
	$username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
38
	$username = $h->a ({ href=>"/schedule/view_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
33
	$RCid = $user->{RCid};
39
	$RCid = $user->{RCid};
34
	$RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
40
	$RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
Line 117... Line 123...
117
 
123
 
Line 118... Line 124...
118
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
124
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
119
	
125
	
120
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
126
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
121
		my ($filter,$field) = split /-/, $_;		
127
		my ($filter,$field) = split /-/, $_;		
122
		$FILTER->{$field} = $FORM{$_};
128
		$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
123
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
129
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
Line 124... Line 130...
124
		{ push @displayFields, $_; }
130
		{ push @displayFields, $_; }
Line 158... Line 164...
158
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
164
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
159
	} 
165
	} 
160
}
166
}
Line 161... Line 167...
161
 
167
 
162
# let's just make sure the columns are in the right order (and there aren't any missing)
168
# let's just make sure the columns are in the right order (and there aren't any missing)
Line 163... Line 169...
163
@displayFields = sort byfield uniq @displayFields, @staticFields;
169
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
164
 
170
 
Line 165... Line 171...
165
# If the field isn't in the displayFields list,	then add it to the hideFields list
171
# If the field isn't in the displayFields list,	then add it to the hideFields list
Line 227... Line 233...
227
  $radiobutton = $h->div ({ class=>'autoload' },
233
  $radiobutton = $h->div ({ class=>'autoload' },
228
    ["Autoload Changes: ",
234
    ["Autoload Changes: ",
229
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
235
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
230
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
236
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
231
    ]);
237
    ]);
-
 
238
  $refreshbutton = "";
232
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
239
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
233
} else {
240
} else {
234
  $onClick = "";
241
  $onClick = "";
235
	$onChange = "onChange='page.value = 1;'";
242
	$onChange = "onChange='page.value = 1;'";
236
  $radiobutton = $h->div ({ class=>'autoload' }, 
243
  $radiobutton = $h->div ({ class=>'autoload' }, 
Line 314... Line 321...
314
# Print the filter boxes...
321
# Print the filter boxes...
315
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
322
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
Line 316... Line 323...
316
 
323
 
317
# Print the things
324
# Print the things
318
foreach my $t (@ProductList)	{
325
foreach my $t (@ProductList)	{
319
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
326
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);