jablonka.czprosek.czf

hotsanic

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

 

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 %DEVS;
20foreach (HotSaNICparser::read_settings(".")) {
21 ($var,$value)=HotSaNICparser::parse_line($_);
22 if ($var eq "DRIVE") {
23 ($dev,$name)=split(/,/,$value);
24 $dev =~ s/SNMP:(.*):(.*):(.*)/$1:$3/;
25 $DEVS{$dev}=$name;
26 }
27 }
28@DIAGRAMS=("hour", "day","week","month","year");
29@TIMES=("week");
30 
31# build time-based .html files
32#
33foreach $time (@TIMES) {
34 open (FILE,">index/$time.html");
35 print FILE "<html>\n";
36 if ($REFRESH > 0) {
37 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
38<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
39<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
40 }
41 print FILE "<body>\n<table>\n";
42 foreach $dev (sort keys(%DEVS)) {
43 $name=$DEVS{$dev};
44 $file=$dev;
45 $file=~ s/(\/|:)/_/g;
46 print FILE" <tr><td><a href=\"",$file,".html\"><img src=\"",$file,"-",$time,".",$IMAGEFORMAT,"\"></a></td>
47 <td valign=top><a href=\"",$file,".html\"><h2>",$dev,"</h2></a><br>",$name,"</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,"/week.html\">week</a><br>
580## <hr width=90%>
590## </td>\n";
60$nn=0;
61foreach $dev (sort keys(%DEVS)) {
62 $nn++;
63 $name=$DEVS{$dev};
64 $file=$dev;
65 $file=~ s/(\/|:)/_/g;
66 print IDXFILE $nn,"## <td><a href=\"",$MODNAME,"/",$file,".html\"><img src=\"",$MODNAME,"/thumb-",$file,".",$IMAGEFORMAT,"\"></a></td>
67",$nn,"## <td valign=top><a href=\"",$MODNAME,"/",$file,".html\">",$dev,"<br></a><font size=\"-2\">",$name,"</font></td>\n";
68 
69# build device-based .html
70#
71 open (FILE,">index/$file.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=\"",$file,"-",$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