1 | 1 | simandl | #!/usr/bin/env perl |
2 | | | |
3 | | | # $Id: makeindex.pl,v 1.15 2004/05/29 09:42:59 bernisys Exp $ |
4 | | | |
5 | | | # include PERL libraries |
6 | | | use warnings; |
7 | | | use diagnostics; |
8 | | | |
9 | | | # include HotSaNIC libraries |
10 | | | use lib "../../lib"; |
11 | | | |
12 | | | use HotSaNICparser; |
13 | | | use HotSaNIChtml; |
14 | | | |
15 | | | |
16 | | | (my $VERSION = '$Revision: 1.15 $') =~ s/.*(\d+\.\d+).*/$1/; |
17 | | | (my $IDENTIFIER = '$Id: makeindex.pl,v 1.15 2004/05/29 09:42:59 bernisys Exp $') =~ s/.*,v (.*) \$/$1/; |
18 | | | |
19 | | | # read global settings |
20 | | | # |
21 | | | $MODNAME=lc HotSaNICparser::get_module_name(); |
22 | | | %CONFIG=HotSaNICparser::get_config("../.."); |
23 | | | $IMAGEFORMAT=$CONFIG{IMAGEFORMAT}; |
24 | | | $WEBDIR=$CONFIG{WEBDIR}."/".lc $MODNAME; |
25 | | | $VARDIR=$CONFIG{VARDIR}."/modules/".lc $MODNAME; |
26 | | | $REFRESH=$CONFIG{REFRESH}; |
27 | | | $REFRESH=0 if !defined $REFRESH; |
28 | | | |
29 | | | |
30 | | | |
31 | | | @DIAGRAMS=("hour","6h","day","week","month","year"); |
32 | | | @TIMES=("6h","week"); |
33 | | | |
34 | | | # build time-based .html files |
35 | | | # |
36 | | | $DESCR{loadpct}="USV load"; |
37 | | | $DESCR{timeleft}="uptime left"; |
38 | | | $DESCR{battpct}="battery charge"; |
39 | | | $DESCR{battv}="battery voltage"; |
40 | | | $DESCR{outv}="output voltage"; |
41 | | | $DESCR{temp}="temperature"; |
42 | | | |
43 | | | foreach $time (@TIMES) { |
44 | | | open (FILE,">$WEBDIR/$time.html"); |
45 | | | print FILE HotSaNIChtml::create_header($MODNAME,$REFRESH,"$time overview page")."<table>\n"; |
46 | | | |
47 | | | foreach (keys %DESCR) { |
48 | | | ($page=$_) =~ s/[.:]/_/g; |
49 | | | print FILE HotSaNIChtml::create_table_entry($IMAGEFORMAT,$page,$time,$_,$DESCR{$_},1); |
50 | | | } |
51 | | | print FILE "</table>\n".HotSaNIChtml::create_footer($MODNAME); |
52 | | | close FILE; |
53 | | | } |
54 | | | |
55 | | | # build device-based .html files and complete index |
56 | | | # |
57 | | | print "$VARDIR\n"; |
58 | | | open (IDXFILE,">$VARDIR/idxdata"); |
59 | | | print IDXFILE HotSaNIChtml::create_overview_table_header($MODNAME,join(" ",@TIMES),1); |
60 | | | $num=0; |
61 | | | foreach $dev (sort keys %DESCR) { |
62 | | | $num++; |
63 | | | $description=$DESCR{$dev}; |
64 | | | ($file=$dev) =~ s/[.:]/_/g; |
65 | | | print IDXFILE HotSaNIChtml::create_overview_table_entry($MODNAME,$IMAGEFORMAT,$num,$file,$dev,$description); |
66 | | | HotSaNIChtml::make_device_page($MODNAME,$WEBDIR,$IMAGEFORMAT,$file,$description,@DIAGRAMS); |
67 | | | } |
68 | | | |
69 | | | close IDXFILE; |
70 | | | |