- Dave Matthews
To: acedb@net.bio.net
From: caron@jade.jouy.inra.fr (Christophe Caron)
Subject: Allow user to add comments to a database via markup rule
Date: 7 Apr 1998 09:38:36 GMT
Hi
In webace the clickable "[View graphic]" at the top of html
pages does not work correctly in some cases.
The idea is to use this "feature":) to add a new functionnality:
Allow user to add comments to a database via markup rule
This is already used in graingenes database at NAL, and mirror site at
Jouy-en-Josas (France).
You could look at some graingenes sites :
/cgi-bin/WebAce/webace?db=graingenes
or
http://grain.jouy.inra.fr/cgi-bin/webace?db=graingenes
by selecting an class/object and click on _Submit comment/correction
There are 4 steps to add this:
1) Add this rule to your markup.pl, in your '$ACEDB/wspec' directory.
#
# add comment in webace
#
{
#
'keys' => sub {my ($node, $root) = @_;
return ($node->{db},$node->{cl},$node->{va});
},
'urls'=>'edit'
},
#
#
#
2)Add to standard_urls , in 'acelib' directory.
edit:_Submit comment/correction:$main::baseURL/cgi-bin/comment?db=$keys[0]&class=$keys[1]&object=$keys[2]
3)Copy the script 'comment' to your cgi-bin directory
and adapt it (email address(in $send_to variable), perl path, url
path, hostname, database name....) to your site.
4)Add the procedure prettyPrint2 to your Aceobj.pm:
sub prettyPrint2 { # SB-S 6 June 1997
# returns an array of strings, with the object formatted nicely
# NOT in .ace format
my ($obj,$past_root) = @_;
my ($nodeText, @output);
unless ($past_root) {
@output = ("$obj->{'cl'} : \"$obj->{'va'}\"");
foreach $next ($obj->right) {
push (@output, &prettyPrint2($next, 1));
}
} else {
$nodeText = $obj->{'ti'} || $obj->{'va'};
if ($obj->{'ty'} ne 'tg') { #new
$nodeText =~ s/\"/\\"/g; # " #new
$nodeText = "\"".$nodeText."\""; #new
}
if ($obj->right) {
my ($already);
foreach $next ($obj->right) {
my ($line);
foreach $line (&prettyPrint2($next, 1)) {
push (@output, $nodeText . ' ' . $line);
unless ($already) {
$nodeText =~ tr// /c;
$already = 1;
}
}
}
} else {
@output = ($nodeText);
}
}
return @output;
}
################
And test it....
christophe
Thanks to Dave Matthews, Jon Krainak, Matthew Couchman, Thierry
Hotelier for their help on ACEDB/Webace.
=========================================================
= Christophe Caron C.T.I.S.
= I.N.R.A. Domaine de Vilvert =
= 78352 Jouy-en-Josas email : caron@jouy.inra.fr =
=========================================================