[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.22, Sat Dec 2 09:45:30 2006 UTC revision 1.23, Wed Dec 6 03:35:42 2006 UTC
# Line 679  Line 679 
679          push @colNames, $self->DefaultFeatureColumns();          push @colNames, $self->DefaultFeatureColumns();
680          # Add any additional columns requested by the feature filter.          # Add any additional columns requested by the feature filter.
681          push @colNames, FeatureQuery::AdditionalColumns($self);          push @colNames, FeatureQuery::AdditionalColumns($self);
682            Trace("Full column list determined.") if T(3);
683          # Save the full list.          # Save the full list.
684          $self->{cols} = \@colNames;          $self->{cols} = \@colNames;
685          # 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
686          # output.          # output.
687            Trace("Writing column headers.") if T(3);
688          $self->WriteColumnHeaders(map { $self->FeatureColumnTitle($_) } @{$self->{cols}});          $self->WriteColumnHeaders(map { $self->FeatureColumnTitle($_) } @{$self->{cols}});
689            Trace("Column headers written.") if T(3);
690      }      }
691      # Get the feature ID.      # Get the feature ID.
692      my $fid = $fd->FID();      my $fid = $fd->FID();
# Line 2377  Line 2380 
2380          ($retVal) = $record->Value('Feature(assignment)');          ($retVal) = $record->Value('Feature(assignment)');
2381      } elsif ($colName eq 'gblink') {      } elsif ($colName eq 'gblink') {
2382          # Here we want a link to the GBrowse page using the official GBrowse button.          # Here we want a link to the GBrowse page using the official GBrowse button.
2383          $retVal = Formlet('GBrowse', "GetGBrowse.cgi", undef,          $retVal = FakeButton('GBrowse', "GetGBrowse.cgi", undef,
2384                            fid => $fid);                            fid => $fid);
2385      } elsif ($colName eq 'group') {      } elsif ($colName eq 'group') {
2386          # Get the NMPDR group name.          # Get the NMPDR group name.
# Line 2395  Line 2398 
2398          $retVal = $self->FeatureName($fid);          $retVal = $self->FeatureName($fid);
2399      } elsif ($colName eq 'protlink') {      } elsif ($colName eq 'protlink') {
2400          # Here we want a link to the protein page using the official NMPDR button.          # Here we want a link to the protein page using the official NMPDR button.
2401          $retVal = Formlet('NMPDR', "protein.cgi", undef,          $retVal = FakeButton('NMPDR', "protein.cgi", undef,
2402                            prot => $fid, SPROUT => 1, new_framework => 0,                            prot => $fid, SPROUT => 1, new_framework => 0,
2403                            user => '');                            user => '');
2404      }elsif ($colName eq 'subsystem') {      }elsif ($colName eq 'subsystem') {
# Line 2601  Line 2604 
2604      return $retVal;      return $retVal;
2605  }  }
2606    
2607    =head3 FakeButton
2608    
2609    C<< my $html = SearchHelper::FakeButton($caption, $url, $target, %parms); >>
2610    
2611    Create a fake button that hyperlinks to the specified URL with the specified parameters.
2612    Unlike a real button, this one won't visibly click, but it will take the user to the
2613    correct place.
2614    
2615    The parameters of this method are deliberately identical to L</Formlet> so that we
2616    can switch easily from real buttons to fake ones in the code.
2617    
2618    =over 4
2619    
2620    =item caption
2621    
2622    Caption to be put on the button.
2623    
2624    =item url
2625    
2626    URL for the target page or script.
2627    
2628    =item target
2629    
2630    Frame or target in which the new page should appear. If C<undef> is specified,
2631    the default target will be used.
2632    
2633    =item parms
2634    
2635    Hash containing the parameter names as keys and the parameter values as values.
2636    These will be appended to the URL.
2637    
2638    =back
2639    
2640    =cut
2641    
2642    sub FakeButton {
2643        # Get the parameters.
2644        my ($caption, $url, $target, %parms) = @_;
2645        # Declare the return variable.
2646        my $retVal;
2647        # Compute the target URL.
2648        my $targetUrl = "$url?" . join(";", map { "$_=" . uri_escape($parms{$_}) } keys %parms);
2649        # Compute the target-frame HTML.
2650        my $targetHtml = ($target ? " target=\"$target\"" : "");
2651        # Assemble the result.
2652        return "<a href=\"$targetUrl\" $targetHtml><div class=\"button2 button\">$caption</div></a>";
2653    }
2654    
2655  =head3 Formlet  =head3 Formlet
2656    
2657  C<< my $html = SearchHelper::Formlet($caption, $url, $target, %parms); >>  C<< my $html = SearchHelper::Formlet($caption, $url, $target, %parms); >>

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3