#!/usr/bin/perl

# $Id: change_icon.pl,v 1.1 1996/01/20 08:31:32 hoagland Exp $

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

# this program changes the icon of the given folder to the given icon then 
# draws a confirmation screen.
# Input is CGI, two fields on a form,  Output is HTML to STDOUT.

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

require CGI;

$input= new CGI;

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

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

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

$folder= $input->param('folder');
$input->delete('folder');
@param= $input->param();
$icon= shift @param;
$icon =~ s/\.[xy]$//;
$state->{'icons'}->{$folder}= $icon;
$state->store;

print <<">>";
Content-type:  text/html

<HTML><HEAD>
<TITLE>Changed</TITLE>
</HEAD><BODY>
The icon for $folder was changed to $icon.
</BODY></HTML>
>>

1;
