]> git.etc.gen.nz Git - spong.git/commitdiff
xhtml and more cleanups
authorMichael Arndt <scriptkiller@gmx.de>
Tue, 15 Nov 2005 12:28:32 +0000 (12:28 +0000)
committerMichael Arndt <scriptkiller@gmx.de>
Tue, 15 Nov 2005 12:28:32 +0000 (12:28 +0000)
src/lib/Spong/AckList.pm
src/lib/Spong/History.pm
src/lib/Spong/HistoryList.pm
src/lib/Spong/HistoryService.pm
src/lib/Spong/Host.pm
src/lib/Spong/HostGroups.pm
src/lib/Spong/HostList.pm
src/lib/Spong/Service.pm
src/lib/Spong/ServiceList.pm

index 786e0947072910c78e55f853fc5548b225012ac7..0b5427c6eb365fe5a2a8f533f8b74a4826d7ee26 100755 (executable)
@@ -14,6 +14,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 30, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15)
 
 use Spong::Ack;
 
@@ -116,7 +117,7 @@ sub display {
       $_->display( $format, $view ); 
       
       if( $format eq "text" ) { print "\n"; }
-      if( $format eq "html" ) { print "<p>"; }
+      if( $format eq "html" ) { print "<br /><br />"; }
    }
 }
 
index 8e707c1e1712a89d707b8c977ee08683d09cc16c..7b70d1f9cbd66c2ce02edbcb883c1f484dc1dbdc 100755 (executable)
@@ -19,8 +19,9 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
-# $Id: History.pm,v 1.5 2000/12/15 21:01:10 sljohnson Exp $
+# $Id: History.pm,v 1.6 2005/11/15 12:28:32 scriptkiller Exp $
 
 package Spong::History;
 
@@ -109,33 +110,51 @@ sub display_html {
    $shost = $self->host() if $main::HISTORY_FQDN;
    $shost = (split( /\./, $self->host() ))[0] unless $shost;
 
-   print "<tr><td width=5% align=left valign=top>";
+   # this is used to format every second row
+   # to make it better readable
+   if($view eq "contrast") {
+       print " <tr class=\"spong_history_contrast\">\n";
+   }
+   else {
+       print " <tr class=\"spong_history\">\n";
+   }
+
+   print "  <td class=\"spong_history_image\">\n";
 
    if( $main::WWW_USE_IMAGES == 1 ) {
-      print "<a href=\"" . $main::WWWSPONG . "/histservice/".$self->host()
+      print "  <a href=\"" . $main::WWWSPONG . "/histservice/".$self->host()
          . "/$service/$time\">" if ($main::STATUS_HISTORY);
-      print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0>";
-      print "</a>" if ($main::STATUS_HISTORY);
+      print " <img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />";
+      print "</a>\n" if ($main::STATUS_HISTORY);
    } else {
-      print "<table width=20 border=0 cellspacing=0 cellpadding=0><tr>";
-      print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} . "\">"; 
-      print "<a href=\"" . $main::WWWSPONG . "/histservice/".$self->host()
-          . "/$service/$time\"><font color=\"" . $main::WWW_COLOR{$color}
-          . "\">" if ($main::STATUS_HISTORY);
-      print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
-      print "</a>" if $main::STATUS_HISTORY;
-      print "</td></tr></table>";
+      print "<table class=\"spong_history_noimage\">\n";
+      print " <tr class=\"spong_history_noimage\">\n";
+      print "  <td class=\"spong_background_$color\">\n"; 
+
+      if($main::STATUS_HISTORY) {
+         print "   <a href=\"" . $main::WWWSPONG . "/histservice/".$self->host()
+             ."/$service/$time\">\n";
+         print "   <span class=\"spong_color_$color\">\n";
+         print "   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
+         print "   </span>\n";
+         print "   </a>\n";
+      }
+
+      print "  </td>\n";
+      print " </tr>\n";
+      print "</table>\n";
    }
 
-   print "</td>\n";
-   print "<td width=5% align=center>";
+   print "  </td>\n";
+   print "  <td class=\"spong_history_type\">";
    my($type) = substr($self->type,0,1); $type =~ tr/a-z/A-Z/;
    print "$type</td>\n";
-   print "<td width=10% align=center valign=top>";
-   printf ( "%2.2d:%2.2d</td>", $hour, $min );
-   print "<td width=15% align=left valign=top>$shost </td>\n";
-   print "<td width=15% align=left valign=top>$service</td>\n";
-   print "<td width=51% align=left valign=top>$other</td></tr>\n";
+   print "  <td class=\"spong_history_time\">";
+   printf ( "%2.2d:%2.2d</td>\n", $hour, $min );
+   print "  <td class=\"spong_history_host\">$shost </td>\n";
+   print "  <td class=\"spong_history_service\">$service</td>\n";
+   print "  <td class=\"spong_history_other\">$other</td>\n";
+   print " </tr>\n";
 }
 
 1;
index c4212393370cbcd6e6a62594b2b58be9fcbbc40e..708b9ba5f5647c07a1920c75594fc2b6b7db53a3 100755 (executable)
@@ -16,6 +16,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
 use Spong::History;
 
