#!/DOCUMENT_ROOT/OCEAN_PLANET/SUPPORT_PROGRAMS/perl # Get the document root from the path to perl. ($dr) = $^X =~ m@^(.*)/OCEAN_PLANET/@; $html_dir = "$dr/OCEAN_PLANET/HTML"; $web_dir = "/OCEAN_PLANET/HTML"; @room_suffix = ( "immersion","room1","sea_people","sea_store","oceans_in_peril", "management","reflections","resource_room" ); @room_prefix = ( "immersion","oceanography","sea_people","sea_store","peril", "management","reflections","resource" ); print "Content-type: text/html\n\n"; require "$dr/OCEAN_PLANET/SUPPORT_PROGRAMS/cgi-lib.pl"; &ReadParse; if( $in{"list"} eq "" && $in{"keywords"} eq "" ){ print "

NO SEARCH CRITERIA GIVEN

\n"; print "You forgot to specify some keywords for your search.\n"; print "Please return to the previous page and try again.\n"; exit; } if($in{"andor"} eq "and") { $andor = '&&'; } else { $andor = '||'; } if($in{"case"} eq "ignore") { $case = 'i'; } else { $case = ''; } $keywords .= $in{"list"} if($in{"list"} ne ""); $keywords .= ' ' if($in{"list"} ne "" && $in{"keywords"} ne ""); $keywords .= $in{"keywords"} if($in{"keywords"} ne ""); $keywords =~ s/\\0/ /g; $pattern = "/" . join("/$case $andor /", split(/\s+/, $keywords)) . "/$case"; print "\n\n"; print "Ocean Planet WWW Pages Search Results\n"; print "\n"; print "\n"; print "

Ocean Planet WWW Pages Search Results

\n"; print "
"; print "
\n"; if($andor eq "&&") { print "
Each caption contains all of the specified keywords
\n"; } else { print "
Each caption contains at least one of the specified keywords
\n"; } if($case eq "i") {print "
Case ignored during search
\n";} else {print "
Search was case-sensitive
\n";} print <<"--";
Search keywords
$keywords
The results presented below list the room of the exhibiton in which the topic of interst can be found, as well as, the specific section of that room that contains that topic in the format:

Exhibition Room Name


-- opendir(DIR,$html_dir) || die "Could not open directory, $html_dir, stopped"; foreach $file (sort(grep(/\.html$/, readdir(DIR)))){ # Don't search the form that calls this script. if($file =~ /ocean_planet_html_search\.html/){ next; } open(HTML_FILE, "$html_dir/$file") || die "Could not open $html_dir/$file"; $text = ""; while(){ # Slurp the file into memory. $text .= $_; } $_ = $text; $file =~ m@(.*)\.html@; $name = $1; if(eval($pattern)){ $found_one = 1; for($i=0; $i<@room_prefix; $i++){ if($name =~ /^$room_prefix[$i]_(.*)/){ $room{$room_prefix[$i]} .= "
  • $1\n"; last; } } if($i == @room_prefix){ $other .= "
  • $name\n"; } } } for($i=0; $i<@room_prefix; $i++){ if(defined($room{$room_prefix[$i]})){ # Remove this link from the "$other" string since we list it here. $excise = "
  • " . "ocean_planet_$room_suffix[$i]\n"; if($other =~ m@([^\000]*)$excise([^\000]*)@){ $other = $1 . $2; } print ""; print "$room_prefix[$i]\n"; print ""; print "


    "; } } print "

    Nothing found

    " if(!defined($found_one)); if($other){ print "Other pages"; print "

    "; } print <<'--';
    Ocean Planet Exhibition Floorplan

    Gene Carl Feldman (gene@seawifs.gsfc.nasa.gov) (301) 286-9428
    Judith Gradwohl (Curator/Ocean Planet)

    --