#!/bin/csh -f
echo "Content-type: text/html"
echo ""
source build-opt-env
cd ${USETEMPDIR}

#unsetenv PATH_INFO

set CUROPT=(`cat plotopt`)

if ( "${SUBSELS}x" == "x" ) then
  set DISPFULL=${OBJECT}
  set CALLURL=${OBJECT}
  set CALLFULL=${OBJECT}
else
  set DISPFULL="${OBJECT}(${DISPSS})"
  set CALLURL="${OBJECT}?${SUBSELS}"
  set CALLFULL="${OBJECT}(${SUBSELS_QS})"
endif

cat <<XXstuffXX
<html><head><title>Simple XY Plotting</title></head>
<body>
<h1>Simple XY Plot</h1>
<b>Current object is:  $DISPFULL</b></br>
<hr noshade>
<p>
<font size="3">
<a href="/jg/cleanplot${OBJECT}.plotopt?${SUBSELS}">Select this link, if the form looks incomplete</a>.
</font>
<form action="/jg/plotxy$CALLURL" method="POST">
XXstuffXX

${OPTHOME}/bin/listvar "$CALLFULL" > variables

cat <<XXstuffXX
Select an X variable ($CUROPT[1]): <select name="xvar" size="4">
XXstuffXX

${OPTHOME}/bin/nawkscr $CUROPT[1] < variables

cat <<XXstuffXX
</select><br>
Select a reverse or log X axis ($CUROPT[2]):  <select name="xopt">
XXstuffXX

${OPTHOME}/bin/nawkscr $CUROPT[2] << XXSTUFFXX
none
reverse
log
rev/log
XXSTUFFXX

cat <<XXstuffXX
</select>
<br>
Select a Y variable ($CUROPT[3]): <select name="yvar" size="4">
XXstuffXX

${OPTHOME}/bin/nawkscr $CUROPT[3] < variables

cat <<XXstuffXX
</select><br>
Select a reverse or log Y axis ($CUROPT[4]):  <select name="yopt">
XXstuffXX

${OPTHOME}/bin/nawkscr $CUROPT[4]  <<XXSTUFFXX
none
reverse
log
rev/log
XXSTUFFXX

cat <<XXstuffXX
</select><br>
Select a symbol for plotting the values ($CUROPT[5]): <select name="sym">
XXstuffXX

${OPTHOME}/bin/nawkscr $CUROPT[5] <<XXSTUFFXX
line
+
o
x
+(connected)
o(connected)
x(connected)
XXSTUFFXX

cat <<XXstuffXX
</select><p>
<hr noshade>
<input type="submit" value="Make the Plot"> if the selected options are satisfactory.
</form>
</body>
</html>
XXstuffXX
