Subversion Repositories PEEPS

Rev

Rev 5 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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 CGI qw/param cookie header start_html url/;
13
use HTML::Tiny;
14
use tableViewer;
15
use PEEPS;
16
our $h = HTML::Tiny->new( mode => 'html' );
4 - 17
$ENV{HTTPS} = 'ON' if $ENV{SERVER_NAME} =~ /^peeps/;
2 - 18
 
19
my $cookie_string = authenticate () || die;
20
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
21
my $PEEPSAUTH_cookie = CGI::Cookie->new(-name=>'PEEPSAUTH',-value=>"$cookie_string",-expires=>"+30m");
22
 
23
my $pageTitle = "PEEPS - Organizations";
24
our $DBTABLE = 'organization';
25
my %COLUMNS = (
26
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
27
  id                 => [qw(ID               5    number              )],
28
  league_name        => [qw(LeagueName      10    text        default )],
29
  business_name      => [qw(BusinessName    15    text                )],
30
  city               => [qw(City            20    text        default )],
31
  state_province     => [qw(StateProvince   25    select      default )],
32
  country            => [qw(Country         30    select      default )],
33
  url                => [qw(Website         35    text                )],
34
  type               => [qw(Type            40    select      default )],
35
  status             => [qw(Status          45    select      default )],
36
  legal_entity_type  => [qw(LegalEntity     50    select       )],
37
  tax_id             => [qw(TaxID           55    text         )],
38
  date_established   => [qw(Established     60    date        default )],
39
);
40
 
41
# Set any custom "where" DB filters here...
42
my @whereClause;
43
 
44
# If we need to modify line item values, create a subroutine named "modify_$columnname"
45
#    It will receive a hashref to the object lineitem
46
 
47
sub modify_url {
48
  my $thing = shift;
49
  return $h->a ({ href => $thing->{url}, target => "_blank", onClick=>"event.stopPropagation();" }, $thing->{url});
50
}
51
 
52
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
53
#    It will receive two fields, the field name and the current filter value (if any)
54
 
55
# Uncomment and update if we want to enable clicking on a row to open a new page.
56
#
57
sub addRowClick {
58
  my $t = shift;
59
  return "location.href='view_league?id=$t->{id}'";
60
}
61
 
62
# Call the function to print the table view page (with available options)
63
printTablePage ({ Title     => $pageTitle,
64
#                  Prefs     => $prefscookie,
65
                  Table     => $DBTABLE,
66
                  Columns   => \%COLUMNS,
67
                  PEEPSAuth => $PEEPSAUTH_cookie,
68
                  Where     => join (" and ", @whereClause),
69
#                  HeaderButton       => { field  => "id",
70
#                                          button => $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) }
71
               });
72
 
5 - 73