@@ -135,6 +136,9 @@ sub display_html {
    my( $event, $date );
    my( $day ) = 24*60*60;
 
+   # used to add contrast to every 2nd row in html output
+   my ( $i, $contrast ) = (0, 0);
+
    sub bytime { return $b->time() <=> $a->time(); }
 
    foreach $event ( sort bytime $self->events() ) {
@@ -144,13 +148,28 @@ sub display_html {
 
         my $dstr = POSIX::strftime( "%A, $main::DATEFMT", localtime($event->time()) );
         if( $dstr ne $date ) { 
-           if( $date ne "" ) { print "</table><br>"; }
-           print "$dstr\n<hr border=1 noshade>\n";
-           print "<table width=100% border=0 cellspacing=1 cellpadding=0>\n";
+           if( $date ne "" ) { print "</table>\n<br />\n"; }
+           print "<div class=\"spong_historylist_date\">$dstr</div>\n";
+
+           # TODO: leave <br /> instead of <hr /> here?
+           # print "<hr class=\"spong_historylist\" />\n";
+
+           print "<br />\n";
+           print "<table class=\"spong_historylist\">\n";
            $date = $dstr; 
         }
 
-        $event->display_html();
+        # format every second row with style-attribute "contrast"
+        # so the table will be much better readable (-> History.pm)
+        if($i % 2) {
+            $contrast="";
+        }
+        else {
+            $contrast="contrast";
+        }
+
+        $event->display_html($contrast);
+        $i++;
       }
    }
    print "</table>\n";
index 3b910a9feae3be4d9e91ec7a253ef1fc3ca64fc5..3c49d4545a271dd8c71fdc1be3fcb0833790c58a 100755 (executable)
@@ -7,6 +7,7 @@
 
 # History
 # (1) Created (Dec 27, 1999  Stephen L Johnson)
+# (2) XHTML (Michael Arndt, 2005/11/15)
 
 package Spong::HistoryService;
 
@@ -55,7 +56,6 @@ sub filename {
 }
 
 # Overridden html display function
-
 sub display_html {
    my( $self, $format ) = @_;
    my $host  = $self->host;
@@ -68,32 +68,48 @@ sub display_html {
       print "<a href=\"!!WWWSPONG!!/service/$host/$name\">\n";
 
       if( $main::WWW_USE_IMAGES == 1 ) {
-        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0>";
+        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />";
       } else {
-        print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-        print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} ;
-        print "\"><font color=\"" . $main::WWW_COLOR{$color} . "\">";
-        print "___</font></td></tr></table>\n";
+         print "<table class=\"nospacing\">\n";
+         print " <tr>\n";
+         print "  <td class=\"spong_background_$color\">\n";
+         print "   <span class=\"spong_text_$color\">";
+         print "___</span>\n";
+         print "  </td>\n";
+         print " </tr>\n";
+         print "</table>\n";
       }
       print "</a>";
    } elsif( $format eq "standard_table" ) {
-      print "<tr><td align=left valign=top nowrap>\n"; 
-      print "<a href=\"!!WWWSPONG!!/service/$host/$name\">$name</a></td>\n";
-      print "<td align=center valign=top>\n"; 
+
+       # TODO: restore removed styles in <td> etc. ...
+       # print "<table class=\"spong_historyservice\">\n";
+       print " <tr>\n";
+       print "  <td>\n"; 
+       print "   <a href=\"!!WWWSPONG!!/service/$host/$name\">$name</a>\n";
+       print "  </td>\n";
+       print "  <td>\n"; 
 
       if( $main::WWW_USE_IMAGES == 1 ) {
         print "<a href=\"!!WWWSPONG!!/service/$host/$name\">\n";
-        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0></a>";
+        print " <img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />\n";
+        print "</a>\n";
       } else {
-        print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-        print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} . "\">";
-        print "<a href=\"!!WWWSPONG!!/service/$host/$name\">";
-        print "<font color=\"" . $main::WWW_COLOR{$color} . "\">___</font>";
-        print "</a></td></tr></table>\n";
+
+          print "<table class=\"nospacing\">\n";
+          print " <tr>\n";
+          print "  <td class=\"spong_background_$color\">\n";
+         print "   <a href=\"!!WWWSPONG!!/service/$host/$name\">";
+          print "   <span class=\"spong_text_$color\">";
+          print "___</span>\n";
+         print "   </a>\n";
+          print "  </td>\n";
+          print " </tr>\n";
+          # print "</table>\n";
       }
 
-      print "</td>\n"; 
-      print "<td align=center valign=top nowrap>";
+      print "  </td>\n"; 
+      print "  <td>";
 
       if( $d1 == $d2 && $m1 == $m2 && $y1 == $y2 ) {
         print POSIX::strftime( "%H:%M", localtime($self->rtime()) ), "  ";
@@ -101,31 +117,43 @@ sub display_html {
         print POSIX::strftime( "%D", localtime($self->rtime()) ), "  ";
       }
 
-      print "</td>\n";
-      print "<td align=left valign=top>", $self->summary(), "</td></tr>\n";
+       print "  </td>\n";
+       print "  <td>", $self->summary(), "</td>\n";
+       print " </tr>\n";
+       print "</table>\n";
+
    } elsif( $format eq "standard" ) {
-      print "<table width=100% border=1 cellspacing=2 cellpadding=2><tr>\n";
-      print "<td width=60 align=center><b>Service</b></td>\n";
-      print "<td width=1%>&nbsp</td>\n";
-      print "<td width=60 align=center><b>Updated</b></td>\n";
-      print "<td width=100% align=center><b>Summary</b></td></tr>\n";
+
+      # TODO: where's that stuff coming from??
+      print "<table width=\"100%\" border=\"1\" cellspacing=\"2\" cellpadding=\"2\"><tr>\n";
+      print "<td width=\"60\" align=\"center\"><b>Service</b></td>\n";
+      print "<td width=\"1%\">&nbsp;</td>\n";
+      print "<td width=\"60\" align=\"center\"><b>Updated</b></td>\n";
+      print "<td width=\"100%\" align=\"center\"><b>Summary</b></td></tr>\n";
 
       $self->display_html( "standard_table" );
 
       print "</table>\n";
+
    } elsif( $format eq "full" ) {
-      print "<font size=+2><b>", $self->host(), "/", $self->name();
-      print "</b></font>\n";
 
-      print "<table width=100% cellspacing=0 cellpadding=0 border=0>";
-      print "<tr><td bgcolor=\"" . $main::WWW_COLOR{$color} . "\">&nbsp;</td>";
-      print "</tr></table><p>";
+      print "<h2>", $self->host(), "/", $self->name();
+      print "</h2>\n";
+
+      print "<table class=\"spong_historyservice\">\n";
+      print " <tr class=\"spong_historyservice\">\n";
+      print "  <td class=\"spong_background_$color\">&nbsp;</td>\n";
+      print " </tr>\n";
+      print "</table>\n";
+      print "<br />\n";
 
-      print "<b>Date:</b> ";
+      print "<span class=\"form_property\">Date:</span> ";
       print POSIX::strftime( "%H:%M, %D", localtime($self->rtime()) );
 
-      print "<br><b>Summary:</b> ", $self->summary(), "<br>\n";
-      print "<hr noshade><pre>", $self->message(), "</pre>\n";
+      print "<br />\n";
+      print "<span class=\"form_property\">Summary:</span> ", $self->summary(), "<br />\n";
+      print "<hr class=\"spong_historyservice\" />\n";
+      print "<pre>", $self->message(), "</pre>\n";
    }
 }
 
