[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.37, Mon Aug 20 23:22:42 2007 UTC
# 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 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 1330  Line 1326 
1326          my $searchThingName = "${menuName}_SearchThing";          my $searchThingName = "${menuName}_SearchThing";
1327          push @lines, "<br />" .          push @lines, "<br />" .
1328                       "<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;" .
1329                       "<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",
1330                                                                                                "Enter a genome number, then click the button to the left " .
1331                                                                                              "in order to select the genome with that number. " .                                                                                              "in order to select the genome with that number. " .
1332                                                                                              "Enter a genus, species, or strain and click the " .                                                                                              "Enter a genus, species, or strain and click the " .
1333                                                                                              "button to select all genomes with that genus, species, " .                                                                                              "button to select all genomes with that genus, species, " .
# Line 1340  Line 1337 
1337          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\" />";
1338          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\" />";
1339          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\" />";
1340          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\" />";
1341          # Add the status display, too.          # Add the status display, too.
1342          push @lines, "<DIV id=\"$divID\" class=\"selectStatus\"></DIV>";          push @lines, "<DIV id=\"$divID\" class=\"selectStatus\"></DIV>";
1343          # 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 1506  Line 1503 
1503      # Get the current feature ID type.      # Get the current feature ID type.
1504      my $aliasType = $self->GetPreferredAliasType();      my $aliasType = $self->GetPreferredAliasType();
1505      # Create the rows.      # Create the rows.
1506      my $retVal = $cgi->Tr($cgi->td("ID Type"), $cgi->td({ colspan => 2 },      my $retVal = $cgi->Tr($cgi->td("Identifier Type "),
1507                              $cgi->td({ colspan => 2 },
1508                                                          $cgi->popup_menu(-name => 'AliasType',                                                          $cgi->popup_menu(-name => 'AliasType',
1509                                                                           -values => ['FIG', AliasAnalysis::AliasTypes() ],                                                                           -values => ['FIG', AliasAnalysis::AliasTypes() ],
1510                                                                           -default => $aliasType) .                                                                           -default => $aliasType) .
1511                                                          Hint("Specify how you want gene names to be displayed."))) .                                     Hint("Identifier type", "Specify how you want gene names to be displayed."))) .
1512                   "\n" .                   "\n" .
1513                   $cgi->Tr($cgi->td("Results/Page"),                   $cgi->Tr($cgi->td("Results/Page"),
1514                            $cgi->td($cgi->popup_menu(-name => 'PageSize',                            $cgi->td($cgi->popup_menu(-name => 'PageSize',
# Line 2180  Line 2178 
2178    
2179  =head3 SaveOrganismData  =head3 SaveOrganismData
2180    
2181  C<< my ($name, $displayGroup) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy); >>  C<< my ($name, $displayGroup, $domain) = $shelp->SaveOrganismData($group, $genomeID, $genus, $species, $strain, $taxonomy); >>
2182    
2183  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
2184  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 2239 
2239          # 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
2240          # name unless it's the supporting group, which is nulled out.          # name unless it's the supporting group, which is nulled out.
2241          $displayGroup = ($group eq $FIG_Config::otherGroup ? "" : $group);          $displayGroup = ($group eq $FIG_Config::otherGroup ? "" : $group);
2242            Trace("Group = $displayGroup, translated from \"$group\".") if T(4);
2243      }      }
2244      # Compute the domain from the taxonomy.      # Compute the domain from the taxonomy.
2245      my ($domain) = split /\s*;\s*/, $taxonomy, 2;      my ($domain) = split /\s*;\s*/, $taxonomy, 2;
# Line 2455  Line 2454 
2454    
2455  =head3 Hint  =head3 Hint
2456    
2457  C<< my $htmlText = SearchHelper::Hint($hintText); >>  C<< my $htmlText = SearchHelper::Hint($wikiPage, $hintText); >>
2458    
2459  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.
2460  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.
2461    
2462  =over 4  =over 4
2463    
2464    =item wikiPage
2465    
2466    Name of the wiki page to be popped up when the hint maek is clicked.
2467    
2468  =item hintText  =item hintText
2469    
2470  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 2480 
2480    
2481  sub Hint {  sub Hint {
2482      # Get the parameters.      # Get the parameters.
2483      my ($hintText) = @_;      my ($wikiPage, $hintText) = @_;
2484      # Escape the single quotes.      # Escape the single quotes in the hint text.
2485      my $quotedText = $hintText;      my $quotedText = $hintText;
2486      $quotedText =~ s/'/\\'/g;      $quotedText =~ s/'/\\'/g;
2487        # Convert the wiki page name to a URL.
2488        my $wikiURL = ucfirst $wikiPage;
2489        $wikiURL =~ s/ /_/g;
2490        $wikiURL = "../wiki/index.php/$wikiURL";
2491      # Create the html.      # Create the html.
2492      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) { " .
2493                   "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(); } " .
2494                   "return false;\" value=\"?\" />";                   "return false;\" value=\"?\" onClick=\"javascript:window.open('$wikiURL', 'nmpdrHelp');\" />";
2495      # Return it.      # Return it.
2496      return $retVal;      return $retVal;
2497  }  }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3