]> git.etc.gen.nz Git - spong.git/commitdiff
host URLs were incorrect in display_html() when WWW_FQDN = 0 and restored display_nam...
authorStephen L Johnson <sjohnson@monsters.org>
Thu, 24 Feb 2000 15:13:52 +0000 (15:13 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Thu, 24 Feb 2000 15:13:52 +0000 (15:13 +0000)
src/lib/Spong/HostList.pm

index 3d24aaf505f11a3a7d25c105a9503627b5e45688..62a2a238d655f372f3d2a8ae26c78a7364d72c8d 100755 (executable)
@@ -246,15 +246,16 @@ sub display_html {
       # Now go through each host, and fill in the table.
       
       foreach $host ( $self->hosts() ) { 
-        my $hostname = $host->name();
-         if ( ! $main::WWW_FQDN ) {  # If WWW_FQDN not set, use short hostname
-           my $short = $main::HOSTS{$hostname}->{'display_name'};
-           $short = (split( /\./, $hostname ))[0] unless $short;
-            $hostname = $short;
+        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><td align=left bgcolor=#ffffff nowrap>\n";
-        print "<a href=\"!!WWWSPONG!!/host/$hostname\">$hostname</a></td>\n";
+        print "<a href=\"!!WWWSPONG!!/host/$hostname\">$display</a></td>\n";
         
         foreach $service ( @names ) {
            my $servobj = $host->service( $service );