<?php
	/*
	** File: edit_variation
	** Description: edit a variation
	** Version: $Revision: 1.10 $
	** Created: 04/21/1999
	** Author: Leon Atkinson
	** Email: leon@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/12/07 21:45:10 $
	** Log : $Log: edit_variation,v $
	** Log : Revision 1.10  1999/12/07 21:45:10  leon
	** Log : All forms should be using StartForm now...
	** Log :
	** Log : Revision 1.9  1999/11/08 22:32:26  leon
	** Log : Added prepareText() function to use everywhere we were using htmlentities.
	** Log :
	** Log : Revision 1.8  1999/10/13 22:19:03  chris
	** Log : Moving text into constants in preparation of localization support.
	** Log :
	** Log : Revision 1.7  1999/10/13 00:42:29  chris
	** Log : Moving text into constants in preparation of localization support.
	** Log :
	** Log : Revision 1.6  1999/08/18 22:32:17  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.5  1999/07/28 19:27:32  leon
	** Log : Mass update based on code donation from a live project
	** Log :
	**
	** Copyright (c) 1999 Working Dogs.  All rights reserved.
	*/

	/* Make sure the user has admin rights. */
	if( !$UserInfo["Permission"]["Administrate"] )
	{
		print(L_EDITVARIATION_DENIED . "<BR>\n");
	}
	else
	{
		//get variation info
		$Query = "SELECT Name, Description, Graphic, DisplayPrecedence ";
		$Query .= "FROM variation ";
		$Query .= "WHERE ID=$variation ";
		$DatabaseResult = mysql_query($Query, $DatabaseLink);
		$DatabaseRow = mysql_fetch_row($DatabaseResult);

		$variationName = $DatabaseRow[0]; 
		$variationDescription = $DatabaseRow[1]; 
		$variationGraphic = $DatabaseRow[2];
		$variationDisplayPrecedence = $DatabaseRow[3];

		//show form for editing

		print(StartForm("admin_attribute", 'post', 'UPDATE_VARIATION', FALSE, 
			array("variation"=>$variation)));

		print(L_EDITVARIATION_NAME);
		print("<INPUT TYPE=\"text\" NAME=\"inputName\" SIZE=\"32\" ");
		print("VALUE=\"" . prepareText($variationName));
		print("\">");
		print("<BR>\n");

		print(L_EDITVARIATION_DESCRIPTION);
		print("<INPUT TYPE=\"text\" NAME=\"inputDescription\" SIZE=\"32\" ");
		print("VALUE=\"" . prepareText($variationDescription));
		print("\">");
		print("<BR>\n");

		print(L_EDITVARIATION_GRAPHIC);
		print("<INPUT TYPE=\"text\" NAME=\"inputGraphic\" SIZE=\"32\" ");
		print("VALUE=\"$variationGraphic\">");
		print("<BR>\n");

		print(L_EDITVARIATION_DISPLAYPRECEDENCE);
		print("<INPUT TYPE=\"text\" NAME=\"inputDisplayPrecedence\" ");
		print("SIZE=\"2\"  VALUE=\"$variationDisplayPrecedence\">");
		print("<BR>\n");


		print("<INPUT TYPE=\"submit\" VALUE=\"" . L_EDITVARIATION_UPDATEVARIATION . "\">\n");
		print("</FORM>\n");


		//Delete this variation
		print("<A HREF=\"" . ScreenURL("admin_attribute") . 
			"&variation=$variation&ACTION=DELETE_VARIATION\">");
		print(L_EDITVARIATION_DELETEVARIATION);
		print("</A><BR>\n");
	}

?>
