#!/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;

    $archiveid = $1 if /archiveid=(.*)/;

}

print ("Content-type: TEXT/HTML\n\n");
print <<"EndOfHTML"; 
<HTML>
<head>
<script>
document.bgColor=top.menu.document.bgColor
</script>
<TITLE>Video News Database - Annotate Clip </TITLE>
</head>
<BODY>
<H1>Annotate Clip </H1>
<HR><BR>
<FONT Size="4">Select the clip to annotate<BR>
<FONT SIze="3">
<FORM ACTION="$WSA/cgi-bin/annclipform" METHOD="POST">
<SELECT NAME="clipid" SIZE="10">
EndOfHTML

##### oracle login #####
$lda = &ora_login('', $orauser, $orapass);

if ( $archiveid == 0) {
$csr = &ora_open
($lda, " select distinct clipid, title from cliptable 
         order by title");
} else {
$csr = &ora_open
($lda, " select distinct clipid, title from cliptable 
         where archiveid = $archiveid order by title");
}


while ( ($clipid, $title ) = &ora_fetch($csr))
{
    print ("<OPTION VALUE=\"$clipid\"> $title $clipid \n");
}

&ora_close($csr);

##### oracle logoff ##### 

print <<"EndOfHTML"; 
</SELECT><P>
<INPUT TYPE="Submit" VALUE="OPEN SELECTED CLIP">
<INPUT TYPE="Reset" VALUE="RESET">
</FORM>
<HR>
</BODY>
</HTML>
EndOfHTML

