# # $Id: HotSaNIChtml.pm,v 1.8 2004/06/03 00:21:46 bernisys Exp $ # package HotSaNIChtml; ($VERSION = '$Revision: 1.8 $') =~ s/.*(\d+\.\d+).*/$1/; ###################################################################### # # insert complete HTML header # sub create_header { my $MODNAME=shift || ""; my $REFRESH=shift || 0; my $WHICH=shift || ""; my %STYLE=@_; $STYLE{BGCOLOR}="E0E0E0" if !defined $STYLE{BGCOLOR}; $STYLE{TEXT}="000000" if !defined $STYLE{TEXT}; $STYLE{LINK}="000080" if !defined $STYLE{LINK}; $STYLE{VLINK}="800080" if !defined $STYLE{VLINK}; $STYLE{ALINK}="008000" if !defined $STYLE{ALINK}; $STYLE{BACKGROUND}="" if !defined $STYLE{BACKGROUND}; if ($STYLE{BACKGROUND} ne "") { if ($MODNAME ne "") { $STYLE{BACKGROUND}="../$STYLE{BACKGROUND}"; } $STYLE{BACKGROUND}=" background=\"$STYLE{BACKGROUND}\""; } my $INFO=$MODNAME; if ($INFO eq "") {$INFO = "global overview page"; } if ($WHICH ne "") {$WHICH = " - $WHICH"; } my @head=( "", "", "", " ", " ", ); if ($REFRESH > 0) { push @head,( " ", " " ); } push @head,( # " ", " ", " ", " ", # " ", "", " ", " ", " ", # " ", "", " HotSaNIC stats - $INFO$WHICH", " ", "", " ", ); if ($MODNAME ne "") { push @head,"

$INFO$WHICH

"; } return join("\n",@head)."\n"; } ###################################################################### # # insert complete HTML footer # sub create_footer { my $MODNAME=shift || ""; my $PATH="."; if ($MODNAME ne "") { $PATH=".."; } my @foot=( "
", "
", "
", " \"HotSaNIC\" \"rrdtool\"", "
", " HTML overview to System and Network Information Center", "
", " ", "" ); return join("\n",@foot)."\n"; } ###################################################################### # # insert complete table entry for a module time index page # sub create_table_entry { my $IMAGEFORMAT=shift || ""; my $PAGENAME=shift || ""; my $TIME=shift || ""; my $NAME=shift || ""; my $DESCRIPTION=shift || ""; my $COMPACT=shift || 1; if ($DESCRIPTION ne "") { $DESCRIPTION="

$DESCRIPTION"; } my $LV1=" " x 8; my $LV2=" " x 10; my $LV3=" " x 12; my @items=("$LV1"); my @block=( "$LV2", "", "" ); if ($COMPACT != 1) { push @items,$block[0],$LV3.$block[1],$LV2.$block[2]; } else { push @items,join ("",@block); } @block=( "$LV2", "$NAME$DESCRIPTION", "", ); if ($COMPACT != 1) { push @items,$block[0],$LV3.$block[1],$LV2.$block[2]; } else { push @items,join ("",@block); } push @items,"$LV1"; return join("\n",@items)."\n"; } ###################################################################### # # insert complete table header for the overview page # sub create_overview_table_header { my $MODNAME=shift || ""; my $TIMES=shift || ""; my $COLS=shift || 1; my $LV1=" " x 10; my $LV2=" " x 12; my @items=("$COLS","0##$LV1 $MODNAME
"); foreach $time (split /\s+/, $TIMES) { push @items,"0##$LV2$time"; } push @items,("0##$LV2
","0##$LV2
","0##$LV1"); return join("\n",@items)."\n"; } ###################################################################### # # insert complete table entry for the overview page # sub create_overview_table_entry { my $MODNAME=shift || ""; my $IMAGEFORMAT=shift || ""; my $NUM=shift || 1; my $PAGENAME=shift || ""; my $NAME=shift || ""; my $DESCRIPTION=shift || ""; my $COMPACT=shift || 1; if ($DESCRIPTION ne "") { $DESCRIPTION="
$DESCRIPTION"; } my $LV1=" " x 10; my $LV2=" " x 12; my @items=(); my @block=( "$NUM##$LV1", "", ""); if ($COMPACT != 1) { push @items,$block[0],"$NUM##$LV2".$block[1],"$NUM##$LV1".$block[2]; } else { push @items,join ("",@block); } @block=( "$NUM##$LV1", "$NAME$DESCRIPTION", "" ); if ($COMPACT != 1) { push @items,$block[0],"$NUM##$LV2".$block[1],"$NUM##$LV1".$block[2]; } else { push @items,join ("",@block); } return join("\n",@items)."\n"; } ###################################################################### # # insert a number of empty table entries for the overview page # # $num row number # # $count how many cols shall be added # sub create_overview_table_entry_empty { my $NUM=shift || 1; my $COUNT=shift || 0; my $LV1=" " x 10; my $value=""; if ($COUNT > 0) { if ($NUM >= 0) { $value="$NUM##$LV1\n" x $COUNT; } else { $value="$LV1\n" x $COUNT; } } return $value; } ###################################################################### # # generate a .html file containing the detailed device overview # # HotSaNIChtml::make_device_page($MODNAME,$WEBDIR,$IMAGEFORMAT,$file,description,@times); # # $MODNAME name of the module # # $WEBDIR the directory where the file shall be written # # $IMAGEFORMAT gif or png # # $file name of the file (without ".html" suffix) # # $description description tag that will be included on top of the page # # @times array containing the timespans for which diagrams shall # be inseerted # sub make_device_page { my $MODNAME=shift; my $WEBDIR=shift; my $IMAGEFORMAT=shift; my $file=shift; my $description=shift; open (FILE,">$WEBDIR/$file.html"); print FILE HotSaNIChtml::create_header($MODNAME,$REFRESH,$description); foreach my $time (@_) { print FILE "\n"; } print FILE HotSaNIChtml::create_footer($MODNAME); close FILE; } 1; WebSVN - hotsanic - Blame - Rev 36 - /branches/HotSaNIC-0.5.0-pre6/lib/HotSaNIChtml.pm
  jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [lib/] [HotSaNIChtml.pm] - Blame information for rev 36

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1