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

View of /SeedViewer/seedviewer.cgi

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.26 - (download) (annotate)
Thu Oct 16 22:30:43 2008 UTC (11 years, 3 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_rel_2008_1110_v2, mgrast_rel_2008_1110, rast_rel_2008_10_29, rast_rel_2008_11_24
Changes since 1.25: +2 -1 lines
Initial changes to support mod_perl with RAST/SeedViewer:

Template loading requires absolute path. We use TMPL_PATH for this.

add_css used to use TMPL_PATH, but css paths are in URL space, not in
filesystem space. Add new TMPL_URL_PATH to WebConfig and use that instead.

WebApplication::run should not exit; mod_perl doesn't like it and it isn't necessary. Just return.

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

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

eval {

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();
    # Initialize tracing.
    if (FIGRules::nmpdr_mode($cgi)) {
	Trace("NMPDR mode selected.") if T(3);
        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);
    } else {
	# initialize layout
	# Use the template file for the current mode-- NMPDR or SEED
	my $templateFile = TMPL_PATH . "/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.   
	# build menu
	my $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', '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');
	$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');

	# check which contact info to show
	if (defined($FIG_Config::server_type) && ($FIG_Config::server_type eq 'MG-RAST')) {
	    $menu->add_entry('&raquo;Help', 'Contact', 'mailto:mg-rast@mcs.anl.gov', undef, ['login']);
	} elsif (defined($FIG_Config::server_type) && ($FIG_Config::server_type eq 'RAST')) {
	    $menu->add_entry('&raquo;Help', 'Contact', 'mailto:rast@mcs.anl.gov', undef, ['login']);
	} else {
	    $menu->add_entry('&raquo;Help', 'Contact', 'mailto:info@theseed.org');
	$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 = "Seed Viewer - ";
	# run application

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3