Subversion Repositories VORC

Rev

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

Rev Author Line No. Line
112 - 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::SYSADMIN) || 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 $pageTitle = "Class Survey Overview";
24
our $DBTABLE = 'v_class_survey_summary';
25
my %COLUMNS = (
26
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
196 - 27
  id         => [qw(ClassID      5    number      default )],
28
  name       => [qw(Name        10    text        default )],
29
  coach      => [qw(Coach       15    select      default )],
30
  date       => [qw(Date        20    date        default )],
31
  location   => [qw(Location    25    text        default )],
32
  time       => [qw(Time        30    time        default )],
33
  count      => [qw(Attendees   35    number      default )],
34
  Overall    => [qw(Overall     40    number      default )],
35
  responses  => [qw(Responses   45    number      default )]
112 - 36
);
37
 
38
# Set any custom "where" DB filters here...
39
my @whereClause;
40
 
41
# If we need to modify line item values, create a subroutine named "modify_$columnname"
42
#    It will receive a hashref to the object lineitem
43
 
196 - 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)
112 - 46
 
196 - 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;
112 - 51
 
196 - 52
  if ($LVL >= RollerCon::ADMIN or $ORCUSER->{department}->{MVP} >= RollerCon::VOLUNTEER) {
53
    return "location.href='view_class.pl?id=$t->{id}&choice=View'";
112 - 54
  } else {
196 - 55
    return "";
112 - 56
  }
57
}
58
 
196 - 59
# Call the function to print the table view page (with available options)
112 - 60
 
196 - 61
printTablePage ({ Title   => $pageTitle,
62
                  Table   => $DBTABLE,
63
                  Columns => \%COLUMNS,
64
                  RCAuth  => $RCAUTH_cookie,
65
                  DisplayYearSelect => 1,
66
                 });