#!/cygdrive/c/strawberry/perl/bin/perl -w # Need to specify the full path of Perl above, e.g. for Windows something like #!C:\\Perl32\\bin\\perl -w use strict; # Set this to 1 to work around IIS 6 craziness my $iis6_mode = 0; # IIS 6: for some reason, IIS runs this script with the working directory set to the Greenstone # directory rather than the cgi-bin directory, causing lots of stuff to fail if ($iis6_mode) { # Change into cgi-bin directory chdir("cgi-bin"); } # We use require and an eval here (instead of "use") to catch any errors loading the module (for IIS) eval("require \"gsdlCGI.pm\""); if ($@) { print STDOUT "Content-type:text/plain\n\n"; print STDOUT "ERROR: $@\n"; exit 0; } sub generate_html_form { # First create an overlay frame containing CL links. # Then create frames with document links and images. my ($isGSDL2,$site,$collect,$cl) = @_; my $html_form = < Generate Collection Space for $collect

Generate a Collection Space to make it easier to view documents in GlamED/Expeditee. Before running this script you must have already converted the Greenstone collection to an Expeditee frameset. If you have NOT done this, click here

Generate a Collection Space for using the classifier

EOT print "Content-type:text/html\n\n"; print $html_form; } sub main { my $gsdl_cgi = new gsdlCGI(); # Load the Greenstone modules that we need to use $gsdl_cgi->setup_gsdl(); my $gsdlhome = $ENV{'GSDLHOME'}; $gsdl_cgi->checked_chdir($gsdlhome); require cgiactions::CollectionSpaceAction; $gsdl_cgi->parse_cgi_args(); # We don't want the gsdlCGI module to return errors and warnings in XML $gsdl_cgi->{'xml'} = 0; my $fn = $gsdl_cgi->clean_param("fn"); if(defined $fn){ #Generate a frame. my $action = new CollectionSpaceAction($gsdl_cgi,$iis6_mode); $action->do_action(); }else{ my $collect = $gsdl_cgi->clean_param("collect"); my $cl = $gsdl_cgi->clean_param("cl"); #Establish collect_dir using defining 'site' along the way if GS3 my $site = undef; my $isGSDL2 = undef; if($gsdl_cgi->greenstone_version() == 2){ $isGSDL2 = 1; }else{ $isGSDL2 = 0; #GS3 makes use of 'site' $site = $gsdl_cgi->clean_param("site"); if(!defined $site){ $gsdl_cgi->generate_error("No site specified."); } } generate_html_form($isGSDL2,$site,$collect,$cl); } } &main();