Subversion Repositories VORC

Rev

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

Rev Author Line No. Line
266 - 1
#!/usr/bin/perl
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";
8
 
9
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
10
 
11
use strict;
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 (RollerCon::USER) || die;
20
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
21
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
22
 
23
my $YEAR = 1900 + (localtime)[5];
24
my $pageTitle = "$YEAR Seminar Coaches";
25
our $DBTABLE = 'v_seminar_coaches_current';
26
my %COLUMNS = (
27
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
28
  derby_name  => [qw(DerbyName     5    select      static )],
29
  seminar_count => [qw(Count        10    text        static )],
30
  seminars     => [qw(Seminarss      15    text        static )],
31
);
32
 
33
# Set any custom "where" DB filters here...
34
my @whereClause;
35
 
36
# If we need to modify line item values, create a subroutine named "modify_$columnname"
37
#    It will receive a hashref to the object lineitem
38
 
267 - 39
sub modify_seminars {
40
  my $s = shift;
41
  return $s->{seminars} =~ s/\|/<br>/gr;
42
}
43
 
266 - 44
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
45
#    It will receive two fields, the field name and the current filter value (if any)
46
 
47
# Uncomment and update if we want to enable clicking on a row to open a new page.
48
#
49
sub addRowClick {
50
  my $t = shift;
51
  return "location.href='view_coach.pl?RCid=$t->{RCid}&choice=View'";
52
}
53
 
54
# Call the function to print the table view page (with available options)
55
printTablePage ({ Title   => $pageTitle,
56
#                  Prefs   => $prefscookie,
57
                  Table   => $DBTABLE,
58
                  Columns => \%COLUMNS,
59
                  RCAuth  => $RCAUTH_cookie,
60
                  Where   => join (" and ", @whereClause),
61
                  DisplayYearSelect  => 0,
62
                  ShowMyShifts       => 0,
63
                  PersonalTimeButton => 0,
64
                  HighlightShifts    => 0,
65
#                  HeaderButton       => { field  => "id",
66
#                                          button => $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) }
67
               });
68