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

Diff of /Sprout/SHWordSearch.pm

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

revision 1.2, Wed Nov 8 23:19:22 2006 UTC revision 1.5, Thu Nov 16 22:59:01 2006 UTC
# Line 69  Line 69 
69    
70  =head3 Form  =head3 Form
71    
72  C<< my $html = $shelp->Include(); >>  C<< my $html = $shelp->Form(); >>
73    
74  Generate the HTML for a form to request a new search.  Generate the HTML for a form to request a new search.
75    
# Line 88  Line 88 
88      # The first row is for the keyword search expression.      # The first row is for the keyword search expression.
89      my $expressionString = $cgi->param('keywords') || "";      my $expressionString = $cgi->param('keywords') || "";
90      push @rows, $cgi->Tr($cgi->td("Search Words"),      push @rows, $cgi->Tr($cgi->td("Search Words"),
91                           $cgi->td({colspan => 2}, $cgi->textfield(-name => 'keywords',                           $cgi->td($cgi->textfield(-name => 'keywords',
92                                                                    -value => $expressionString,                                                                    -value => $expressionString,
93                                                                    -size => 40)));                                                    -size => 40)),
94                             $cgi->td($cgi->submit(-name => 'Alternate',
95                                                   -value => 'Advanced',
96                                                   -class => 'button')),
97                            );
98      # The other row is for the submit button.      # The other row is for the submit button.
99      push @rows, $self->SubmitRow();      push @rows, $self->SubmitRow();
100      # Finally, if groups are specified, we include them as hidden fields and display      # Finally, if groups are specified, we include them as hidden fields and display
# Line 138  Line 142 
142      # Declare the return variable. If it remains undefined, the caller will      # Declare the return variable. If it remains undefined, the caller will
143      # know that an error occurred.      # know that an error occurred.
144      my $retVal;      my $retVal;
145      # Get the keyword list. We need to prove that there is at least one keyword      # Get the keyword list and validate it.
     # that does not begin with a "-".  
146      my $keywords = $cgi->param('keywords') || "";      my $keywords = $cgi->param('keywords') || "";
147      my @wordList = split /\s+/, $keywords;      if ($self->ValidateKeywords($keywords, 1)) {
     my @plusWords = grep { $_ =~ /^[^\-]/ } @wordList;  
     if (! @wordList) {  
         $self->SetMessage("No search words specified.");  
     } elsif (! @plusWords) {  
         $self->SetMessage("At least one keyword must be positive. All the keywords entered are preceded by minus signs.");  
     } else {  
148          # We have good keywords. Initialize the session file.          # We have good keywords. Initialize the session file.
149          $self->OpenSession();          $self->OpenSession();
150          # Initialize the result counter.          # Initialize the result counter.
# Line 187  Line 184 
184      # Get the parameters.      # Get the parameters.
185      my ($self) = @_;      my ($self) = @_;
186      # Return the result.      # Return the result.
187      return "Search for features based on keywords.";      return "Search for genes based on keywords.";
188  }  }
189    
190  =head3 ProcessQuery  =head3 ProcessQuery

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3