[Bio] / FigWebServices / construct.cgi Repository:
ViewVC logotype

View of /FigWebServices/construct.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Fri Jan 7 21:31:26 2005 UTC (15 years, 4 months ago) by olson
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, merge-trunktag-bobdev_news-1, merge-bodev_news-3, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.1: +1 -0 lines
fix propagation of subsystem name in hiddent var.

use strict;

use FIG;
my $fig = new FIG;

use HTML;
use Data::Dumper;

use CGI;
my $cgi = new CGI;

use Construct qw(/.*/);

if (0)
{
    my $VAR1;
    eval(join("",`cat /tmp/protein_parms`));
    $cgi = $VAR1;
#   print STDERR &Dumper($cgi);
}

if (0)
{
    print $cgi->header;
    my @params = $cgi->param;
    print "<pre>\n";
    foreach $_ (@params)
    {
	print "$_\t:",join(",",$cgi->param($_)),":\n";
    }

    if (0)
    {
	if (open(TMP,">/tmp/protein_parms"))
	{
	    print TMP &Dumper($cgi);
	    close(TMP);
	}
    }
    exit;
}

my $html = [];

unshift @$html, "<TITLE>subsys constructs</TITLE>\n";

#
# Figure out what subsystem we're in.
#

my $sub_name = $cgi->param('ssa');

if (!defined($sub_name))
{
    push(@$html, $cgi->p, "Subsystem name must be provided\n");
    HTML::show_page($cgi, $html);
    exit;
}

my $sub = $fig->get_subsystem($sub_name);

push(@$html, $cgi->h1($sub->get_name()));
push(@$html, $cgi->a({href => "Html/Constructs.html"},
		     "More information on constructs"),
     $cgi->p);

my (@val);

if ($cgi->param('Update'))
{
    push(@$html, "we've been updated!\n");

    @val = get_constructs_from_form($cgi);
    my $verrs = [];
    if (validate_constructs(\@val, $sub, $verrs))
    {	
	my $constructs_file = "$sub->{dir}/constructs";
	system("cp $constructs_file $constructs_file.bak");
	write_constructs_file(\@val, $constructs_file);
    }
    else
    {
	push(@$html, $cgi->p,
	     "Validation failed");
	push(@$html, "<ul>\n", "<li> ", join("<li>\n", @$verrs), "</ul>\n");
    }
    
    # push(@$html, "<pre>\n", Dumper(\@val), "</pre>\n");
}
else
{
    my $constructs_file = "$sub->{dir}/constructs";

    #
    # Create empty file if it's not already there.
    #

    if (! -f $constructs_file)
    {
	open(my $fh, ">$constructs_file");
	close($fh);
    }
    
    @val = parse_constructs_file($constructs_file, $sub);
 }

push(@$html, $cgi->start_form(-name => "construct_form",
			      -method => 'POST',
			      -action => 'construct.cgi'));

push(@$html, $cgi->hidden(-name => 'ssa', -value => $sub_name));

my $ctable = make_html(\@val, $cgi);
push(@$html, $ctable);

push(@$html, $cgi->submit("Update"));

push(@$html, $cgi->end_form);

HTML::show_page($cgi, $html);

#write_constructs_file(\@val, "/tmp/foo");


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3