jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-jablonecka/] [modules/] [sensors/] [makeindex.pl] - Blame information for rev 28

 

Line No. Rev Author Line
11simandl#!/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# read module-specific settings
18#
19undef %SENSOR;
20undef %SENSORDB;
21foreach (HotSaNICparser::read_settings(".")) {
22 ($var,$value)=HotSaNICparser::parse_line($_);
23 if ($var eq "SENSOR") {
24 ($dev,$dbname,$name)=split(/,/,$value);
25 $SENSORDB{$dbname}=$dbname;
26 $SENSOR{$dbname}=$name;
27print "$dev\n";
28 }
29 }
30@DIAGRAMS=("hour","6h","day","week","month","year");
31 
32# build time-based .html files
33#
34foreach $index ("6h","week") {
35 open (FILE,">index/$index.html");
36 print FILE "<html>\n";
37 if ($REFRESH > 0) {
38 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
39<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
40<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
41 }
42 print FILE "<body>\n<table>\n";
43 foreach $dev (keys %SENSOR) {
44 $dbname=$SENSORDB{$dev};
45 $name=$SENSOR{$dev};
46 print FILE " <tr><td><a href=\"",$dbname,".html\"><img src=\"",$dbname,"-",$index,".",$IMAGEFORMAT,"\"></a></td>
47 <td valign=top><a href=\"",$dbname,".html\"><h2>",$name,"</h2></a></td></tr>\n";
48 }
49 print FILE "</table>\n</body>\n</html>\n";
50 close FILE;
51 }
52 
53# build device-based .html files and complete index
54#
55open (IDXFILE,">idxdata");
56print IDXFILE "0## <td colspan=2 align=center valign=top> <font size=\"+3\">",$MODNAME,"</font><br>
570## <a href=\"",$MODNAME,"/6h.html\">6 hours</a>
580## <a href=\"",$MODNAME,"/week.html\">week</a><br>
590## <hr width=90%>
600## </td>\n";
61$nn=0;
62foreach $dev (sort(keys %SENSOR)) {
63 $nn++;
64 $dbname=$SENSORDB{$dev};
65 $name=$SENSOR{$dev};
66 print IDXFILE $nn,"## <td><a href=\"",$MODNAME,"/",$dbname,".html\"><img src=\"",$MODNAME,"/thumb-",$dbname,".",$IMAGEFORMAT,"\"></a></td>
67",$nn,"## <td valign=top><a href=\"",$MODNAME,"/",$dbname,".html\">",$name,"</a><br></td>\n";
68 
69# build device-based .html
70#
71 open (FILE,">index/$dbname.html");
72 print FILE "<html>\n";
73 if ($REFRESH > 0) {
74 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
75<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
76<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
77 }
78 print FILE "<body>\n";
79 foreach $diagram (@DIAGRAMS) {
80 print FILE "<img src=\"",$dbname,"-",$diagram,".",$IMAGEFORMAT,"\">\n";
81 }
82 print FILE "</body>\n</html>\n";
83 close FILE;
84 }
85 
86close IDXFILE;
87 

Powered by WebSVN 2.2.1