1 package CXGN
::Glossary
;
2 use CXGN
::DB
::Connection
;
6 CXGN::Glossary -- Helper functions for querying the glossary database.
10 Allows a list of definitions for a term to be searched and for the first of
11 those definitions to be put into a toolip.
15 All functions are EXPORT_OK.
22 our @ISA = qw
/Exporter/;
24 our $VERSION = sprintf "%d.%03d", q
$Revision: 1.1 $ =~ /(\d+)/g;
25 our @EXPORT_OK = qw
/ get_definitions get_glossary_tooltip create_tooltips_from_text/;
31 my $dbh=CXGN
::DB
::Connection
->new();
37 my $terms = $dbh->selectall_arrayref("select definition from glossary where ? ilike term", undef, $term);
39 for(my $i = 0; $i < @
{$terms}[$i]; $i++){
40 $definitions[$i] = $terms->[$i][0];
45 sub get_glossary_tooltip
{
47 my @defs = get_definitions
($term);
49 return tooltipped_text
($term, $defs[0]);
52 return tooltipped_text
("<a href = \"glossarysearch.pl?getTerm=$term\">$term</a>",$defs[0]."<br />See link for more definitions.");
58 #Doesn't work, should take a paragraph of text and make a tooltip for
59 #every word that is in the database.
60 sub create_tooltips_from_text
{
61 my @words = split(" ", $_[0]);
64 $text .= " " . get_glossary_tooltip
($word);