jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [modules/] [apcusv/] [makeindex.pl] - Blame information for rev 36

 

Line No. Rev Author Line
110simandl#!/usr/bin/env perl
2use warnings;
3use diagnostics;
4 
5use lib "../../lib";
6use HotSaNICparser;
7 
8# read global settings
9#
10$MODNAME=lc HotSaNICparser::get_module_name();
11 
12%CONFIG=HotSaNICparser::get_config("../..");
13$IMAGEFORMAT=$CONFIG{"IMAGEFORMAT"};
14$REFRESH=$CONFIG{"REFRESH"};
15$REFRESH=0 if !defined $REFRESH;
16 
17$DESCR{loadpct}="USV load";
18$DESCR{timeleft}="uptime left";
19$DESCR{battpct}="battery charge";
20$DESCR{battv}="battery voltage";
21$DESCR{outv}="output voltage";
22$DESCR{temp}="temperature";
23 
24# read module-specific settings
25#
26close FILE;
27@DIAGRAMS=("hour","6h","day","week","month","year");
28@TIMES=("6h","week");
29 
30# build time-based .html files
31#
32foreach $time (@TIMES) {
33 open (FILE,">index/$time.html");
34 print FILE "<html>\n";
35 if ($REFRESH > 0) {
36 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
37<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
38<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
39 }
40 print FILE "<body>\n<table>\n";
41 foreach $dev (keys %DESCR) {
42 $descr=$DESCR{$dev};
43 ($page=$dev) =~ s/[.:]/_/g;
44 print FILE " <tr><td><a href=\"$page.html\"><img src=\"$page-$time.$IMAGEFORMAT\"></a></td>
45 <td valign=top><a href=\"$page.html\"><h2>$dev</h2></a><br>$descr</td></tr>\n";
46 }
47 print FILE "</table>\n</body>\n</html>\n";
48 close FILE;
49 }
50 
51# build device-based .html files and complete index
52#
53open (IDXFILE,">idxdata");
54print IDXFILE "0## <td colspan=2 align=center valign=top> <font size=\"+3\">$MODNAME</font><br>
550## <a href=\"$MODNAME/6h.html\">6 hours</a>
560## <a href=\"$MODNAME/week.html\">week</a><br>
570## <hr width=90%>
580## </td>\n";
59$nn=0;
60foreach $dev (sort keys %DESCR) {
61 $nn++;
62 $descr=$DESCR{$dev};
63 ($page=$dev) =~ s/[.:]/_/g;
64 print IDXFILE $nn,"## <td><a href=\"$MODNAME/$page.html\"><img src=\"$MODNAME/thumb-$page.$IMAGEFORMAT\"></a></td>
65$nn## <td valign=top><a href=\"$MODNAME/$page.html\">$dev</a><br><font size=\"-2\">$descr</font></td>\n";
66 
67# build device-based .html
68#
69 open (FILE,">index/$page.html");
70 print FILE "<html>\n";
71 if ($REFRESH > 0) {
72 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
73<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
74<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
75 }
76 print FILE "<body>\n";
77 foreach $diagram (@DIAGRAMS) {
78 print FILE "<img src=\"$page-$diagram.$IMAGEFORMAT\">\n";
79 }
80 print FILE "</body>\n</html>\n";
81 close FILE;
82 }
83 
84close IDXFILE;
85 
86 

Powered by WebSVN 2.2.1