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

View of /SeedViewer/seedviewer.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (download) (annotate)
Wed Sep 3 20:42:27 2008 UTC (11 years, 3 months ago) by parrello
Branch: MAIN
Changes since 1.22: +17 -6 lines
Fixed to work with the new NMPDR.

use strict;
use warnings;
no warnings 'once';

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

eval {
    &main;
};

if ($@)
{
    my $error = $@;
    Warn("Script error: $error") if T(SeedViewer => 0);

    print CGI::header();
    print CGI::start_html();
    
    # print out the error
    print '<pre>'.$error.'</pre>';

    print CGI::end_html();

}

sub main {

    # initialize cgi
    my $cgi = new CGI();
    if ($FIG_Config::linkinSV) {
        my $parms = $cgi->query_string();
        if ($parms) {
            $parms = "?$parms";
        } else {
            $parms = "?page=Home";
        }
        print CGI::redirect(-uri => "$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer$parms",
                            -status => 301);
        return;
    }

    # initialize layout
    # Use the template file for the current mode-- NMPDR or SEED
    my $templateFile = (FIGRules::nmpdr_mode($cgi) ? "$FIG_Config::cgi_url/Html/NmpdrViewer.tmpl" : "$FIG_Config::cgi_url/Html/SeedViewer.tmpl");
    Trace("Template file is $templateFile") if T(3);
    my $layout = WebLayout->new($templateFile);
    # Choose the body/header style sheet according to the mode.   
    if (FIGRules::nmpdr_mode($cgi)) {
        # NMPDR mode.
        $layout->add_css("$FIG_Config::cgi_url/Html/nmpdrviewer.css");
        $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
        # Display the official NMPDR icon for this machine.
        $layout->add_metatag("<link rel=\"icon\" href=\"${FIG_Config::cgi_base}wiki/pub/logos/nmpdr.ico\" type=\"image/x-icon\" />");
        $layout->add_metatag("<link rel=\"shortcut icon\" href=\"${FIG_Config::cgi_base}wiki/pub/logos/nmpdr.ico\" type=\"image/x-icon\" />");
    } else {
        # SEED mode.
        $layout->add_css("$FIG_Config::cgi_url/Html/seedviewer.css");
        $layout->add_css("$FIG_Config::cgi_url/Html/commonviewer.css");
        $layout->add_css("$FIG_Config::cgi_url/Html/default.css");
   }
    # build menu
    my $menu;
    $menu = WebMenu->new();
    if (FIGRules::nmpdr_mode($cgi)) {
        $menu->add_category('&raquo;Navigate', '?page=Home');
    	$menu->add_entry('&raquo;Navigate', 'NMPDR home', "$FIG_Config::nmpdr_site_url/index.php");
    	$menu->add_entry('&raquo;Navigate', 'Organisms', "$FIG_Config::nmpdr_site_url/content/organisms.php");
    	$menu->add_entry('&raquo;Navigate', 'Subsystems', "$FIG_Config::nmpdr_site_url/content/subsystems.php");
    	$menu->add_entry('&raquo;Navigate', 'FigFams', '?page=FigFamViewer');
    } else {
	$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', 'FigFams', '?page=FigFamViewer');
	$menu->add_entry('&raquo;Navigate', 'BLAST Search', '?page=BlastRun');
    }
    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_entry('&raquo;Teacher', 'Annotation Resolve', '?page=ClassAnnotationResolve');
    }
    if (FIGRules::nmpdr_mode($cgi)) {
        $menu->add_category('Help', "$FIG_Config::nmpdr_site_url/content/help.php", 'help', undef, 98);
        $menu->add_entry('Help', 'Searching NMPDR', "$FIG_Config::nmpdr_site_url/content/find.php");
        $menu->add_entry('Help', 'Contact', "$FIG_Config::nmpdr_site_url/content/contactus.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');
	$menu->add_entry('&raquo;Help', 'I forgot my Password', '?page=RequestNewPassword');
    }
    # initialize application
    my $WebApp = WebApplication->new( { id => 'SeedViewer',
					menu     => $menu,
					layout   => $layout,
					default  => 'Home',
				      } );
    my $prefix = (FIGRules::nmpdr_mode($cgi) ? "NMPDR " : "") . "Seed Viewer - ";
    $WebApp->page_title_prefix($prefix);
    $WebApp->show_login_user_info(1);

    # run application
    $WebApp->run();

}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3