#!/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 { my ($isGSDL2,$site,$collect,$cl) = @_; my $html_form = < HTML to Expeditee Frames
Convert the collection to Expeditee frames by traversing the classifier

EOT print "Content-type:text/html\n\n"; print $html_form; } sub main { # $ENV{'QUERY_STRING'} = "a=...";set-import-metadata&c=espresso-music&d=HASH012d6f72cde5dc48162f4a1d.1&metaname=annotation&metapos=0&metavalue=adfadfad"; # $ENV{'REQUEST_METHOD'} = "GET"; 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::HtmlToExpediteeAction; # Useful debug statement for seeing what packages have been included #### printf("%-45s%-s\n",$_,$INC{$_}) foreach (sort keys %INC); $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"); # frame number if (defined $fn) { my $action = new HtmlToExpediteeAction($gsdl_cgi,$iis6_mode); $action->do_action(); } else { # generate form, pre-filled out with any useful values such # as the collection and classifier value 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 (and possible future versions) make 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();