#!/usr/bin/perl -w

# $Id: new_folder.pl,v 1.4 1996/02/07 06:45:57 hoagland Exp $

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

# this program creates a new folder then invokes &draw_folder to
# return the HTML for the folder just created.
# Input is CGI, a field on a form,  Output is eventually HTML to STDOUT.

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

require CGI;

$input= new CGI;

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

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

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

$curr_folder= $input->param('curr_folder');
if ($curr_folder eq "") {
  $new_folder= $input->param('name');
} else {
  $new_folder= $input->param('curr_folder') . ':' . $input->param('name');
}
$test= $input->param('condition');
$test=~ s/\n/ \&\& /g;
$state->set_folder($new_folder,$test,'folder.gif');
$state->store;

&draw_folder($state,$input->param('ws'),$new_folder);
1;
