#!/usr/bin/perl -w
{
#  NB: The name of this program is used as a flag.  The name (and hence
#  the flag) is propagated from here via the HTTP_REFERER environment variable.
#  It is anticipated that all names for this program will be links to this file.

$version = "otheropt version 2.2h  9 Mar 13";

#   9 Mar 13. WJS
#	Switch from math-form/mathopt to mathopt.pl
#  20 Dec 12. WJS
#	Switch from listopt to listopt.pl
#	[begin 2.2h]

#  10 Aug 11. WJS
#	Change page name to "Download and Other Operations"
#	[begin 2.2g]
#   5 Feb 10. WJS
#	Send extended URL to download-1
#	[begin 2.2f]
#  31 Oct 09. WJS
#	Print "server ID" in ID footer &, accordingly, remove "production"
#    As long as root is symbolic link, the directory to which it points
#    will be a good ID.
#	[begin 2.2e]
#  27 May 09. WJS
#	Comment change regarding  15 Mar 08 comment
#  24 Feb 09.  WJS
#	Date change due to freeze of wjsotheroptMay08
#	Add (production) to 2.2d on production server and mod text
#    to be prod server text.  Functionally, however, this is 2.2d
#	[begin 2.2d]
#  27 Nov 08.  WJS
#	Replace joinu.shtml with join-form1.pl
#	[begin 2.2c]
#  24 Oct 08.  WJS
#	timesplit entry
#	[begin 2.2b]
#   4 Sep 08.  WJS
#	Change text regarding need to save stuff as persistent object
#	[begin 2.2a]
#  14 Aug 08.  WJS
#	makeodv entry
#	[begin 2.2]

#  23 May 08.  WJS
#	Change ID string.  (v 2.1b was another mod of ID string)
#	(begin 2.1c)
#  10 May 08.  WJS
#	Help link for deferred download
#   3 Apr 08.  WJS
#	selopt.pl stuff instead of selopt stuff
#  15 Mar 08.  WJS
#	Remove mapping software.  Decision in email Cyndy/Bob 14 Mar
#	The href to restore it is /jg/mapoptjg$CALLURL
#	  NB: as of 27 May 09, mapoptjg is mapoptjg.00.  It uses SUBSELS_QS
#	which is on its way out... so mapoptjg is further toward ITS way out
#  25 Jan 08.  WJS
#	Incorporate Bob's warning text about downloading joins, etc,
#	suitably modified for the existence of persistent objects
#	(Note that the correct soln is the removal of the text from
#	here, and the presence of a "persistent save (needed for
#	future download)" button on the join, etc pages)
#	[begin 2.1a]

#  16 Jul 05.  WJS
#	makenetcdf entry
#  13 Mar 05.  WJS
#	Stick a "merged" in the ID
#  23 Dec 04.  WJS
#	Note that download also has matlab capability
#  12 Dec 04.  WJS
#	Add download inquiry entry
#	Split listing opts from download opts
#  27 Oct 04.  WJS
#	Change "save object" text to "save/remove" object
#  20 Aug 04.  WJS
#	Change persistent object entry
#	Send extended URL to persistent object thing, too
#   5 Aug 04.  WJS
#	Convert to perl
#	Ignore -f switch - not used in any file in OO tree
#	Send extended URL to, at least, time converter
#   3 Aug 04.  WJS
#	Change time converter entry
#   1 Jun 04.  WJS
#	Add time converter entry
#  14 May 04.  WJS
#	Add persistent object entry
#  15 Apr 04.  WJS
#	Put in warning message for port 8200 server
# Modified April 1, 2004.  Replace call to makematlab with makematlab.pl.
#	WJS/RCG
# modified March 4, 2004 rcg - add entry for statisticker option. 
#	Add version output.  rcg
# modified August 20, 1997 clh - only for readability, no functional changes
#          September 23, 1997 clh - group like functions (plot, list, etc.)
#          November 24, 1997 clh - display sub-selections, if any active
#  OBJEXT == path to object with extension
#  OBJECT == object name - simple form (no /jg/serv)
#
# below removed until we decide whether to serve
#<li><a href="/jg/dynopt$FULLOBJ?$subsel">Dynamic Height calculations</a>
#<li><a href="/jg/fullplotopt$FULLOBJ?$subsel">Full Plot</a> Allows 
#specifying details for an X-Y plot
#
require ("cgi-lib.pl");
require "build-opt-env.pl";

#####
#####if ( $#argv == 0 ) then
#####  echo "Content-type: text/html"
#####  echo ""
#####else if ( "$argv[$#argv]" == "-f" ) then
#####else
#####  echo "Content-type: text/html"
#####  echo ""
#####endif

print &PrintHeader();

print "<html><head><title>Download and Other Operations Menu</title></head>";
print "<body>";
print "<h1>Download and Other Operations Menu </h1>";

$EXTURL_NAME=$ENV{"PATH_INFO_PREFIX"} . "OPTION_STRING";
$EXTURL = $ENV{$EXTURL_NAME} ? "{" . $ENV{$EXTURL_NAME} . "}" : "";

$URLFULL = $ENV{"URLOBJX"};
$URLFULL_EXT = $URLFULL . $EXTURL;
$CALLURL = $ENV{"OBJEXT"};
$CALLURL_EXT = $CALLURL . $EXTURL;
$CURROBJ = $ENV{"OBJECT"};
if ( $SUBSELS = $ENV{"SUBSELS"} ) {
  $CURROBJ  .= "(" . $ENV{"DISPSS"} . ")";
  $URLFULL .= "?$SUBSELS";
  $URLFULL_EXT .= "?$SUBSELS";
  $CALLURL .= "?$SUBSELS";
  $CALLURL_EXT .= "?$SUBSELS";
}
print "<b>Current object is:  $CURROBJ</b></br>";

print "<hr noshade>";
print "<p>";

print <<"XXstuffXX";
<ul>

<li>
<b><font size="4">Listing data</font></b>
<ul type=disc>
<li>
<a href="$URLFULL">List at this level</a>
<li>
<a href="/jg/listopt.pl$CALLURL">Other data listing formats</a>
<p>
</ul>

<p>
<li>
<b><font size="4">Downloading data</font></b>
<ul type=disc>
<li>
<a href="/jg/makematlab.pl$CALLURL">Matlab file format</a> 
of all data at this level and further in. (Download will also 'do' matlab)
<a href="/matlab-downloading-help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a> 
<li>
<a href="/jg/makenetcdf.pl$CALLURL">netcdf file format</a> 
<li>
<a href="/jg/makeodv.pl$CALLURL">ODV file format</a> 
<a href="/odv-downloading-help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a> 
<li>
<a href="/jg/download-1$CALLURL_EXT">Download utility</a>
<a href="/download-help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a>
<li>
<a href="/jg/download_inquiry_form.pl$ENV{'PATH_INFO'}">Download inquiry/data pickup</a>
<a href="/download-help.html#deferred">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a>
<p>
</ul>

<p>
<li>
<b><font size="4">Manipulating data</font></b> 

<ul type=disc>
<li>
<a href="/jg/mathopt.pl$CALLURL">Math operations</a> 
for calculating values from existing parameters. 
<a href="/math-help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a>
<li>
<a href="/jg/join-form1.pl$CALLURL">Join 2 objects</a> 
					having at least 1 parameter in common. 
<a href="/joinu_help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a> 
<li>
<a href="/jg/timesplit.pl$CALLURL_EXT">Time field splitting</a>
<a href="/time-splitter-help.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a> 
<li>
<a href="/jg/timecnv.pl$CALLURL_EXT">Time conversions</a>
<li>
<a href="/jg/stat_web_interface.pl$CALLURL">Statistics</a>
</ul>

<p>
<li>
<b><font size="4">Plotting data</font></b>
<ul type=disc>
<li>
<a href="/jg/plotopt$CALLURL">Simple X-Y plot</a>
</ul>

<p>
<li>
<b><font size="4">Persistent objects</font></b>
<ul type=disc>
<li>
<a href="/jg/dir//persistent_objects">Directory of available objects</a>
<li>
<a href="/jg/add_persistent.pl$CALLURL_EXT">Save/remove current object</a>
</ul>

<p>
<li>
<b><font size="4"><a href="/jg/selopt.pl$CALLURL">Subsetting data</a></font></b>
<a href="/subhelp.html">
<img alt="[HELP]" align=absmiddle border=0 src="/images/helpbutton.gif"></a>
</ul>
XXstuffXX


#   Get directory immediately "above" otheropt file
($ooserver_version) = ($ENV{"OPTHOME"} =~ /.*\/(.+)/);
print "<p><hr><font size=-1><i>$version<br>server: $ooserver_version</i></font>";
print "</body>";
print "</html>";

exit;
}
