Index: unk/gsdl/cgi-bin/GSDLHOME.pm
===================================================================
--- /trunk/gsdl/cgi-bin/GSDLHOME.pm	(revision 1552)
+++ 	(revision )
@@ -1,36 +1,0 @@
-package GSDLHOME;
-
-BEGIN {
-
-    if (!defined $ENV{'GSDLHOME'}) {
-	# read gsdlhome from gsdlsite.cfg
-	open (GSDLSITE, "gsdlsite.cfg") || die 
-	    "GSDLHOME.pm: unable to open gsdlsite.cfg\n";
-	my $line = "";
-	while (defined ($line = <GSDLSITE>)) {
-	    if ($line =~ /^gsdlhome\s+(.*?)\s*$/) {
-		$ENV{'GSDLHOME'} = $1;
-		last;
-	    }
-	}
-	die "GSDLHOME.pm: couldn't find gsdlhome field in gsdlsite.cfg\n"
-	    unless defined $ENV{'GSDLHOME'};
-    }
-
-    # just in case GSDLHOME has a slash on the end which would cause
-    # double slashes below
-    $ENV{'GSDLHOME'} =~ s/[\/\\]+$//;
-
-    $ENV{'GSDLOS'} = $^O;
-
-    if ($ENV{'GSDLOS'} =~ /(win|dos)/i) {
-	$ENV{'GSDLOS'} = 'windows';
-    }
-    
-    $ENV{'PATH'} .= ":$ENV{'GSDLHOME'}/bin/script";
-    $ENV{'PATH'} .= ":$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
-    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
-    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
-}
-
-1;
Index: unk/gsdl/cgi-bin/webpage_buildcol.pl
===================================================================
--- /trunk/gsdl/cgi-bin/webpage_buildcol.pl	(revision 1552)
+++ 	(revision )
@@ -1,324 +1,0 @@
-#!perl -w
-
-###########################################################################
-#
-# webpage_buildcol.pl --
-# A component of the Greenstone digital library software
-# from the New Zealand Digital Library Project at the 
-# University of Waikato, New Zealand.
-#
-# Copyright (C) 1999 New Zealand Digital Library Project
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-# This program is a webpage wrapper to the import.pl and buildcol.pl 
-#   processes
-# Note while it is in the cgi-bin directory, its arguments are supplied as 
-#  the more traditional command line argument.  The program is executed by
-#   an already running cgi program.
-
-package webpage_buildcol;
-
-use File::Basename;
-use GSDLHOME;
-use gflock;
-
-my $args;
-
-BEGIN
-{    
-    my $va_pair;
-    foreach $va_pair (@ARGV) 
-    { 
-	if ($va_pair =~ m/^(\w+)=(\"?)(.*)(\"?)$/)
-	{
-	    my ($variable,$assignment) = ($1,$3);
-	    $args->{$variable} = $assignment;
-	}
-    }
-}
-
-require util;
-require webpageutil;
-require cfgread;
-
-sub communicate_single_line
-{
-    my ($full_tmpname,$text) = @_;
-
-    if (open(TMPOUT,">$full_tmpname"))
-    {
-	if (&gflock::lock (webpage_buildcol::TMPOUT)) {
-	    print TMPOUT $text;
-	    close(TMPOUT);
-	    &gflock::unlock (webpage_buildcol::TMPOUT);
-
-	} else {
-	    # Problem locking file
-	    my $mess = "Unable to lock temporary communication file:";
-	    $mess .= " $full_tmpname";
-	    print STDERR "$mess\n";
-	    return;
-	}
-    }
-    else
-    {
-	my $mess = "Unable to open for writing";
-	$mess .= " communication temporary file: $full_tmpname.";
-	print STDERR "$mess\n";
-	return;
-    }
-}
-
-
-sub do_build
-{
-    my ($full_dirname,$dirname,$args) = @_;
-
-    my $tmpname = $args->{'bc1tmpname'};
-    my $full_tmpname = &util::filename_cat($ENV{'GSDLHOME'},"tmp",$tmpname);
-    my $cfg_filename = &util::filename_cat($full_dirname,"etc","collect.cfg");
-    my $full_importname = &util::filename_cat($full_dirname,"import");
-
-    my $log_filename = &util::filename_cat($ENV{'GSDLHOME'},"etc","$dirname.bld");
-    if (!open (LOGOUT, ">$log_filename"))
-    {
-	my $mess = "Error: Unable to open log file '$log_filename'";
-	print LOGOUT "$mess\n";
-	communicate_single_line($full_tmpname,$mess);
-	return "failure";
-    }
-
-    my $copy_data = $args->{'bc1copydata'};
-    my $do_import = $args->{'bc1doimport'};
-    my $do_build  = $args->{'bc1dobuild'};
-
-    my $building_cfg_text 
-	= &cfgread::read_cfg_file($cfg_filename,undef,undef,"^building");
-    my $copy_dir     = $building_cfg_text->{'building'}->{'copydir'};
-    my $input_dir    = $building_cfg_text->{'building'}->{'inputdir'};
-
-    if ($copy_data eq "true")
-    {
-	if ($copy_dir =~ m/^yes$/i)
-	{
-	    my $download_cmd = "perl " . &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "script");
-
-	    # run filecopy.pl to download files
-	    $input_dir =~ s/^\s+//;
-	    $input_dir =~ s/\s+$//;
-	    $download_cmd = " filecopy.pl \"$input_dir\" \"$dirname\"";
-	    
-	    # execute download command and monitor the output generated
-	    if(!open(DOWNLOADOUT,"$download_cmd 2>&1 |"))
-	    {
-		my $mess = "Error: Unable to open pipe to command '$download_cmd'";
-		print LOGOUT "$mess\n";
-		communicate_single_line($full_tmpname,$mess);
-		close(LOGOUT);
-		return "failure";
-	    }
-	    while (defined($line=<DOWNLOADOUT>))
-	    {
-		print LOGOUT $line;
-		chop $line;
-		if ($line =~ m/^Error:/)
-		{
-		    print LOGOUT "$line";
-		    communicate_single_line($full_tmpname,"$line");
-		    close(DOWNLOADOUT);
-		    close(LOGOUT);
-		    return "failure";
-		}    
-		communicate_single_line($full_tmpname,"Copying data ...<br>$line");
-	    }
-	    
-	    close(DOWNLOADOUT);
-	}
-    }
-
-    if ((defined $copy_dir) && ($copy_dir =~ /^no$/i))
-    {
-	# link it
-	my $tail_dir = &File::Basename::basename($input_dir);
-	my $sym_dirname = &util::filename_cat($full_importname,$tail_dir);
-	
-	&util::rm_r($sym_dirname) if (-e $sym_dirname);
-
-	if (&util::soft_link($input_dir,$sym_dirname))
-	{
-	    my $mess = "Source data linked to $input_dir";
-	    communicate_single_line($full_tmpname,$mess);
-	}
-	else
-	{
-	    my $mess = "Error: unable to make symbolic link to source:";
-	    $mess .= " $input_dir";
-	    print LOGOUT "$mess\n";
-	    communicate_single_line($full_tmpname,$mess);
-	    close(LOGOUT);
-	    return "failure";
-	}
-    }
-
-    if ($do_import eq "true")
-    {
-	# Import operation
-	my $import_cmd = "perl ";
-	$import_cmd .= &util::filename_cat($ENV{'GSDLHOME'}, "bin", "script", "import.pl");
-	$import_cmd .= " -removeold $dirname";
-	
-	if(!open(IMPORTOUT,"$import_cmd 2>&1 |"))
-	{
-	    my $mess = "Error: Unable to open pipe to command '$import_cmd'";
-	    print LOGOUT "$mess\n";
-	    communicate_single_line($full_tmpname,$mess);
-	    close(LOGOUT);
-	    return "failure";
-	}
-	while (defined($line=<IMPORTOUT>))
-	{
-	    print LOGOUT $line;
-	    chop $line;
-	    if ($line =~ m/^Error:/)
-	    {
-		print LOGOUT "$line";
-		communicate_single_line($full_tmpname,"$line");
-		close(IMPORTOUT);
-		close(LOGOUT);
-		return "failure";
-	    }    
-	    communicate_single_line($full_tmpname,"Caching data ...<br>$line");
-	}
-	
-	close(IMPORTOUT);
-    }
-
-    if ($do_build eq "true")
-    {
-	my $full_archivename = &util::filename_cat($full_dirname,"archives");
-
-	# Build operation
-	my $build_cmd = "perl " . 
-	    &util::filename_cat($ENV{'GSDLHOME'}, "bin", "script", "buildcol.pl");
-	if (($do_import eq "true") 
-	    || (($do_import eq "false") && (-e $full_archivename)))
-	{
-	    $build_cmd .= " $dirname";
-	}
-	else
-	{
-	    $build_cmd .= " -archivedir $full_importname";
-	    $build_cmd .= " -cachedir $full_archivename";
-	    $build_cmd .= " $dirname";
-	}
-	
-	if(!open(BUILDOUT,"$build_cmd 2>&1 |"))
-	{
-	    my $mess = "Error: Unable to open pipe to command '$build_cmd'";
-	    print LOGOUT "$mess\n";
-	    communicate_single_line($full_tmpname,$mess);
-	    close(LOGOUT);
-	    return "failure";
-	}
-	while (defined($line=<BUILDOUT>))
-	{
-	    print LOGOUT $line;
-	    chop $line;
-	    if ($line =~ m/^Error:/)
-	    {
-		print LOGOUT "$line";
-		communicate_single_line($full_tmpname,"$line");
-		close(BUILDOUT);
-		close(LOGOUT);
-		return "failure";
-	    }    
-	    communicate_single_line($full_tmpname,"Creating indexes ...<br>$line");
-	}
-	
-	close(BUILDOUT);
-
-	# Make collection live
-	#--
-	# rm index
-	my $full_indexname = &util::filename_cat($full_dirname,"index");
-	&util::rm_r($full_indexname);
-	
-	# move building
-	my $full_buildingname = &util::filename_cat($full_dirname,"building");
-	&util::mv($full_buildingname,$full_indexname);
-	
-	my $full_imagesrc = &util::filename_cat($full_dirname,"building_images","imgsrc");
-	if (-e $full_imagesrc)
-	{
-	    my $full_imagedst = &util::filename_cat($full_dirname,"index","imgsrc");
-	    &util::soft_link($full_imagesrc,$full_imagedst);
-	}
-
-	# Recreate 'building' directory ready for next build
-	&util::mk_dir($full_buildingname);
-    }
-
-    communicate_single_line($full_tmpname,"Done");
-    close(LOGOUT);
-    return "success";
-}
-
-
-sub main
-{
-    # get arguments
-    my $dirname = $args->{'bc1dirname'};
-    if (!defined($dirname))
-    {
-	my $mess = "Directory name for collection missing.";
-	print STDERR "$mess\n";
-	return;
-    }
-
-    my $tmpname = $args->{'bc1tmpname'};
-    if (!defined($tmpname))
-    {
-	my $mess = "Temporary name for building communication missing.";
-	print STDERR "$mess\n";
-	return;
-    }
-
-    my $full_tmpname
-	= &util::filename_cat($ENV{'GSDLHOME'},"tmp",$tmpname);
-
-    communicate_single_line($full_tmpname,"Preparing to build.");
-
-    # Put lock on config file before any building is done as safe
-    # guard against any concurrent operations on this collection.
-    #--
-
-    my $full_dirname 
-	= &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname);
-    my $cfg_filename 
-	= &util::filename_cat($full_dirname,"etc","collect.cfg");
-
-    # do requested stages for building
-    my $result = do_build($full_dirname,$dirname,$args);
-    return if ($result ne "success");
-
-    my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$dirname";
-    print "Location: $mess_url&head=_headdone_&mess=_messdonebuildcol_\n\n";
-    print "done\n"; # in tmp file
-}
-
-&main();
Index: unk/gsdl/cgi-bin/webpage_buildstatus.pl
===================================================================
--- /trunk/gsdl/cgi-bin/webpage_buildstatus.pl	(revision 1552)
+++ 	(revision )
@@ -1,103 +1,0 @@
-#!perl -w
-
-###########################################################################
-#
-# webpage_buildstatus.pl --
-# A component of the Greenstone digital library software
-# from the New Zealand Digital Library Project at the 
-# University of Waikato, New Zealand.
-#
-# Copyright (C) 1999 New Zealand Digital Library Project
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-# This program is a webpage wrapper that checks on the progress of 
-#  import.pl and buildcol.pl processes
-
-use CGI;
-use GSDLHOME;
-
-require util;
-require webpageutil;
-
-sub parse_cgiargs
-{
-    # get arguments
-    my $cgi = new CGI;
-    my %args = ();
-
-    foreach $p ($cgi->param()) 
-    { 
-	$args{$p} = $cgi->param($p);
-    }
-
-    return \%args;
-}
-
-
-sub main
-{
-    # get arguments
-    my $args = parse_cgiargs();
-    my $bc1finished = 0;
-
-    my $tmpname = $args->{'bc1tmpname'};
-    if (!defined($tmpname))
-    {
-	my $mess = "Temporary filename for building communication not defined.";
-	$bc1finished = 1;
-	&webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
-	return;
-    }
-
-    my $full_tmpname = &util::filename_cat($ENV{'GSDLHOME'},"tmp");
-
-    if (!-d $full_tmpname) {
-	mkdir ($full_tmpname, 0777);
-    }
-
-    $full_tmpname = &util::filename_cat($full_tmpname, $tmpname);
-
-    if (open(TMPIN,"<$full_tmpname"))
-    {
-	my @tmp_text = ();
-	my $line;
-	while (defined($line=<TMPIN>))
-	{
-	    chomp $line;
-	    push(@tmp_text,$line);
-	}
-	my $mess = join(" ",@tmp_text);
-	$bc1finished = 1 if ($mess eq "Done");
-	$bc1finished = -1 if ($mess =~ m/^Error:/);
-	# escape backslashes so they don't vanish from printed filenames
-	$mess =~ s/\\/\\\\/g;
-	&webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
-
-	close(TMPIN);
-    }
-    else
-    {
-	my $mess = "Unable to open for reading temporary file: $full_tmpname.";
-	$bc1finished = 1;
-	&util::rm($full_tmpname);
-	&webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
-	return;
-    }
-}
-
-&main();
Index: unk/gsdl/cgi-bin/webpage_delcol.pl
===================================================================
--- /trunk/gsdl/cgi-bin/webpage_delcol.pl	(revision 1552)
+++ 	(revision )
@@ -1,107 +1,0 @@
-#!perl -w
-
-###########################################################################
-#
-# webpage_delcol.pl --
-# A component of the Greenstone digital library software
-# from the New Zealand Digital Library Project at the 
-# University of Waikato, New Zealand.
-#
-# Copyright (C) 1999 New Zealand Digital Library Project
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-# This program is a webpage wrapper that deletes the named collection
-
-use CGI;
-use GSDLHOME;
-
-require util;
-require webpageutil;
-
-sub parse_cgiargs
-{
-    # get arguments
-    my $cgi = new CGI;
-    my %args = ();
-    
-    foreach $p ($cgi->param()) 
-    { 
-	$args{$p} = $cgi->param($p);
-    }
-
-    return \%args;
-}
-
-
-
-sub main
-{
-    # get arguments
-    my $args = parse_cgiargs();
-
-    my $dirname = $args->{'bc1dirname'};
-    if (!defined($dirname))
-    {
-	# directory name derived from the collection name missing
-	my $mess = "Directory name derived from the collection name missing.";
-	&webpageutil::error_location($args,$mess);
-	return;
-    }
-
-    my $delete_area = $args->{'bc1deletearea'};
-
-    if ($delete_area eq "all")
-    {
-	# delete all files
-	my $col_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname);
-	&util::rm_r($col_dir);
-
-    }
-    elsif ($delete_area eq "import")
-    {
-
-	my $collectdir =  &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname);
-	my $import_dir = &util::filename_cat($collectdir,"import");
-	my $archives_dir = &util::filename_cat($collectdir,"archives");
-	&util::rm_r($import_dir,$archives_dir);
-	&util::mk_dir($import_dir);
-    }
-    elsif ($delete_area eq "archives")
-    {
-	my $collectdir =  &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname);
-	my $archives_dir = &util::filename_cat($collectdir,"archives");
-	&util::rm_r($archives_dir);
-    }
-    else
-    {
-	# unrecoginised area to delete
-	my $mess = "Unrecognised area to delete: $delete_area";
-	&webpageutil::error_location($args,$mess);
-	return;
-    }
-
-    my $mess_url = "$args->{'httpbuild'}&bca=mess";
-    $mess_url .= "&bc1dirname=$dirname" if ($delete_area ne "all");
-    print "Location: $mess_url&head=_headdone_&mess=_messdonedelcol_\n\n";
-    return;
-
-}
-
-&main();
-
-
Index: unk/gsdl/cgi-bin/webpage_editcol.pl
===================================================================
--- /trunk/gsdl/cgi-bin/webpage_editcol.pl	(revision 1552)
+++ 	(revision )
@@ -1,109 +1,0 @@
-#!perl -w
-
-###########################################################################
-#
-# webpage_editcol.pl --
-# A component of the Greenstone digital library software
-# from the New Zealand Digital Library Project at the 
-# University of Waikato, New Zealand.
-#
-# Copyright (C) 1999 New Zealand Digital Library Project
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-# This program is a webpage wrapper for saving an edited config file
-
-package webpage_editcol;
-
-use CGI;
-use GSDLHOME;
-use gflock;
-
-require util;
-require webpageutil;
-
-sub parse_cgiargs
-{
-    # get arguments
-    my $cgi = new CGI;
-    my %args = ();
-
-    foreach $p ($cgi->param()) 
-    { 
-	$args{$p} = $cgi->param($p);
-    }
-
-    return \%args;
-}
-
-
-
-sub main
-{
-    # get arguments
-    my $args = parse_cgiargs();
-
-    my $dirname = $args->{'bc1dirname'};
-    if (!defined($dirname))
-    {
-	# directory name derived from the collection name missing
-	my $mess = "Directory name for collection missing.";
-	&webpageutil::error_location($args,$mess);
-	return;
-    }
-
-    my $cfg_filename 
-	= &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname,"etc","collect.cfg");
-
-    if (open(CFGOUT,">$cfg_filename"))
-    {
-	binmode (CFGOUT); # windows
-	
-	if (&gflock::lock (webpage_editcol::CFGOUT)) {
-	    my $cfg_text = $args->{'bc1cfgfile'};
-	    print CFGOUT "$cfg_text";
-	    &gflock::unlock (webpage_editcol::CFGOUT);
-	    close(CFGOUT);
-	}
-	else
-	{
-	    # problem locking file
-	    my $mess = "Unable to lock configuration file: $cfg_filename";
-	    &webpageutil::error_location($args,$mess);
-	    return;
-	}
-    }
-    else
-    {
-	# unable to open configuration file for writing
-	my $mess = "Unable to open for writing configuration file: $cfg_filename";
-	&webpageutil::error_location($args,$mess);
-	return;
-    }
-
-    my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$dirname";
-    print "Location: $mess_url&head=_headdone_&mess=_messdoneeditcol_\n\n";
-    return;
-
-}
-
-&main();
-
-
-
-
-
Index: unk/gsdl/cgi-bin/webpage_mkcol.pl
===================================================================
--- /trunk/gsdl/cgi-bin/webpage_mkcol.pl	(revision 1552)
+++ 	(revision )
@@ -1,231 +1,0 @@
-#!perl -w
-
-###########################################################################
-#
-# webpage_mkcol.pl --
-# A component of the Greenstone digital library software
-# from the New Zealand Digital Library Project at the 
-# University of Waikato, New Zealand.
-#
-# Copyright (C) 1999 New Zealand Digital Library Project
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-###########################################################################
-
-# This program is a webpage wrapper to the mkcol.pl process
-
-package webpage_mkcol;
-
-use CGI;
-use GSDLHOME;
-use gflock;
-
-require util;
-require webpageutil;
-
-sub parse_cgiargs
-{
-    # get arguments
-    my $cgi = new CGI;
-    my %args = ();
-    
-    foreach $p ($cgi->param()) 
-    { 
-	$args{$p} = $cgi->param($p);
-    }
-
-    return \%args;
-}
-
-
-sub get_unique_dirname
-{
-    my ($args) = @_;
-
-    my $dirname = "";
-
-    my $fullname = $args->{'bc1fullname'};
-    my $in_gsdl_area = $args->{'bc1ingsdlarea'};
-    my $copy_dir = $args->{'bc1copydir'};
-
-    # if inputdir is in gsdl area then need to extract existing dirname
-    if (($in_gsdl_area eq "yes") && (($copy_dir eq "no")))
-    {
-	my $inputdir = $args->{'bc1inputdir'};
-	my $dirsep_re = &util::get_re_dirsep();
-	my @id_split = split(/$dirsep_re/,$inputdir);
-	while (@id_split>0)
-	{
-	    $dirname = pop(@id_split);
-	    last if ($dirname =~ m/(import|building)/i);
-	}
-	$dirname = pop(@id_split);
-
-	# check to see if config file already exists
-	my $cfg_filename
-	    = &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname,
-				 "etc","collect.cfg");
-	if (-e $cfg_filename)
-	{
-	    &webpageutil::error_location($args,"_messconfigexists_");
-	    return "";
-	}	
-    }
-    else
-    {
-	# clean up input for heuristic that derives directory name for a
-	# new collection
-	$fullname =~ s/\s+/ /g;
-	$fullname =~ tr/[A-Z]/[a-z]/;
-	my @fn_split = split(" ",$fullname);
-	map { $_ =~ s/\W//g } @fn_split; # remove any non-word characters
-	
-	my $no_words = scalar(@fn_split);
-	if ($no_words == 0)
-	{
-	    &webpageutil::error_location($args,"_messnofn_");
-	    return "";
-	}
-	
-	my $use_words = ($no_words<=6) ? $no_words : 6;
-	my $substr_len = int(6/$use_words);
-	
-	my $i;
-	for ($i=0; $i<$use_words; $i++)
-	{
-	    $dirname .= substr($fn_split[$i],0,$substr_len);
-	}
-	
-	# check to see if dirname is unique
-	my $fulldirname 
-	    = &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname);
-	if (-e $fulldirname)
-	{
-	    my $version = 0;
-	    do
-	    {
-		$version++;
-		$fulldirname 
-		    = &util::filename_cat($ENV{'GSDLHOME'},"collect",
-					  "${dirname}v$version");
-
-	    } while (-e $fulldirname);
-
-	    $dirname = "${dirname}v$version";
-	}
-    }
-
-    return $dirname;
-}
-
-
-sub main
-{
-    # get arguments
-    my $args = parse_cgiargs();
-    
-    # get unique dirname
-    my $unique_dirname = get_unique_dirname($args);
-    if ($unique_dirname ne "")
-    {
-	my $fullname      = $args->{'bc1fullname'};
-	my $contact_email = $args->{'bc1contactemail'};		
-	my $about_desc    = $args->{'bc1aboutdesc'};
-	my $src_format    = $args->{'bc1srcformat'};
-	my $input_dir     = $args->{'bc1inputdir'};
-	my $copy_dir      = $args->{'bc1copydir'};
-	my $in_gsdl_area  = $args->{'bc1ingsdlarea'};
-	my $acronyms      = $args->{'bc1acronyms'};
-
-	my $cmd = "perl ";
-	$cmd .= &util::filename_cat($ENV{'GSDLHOME'}, "bin", "script", "mkcol.pl");
-	$cmd .= " -title   \"$fullname\"";
-	$cmd .= " -creator $contact_email";
-	$cmd .= " -about   \"$about_desc\"";
-	$cmd .= " -plugin  \"GMLPlug\"";
-	if ($src_format eq "HTML") {
-	    $cmd .= " -plugin  \"HTMLPlug -keep_head\"";
-	} else {
-	    $cmd .= " -plugin  \"${src_format}Plug\"";
-	}
-	$cmd .= " -plugin  \"ArcPlug\"";
-	$cmd .= " -plugin  \"RecPlug\"";
-	$cmd .= " $unique_dirname";
-
-	my $status = system($cmd);
-	$status /= 256;
-
-	if ($status == 0)
-	{
-	    # append copydir and input_dir to end of collect.cfg we'll also
-	    # append DocumentUseHTML if processing HTML docs
-	    my $cfg_filename 
-		= &util::filename_cat($ENV{'GSDLHOME'},"collect",$unique_dirname,
-				      "etc","collect.cfg");
-	    if (open(CFGAPP,">>$cfg_filename"))
-	    {
-		if (&gflock::lock (webpage_mkcol::CFGAPP)) {
-		    print CFGAPP "\n";
-
-		    if ($src_format eq "HTML") {
-			print CFGAPP "format\tDocumentUseHTML\ttrue\n\n";
-		    }
-
-		    print CFGAPP "building\tinputdir\t\"$input_dir\"\n";
-		    print CFGAPP "building\tcopydir\t\t$copy_dir\n";
-		    print CFGAPP "building\tingsdlarea\t$in_gsdl_area\n";
-		    &gflock::unlock (webpage_mkcol::CFGAPP);
-		    close(CFGAPP);
-		}
-		else
-		{
-		    # problem locking file
-		    my $mess = "Unable to lock collection";
-		    $mess .= " configuration file: $cfg_filename";
-		    &webpageutil::error_location($args,$mess);
-		    close(CFGAPP);
-		    return;
-		}
-	    }
-	    else
-	    {
-		# problem
-		my $mess = "Unable to append to collection";
-		$mess .= " configuration file: $cfg_filename";
-		&webpageutil::error_location($args,$mess);
-		return;
-	    }
-	}
-	else
-	{
-	    my $mess = "An error was encountered: error status = $status";
-	    &webpageutil::error_location($args,$mess);
-	    return;
-	}
-    }
-    else
-    {
-	my $mess = "No unique directory name specified for collection";
-	&webpageutil::error_location($args,$mess);
-	return;
-    }
-
-    my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$unique_dirname";
-    print "Location: $mess_url&head=_headdone_&mess=_messdonenewcol_\n\n";
-
-}
-
-&main();
