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

Diff of /Sprout/Sprout.pm

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

revision 1.122, Mon Jan 19 21:46:21 2009 UTC revision 1.125, Mon Mar 16 00:24:23 2009 UTC
# Line 133  Line 133 
133                         maxSegmentLength => 4500,        # maximum feature segment length                         maxSegmentLength => 4500,        # maximum feature segment length
134                         maxSequenceLength => 8000,       # maximum contig sequence length                         maxSequenceLength => 8000,       # maximum contig sequence length
135                         noDBOpen     => 0,               # 1 to suppress the database open                         noDBOpen     => 0,               # 1 to suppress the database open
136                           demandDriven => 0,               # 1 for forward-only queries
137                        }, $options);                        }, $options);
138      # Get the data directory.      # Get the data directory.
139      my $dataDir = $optionTable->{dataDir};      my $dataDir = $optionTable->{dataDir};
# Line 148  Line 149 
149      }      }
150      # Create the ERDB object.      # Create the ERDB object.
151      my $xmlFileName = "$optionTable->{xmlFileName}";      my $xmlFileName = "$optionTable->{xmlFileName}";
152      my $retVal = ERDB::new($class, $dbh, $xmlFileName);      my $retVal = ERDB::new($class, $dbh, $xmlFileName, %$optionTable);
153      # Add the option table and XML file name.      # Add the option table and XML file name.
154      $retVal->{_options} = $optionTable;      $retVal->{_options} = $optionTable;
155      $retVal->{_xmlName} = $xmlFileName;      $retVal->{_xmlName} = $xmlFileName;
# Line 298  Line 299 
299                  $retVal = $superGroup;                  $retVal = $superGroup;
300              }              }
301          }          }
         # Make sure we found something.  
         if (! $retVal) {  
             Confess("No super-group found for \"$groupName\".");  
         }  
