[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.46, Sat Mar 7 18:07:36 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',
# 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 1431  Line 1383 
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',

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3