[Bio] / SeedViewer / seedviewer.cgi Repository:
ViewVC logotype

Annotation of /SeedViewer/seedviewer.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (view) (download)

1 : paczian 1.1 use strict;
2 :     use warnings;
3 : paczian 1.7 no warnings 'once';
4 : paczian 1.1
5 :     use DBMaster;
6 :     use WebApplication;
7 :     use WebMenu;
8 :     use WebLayout;
9 : parrello 1.6 use Tracer;
10 :     use FIGRules;
11 : paczian 1.5 use FIG_Config;
12 : olson 1.26 use WebConfig;
13 : paczian 1.1
14 : olson 1.34 my $have_fcgi;
15 : paczian 1.33 eval {
16 : olson 1.34 require CGI::Fast;
17 :     $have_fcgi = 1;
18 : paczian 1.33 };
19 :    
20 : olson 1.34 if ($have_fcgi && ! $ENV{REQUEST_METHOD})
21 : paczian 1.1 {
22 : olson 1.34 my $max_requests = $FIG_Config::fcgi_max_requests || 50;
23 :     my $n_requests = 0;
24 : paczian 1.33
25 : olson 1.34 warn "begin loop\n";
26 :     while (($max_requests == 0 || $n_requests++ < $max_requests) &&
27 :     (my $cgi = new CGI::Fast()))
28 :     {
29 :     eval {
30 :     &main($cgi);
31 :     };
32 :    
33 :     if ($@)
34 :     {
35 :     my $error = $@;
36 :     Warn("Script error: $error") if T(SeedViewer => 0);
37 :    
38 :     print CGI::header();
39 :     print CGI::start_html();
40 :    
41 :     # print out the error
42 :     print '<pre>'.$error.'</pre>';
43 :    
44 :     print CGI::end_html();
45 :     }
46 :     }
47 :     }
48 :     else
49 :     {
50 :     my $cgi = new CGI;
51 :     eval {
52 :     &main($cgi);
53 :     };
54 : paczian 1.1
55 : olson 1.34 if ($@)
56 :     {
57 :     my $error = $@;
58 :     Warn("Script error: $error") if T(SeedViewer => 0);
59 :    
60 :     print CGI::header();
61 :     print CGI::start_html();
62 :    
63 :     # print out the error
64 :     print '<pre>'.$error.'</pre>';
65 :    
66 :     print CGI::end_html();
67 :     }
68 : paczian 1.1 }
69 :    
70 :     sub main {
71 : olson 1.34 my($cgi) = @_;
72 : paczian 1.33
73 :     # Initialize tracing.
74 : parrello 1.24 ETracing($cgi);
75 :     if (FIGRules::nmpdr_mode($cgi)) {
76 :     Trace("NMPDR mode selected.") if T(3);
77 : parrello 1.23 my $parms = $cgi->query_string();
78 :     if ($parms) {
79 :     $parms = "?$parms";
80 :     } else {
81 :     $parms = "?page=Home";
82 :     }
83 :     print CGI::redirect(-uri => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer$parms",
84 :     -status => 301);
85 : parrello 1.15 } else {
86 : parrello 1.24 # initialize layout
87 :     # Use the template file for the current mode-- NMPDR or SEED
88 : olson 1.26 my $templateFile = TMPL_PATH . "/SeedViewer.tmpl";
89 : parrello 1.24 Trace("Template file is $templateFile") if T(3);
90 :     my $layout = WebLayout->new($templateFile);
91 :     # Choose the body/header style sheet according to the mode.
92 :     $layout->add_css("$FIG_Config::cgi_url/Html/seedviewer.css");
93 :     $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
94 : paczian 1.30 $layout->add_css("$FIG_Config::cgi_url/Html/web_app_default.css");
95 : parrello 1.24 # build menu
96 :     my $menu;
97 :     $menu = WebMenu->new();
98 : parrello 1.16 $menu->add_category('&raquo;Navigate', '?page=Home');
99 :     $menu->add_entry('&raquo;Navigate', 'Startpage', '?page=Home');
100 :     $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');
101 :     $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');
102 : paczian 1.27 $menu->add_entry('&raquo;Navigate', 'Scenarios', '?page=Scenarios');
103 : parrello 1.16 $menu->add_entry('&raquo;Navigate', 'FigFams', '?page=FigFamViewer');
104 : paczian 1.22 $menu->add_entry('&raquo;Navigate', 'BLAST Search', '?page=BlastRun');
105 : parrello 1.24 if (defined($FIG_Config::teacher_db)) {
106 :     $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);
107 :     $menu->add_entry('&raquo;Teacher', 'Class Performance', '?page=Teach');
108 :     $menu->add_entry('&raquo;Teacher', 'Class Management', '?page=ManageClass');
109 :     $menu->add_entry('&raquo;Teacher', 'Problem Sets', '?page=ManageProblemSets');
110 :     $menu->add_entry('&raquo;Teacher', 'Annotation Resolve', '?page=ClassAnnotationResolve');
111 :     }
112 :     $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);
113 : paczian 1.33 $menu->add_entry('&raquo;Help', 'What is the SEED', 'http://www.theseed.org/wiki/index.php/Home_of_the_SEED');
114 :     $menu->add_entry('&raquo;Help', 'HowTo use the SEED Viewer', 'http://www.theseed.org/wiki/index.php/SEED_Viewer_Tutorial');
115 :     $menu->add_entry('&raquo;Help', 'Submitting Data to SEED', 'http://www.theseed.org/wiki/index.php/RAST_Tutorial');
116 : paczian 1.25
117 :     # check which contact info to show
118 :     if (defined($FIG_Config::server_type) && ($FIG_Config::server_type eq 'MG-RAST')) {
119 :     $menu->add_entry('&raquo;Help', 'Contact', 'mailto:mg-rast@mcs.anl.gov', undef, ['login']);
120 :     } elsif (defined($FIG_Config::server_type) && ($FIG_Config::server_type eq 'RAST')) {
121 :     $menu->add_entry('&raquo;Help', 'Contact', 'mailto:rast@mcs.anl.gov', undef, ['login']);
122 :     } else {
123 :     $menu->add_entry('&raquo;Help', 'Contact', 'mailto:info@theseed.org');
124 :     }
125 : parrello 1.24 $menu->add_entry('&raquo;Help', 'Register', '?page=Register');
126 : paczian 1.10 $menu->add_entry('&raquo;Help', 'I forgot my Password', '?page=RequestNewPassword');
127 : paczian 1.30
128 : parrello 1.24 # initialize application
129 :     my $WebApp = WebApplication->new( { id => 'SeedViewer',
130 :     menu => $menu,
131 :     layout => $layout,
132 :     default => 'Home',
133 : olson 1.34 cgi => $cgi,
134 : parrello 1.24 } );
135 : paczian 1.30
136 : parrello 1.24 my $prefix = "Seed Viewer - ";
137 :     $WebApp->page_title_prefix($prefix);
138 :     $WebApp->show_login_user_info(1);
139 :     # run application
140 :     $WebApp->run();
141 : parrello 1.6 }
142 : paczian 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3