Subversion Repositories VORC

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
222 - 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
if (!$ORCUSER->{MVPid} and $LVL < RollerCon::ADMIN and $ORCUSER->{department}->{MVP} < RollerCon::USER and $ORCUSER->{department}->{COA} < RollerCon::USER) {
24
  print header(-cookie=>$RCAUTH_cookie);
25
  printRCHeader("Unauthorized Page");
26
  print $h->div ({ class=>"error" }, "No Access");
27
  print $h->div ("Your user account is not registered to sign up for MVP Classes, so you can't see this page.  It's possible that your access is still being reviewed.  Please be patient.");
28
  print $h->a ({ href=>"/schedule/" }, "[Go Home]");
29
  print $h->close ("body");
30
  print $h->close ("html");
31
  exit;
32
}
33
 
34
my $YEAR = 1900 + (localtime)[5];
35
my $pageTitle = "$YEAR MVP Class Coaches";
36
our $DBTABLE = 'v_class_coaches_current';
37
my %COLUMNS = (
38
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
39
  derby_name  => [qw(DerbyName     5    select      static )],
40
  class_count => [qw(Count        10    text        static )],
41
  classes     => [qw(Classes      15    text        static )],
42
);
43
 
44
# Set any custom "where" DB filters here...
45
my @whereClause;
46
 
47
# If we need to modify line item values, create a subroutine named "modify_$columnname"
48
#    It will receive a hashref to the object lineitem
49
 
50
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
51
#    It will receive two fields, the field name and the current filter value (if any)
52
 
53
# Uncomment and update if we want to enable clicking on a row to open a new page.
54
#
55
sub addRowClick {
56
  my $t = shift;
57
  return "location.href='view_coach.pl?RCid=$t->{RCid}&choice=View'";
58
}
59
 
60
# Call the function to print the table view page (with available options)
61
printTablePage ({ Title   => $pageTitle,
62
#                  Prefs   => $prefscookie,
63
                  Table   => $DBTABLE,
64
                  Columns => \%COLUMNS,
65
                  RCAuth  => $RCAUTH_cookie,
66
                  Where   => join (" and ", @whereClause),
67
                  DisplayYearSelect  => 0,
68
                  ShowMyShifts       => 0,
69
                  PersonalTimeButton => 0,
70
                  HighlightShifts    => 0,
71
#                  HeaderButton       => { field  => "id",
72
#                                          button => $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) }
73
               });
74