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 28... Line 34...
28
	print $h->a ({ href=>"/schedule/" }, "[Go Home]");
34
	print $h->a ({ href=>"/schedule/" }, "[Go Home]");
29
	print $h->close ("html");
35
	print $h->close ("html");
30
	exit;	
36
	exit;	
31
}
37
}
Line 32... Line 38...
32
 
38
 
33
my $username = $h->a ({ href=>"/schedule/manage_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
39
my $username = $h->a ({ href=>"/schedule/view_user.pl?submit=View&RCid=$user->{RCid}" }, $user->{derby_name});
34
my $RCid = $user->{RCid};
40
my $RCid = $user->{RCid};
35
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
41
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
36
#my $YEAR = 1900 + (localtime)[5]; #which year of data to display, default to current
42
#my $YEAR = 1900 + (localtime)[5]; #which year of data to display, default to current
Line 154... Line 160...
154
 
160
 
Line 155... Line 161...
155
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
161
	$FORM{$_} = param($_);				# Retrieve all of the FORM data submitted
156
	
162
	
157
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
163
	if ((/^filter/) and ($FORM{$_} ne '')) {	# Build a set of filters to apply
158
		my ($filter,$field) = split /-/, $_;		
164
		my ($filter,$field) = split /-/, $_;		
159
		$FILTER->{$field} = $FORM{$_};
165
		$FILTER->{$field} = $FORM{$_} unless notInArray ($field, \@allFields);
160
	}	elsif ($FORM{$_} eq "true")	{		# Compile list of fields to display
166
	}	elsif ($FORM{$_} eq "true")	{		# Compile list of fields to display
161
	  if ($_ ne "shiftinclude") {
167
	  if ($_ ne "shiftinclude") {
162
		  push @displayFields, $_;
168
		  push @displayFields, $_;
Line 195... Line 201...
195
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
201
	  $FORM{autoload} = 1;             # And turn aut0load on by default.
196
	} 
202
	} 
197
}
203
}
Line 198... Line 204...
198
 
204
 
199
# let's just make sure the columns are in the right order (and there aren't any missing)
205
# let's just make sure the columns are in the right order (and there aren't any missing)
Line 200... Line 206...
200
@displayFields = sort byfield uniq @displayFields, @staticFields;
206
@displayFields = grep { inArray($_, \@allFields) } sort byfield uniq @displayFields, @staticFields;
201
 
207
 
Line 202... Line 208...
202
# If the field isn't in the displayFields list,	then add it to the hideFields list
208
# If the field isn't in the displayFields list,	then add it to the hideFields list
Line 268... Line 274...
268
  $radiobutton = $h->div ({ class=>'autoload' },
274
  $radiobutton = $h->div ({ class=>'autoload' },
269
    ["Autoload Changes: ",
275
    ["Autoload Changes: ",
270
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
276
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>1, onClick=>'submit();', checked=>[] }), "On ", 
271
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
277
    $h->input ({ type=>"radio", name=>'autoload', class=>'accent', value=>0, onClick=>'submit();' }), "Off ",
272
    ]);
278
    ]);
-
 
279
  $refreshbutton = "";
273
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
280
  $sortby = $h->select ({name=>"sortby", onChange=>'submit();' }, [ map { $FORM{sortby} eq $_ ? $h->option ({ value=>$_, selected=>[] }, $NAME{$_}) : $h->option ({ value=>$_ }, $NAME{$_}) } @displayFields ]);
274
} else {
281
} else {
275
  $onClick = "";
282
  $onClick = "";
276
	$onChange = "onChange='page.value = 1;'";
283
	$onChange = "onChange='page.value = 1;'";
277
  $radiobutton = $h->div ({ class=>'autoload' }, 
284
  $radiobutton = $h->div ({ class=>'autoload' }, 
Line 340... Line 347...
340
  print $h->div ({ class=>"sp0" }, [
347
  print $h->div ({ class=>"sp0" }, [
341
    $h->div ({ class=>"spLeft"  }, [ @topleft ]),
348
    $h->div ({ class=>"spLeft"  }, [ @topleft ]),
342
    $h->div ({ class=>"spRight" }, [
349
    $h->div ({ class=>"spRight" }, [
343
      $signedOnAs, $h->br,
350
      $signedOnAs, $h->br,
344
      "Show my shifts: ", $SIChecked, $h->br,
351
      "Show my shifts: ", $SIChecked, $h->br,
345
      $h->input ({ type=>"button", value=>"Block Personal Time", onClick=>"window.location.href='manage_personal_time.pl'" }),
352
      $h->input ({ type=>"button", value=>"Block Personal Time", onClick=>"window.location.href='personal_time.pl'" }),
346
    ])
353
    ])
347
  ]);
354
  ]);
348
}
355
}
Line 349... Line 356...
349
 
356
 
Line 368... Line 375...
368
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
375
print $h->div ({ class=>'rTableHeading' }, [ @tmptitlerow ], [ map { $h->div ({ class=>'rTableCell filters' }, filter ($_)) } @displayFields ], $h->div ({ class=>"rTableCell" }));
Line 369... Line 376...
369
 
376
 
370
 
377
 
371
if ($FORM{shiftinclude}) {  # Include all of the user's shifts at the top
378
if ($FORM{shiftinclude}) {  # Include all of the user's shifts at the top
372
  foreach my $t (@shifts)	{
379
  foreach my $t (@shifts)	{
373
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_}) } @displayFields ]);
380
	  print $h->div ({ class=>'rTableRow highlighted' }, [ map { $h->div ({ class=>'rTableCell' }, exists &{"modify_".$_} ? &{"modify_".$_} ($t) : $t->{$_} ? $t->{$_} : "") } @displayFields ]);
374
  }
381
  }