[Bio] / Sprout / SearchHelper.pm Repository:
ViewVC logotype

Diff of /Sprout/SearchHelper.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35, Mon Jul 16 20:53:11 2007 UTC revision 1.40, Tue Apr 29 20:52:05 2008 UTC
# Line 241  Line 241 
241    
242  =head3 new  =head3 new
243    
244  C<< my $shelp = SearchHelper->new($cgi); >>      my $shelp = SearchHelper->new($cgi);
245    
246  Construct a new SearchHelper object.  Construct a new SearchHelper object.
247    
# Line 311  Line 311 
311    
312  =head3 Q  =head3 Q
313    
314  C<< my $query = $shelp->Q(); >>      my $query = $shelp->Q();
315    
316  Return the CGI query object.  Return the CGI query object.
317    
# Line 328  Line 328 
328    
329  =head3 DB  =head3 DB
330    
331  C<< my $sprout = $shelp->DB(); >>      my $sprout = $shelp->DB();
332    
333  Return the Sprout database object.  Return the Sprout database object.
334    
# Line 349  Line 349 
349    
350  =head3 IsNew  =head3 IsNew
351    
352  C<< my $flag = $shelp->IsNew(); >>      my $flag = $shelp->IsNew();
353    
354  Return TRUE if this is a new session, FALSE if this is an old session. An old  Return TRUE if this is a new session, FALSE if this is an old session. An old
355  session already has search results ready to process.  session already has search results ready to process.
# Line 365  Line 365 
365    
366  =head3 ID  =head3 ID
367    
368  C<< my $sessionID = $shelp->ID(); >>      my $sessionID = $shelp->ID();
369    
370  Return the current session ID.  Return the current session ID.
371    
# Line 380  Line 380 
380    
381  =head3 FormName  =head3 FormName
382    
383  C<< my $name = $shelp->FormName(); >>      my $name = $shelp->FormName();
384    
385  Return the name of the form this helper object will generate.  Return the name of the form this helper object will generate.
386    
# Line 395  Line 395 
395    
396  =head3 QueueFormScript  =head3 QueueFormScript
397    
398  C<< $shelp->QueueFormScript($statement); >>      $shelp->QueueFormScript($statement);
399    
400  Add the specified statement to the queue of JavaScript statements that are to be  Add the specified statement to the queue of JavaScript statements that are to be
401  executed when the form has been fully defined. This is necessary because until  executed when the form has been fully defined. This is necessary because until
# Line 430  Line 430 
430    
431  =head3 FormStart  =head3 FormStart
432    
433  C<< my $html = $shelp->FormStart($title); >>      my $html = $shelp->FormStart($title);
434    
435  Return the initial section of a form designed to perform another search of the  Return the initial section of a form designed to perform another search of the
436  same type. The form header is included along with hidden fields to persist the  same type. The form header is included along with hidden fields to persist the
# Line 468  Line 468 
468                                -override => 1) .                                -override => 1) .
469                   $cgi->hidden(-name => 'SPROUT',                   $cgi->hidden(-name => 'SPROUT',
470                                -value => 1) .                                -value => 1) .
471                   $cgi->h3($title);                   $cgi->h3("$title" . Hint($self->{class}, "Click here for more information."));
     # If tracing is on, add it to the form.  
     if ($cgi->param('Trace')) {  
         $retVal .= $cgi->hidden(-name => 'Trace',  
                                 -value => $cgi->param('Trace')) .  
                    $cgi->hidden(-name => 'TF',  
                                 -value => ($cgi->param('TF') ? 1 : 0));  
     }  