index 123c4af89351ec4aeb32e0511853b74df50dc6d2..c82f7a5914a203709dc1e631f77f67aa98414759 100755 (executable)
@@ -27,6 +27,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
 use Spong::AckList;
 use Spong::Ack;
@@ -223,48 +224,70 @@ sub display_html {
    if( $format eq "brief" ) {
       my $color = $self->color();
 
-      print "<a href=\"!!WWWSPONG!!/host/$name\">\n";
+      print "<a href=\"!!WWWSPONG!!/host/$name\" ".
+         "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">\n";
 
       if( $main::WWW_USE_IMAGES == 1 ) {
-        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0>";
+        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />";
       } else {
-        print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-        print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} ;
-        print "\"><font color=\"" . $main::WWW_COLOR{$color} . "\">";
-        print "___</font></td></tr></table>\n";
+         print "<table class=\"nospacing\">\n";
+         print " <tr>\n";
+         print "  <td class=\"spong_background_$color\">\n";
+         print "   <span class=\"spong_text_$color\">";
+         print "___</span>\n";
+         print "  </td>\n";
+         print " </tr>\n";
+         print "</table>\n";
       }
       print "</a>";
    } elsif( $format eq "standard" || $format eq "full" ) {
-      print "<font size=+2><b>$name</b></font>\n";
 
-      # This breaks the generic interactive vs non-interactive model
-      $self->add_action_bar();
-
-      my $color = $self->color();
-
-      print "<table width=100% cellspacing=0 cellpadding=0 border=0>";
-      print "<tr><td bgcolor=\"" . $main::WWW_COLOR{$color} . "\">&nbsp;</td>";
-      print "</tr></table><p>";
-
-      my $acklist = $self->acks();
-      if( $acklist ) {
-        print "<font size=+1><b>Acknowledgments</b></font><br><hr>\n";
-        $acklist->display( "html", $format ); }
-
-      my $servicelist = $self->services();
-      if( $servicelist ) {
-        print "<p><font size=+1><b>Services</b></font><br><hr>\n";
-        $servicelist->display( "html", $format ); }
-      
-      my $info = Spong::Info->new( $self->name() );
-      if( $info ) {
-        print "<p><font size=+1><b>Information</b></font><br><hr>\n";
-        $info->display( "html", $format ); }
-
-      my $historylist = $self->history();
-      if( $historylist ) {
-        print "<p><font size=+1><b>History</b></font><br><hr>\n";
-        $historylist->display( "html", $format ); }
+       print "<h2>$name</h2>\n";
+       
+       # This breaks the generic interactive vs non-interactive model
+       $self->add_action_bar();
+       
+       my $color = $self->color();
+       
+       print "\n";
+       print "<table class=\"spong_host_colorbar\">\n";
+       print " <tr class=\"spong_host_colorbar\">\n";
+       print "  <td class=\"spong_background_$color\">&nbsp;</td>\n";
+       print " </tr>\n";
+       print "</table>\n\n";
+       
+       
+       my $acklist = $self->acks();
+       if( $acklist ) {
+          print "<h3>Acknowledgments</h3>\n";
+          print "<hr class=\"spong_host_sub\" />\n";
+          $acklist->display( "html", $format );
+          print "<br />\n";
+       }
+       
+       my $servicelist = $self->services();
+       if( $servicelist ) {
+          print "<h3>Services</h3>\n";
+          print "<hr class=\"spong_host_sub\" />\n";
+          $servicelist->display( "html", $format );
+          print "<br />\n";
+       }
+       
+       my $info = Spong::Info->new( $self->name() );
+       if( $info ) {
+          print "<h3>Information</h3>\n";
+          print "<hr class=\"spong_host_sub\" />\n";
+          $info->display( "html", $format );
+          print "<br />\n";
+       }
+       
+       my $historylist = $self->history();
+       if( $historylist ) {
+          print "<h3>Weekly History</h3>\n";
+          print "<hr class=\"spong_host_sub\" />\n";
+          $historylist->display( "html", $format );
+          print "<br />\n";
+       }
    }
 }
 
@@ -308,36 +331,43 @@ sub display_problem_html {
    my $color   = $self->color();
    my $name    = $self->name();
    my $message = &escape( "Host: $name, " . $self->_problem_message() );
-   my $spacer  = "&nbsp &nbsp &nbsp ";
+   my $spacer  = "&nbsp; &nbsp; &nbsp; ";
    my( $prob, $summ, $time ) = $self->_problem_service();
 
    if( $main::WWW_USE_IMAGES == 1 ) {
-      print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0>";
-      print "<b><a href=\"!!WWWSPONG!!/host/$name\">$name</a></b><br> ";
+      print "<img src=\"!!WWWGIFS!!/$color.gif\" name=\"$color\" /> &nbsp;";
+      print "<a class=\"spong_host_problem_host\" href=\"!!WWWSPONG!!/host/$name\" ".
+         "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">$name</a><br />\n";
    } else {
-      print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-      print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} ;
-      print "\">&nbsp;</td><td>&nbsp;";
-      print "<b><a href=\"!!WWWSPONG!!/host/$name\">$name</a></b>";
-      print "</td></tr></table>\n";
+      print "<table class=\"spong_host_problems\">\n";
+      print " <tr>\n";
+# does not look very nice:
+#      print "  <td class=\"spong_background_$color\">&nbsp;</td>\n";
+      print "  <td class=\"spong_host_problems\">&nbsp;";
+      print "   <a href=\"!!WWWSPONG!!/host/$name\" ".
+         "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">$name</a>\n";
+      print "  </td>\n";
+      print " </tr>\n";
+      print "</table>\n";
    }
    
