]> mj.ucw.cz Git - arexx.git/blob - web/index.cgi
Merge branch '32bit'
[arexx.git] / web / index.cgi
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use lib '.';
7 use UCW::CGI;
8
9 my $graph;
10
11 UCW::CGI::parse_args({
12         'g' => { 'var' => \$graph, 'default' => 'temp-12h' },
13 });
14
15 print <<AMEN ;
16 Content-type: text/html
17
18 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
19 <html><head>
20 <title>Weather in the Burrow</title>
21 <body>
22 <h1>Weather in the Burrow</h1>
23 AMEN
24
25 sub links(@) {
26         my $prefix = shift @_;
27         my $out = "";
28         for my $x (@_) {
29                 my $y = $prefix . $x;
30                 if ($graph eq $y) {
31                         $out .= " <b>$x</b>";
32                 } else {
33                         $out .= " <a href='?g=$y'>$x</a>";
34                 }
35         }
36         return $out;
37 }
38
39 print "<p>Temperature:", links("temp-", "quick", "12h", "48h", "month"), "\n";
40 print "<p>Humidity:", links("rh-", "12h", "48h", "month"), "\n";
41 # print "<p>Power:", links("power-", "2h", "2h-detail", "day", "day-detail", "48h", "48h-detail", "week", "month"), "\n";
42
43 if ($graph =~ /^power-/) {
44         $graph = "http://micac.burrow.ucw.cz/burrow/$graph";
45 }
46 print "<p><img src='$graph.cgi'>\n";