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

Diff of /FigWebServices/start.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Mon Aug 8 21:54:39 2005 UTC revision 1.2, Thu Aug 11 18:30:38 2005 UTC
# Line 20  Line 20 
20    
21  my $user = $cgi->param('user');  my $user = $cgi->param('user');
22    
23  my $click_js = <<'EJS';  #my $click_js = <<'EJS';
24  <script language="JavaScript">  #put the javascript in FIG.js with all the others to keep the html clean and reduce redundancy
   
 haveClickedSearch = 0;  
   
 function check_first_search_click(what)  
 {  
     if (!haveClickedSearch)  
     {  
         what.value = '';  
         haveClickedSearch = 1;  
     }  
 }  
 </script>  
 EJS  
25    
26  push(@$html, $cgi->start_head,  push(@$html, $cgi->start_head,
27       $cgi->title("Wecome to the SEED"),       $cgi->title("Wecome to the SEED"),
      $click_js,  
28       q(<body onload="document.search_form.search_string.focus(); document.search_form.search_string.value = 'Enter search terms'">));       q(<body onload="document.search_form.search_string.focus(); document.search_form.search_string.value = 'Enter search terms'">));
29    
30  push(@$html, $cgi->hidden("user"));  push(@$html, $cgi->hidden("user"));
# Line 46  Line 32 
32  #  #
33  # Command handlers  # Command handlers
34  #  #
 handle_action('view_subsystem', \&do_view_subsystem, $cgi, $html);  
 handle_action('view_genome', \&do_view_genome, $cgi, $html);  
 handle_action('text_search', \&do_text_search, $cgi, $html);  
 handle_action('go_old', \&do_go_old_seed, $cgi, $html);  
35    
36    if ($cgi->param('search_string') && $cgi->param('search_string') ne "Enter search terms")
37    {
38     &do_text_search($cgi, $html);
39    }
40    if ($cgi->param('sel_genome') && $cgi->param('sel_genome') ne "Pick an organism")
41    {
42     &do_view_genome($cgi, $html);
43    }
44    if ($cgi->param('sel_subsystem') && $cgi->param('sel_subsystem') ne "Pick a subsystem")
45    {
46     &do_view_subsystem($cgi, $html);
47    }
48    if ($cgi->param('go_old'))
49    {
50     &do_go_old_seed($cgi, $html);
51    }
52    
53  push(@$html, $cgi->start_form(-name => "search_form"));  push(@$html, $cgi->start_form(-name => "search_form", -class => "firstform"));
54    
55  gen_user_login($cgi, $html);  gen_user_login($cgi, $html);
56    
# Line 64  Line 62 
62  gen_subsystem_dropdown($cgi, $html);  gen_subsystem_dropdown($cgi, $html);
63    
64  push(@$html,  push(@$html,
65       $cgi->p,       $cgi->p({-class=>"center"},
66         $cgi->submit(-name => 'go', -value=>"Go!", -class=>"go"),
67         ),
68         $cgi->p({class=>"center"},
69       $cgi->submit(-name => 'go_old',       $cgi->submit(-name => 'go_old',
70                    -value => 'Advanced SEED entrypoint'),                    -value => 'Advanced SEED entrypoint'),
71       $cgi->p,       ),
72                    $cgi->a({href => "Html/help_front_page.html"}, "Help")       $cgi->end_form(),
73         $cgi->a({href => "Html/help_front_page.html", class=>"help"}, "Help")
74       );       );
75    
   
   
 push(@$html, $cgi->end_form());  
   
76  my @hdr = &HTML::compute_html_header(undef, undef, no_fig_search => 1 );  my @hdr = &HTML::compute_html_header(undef, undef, no_fig_search => 1 );
77    
78  push(@$html, $cgi->end_body);  push(@$html, $cgi->end_body);
# Line 89  Line 87 
87  sub gen_user_login  sub gen_user_login
88  {  {
89      my($cgi, $html) = @_;      my($cgi, $html) = @_;
90        return if ($cgi->param('user'));
91        my $inputclass='emptyuserinput';
92        if ($cgi->param('user')) {$inputclass='knownuserinput'}
93    
94      push(@$html, $cgi->p("User id:",      push(@$html, $cgi->p({id=>"userid"}, "User ID:",
95                    $cgi->textfield(-name => 'user',                    $cgi->textfield(-name => 'user',
96                                    -default => ""),                                    -default => "",
97                    " (of the form JohnDoe - <b>no spaces or special characters</b>)",                                    -class => $inputclass),
98                     $cgi->a({id=>"help", onMouseover=>"javascript:if(!this.tooltip) this.tooltip=new Popup_Tooltip(this, 'Help', '<b>Please use something like JohnDoe</b><br>Your username is unique to you but is not a security measure.<br>Please do not uses spaces or special characters in the username', ''); this.tooltip.addHandler(); return false;"}, Help),
                   $cgi->p,  
99                    ));                    ));
   
   
   
100  }  }
101    
102  sub gen_subsystem_dropdown  sub gen_subsystem_dropdown
# Line 125  Line 122 
122            $cgi->popup_menu(-name => 'sel_subsystem',            $cgi->popup_menu(-name => 'sel_subsystem',
123                             -style => "width: 4in",                             -style => "width: 4in",
124                             -values => \@values,                             -values => \@values,
125                             -labels => \%labels),,                             -labels => \%labels,
126            "&nbsp;",                             -class => "sel_subsystem"),
127            $cgi->submit(-name => 'view_subsystem',            q(<a id="help" onMouseover="javascript:if(!this.tooltip) this.tooltip=new Popup_Tooltip(this, 'Help', '<b>Please choose a subsystem from this list</b>', ''); this.tooltip.addHandler(); return false;" >Help</a>),
                        -value => "Go"),  
