#!/usr/bin/perl -w

# $Id: draw_ws.pl,v 1.4 1996/01/24 08:39:04 hoagland Exp $

# draw_ws.pl, by Jim Hoagland (hoagland@cs) 1/96

# this routine generates the working set modification page for the ARPA IDS
# demo GUI
# its first argument indicates which working set this is for
# outputs HTML to STDOUT

require 5.000;

require '/pkg/www/arpa/secret/cgi-bin/gui-helper.pl';

sub draw_ws {
  my($state,$ws)= @_;
  my %his;
  grep($his{$_}++,$state->hosts_in_set($ws));
  my $checklist= '';
  foreach (sort $state->hosts) {
    $checklist.= "<DT><INPUT TYPE=checkbox NAME=\"$_\"";
    if ($his{$_}) {
      $checklist.= " CHECKED><STRONG>$_</STRONG>\n";
    } else {
      $checklist.= ">$_\n";
    }
  }
  print "Content-type:  text/html\n\n";
  &output_instantiated_file('/pkg/www/arpa/secret/gui/html-src/show_ws.html',*STDOUT,
			    '<!!! Put WS here !!!>',$ws,
			    '<!!! Put host checklist here !!!>',$checklist,
			    '<!!! Insert WS options Here !!!>',&ws_options($state));
}
1;
