jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-jablonecka/] [modules/] [traffic/] [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 %DESCR;
20foreach (HotSaNICparser::read_settings(".")) {
21 ($var,$value)=HotSaNICparser::parse_line($_);
22 if ($var eq "DEV") {
23 ($dev,undef,undef,$descr)=split(/,/,$value);
24 $dev =~ s/SNMP:(.*?):.*:(.*?)/$1:$2/;
25 $dev =~ s/RRCP:(.*?):.*:(.*?)/$1:$2/;
26 $DESCR{$dev}=$descr;
27 }
28 }
29@DIAGRAMS=("hour","6h","day","week","month","year");
30@TIMES=("6h","week");
31 
32# build time-based .html files
33#
34foreach $time (@TIMES) {
35 open (FILE,">index/$time.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 %DESCR) {
44 $descr=$DESCR{$dev};
45 ($page=$dev) =~ s/[.:]/_/g;
46 print FILE " <tr><td><a href=\"",$page,".html\"><img src=\"",$page,"-",$time,".",$IMAGEFORMAT,"\"></a></td>
47 <td valign=top><a href=\"",$page,".html\"><h2>",$dev,"</h2></a><br>",$descr,"</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 %DESCR) {
63 $nn++;
64 $descr=$DESCR{$dev};
65 ($page=$dev) =~ s/[.:]/_/g;
66 print IDXFILE $nn,"## <td><a href=\"",$MODNAME,"/",$page,".html\"><img src=\"",$MODNAME,"/thumb-",$page,".",$IMAGEFORMAT,"\"></a></td>
67",$nn,"## <td valign=top><a href=\"",$MODNAME,"/",$page,".html\">",$dev,"</a><br><font size=\"-2\">",$descr,"</font></td>\n";
68 
69# build device-based .html
70#
71 open (FILE,">index/$page.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=\"",$page,"-",$diagram,".",$IMAGEFORMAT,"\">\n";
81 }
82 print FILE "</body>\n</html>\n";
83 close FILE;
84 }
85 
86close IDXFILE;
87 
88 

Powered by WebSVN 2.2.1