<?
include ("connection.php");
?>
<html>
<body bgcolor="#999966" text="#FFFFFF" link="#000000" vlink="#000000" alink="#000000">
<title>ANISEED</title>
<br>

<?php
    if ( (!isset($_SESSION["login"]))or(!isset($_SESSION["pass"])) ) {
	    print "<center><strong>you need to <a href=\"login.php\">login</a> as an authorised curator to proceed.</strong>";
	    print '</center></body></html>';
	return;
	}
?>


<?


$id=$_GET["id"];
$pubmedid=$_GET["pubmedid"];
$title=$_GET["title"];
$paper=$_GET["paper"];
$authors=$_GET["authors"];
$url=$_GET["url"];
$comments=$_GET["comments"];
$oldpmid=$_GET["oldpmid"];


$requete="DELETE from \"REFERENCE\" where \"BIO_ID\"='$id' and \"PUBMED_ID\"='$oldpmid'";
pg_query($c,"begin");
pg_query($c,$requete);
pg_query($c,"commit");

$requete2="INSERT INTO \"REFERENCE\"(\"BIO_ID\",\"PUBMED_ID\",\"TITLE\",\"PAPER\",\"AUTHORS\",\"URL\",\"COMMENTS\")
values ('$id','$pubmedid','$title','$paper','$authors','$url','$comments')";
pg_query($c,"begin");
pg_query($c,$requete2);

$requete = "update \"ENTRY_ORIGIN\" set \"ANNOTATOR_ID\"=".$_SESSION['curationauthor'].", \"ANNOTATION_DATE\"=current_date where \"BIO_ID\"=$id";
$resultset = pg_query($c,$requete) or die("<strong>ERROR </strong>".pg_last_error($c));	


pg_query($c,"commit");



		print '<center><H1>Update done for '.$id.'</H1></center>';
		print ' <br><center> To see changes refresh the "IN SITU FULL REPORT" page</center><br>';
		






print '<br><center><input name="Exit" type="button" value="-= Close window =-" onClick="javascript:self.close();"></center>';

?>

<SCRIPT LANGUAGE="JavaScript"> opener.location.reload(); self.close();</script>

</body>
</html>