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

Annotation of /FigWebServices/construct.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (view) (download)

1 : olson 1.3 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : olson 1.1 use strict;
19 :    
20 :     use FIG;
21 :     my $fig = new FIG;
22 :    
23 :     use HTML;
24 :     use Data::Dumper;
25 :    
26 :     use CGI;
27 :     my $cgi = new CGI;
28 :    
29 :     use Construct qw(/.*/);
30 :    
31 :     if (0)
32 :     {
33 :     my $VAR1;
34 :     eval(join("",`cat /tmp/protein_parms`));
35 :     $cgi = $VAR1;
36 :     # print STDERR &Dumper($cgi);
37 :     }
38 :    
39 :     if (0)
40 :     {
41 :     print $cgi->header;
42 :     my @params = $cgi->param;
43 :     print "<pre>\n";
44 :     foreach $_ (@params)
45 :     {
46 :     print "$_\t:",join(",",$cgi->param($_)),":\n";
47 :     }
48 :    
49 :     if (0)
50 :     {
51 :     if (open(TMP,">/tmp/protein_parms"))
52 :     {
53 :     print TMP &Dumper($cgi);
54 :     close(TMP);
55 :     }
56 :     }
57 :     exit;
58 :     }
59 :    
60 :     my $html = [];
61 :    
62 :     unshift @$html, "<TITLE>subsys constructs</TITLE>\n";
63 :    
64 :     #
65 :     # Figure out what subsystem we're in.
66 :     #
67 :    
68 :     my $sub_name = $cgi->param('ssa');
69 :    
70 :     if (!defined($sub_name))
71 :     {
72 :     push(@$html, $cgi->p, "Subsystem name must be provided\n");
73 :     HTML::show_page($cgi, $html);
74 :     exit;
75 :     }
76 :    
77 :     my $sub = $fig->get_subsystem($sub_name);
78 :    
79 :     push(@$html, $cgi->h1($sub->get_name()));
80 :     push(@$html, $cgi->a({href => "Html/Constructs.html"},
81 :     "More information on constructs"),
82 :     $cgi->p);
83 :    
84 :     my (@val);
85 :    
86 :     if ($cgi->param('Update'))
87 :     {
88 :     push(@$html, "we've been updated!\n");
89 :    
90 :     @val = get_constructs_from_form($cgi);
91 :     my $verrs = [];
92 :     if (validate_constructs(\@val, $sub, $verrs))
93 :     {
94 :     my $constructs_file = "$sub->{dir}/constructs";
95 :     system("cp $constructs_file $constructs_file.bak");
96 :     write_constructs_file(\@val, $constructs_file);
97 :     }
98 :     else
99 :     {
100 :     push(@$html, $cgi->p,
101 :     "Validation failed");
102 :     push(@$html, "<ul>\n", "<li> ", join("<li>\n", @$verrs), "</ul>\n");
103 :     }
104 :    
105 :     # push(@$html, "<pre>\n", Dumper(\@val), "</pre>\n");
106 :     }
107 :     else
108 :     {
109 :     my $constructs_file = "$sub->{dir}/constructs";
110 :    
111 :     #
112 :     # Create empty file if it's not already there.
113 :     #
114 :    
115 :     if (! -f $constructs_file)
116 :     {
117 :     open(my $fh, ">$constructs_file");
118 :     close($fh);
119 :     }
120 :    
121 :     @val = parse_constructs_file($constructs_file, $sub);
122 :     }
123 :    
124 :     push(@$html, $cgi->start_form(-name => "construct_form",
125 :     -method => 'POST',
126 :     -action => 'construct.cgi'));
127 :    
128 : olson 1.2 push(@$html, $cgi->hidden(-name => 'ssa', -value => $sub_name));
129 : olson 1.1
130 :     my $ctable = make_html(\@val, $cgi);
131 :     push(@$html, $ctable);
132 :    
133 :     push(@$html, $cgi->submit("Update"));
134 :    
135 :     push(@$html, $cgi->end_form);
136 :    
137 :     HTML::show_page($cgi, $html);
138 :    
139 :     #write_constructs_file(\@val, "/tmp/foo");
140 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3