#!/oracle/app/oracle/product/7.3.3/bin/oraperl

##### set Oracle's variables #####
$ENV{'ORACLE_HOME'}='/oracle/app/oracle/product/7.3.3';
$ENV{'ORACLE_SID'}='rabbit';
$orauser="vod";
$orapass="vod";

#### set web server address ####
$WSA = "http://clarissa.npac.syr.edu/vod";
$PROJDIR="/project/K136/VOD";




$input = <>;
#chop $input;

@param = split(/\&/, $input );

foreach (@param)
{
    ##### for URL decoding ######
    ### convert plus to space ###
    $_ =~ s/\+/ /g;
    ### convert %XX from hex numbers to alphanumeric ###
    $_ =~ s/%(..)/pack("c", hex($1))/ge;

    $clipid = $1 if /clipid=(.*)/;
}

$Date = `date +%d-%b-%y`;

print ("Content-type: TEXT/HTML\n\n");
print <<"EndOfHTML"; 
<HTML>
<head>
<script>
document.bgColor=top.menu.document.bgColor
</script>
<TITLE>Annotate  clip in the Video Database</TITLE>
</head>
<BODY>
<H1>Annotate  clip in the Video Database</H1>
<HR>
EndOfHTML

print "<FORM ACTION=\"annclip\" NAME=\"annfm\" METHOD=\"POST\">";
print "<INPUT TYPE=\"HIDDEN\" VALUE=\"$clipid\" NAME=\"clipid\">";

print <<"EndOfHTML";
EndOfHTML

##### logon Oracle #####
$lda = &ora_login ('', $orauser, $orapass);

$csr = &ora_open 
($lda, " select distinct  title from cliptable where clipid=$clipid ");
($title) = &ora_fetch($csr);
&ora_close($csr);
&ora_logoff($lda);

print <<"EndOfHTML";
<h3> Annotatating video clip "
EndOfHTML
print "$title\"</h3>";
print <<"EndOfHTML";
<BR>
The following entries are <B>optional:</B><P>
<LI>Caption file name (*.cap) : 
<INPUT NAME="capfile" SIZE="45" VALUE=
"$PROJDIR/CP/cap/empty.cap"><BR>

<LI>Fingernail file name (*.gif) : 
<INPUT NAME="fnailfile" SIZE="45" VALUE=
"$PROJDIR/CP/fnail/dummy.gif"><BR>

<LI>Fingernail URL on the server :
<INPUT NAME="fnailurl" SIZE="25" VALUE=
"$WSA/fingernails/dummy.gif"><BR>

<LI>Annotations to the clip: <BR>
Where this annotation starts (enter frame number (0-start)):
<INPUT NAME="ann_start" SIZE="10" VALUE="0"><BR>
Select data type : 
<SELECT NAME="datatype">
<OPTION>NO ANNOTATION
<OPTION>TEXT
<OPTION>HTML
<OPTION>IMAGE
<OPTION>SOUND
</SELECT><BR>
For textual annotations only:
<TEXTAREA NAME="annotations" ROWS="3" COLS="60">
</TEXTAREA>
<P>
<INPUT TYPE="Submit" VALUE="ANNOTATE CLIP">
<INPUT TYPE="Reset" VALUE="RESET">
</FORM>
<HR>
</BODY>
</HTML> 
EndOfHTML
