[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.109, Sun Mar 23 16:32:05 2008 UTC revision 1.110, Tue Apr 29 20:54:51 2008 UTC
# Line 519  Line 519 
519  A comma-delimited list of selected genomes, or a reference to a list of selected genomes. The  A comma-delimited list of selected genomes, or a reference to a list of selected genomes. The
520  default is none.  default is none.
521    
522  =item inTable  =item class
523    
524  If TRUE, then backslashes will be included at the end of each line in the resulting HTML. This enables the control  If specified, a style class to assign to the genome control.
 to be used in TWiki tables.  
525    
526  =back  =back
527    
# Line 541  Line 540 
540      my $showSelect = "showSelected('$menuID', '$divID', '$urlID', 1000)";      my $showSelect = "showSelected('$menuID', '$divID', '$urlID', 1000)";
541      # Check for single-select or multi-select.      # Check for single-select or multi-select.
542      my $multiSelect = $options{multiSelect} || 0;      my $multiSelect = $options{multiSelect} || 0;
543        # Get the style data.
544        my $class = $options{class} || '';
545      # Get the list of pre-selected items.      # Get the list of pre-selected items.
546      my $selections = $options{selected} || [];      my $selections = $options{selected} || [];
547      if (ref $selections ne 'ARRAY') {      if (ref $selections ne 'ARRAY') {
# Line 619  Line 620 
620      my $onChangeTag = ( $rows > 1 ? " onChange=\"$showSelect;\" onFocus=\"$showSelect;\"" : "" );      my $onChangeTag = ( $rows > 1 ? " onChange=\"$showSelect;\" onFocus=\"$showSelect;\"" : "" );
621      # Set up the multiple-select flag.      # Set up the multiple-select flag.
622      my $multipleTag = ($multiSelect ? " multiple" : "" );      my $multipleTag = ($multiSelect ? " multiple" : "" );
623        # Set up the style class.
624        my $classTag = ($class ? " class=\"$class\"" : "" );
625      # Create the SELECT tag and stuff it into the output array.      # Create the SELECT tag and stuff it into the output array.
626      my @lines = ("<SELECT name=\"$menuID\" id=\"$menuID\" $onChangeTag$multipleTag size=\"$rows\" style=\"width: 100%\">");      my @lines = ("<SELECT name=\"$menuID\" id=\"$menuID\" $onChangeTag$multipleTag$classTag size=\"$rows\">");
627      # Loop through the groups.      # Loop through the groups.
628      for my $group (@groups) {      for my $group (@groups) {
629          # Get the genomes in the group.          # Get the genomes in the group.
# Line 668  Line 671 
671          # 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.
672          push @lines, "<DIV id=\"$divID\" class=\"Panel\"></DIV>";          push @lines, "<DIV id=\"$divID\" class=\"Panel\"></DIV>";
673      }      }
674      # Assemble all the lines into a string. This is where we do the "inTable" thing to insure we don't mess up TWiki tables.      # Assemble all the lines into a string.
675      my $delim = ($options{inTable} ? "\\" : "" ) . "\n";      my $retVal = join("\n", @lines, "");
     my $retVal = join($delim, @lines, "");  
676      # Return the result.      # Return the result.
677      return $retVal;      return $retVal;
678  }  }
# Line 813  Line 815 
815  =item RETURN  =item RETURN
816    
817  Returns a list of the feature's contig segments. The locations are returned as a list in a list  Returns a list of the feature's contig segments. The locations are returned as a list in a list
818  context and as a comma-delimited string in a scalar context.  context and as a comma-delimited string in a scalar context. An empty list means the feature
819    wasn't found.
820    
821  =back  =back
822    
# Line 822  Line 825 
825  sub FeatureLocation {  sub FeatureLocation {
826      # Get the parameters.      # Get the parameters.
827      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
828        # Declare the return variable.
829        my @retVal = ();
830      # Get the feature record.      # Get the feature record.
831      my $object = $self->GetEntity('Feature', $featureID);      my $object = $self->GetEntity('Feature', $featureID);
832      Confess("Feature $featureID not found.") if ! defined($object);      # Only proceed if we found it.
833        if (defined $object) {
834      # Get the location string.      # Get the location string.
835      my $locString = $object->PrimaryValue('Feature(location-string)');      my $locString = $object->PrimaryValue('Feature(location-string)');
836      # Create the return list.      # Create the return list.
837      my @retVal = split /\s*,\s*/, $locString;          @retVal = split /\s*,\s*/, $locString;
838        }
839      # Return the list in the format indicated by the context.      # Return the list in the format indicated by the context.
840      return (wantarray ? @retVal : join(',', @retVal));      return (wantarray ? @retVal : join(',', @retVal));
841  }  }

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.110

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3