Subversion Repositories VORC

Rev

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

Rev 48 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 (5) || die;
19
my $cookie_string = authenticate (5) || 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 40... Line 46...
40
# If we need to modify line item values, create a subroutine named "modify_$columnname"
46
# If we need to modify line item values, create a subroutine named "modify_$columnname"
41
#    It will receive a hashref to the object lineitem
47
#    It will receive a hashref to the object lineitem
Line 42... Line 48...
42
 
48
 
43
sub modify_derby_name {
49
sub modify_derby_name {
44
  my $li = shift;
50
  my $li = shift;
45
  return $h->a ({ href=>"manage_user.pl?RCid=".getRCid ($li->{derby_name}) }, $li->{derby_name});
51
  return $h->a ({ href=>"view_user.pl?RCid=".getRCid ($li->{derby_name}) }, $li->{derby_name});
Line 46... Line 52...
46
}
52
}
47
 
53
 
Line 82... Line 88...
82
 
88
 
Line 83... Line 89...
83
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
89
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
84
	
90
	
85
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
91
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
86
		my ($filter,$field) = split /-/, $_;		
92
		my ($filter,$field) = split /-/, $_;		
87
		$FILTER->{$field} = $FORM{$_};
93
		$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
88
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
94
	}	elsif ($FORM{$_} eq "true")			# Compile list of fields to display
Line 118... Line 124...
118
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
124
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
119
	} 
125
	} 
120
}
126
}
Line 121... Line 127...
121
 
127
 
122
# let's just make sure the columns are in the right order (and there aren't any missing)
128
# let's just make sure the columns are in the right order (and there aren't any missing)
Line 123... Line 129...
123
@displayFields = sort byfield uniq @displayFields, @staticFields;
129
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
124
 
130
 
Line 125... Line 131...
125
# If the field isn't in the displayFields list,	then add it to the hideFields list
131
# If the field isn't in the displayFields list,	then add it to the hideFields list
Line 183... Line 189...
183
  $radiobutton = $h->div ({ class=>'autoload' },
189
  $radiobutton = $h->div ({ class=>'autoload' },
184
    ["Autoload Changes: ",
190
    ["Autoload Changes: ",
185
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
191
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
186
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
192
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
187
    ]);
193
    ]);
-
 
194
  $refreshbutton = "";
188
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
195
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
189
} else {
196
} else {
190
  $onClick = "";
197
  $onClick = "";
191
	$onChange = "onChange='page.value = 1;'";
198
	$onChange = "onChange='page.value = 1;'";
192
  $radiobutton = $h->div ({ class=>'autoload' }, 
199
  $radiobutton = $h->div ({ class=>'autoload' }, 
Line 271... Line 278...
271
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
278
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
Line 272... Line 279...
272
 
279
 
273
# Print the things
280
# Print the things
274
foreach my $t (@ProductList)	{
281
foreach my $t (@ProductList)	{
275
  no strict;
282
  no strict;
276
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
283
  print $h->div ({ class=>'rTableRow shaded' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);