From bee0bb279f65a2d088d051cf8f0eaffbdf2e2f03 Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Wed, 29 Dec 1999 04:18:36 +0000 Subject: [PATCH] Support added for HistoryService field in class. display_html() modified to add HREF to display HistoryService for History instance. --- src/lib/Spong/History.pm | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/lib/Spong/History.pm b/src/lib/Spong/History.pm index 89deb77..9ed0566 100755 --- a/src/lib/Spong/History.pm +++ b/src/lib/Spong/History.pm @@ -11,6 +11,7 @@ # service - service name this history is associated with # color - color of the service at time history event was created # other - summary information about the history event +# service - service object that cause status change # # + new() - constructor (sets instance vars to arguments passed in) # + gets/sets() - magical set/get functions (autoloaded based on func name) @@ -21,11 +22,14 @@ package Spong::History; +use Spong::HistoryService; + # Constructor. A simple constructor that just sets all of the instance vars # according to what was passed in. All vars should be set on creation. sub new { - my( $class, $host, $type, $time, $service, $color, $other ) = @_; + my( $proto, $host, $type, $time, $service, $color, $other ) = @_; + my( $class ) = ref($proto) || $proto; my $self = {}; $self->{'host'} = $host; @@ -34,8 +38,9 @@ sub new { $self->{'service'} = $service; $self->{'color'} = $color; $self->{'other'} = $other; + $self->{'status'} = new Spong::HistoryService($host, $service, $time ); - bless $self; + bless ($self,$class); return $self; } @@ -54,6 +59,10 @@ sub color { my $var = 'color'; sub other { my $var = 'other'; if( defined $_[1] ) { $_[0]->{$var} = $_[1]; } return $_[0]->{$var}; } +# Simple Set method for the status object +sub status { + return $self->{'status'} +} # Display summary. Does both text and html, doesn't make any calls to # sub-objects or other helper objects, just spits out the data that it has. @@ -90,17 +99,25 @@ sub display_html { my $color = $self->color(); my $service = $self->service(); my $other = $self->other(); + my $time = $self->time(); $shost = (split( /\./, $self->host() ))[0] unless $shost; print ""; if( $main::WWW_USE_IMAGES == 1 ) { + print "host() + . "/$service/$time\">" if ($main::STATUS_HISTORY); print "$color"; + print "" if ($main::STATUS_HISTORY); } else { print ""; - print "
"; - print " 
"; + print ""; + print "host() + . "/$service/$time\">" if ($main::STATUS_HISTORY); + print "      "; + print "" if $main::STATUS_HISTORY; + print ""; } print ""; -- 2.30.2