128           );           );
129    
130    
# Line 138  Line 134 
134  {  {
135      my($cgi, $html) = @_;      my($cgi, $html) = @_;
136    
137  #    push(@$html, $cgi->h2("Metabolic Reconstructions"));      my @values;
138        my $label;
139        my $attribute;
140    
141      my $res = $fig->db_handle()->SQL("select genome, gname from genome order by gname");      # this is just a hash that will put the bacteria first, then the euks, then the archs, and so on
142        my %sort=(
143            "Virus"=>'4',
144            "Eukaryota"=>'3',
145            "Bacteria"=>'1',
146            "Archaea"=>'2',
147            "unknown"=>'5',
148            "Environmental Sample"=>'9',
149        );
150    
     my %labels;  
     my @values;  
     for my $ent (@$res)  
     {  
         my($genome, $gs) = @$ent;  
151    
152          push(@values, $genome);      my %count;
153          $labels{$genome} = "$gs ($genome)";      foreach my $genome (
154         sort {$sort{$fig->genome_domain($a)} <=> $sort{$fig->genome_domain($b)}
155               || uc($fig->genus_species($a)) cmp uc($fig->genus_species($b))} $fig->genomes(1)) {
156                    push @values, $genome;
157                    $label->{$genome}=$fig->genus_species($genome), " ($genome)";
158                    $attribute->{$genome}={class=>$fig->genome_domain($genome)}; $attribute->{$genome}=~ s/\s+//g;
159      }      }
160    
   
161      unshift(@values, "_choose_org");      unshift(@values, "_choose_org");
162      $labels{_choose_org} = "Pick an organism";      $label->{_choose_org} = "Pick an organism";
163    
164    
165      push (@$html, ($cgi->popup_menu(-name => 'sel_genome',      push (@$html, ($cgi->popup_menu(-name => 'sel_genome',
166                                      -style => "width: 4in",                                      -style => "width: 4in",
167                                      -values => \@values,                                      -values => \@values,
168                                      -labels => \%labels),,                                      -labels => $label,
169                    "&nbsp;",                                      -class => "sel_genome",
170                     $cgi->submit(-name => 'view_genome',                                      -attributes => $attribute),
171                                  -value => "Go"),      q(<a id="help" onMouseover="javascript:if(!this.tooltip) this.tooltip=new Popup_Tooltip(this, 'Help', '<b>Please choose an organism from this list.</b><br>The list shows the current organisms in the SEED database.<br>They have been grouped and colored so that <span class=\\'Bacteria\\'>Bacteria</span> appear first, and then <span class=\\'Archaea\\'>Archaea</span>, <span class=\\'Eukaryota\\'>Eukaryota</span>, <span class=\\'Viruses\\'>Viruses</span>, <span class=\\'unknown\\'>unclassified sequences</span>, and then <span class=\\'EnvironmentalSample\\'>Environmental Samples</span>.<br> Your search will be restricted to just the organism you choose, or if you do not enter a search term you will be taken to that organisms homepage.',''); this.tooltip.addHandler(); return false;" >Help</a>)));
                    $cgi->p,  
                    ));  
172  }  }
173    
174  sub gen_text_search  sub gen_text_search
# Line 179  Line 182 
182                                    -override => 1,                                    -override => 1,
183                                    -onClick => 'check_first_search_click(this)',                                    -onClick => 'check_first_search_click(this)',
184                                    -size => 60),                                    -size => 60),
185                    "&nbsp;",          q(<a id="help" onMouseover="javascript:if(!this.tooltip) this.tooltip=new Popup_Tooltip(this, 'Help', '<b>Please enter some text to search.</b> You may enter the full or partial name of a functional role, an organism, or any other data.', ''); this.tooltip.addHandler(); return false;" >Help</a>),
                   $cgi->submit(-name => 'text_search',  
                                -value => 'Go'),  
186                   ));                   ));
187    
188  }  }
189    
 sub handle_action  
 {  
     my($field, $sub, $cgi, $html) = @_;  
   
     if ($cgi->param($field))  
     {  
         &$sub($cgi, $html);  
     }  
 }  
190    
191  sub do_view_subsystem  sub do_view_subsystem
192  {  {
# Line 243  Line 235 
235      }      }
236    
237      my $sub_url = $fig->cgi_url() . "/genome_statistics.cgi?user=$user&genome=$genome";      my $sub_url = $fig->cgi_url() . "/genome_statistics.cgi?user=$user&genome=$genome";
238      warn "Redirect to $sub_url\n";      #warn "Redirect to $sub_url\n";
239      print $cgi->redirect($sub_url);      print $cgi->redirect($sub_url);
240      exit 0;      exit 0;
241  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3