<?php
include("connection.php");
include("frames_header.php");
?>


<?php
	
	$name=$_GET["name"];
	//$name=strtoupper($name);
	if(strlen($name)==0){
	    print '<center><h2><strong>Missing parameter: gene name.</strong></h2></center>';
		include("frames_footer.php");
		return;
	}
	
	
	
	$species=$_GET["species"];

print "<h2><strong><em>Add/Remove Gene synonyms</em></strong> </h2>";

print "<center>";



	print "<br><hr><br>";


	print "<strong>Add a new synonym for <i>".str_replace("cluster","aniseedV3_",$name)."</i>  </strong> <br><br>";
	
	print '<form name="formulaire" action="gene4.php" method="get" target="_blank">';
	
	print '<input name="syno" type="text" size="50"  align="center"> <br><br>';
	print "<input name=\"name\" type=\"hidden\" value=\"".str_replace("cluster","aniseedV3_",$name)."\" >";

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

	print '</form>';
		






	print "<br><hr><br>";


	$requete="SELECT distinct \"GENE_CLUSTER_NAME\" from \"GENE_CONCEPT_NAME\"  where \"GENE_CLUSTER_ID\"='$name'";
	$stmt=pg_query($c,$requete);
/*

		$requete="SELECT \"GENE_ID\" FROM \"GENE\" WHERE \"NAME\"='$name'";

		$stmt=pg_query($c,$requete);

		$row=pg_fetch_array($stmt);

		$molid=$row["GENE_ID"];

		//print "<br>$molid<br>";


	

		print "<center><strong>Remove synonyms from <i>$name</i> <br></strong></name>";

		//$molid='759730';

		$requete="SELECT \"SYNO\" FROM \"SYNO\" WHERE \"GENE_ID\"='$molid' AND \"SYNO\"<>'$name'";
		$stmt=pg_query($c,$requete);
		print "<br>";
		
*/
		//print '<table align="center" border="1">';

		print '<table width="99%" border="0" cellspacing="0" cellpadding="0">';
		print '<tr align="center" valign="middle" bgcolor="#990000"><td> </td><td>Synonyms</td><td background="pictures/barre-red.jpg">&nbsp; &nbsp; &nbsp; &nbsp; </td></tr>';

		print '<tr align="center" valign="middle"> ';


		while ($row=pg_fetch_array($stmt))
		{
				print '<tr align="center" valign="middle">';
		print '<td>';	
		print "<a href=\"gene3.php?species=$species&name=$name&syno=".$row["GENE_CLUSTER_NAME"]."\"> <img border=\"0\" 		src=\"pictures/button-remove.jpg\"></a><br>";
		print '</td>';
		print '<td>';
		print "<strong>&nbsp;&nbsp;".$row["GENE_CLUSTER_NAME"];
		print '</strong></td>';

			/*$requete="SELECT \"GO_TERM\" FROM \"GO\" WHERE \"GO_ID\"='".$row["GO_ID"]."'";
			$stmt2=pg_query($c,$requete);
			$row2=pg_fetch_array($stmt2);
			print '<td>';
			print $row2["GO_TERM"];
			print '</td>';*/

		

		}
		
		print '</table>';




?>


</center>


<?
include ("frames_footer.php");
?>