package Spong::HostGroups;
+my %COLORS = ( 'blue', 4, 'red', 5, 'yellow', 3, 'green', 1, 'purple', 2 );
+
# This constructor expects one of four different types of options. Either an
# empty string specifying that no actual hostlist will be loaded, the string
# "ALL" to load all the host grups, the string containing a group name that
sub display_html {
my( $self, $format ) = @_;
- if( $format eq "standard" ) {
+ if( $format eq "brief" ) {
+ my (%services, $group, $serivce, @names );
+ foreach $service ( sort keys %main::SERVICES ) {
+ push( @names, $service );
+ }
+
+ # Print the header of the table.
+
+ print "<table border=1 cellspacing=0 cellpadding=1";
+ print " bgcolor=" . $main::WWW_TITLE_COLOR if $main::WWW_TITLE_COLOR;
+ print ">\n <tr>\n";
+ print " <td align=center>Host Group</td>\n";
+ print " <td>Status</td>\n";
+ print " </tr>\n";
+
+ # Now for each group, go through and find out overall status of that
+ # host.
+
+ foreach $group ( $self->groups() ) {
+ my $name = $group->name();
+ my $grname = $main::GROUPS{$name}->{'name'};
+
+ print " <tr>\n";
+ print " <th align=left bgcolor=#ffffff nowrap><a href=\"!!WWWSPONG!!/group/$name\" target=\"view\">$grname</a></th>\n";
+
+ my ($color);
+ foreach $service ( @names ) {
+ my ($servicecolor) = $group->services_color( $service );
+ $color = $servicecolor if ($COLORS{$servicecolor} > $COLORS{$color});
+ }
+
+ if( $color ) {
+ if( $main::WWW_USE_IMAGES == 1 ) {
+ print " <td align=center";
+ print " bgcolor=" . $main::WWW_CELL_COLOR
+ if $main::WWW_CELL_COLOR;
+ print ">";
+ my $alt = "";
+ print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$alt\" border=0>";
+ print "";
+ } else {
+ print " <td align=center bgcolor=\"";
+ print $main::WWW_COLOR{$color} . "\" width=25>";
+ print "<font color=\"" . $main::WWW_COLOR{$color} . "\">";
+ print "___</font>";
+ }
+ print "</td>\n";
+ } else {
+ if( $main::WWW_USE_IMAGES == 1 ) {
+ print " <td align=center width=25";
+ print " bgcolor=" . $main::WWW_CELL_COLOR
+ if $main::WWW_CELL_COLOR;
+ print "> - </td>\n";
+ } else {
+ print " <td align=center width=25";
+ print " bgcolor=" . $main::WWW_CELL_COLOR
+ if $main::WWW_CELL_COLOR;
+ print "> </td>\n";
+ }
+ }
+ print " </tr>\n";
+ }
+ print "</table>\n";
+
+ } elsif( $format eq "standard" ) {
my( %services, $group, $service, @names );
# Compute the total list of services running on the various hosts, and
my $grname = $main::GROUPS{$name}->{'name'};
print "<tr><td align=left bgcolor=#ffffff nowrap>\n";
- print "<a href=\"!!WWWSPONG!!/full/overview/$name\">$grname</a></td>\n";
+ print "<a href=\"!!WWWSPONG!!/group/$name\" target=\"view\">$grname</a></td>\n";
foreach $service ( @names ) {
my $color = $group->services_color( $service );