#!/usr/local/public/perlace/bin/perl -I/usr/local/public/perlace/lib/perl5
#####################################################################
# comment - allows user to add comments to a database via markup rule
####################################################################
# use & require
use acelib::Acedb;
use acelib::AceWWW;
use CGI qw(:standard :cgi-lib);
print header;
$query = new CGI; # parse form input
$db = param('db');
$class = param('class');
$object = param('object');
param('remote',remote_host());
hidden('remote',param('remote')),"\n";
param('dbtitle',$dbinfo{$db}{'title'});
if (!param('sender email') || !param('sender') || param('sender email') !~ m/^[\w-]+\@[A-Za-z0-9]+(\.[\w-]+)*\.[A-Za-z0-9]+$/) {&opening;}
#elsif (param('correction') && param('sender email')) {&mailitoff;}
else {&mailitoff;}
print endform;
print end_html;
exit;
sub opening {
print start_html(-title=>'Correction form for ' . param('dbtitle'),
-background=>'/icons/dnabak3.gif',
-text=>'#000000',
-link=>'#0000ff',
-vlink=>'#551a8b',
-alink=>'#ff0000',
-bgcolor=>'#c0c0c0')."\n";
print startform(-method => 'POST',"http://grain.jouy.inra.fr/cgi-bin/comment");
print "Database: " . param('dbtitle');
print hidden('dbtitle',param('dbtitle')),"\n";
print hidden('db',param('db')),"\n";
print "
Class: " . param('class');
print hidden('class',param('class')),"\n";
print "
Object Name: " . param('object');
print hidden('object',param('object')),"\n";
if (param('sender')) {print hidden('sender',param('sender')),"\n";}
elsif (!param('sender')) {
print "
", textfield(-name=>'sender', -size => 50)." Name and affiliation\n";
}
if (param('sender email') =~ m/^[\w-]+\@[A-Za-z0-9]+(\.[\w-]+)*\.[A-Za-z0-9]+$/) {print hidden('sender email',param('sender email')),"\n";}
else {
if (param('sender email') !~ m/^\s*$/) {print "
E-mail address is invalid - please enter e-mail address again\n";}
print "
",textfield(-name=>'sender email', -size => 50)," E-mail address (required)\n";
}
if (param('edited')) {
print hidden('edited',param('edited')),"\n";
print hidden('saved acedump') if (param('saved acedump'));
}
elsif (!param('edited')) {
print "
Please edit the entry directly and add any comments to the Comments/References box.
If
you can supply a reference it will help us reconcile your information
with the original data source.
Additional information on the
fields available in this data class can be found at the bottom of
this page.
";
print "\n";
$myobj = &acelib::Acedb::getObj($db,$class,$object);
@outstrings = $myobj->prettyPrint2(1);
$outstrings[0] =~ s/^( *\"[^\"]+\" +)(.+)$/$class: $1\n $2/; # "
my ($actuallength) = length($1) - 5;
# print "
Comments/References
\n";
print textarea(-name=>'references', -rows=>8, -columns=>60),"\n";
}
print submit('correction', 'Send corrections to ' . param('dbtitle') . ' curators'),"\n";
print "
Thanks very much for your feedback!\n";
print "
- The GrainGenes curators, Dave Matthews, Gerry Lazo, Olin Anderson\n";
print "
CORRECTED OBJECT:
",$myedited,"\n"; $myedited =~ s/\r//g; #gets rid of \r which DOS machines combine with \n to make a ^M, which causes problems print MAILIT "CORRECTED OBJECT:\n\n",$myedited, "\n"; my $myacedump = param('saved acedump'); print "
ORIGINAL OBJECT in ace format:
", $myacedump,"\n"; $myacedump =~ s/\r/\n/g; #gets rid of \r which DOS machines combine with \n to make a ^M, which causes problems print MAILIT "\n\nORIGINAL OBJECT in ace format:\n\n", $myacedump,"\n\n"; if (param('references')) { my $myreferences = param('references'); print "
COMMENTS/REFERENCES:
",$myreferences,"\n"; $myreferences =~ s/\r//g; #gets rid of \r which DOS machines combine with \n to make a ^M, which causes problems print MAILIT "COMMENTS/REFERENCES:\n\n",$myreferences, "\n"; } close MAILIT; }