Subversion Repositories VORC

Rev

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

Rev 32 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 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
$user->{department} = convertDepartments ($user->{department});
22
$user->{department} = convertDepartments ($user->{department});
17
my $username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
23
my $username = $h->a ({ href=>"/schedule/view_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
18
my $RCid = $user->{RCid};
24
my $RCid = $user->{RCid};
19
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
25
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
Line 45... Line 51...
45
# If we need to modify line item values, create a subroutine named "modify_$columnname"
51
# If we need to modify line item values, create a subroutine named "modify_$columnname"
46
#    It will receive a hashref to the object lineitem
52
#    It will receive a hashref to the object lineitem
Line 47... Line 53...
47
 
53
 
48
sub modify_derby_name {
54
sub modify_derby_name {
49
  my $li = shift;
55
  my $li = shift;
50
  return $h->a ({ href=>"manage_user.pl?RCid=".getRCid ($li->{derby_name}) }, $li->{derby_name});
56
  return $h->a ({ href=>"view_user.pl?RCid=".getRCid ($li->{derby_name}) }, $li->{derby_name});
Line 51... Line 57...
51
}
57
}
52
 
58
 
Line 107... Line 113...
107
 
113
 
Line 108... Line 114...
108
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
114
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
109
	
115
	
110
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
116
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
111
		my ($filter,$field) = split /-/, $_;		
117
		my ($filter,$field) = split /-/, $_;		
112
		$FILTER->{$field} = $FORM{$_};
118
		$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
113
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
119
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
Line 143... Line 149...
143
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
149
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
144
	} 
150
	} 
145
}
151
}
Line 146... Line 152...
146
 
152
 
147
# let's just make sure the columns are in the right order (and there aren't any missing)
153
# let's just make sure the columns are in the right order (and there aren't any missing)
Line 148... Line 154...
148
@displayFields = sort byfield uniq @displayFields, @staticFields;
154
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
149
 
155
 
Line 150... Line 156...
150
# If the field isn't in the displayFields list,	then add it to the hideFields list
156
# If the field isn't in the displayFields list,	then add it to the hideFields list
Line 208... Line 214...
208
  $radiobutton = $h->div ({ class=>'autoload' },
214
  $radiobutton = $h->div ({ class=>'autoload' },
209
    ["Autoload Changes: ",
215
    ["Autoload Changes: ",
210
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
216
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
211
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
217
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
212
    ]);
218
    ]);
-
 
219
  $refreshbutton = "";
213
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
220
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
214
} else {
221
} else {
215
  $onClick = "";
222
  $onClick = "";
216
	$onChange = "onChange='page.value = 1;'";
223
	$onChange = "onChange='page.value = 1;'";
217
  $radiobutton = $h->div ({ class=>'autoload' }, 
224
  $radiobutton = $h->div ({ class=>'autoload' }, 
Line 296... Line 303...
296
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
303
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
Line 297... Line 304...
297
 
304
 
298
# Print the things
305
# Print the things
299
foreach my $t (@ProductList)	{
306
foreach my $t (@ProductList)	{
300
  no strict;
307
  no strict;
301
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
308
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);