#!/usr/local/bin/perl
#
#  Want the script display free machines, allocated machines and booked machines
#  separately.
require 'cgi-lib.pl';

$labname = $ENV{'QUERY_STRING'};
$refreshtime='60';

&ReadParse;
print &PrintHeader;

print "<html><head><title>Bookings in $labname lab</title></head>";


@head = `/home/www/lib/scripts/header`;   # Get the good parts of the header
foreach (@head){
  s|Content-type: text/html| |;
}
print @head;
print "<center><h1>Bookings in  $labname lab</h1></center>";

print "<pre>" , "\n";
print `/usr/local/bin/lab $labname | grep UnAllocated`, "\n";
print "</pre>" , "\n";
print "</font>", "\n";
print "<pre>" , "\n";
print `/usr/local/bin/lab $labname | grep '[^n]Allocated'`, "\n";
print "</pre>" , "\n";
print '<FONT COLOR="#880000">' ,"\n";
print "<pre>" , "\n";
print `/usr/local/bin/lab $labname | grep Broken`, "\n";
print "</pre>" , "\n";
print "</font>", "\n";
print '<FONT COLOR="#000080">' ,"\n";
print "<pre>" , "\n";
print `/usr/local/bin/lab $labname  | grep NotBookable`, "\n";
print "</pre>" , "\n";
print "</font>", "\n";

@foot = `./footer`;   # Get the good parts of the footer
foreach (@foot){
  s|Content-type: text/html| |;
}
print @foot;
print "</body></html>";
