[Bio] / FigWebServices / link.cgi Repository:
ViewVC logotype

Annotation of /FigWebServices/link.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     =head1 Protein Page Link
4 :    
5 :     This is a simple redirection script that takes a feature name as input and opens
6 :     the appropriate protein page. The feature name can be a FIG feature ID or
7 :     an external alias.
8 :    
9 :     This script supports the following CGI query parameters.
10 :    
11 :     =over 4
12 :    
13 :     =item id
14 :    
15 :     ID of the desired feature. This can be a FIG ID or an alias.
16 :    
17 :     =item Trace
18 :    
19 :     Trace level and list of trace modules to turn on, space-delimited. The
20 :     default is no tracing.
21 :    
22 :     =item TF
23 :    
24 :     C<1> to trace to a file, C<0> to trace to the web page itself. The
25 :     default is C<0>.
26 :    
27 :     =back
28 :    
29 :     =cut
30 :    
31 :     use strict;
32 :     use Tracer;
33 :     use CGI;
34 :     use Sprout;
35 :     use URI::Escape;
36 :    
37 :     my ($cgi, $varHash) = ScriptSetup();
38 :     eval {
39 :     # Get the protein ID.
40 :     my $pegID = $cgi->param('id');
41 :     if (! $pegID) {
42 :     # No protein ID, so we fail.
43 :     Confess("No ID specified.");
44 :     } else {
45 :     # Escape the incoming ID.
46 :     my $protID = uri_escape($pegID);
47 :     # Determine the correct mode (seed or SPROUT).
48 :     my $mode = $cgi->param('SPROUT');
49 :     if (! defined $mode) {
50 :     $mode = ($FIG_Config::sproutDB ? 1 : 0);
51 :     }
52 :     my $url = "protein.cgi?SPROUT=1;prot=$protID;SPROUT=$mode";
53 :     # Redirect to the protein page.
54 :     print $cgi->redirect(-uri => $url);
55 :     }
56 :     };
57 :     if ($@) {
58 :     # Get the error message.
59 :     my $errorMessage = $@;
60 :     Trace("Script Error: $errorMessage") if T(0);
61 :     # Display the error message. Note that unlike most situations,
62 :     # we have to write a content header. This is because we have a
63 :     # redirection script ratherh than a standard CGI script.
64 :     $varHash->{results} = $cgi->h3("Script Error: $errorMessage");
65 :     print "CONTENT-TYPE: text/html\n\n";
66 :     ScriptFinish("Simple_tmpl.php", $varHash);
67 :     }
68 :    
69 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3