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

Diff of /SeedViewer/seedviewer.cgi

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

revision 1.12, Tue Feb 5 04:44:46 2008 UTC revision 1.34, Thu Dec 23 18:03:19 2010 UTC
# Line 9  Line 9 
9  use Tracer;  use Tracer;
10  use FIGRules;  use FIGRules;
11  use FIG_Config;  use FIG_Config;
12    use WebConfig;
13    
14    my $have_fcgi;
15  eval {  eval {
16      &main;      require CGI::Fast;
17        $have_fcgi = 1;
18    };
19    
20    if ($have_fcgi && ! $ENV{REQUEST_METHOD})
21    {
22        my $max_requests = $FIG_Config::fcgi_max_requests || 50;
23        my $n_requests = 0;
24    
25        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 ($@)  if ($@)
34  {  {
35      my $cgi = new CGI();              my $error = $@;
36                Warn("Script error: $error") if T(SeedViewer => 0);
37    
38      print $cgi->header();              print CGI::header();
39      print $cgi->start_html();              print CGI::start_html();
40    
41      # print out the error      # print out the error
42      print '<pre>'.$@.'</pre>';              print '<pre>'.$error.'</pre>';
43    
44      print $cgi->end_html();              print CGI::end_html();
45            }
46        }
47    }
48    else
49    {
50        my $cgi = new CGI;
51        eval {
52            &main($cgi);
53        };
54    
55        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  }  }
69    
70  sub main {  sub main {
71        my($cgi) = @_;
72    
73      # initialize cgi      # Initialize tracing.
     my $cgi = new CGI();  
74      ETracing($cgi);      ETracing($cgi);
75        if (FIGRules::nmpdr_mode($cgi)) {
76            Trace("NMPDR mode selected.") if T(3);
77            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        } else {
86      # initialize layout      # initialize layout
87      # Use the template file for the current mode-- NMPDR or SEED      # Use the template file for the current mode-- NMPDR or SEED
88      my $templateFile = (FIGRules::nmpdr_mode($cgi) ? './Html/NmpdrViewer.tmpl' : './Html/SeedViewer.tmpl');          my $templateFile = TMPL_PATH . "/SeedViewer.tmpl";
89      Trace("Template file is $templateFile") if T(3);      Trace("Template file is $templateFile") if T(3);
90      my $layout = WebLayout->new($templateFile);      my $layout = WebLayout->new($templateFile);
     # Start with the normal style.  
     $layout->add_css('./Html/default.css');  
91      # Choose the body/header style sheet according to the mode.      # Choose the body/header style sheet according to the mode.
92      if (FIGRules::nmpdr_mode($cgi)) {          $layout->add_css("$FIG_Config::cgi_url/Html/seedviewer.css");
93          # NMPDR mode.          $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
94          $layout->add_css('./Html/nmpdrviewer.css');          $layout->add_css("$FIG_Config::cgi_url/Html/web_app_default.css");
         # Show the NMPDR version in the header.  
         $layout->set_variable(VERSION => "Sprout version $FIG_Config::nmpdr_version on $ENV{HTTP_HOST}.");  
     } else {  
         # SEED mode.  
         $layout->add_css('./Html/seedviewer.css');  
    }  
     # Add the common styles.  
     $layout->add_css('./Html/commonviewer.css');  
   
     # add site meter  
     my $site_meter = $FIG_Config::site_meter;  
     if ($site_meter) {  
         $layout->add_javascript("http://s20.sitemeter.com/js/counter.js?site=s20nmpdr");  
     }  
   
95      # build menu      # build menu
96      my $menu;      my $menu;
97      $menu = WebMenu->new();      $menu = WebMenu->new();
# Line 67  Line 99 
99      $menu->add_entry('&raquo;Navigate', 'Startpage', '?page=Home');      $menu->add_entry('&raquo;Navigate', 'Startpage', '?page=Home');
100      $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');      $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');
101      $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');      $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');
102      $menu->add_entry('&raquo;Navigate', '<a>Jump to Feature by</a>');          $menu->add_entry('&raquo;Navigate', 'Scenarios', '?page=Scenarios');
103      $menu->add_entry('&raquo;Navigate', '&nbsp;&nbsp;BLAST Search', '?page=BlastRun');          $menu->add_entry('&raquo;Navigate', 'FigFams', '?page=FigFamViewer');
104      $menu->add_entry('&raquo;Navigate', "<form style='margin: 0px 0px 0px 6px;'>&nbsp;&nbsp;ID&nbsp;&nbsp;<input type='text' name='pattern' style='border: 1px solid #5da668; width: 100px; height: 17px; margin-top: 2px; font-size: 11px;'><input type='hidden' name='page' value='SearchResult'><input type='hidden' name='action' value='check_search'><input type='submit' style='display:none;'></form>");          $menu->add_entry('&raquo;Navigate', 'BLAST Search', '?page=BlastRun');
   
105      if (defined($FIG_Config::teacher_db)) {      if (defined($FIG_Config::teacher_db)) {
106          $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);          $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);
107          $menu->add_entry('&raquo;Teacher', 'Class Performance', '?page=Teach');          $menu->add_entry('&raquo;Teacher', 'Class Performance', '?page=Teach');
# Line 78  Line 109 
109          $menu->add_entry('&raquo;Teacher', 'Problem Sets', '?page=ManageProblemSets');          $menu->add_entry('&raquo;Teacher', 'Problem Sets', '?page=ManageProblemSets');
110          $menu->add_entry('&raquo;Teacher', 'Annotation Resolve', '?page=ClassAnnotationResolve');          $menu->add_entry('&raquo;Teacher', 'Annotation Resolve', '?page=ClassAnnotationResolve');
111      }      }
     #$menu->add_category('&raquo;Admin', '?page=Admin', undef, ['edit', 'scope', '*'], 99);  
     if (FIGRules::nmpdr_mode($cgi)) {  
         $menu->add_category('&raquo;Help', "$FIG_Config::nmpdr_site_url/content/help.php", 'help', undef, 98);  
         $menu->add_entry('&raquo;Help', 'Searching NMPDR', "$FIG_Config::nmpdr_site_url/content/find.php");  
         $menu->add_entry('&raquo;Help', 'SEED Viewer Tutorial', 'http://www.theseed.org/wiki/SEED_Viewer_Tutorial');  
         $menu->add_entry('&raquo;Help', 'Contact', "$FIG_Config::nmpdr_site_url/content/contact.php");  
     } else {  
112          $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);          $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);
113          $menu->add_entry('&raquo;Help', 'What is the SEED', 'http://www.theseed.org/wiki/Home_of_the_SEED');          $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/SEED_Viewer_Tutorial');          $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/RAST_Tutorial');          $menu->add_entry('&raquo;Help', 'Submitting Data to SEED', 'http://www.theseed.org/wiki/index.php/RAST_Tutorial');
116          $menu->add_entry('&raquo;Help', 'Contact', 'http://www.theseed.org/wiki/Contact');  
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          $menu->add_entry('&raquo;Help', 'Register', '?page=Register');          $menu->add_entry('&raquo;Help', 'Register', '?page=Register');
126          $menu->add_entry('&raquo;Help', 'I forgot my Password', '?page=RequestNewPassword');          $menu->add_entry('&raquo;Help', 'I forgot my Password', '?page=RequestNewPassword');
127      }  
128      # initialize application      # initialize application
129      my $WebApp = WebApplication->new( { id => 'SeedViewer',      my $WebApp = WebApplication->new( { id => 'SeedViewer',
130                                          menu     => $menu,                                          menu     => $menu,
131                                          layout   => $layout,                                          layout   => $layout,
132                                          default  => 'Home',                                          default  => 'Home',
133                                                cgi => $cgi,
134                                        } );                                        } );
     $WebApp->page_title_prefix('SEED Viewer - ');  
     $WebApp->show_login_user_info(1);  
135    
136            my $prefix = "Seed Viewer - ";
137            $WebApp->page_title_prefix($prefix);
138            $WebApp->show_login_user_info(1);
139      # run application      # run application
140      $WebApp->run();      $WebApp->run();
141        }
142  }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.34

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3