#!/usr/bin/perl

# $Id: add_host.pl,v 1.3 1996/01/17 04:54:08 hoagland Exp $

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

# this program adds a new host to the list of hosts then invokes &draw_ws to
# return the HTML for the page.
# Input is CGI, fields on a form,  Output is HTML to STDOUT.

require '/pkg/www/arpa/secret/cgi-bin/gui-helper.pl';
require '/pkg/www/arpa/secret/cgi-bin/draw_ws.pl';
#require '/pkg/www/arpa/secret/cgi-bin/draw_tw_request.pl';
require '/pkg/www/arpa/secret/cgi-bin/draw_component_request.pl';

require CGI;

$input= new CGI;

foreach (@ARGV) {  # simulate field input
  $input->param(split('=',$_,2));
}

$state= State->new(&get_statefile);

#-------------

$new_host= $input->param('name');
$state->add_hosts($new_host);
$state->{'last_host'}= $new_host;
$state->set_set($new_host,$new_host); # create a new working set as well
$state->store;

$goto= $input->param('goto');
if ($goto eq 'ws') {
  $ws= $input->param('ws_name');
  &draw_ws($state,$ws);
#} elsif ($goto eq 'tw_request') {
#  &draw_tw_request($state);
} elsif ($goto eq 'component_request') {
  &draw_component_request($state);
}
1;
