Subversion Repositories VORC

Rev

Rev 196 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 bgadell 1
#!/usr/bin/perl
2
 
56 bgadell 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";
8
 
48 bgadell 9
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
10
 
196 - 11
use strict;
48 bgadell 12
use cPanelUserConfig;
13
use CGI qw/param cookie header start_html url/;
14
use HTML::Tiny;
15
use tableViewer;
16
use RollerCon;
17
our $h = HTML::Tiny->new( mode => 'html' );
18
 
19
my $cookie_string = authenticate (5) || die;
20
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
196 - 21
my $RCAUTH_cookie = CGI::Cookie-> new(-name=>'RCAUTH', -value=>"$cookie_string", -expires=>"+30m");
48 bgadell 22
 
23
my $pageTitle = "Volunteer Hours Year End Report";
24
our $DBTABLE = 'v_volhours_report';
25
my %COLUMNS = (
26
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
196 - 27
  derby_name  => [qw(DerbyName    20    text      static )],
28
  real_name  => [qw(RealName    25    text      static )],
29
  email       => [qw(Email   30    text      static )],
227 - 30
  tshirt       => [qw(TShirt   35    select      static )],
196 - 31
  totalhours      => [qw(TotalHours         40    number      static )]
48 bgadell 32
);
33
 
196 - 34
# Set any custom "where" DB filters here...
35
my @whereClause;
36
 
48 bgadell 37
# If we need to modify line item values, create a subroutine named "modify_$columnname"
38
#    It will receive a hashref to the object lineitem
39
 
40
sub modify_derby_name {
41
  my $li = shift;
56 bgadell 42
  return $h->a ({ href=>"view_user.pl?RCid=".getRCid ($li->{derby_name}) }, $li->{derby_name});
48 bgadell 43
}
44
 
196 - 45
my $DEPTS = getDepartments;
48 bgadell 46
sub modify_dept {
47
  my $hr = shift;
48
  return $DEPTS->{$hr->{dept}};
49
}
50
 
196 - 51
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
52
#    It will receive two fields, the field name and the current filter value (if any)
48 bgadell 53
 
196 - 54
# Uncomment and update if we want to enable clicking on a row to open a new page.
55
#
56
#sub addRowClick {
57
#  my $t = shift;
58
#  return "location.href='view_thing.pl?field=$t->{field}&choice=View'";
59
#}
48 bgadell 60
 
196 - 61
# Call the function to print the table view page (with available options)
62
printTablePage ({ Title   => $pageTitle,
63
                  Table   => $DBTABLE,
64
                  Columns => \%COLUMNS,
65
                  RCAuth  => $RCAUTH_cookie,
66
                  Where => join(" and ", @whereClause),
67
                  DisplayYearSelect => 1,
68
                 });