472      # Put in an anchor tag in case there's a table of contents.      # Put in an anchor tag in case there's a table of contents.
473      my $anchorName = $self->FormName();      my $anchorName = $self->FormName();
474      $retVal .= "<a name=\"$anchorName\"></a>\n";      $retVal .= "<a name=\"$anchorName\"></a>\n";
# Line 485  Line 478 
478    
479  =head3 FormEnd  =head3 FormEnd
480    
481  C<< my $htmlText = $shelp->FormEnd(); >>      my $htmlText = $shelp->FormEnd();
482    
483  Return the HTML text for closing a search form. This closes both the C<form> and  Return the HTML text for closing a search form. This closes both the C<form> and
484  C<div> tags.  C<div> tags.
# Line 517  Line 510 
510    
511  =head3 SetMessage  =head3 SetMessage
512    
513  C<< $shelp->SetMessage($msg); >>      $shelp->SetMessage($msg);
514    
515  Store the specified text as the result message. The result message is displayed  Store the specified text as the result message. The result message is displayed
516  if an invalid parameter value is specified.  if an invalid parameter value is specified.
# Line 541  Line 534 
534    
535  =head3 Message  =head3 Message
536    
537  C<< my $text = $shelp->Message(); >>      my $text = $shelp->Message();
538    
539  Return the result message. The result message is displayed if an invalid parameter  Return the result message. The result message is displayed if an invalid parameter
540  value is specified.  value is specified.
# Line 557  Line 550 
550    
551  =head3 OpenSession  =head3 OpenSession
552    
553  C<< $shelp->OpenSession($rhelp); >>      $shelp->OpenSession($rhelp);
554    
555  Set up the session cache file and write out the column headers.  Set up the session cache file and write out the column headers.
556  This method should not be called until all the columns have  This method should not be called until all the columns have
# Line 592  Line 585 
585    
586  =head3 GetCacheFileName  =head3 GetCacheFileName
587    
588  C<< my $fileName = $shelp->GetCacheFileName(); >>      my $fileName = $shelp->GetCacheFileName();
589    
590  Return the name to be used for this session's cache file.  Return the name to be used for this session's cache file.
591    
# Line 607  Line 600 
600    
601  =head3 GetTempFileName  =head3 GetTempFileName
602    
603  C<< my $fileName = $shelp->GetTempFileName($type); >>      my $fileName = $shelp->GetTempFileName($type);
604    
605  Return the name to be used for a temporary file of the specified type. The  Return the name to be used for a temporary file of the specified type. The
606  name is computed from the session name with the type as a suffix.  name is computed from the session name with the type as a suffix.
# Line 638  Line 631 
631    
632  =head3 WriteColumnHeaders  =head3 WriteColumnHeaders
633    
634  C<< $shelp->WriteColumnHeaders(@colNames); >>      $shelp->WriteColumnHeaders(@colNames);
635    
636  Write out the column headers for the current search session. The column headers  Write out the column headers for the current search session. The column headers
637  are sent to the cache file, and then the cache is re-opened as a sort pipe and  are sent to the cache file, and then the cache is re-opened as a sort pipe and
# Line 675  Line 668 
668    
669  =head3 ReadColumnHeaders  =head3 ReadColumnHeaders
670    
671  C<< my @colHdrs = $shelp->ReadColumnHeaders($fh); >>      my @colHdrs = $shelp->ReadColumnHeaders($fh);
672    
673  Read the column headers from the specified file handle. The column headers are  Read the column headers from the specified file handle. The column headers are
674  frozen strings intermixed with frozen hash references. The strings represent  frozen strings intermixed with frozen hash references. The strings represent
# Line 707  Line 700 
700    
701  =head3 WriteColumnData  =head3 WriteColumnData
702    
703  C<< $shelp->WriteColumnData($key, @colValues); >>      $shelp->WriteColumnData($key, @colValues);
704    
705  Write a row of column values to the current search session. It is assumed that  Write a row of column values to the current search session. It is assumed that
706  the session file is already open for output.  the session file is already open for output.
# Line 736  Line 729 
729    
730  =head3 CloseSession  =head3 CloseSession
731    
732  C<< $shelp->CloseSession(); >>      $shelp->CloseSession();
733    
734  Close the session file.  Close the session file.
735    
# Line 758  Line 751 
751    
752  =head3 OrganismData  =head3 OrganismData
753    
754  C<< my ($orgName, $group) = $shelp->Organism($genomeID); >>      my ($orgName, $group) = $shelp->Organism($genomeID);
755    
756  Return the name and status of the organism corresponding to the specified genome ID.  Return the name and status of the organism corresponding to the specified genome ID.
757  For performance reasons, this information is cached in a special hash table, so we  For performance reasons, this information is cached in a special hash table, so we
# Line 789  Line 782 
782      my $cache = $self->{orgs};      my $cache = $self->{orgs};
783      if (exists $cache->{$genomeID}) {      if (exists $cache->{$genomeID}) {
784          ($orgName, $group, $domain) = @{$cache->{$genomeID}};          ($orgName, $group, $domain) = @{$cache->{$genomeID}};
785            Trace("Cached organism $genomeID has group \"$group\".") if T(4);
786      } else {      } else {
787          # Here we have to use the database.          # Here we have to use the database.
788          my $sprout = $self->DB();          my $sprout = $self->DB();
789          my ($genus, $species, $strain, $group, $taxonomy) = $sprout->GetEntityValues('Genome', $genomeID,          my ($genus, $species, $strain, $newGroup, $taxonomy) = $sprout->GetEntityValues('Genome', $genomeID,
790                                                                  ['Genome(genus)', 'Genome(species)',                                                                  ['Genome(genus)', 'Genome(species)',
791                                                                   'Genome(unique-characterization)',                                                                   'Genome(unique-characterization)',
792                                                                   'Genome(primary-group)',                                                                   'Genome(primary-group)',
793                                                                   'Genome(taxonomy)']);                                                                   'Genome(taxonomy)']);
794          # Format and cache the name and display group.          # Format and cache the name and display group.
795          ($orgName, $group, $domain) = $self->SaveOrganismData($group, $genomeID, $genus, $species,          Trace("Caching organism $genomeID with group \"$newGroup\".") if T(4);
796            ($orgName, $group, $domain) = $self->SaveOrganismData($newGroup, $genomeID, $genus, $species,
797                                                                $strain, $taxonomy);                                                                $strain, $taxonomy);
798            Trace("Returning group $group.") if T(4);
799      }      }
800      # Return the result.      # Return the result.
801      return ($orgName, $group, $domain);      return ($orgName, $group, $domain);
# Line 807  Line 803 
803    
804  =head3 Organism  =head3 Organism
805    
806  C<< my $orgName = $shelp->Organism($genomeID); >>      my $orgName = $shelp->Organism($genomeID);
807    
808  Return the name of the relevant organism. The name is computed from the genus,  Return the name of the relevant organism. The name is computed from the genus,
809  species, and unique characterization. A cache is used to improve performance.  species, and unique characterization. A cache is used to improve performance.
# Line 837  Line 833 
833    
834  =head3 ComputeFASTA  =head3 ComputeFASTA
835    
836  C<< my $fasta = $shelp->ComputeFASTA($desiredType, $sequence, $flankingWidth); >>      my $fasta = $shelp->ComputeFASTA($desiredType, $sequence, $flankingWidth);
837    
838  Parse a sequence input and convert it into a FASTA string of the desired type with  Parse a sequence input and convert it into a FASTA string of the desired type with
839  the desired flanking width.  the desired flanking width.
# Line 998  Line 994 
994    
995  =head3 SubsystemTree  =head3 SubsystemTree
996    
997  C<< my $tree = SearchHelper::SubsystemTree($sprout, %options); >>      my $tree = SearchHelper::SubsystemTree($sprout, %options);
998    
999  This method creates a subsystem selection tree suitable for passing to  This method creates a subsystem selection tree suitable for passing to
1000  L</SelectionTree>. Each leaf node in the tree will have a link to the  L</SelectionTree>. Each leaf node in the tree will have a link to the
# Line 1130  Line 1126 
1126              if ($optionThing->{links}) {              if ($optionThing->{links}) {
1127                  # Compute the link value.                  # Compute the link value.
1128                  my $linkable = uri_escape($id);                  my $linkable = uri_escape($id);
1129                  $nodeContent->{link} = "../FIG/display_subsys.cgi?ssa_name=$linkable;request=show_ssa;sort=by_phylo;show_clusters=1;SPROUT=1";                  $nodeContent->{link} = "../FIG/seedviewer.cgi?page=Subsystems;subsystem=$linkable";
1130              }              }
1131              if ($optionThing->{radio}) {              if ($optionThing->{radio}) {
1132                  # Compute the radio value.                  # Compute the radio value.
# Line 1148  Line 1144 
1144    
1145  =head3 NmpdrGenomeMenu  =head3 NmpdrGenomeMenu
1146    
1147  C<< my $htmlText = $shelp->NmpdrGenomeMenu($menuName, $multiple, \@selected, $rows); >>      my $htmlText = $shelp->NmpdrGenomeMenu($menuName, $multiple, \@selected, $rows);
1148    
1149  This method creates a hierarchical HTML menu for NMPDR genomes organized by category. The  This method creates a hierarchical HTML menu for NMPDR genomes organized by category. The
1150  category indicates the low-level NMPDR group. Organizing the genomes in this way makes it  category indicates the low-level NMPDR group. Organizing the genomes in this way makes it
# Line 1239  Line 1235 
1235              push @{$gHash{$group}}, [$genomeID, $name, $domain];              push @{$gHash{$group}}, [$genomeID, $name, $domain];
1236          }          }
1237          # We are almost ready to unroll the menu out of the group hash. The final step is to separate          # We are almost ready to unroll the menu out of the group hash. The final step is to separate
1238          # the supporting genomes by domain. First, we sort the NMPDR groups.          # the supporting genomes by domain. First, we extract the NMPDR groups and sort them. They
1239          @groups = sort grep { $_ ne $FIG_Config::otherGroup } keys %gHash;          # are sorted by the first capitalized word. Groups with "other" are sorted after groups
1240            # that aren't "other". At some point, we will want to make this less complicated.
1241            my %sortGroups = map { $_ =~ /(other)?(.*)([A-Z].+)/; "$3$1$2" => $_ }
1242                                 grep { $_ ne $FIG_Config::otherGroup } keys %gHash;
1243            @groups = map { $sortGroups{$_} } sort keys %sortGroups;
1244          # Remember the number of NMPDR groups.          # Remember the number of NMPDR groups.
1245          $nmpdrGroupCount = scalar @groups;          $nmpdrGroupCount = scalar @groups;
1246          # Loop through the supporting genomes, classifying them by domain. We'll also keep a list          # Loop through the supporting genomes, classifying them by domain. We'll also keep a list
# Line 1330  Line 1330 
1330          my $searchThingName = "${menuName}_SearchThing";          my $searchThingName = "${menuName}_SearchThing";
1331          push @lines, "<br />" .          push @lines, "<br />" .
1332                       "<INPUT type=\"button\" name=\"MacroSearch\" class=\"button\" value=\"Select genomes containing\" onClick=\"selectViaSearch($menuName, $searchThingName); $showSelect\" />&nbsp;" .                       "<INPUT type=\"button\" name=\"MacroSearch\" class=\"button\" value=\"Select genomes containing\" onClick=\"selectViaSearch($menuName, $searchThingName); $showSelect\" />&nbsp;" .
1333                       "<INPUT type=\"text\" name=\"$searchThingName\" size=\"30\" />" . Hint("Enter a genome number, then click the button to the left " .                       "<INPUT type=\"text\" name=\"$searchThingName\" size=\"30\" />" . Hint("Genome Control",
1334                                                                                                "Enter a genome number, then click the button to the left " .
1335                                                                                              "in order to select the genome with that number. " .                                                                                              "in order to select the genome with that number. " .
1336                                                                                              "Enter a genus, species, or strain and click the " .                                                                                              "Enter a genus, species, or strain and click the " .
1337                                                                                              "button to select all genomes with that genus, species, " .                                                                                              "button to select all genomes with that genus, species, " .
# Line 1340  Line 1341 
1341          push @lines, "<INPUT type=\"button\" name=\"ClearAll\" class=\"bigButton\"  value=\"Clear All\" onClick=\"clearAll($menuName); $showSelect\" />";          push @lines, "<INPUT type=\"button\" name=\"ClearAll\" class=\"bigButton\"  value=\"Clear All\" onClick=\"clearAll($menuName); $showSelect\" />";
1342          push @lines, "<INPUT type=\"button\" name=\"SelectAll\" class=\"bigButton\" value=\"Select All\" onClick=\"selectAll($menuName); $showSelect\" />";          push @lines, "<INPUT type=\"button\" name=\"SelectAll\" class=\"bigButton\" value=\"Select All\" onClick=\"selectAll($menuName); $showSelect\" />";
1343          push @lines, "<INPUT type=\"button\" name=\"NMPDROnly\" class=\"bigButton\"  value=\"Select NMPDR\" onClick=\"selectSome($menuName, $nmpdrCount, true); $showSelect\" />";          push @lines, "<INPUT type=\"button\" name=\"NMPDROnly\" class=\"bigButton\"  value=\"Select NMPDR\" onClick=\"selectSome($menuName, $nmpdrCount, true); $showSelect\" />";
1344          push @lines, "<INPUT type=\"button\" name=\"OtherOnly\" class=\"bigButton\" value=\"Select Supporting\" onClick=\"selectSome($menuName, $nmpdrCount, false); $showSelect\" />";          # push @lines, "<INPUT type=\"button\" name=\"OtherOnly\" class=\"bigButton\" value=\"Select Supporting\" onClick=\"selectSome($menuName, $nmpdrCount, false); $showSelect\" />";
1345          # Add the status display, too.          # Add the status display, too.
1346          push @lines, "<DIV id=\"$divID\" class=\"selectStatus\"></DIV>";          push @lines, "<DIV id=\"$divID\" class=\"selectStatus\"></DIV>";
1347          # Queue to update the status display when the form loads. We need to modify the show statement          # Queue to update the status display when the form loads. We need to modify the show statement
# Line 1361  Line 1362 
1362    
1363  =head3 PropertyMenu  =head3 PropertyMenu
1364    
1365  C<< my $htmlText = $shelp->PropertyMenu($menuName, $selected, $force); >>      my $htmlText = $shelp->PropertyMenu($menuName, $selected, $force);
1366    
1367  Generate a property name dropdown menu.  Generate a property name dropdown menu.
1368    
# Line 1411  Line 1412 
1412    
1413  =head3 MakeTable  =head3 MakeTable
1414    
1415  C<< my $htmlText = $shelp->MakeTable(\@rows); >>      my $htmlText = $shelp->MakeTable(\@rows);
1416    
1417  Create a table from a group of table rows. The table rows must be fully pre-formatted: in  Create a table from a group of table rows. The table rows must be fully pre-formatted: in
1418  other words, each must have the TR and TD tags included.  other words, each must have the TR and TD tags included.
# Line 1474  Line 1475 
1475    
1476  =head3 SubmitRow  =head3 SubmitRow
1477    
1478  C<< my $htmlText = $shelp->SubmitRow($caption); >>      my $htmlText = $shelp->SubmitRow($caption);
1479    
1480  Returns the HTML text for the row containing the page size control  Returns the HTML text for the row containing the page size control
1481  and the submit button. All searches should have this row somewhere  and the submit button. All searches should have this row somewhere
# Line 1506  Line 1507 
1507      # Get the current feature ID type.      # Get the current feature ID type.
1508      my $aliasType = $self->GetPreferredAliasType();      my $aliasType = $self->GetPreferredAliasType();
1509      # Create the rows.      # Create the rows.
1510      my $retVal = $cgi->Tr($cgi->td("ID Type"), $cgi->td({ colspan => 2 },      my $retVal = $cgi->Tr($cgi->td("Identifier Type "),
1511                              $cgi->td({ colspan => 2 },
1512                                                          $cgi->popup_menu(-name => 'AliasType',                                                          $cgi->popup_menu(-name => 'AliasType',
1513                                                                           -values => ['FIG', AliasAnalysis::AliasTypes() ],                                                                           -values => ['FIG', AliasAnalysis::AliasTypes() ],
1514                                                                           -default => $aliasType) .                                                                           -default => $aliasType) .
1515                                                          Hint("Specify how you want gene names to be displayed."))) .                                     Hint("Identifier Type", "Specify how you want gene names to be displayed."))) .
1516                   "\n" .                   "\n" .
1517                   $cgi->Tr($cgi->td("Results/Page"),                   $cgi->Tr($cgi->td("Results/Page"),
1518                            $cgi->td($cgi->popup_menu(-name => 'PageSize',                            $cgi->td($cgi->popup_menu(-name => 'PageSize',
# Line 1525  Line 1527 
1527    
1528  =head3 GetGenomes  =head3 GetGenomes
1529    
1530  C<< my @genomeList = $shelp->GetGenomes($parmName); >>      my @genomeList = $shelp->GetGenomes($parmName);
1531    
1532  Return the list of genomes specified by the specified CGI query parameter.  Return the list of genomes specified by the specified CGI query parameter.
1533  If the request method is POST, then the list of genome IDs is returned  If the request method is POST, then the list of genome IDs is returned
# Line 1569  Line 1571 
1571    
1572  =head3 GetHelpText  =head3 GetHelpText
1573    
1574  C<< my $htmlText = $shelp->GetHelpText(); >>      my $htmlText = $shelp->GetHelpText();
1575    
1576  Get the help text for this search. The help text is stored in files on the template  Get the help text for this search. The help text is stored in files on the template
1577  server. The help text for a specific search is taken from a file named  server. The help text for a specific search is taken from a file named
# Line 1610  Line 1612 
1612    
1613  =head3 ComputeSearchURL  =head3 ComputeSearchURL
1614    
1615  C<< my $url = $shelp->ComputeSearchURL(%overrides); >>      my $url = $shelp->ComputeSearchURL(%overrides);
1616    
1617  Compute the GET-style URL for the current search. In order for this to work, there  Compute the GET-style URL for the current search. In order for this to work, there
1618  must be a copy of the search form on the current page. This will always be the  must be a copy of the search form on the current page. This will always be the
# Line 1703  Line 1705 
1705    
1706  =head3 AdvancedClassList  =head3 AdvancedClassList
1707    
1708  C<< my @classes = SearchHelper::AdvancedClassList(); >>      my @classes = SearchHelper::AdvancedClassList();
1709    
1710  Return a list of advanced class names. This list is used to generate the directory  Return a list of advanced class names. This list is used to generate the directory
1711  of available searches on the search page.  of available searches on the search page.
# Line 1726  Line 1728 
1728    
1729  =head3 SelectionTree  =head3 SelectionTree
1730    
1731  C<< my $htmlText = SearchHelper::SelectionTree($cgi, \%tree, %options); >>      my $htmlText = SearchHelper::SelectionTree($cgi, \%tree, %options);
1732    
1733  Display a selection tree.  Display a selection tree.
1734    
# Line 1915  Line 1917 
1917    
1918  =head3 ShowBranch  =head3 ShowBranch
1919    
1920  C<< my @htmlLines = SearchHelper::ShowBranch($cgi, $label, $id, $branch, $options, $displayType); >>      my @htmlLines = SearchHelper::ShowBranch($cgi, $label, $id, $branch, $options, $displayType);
1921    
1922  This is a recursive method that displays a branch of the tree.  This is a recursive method that displays a branch of the tree.
1923    
# Line 2067  Line 2069 
2069    
2070  =head3 GetDivID  =head3 GetDivID
2071    
2072  C<< my $idString = SearchHelper::GetDivID($name); >>      my $idString = SearchHelper::GetDivID($name);
2073    
2074  Return a new HTML ID string.  Return a new HTML ID string.
2075    
# Line 2098  Line 2100 
2100    
2101  =head3 PrintLine  =head3 PrintLine
2102    
2103  C<< $shelp->PrintLine($message); >>      $shelp->PrintLine($message);
2104    
2105  Print a line of CGI output. This is used during the operation of the B<Find> method while  Print a line of CGI output. This is used during the operation of the B<Find> method while
2106  searching, so the user sees progress in real-time.  searching, so the user sees progress in real-time.
# Line 2122  Line 2124 
2124    
2125  =head3 GetHelper  =head3 GetHelper
2126    
2127  C<< my $shelp = SearchHelper::GetHelper($parm, $type => $className); >>      my $shelp = SearchHelper::GetHelper($parm, $type => $className);
2128    
2129  Return a helper object with the given class name. If no such class exists, an  Return a helper object with the given class name. If no such class exists, an
2130  error will be thrown.  error will be thrown.
# Line 2180  Line 2182 
2182    
2183  =head3 SaveOrganismData  =head3 SaveOrganismData
2184    
2185  C<< my ($name, $displayGroup) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy); >>      my ($name, $displayGroup, $domain) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy);
2186    
2187  Format the name of an organism and the display version of its group name. The incoming  Format the name of an organism and the display version of its group name. The incoming
2188  data should be the relevant fields from the B<Genome> record in the database. The  data should be the relevant fields from the B<Genome> record in the database. The
# Line 2241  Line 2243 
2243          # Compute the display group. This is currently the same as the incoming group          # Compute the display group. This is currently the same as the incoming group
2244          # name unless it's the supporting group, which is nulled out.          # name unless it's the supporting group, which is nulled out.
2245          $displayGroup = ($group eq $FIG_Config::otherGroup ? "" : $group);          $displayGroup = ($group eq $FIG_Config::otherGroup ? "" : $group);
2246            Trace("Group = $displayGroup, translated from \"$group\".") if T(4);
2247      }      }
2248      # Compute the domain from the taxonomy.      # Compute the domain from the taxonomy.
2249      my ($domain) = split /\s*;\s*/, $taxonomy, 2;      my ($domain) = split /\s*;\s*/, $taxonomy, 2;
# Line 2253  Line 2256 
2256    
2257  =head3 ValidateKeywords  =head3 ValidateKeywords
2258    
2259  C<< my $okFlag = $shelp->ValidateKeywords($keywordString, $required); >>      my $okFlag = $shelp->ValidateKeywords($keywordString, $required);
2260    
2261  Insure that a keyword string is reasonably valid. If it is invalid, a message will be  Insure that a keyword string is reasonably valid. If it is invalid, a message will be
2262  set.  set.
# Line 2303  Line 2306 
2306    
2307  =head3 TuningParameters  =head3 TuningParameters
2308    
2309  C<< my $options = $shelp->TuningParameters(%parmHash); >>      my $options = $shelp->TuningParameters(%parmHash);
2310    
2311  Retrieve tuning parameters from the CGI query object. The parameter is a hash that maps parameter names  Retrieve tuning parameters from the CGI query object. The parameter is a hash that maps parameter names
2312  to their default values. The parameters and their values will be returned as a hash reference.  to their default values. The parameters and their values will be returned as a hash reference.
# Line 2346  Line 2349 
2349    
2350  =head3 GetPreferredAliasType  =head3 GetPreferredAliasType
2351    
2352  C<< my $type = $shelp->GetPreferredAliasType(); >>      my $type = $shelp->GetPreferredAliasType();
2353    
2354  Return the preferred alias type for the current session. This information is stored  Return the preferred alias type for the current session. This information is stored
2355  in the C<AliasType> parameter of the CGI query object, and the default is C<FIG>  in the C<AliasType> parameter of the CGI query object, and the default is C<FIG>
# Line 2368  Line 2371 
2371    
2372  =head3 Form  =head3 Form
2373    
2374  C<< my $html = $shelp->Form(); >>      my $html = $shelp->Form();
2375    
2376  Generate the HTML for a form to request a new search.  Generate the HTML for a form to request a new search.
2377    
2378  =head3 Find  =head3 Find
2379    
2380  C<< my $resultCount = $shelp->Find(); >>      my $resultCount = $shelp->Find();
2381    
2382  Conduct a search based on the current CGI query parameters. The search results will  Conduct a search based on the current CGI query parameters. The search results will
2383  be written to the session cache file and the number of results will be  be written to the session cache file and the number of results will be
# Line 2392  Line 2395 
2395    
2396  =head3 Description  =head3 Description
2397    
2398  C<< my $htmlText = $shelp->Description(); >>      my $htmlText = $shelp->Description();
2399    
2400  Return a description of this search. The description is used for the table of contents  Return a description of this search. The description is used for the table of contents
2401  on the main search tools page. It may contain HTML, but it should be character-level,  on the main search tools page. It may contain HTML, but it should be character-level,
# Line 2409  Line 2412 
2412    
2413  =head3 SearchTitle  =head3 SearchTitle
2414    
2415  C<< my $titleHtml = $shelp->SearchTitle(); >>      my $titleHtml = $shelp->SearchTitle();
2416    
2417  Return the display title for this search. The display title appears above the search results.  Return the display title for this search. The display title appears above the search results.
2418  If no result is returned, no title will be displayed. The result should be an html string  If no result is returned, no title will be displayed. The result should be an html string
# Line 2428  Line 2431 
2431    
2432  =head3 DefaultColumns  =head3 DefaultColumns
2433    
2434  C<< $shelp->DefaultColumns($rhelp); >>      $shelp->DefaultColumns($rhelp);
2435    
2436  Store the default columns in the result helper. The default action is just to ask  Store the default columns in the result helper. The default action is just to ask
2437  the result helper for its default columns, but this may be changed by overriding  the result helper for its default columns, but this may be changed by overriding
# Line 2455  Line 2458 
2458    
2459  =head3 Hint  =head3 Hint
2460    
2461  C<< my $htmlText = SearchHelper::Hint($hintText); >>      my $htmlText = SearchHelper::Hint($wikiPage, $hintText);
2462    
2463  Return the HTML for a small question mark that displays the specified hint text when it is clicked.  Return the HTML for a small question mark that displays the specified hint text when it is clicked.
2464  This HTML can be put in forms to provide a useful hinting mechanism.  This HTML can be put in forms to provide a useful hinting mechanism.
2465    
2466  =over 4  =over 4
2467    
2468    =item wikiPage
2469    
2470    Name of the wiki page to be popped up when the hint mark is clicked.
2471    
2472  =item hintText  =item hintText
2473    
2474  Text to display for the hint. It is raw html, but may not contain any double quotes.  Text to display for the hint. It is raw html, but may not contain any double quotes.
# Line 2477  Line 2484 
2484    
2485  sub Hint {  sub Hint {
2486      # Get the parameters.      # Get the parameters.
2487      my ($hintText) = @_;      my ($wikiPage, $hintText) = @_;
2488      # Escape the single quotes.      # Escape the single quotes in the hint text.
2489      my $quotedText = $hintText;      my $quotedText = $hintText;
2490      $quotedText =~ s/'/\\'/g;      $quotedText =~ s/'/\\'/g;
2491        # Convert the wiki page name to a URL.
2492        my $wikiURL = join("", map { ucfirst $_ } split /\s+/, $wikiPage);
2493        $wikiURL = "wiki/view.cgi/FIG/$wikiURL";
2494      # Create the html.      # Create the html.
2495      my $retVal = "&nbsp;<input type=\"button\" class=\"hintbutton\" onMouseOver=\"javascript:if (!this.tooltip) { " .      my $retVal = "&nbsp;<input type=\"button\" class=\"hintbutton\" onMouseOver=\"javascript:if (!this.tooltip) { " .
2496                   "this.tooltip = new Popup_Tooltip(this, 'Search Hint', '$quotedText', '', 1); this.tooltip.addHandler(); } " .                   "this.tooltip = new Popup_Tooltip(this, 'Search Hint', '$quotedText', '', 1); this.tooltip.addHandler(); } " .
2497                   "return false;\" value=\"?\" />";                   "return false;\" value=\"?\" onClick=\"javascript:window.open('$wikiURL', 'nmpdrHelp');\" />";
2498      # Return it.      # Return it.
2499      return $retVal;      return $retVal;
2500  }  }

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.40

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3