| 7 |
- |
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 |
|
| 7 |
- |
9 |
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
|
|
|
10 |
|
|
|
11 |
use strict;
|
| 8 |
- |
12 |
use cPanelUserConfig;
|
| 7 |
- |
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 (3) || 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 = "Dev Log Viewer";
|
|
|
24 |
our $DBTABLE = 'v_log';
|
|
|
25 |
my %COLUMNS = (
|
|
|
26 |
# colname => [qw(DisplayName N type status)], status -> static | default | <blank>
|
| 196 |
- |
27 |
eventid => [qw(EventID 5 number default )],
|
|
|
28 |
timestamp => [qw(Timestamp 10 date default )],
|
|
|
29 |
event => [qw(Event 15 text default )],
|
|
|
30 |
RCid => [qw(RCID 20 number default )],
|
|
|
31 |
derby_name => [qw(DerbyName 25 select default )],
|
|
|
32 |
email => [qw(Email 30 text )],
|
|
|
33 |
real_name => [qw(RealName 35 text )],
|
|
|
34 |
access => [qw(Role 40 select )]
|
| 7 |
- |
35 |
);
|
|
|
36 |
|
|
|
37 |
# Set any custom "where" DB filters here...
|
|
|
38 |
my @whereClause;
|
|
|
39 |
|
|
|
40 |
# If we need to modify line item values, create a subroutine named "modify_$columnname"
|
|
|
41 |
# It will receive a hashref to the object lineitem
|
|
|
42 |
|
| 196 |
- |
43 |
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
|
|
|
44 |
# It will receive two fields, the field name and the current filter value (if any)
|
| 7 |
- |
45 |
|
| 196 |
- |
46 |
# Uncomment and update if we want to enable clicking on a row to open a new page.
|
|
|
47 |
#
|
|
|
48 |
#sub addRowClick {
|
|
|
49 |
# my $t = shift;
|
|
|
50 |
# return "location.href='view_thing.pl?field=$t->{field}&choice=View'";
|
|
|
51 |
#}
|
| 7 |
- |
52 |
|
| 196 |
- |
53 |
# Call the function to print the table view page (with available options)
|
|
|
54 |
printTablePage ({ Title => $pageTitle,
|
|
|
55 |
# Prefs => $prefscookie,
|
|
|
56 |
Table => $DBTABLE,
|
|
|
57 |
Columns => \%COLUMNS,
|
|
|
58 |
RCAuth => $RCAUTH_cookie,
|
|
|
59 |
Where => join (" and ", @whereClause),
|
|
|
60 |
DisplayYearSelect => 1,
|
|
|
61 |
ShowMyShifts => 1,
|
|
|
62 |
PersonalTimeButton => 1,
|
|
|
63 |
HighlightShifts => 1,
|
|
|
64 |
HeaderButton => { field => "id",
|
|
|
65 |
button => $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) }
|
|
|
66 |
});
|
| 7 |
- |
67 |
|