| 1 | # | ||
| 2 | # $Id: SkipperOutput.pm,v 1.7 2005/04/01 08:54:46 rsandberg Exp $ | ||
| 3 | |||
| 4 | package CGI::CRUD::SkipperOutput; | ||
| 5 | |||
| 6 | use strict; | ||
| 7 | use DBI; | ||
| 8 | use CGI::CRUD::ApacheOutputFastTemplate; | ||
| 9 | |||
| 10 | @CGI::CRUD::SkipperOutput::ISA = qw(CGI::CRUD::ApacheOutputFastTemplate); | ||
| 11 | |||
| 12 | sub new | ||
| 13 | { | ||
| 14 | my $caller = shift; | ||
| 15 | my $self = $caller->SUPER::new(@_); | ||
| 16 | |||
| 17 | # Make sure to define env DBI_DSN, DBI_USER, etc (see man DBI) | ||
| 18 | # This should match the connect string in mod_perl_startup.pl (Apache::DBI->connect_on_init) | ||
| 19 | unless ($self->{dbh} = DBI->connect(undef,undef,undef,{ PrintError => 1, RaiseError => 0, AutoCommit => 1, })) | ||
| 20 | { | ||
| 21 | $self->perror("Database server not responding, contact your administrator"); | ||
| 22 | warn("Can't connect to db, check DBI_DSN, DBI_USER, etc env."); | ||
| 23 | return undef; | ||
| 24 | } | ||
| 25 | |||
| 26 | return $self; | ||
| 27 | } | ||
| 28 | |||
| 29 | sub form_attrs | ||
| 30 | { | ||
| 31 | my ($caller,$form) = @_; | ||
| 32 | $caller->SUPER::form_attrs($form); | ||
| 33 | $form->{submit_button_attrs} = qq[class="formbutton" onmouseout="javascript:this.style.color='black';" onmouseover="javascript:this.style.color='red';"]; | ||
| 34 | return $form; | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; |