| 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 11... |
Line 17... |
| 11 |
our $h = HTML::Tiny->new( mode => 'html' );
|
17 |
our $h = HTML::Tiny->new( mode => 'html' );
|
| Line 12... |
Line 18... |
| 12 |
|
18 |
|
| 13 |
my $cookie_string = authenticate (3) || die;
|
19 |
my $cookie_string = authenticate (3) || die;
|
| 14 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
20 |
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
|
| 15 |
my $user = getUser ($EML);
|
21 |
my $user = getUser ($EML);
|
| 16 |
my $username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
|
22 |
my $username = $h->a ({ href=>"/schedule/view_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
|
| 17 |
my $RCid = $user->{RCid};
|
23 |
my $RCid = $user->{RCid};
|
| 18 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
24 |
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
|
| Line 77... |
Line 83... |
| 77 |
|
83 |
|
| Line 78... |
Line 84... |
| 78 |
$FORM{$_} = param($_); # Retrieve all of the FORM data submitted
|
84 |
$FORM{$_} = param($_); # Retrieve all of the FORM data submitted
|
| 79 |
|
85 |
|
| 80 |
if ((/^filter/) and ($FORM{$_} ne '')) { # Build a set of filters to apply
|
86 |
if ((/^filter/) and ($FORM{$_} ne '')) { # Build a set of filters to apply
|
| 81 |
my ($filter,$field) = split /-/, $_;
|
87 |
my ($filter,$field) = split /-/, $_;
|
| 82 |
$FILTER->{$field} = $FORM{$_};
|
88 |
$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
|
| 83 |
} elsif ($FORM{$_} eq "true") # Compile list of fields to display
|
89 |
} elsif ($FORM{$_} eq "true") # Compile list of fields to display
|
| Line 113... |
Line 119... |
| 113 |
$FORM{autoload} = 1; # And turn aut0load on by default.
|
119 |
$FORM{autoload} = 1; # And turn aut0load on by default.
|
| 114 |
}
|
120 |
}
|
| 115 |
}
|
121 |
}
|
| Line 116... |
Line 122... |
| 116 |
|
122 |
|
| 117 |
# let's just make sure the columns are in the right order (and there aren't any missing)
|
123 |
# let's just make sure the columns are in the right order (and there aren't any missing)
|
| Line 118... |
Line 124... |
| 118 |
@displayFields = sort byfield uniq @displayFields, @staticFields;
|
124 |
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
|
| 119 |
|
125 |
|
| Line 120... |
Line 126... |
| 120 |
# If the field isn't in the displayFields list, then add it to the hideFields list
|
126 |
# If the field isn't in the displayFields list, then add it to the hideFields list
|
| Line 178... |
Line 184... |
| 178 |
$radiobutton = $h->div ({ class=>'autoload' },
|
184 |
$radiobutton = $h->div ({ class=>'autoload' },
|
| 179 |
["Autoload Changes: ",
|
185 |
["Autoload Changes: ",
|
| 180 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ",
|
186 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ",
|
| 181 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
|
187 |
$h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
|
| 182 |
]);
|
188 |
]);
|
| - |
|
189 |
$refreshbutton = "";
|
| 183 |
$sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
|
190 |
$sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
|
| 184 |
} else {
|
191 |
} else {
|
| 185 |
$onClick = "";
|
192 |
$onClick = "";
|
| 186 |
$onChange = "onChange='page.value = 1;'";
|
193 |
$onChange = "onChange='page.value = 1;'";
|
| 187 |
$radiobutton = $h->div ({ class=>'autoload' },
|
194 |
$radiobutton = $h->div ({ class=>'autoload' },
|
| Line 265... |
Line 272... |
| 265 |
# Print the filter boxes...
|
272 |
# Print the filter boxes...
|
| 266 |
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
|
273 |
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
|
| Line 267... |
Line 274... |
| 267 |
|
274 |
|
| 268 |
# Print the things
|
275 |
# Print the things
|
| - |
|
276 |
foreach my $t (@ProductList) {
|
| 269 |
foreach my $t (@ProductList) {
|
277 |
no strict;
|
| 270 |
print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
|
278 |
print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);
|