#!c:/perl/bin/perl use CGI; use strict; use Globals; use Globals qw(%ALLPLATTERS); use Globals qw($bgcolour); my $QUERY = CGI::new(); my $exclude = $QUERY->cookie("exclude"); my $emptytime = 0; my %servers; # Generate server exclusion form # my $server; my $totartists; my $tottracks; foreach $server ( keys %ALLPLATTERS ) { chomp $server; my $newsfile = '../inventory/'.$server.".news"; my $thistime = $emptytime++; my $thisnews = '

'.$server.'
'; my ($tracks,$artists) = getPlatterStats($server); $totartists+=$artists; $tottracks+=$tracks; $thisnews .= ''.$tracks.' tracks by '.$artists.' artists.
'; # open the news file if (open NEWS, $newsfile) { $thistime = ; chomp $thistime; $thisnews .= 'News last updated: '.localtime($thistime).' CET

'; while ( ) { $thisnews .= $_; } close NEWS; } else { # add to 'hidden' servers list $thisnews .= 'No news found.
'; } # check the box if it's a selected server my $checked = 'checked'; if ($exclude =~ /$server/) { $checked = ''; } # write the selection box $thisnews.= '
Include '.$server.' in your selected servers.'; $servers{ $thistime } = $thisnews; } my $serverlist = '

Today the platter contains '.$tottracks.' tracks by '.$totartists.' artists
'; foreach (sort {$b <=> $a} keys %servers) { $serverlist.= $servers{$_}; } # get the template # my $WEBPAGE = openTemplate("servernews"); # Put in what we know # $WEBPAGE =~ s/%SERVERS%/$serverlist/g; $WEBPAGE =~ s/%BGCOLOUR%/$bgcolour/g; # Display the finished Web page # print $WEBPAGE; # Fin # exit;