[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.37, Mon Aug 20 23:22:42 2007 UTC revision 1.41, Wed Sep 3 20:54:47 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 461  Line 461 
461      # case the Advanced button was used.      # case the Advanced button was used.
462      my $retVal = "<div class=\"search\">\n" .      my $retVal = "<div class=\"search\">\n" .
463                   $cgi->start_form(-method => 'POST',                   $cgi->start_form(-method => 'POST',
464                                    -action => $cgi->url(-relative => 1),                                    -action => "$FIG_Config::cgi_url/SearchSkeleton.cgi",
465                                    -name => $self->FormName()) .                                    -name => $self->FormName()) .
466                   $cgi->hidden(-name => 'Class',                   $cgi->hidden(-name => 'Class',
467                                -value => $self->{class},                                -value => $self->{class},
# Line 478  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 510  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 534  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 550  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 585  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 600  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 631  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 668  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 700  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 729  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 751  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 803  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 833  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 994  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 1052  Line 1052 
1052              push @subs, $classLess;              push @subs, $classLess;
1053          }          }
1054      }      }
1055        # Get the seedviewer URL.
1056        my $svURL = $FIG_Config::linkinSV || "$FIG_Config::cgi_url/seedviewer.cgi";
1057        Trace("Seed Viewer URL is $svURL.") if T(3);
1058      # Declare the return variable.      # Declare the return variable.
1059      my @retVal = ();      my @retVal = ();
1060      # Each element in @subs represents a leaf node, so as we loop through it we will be      # Each element in @subs represents a leaf node, so as we loop through it we will be
# Line 1126  Line 1129 
1129              if ($optionThing->{links}) {              if ($optionThing->{links}) {
1130                  # Compute the link value.                  # Compute the link value.
1131                  my $linkable = uri_escape($id);                  my $linkable = uri_escape($id);
1132                  $nodeContent->{link} = "../FIG/display_subsys.cgi?ssa_name=$linkable;request=show_ssa;sort=by_phylo;show_clusters=1;SPROUT=1";                  $nodeContent->{link} = "$svURL?page=Subsystems;subsystem=$linkable";
1133              }              }
1134              if ($optionThing->{radio}) {              if ($optionThing->{radio}) {
1135                  # Compute the radio value.                  # Compute the radio value.
# Line 1144  Line 1147 
1147    
1148  =head3 NmpdrGenomeMenu  =head3 NmpdrGenomeMenu
1149    
1150  C<< my $htmlText = $shelp->NmpdrGenomeMenu($menuName, $multiple, \@selected, $rows); >>      my $htmlText = $shelp->NmpdrGenomeMenu($menuName, $multiple, \@selected, $rows);
1151    
1152  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
1153  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 1173  Line 1176 
1176    
1177  =item crossMenu (optional)  =item crossMenu (optional)
1178    
1179  If specified, is presumed to be the name of another genome menu whose contents  This is currently not supported.
 are to be mutually exclusive with the contents of this menu. As a result, instead  
 of the standard onChange event, the onChange event will deselect any entries in  
 the other menu.  
1180    
1181  =item RETURN  =item RETURN
1182    
# Line 1196  Line 1196 
1196      if (! defined $rows) {      if (! defined $rows) {
1197          $rows = ($multiple ? 10 : 1);          $rows = ($multiple ? 10 : 1);
1198      }      }
1199      # Create the multiple tag.      # Get a comma-delimited list of the preselected genomes.
1200      my $multipleTag = ($multiple ? " multiple" : "");      my $preselected = "";
1201      # Get the form name.      if ($selected) {
1202      my $formName = $self->FormName();          $preselected = join(", ", @$selected);
1203      # Check to see if we already have a genome list in memory.      }
1204      my $groupHash;      # Ask Sprout for a genome menu.
1205      my @groups;      my $retVal = $sprout->GenomeMenu(name => $menuName,
1206      my $nmpdrGroupCount;                                       multiSelect => $multiple,
1207      my $genomes = $self->{genomeList};                                       selected => $preselected,
1208      if (defined $genomes) {                                       size => $rows);
         # We have a list ready to use.  
         $groupHash = $genomes;  
         @groups = @{$self->{groupList}};  
         $nmpdrGroupCount = $self->{groupCount};  
     } else {  
         # Get a list of all the genomes in group order. In fact, we only need them ordered  
         # by name (genus,species,strain), but putting primary-group in front enables us to  
         # take advantage of an existing index.  
         my @genomeList = $sprout->GetAll(['Genome'],  
                                          "ORDER BY Genome(primary-group), Genome(genus), Genome(species), Genome(unique-characterization)",  
                                          [], ['Genome(primary-group)', 'Genome(id)',  
                                               'Genome(genus)', 'Genome(species)',  
                                               'Genome(unique-characterization)',  
                                               'Genome(taxonomy)']);  
         # Create a hash to organize the genomes by group. Each group will contain a list of  
         # 2-tuples, the first element being the genome ID and the second being the genome  
         # name.  
         my %gHash = ();  
         for my $genome (@genomeList) {  
             # Get the genome data.  
             my ($group, $genomeID, $genus, $species, $strain, $taxonomy) = @{$genome};  
             # Compute and cache its name and display group.  
             my ($name, $displayGroup, $domain) = $self->SaveOrganismData($group, $genomeID, $genus, $species,  
                                                                          $strain, $taxonomy);  
             # Push the genome into the group's list. Note that we use the real group  
             # name here, not the display group name.  
             push @{$gHash{$group}}, [$genomeID, $name, $domain];  
         }  
         # We are almost ready to unroll the menu out of the group hash. The final step is to separate  
         # the supporting genomes by domain. First, we sort the NMPDR groups.  
         @groups = sort grep { $_ ne $FIG_Config::otherGroup } keys %gHash;  
         # Remember the number of NMPDR groups.  
         $nmpdrGroupCount = scalar @groups;  
         # Loop through the supporting genomes, classifying them by domain. We'll also keep a list  
         # of the domains found.  
         my @otherGenomes = @{$gHash{$FIG_Config::otherGroup}};  
         my @domains = ();  
         for my $genomeData (@otherGenomes) {  
             my ($genomeID, $name, $domain) = @{$genomeData};  
             if (exists $gHash{$domain}) {  
                 push @{$gHash{$domain}}, $genomeData;  
             } else {  
                 $gHash{$domain} = [$genomeData];  
                 push @domains, $domain;  
             }  
         }  
         # Add the domain groups at the end of the main group list. The main group list will now  
         # contain all the categories we need to display the genomes.  
         push @groups, sort @domains;  
         # Delete the supporting group.  
         delete $gHash{$FIG_Config::otherGroup};  
         # Save the genome list for future use.  
         $self->{genomeList} = \%gHash;  
         $self->{groupList} = \@groups;  
         $self->{groupCount} = $nmpdrGroupCount;  
         $groupHash = \%gHash;  
     }  
     # Next, create a hash that specifies the pre-selected entries. Note that we need to deal  
     # with the possibility of undefined values in the incoming list.  
     my %selectedHash = ();  
     if (defined $selected) {  
         %selectedHash = map { $_ => 1 } grep { defined($_) } @{$selected};  
     }  
     # Now it gets complicated. We need a way to mark all the NMPDR genomes. We take advantage  
     # of the fact they come first in the list. We'll accumulate a count of the NMPDR genomes  
     # and use that to make the selections.  
     my $nmpdrCount = 0;  
     # Create the type counters.  
     my $groupCount = 1;  
     # Compute the ID for the status display.  
     my $divID = "${formName}_${menuName}_status";  
     # Compute the JavaScript call for updating the status.  
     my $showSelect = "showSelected($menuName, '$divID', 1000);";  
     # If multiple selection is supported, create an onChange event.  
     my $onChange = "";  
     if ($cross) {  
         # Here we have a paired menu. Selecting something in our menu unselects it in the  
         # other and redisplays the status of both.  
         $onChange = " onChange=\"crossUnSelect($menuName, '$divID', $cross, '${formName}_${cross}_status', 1000)\"";  
     } elsif ($multiple) {  
         # This is an unpaired menu, so all we do is redisplay our status.  
         $onChange = " onChange=\"$showSelect\"";  
     }  
     # Create the SELECT tag and stuff it into the output array.  
     my @lines = ("<SELECT name=\"$menuName\"$onChange$multipleTag size=\"$rows\">");  
     # Loop through the groups.  
     for my $group (@groups) {  
         # Create the option group tag.  
         my $tag = "<OPTGROUP label=\"$group\">";  
         push @lines, "  $tag";  
         # Get the genomes in the group.  
         for my $genome (@{$groupHash->{$group}}) {  
             # Count this organism if it's NMPDR.  
             if ($nmpdrGroupCount > 0) {  
                 $nmpdrCount++;  
             }  
             # Get the organism ID, name, and domain.  
             my ($genomeID, $name, $domain) = @{$genome};  
             # See if it's selected.  
             my $select = ($selectedHash{$genomeID} ? " selected" : "");  
             # Generate the option tag.  
             my $optionTag = "<OPTION class=\"$domain\" value=\"$genomeID\"$select>$name <em>($genomeID)</em></OPTION>";  
             push @lines, "    $optionTag";  
         }  
         # Close the option group.  
         push @lines, "  </OPTGROUP>";  
         # Record this group in the nmpdrGroup count. When that gets to 0, we've finished the NMPDR  
         # groups.  
         $nmpdrGroupCount--;  
     }  
     # Close the SELECT tag.  
     push @lines, "</SELECT>";  
     # Check for multiple selection.  
     if ($multiple) {  
         # Multi-select is on, so we need to add some selection helpers. First is  
         # the search box. This allows the user to type text and have all genomes containing  
         # the text selected automatically.  
         my $searchThingName = "${menuName}_SearchThing";  
         push @lines, "<br />" .  
                      "<INPUT type=\"button\" name=\"MacroSearch\" class=\"button\" value=\"Select genomes containing\" onClick=\"selectViaSearch($menuName, $searchThingName); $showSelect\" />&nbsp;" .  
                      "<INPUT type=\"text\" name=\"$searchThingName\" size=\"30\" />" . Hint("Genome Control",  
                                                                                             "Enter a genome number, then click the button to the left " .  
                                                                                             "in order to select the genome with that number. " .  
                                                                                             "Enter a genus, species, or strain and click the " .  
                                                                                             "button to select all genomes with that genus, species, " .  
                                                                                             "or strain name.");  
         # Next are the buttons to set and clear selections.  
         push @lines, "<br />";  
         push @lines, "<INPUT type=\"button\" name=\"ClearAll\" class=\"bigButton\"  value=\"Clear All\" onClick=\"clearAll($menuName); $showSelect\" />";  
         push @lines, "<INPUT type=\"button\" name=\"SelectAll\" class=\"bigButton\" value=\"Select All\" onClick=\"selectAll($menuName); $showSelect\" />";  
         push @lines, "<INPUT type=\"button\" name=\"NMPDROnly\" class=\"bigButton\"  value=\"Select NMPDR\" onClick=\"selectSome($menuName, $nmpdrCount, true); $showSelect\" />";  
         # push @lines, "<INPUT type=\"button\" name=\"OtherOnly\" class=\"bigButton\" value=\"Select Supporting\" onClick=\"selectSome($menuName, $nmpdrCount, false); $showSelect\" />";  
         # Add the status display, too.  
         push @lines, "<DIV id=\"$divID\" class=\"selectStatus\"></DIV>";  
         # Queue to update the status display when the form loads. We need to modify the show statement  
         # slightly because the queued statements are executed outside the form. This may seem like a lot of  
         # trouble, but we want all of the show statement calls to be generated from a single line of code,  
         # in case we decide to twiddle the parameters.  
         $showSelect =~ s/showSelected\(/showSelected\(thisForm\./;  
         $self->QueueFormScript($showSelect);  
         # Finally, add this parameter to the list of genome parameters. This enables us to  
         # easily find all the parameters used to select one or more genomes.  
         push @{$self->{genomeParms}}, $menuName;  
     }  
     # Assemble all the lines into a string.  
     my $retVal = join("\n", @lines, "");  
1209      # Return the result.      # Return the result.
1210      return $retVal;      return $retVal;
1211  }  }
1212    
1213  =head3 PropertyMenu  =head3 PropertyMenu
1214    
1215  C<< my $htmlText = $shelp->PropertyMenu($menuName, $selected, $force); >>      my $htmlText = $shelp->PropertyMenu($menuName, $selected, $force);
1216    
1217  Generate a property name dropdown menu.  Generate a property name dropdown menu.
1218    
# Line 1408  Line 1262 
1262    
1263  =head3 MakeTable  =head3 MakeTable
1264    
1265  C<< my $htmlText = $shelp->MakeTable(\@rows); >>      my $htmlText = $shelp->MakeTable(\@rows);
1266    
1267  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
1268  other words, each must have the TR and TD tags included.  other words, each must have the TR and TD tags included.
# Line 1471  Line 1325 
1325    
1326  =head3 SubmitRow  =head3 SubmitRow
1327    
1328  C<< my $htmlText = $shelp->SubmitRow($caption); >>      my $htmlText = $shelp->SubmitRow($caption);
1329    
1330  Returns the HTML text for the row containing the page size control  Returns the HTML text for the row containing the page size control
1331  and the submit button. All searches should have this row somewhere  and the submit button. All searches should have this row somewhere
# Line 1508  Line 1362 
1362                                     $cgi->popup_menu(-name => 'AliasType',                                     $cgi->popup_menu(-name => 'AliasType',
1363                                                      -values => ['FIG', AliasAnalysis::AliasTypes() ],                                                      -values => ['FIG', AliasAnalysis::AliasTypes() ],
1364                                                      -default => $aliasType) .                                                      -default => $aliasType) .
1365                                     Hint("Identifier type", "Specify how you want gene names to be displayed."))) .                                     Hint("Identifier Type", "Specify how you want gene names to be displayed."))) .
1366                   "\n" .                   "\n" .
1367                   $cgi->Tr($cgi->td("Results/Page"),                   $cgi->Tr($cgi->td("Results/Page"),
1368                            $cgi->td($cgi->popup_menu(-name => 'PageSize',                            $cgi->td($cgi->popup_menu(-name => 'PageSize',
# Line 1523  Line 1377 
1377    
1378  =head3 GetGenomes  =head3 GetGenomes
1379    
1380  C<< my @genomeList = $shelp->GetGenomes($parmName); >>      my @genomeList = $shelp->GetGenomes($parmName);
1381    
1382  Return the list of genomes specified by the specified CGI query parameter.  Return the list of genomes specified by the specified CGI query parameter.
1383  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 1565  Line 1419 
1419      return @retVal;      return @retVal;
1420  }  }
1421    
 =head3 GetHelpText  
   
 C<< my $htmlText = $shelp->GetHelpText(); >>  
   
 Get the help text for this search. The help text is stored in files on the template  
 server. The help text for a specific search is taken from a file named  
 C<SearchHelp_>I<class>C<.inc> in the template directory C<$FIG_Config::template_url>.  
 There are also three standard help files: C<SearchHelp1_Filtering.inc> describes the  
 feature filtering performed by the B<RHFeatures> object, C<SearchHelp1_GenomeControl.inc>  
 describes how to use a multiple-selection genome control, and C<SearchHelp1_Standard.inc>  
 describes the standard controls for a search, such as page size, URL display, and  
 external alias display.  
   
 =cut  
   
 sub GetHelpText {  
     # Get the parameters.  
     my ($self) = @_;  
     # Create a list to hold the pieces of the help.  
     my @helps = ();  
     # Get the template directory URL.  
     my $urlBase = $FIG_Config::template_url;  
     # Start with the specific help.  
     my $class = $self->{class};  
     push @helps, PageBuilder::GetPage("$urlBase/SearchHelp_$class.inc");  
     # Add the genome control help if needed.  
     if (scalar @{$self->{genomeParms}}) {  
         push @helps, PageBuilder::GetPage("$urlBase/SearchHelp1_GenomeControl.inc");  
     }  
     # Next the filter help.  
     if ($self->{filtered}) {  
         push @helps, PageBuilder::GetPage("$urlBase/SearchHelp1_Filtering.inc");  
     }  
     # Finally, the standard help.  
     push @helps, PageBuilder::GetPage("$urlBase/SearchHelp1_Standard.inc");  
     # Assemble the pieces.  
     my $retVal = join("\n<p>&nbsp;</p>\n", @helps);  
     # Return the result.  
     return $retVal;  
 }  
   
1422  =head3 ComputeSearchURL  =head3 ComputeSearchURL
1423    
1424  C<< my $url = $shelp->ComputeSearchURL(%overrides); >>      my $url = $shelp->ComputeSearchURL(%overrides);
1425    
1426  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
1427  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 1641  Line 1454 
1454      my $cgi = $self->Q();      my $cgi = $self->Q();
1455      my $sprout = $self->DB();      my $sprout = $self->DB();
1456      # Start with the full URL.      # Start with the full URL.
1457      my $retVal = $cgi->url(-full => 1);      my $retVal = "$FIG_Config::cgi_url/SearchSkeleton.cgi";
1458      # Get all the query parameters in a hash.      # Get all the query parameters in a hash.
1459      my %parms = $cgi->Vars();      my %parms = $cgi->Vars();
1460      # Now we need to do some fixing. Each multi-valued parameter is encoded as a string with null      # Now we need to do some fixing. Each multi-valued parameter is encoded as a string with null
# Line 1701  Line 1514 
1514    
1515  =head3 AdvancedClassList  =head3 AdvancedClassList
1516    
1517  C<< my @classes = SearchHelper::AdvancedClassList(); >>      my @classes = SearchHelper::AdvancedClassList();
1518    
1519  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
1520  of available searches on the search page.  of available searches on the search page.
# Line 1724  Line 1537 
1537    
1538  =head3 SelectionTree  =head3 SelectionTree
1539    
1540  C<< my $htmlText = SearchHelper::SelectionTree($cgi, \%tree, %options); >>      my $htmlText = SearchHelper::SelectionTree($cgi, \%tree, %options);
1541    
1542  Display a selection tree.  Display a selection tree.
1543    
# Line 1833  Line 1646 
1646  =item nodeImageClosed  =item nodeImageClosed
1647    
1648  URL of the image to display next to the tree nodes when they are collapsed. Clicking  URL of the image to display next to the tree nodes when they are collapsed. Clicking
1649  on the image will expand a section of the tree. The default is C<../FIG/Html/plus.gif>.  on the image will expand a section of the tree. The default is C<plus.gif>.
1650    
1651  =item nodeImageOpen  =item nodeImageOpen
1652    
1653  URL of the image to display next to the tree nodes when they are expanded. Clicking  URL of the image to display next to the tree nodes when they are expanded. Clicking
1654  on the image will collapse a section of the tree. The default is C<../FIG/Html/minus.gif>.  on the image will collapse a section of the tree. The default is C<minus.gif>.
1655    
1656  =item style  =item style
1657    
# Line 1878  Line 1691 
1691      my ($cgi, $tree, %options) = @_;      my ($cgi, $tree, %options) = @_;
1692      # Get the options.      # Get the options.
1693      my $optionThing = Tracer::GetOptions({ name => 'selection',      my $optionThing = Tracer::GetOptions({ name => 'selection',
1694                                             nodeImageClosed => '../FIG/Html/plus.gif',                                             nodeImageClosed => "$FIG_Config::cgi_url/Html/plus.gif",
1695                                             nodeImageOpen => '../FIG/Html/minus.gif',                                             nodeImageOpen => "$FIG_Config::cgi_url/Html/minus.gif",
1696                                             style => 'tree',                                             style => 'tree',
1697                                             target => '_self',                                             target => '_self',
1698                                             selected => undef},                                             selected => undef},
# Line 1913  Line 1726 
1726    
1727  =head3 ShowBranch  =head3 ShowBranch
1728    
1729  C<< my @htmlLines = SearchHelper::ShowBranch($cgi, $label, $id, $branch, $options, $displayType); >>      my @htmlLines = SearchHelper::ShowBranch($cgi, $label, $id, $branch, $options, $displayType);
1730    
1731  This is a recursive method that displays a branch of the tree.  This is a recursive method that displays a branch of the tree.
1732    
# Line 2065  Line 1878 
1878    
1879  =head3 GetDivID  =head3 GetDivID
1880    
1881  C<< my $idString = SearchHelper::GetDivID($name); >>      my $idString = SearchHelper::GetDivID($name);
1882    
1883  Return a new HTML ID string.  Return a new HTML ID string.
1884    
# Line 2096  Line 1909 
1909    
1910  =head3 PrintLine  =head3 PrintLine
1911    
1912  C<< $shelp->PrintLine($message); >>      $shelp->PrintLine($message);
1913    
1914  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
1915  searching, so the user sees progress in real-time.  searching, so the user sees progress in real-time.
# Line 2120  Line 1933 
1933    
1934  =head3 GetHelper  =head3 GetHelper
1935    
1936  C<< my $shelp = SearchHelper::GetHelper($parm, $type => $className); >>      my $shelp = SearchHelper::GetHelper($parm, $type => $className);
1937    
1938  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
1939  error will be thrown.  error will be thrown.
# Line 2178  Line 1991 
1991    
1992  =head3 SaveOrganismData  =head3 SaveOrganismData
1993    
1994  C<< my ($name, $displayGroup, $domain) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy); >>      my ($name, $displayGroup, $domain) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy);
1995    
1996  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
1997  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 2252  Line 2065 
2065    
2066  =head3 ValidateKeywords  =head3 ValidateKeywords
2067    
2068  C<< my $okFlag = $shelp->ValidateKeywords($keywordString, $required); >>      my $okFlag = $shelp->ValidateKeywords($keywordString, $required);
2069    
2070  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
2071  set.  set.
# Line 2302  Line 2115 
2115    
2116  =head3 TuningParameters  =head3 TuningParameters
2117    
2118  C<< my $options = $shelp->TuningParameters(%parmHash); >>      my $options = $shelp->TuningParameters(%parmHash);
2119    
2120  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
2121  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 2345  Line 2158 
2158    
2159  =head3 GetPreferredAliasType  =head3 GetPreferredAliasType
2160    
2161  C<< my $type = $shelp->GetPreferredAliasType(); >>      my $type = $shelp->GetPreferredAliasType();
2162    
2163  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
2164  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 2367  Line 2180 
2180    
2181  =head3 Form  =head3 Form
2182    
2183  C<< my $html = $shelp->Form(); >>      my $html = $shelp->Form();
2184    
2185  Generate the HTML for a form to request a new search.  Generate the HTML for a form to request a new search.
2186    
2187  =head3 Find  =head3 Find
2188    
2189  C<< my $resultCount = $shelp->Find(); >>      my $resultCount = $shelp->Find();
2190    
2191  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
2192  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 2391  Line 2204 
2204    
2205  =head3 Description  =head3 Description
2206    
2207  C<< my $htmlText = $shelp->Description(); >>      my $htmlText = $shelp->Description();
2208    
2209  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
2210  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 2408  Line 2221 
2221    
2222  =head3 SearchTitle  =head3 SearchTitle
2223    
2224  C<< my $titleHtml = $shelp->SearchTitle(); >>      my $titleHtml = $shelp->SearchTitle();
2225    
2226  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.
2227  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 2427  Line 2240 
2240    
2241  =head3 DefaultColumns  =head3 DefaultColumns
2242    
2243  C<< $shelp->DefaultColumns($rhelp); >>      $shelp->DefaultColumns($rhelp);
2244    
2245  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
2246  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 2454  Line 2267 
2267    
2268  =head3 Hint  =head3 Hint
2269    
2270  C<< my $htmlText = SearchHelper::Hint($wikiPage, $hintText); >>      my $htmlText = SearchHelper::Hint($wikiPage, $hintText);
2271    
2272  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.
2273  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.
# Line 2463  Line 2276 
2276    
2277  =item wikiPage  =item wikiPage
2278    
2279  Name of the wiki page to be popped up when the hint maek is clicked.  Name of the wiki page to be popped up when the hint mark is clicked.
2280    
2281  =item hintText  =item hintText
2282    
# Line 2481  Line 2294 
2294  sub Hint {  sub Hint {
2295      # Get the parameters.      # Get the parameters.
2296      my ($wikiPage, $hintText) = @_;      my ($wikiPage, $hintText) = @_;
2297      # Escape the single quotes in the hint text.      # Ask Sprout to draw the hint button for us.
2298      my $quotedText = $hintText;      return Sprout::Hint($wikiPage, $hintText);
     $quotedText =~ s/'/\\'/g;  
     # Convert the wiki page name to a URL.  
     my $wikiURL = ucfirst $wikiPage;  
     $wikiURL =~ s/ /_/g;  
     $wikiURL = "../wiki/index.php/$wikiURL";  
     # Create the html.  
     my $retVal = "&nbsp;<input type=\"button\" class=\"hintbutton\" onMouseOver=\"javascript:if (!this.tooltip) { " .  
                  "this.tooltip = new Popup_Tooltip(this, 'Search Hint', '$quotedText', '', 1); this.tooltip.addHandler(); } " .  
                  "return false;\" value=\"?\" onClick=\"javascript:window.open('$wikiURL', 'nmpdrHelp');\" />";  
     # Return it.  
     return $retVal;  
2299  }  }
2300    
2301    

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.41

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3