[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.20, Tue Nov 21 17:23:41 2006 UTC revision 1.25, Wed Dec 20 20:06:17 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 1042  Line 1045 
1045          $fastaData =~ s/\n//g;          $fastaData =~ s/\n//g;
1046          $fastaData =~ s/\s+//g;          $fastaData =~ s/\s+//g;
1047          # Finally, verify that it's DNA if we're doing DNA stuff.          # Finally, verify that it's DNA if we're doing DNA stuff.
1048          if ($desiredType eq 'dna' && $fastaData =~ /[^agct]/i) {          if ($desiredType eq 'dna' && $fastaData =~ /[^agctxn]/i) {
1049              $self->SetMessage("Invaid characters detected. Is the input really a DNA sequence?");              $self->SetMessage("Invalid characters detected. Is the input really a DNA sequence?");
1050              $okFlag = 0;              $okFlag = 0;
1051          }          }
1052      }      }
# Line 1519  Line 1522 
1522      my $retVal = $cgi->Tr($cgi->td("Results/Page"),      my $retVal = $cgi->Tr($cgi->td("Results/Page"),
1523                            $cgi->td($cgi->popup_menu(-name => 'PageSize',                            $cgi->td($cgi->popup_menu(-name => 'PageSize',
1524                                                      -values => [10, 25, 50, 100, 1000],                                                      -values => [10, 25, 50, 100, 1000],
1525                                                      -default => $pageSize) . " " .                                                      -default => $pageSize)),
                                    $cgi->checkbox(-name => 'ShowURL',  
                                                   -value => 1,  
                                                   -label => 'Show URL')),  
1526                            $cgi->td($cgi->submit(-class => 'goButton',                            $cgi->td($cgi->submit(-class => 'goButton',
1527                                                  -name => 'Search',                                                  -name => 'Search',
1528                                                  -value => $realCaption)));                                                  -value => $realCaption)));
# Line 2303  Line 2303 
2303      } elsif ($colName =~ /^keyword:(.+)$/) {      } elsif ($colName =~ /^keyword:(.+)$/) {
2304          $retVal = ucfirst $1;          $retVal = ucfirst $1;
2305      } elsif ($colName eq 'orgName') {      } elsif ($colName eq 'orgName') {
2306          $retVal = "Gene Name";          $retVal = "Organism and Gene ID";
2307      } elsif ($colName eq 'protlink') {      } elsif ($colName eq 'protlink') {
2308          $retVal = "NMPDR Protein Page";          $retVal = "NMPDR Protein Page";
2309      } elsif ($colName eq 'subsystem') {      } elsif ($colName eq 'subsystem') {
# Line 2376  Line 2376 
2376          ($retVal) = $record->Value('Feature(assignment)');          ($retVal) = $record->Value('Feature(assignment)');
2377      } elsif ($colName eq 'gblink') {      } elsif ($colName eq 'gblink') {
2378          # 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.
2379          $retVal = Formlet('GBrowse', "GetGBrowse.cgi", undef,          $retVal = FakeButton('GBrowse', "GetGBrowse.cgi", undef,
2380                            fid => $fid);                            fid => $fid);
2381      } elsif ($colName eq 'group') {      } elsif ($colName eq 'group') {
2382          # Get the NMPDR group name.          # Get the NMPDR group name.
# Line 2394  Line 2394 
2394          $retVal = $self->FeatureName($fid);          $retVal = $self->FeatureName($fid);
2395      } elsif ($colName eq 'protlink') {      } elsif ($colName eq 'protlink') {
2396          # 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.
2397          $retVal = Formlet('NMPDR', "protein.cgi", undef,          $retVal = FakeButton('NMPDR', "protein.cgi", undef,
2398                            prot => $fid, SPROUT => 1, new_framework => 0,                            prot => $fid, SPROUT => 1, new_framework => 0,
2399                            user => '');                            user => '');
2400      }elsif ($colName eq 'subsystem') {      }elsif ($colName eq 'subsystem') {
# Line 2588  Line 2588 
2588      if (! @wordList) {      if (! @wordList) {
2589          if ($required) {          if ($required) {
2590              $self->SetMessage("No search words specified.");              $self->SetMessage("No search words specified.");
2591            } else {
2592                $retVal = 1;
2593          }          }
2594      } elsif (! @plusWords) {      } elsif (! @plusWords) {
2595          $self->SetMessage("At least one keyword must be positive. All the keywords entered are preceded by minus signs.");          $self->SetMessage("At least one keyword must be positive. All the keywords entered are preceded by minus signs.");
# Line 2598  Line 2600 
2600      return $retVal;      return $retVal;
2601  }  }
2602    
2603    =head3 FakeButton
2604    
2605    C<< my $html = SearchHelper::FakeButton($caption, $url, $target, %parms); >>
2606    
2607    Create a fake button that hyperlinks to the specified URL with the specified parameters.
2608    Unlike a real button, this one won't visibly click, but it will take the user to the
2609    correct place.
2610    
2611    The parameters of this method are deliberately identical to L</Formlet> so that we
2612    can switch easily from real buttons to fake ones in the code.
2613    
2614    =over 4
2615    
2616    =item caption
2617    
2618    Caption to be put on the button.
2619    
2620    =item url
2621    
2622    URL for the target page or script.
2623    
2624    =item target
2625    
2626    Frame or target in which the new page should appear. If C<undef> is specified,
2627    the default target will be used.
2628    
2629    =item parms
2630    
2631    Hash containing the parameter names as keys and the parameter values as values.
2632    These will be appended to the URL.
2633    
2634    =back
2635    
2636    =cut
2637    
2638    sub FakeButton {
2639        # Get the parameters.
2640        my ($caption, $url, $target, %parms) = @_;
2641        # Declare the return variable.
2642        my $retVal;
2643        # Compute the target URL.
2644        my $targetUrl = "$url?" . join(";", map { "$_=" . uri_escape($parms{$_}) } keys %parms);
2645        # Compute the target-frame HTML.
2646        my $targetHtml = ($target ? " target=\"$target\"" : "");
2647        # Assemble the result.
2648        return "<a href=\"$targetUrl\" $targetHtml><div class=\"button2 button\">$caption</div></a>";
2649    }
2650    
2651  =head3 Formlet  =head3 Formlet
2652    
2653  C<< my $html = SearchHelper::Formlet($caption, $url, $target, %parms); >>  C<< my $html = SearchHelper::Formlet($caption, $url, $target, %parms); >>

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.25

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3