[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.13, Fri Nov 3 00:40:16 2006 UTC revision 1.14, Wed Nov 8 23:18:24 2006 UTC
# Line 177  Line 177 
177    
178  =back  =back
179    
180    If you are doing a feature search, you can also change the list of feature
181    columns displayed and their display order by overriding
182    L</DefaultFeatureColumns>.
183    
184  Finally, when generating the code for your controls, be sure to use any incoming  Finally, when generating the code for your controls, be sure to use any incoming
185  query parameters as default values so that the search request is persistent.  query parameters as default values so that the search request is persistent.
186    
# Line 222  Line 226 
226      }      }
227    
228  A Find method is of course much more complicated than generating a form, and there  A Find method is of course much more complicated than generating a form, and there
229  are variations on the above them. For example, you could eschew feature filtering  are variations on the above theme. For example, you could eschew feature filtering
230  entirely in favor of your own custom filtering, you could include extra columns  entirely in favor of your own custom filtering, you could include extra columns
231  in the output, or you could search for something that's not a feature at all. The  in the output, or you could search for something that's not a feature at all. The
232  above code is just a loose framework.  above code is just a loose framework.
# Line 654  Line 658 
658      my $extraCols = $fd->ExtraCols();      my $extraCols = $fd->ExtraCols();
659      # Check for a first-call situation.      # Check for a first-call situation.
660      if (! defined $self->{cols}) {      if (! defined $self->{cols}) {
661          # Here we need to set up the column information. Start with the defaults.          Trace("Setting up the columns.") if T(3);
662          $self->{cols} = $self->DefaultFeatureColumns();          # Here we need to set up the column information. Start with the extras,
663          # Add any additional columns requested by the feature filter.          # sorted by column name.
664          push @{$self->{cols}}, FeatureQuery::AdditionalColumns($self);          my @colNames = ();
         # Append the extras, sorted by column name.  
665          for my $col (sort keys %{$extraCols}) {          for my $col (sort keys %{$extraCols}) {
666              push @{$self->{cols}}, "X=$col";              push @colNames, "X=$col";
667          }          }
668            # Add the default columns.
669            push @colNames, $self->DefaultFeatureColumns();
670            # Add any additional columns requested by the feature filter.
671            push @colNames, FeatureQuery::AdditionalColumns($self);
672            # Save the full list.
673            $self->{cols} = \@colNames;
674          # Write out the column headers. This also prepares the cache file to receive          # Write out the column headers. This also prepares the cache file to receive
675          # output.          # output.
676          $self->WriteColumnHeaders(map { $self->FeatureColumnTitle($_) } @{$self->{cols}});          $self->WriteColumnHeaders(map { $self->FeatureColumnTitle($_) } @{$self->{cols}});
# Line 1692  Line 1701 
1701    
1702  =head3 DefaultFeatureColumns  =head3 DefaultFeatureColumns
1703    
1704  C<< my $colNames = $shelp->DefaultFeatureColumns(); >>  C<< my @colNames = $shelp->DefaultFeatureColumns(); >>
1705    
1706  Return a reference to a list of the default feature column identifiers. These  Return a list of the default feature column identifiers. These identifiers can
1707  identifiers can be passed to L</FeatureColumnTitle> and L</FeatureColumnValue> in  be passed to L</FeatureColumnTitle> and L</FeatureColumnValue> in order to
1708  order to produce the column titles and row values.  produce the column titles and row values.
1709    
1710  =cut  =cut
1711    
# Line 1704  Line 1713 
1713      # Get the parameters.      # Get the parameters.
1714      my ($self) = @_;      my ($self) = @_;
1715      # Return the result.      # Return the result.
1716      return ['orgName', 'function', 'gblink', 'protlink',      return qw(orgName function gblink protlink);
             FeatureQuery::AdditionalColumns($self)];  
1717  }  }
1718    
1719  =head3 FeatureColumnTitle  =head3 FeatureColumnTitle
# Line 1750  Line 1758 
1758      } elsif ($colName =~ /^keyword:(.+)$/) {      } elsif ($colName =~ /^keyword:(.+)$/) {
1759          $retVal = ucfirst $1;          $retVal = ucfirst $1;
1760      } elsif ($colName eq 'orgName') {      } elsif ($colName eq 'orgName') {
1761          $retVal = "Name";          $retVal = "Feature Name";
1762      } elsif ($colName eq 'protlink') {      } elsif ($colName eq 'protlink') {
1763          $retVal = "NMPDR Protein Page";          $retVal = "NMPDR Protein Page";
1764      } elsif ($colName eq 'subsystem') {      } elsif ($colName eq 'subsystem') {
# Line 1838  Line 1846 
1846      } elsif ($colName =~ /^keyword:(.+)$/) {      } elsif ($colName =~ /^keyword:(.+)$/) {
1847          # Here we want keyword-related values. This is also expensive, so          # Here we want keyword-related values. This is also expensive, so
1848          # we compute them when the row is displayed.          # we compute them when the row is displayed.
1849          $retVal = "%%colName=$fid";          $retVal = "%%$colName=$fid";
1850      } elsif ($colName eq 'orgName') {      } elsif ($colName eq 'orgName') {
1851          # Here we want the formatted organism name and feature number.          # Here we want the formatted organism name and feature number.
1852          $retVal = $self->FeatureName($fid);          $retVal = $self->FeatureName($fid);
# Line 1890  Line 1898 
1898      # Get the Sprout and CGI objects.      # Get the Sprout and CGI objects.
1899      my $sprout = $self->DB();      my $sprout = $self->DB();
1900      my $cgi = $self->Q();      my $cgi = $self->Q();
1901        Trace("Runtime column $type with text \"$text\" found.") if T(4);
1902      # Separate the text into a type and data.      # Separate the text into a type and data.
1903      if ($type eq 'alias') {      if ($type eq 'alias') {
1904          # Here the caller wants external alias links for a feature. The text          # Here the caller wants external alias links for a feature. The text

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3