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

View of /SeedViewer/seedviewer.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (download) (annotate)
Thu Nov 29 16:31:17 2007 UTC (12 years ago) by parrello
Branch: MAIN
Changes since 1.5: +41 -14 lines
Updated to work in NMPDR with different styles.

use strict;
use warnings;

use DBMaster;
use WebApplication;
use WebMenu;
use WebLayout;
use Tracer;
use FIGRules;
use FIG_Config;

eval {
    &main;
};

if ($@)
{
    my $cgi = new CGI();

    print $cgi->header();
    print $cgi->start_html();
    
    # print out the error
    print '<pre>'.$@.'</pre>';

    print $cgi->end_html();

}

sub main {

    # initialize cgi
    my $cgi = new CGI();
    ETracing($cgi);

    # initialize db-master
    #my $dbmaster = DBMaster->new(-database => 'WebAppBackend');

    # initialize layout
    # Use the template file for the current mode-- NMPDR or SEED
    my $templateFile = (FIGRules::nmpdr_mode($cgi) ? './Html/NmpdrViewer.tmpl'
                                                   : './Html/SeedViewer.tmpl');
    Trace("Template file is $templateFile") if T(3);
    my $layout = WebLayout->new($templateFile);
    # Start with the normal style.
    $layout->add_css('./Html/default.css');
    # Choose the body/header style sheet according to the mode.   
    if (FIGRules::nmpdr_mode($cgi)) {
        # NMPDR mode.
        $layout->add_css('./Html/nmpdrviewer.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');

    # build menu
    my $menu;
    # For now, NMPDR does not use the menu.
    $menu = WebMenu->new();
    $menu->add_category('&raquo;Navigate', '?page=Home');
    $menu->add_entry('&raquo;Navigate', 'Startpage', '?page=Home');
    $menu->add_entry('&raquo;Navigate', 'Organisms', '?page=OrganismSelect');
    $menu->add_entry('&raquo;Navigate', 'Subsystems', '?page=SubsystemSelect');
    $menu->add_entry('&raquo;Navigate', 'Blast', '?page=BlastRun');
    $menu->add_entry('&raquo;Navigate', "<form style='margin: 0px 0px 0px 6px;'>ID&nbsp;&nbsp;<input type='text' name='pattern' style='border: 1px solid #5da668; width: 120px; 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>");
    
    if (defined($FIG_Config::teacher_db)) {
        $menu->add_category('&raquo;Teacher', '?page=Teach', undef, ['edit', 'problem_list'], 96);
        $menu->add_entry('&raquo;Teacher', 'Class Performance', '?page=Teach');
        $menu->add_entry('&raquo;Teacher', 'Class Management', '?page=ManageClass');
        $menu->add_entry('&raquo;Teacher', 'Problem Sets', '?page=ManageProblemSets');
    }
    $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 {
        $menu->add_category('&raquo;Help', 'http://www.theseed.org', 'help', undef, 98);
        $menu->add_entry('&raquo;Help', 'What is the SEED', 'http://www.theseed.org/wiki/Home_of_the_SEED');
        $menu->add_entry('&raquo;Help', 'HowTo use the SEED Viewer', 'http://www.theseed.org/wiki/SEED_Viewer_Tutorial');
        $menu->add_entry('&raquo;Help', 'Submitting Data to SEED', 'http://www.theseed.org/wiki/RAST_Tutorial');
        $menu->add_entry('&raquo;Help', 'Contact', 'http://www.theseed.org/wiki/Contact');
        $menu->add_entry('&raquo;Help', 'Register', '?page=Register');
    }
    # initialize application
    my $WebApp = WebApplication->new( { id => 'SeedViewer',
					#dbmaster => $dbmaster,
					menu     => $menu,
					layout   => $layout,
					default  => 'Home',
				      } );
    $WebApp->show_login_user_info(1);

    # run application
    $WebApp->run();

}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3