-   if( $prob eq "multiple problems" ) {
-      print "$spacer problem: $prob<br>\n";
+   if( $prob eq "multiple" ) {
+       print "$spacer problem: $prob<br />\n";
    } else {
-      print "$spacer problem: <a href=\"!!WWWSPONG!!/service/$name/";
-      print "$prob\">$prob</a><br>";
+       print "$spacer problem: <a href=\"!!WWWSPONG!!/service/$name/";
+       print "$prob\" target=\"$main::WWW_MAIN_DISPLAY_FRAME\">$prob</a><br />";
    }
    
-   # if( $summ ) { print "$spacer summary: $summ<br>\n"; }
+   # if( $summ ) { print "$spacer summary: $summ<br />\n"; }
    if( $time ) { 
       print "$spacer updated: ";
-      print POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($time) ), "<br>\n";
+      print POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($time) ), "<br />\n";
    }
    
    if ( $main::WWWCONTACT ) {
       print "$spacer contact: ";
-      print "<a href=\"$main::WWWCONTACT?host=$name&message=$message\">";
+      print "<a href=\"$main::WWWCONTACT?host=$name&message=$message\" ".
+         "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">";
       print "$human</a>\n";
    }
 
@@ -347,12 +377,12 @@ sub display_problem_html {
          &main::error("add_action_bar: $@");
          &main::error($main::WWW_PROB_ACTIONBAR);
       } else {
-         print "$spacer $text<br>\n";
+         print "$spacer $text<br />\n";
       }
    }
 
 
-   print "<p>\n"; 
+   print "<br />\n"; 
 }
 
 
@@ -379,7 +409,7 @@ sub _problem_service {
    } elsif( $#problist == 0 ) {
       return( $problist[0], $summary, $probtime );
    } else {
-      return( "multiple problems", "", $probtime );
+      return( "multiple", "", $probtime );
    }
 }
 
@@ -419,13 +449,19 @@ sub add_action_bar {
    my $name = $self->name();
    my $message = &escape( "Host: $name, " . $self->_problem_message() );
 
-   print "<hr>";
-   print "<a href=\"telnet://$name\">Connect</a> || ";
-   print "<a href=\"$main::WWWACK/$name\">Acknowledge Problem</a> ";
+
+# TODO: config option to remove "WWWACK"-link
+#
+   print "<hr />\n";
+# nobody uses telnet anymore, consider removing this completely:
+#   print "<a href=\"telnet://$name\">Connect</a> || ";
+   print "<a href=\"$main::WWWACK/$name\" ".
+   "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">Acknowledge Problem</a> ";
 
    if( $main::WWWCONTACT ) {
-      print "|| <a href=\"$main::WWWCONTACT?host=$name&message=$message\">";
-      print "Contact Help</a>"; 
+      print "|| <a href=\"$main::WWWCONTACT?host=$name&message=$message\" ".
+         "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">";
+      print "Contact Help</a>\n"; 
    }
    
    if ($main::WWW_ACTIONBAR_CUSTOM) {
@@ -438,7 +474,7 @@ sub add_action_bar {
       }
    }
 
-   print "<hr>\n";
+   print "<hr />\n";
 }
 
 sub escape {
index 9a1b36c2813bddf4d8d5ac0ebd2adbdc0b7a9d3a..ef1121c4d169b5c56ce1eee4f1e6e07990c30c65 100755 (executable)
 # + groups        - used to get back a generic list of groups that are stored
 # + add           - adds a specific host group to the instance
 #
+# History:
+# (1) XHTML (Michael Arndt, 2005/11/15)
 
-# $Id: HostGroups.pm,v 1.11 2001/01/10 16:29:41 sljohnson Exp $
+# $Id: HostGroups.pm,v 1.12 2005/11/15 12:28:32 scriptkiller Exp $
 
 use Spong::Host;
 use Spong::HostList;
@@ -283,12 +285,11 @@ sub display_html {
 
       # 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";
+      print "<table class=\"spong_hostgroups\">\n";
+      print " <tr class=\"spong_hostgroups\">\n";
+      print "   <td class=\"spong_hostgroups\">Host Group</td>\n";
+      print "   <td class=\"spong_hostgroups\">Status</td>\n";
+      print " </tr>\n";
  
       # Now for each group, go through and find out overall status of that
       # host.   
@@ -297,8 +298,8 @@ sub display_html {
          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";
+         print " <tr class=\"spong_hostgroups\">\n";
+         print "  <th class=\"spong_hostgroups\"><a href=\"!!WWWSPONG!!/group/$name\" target=\"_top\">$grname</a></th>\n";
    
          my ($color);
          foreach $service ( @names ) {
@@ -308,34 +309,23 @@ sub display_html {
 
          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 "";
+               print "  <td class=\"spong_hostgroups\">\n";
+               my $alt = "";
+               print "   <img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$alt\" />&nbps;";
+
             } else {
-               print "    <td align=center bgcolor=\"";
-               print $main::WWW_COLOR{$color} . "\" width=25>";
-               print "<font color=\"" . $main::WWW_COLOR{$color} . "\">";
-               print "___</font>";
+               print "  <td class=\"spong_hostgroups\">\n";
+               print "   <span class=\"spong_text_$color\">___</span>\n";
             }
-            print "</td>\n";
+            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";
+               print "  <td class=\"spong_hostgroups\"> - </td>\n";
             } else {
-               print "    <td align=center width=25";
-               print " bgcolor=" . $main::WWW_CELL_COLOR
-                   if $main::WWW_CELL_COLOR;
-               print ">&nbsp;</td>\n";
+               print "  <td class=\"spong_hostgroups\">&nbsp;</td>\n";
             }
          }
-         print "  </tr>\n";
+         print " </tr>\n";
       }
       print "</table>\n";
          
@@ -351,17 +341,17 @@ sub display_html {
       
       # Print the horizontal axis of the table (names of the services)
       
-      print "<table border=1 cellspacing=0 cellpadding=1";
-      print " bgcolor=" . $main::WWW_TITLE_COLOR if $main::WWW_TITLE_COLOR;
-      print "><tr>";
-      print "<td align=center width=80 nowrap><b>Host Group</b></td>\n";
+      print "<table class=\"spong_hostgroups\">\n";
+      print " <tr class=\"spong_hostgroups\">\n";
+      print "  <th class=\"spong_hostgroups_left\">Host Group</th>\n";
       foreach $service ( @names ) { 
-        print "<td align=center valign=bottom width=25>\n";
-        print "<font size=-1><a href=\"!!WWWSPONG!!/help/$service\">";
-        print "$service</a></font></td>\n"; 
+        print "  <th class=\"spong_hostgroups_service\">\n";
+        print "   <a href=\"!!WWWSPONG!!/help/$service\" title=\"Help\">";
+        print "$service</a>\n";
+        print "  </th>\n"; 
       }
       
-      print "</tr>\n\n";
+      print " </tr>\n\n";
       
       # Now go through each host group, and fill in the table.
       
@@ -369,44 +359,37 @@ sub display_html {
          my $name = $group->name();
          my $grname = $main::GROUPS{$name}->{'name'};
         
-        print "<tr><td align=left bgcolor=#ffffff nowrap>\n";
-        print "<a href=\"!!WWWSPONG!!/group/$name\" target=\"view\">$grname</a></td>\n";
+        print " <tr class=\"spong_hostgroups\">\n";
+        print "  <td class=\"spong_hostgroups_left\">\n";
+        print "   <a href=\"!!WWWSPONG!!/group/$name\" target=\"_top\">$grname</a>\n";
+        print "  </td>\n";
         
         foreach $service ( @names ) {
             my $color = $group->services_color( $service );
 
            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 "";
+                 print "  <td class=\"spong_hostgroups_service\">\n";
+                 print "   <img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />\n";
               } else {
-                 print "<td align=center bgcolor=\"";
-                 print $main::WWW_COLOR{$color} . "\" width=25>";
-                 print "<font color=\"" . $main::WWW_COLOR{$color} . "\">";
-                 print "___</font>";
+                 print "  <td class=\"spong_background_$color\">\n";
+                 print "   <span class=\"spong_text_$color\">";
+                 print "___</span>\n";
               }
-              print "</td>";
+              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"; 
+               if( $main::WWW_USE_IMAGES == 1 ) {
+                  print "  <td class=\"spong_hostgroups_service\"> - </td>\n";
               } else {
-                 print "<td align=center width=25";
-                  print " bgcolor=" . $main::WWW_CELL_COLOR
-                      if $main::WWW_CELL_COLOR;
-                  print ">&nbsp;</td>\n";
+                  print "  <td class=\"spong_hostgroups_service\">&nbsp;</td>\n";
               }
            }
         }
+
+        print " </tr>\n";
+
       }        
