#!/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) = @_; # first generate the document frames # then generate the classifier browsing frames. my $html_form = < HTML To Expeditee Frames
Convert the collection to Expeditee frames by traversing the classifier

Generate Collection Space

Extra Expeditee Frame Output Options:

Compute Font
Compute Width


EOT print "Content-type:text/html\n\n"; print $html_form; } sub main { my $gsdl_cgi = new gsdlCGI(); #Load GS modules $gsdl_cgi->setup_gsdl(); my $gsdlhome = $ENV{'GSDLHOME'}; $gsdl_cgi->checked_chdir($gsdlhome); #TODO: Refactor so we only need to use HtmlToExpediteeAction require cgiactions::HtmlToExpediteeAction; require cgiactions::CollectionSpaceAction; $gsdl_cgi->parse_cgi_args(); $gsdl_cgi->{'xml'} = 0; my $fn = $gsdl_cgi->clean_param("fn"); if(defined $fn){ #page_type can have two values: "document" or "clPage" my $page_type = $gsdl_cgi->clean_param("page-type"); if(defined $page_type){ my $action; if($page_type eq "document"){ $action = new HtmlToExpediteeAction($gsdl_cgi,$iis6_mode); }elsif($page_type eq "clPage"){ $action = new CollectionSpaceAction($gsdl_cgi,$iis6_mode); }else{ $gsdl_cgi->generate_error("Invalid page type specified. Must be 'document' or 'clPage'"); } $action->do_action(); }else{ $gsdl_cgi->generate_error("No page type specified. Must be 'document' or 'clPage'"); } }else{ # generate html form 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();