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

Annotation of /FigWebServices/myseed.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3