-      print "</tr></table>";
+      print "</table>\n";
 
    } elsif( $format eq "full" ) {
 
@@ -424,11 +407,11 @@ sub display_html {
 
          # Display the host group table
 #         print "<a href=\"$main::WWWSPONG/group/$name\">";
-         print "<strong>Group - $grname</strong>";
+         print "\n<div class=\"spong_hostgroups_groupname\">Group - $grname</div><br />\n";
 #         print "</a>\n";
          $group->display_html("standard");
        
-         print "\n<HR>\n";
+         print "\n<hr />\n";
       }
    }
 }
@@ -469,33 +452,53 @@ sub display_problems {
    if ( $problems ) {
       foreach my $group ( $badgroups->groups() ) {
          my $name = $main::GROUPS{$group->name()}->{'name'};
-         print "<b>" 
-            if $type eq "html";
-         print "<strong>Group: $name</strong>\n";
-         print "</b><p>"                   if $type eq "html";
+         print "<div class=\"spong_hostgroups_problems_groupname\">Group: $name</div>\n";
+         print "<p>\n"                   if $type eq "html";
          $group->display( $type, $format );
-         print "<hr align=left width=25%>\n";
+        print "</p>\n";
+         print "<hr class=\"spong_hostgroups_problems\" />\n";
       }
    } else {
       if( $format eq "full" ) {
-         if( $purple ) {
-            print "<p><font color=green><b>"       if( $type eq "html" );
-            print "No known problems.\n";
-            print "</b></font>"                    if( $type eq "html" );
-            print "<p><font size=-1 color=purple>" if( $type eq "html" );
-            print "Although some information is out of date which might ";
-            print "indicate a problem.\n";
-            print "</font>"                        if( $type eq "html" );
-         } else {
-            print "<p><font color=green><b>"       if( $type eq "html" );
-            print "No current problems.\n";
-            print "</b></font>"                    if( $type eq "html" );
-         }
+         output_problems($purple, $type);       
       }
    }
 
 }
 
+sub output_problems {
+    my $purple=shift;
+    my $type=shift;
+
+    if( $purple ) {
+       print "<p class=\"spong_hostgroups_no_problems\">\n"
+           if( $type eq "html" );
+       
+       print "No known problems.\n";
+       
+       print "</p>\n"
+           if( $type eq "html" );
+       print "<p class=\"spong_hostgroups_outdated\">"
+           if( $type eq "html" );
+       
+       print "Although some information is out of date which might ";
+       print "indicate a problem.\n";
+       
+       print "</p>\n"
+           if( $type eq "html" );
+
+    }
+    else {
+       print "<p class=\"spong_hostgroups_no_problems\">"
+           if( $type eq "html" );
+       
+       print "No current problems.\n";
+       
+       print "</p>\n"
+           if( $type eq "html" );
+    }
+
+}
 
 # This displays a summary of all the hosts in this list in an WML format
 # suitable for displaying on WAP enabled devices
index 6dba8840f97ef52a241079dc3fda2690ecc57d5e..e446d54c84d630a0d127b4bf50135f58ffb2b38f 100755 (executable)
@@ -20,6 +20,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
 use Spong::Host;
 
@@ -93,7 +94,6 @@ sub byname {
 }
 
 
-
 # Get/Set methods, hostnames() is a little fancy in that it return a list
 # rather then just the list reference (easier for others to deal with).  The
 # hosthash function returns a reference however.
