From fa3395b7de59350c1990620b953fc3291ec81c8a Mon Sep 17 00:00:00 2001 From: Stephen L Johnson <sjohnson@monsters.org> Date: Thu, 26 Oct 2000 19:06:52 +0000 Subject: [PATCH] fixed problem with code handling host group 'display' attribute --- src/lib/Spong/HostGroups.pm | 38 ++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/lib/Spong/HostGroups.pm b/src/lib/Spong/HostGroups.pm index 78d4cac..da45e78 100755 --- a/src/lib/Spong/HostGroups.pm +++ b/src/lib/Spong/HostGroups.pm @@ -18,6 +18,8 @@ # + add - adds a specific host group to the instance # +# $Id: HostGroups.pm,v 1.9 2000/10/26 19:06:52 sljohnson Exp $ + use Spong::Host; use Spong::HostList; @@ -49,7 +51,8 @@ sub new { } elsif ( $grps eq "ALL" ) { foreach $group ( keys %main::GROUPS ) { next if $group eq 'all' && ! $main::HOSTGROUPSALL; - next if $group->{'display'} == 0; # skip if display attr = 0 + next if ( defined $main::GROUPS{$group}->{'display'} && + $main::GROUPS{$group}->{'display'} == 0); my $object = Spong::HostList->new( $group ); if( $object ) { $groups{$group} = $object; } } @@ -98,6 +101,7 @@ sub add { $self->{'group_hash'}->{$name} = $hostlist; } + # Display routines. Does both text and html, does rely on both the Host and # Service objects for some help. # @@ -110,6 +114,7 @@ sub display { $self->display_text( $view ) if $type eq "text"; $self->display_html( $view ) if $type eq "html"; + $self->display_wml( $view ) if $type eq "wml"; } # This displays a summary of all the hosts in this list in a text format @@ -480,4 +485,35 @@ sub display_problems { } +# This displays a summary of all the hosts in this list in an WML format +# suitable for displaying on WAP enabled devices + +sub display_wml { + my( $self, $format ) = @_; + + if( $format eq "brief" ) { + + # Go through each HostList + foreach $hostlist ( $self->groups() ) { + my $color = substr($hostlist->summary_color(),0,2); + $color =~ tr/a-z/A-Z/; + my $name = $hostlist->name(); + print "<b><anchor title=\"$name\">$color"; + print "<go href=\"!!WAPSPONG!!/grp-summary/$name\"/></anchor></b> "; + print $main::GROUPS{$hostlist->name()}->{'name'}, "<br/>\n"; + } + + } + elsif( $format eq "standard" ) { + + # Go through each HostList + foreach $group ( $self->groups() ) { + print "<b> ",$main::GROUPS{$group->name()}->{'name'}, " </b><br/><br/>\n"; + $group->display_wml("standard"); + print "<br/>\n"; + } + } +} + + 1; -- 2.30.2