<?
include ("connection.php");
print "<title>ANISEED CURATOR - Edit Article Phenotypes</title>";
include ("frames_header.php");

$id=$_GET["id"];

if (strlen($id)==0)
	{

	$morpho=$_GET["morphoid"];
	$requete="SELECT \"ARTICLE_ID\",\"TRANSCRIPT\",\"COMMENTS\",\"NAME\",\"DEV_STAGE_ID\" from \"ARTICLE_MORPHOGEN\" where \"MORPHOGEN_ID\"='$morpho'";
	$stmt=pg_query($c,$requete);
	if ($row=pg_fetch_array($stmt)) 
		{
		$id=$row["ARTICLE_ID"];
		$genename=$row["TRANSCRIPT"];
		//$genename=str_replace("cluster","aniseedV3_",$genename);
		$comments=$row["COMMENTS"];
		$name=$row["NAME"];
		$devstage=$row["DEV_STAGE_ID"];

		}


	}





print "<center><h3>Add a Phenotype for the Article $id</h3><br><br></center>";

print "<form name=\"formu\" action=\"edit-article-morphogen2.php\" method=\"POST\">";

/*print "<center>Enter a valid Transcript ID (JGI, Kyotograil, Ensembl) <br> <input style=\"text-align:center;\" type=\"text\" name=\"gene\"  value=\"$genename\" size=\"20\"><br><br>";*/

print "<center>Name: <input type=\"text\" value=\"$name\" name=\"name\"> </center><br><br>";



$requete="SELECT \"DEV_STAGE_ID\",\"NAME\" from \"DEV_STAGE\" where \"SPECIES\"='Ciona intestinalis' order by \"DEV_PERCENT\"";
$stmt=pg_query($c,$requete);


print "<center> Developmental Stage <br><select name=\"devstage\">";

while ($row=pg_fetch_array($stmt))
{
$selected="";
if ($row["DEV_STAGE_ID"]==$devstage) $selected="selected";

print "<option value=\"".$row["DEV_STAGE_ID"]."\" $selected>".$row["NAME"]."</option>";
}

print "</select></center><br><br>";


print "<center>Choose a Transcript ID already entered from this Article <br>";
print "<select name=\"gene\">";
$requete="SELECT \"TRANSCRIPT\" from \"ARTICLE_GENE\" where \"ARTICLE_ID\"='$id' and \"TYPE\"='Function' order by \"TRANSCRIPT\"";
$stmt=pg_query($c,$requete);
while ($row=pg_fetch_array($stmt))
{
$selected="";
if ($row["TRANSCRIPT"]==$genename) $selected="selected";
print "<option $selected>".$row["TRANSCRIPT"]."</option>";


}


print "</select><br><br>";

print "Comments <br><textarea name=\"comments\" rows=\"10\" cols=\"80\">$comments</textarea>";


print "<br><br><input name=\"submit\" type=\"image\" src=\"pictures/button-submit.jpg\" onClick=\"submit\">";

if (strlen($morpho)>0) print "<input type=\"hidden\" name=\"morphoid\" value=\"$morpho\">";

print "<input type=\"hidden\" name=\"id\" value=\"$id\">";



print "</form>";


include ("frames_footer.php");
?>