Sign the Guestbook
% if (defined ($submit) && $errstr eq "") {
Your entry has been added.
View the Guestbook (please note that you may need to reload/refresh your browser to see the new entry)
% } elsif ($errstr) { # show the errstr
<% $errstr %>
% } else {
% print $m->comp($ENV{'ac_homedir'} . "/components/gbform", "" );
% }
<%args>
$name => undef
$email => undef
$hide_email => 0
$location => undef
$message => undef
$submit => undef
%args>
<%init>
use Artsconverge::Guestbook;
my $errstr = "";
if (defined ($submit)) {
if (!defined ($message) || $message =~ /^\s*$/ms) {
$errstr = "Sorry, you need to have some comments if you want to sign the guestbook.
";
} elsif (($message =~ /http:\/\//ms) && ($message !~ /http:\/\/www.recmusic.org/ms)) {
$errstr = "Sorry, there was an unknown error.
";
} elsif ($message =~ /<.*>/ms) {
$errstr = "Sorry, no HTML allowed.
";
}
else {
my $date = `date "+%Y-%m-%d %T"`;
my $entry = Artsconverge::Guestbook->create( { name => $name,
email => $email,
message => $message,
date => $date,
location => $location,
hide_email => $hide_email } );
unless (defined($entry)) {
$errstr = "Sorry, there was an unknown error.
";
}
}
}
%init>
<%method title>
Sign the Guestbook (Artsconverge)
%method>