@@ -107,6 +107,7 @@ sub hostnames { my $var = 'hostnames';
 sub sorted_hostnames { my $var = 'sorted_hostnames';
    if( defined $_[1] ) { $_[0]->{$var} = $_[1]; } return @{$_[0]->{$var}}; }
 
+
 # Some specific functions that get at and manipulate the data in the instance
 # vars in more convenient ways
 
@@ -121,7 +122,7 @@ sub hosts {
    return @tmp;
 }
 
-sub sorted_hosts { 
+sub sorted_hosts {
    my $self = shift;
    my( @tmp );
 
@@ -129,6 +130,7 @@ sub sorted_hosts {
    return @tmp;
 }
 
+
 sub add {
    my( $self, $host ) = @_;
    my $name = $host->name();
@@ -137,6 +139,8 @@ sub add {
    push( @{$self->{'hostnames'}}, $name );
    push( @{ $self->{'sorted_hostnames'} }, $name);
    $self->{'sorted_hostnames'} = [ sort byname @{ $self->{'sorted_hostnames'} } ];
+
+
 }
 
 # Calculate summary color for a service
@@ -226,7 +230,7 @@ sub display_text {
 
       # Now go through each host, and fill in the table.
 
-      foreach $host ( $self->hosts() ) {
+      foreach $host ( $self->sorted_hosts() ) {
         print substr( $host->name(), 0, 29 );
         print " "x(30-length(substr($host->name(), 0, 29)));
         foreach $service ( @names ) {
@@ -247,7 +251,7 @@ sub display_text {
       # of the problem services, date/time the problem occurred, and contact
       # information (as well as acknowledgments if they are available).
 
-      foreach $host ( $self->hosts() ) {
+      foreach $host ( $self->sorted_hosts() ) {
         $host->display_problem( "text" ); print "\n";
       }
    } elsif( $format eq "brief" ) {
@@ -256,7 +260,7 @@ sub display_text {
       # line of the current status of the host. The consists of the overall
       # status color and the host name.
 
-      foreach $host ( $self->hosts() ) {
+      foreach $host ( $self->sorted_hosts() ) {
          printf "%-6s %s\n",$host->color(),$host->name();
       }
 
@@ -269,6 +273,32 @@ sub display_text {
 sub display_html { 
    my( $self, $format ) = @_;
 
+   # output only the names of the hosts,
+   # no other information like services etc.
+   if($format eq "names_only" ) {
+
+       my $host;
+
+       print "<table class=\"spong_host_names_only\">\n";
+       foreach $host ( $self->hosts() ) { 
+          my $hostname = $host->name(); 
+          # Use display-name attrib if defined
+          my $display = $main::HOSTS{$hostname}->{'display_name'};
+          if ( ! $display ) {
+              # Otherwise use the hostname if $WWW_FQDN or short name
+              $display = $main::WWW_FQDN ? $hostname :
+                  (split( /\./, $hostname ))[0];
+          }
+          print " <tr class=\"spong_host_names_only\">\n";
+          print "  <td class=\"spong_host_names_only\">\n";
+          print "   <a href=\"!!WWWSPONG!!/host/$hostname\"".
+              "target=\"$main::WWW_MAIN_DISPLAY_FRAME\">$display</a>\n";
+          print "  </td>\n";
+          print " </tr>\n";
+       }
+       print "</table>\n";
+   }
+
    if( $format eq "standard" ) {
       my( %services, $host, $service, @names );
 
@@ -290,20 +320,20 @@ sub display_html {
       if( grep( /^ping$/, (@s) ) ) { push( @names, "ping" ); }
       foreach $service ( sort (@s) ) {
         push( @names, $service ) unless $service eq "ping"; }
+
       
       # Print the horizontal axis of the table (names of the services)
-      
-      print "<table border=1 cellspacing=0 cellpadding=1";
-      print " bgcolor=" . $main::WWW_TITLE_COLOR if $main::WWW_TITLE_COLOR;
-      print "><tr>";
-      print "<td align=center width=80 nowrap><b>Host</b></td>\n";
+      print "<table class=\"spong_host\">\n";
+      print " <tr class=\"spong_host\">\n";
+      print "  <th class=\"spong_host\">Host</th>\n";
       foreach $service ( @names ) { 
-        print "<td align=center valign=bottom width=25>\n";
-        print "<font size=-1><a href=\"!!WWWSPONG!!/help/$service\">";
-        print "$service</a></font></td>\n"; 
+        print "  <th class=\"spong_host_service\">\n";
+        print "   <a href=\"!!WWWSPONG!!/help/$service\">$service</a>\n";
+        print "  </th>\n";
       }
       
-      print "</tr>\n\n";
+      print " </tr>\n\n";
       
       # Now go through each host, and fill in the table.
       
@@ -316,8 +346,10 @@ sub display_html {
             $display = $main::WWW_FQDN ? $hostname :
                                (split( /\./, $hostname ))[0];
          }
-        print "<tr><td align=left bgcolor=#ffffff nowrap>\n";
-        print "<a href=\"!!WWWSPONG!!/host/$hostname\">$display</a></td>\n";
+        print " <tr class=\"spong_host\">\n";
+        print "  <td class=\"spong_host\">\n";
+        print "   <a href=\"!!WWWSPONG!!/host/$hostname\">$display</a>\n";
+        print "  </td>\n";
         
         foreach $service ( @names ) {
            my $servobj = $host->service( $service );
@@ -326,38 +358,36 @@ sub display_html {
               my $col = $servobj->color();
               
               if( $main::WWW_USE_IMAGES == 1 ) {
-                 print "<td align=center";
-                  print " bgcolor=" . $main::WWW_CELL_COLOR 
-                     if $main::WWW_CELL_COLOR;
-                  print "><a href=\"!!WWWSPONG!!/service/";
-                 print "$hostname/$service\">";
-                  my $alt = $servobj->summary();
-                 print "<img src=\"!!WWWGIFS!!/$col.gif\" alt=\"$alt\" border=0>";
-                 print "</a>";
+                  print "  <td class=\"spong_host_service\">\n";
+                  print "   <a href=\"!!WWWSPONG!!/service/$hostname/$service\">";
+                  my $alt = $servobj->summary();
+                  print "<img src=\"!!WWWGIFS!!/$col.gif\" alt=\"$alt\" title=\"$alt\" />";
+                  print "   </a>\n";
               } else {
-                 print "<td align=center bgcolor=\"";
-                 print $main::WWW_COLOR{$col} . "\" width=25>";
-                 print "<a href=\"!!WWWSPONG!!/service/$hostname/$service\">";
-                 print "<font color=\"" . $main::WWW_COLOR{$col} . "\">";
-                 print "___</font></a>";
+                  print "  <td class=\"spong_background_$col\">\n";
+                  print "   <a href=\"!!WWWSPONG!!/service/$hostname/$service\">";
+                  print "    <span class=\"spong_text_$col\">";
+                  print "___";
+                  print "    </span>\n";
+                  print "   </a>\n";
               }
-              print "</td>";
+              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"; 
+                  print "  <td class=\"spong_host_service\">";
+                  print " - </td>\n"; 
               } else {
-                 print "<td align=center width=25";
-                  print " bgcolor=" . $main::WWW_CELL_COLOR
-                      if $main::WWW_CELL_COLOR;
-                  print ">&nbsp;</td>\n";
+                  print "  <td class=\"spong_host_service\">";
+                  print "&nbsp;</td>\n";
               }
            }
         }
-      }        
-      print "</tr></table>";
+
+        print " </tr>\n";
+
+     }
+
+      print "</table>\n";
 
    } elsif( $format eq "full" ) {
 
@@ -372,6 +402,7 @@ sub display_html {
    }
 }
 
+
 # These methods all display summary information about only those machines
 # that are currently registering a problem, or that have services that have
 # not been updated (showing purple) - it also relays information about 
@@ -398,21 +429,10 @@ sub display_problems {
    if( $problem ) {
       $badhosts->display( $type, $view );
    } else {      
-      if( $view eq "full" ) {
-        if( $purple ) { 
-           print "<p><font color=green><b>"       if( $type eq "html" );
-           print "No known problems.\n";
-           print "</b></font>"                    if( $type eq "html" );
-           print "<p><font size=-1 color=purple>" if( $type eq "html" );
-           print "Although some information is out of date which might ";
-           print "indicate a problem.\n";
-           print "</font>"                        if( $type eq "html" );
-        } else {
-           print "<p><font color=green><b>"       if( $type eq "html" );
-           print "No current problems.\n";
-           print "</b></font>"                    if( $type eq "html" );
+
+       if( $view eq "full" ) {
+          Spong::HostGroups::output_problems($purple, $type);
         }
-      }
    }
 }
 
index 3fd5951ceac28d0d740bb7b0fb4f35f0a4992aa3..988182e3342effef7dd659f1455b28f6136fc4d5 100755 (executable)
@@ -22,6 +22,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
 package Spong::Service;
 
@@ -256,32 +257,44 @@ sub display_html {
       print "<a href=\"!!WWWSPONG!!/service/$host/$name\">\n";
 
       if( $main::WWW_USE_IMAGES == 1 ) {
-        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0>";
+        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" />\n";
       } else {
-        print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-        print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} ;
-        print "\"><font color=\"" . $main::WWW_COLOR{$color} . "\">";
-        print "___</font></td></tr></table>\n";
+          print "<table class=\"nospacing\">\n";
+          print "<tr>\n";
+          print "  <td class=\"spong_background_$color\">\n";
+          print "   <span class=\"spong_text_$color\">";
+          print "___</span>\n";
+          print "  </td>\n";
+          print " </tr>\n";
+          print "</table>\n";
       }
       print "</a>";
    } elsif( $format eq "standard_table" ) {
-      print "<tr><td align=left valign=top nowrap>\n"; 
-      print "<a href=\"!!WWWSPONG!!/service/$host/$name\">$name</a></td>\n";
-      print "<td align=center valign=top>\n"; 
+      print " <tr class=\"spong_service\">\n";
+      print "  <td class=\"spong_service\">\n";
+      print "   <a href=\"!!WWWSPONG!!/service/$host/$name\">$name</a>\n";
+      print "  </td>\n";
+
+      print "  <td class=\"spong_service_image\">\n"; 
 
       if( $main::WWW_USE_IMAGES == 1 ) {
-        print "<a href=\"!!WWWSPONG!!/service/$host/$name\">\n";
-        print "<img src=\"!!WWWGIFS!!/$color.gif\" alt=$color border=0></a>";
+        print "   <a href=\"!!WWWSPONG!!/service/$host/$name\">\n";
+        print "    <img src=\"!!WWWGIFS!!/$color.gif\" alt=\"$color\" /></a>\n";
       } else {
-        print "<table border=0 cellspacing=0 cellpadding=0><tr>";
-        print "<td width=20 bgcolor=\"" . $main::WWW_COLOR{$color} . "\">";
-        print "<a href=\"!!WWWSPONG!!/service/$host/$name\">";
-        print "<font color=\"" . $main::WWW_COLOR{$color} . "\">___</font>";
-        print "</a></td></tr></table>\n";
+
+          print "<table class=\"nospacing\">\n";
+          print " <tr>\n";
+          print "  <td class=\"spong_background_$color\">\n";
+          print "   <span class=\"spong_text_$color\">";
+          print "___</span>\n";
+          print "  </td>\n";
+          print " </tr>\n";
+          print "</table>\n";
+
       }
 
-      print "</td>\n"; 
-      print "<td align=center valign=top nowrap>";
+      print "  </td>\n"; 
+      print "  <td class=\"spong_service\">\n";
 
       if( $d1 == $d2 && $m1 == $m2 && $y1 == $y2 ) {
         print POSIX::strftime( $main::TIMEFMTNOSEC, localtime($self->rtime()) ), "  ";
@@ -289,8 +302,9 @@ sub display_html {
         print POSIX::strftime( $main::DATEFMT, localtime($self->rtime()) ), "  ";
       }
 
-      print "</td>\n";
-      print "<td align=left valign=top>", $self->summary(), "</td></tr>\n";
+      print "  </td>\n";
+      print "  <td class=\"spong_service\">", $self->summary(), "</td>\n";
+      print " </tr>\n";
    } elsif( $format eq "standard" ) {
       print "<table width=100% border=1 cellspacing=2 cellpadding=2><tr>\n";
       print "<td width=60 align=center><b>Service</b></td>\n";
@@ -302,24 +316,30 @@ sub display_html {
 
       print "</table>\n";
    } elsif( $format eq "full" ) {
-      print "<font size=+2><b>", $self->host(), "/", $self->name();
-      print "</b></font>\n";
+      print "<h2>", $self->host(), "/", $self->name();
+      print "</h2>\n";
 
       # This breaks the generic interactive vs non-interactive model
       $self->add_action_bar();
 
-      print "<table width=100% cellspacing=0 cellpadding=0 border=0>";
-      print "<tr><td bgcolor=\"" . $main::WWW_COLOR{$color} . "\">&nbsp;</td>";
-      print "</tr></table><p>";
+      print "<table class=\"spong_service_detailed\">\n";
+      print " <tr class=\"spong_service_detailed\">\n";
+      print "  <td class=\"spong_background_$color\">&nbsp;</td>\n";
+      print "</tr>\n";
+      print "</table>\n";
+      print "<br />\n";
 
-      print "<b>Updated:</b> ";
+      print "<span class=\"form_property\">Updated:</span> ";
       print POSIX::strftime( "$main::TIMEFMTNOSEC, $main::DATEFMT", localtime($self->rtime()) );
 
-      print "<br><b>Duration:</b> ";
+      print "<br />\n";
+      print "<span class=\"form_property\">Duration:</span> ";
       print $self->format_duration($self->stime(),$self->rtime());
 
-      print "<br><b>Summary:</b> ", $self->summary(), "<br>\n";
-      print "<hr noshade><pre>", $self->message(), "</pre>\n";
+      print "<br />\n";
+      print "<span class=\"form_property\">Summary:</span> ", $self->summary(), "<br />\n";
+      print "<hr class=\"spong_service_detailed\" />\n";
+      print "<pre>", $self->message(), "</pre>\n";
    }
 }
 
@@ -362,8 +382,11 @@ sub add_action_bar {
    my $service = $self->name();
    my $message = &escape( "Host: $name, " . $self->_problem_message() );
 
-   print "<hr>";
-   print "<a href=\"telnet://$name\">Connect to Host</a> || ";
+# TODO: config option to remove "WWWACK"-link
+# -> see also Host.pm!
+   print "<hr />\n";
+# nobody uses telnet anymore, consider removing this completely:
+#   print "<a href=\"telnet://$name\">Connect to Host</a> || ";
    print "<a href=\"$main::WWWACK/$name/$service\">Acknowledge Problem</a> ";
 
    if( $main::WWWCONTACT ) {
@@ -371,7 +394,7 @@ sub add_action_bar {
       print "Contact Help</a>"; 
    }
    
-   print "<hr>\n";
+   print "<hr />\n";
 }
 
 # Escape non-standard HTML characters
index 5cc0e2badb1047ddc94fc528bc3f3949dc0c0f87..5011623c8d860492bb924098d147e62acbd67bb3 100755 (executable)
@@ -19,6 +19,7 @@
 #
 # History:
 # (1) Cleaned up (Ed July 31, 1997);
+# (2) XHTML (Michael Arndt, 2005/11/15);
 
 use Spong::Service;
 use Spong::AckList;
@@ -56,12 +57,19 @@ sub new {
          my( $rtime ) = (stat( "$main::SPONGDB/$host/services/$_" ))[9];
          my $service  = Spong::Service->new( $host, $name );
       
+        $service->rcolor( $color );
+        $service->color( $color );
+
          $service->rtime( $rtime );
-         if( $rtime < ( time() - (3 * $main::SPONGSLEEP) ) ) { 
-            $service->rcolor( $color ); $service->color( "purple" );
-         } else {
-            $service->rcolor( $color ); $service->color( $color );
-         }
+
+        # Config option to get rid of (sometimes annoying)
+        # purple colors (maybe this should be an optional patch ...)
+        if(! $main::SPONG_NO_PURPLE) {
+            if( $rtime < ( time() - (3 * $main::SPONGSLEEP) ) ) { 
+                $service->color( "purple" );
+            }
+        }
+
          $service_hash{$name} = $service;
       }
       closedir( DIR );
@@ -82,10 +90,14 @@ sub new {
          $got_one = 1;
          my( $rtime ) = (stat( "$main::SPONGDB/$host/services/$_" ))[9];
          my $service  = Spong::Service->new( $host, $name );
-      
+
+        # Even more purple here ... see above
          $service->rtime( $rtime );
-         if( $rtime < ( time() - (3 * $main::SPONGSLEEP) ) ) { 
-            $service->rcolor( $color ); $service->color( "purple" );
+         if( ($rtime < ( time() - (3 * $main::SPONGSLEEP) ))
+            && (!$main::SPONG_NO_PURPLE)
+            ) {
+            
+            $service->rcolor( $color ); $service->color( "purple" );
          } else {
             $service->rcolor( $color ); $service->color( $color );
          }
@@ -195,25 +207,30 @@ sub display_html {
    my( $event, $date );
    
    if( $format eq "brief" ) {
-      print "<table border=0 cellspacing=1 cellpadding=1>\n";
+      print "<table class=\"spong_servicelist_brief\">\n";
       foreach $service ( $self->services() ) {
         my $host = $service->host();
         my $name = $service->name();
 
-        print "<tr><td align=center valign=center>";
+        print " <tr>\n";
+        print "  <td class=\"spong_servicelist_brief_left\">\n";
         $service->display_html( "brief" );
-        print "</td><td align=left valign=center>";
+        print "  </td>\n";
+        print "  <td class=\"spong_servicelist_brief_right\">\n";
         print "&nbsp<a href=\"!!WWWSPONG!!/service/$host/$name\">$name</a>";
-        print "</td></tr>\n";
+        print "  </td>\n";
+        print " </tr>\n";
       }
       print "</table>\n";
 
    } elsif( $format eq "standard" ) {
-      print "<table width=100% border=1 cellspacing=1 cellpadding=1><tr>\n";
-      print "<td width=60 align=center nowrap><b>Service</b></td>\n";
-      print "<td width=1% nowrap>&nbsp</td>\n";
-      print "<td width=60 align=center nowrap><b>Updated</b></td>\n";
-      print "<td width=100% align=center><b>Summary</b></td></tr>\n";
+       print "<table class=\"spong_servicelist\">\n";
+       print " <tr class=\"spong_servicelist\">\n";
+       print "  <th class=\"spong_servicelist_service\">Service</th>\n";
+       print "  <th class=\"spong_servicelist_image\">&nbsp;</th>\n";
+       print "  <th class=\"spong_servicelist_updated\">Updated</th>\n";
+       print "  <th class=\"spong_servicelist_summary\">Summary</th>\n";
+       print " </tr>\n";
 
       foreach( $self->services() ) { $_->display_html( "standard_table" ); }