[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.4, Wed Nov 7 17:09:12 2007 UTC revision 1.23, Wed Sep 3 20:42:27 2008 UTC
# Line 1  Line 1 
1  use strict;  use strict;
2  use warnings;  use warnings;
3    no warnings 'once';
4    
5  use DBMaster;  use DBMaster;
6  use WebApplication;  use WebApplication;
7  use WebMenu;  use WebMenu;
8  use WebLayout;  use WebLayout;
9    use Tracer;
10    use FIGRules;
11    use FIG_Config;
12    
13  eval {  eval {
14      &main;      &main;
# Line 12  Line 16 
16    
17  if ($@)  if ($@)
18  {  {
19      my $cgi = new CGI();      my $error = $@;
20        Warn("Script error: $error") if T(SeedViewer => 0);
21    
22      print $cgi->header();      print CGI::header();
23      print $cgi->start_html();      print CGI::start_html();
24    
25      # print out the error      # print out the error
26      print '<pre>'.$@.'</pre>';      print '<pre>'.$error.'</pre>';
27    
28      print $cgi->end_html();      print CGI::end_html();
29    
30  }  }
31    
# Line 28  Line 33 
33    
34      # initialize cgi      # initialize cgi
35      my $cgi = new CGI();      my $cgi = new CGI();
36        if ($FIG_Config::linkinSV) {
37      # initialize db-master          my $parms = $cgi->query_string();
38      my $dbmaster = DBMaster->new(-database => 'WebAppBackend');          if ($parms) {
39                $parms = "?$parms";
40            } else {
41                $parms = "?page=Home";
42            }
43            print CGI::redirect(-uri => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer$parms",
44                                -status => 301);
45            return;
46        }
47    
48      # initialize layout      # initialize layout
49      my $layout = WebLayout->new('./Html/SeedViewer.tmpl');      # Use the template file for the current mode-- NMPDR or SEED
50      $layout->add_css('./Html/default.css');      my $templateFile = (FIGRules::nmpdr_mode($cgi) ? "$FIG_Config::cgi_url/Html/NmpdrViewer.tmpl" : "$FIG_Config::cgi_url/Html/SeedViewer.tmpl");
51      $layout->add_css('./Html/seedviewer.css');      Trace("Template file is $templateFile") if T(3);
52        my $layout = WebLayout->new($templateFile);
53        # Choose the body/header style sheet according to the mode.
54        if (FIGRules::nmpdr_mode($cgi)) {
55            # NMPDR mode.
56            $layout->add_css("$FIG_Config::cgi_url/Html/nmpdrviewer.css");
57            $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
58            # Display the official NMPDR icon for this machine.
59            $layout->add_metatag("<link rel=\"icon\" href=\"${FIG_Config::cgi_base}wiki/pub/logos/nmpdr.ico\" type=\"image/x-icon\" />");
60            $layout->add_metatag("<link rel=\"shortcut icon\" href=\"${FIG_Config::cgi_base}wiki/pub/logos/nmpdr.ico\" type=\"image/x-icon\" />");
61        } else {
62            # SEED mode.
63            $layout->add_css("$FIG_Config::cgi_url/Html/seedviewer.css");
64            $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
65            $layout->add_css("$FIG_Config::cgi_url/Html/default.css");
66       }
67      # build menu      # build menu
68      my $menu = WebMenu->new();      my $menu;
69        $menu = WebMenu->new();
70        if (FIGRules::nmpdr_mode($cgi)) {
71      $menu->add_category('&raquo;Navigate', '?page=Home');      $menu->add_category('&raquo;Navigate', '?page=Home');
72      $menu->add_entry('&raquo;Navigate', 'Search', '?page=Home');          $menu->add_entry('&raquo;Navigate', 'NMPDR home', "$FIG_Config::nmpdr_site_url/index.php");
73      $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');          $menu->add_entry('&raquo;Navigate', 'Organisms', "$FIG_Config::nmpdr_site_url/content/organisms.php");
74            $menu->add_entry('&raquo;Navigate', 'Subsystems', "$FIG_Config::nmpdr_site_url/content/subsystems.php");
75            $menu->add_entry('&raquo;Navigate', 'FigFams', '?page=FigFamViewer');
76        } else {
77            $menu->add_category('&raquo;Navigate', '?page=Home');
78            $menu->add_entry('&raquo;Navigate', 'Startpage', '?page=Home');
79      $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');      $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');
80            $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');
81            $menu->add_entry('&raquo;Navigate', 'FigFams', '?page=FigFamViewer');
82            $menu->add_entry('&raquo;Navigate', 'BLAST Search', '?page=BlastRun');
83        }
84        if (defined($FIG_Config::teacher_db)) {
85      $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);      $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);
86      $menu->add_category('&raquo;Admin', '?page=Admin', undef, ['edit', 'scope', '*'], 99);          $menu->add_entry('&raquo;Teacher', 'Class Performance', '?page=Teach');
87            $menu->add_entry('&raquo;Teacher', 'Class Management', '?page=ManageClass');
88            $menu->add_entry('&raquo;Teacher', 'Problem Sets', '?page=ManageProblemSets');
89            $menu->add_entry('&raquo;Teacher', 'Annotation Resolve', '?page=ClassAnnotationResolve');
90        }
91        if (FIGRules::nmpdr_mode($cgi)) {
92            $menu->add_category('Help', "$FIG_Config::nmpdr_site_url/content/help.php", 'help', undef, 98);
93            $menu->add_entry('Help', 'Searching NMPDR', "$FIG_Config::nmpdr_site_url/content/find.php");
94            $menu->add_entry('Help', 'Contact', "$FIG_Config::nmpdr_site_url/content/contactus.php");
95        } else {
96      $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);      $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);
97      $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/Home_of_the_SEED');
98      $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/SEED_Viewer_Tutorial');
99      $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/RAST_Tutorial');
100      $menu->add_entry('&raquo;Help', 'Contact', 'http://www.theseed.org/wiki/Contact');      $menu->add_entry('&raquo;Help', 'Contact', 'http://www.theseed.org/wiki/Contact');
101      $menu->add_entry('&raquo;Help', 'Register', '?page=Register');      $menu->add_entry('&raquo;Help', 'Register', '?page=Register');
102            $menu->add_entry('&raquo;Help', 'I forgot my Password', '?page=RequestNewPassword');
103        }
104      # initialize application      # initialize application
105      my $WebApp = WebApplication->new( { id => 'SeedViewer',      my $WebApp = WebApplication->new( { id => 'SeedViewer',
                                         dbmaster => $dbmaster,  
106                                          menu     => $menu,                                          menu     => $menu,
107                                          layout   => $layout,                                          layout   => $layout,
108                                          default  => 'Home',                                          default  => 'Home',
109                                        } );                                        } );
110        my $prefix = (FIGRules::nmpdr_mode($cgi) ? "NMPDR " : "") . "Seed Viewer - ";
111        $WebApp->page_title_prefix($prefix);
112        $WebApp->show_login_user_info(1);
113    
114      # run application      # run application
115      $WebApp->run();      $WebApp->run();

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3