Subversion Repositories PEEPS

Rev

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