[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.43, Mon Jan 19 21:56:19 2009 UTC revision 1.47, Mon Mar 16 00:23:37 2009 UTC
# Line 277  Line 277 
277              $session_id = FIGRules::NewSessionID();              $session_id = FIGRules::NewSessionID();
278              Trace("New session ID is $session_id.") if T(3);              Trace("New session ID is $session_id.") if T(3);
279              $session_cookie = new CGI::Cookie(-name => $class,              $session_cookie = new CGI::Cookie(-name => $class,
280                                                -value => $session_id,                                                -value => $session_id);
                                               -expires => '+7d');  
281              $session_cookie->bake();              $session_cookie->bake();
282          } else {          } else {
283              # Here we're recovering an old session. The session ID is              # Here we're recovering an old session. The session ID is
# Line 289  Line 288 
288          }          }
289          # Denote this is a new session.          # Denote this is a new session.
290          $type = "new";          $type = "new";
291          # Put the session IS in the parameters.          # Put the session ID in the parameters.
292          $cgi->param(-name => 'SessionID', -value => $session_id);          $cgi->param(-name => 'SessionID', -value => $session_id);
293      } else {      } else {
294          Trace("Session ID is $session_id.") if T(3);          Trace("Session ID is $session_id.") if T(3);
# Line 484  Line 483 
483      my $retVal = "<div class=\"search\">\n" .      my $retVal = "<div class=\"search\">\n" .
484                   CGI::start_form(-method => 'POST',                   CGI::start_form(-method => 'POST',
485                                    -action => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/search",                                    -action => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/search",
486                                    -name => $self->FormName()) .                                    -name => $self->FormName(),
487                                      -id => $self->FormName()) .
488                   CGI::hidden(-name => 'Class',                   CGI::hidden(-name => 'Class',
489                                -value => $self->{class}) .                                -value => $self->{class}) .
490                   CGI::hidden(-name => 'SPROUT',                   CGI::hidden(-name => 'SPROUT',
491                                -value => 1) .                                -value => 1) .
492                   CGI::h3("$title" . Hint($self->{class}, "Click here for more information."));                   CGI::h3("$title" . Hint($self->{class}));
493      # Put in an anchor tag in case there's a table of contents.      # Put in an anchor tag in case there's a table of contents.
494      my $anchorName = $self->FormName();      my $anchorName = $self->FormName();
495      $retVal .= "<a name=\"$anchorName\"></a>\n";      $retVal .= "<a name=\"$anchorName\"></a>\n";
# Line 943  Line 943 
943      Trace("FASTA desired type is $desiredType.") if T(4);      Trace("FASTA desired type is $desiredType.") if T(4);
944      # Check for a feature specification. The smoking gun for that is a vertical bar.      # Check for a feature specification. The smoking gun for that is a vertical bar.
945      if ($sequence =~ /^\s*(\w+\|\S+)\s*$/) {      if ($sequence =~ /^\s*(\w+\|\S+)\s*$/) {
946          # Here we have a feature ID in $1. We'll need the Sprout object to process          # Here we have a feature ID in $1. We'll need a Sprout object to process it.
         # it.  
947          my $fid = $1;          my $fid = $1;
948          Trace("Feature ID for fasta is $fid.") if T(3);          Trace("Feature ID for fasta is $fid.") if T(3);
949          my $sprout = $self->DB();          my $sprout = $self->DB();
# Line 1030  Line 1029 
1029          if ($desiredType !~ /pattern/i) {          if ($desiredType !~ /pattern/i) {
1030              $fastaData =~ s/\n//g;              $fastaData =~ s/\n//g;
1031              $fastaData =~ s/\s+//g;              $fastaData =~ s/\s+//g;
1032                $fastaData =~ s/\d+//g;
1033          }          }
1034          # Finally, verify that it's DNA if we're doing DNA stuff.          # Finally, verify that it's DNA if we're doing DNA stuff.
1035          if ($desiredType eq 'dna' && $fastaData =~ /[^agctxn-]/i) {          if ($desiredType eq 'dna' && $fastaData =~ /[^agctxn-]/i) {
# Line 1275  Line 1275 
1275      return $retVal;      return $retVal;
1276  }  }
1277    
 =head3 PropertyMenu  
   
     my $htmlText = $shelp->PropertyMenu($menuName, $selected, $force);  
   
 Generate a property name dropdown menu.  
   
 =over 4  
   
 =item menuName  
   
 Name to give to the menu.  
   
 =item selected  
   
 Value of the property name to pre-select.  
   
 =item force (optional)  
   
 If TRUE, then the user will be forced to choose a property name. If FALSE,  
 then an additional menu choice will be provided to select nothing.  
   
 =item RETURN  
   
 Returns a dropdown menu box that allows the user to select a property name. An additional  
 selection entry will be provided for selecting no property name  
   
 =back  
   
 =cut  
   
 sub PropertyMenu {  
     # Get the parameters.  
     my ($self, $menuName, $selected, $force) = @_;  
     # Get the CGI and Sprout objects.  
     my $sprout = $self->DB();  
     my $cgi = $self->Q();  
     # Create the property name list.  
     my @propNames = ();  
     if (! $force) {  
         push @propNames, "";  
     }  
     # Get all the property names, putting them after the null choice if one exists.  
     push @propNames, $sprout->GetChoices('Property', 'property-name');  
     # Create a menu from them.  
     my $retVal = CGI::popup_menu(-name=> $menuName, -values => \@propNames,  
                                   -default => $selected);  
     # Return the result.  
     return $retVal;  
 }  
   
1278  =head3 MakeTable  =head3 MakeTable
1279    
1280      my $htmlText = $shelp->MakeTable(\@rows);      my $htmlText = $shelp->MakeTable(\@rows);
# Line 1419  Line 1369 
1369      my $realCaption = (defined $caption ? $caption : 'Go');      my $realCaption = (defined $caption ? $caption : 'Go');
1370      # Get the current page size.      # Get the current page size.
1371      my $pageSize = $cgi->param('PageSize');      my $pageSize = $cgi->param('PageSize');
1372        # Get the form name.
1373        my $formName = $self->FormName();
1374      # Get the current feature ID type.      # Get the current feature ID type.
1375      my $aliasType = $self->GetPreferredAliasType();      my $aliasType = $self->GetPreferredAliasType();
1376      # Create the rows.      # Create the rows.
# Line 1427  Line 1379 
1379                                     CGI::popup_menu(-name => 'AliasType',                                     CGI::popup_menu(-name => 'AliasType',
1380                                                      -values => ['FIG', AliasAnalysis::AliasTypes() ],                                                      -values => ['FIG', AliasAnalysis::AliasTypes() ],
1381                                                      -default => $aliasType) .                                                      -default => $aliasType) .
1382                                     Hint("Identifier Type", "Specify how you want gene names to be displayed."))) .                                     Hint("Identifier Type", 27))) .
1383                   "\n" .                   "\n" .
1384                   CGI::Tr(CGI::td("Results/Page"),                   CGI::Tr(CGI::td("Results/Page"),
1385                            CGI::td(CGI::popup_menu(-name => 'PageSize',                            CGI::td(CGI::popup_menu(-name => 'PageSize',
1386                                                      -values => [10, 25, 50, 100, 1000],                                                    -values => [50, 10, 25, 100, 1000],
1387                                                      -default => $pageSize)),                                                      -default => $pageSize)),
1388                            CGI::td(CGI::submit(-class => 'goButton',                            CGI::td(CGI::submit(-class => 'goButton',
1389                                                  -name => 'Search',                                                  -name => 'Search',
# Line 2246  Line 2198 
2198    
2199  =head3 Hint  =head3 Hint
2200    
2201      my $htmlText = SearchHelper::Hint($wikiPage, $hintText);      my $htmlText = SearchHelper::Hint($wikiPage, $hintID);
2202    
2203  Return the HTML for a small question mark that displays the specified hint text when it is clicked.  Return the HTML for a small question mark that displays the specified hint text when it is clicked.
2204  This HTML can be put in forms to provide a useful hinting mechanism.  This HTML can be put in forms to provide a useful hinting mechanism.
# Line 2257  Line 2209 
2209    
2210  Name of the wiki page to be popped up when the hint mark is clicked.  Name of the wiki page to be popped up when the hint mark is clicked.
2211    
2212  =item hintText  =item hintID
2213    
2214  Text to display for the hint. It is raw html, but may not contain any double quotes.  ID of the text to display for the hint. This is the ID number for a tip-of-the-day.
2215    
2216  =item RETURN  =item RETURN
2217    
# Line 2272  Line 2224 
2224    
2225  sub Hint {  sub Hint {
2226      # Get the parameters.      # Get the parameters.
2227      my ($wikiPage, $hintText) = @_;      my ($wikiPage, $hintID) = @_;
2228      # Ask Sprout to draw the hint button for us.      # Ask Sprout to draw the hint button for us.
2229      return Sprout::Hint($wikiPage, $hintText);      return Sprout::Hint($wikiPage, $hintID);
2230  }  }
2231    
2232    

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.47

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3