<?

include ("connection.php");
include ("frames_header.php");

$ish=$_GET["ish"];
$id=$ish;

print "<h2>Annotation help with embryo schema</h2><br><br>";

//recherche des images
$requete="SELECT \"PICTURE_ID\", \"CONTROL\", \"PATH\" FROM \"PICTURE\" WHERE \"IN_SITU_ID\" = $id";
$stmt = pg_query($c,$requete);	
$booli=0;
while($row=pg_fetch_array($stmt)){
	$idpicture=$row["PICTURE_ID"];
		print '<center><table border="0" cellspacing="0" cellpadding="0">';
			if(strlen($row["PATH"])>0)
				{
				  if (!preg_match("/mix/",$row["PATH"]))
					echo "<tr><td><img src=\"picturesDB/".$row["PATH"]."\" border=\"1\" width=\"180\" name=\"$idpicture\" onClick=\"self.growPics2(this);\"></td></tr> ";
				  else 
					{
					if ($booli==0) 
						{
						$booli++;
						print '<img src="pictures/button-mix.jpg" border="0" onClick="window.open(\'viewmixes.php?id='.$id.'\')">';
						}
					}
				}
			else
			    echo "<tr><td><img src=\"picture.php?id=$idpicture\" border=\"1\" width=\"180\" name=\"$idpicture\" onClick=\"self.growPics(this);\"></td></tr> ";

			    if ($row["CONTROL"]=="y"){
					    print "<tr><td align=\"center\" valign=\"center\"><H4>Control&nbsp; <a href=\"linkcontrol.php?idmutant=$id\" target=\"_blank\"><img src=\"pictures/button-cur-edit.gif\" title=\"Edit\" border=\"0\"></a></H4></td></tr>";

								  

							//On teste voir si il y a un lien vers la page de l'ish
							$r="SELECT \"CTRL_ISH_ID\" from \"MUTANT\" where \"IN_SITU_ID\"='$id'";
							$st=pg_query($c,$r);
							$ro=pg_fetch_array($st);
							if (strlen($ro["CTRL_ISH_ID"])!=0) 
							{
							print "<tr><td align=\"center\"><a href=\"insitu.php?id=".$ro["CTRL_ISH_ID"]."\" target=\"_blank\">View ISH</a></td></tr>
							<tr><td align=\"center\"><a target=\"_blank\" href=\"deletelinkctrl.php?id=$id\">Delete link</a></td></tr>";
							}
							else
							{
							$r="SELECT \"CTRL_ISH_ID\" from \"EMBRYO_MANIP\" where \"IN_SITU_ID\"='$id'";
							$st=pg_query($c,$r);
							$ro=pg_fetch_array($st);

							if (strlen($ro["CTRL_ISH_ID"])!=0) 
							{
							print "<tr><td align=\"center\"><a href=\"insitu.php?id=".$ro["CTRL_ISH_ID"]."\" target=\"_blank\">View ISH</a></td></tr><tr><td align=\"center\"><a target=\"_blank\" href=\"deletelinkctrl.php?id=$id\">Delete link</a></td></tr>";
							}
							}
								}
 								print '<tr><td>&nbsp;</td></tr></table></center>';
							}
							
							//if ($booli!=0) print '<img src="pictures/button-mix.jpg" border="0" onClick="window.open(\'viewmixes.php?id='.$id.'\')">';

				//print "<a href=\"viewmixes.php?id=$id\">Visualise mixed stage ISHs</a>";
							
							
							//echo "<img src=\"picture.php?id=$id\">&nbsp;"
							//echo "<a href=\"insitu-original-picture.php?id=$id\">Get the original file</a>" 
							?>

<center><img src="combi.php?ish=<? print $ish ?>"></center>
<br><br><br>
Existing annotation<br>

<?

$requete="
select \"NAME\" from \"ANAT_ENTITY\" where \"ANAT_ID\" in (
SELECT distinct \"REGION_ID\" from \"TARGET\" where \"IN_SITU_ID\"='$ish')";
$stmt=pg_query($c,$requete);
print "<center>";
while ($row=pg_fetch_array($stmt))
{
print "<b>".$row["NAME"]." </b>&nbsp; ";

}
print "</center>";


?>





<?
include ("frames_footer.php");

?>