jablonka.czprosek.czf

hotsanic

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

 

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;
2722simandl $dev =~ s/\//-/g;
281simandl }
29 }
30@DIAGRAMS=("hour","6h","day","week","month","year");
31@TIMES=("6h","week");
32 
33# build time-based .html files
34#
35foreach $time (@TIMES) {
36 open (FILE,">index/$time.html");
37 print FILE "<html>\n";
38 if ($REFRESH > 0) {
39 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
40<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
41<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
42 }
43 print FILE "<body>\n<table>\n";
44 foreach $dev (keys %DESCR) {
45 $descr=$DESCR{$dev};
4622simandl $dev =~ s/\//-/g;
471simandl ($page=$dev) =~ s/[.:]/_/g;
48 print FILE " <tr><td><a href=\"",$page,".html\"><img src=\"",$page,"-",$time,".",$IMAGEFORMAT,"\"></a></td>
49 <td valign=top><a href=\"",$page,".html\"><h2>",$dev,"</h2></a><br>",$descr,"</td></tr>\n";
50 }
51 print FILE "</table>\n</body>\n</html>\n";
52 close FILE;
53 }
54 
55# build device-based .html files and complete index
56#
57open (IDXFILE,">idxdata");
58print IDXFILE "0## <td colspan=2 align=center valign=top> <font size=\"+3\">",$MODNAME,"</font><br>
590## <a href=\"",$MODNAME,"/6h.html\">6 hours</a>
600## <a href=\"",$MODNAME,"/week.html\">week</a><br>
610## <hr width=90%>
620## </td>\n";
63$nn=0;
64foreach $dev (sort keys %DESCR) {
65 $nn++;
66 $descr=$DESCR{$dev};
67 ($page=$dev) =~ s/[.:]/_/g;
6822simandl $page =~ s/\//-/g;
691simandl print IDXFILE $nn,"## <td><a href=\"",$MODNAME,"/",$page,".html\"><img src=\"",$MODNAME,"/thumb-",$page,".",$IMAGEFORMAT,"\"></a></td>
70",$nn,"## <td valign=top><a href=\"",$MODNAME,"/",$page,".html\">",$dev,"</a><br><font size=\"-2\">",$descr,"</font></td>\n";
71 
72# build device-based .html
73#
74 open (FILE,">index/$page.html");
75 print FILE "<html>\n";
76 if ($REFRESH > 0) {
77 print FILE "<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
78<META HTTP-EQUIV=\"Refresh\" CONTENT=\"$REFRESH\">
79<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
80 }
81 print FILE "<body>\n";
82 foreach $diagram (@DIAGRAMS) {
83 print FILE "<img src=\"",$page,"-",$diagram,".",$IMAGEFORMAT,"\">\n";
84 }
85 print FILE "</body>\n</html>\n";
86 close FILE;
87 }
88 
89close IDXFILE;
90 
91 

Powered by WebSVN 2.2.1