--- generate-overview.pl 2002/07/24 15:14:08 1.5
+++ generate-overview.pl 2003/05/26 16:56:11 1.13
@@ -34,7 +34,9 @@
# You need to update this to point to the URL
# you use to access Cricket.
# $gBaseURL = "http://localhost/~cricket/grapher.cgi";
- $gBaseURL = "http://romul.pliva.hr/cgi-bin/cricket/grapher.cgi";
+ my $hostname = `hostname -f`;
+ chomp($hostname);
+ $gBaseURL = "http://$hostname/cgi-bin/cricket/grapher.cgi";
# change this to destination directory
$path = "/data/mon/";
@@ -55,6 +57,12 @@
use Common::Options;
use Common::Log;
+#
+# Set this option to 0 if you don't want JavaScript roll-up/roll-down
+# of images to be created
+#
+my $dynamic_js = 1;
+
Common::Options::commonOptions( 'baseURL=s' => \$gBaseURL );
initConst();
@@ -105,8 +113,158 @@
}
Info("Dumping HTML for $key to $filename.");
open(OUT,"> $filename") || die "can't open output html '$filename': $!";
- print OUT "
$key";
+ print OUT "$key";
+ print OUT '
+ ' if ($filename =~ m/Daily/i);
+ print OUT '';
+ my $html=<<'HTMLEND';
+
+
+
+
+
+HTMLEND
+ if ($dynamic_js) {
+ my $cookie_name = $key;
+ $cookie_name =~ s/[^a-zA-Z0-9]//g;
+ $html =~ s/##cookie_name##/$cookie_name/g;
+ print OUT $html;
+ }
+
print OUT $html_file{$key};
+ $html = <<'HTMLEND';
+
+
+
+HTMLEND
+
+ if ($dynamic_js) {
+ my $cookie_name = $key;
+ $cookie_name =~ s/[^a-zA-Z0-9]//g;
+ $html =~ s/##cookie_name##/$cookie_name/g;
+ print OUT $html;
+ }
+
print OUT "";
close(OUT);
@@ -114,6 +272,28 @@
exit;
+sub do_html {
+ my ($desc,$url,$img) = @_;
+ if ($dynamic_js) {
+ my $html =<<'HTMLEND';
+
+##desc## |
+
+
+
+ |
+HTMLEND
+ $html =~ s/##desc##/$desc/;
+ $html =~ s/##url##/$url/;
+ $html =~ s/##img##/$img/;
+ $html =~ s/##id##/$dynamic_js/g;
+ $dynamic_js++; # increment usage counter
+ return $html;
+ } else {
+ return "$desc
\n";
+ }
+}
+
sub localHandleTargetInstance {
my($Name, $target) = @_;
@@ -179,6 +359,7 @@
$URL = "$gBaseURL?type=png&target=$paramtarget";
$URL .= "&dslist=$dslist&range=$paramrange";
my $desc = "$paramtarget $vname";
+ $desc .= " ".$target->{'short-desc'}."" if (defined $target->{'short-desc'});
if ($paraminst ne "") {
$URL .= "&inst=$paraminst";
}
@@ -186,7 +367,7 @@
Info("Retrieving graph for $desc");
# getURL($URL,"$path/$name-$vname-$rangeLabel.png");
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname";
- $html{"$rangeLabel\t$paramtarget"}.="$desc
\n";
+ $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);
}
} else {
$dslist = $ttRef->{'ds'};
@@ -196,6 +377,7 @@
$URL = "$gBaseURL?type=png&target=$paramtarget";
$URL .= "&dslist=$dslist&range=$paramrange";
my $desc ="$paraminst $rangeLabel";
+ $desc .= " ".$target->{'short-desc'}."" if (defined $target->{'short-desc'});
if ($paraminst ne "") {
$URL .= "&inst=$paraminst";
}
@@ -204,7 +386,7 @@
# getURL($URL,"$path/$name-$rangeLabel.png");
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y";
- $html{"$rangeLabel\t$paramtarget"}.="$desc:
";
+ $html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL);
}
}
}