302      }      }
303      # Return the result.      # Return the result.
304      return $retVal;      return $retVal;
# Line 688  Line 685 
685      # Set up the multiple-select flag.      # Set up the multiple-select flag.
686      my $multipleTag = ($multiSelect ? " multiple" : "" );      my $multipleTag = ($multiSelect ? " multiple" : "" );
687      # Set up the style class.      # Set up the style class.
688      my $classTag = ($class ? " class=\"$class\"" : "" );      my $classTag = ($class ? " $class" : "" );
689      # Create the SELECT tag and stuff it into the output array.      # Create the SELECT tag and stuff it into the output array.
690      my @lines = ("<SELECT name=\"$menuName\" id=\"$menuID\" $onChangeTag$multipleTag$classTag size=\"$rows\">");      my @lines = qq(<SELECT name="$menuName" id="$menuID" class="genomeSelect $class" $onChangeTag$multipleTag$classTag size="$rows">);
691      # Loop through the groups.      # Loop through the groups.
692      for my $group (@groups) {      for my $group (@groups) {
693          # Get the genomes in the group.          # Get the genomes in the group.
# Line 723  Line 720 
720          # displayed. For multiple-select mode, we include a button that selects the displayed          # displayed. For multiple-select mode, we include a button that selects the displayed
721          # genes. For single-select mode, we use a plain label instead.          # genes. For single-select mode, we use a plain label instead.
722          my $searchThingName = "${menuID}_SearchThing";          my $searchThingName = "${menuID}_SearchThing";
723          my $searchThingLabel = ($multiSelect ? "<INPUT type=\"button\" name=\"MacroSearch\" class=\"button\" value=\"Select genomes containing\" onClick=\"selectShowing('$menuID', '$searchThingName'); $showSelect;\" />"          my $searchThingLabel = "Type to narrow selection";
724                                               : "Show genomes containing");          my $searchThingButton = "";
725            if ($multiSelect) {
726                $searchThingButton = qq(<INPUT type="button" name="MacroSearch" class="button" value="Go" onClick="selectShowing('$menuID', '$searchThingName'); $showSelect;" />);
727            }
728          push @lines, "<br />$searchThingLabel&nbsp;" .          push @lines, "<br />$searchThingLabel&nbsp;" .
729                       "<INPUT type=\"text\" id=\"$searchThingName\" name=\"$searchThingName\" size=\"30\" onKeyup=\"showTyped('$menuID', '$searchThingName');\" />" .                       qq(<INPUT type="text" id="$searchThingName" name="$searchThingName" class="genomeSearchThing" onKeyup="showTyped('$menuID', '$searchThingName');" />) .
730                       Hint("GenomeControl", "Type here to filter the genomes displayed.") . "<br />";                       $searchThingButton .
731                         Hint("GenomeControl", 28) . "<br />";
732          # For multi-select mode, we also have buttons to set and clear selections.          # For multi-select mode, we also have buttons to set and clear selections.
733          if ($multiSelect) {          if ($multiSelect) {
734              push @lines, "<INPUT type=\"button\" name=\"ClearAll\" class=\"bigButton\"  value=\"Clear All\" onClick=\"clearAll(getElementById('$menuID')); $showSelect\" />";              push @lines, qq(<INPUT type="button" name="ClearAll" class="bigButton genomeButton" value="Clear All" onClick="clearAll(getElementById('$menuID')); $showSelect" />);
735              push @lines, "<INPUT type=\"button\" name=\"SelectAll\" class=\"bigButton\" value=\"Select All\" onClick=\"selectAll(getElementById('$menuID')); $showSelect\" />";              push @lines, qq(<INPUT type="button" name="SelectAll" class="bigButton genomeButton" value="Select All" onClick="selectAll(getElementById('$menuID')); $showSelect" />);
736              push @lines, "<INPUT type=\"button\" name=\"NMPDROnly\" class=\"bigButton\"  value=\"Select NMPDR\" onClick=\"selectSome(getElementById('$menuID'), $nmpdrCount, true); $showSelect;\" />";              push @lines, qq(<INPUT type="button" name="NMPDROnly" class="bigButton genomeButton" value="Select NMPDR" onClick="selectSome(getElementById('$menuID'), $nmpdrCount, true); $showSelect;" />);
737          }          }
738          # Add a hidden field we can use to generate organism page hyperlinks.          # Add a hidden field we can use to generate organism page hyperlinks.
739          push @lines, "<INPUT type=\"hidden\" id=\"$urlID\" value=\"$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer?page=Organism;organism=\" />";          push @lines, qq(<INPUT type="hidden" id="$urlID" value="$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer?page=Organism;organism=" />);
740          # Add the status display. This tells the user what's selected no matter where the list is scrolled.          # Add the status display. This tells the user what's selected no matter where the list is scrolled.
741          push @lines, "<DIV id=\"$divID\" class=\"Panel\"></DIV>";          push @lines, qq(<DIV id="$divID" class="Panel"></DIV>);
742      }      }
743      # Assemble all the lines into a string.      # Assemble all the lines into a string.
744      my $retVal = join("\n", @lines, "");      my $retVal = join("\n", @lines, "");
# Line 3978  Line 3979 
3979    
3980  =over 4  =over 4
3981    
3982  =item page  =item specials
3983    
3984  The super-group's web page in the NMPDR.  Reference to a hash whose keys are the names of special species.
3985    
3986  =item contents  =item contents
3987    
# Line 4003  Line 4004 
4004          my @groupLines = Tracer::GetFile("$FIG_Config::sproutData/groups.tbl");          my @groupLines = Tracer::GetFile("$FIG_Config::sproutData/groups.tbl");
4005          # Loop through the list of sort-of groups.          # Loop through the list of sort-of groups.
4006          for my $groupLine (@groupLines) {          for my $groupLine (@groupLines) {
4007              my ($name, $page, @contents) = split /\t/, $groupLine;              my ($name, $specials, @contents) = split /\t/, $groupLine;
4008              $groupHash{$name} = { page => $page,              $groupHash{$name} = { specials => { map { $_ => 1 } split /\s*,\s*/, $specials },
4009                                    contents => [ map { [ split /\s*,\s*/, $_ ] } @contents ]                                    contents => [ map { [ split /\s*,\s*/, $_ ] } @contents ]
4010                                  };                                  };
4011          }          }
# Line 4319  Line 4320 
4320    
4321  =head3 Hint  =head3 Hint
4322    
4323      my $htmlText = SearchHelper::Hint($wikiPage, $hintText);      my $htmlText = Sprout::Hint($wikiPage, $hintID);
4324    
4325  Return the HTML for a small question mark that displays the specified hint text when it is clicked.  Return the HTML for a help link that displays the specified hint text when it is clicked.
4326  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.
4327    
4328  =over 4  =over 4
# Line 4330  Line 4331 
4331    
4332  Name of the wiki page to be popped up when the hint mark is clicked.  Name of the wiki page to be popped up when the hint mark is clicked.
4333    
4334  =item hintText  =item hintID
4335    
4336  Text to display for the hint. It is raw html, but may not contain any double quotes.  ID of the text to display for the hint. This should correspond to a tip number
4337    in the Wiki.
4338    
4339  =item RETURN  =item RETURN
4340    
4341  Returns the html for the hint facility. The resulting html shows a small button-like thing that  Returns the html for the hint facility. The resulting html shows the word "help" and
4342  uses the standard FIG popup technology.  uses the standard FIG popup technology.
4343    
4344  =back  =back
# Line 4345  Line 4347 
4347    
4348  sub Hint {  sub Hint {
4349      # Get the parameters.      # Get the parameters.
4350      my ($wikiPage, $hintText) = @_;      my ($wikiPage, $hintID) = @_;
4351      # Escape the single quotes in the hint text.      # Declare the return variable.
4352      my $quotedText = $hintText;      my $retVal;
     $quotedText =~ s/'/\\'/g;  
4353      # Convert the wiki page name to a URL.      # Convert the wiki page name to a URL.
4354      my $wikiURL = join("", map { ucfirst $_ } split /\s+/, $wikiPage);      my $wikiURL;
4355      $wikiURL = "$FIG_Config::cgi_url/wiki/view.cgi/FIG/$wikiURL";      if ($wikiPage =~ m#/#) {
4356      # Compute the mouseover script.          # Here it's a URL of some sort.
4357      my $mouseOver = "doTooltip(this, '$quotedText')";          $wikiURL = $wikiPage;
4358      # Create the html.      } else {
4359      my $retVal = "&nbsp;<a href=\"$wikiURL\"><img src=\"$FIG_Config::cgi_url/Html/button-h.png\" class=\"helpicon\" onmouseover=\"$mouseOver\"/></a>";          # Here it's a wiki page.
4360      # Return it.          my $page = join("", map { ucfirst $_ } split /\s+/, $wikiPage);
4361            if ($page =~ /^(.+?)\.(.+)$/) {
4362                $page = "$1/$2";
4363            } else {
4364                $page = "FIG/$page";
4365            }
4366            $wikiURL = "$FIG_Config::cgi_url/wiki/view.cgi/$page";
4367        }
4368        # Is there hint text?
4369        if (! $hintID) {
4370            # No. Create a new-page hint.
4371            $retVal = qq(&nbsp;<a class="hint" onclick="doPagePopup(this, '$wikiURL')">(help)</a>);
4372        } else {
4373            # With hint text, we create a popup window hint. We need to compute the hint URL.
4374            my $tipURL = "$FIG_Config::cgi_url/wiki/view.cgi/FIG/TWikiCustomTip" .
4375                Tracer::Pad($hintID, 3, 1, "0");
4376            # Create a hint pop-up link.
4377            $retVal = qq(&nbsp;<a class="hint" onclick="doHintPopup(this, '$wikiURL', '$tipURL')">(help)</a>);
4378        }
4379        # Return the HTML.
4380      return $retVal;      return $retVal;
4381  }  }
4382    

Legend:
Removed from v.1.122  
changed lines
  Added in v.1.125

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3