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

Annotation of /FigWebServices/myseed.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : redwards 1.1 # -*- perl -*-
2 : olson 1.2 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : redwards 1.1
20 :     =pod
21 :    
22 :     =head1
23 :    
24 :    
25 :     Generate a myseed page that will allow people to set different settings. All this page will do is set the cookies, it is upto the other pages to respect the cookie settings and display the information as selected.
26 :    
27 :     Overall format is a series of menus, one for each of the most commonly used pages, that is shown or hidden using the javascript.
28 :    
29 :     =cut
30 :    
31 :     use FIG;
32 :    
33 :     use strict;
34 :     use HTML;
35 :     use CGI;
36 :     use raelib;
37 :     my $cgi = new CGI;
38 :     my $raelib=new raelib;
39 :     my $fig;
40 :     eval {
41 :     $fig = new FIG;
42 :     };
43 :    
44 :     if ($@ ne "")
45 :     {
46 :     my $err = $@;
47 :    
48 :     my(@html);
49 :    
50 :     push(@html, $cgi->p("Error connecting to SEED database."));
51 :     if ($err =~ /Could not connect to DBI:.*could not connect to server/)
52 :     {
53 :     push(@html, $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport."));
54 :     }
55 :     else
56 :     {
57 :     push(@html, $cgi->pre($err));
58 :     }
59 :     &HTML::show_page($cgi, \@html, 1);
60 :     exit;
61 :     }
62 :    
63 :    
64 :     my $html=["<title>MySEED Options</title>"];
65 :    
66 :    
67 :     ############### initial settings
68 :     #
69 :     # At the moment this is just username, but we can put other things here too.
70 :     #
71 :    
72 :     my ($cookie, $data)=$raelib->cookie($cgi);
73 :    
74 :    
75 :     $cgi->param('user') ? $data->{"user"} = $cgi->param('user') : 1 ;
76 :    
77 :     push @$html, $cgi->start_form(), "<div style='text-align: center'>MySEED Settings</div>",
78 :     "Please enter your username: ", $cgi->textfield(-name=>"user", -value=>$data->{"user"}, -size=>20), $cgi->p;
79 :    
80 :    
81 :     ############## settings for the default seed entry point
82 :     #
83 :     #
84 :    
85 :     if (0)
86 :     {
87 :     # I can't do this at the moment, because we'd have to put redirects in each of the pages, and I can't figure out how
88 :     # to let you come back to the original page easily
89 :    
90 :     # settings for index.cgi
91 :     my $entry={
92 :     "start.cgi" => "Basic SEED Entry Point",
93 :     "index.cgi" => "Advanced SEED Entry Point",
94 :     "organisms.cgi?show=cyano" => "CyanoSEED",
95 :     "organisms.cgi?show=rohwer" => "Rohwer Metagenomes",
96 :     };
97 :    
98 :     $data->{"entry"} = $cgi->param('entry') or "start.cgi";
99 :    
100 :    
101 :     push @$html, (
102 :     "\n<a href=\"javascript:toggleLayer('indexcgisettings');\" title=\"Show index.cgi settings\">Settings for the SEED entry page</a>\n",
103 :     "<div id=indexcgisettings>\n",
104 :     "Default FIG start page: &nbsp; ", $cgi->popup_menu(-name=>"entry", -value=>[sort keys %$entry], -labels=>$entry, -default=>$data->{"entry"}), "</div>\n"
105 :     );
106 :     }
107 :    
108 :    
109 :     ################## Settings for subsys.cgi
110 :     #
111 :     # we can set the default views for subsys.cgi
112 :    
113 :     map {$cgi->param($_) ? eval {$data->{$_}=$cgi->param($_)} : eval {$data->{$_}=0}} (qw[subsys_fp_sort subsys_fp_genomes subsys_sort subsys_clusters subsys_minusone]);
114 :    
115 :     #print STDERR map {"$_\t". $data->{$_}."\n"} keys %$data;
116 :    
117 :    
118 :     my $fp=['Classification','Subsystem','Curator', 'Number of Roles', 'Version'];
119 :    
120 :     my $ss_sort =
121 :     {
122 :     "by_variant" => "Variant Code",
123 :     "by_pattern" => "Patterns",
124 :     "unsorted" => "None",
125 :     "by_phylo" => "Phylogeny",
126 :     "alphabetic" => "Alphabetical",
127 :     "by_tax_id" => "Taxonomy",
128 :     };
129 :    
130 :     push @$html, (
131 :     "\n<a href=\"javascript:toggleLayer('subsyscgisettings');\" title=\"Show subsys.cgi settings\">Settings for Subsystems display</a>\n",
132 :     "<div id=subsyscgisettings\n",
133 :     $cgi->b("Settings for the subsystems classification and selection page"), "\n<ul>\n",
134 :     $cgi->p("Sort subsystem classification page by : ", $cgi->popup_menu(-name=>'subsys_fp_sort', -value=>$fp, -default=>$data->{'subsys_fp_sort'}, -label=>"")),
135 :     $cgi->p("Show number of genomes on first subsystem page: ", $cgi->checkbox(-name=>"subsys_fp_genomes", -checked=>$data->{'subsys_fp_genomes'}, -label=>"")),
136 :     "\n</ul>\n",
137 :     $cgi->b("Settings for the subsystems view page"), "\n<ul>\n",
138 :     $cgi->p("Color the page by features that are in clusters: ", $cgi->checkbox(-name=>"subsys_clusters", -checked=>$data->{'subsys_clusters'}, -label=>"")),
139 :     $cgi->p("Sort the organisms by: ", $cgi->popup_menu(-name=>'subsys_sort', -values=>[keys %$ss_sort], -labels=>$ss_sort)),
140 :     $cgi->p("Show organisms with a minus one variant code: ", $cgi->checkbox(-name=>"subsys_minusone", -checked=>$data->{'subsys_minusone'}, -label=>"")),
141 :     "\n</ul>\n",
142 :     "</div>",
143 :     );
144 :    
145 :    
146 :    
147 :     push @$html, ($cgi->p, $cgi->submit, $cgi->reset, $cgi->p);
148 :    
149 :    
150 :    
151 :    
152 :    
153 :     ($cookie, $data)=$raelib->cookie($cgi, $data);
154 :     &HTML::show_page($cgi, $html, 1, undef, undef, undef, $cookie);
155 :    
156 :    
157 :    
158 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3