#!/usr/local/bin/perl # # script name: info # used from : jgofsdir/htmlbin # converted from info (/bin/csh script) originally written by Glenn Flierl # modified to read from .info files by Christine Hammond # # NOTE: /images/dir.gif and /images/datadisp.gif are used by this script # if you do not have these buttons, you can get them on anonymous ftp at # dataone.whoi.edu (128.128.80.28) in /pub/images # ################################################################ $dirlink=""; $datalink=""; $imagedir="http://globec.whoi.edu:8081/images"; # # tell browser to display as html # print "Content-type: text/html\n\n"; # # get the argv, use tail only - should be objectname[+params] # # NOTE: info allows for either form: /jg/info?/path/obj # /jg/info/path/obj <--- newer # if ($ENV{'PATH_INFO'}) { $arg = $ENV{'PATH_INFO'}; } elsif ($ENV{'QUERY_STRING'}) { $arg = $ENV{'QUERY_STRING'}; } $ndx = index($arg,'{'); if ($ndx >= $[) { $pathobj=substr($arg,0,$ndx); $extent=substr($arg,$ndx); } else { $pathobj=substr($arg,0); $extent=""; } $obj = substr($pathobj,rindex($pathobj,'/')+1); if ($obj =~ /\.[hi]+/) { $obj = substr($obj,0,(index($obj,"."))); } # # argv's head is the path from top of object tree # $ddir = substr($pathobj,0,index($pathobj,$obj)); # # parse the extension to the URL, get Data URL if present # if ($extent) { if ($datapiece=index($extent,"data=")) { $datalink=substr($extent,$datapiece+5); # # remove the final curly brackets from datalink # chop($datalink); } # # and get the Directory URL if present # if (($ndx=index($extent,"dir=")) >= $[) { $dirlink=substr($extent,$ndx+4,$datapiece-6); } } # # for returning to data object display, need new extension, to dir and info # $newextent="{dir="."$dirlink".",info="; $newextent.="$ENV{'SERVER_NAME'}".":"."$ENV{'SERVER_PORT'}"; $newextent.="/jg/info"."$pathobj"."}"; # # go to top of objects tree, plus current dir # NOTE: this assumes a standard jgofs structure with directories # htmlbin/ and objects/ at the first level subdirs of jgofsdir # chdir("../objects$ddir"); # # show the buttons for directory, data at top of screen # if ($dirlink) { print "\"[Directory]\" \n"; } if ($datalink) { print " \"[Data...]\"\n"; } # # show the objectname for which we have a .info # print "

$obj

\n"; print "
\n";
#
# display contents of objectname.info file in current dir
#
 unless (open(INFILE, "$obj.info")) {
       print "No documentation found\n";
 }
 while () {
     print $_;
 }
 close(INFILE);
#
# turn off pre tag set above 
#
   print "
\n"; print "
\n";