<?php
	/*
	** File: edit_attribute
	** Description: edit an attribute
	** Version: $Revision: 1.11 $
	** Created: 04/21/1999
	** Author: Leon Atkinson
	** Email: leon@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/12/07 21:45:08 $
	** Log : $Log: edit_attribute,v $
	** Log : Revision 1.11  1999/12/07 21:45:08  leon
	** Log : All forms should be using StartForm now...
	** Log :
	** Log : Revision 1.10  1999/11/08 22:32:24  leon
	** Log : Added prepareText() function to use everywhere we were using htmlentities.
	** Log :
	** Log : Revision 1.9  1999/10/13 22:19:01  chris
	** Log : Moving text into constants in preparation of localization support.
	** Log :
	** Log : Revision 1.8  1999/10/13 00:42:26  chris
	** Log : Moving text into constants in preparation of localization support.
	** Log :
	** Log : Revision 1.7  1999/10/12 00:39:10  chris
	** Log : Moving text into constants in preparation of localization support.
	** Log :
	** Log : Revision 1.6  1999/08/18 22:32:14  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.5  1999/07/28 19:27:31  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_EDITATTRIBUTE_DENIED . "<BR>\n");
	}
	else
	{
		//get item info
		$Query = "SELECT Name, Graphic, DisplayPrecedence ";
		$Query .= "FROM attribute ";
		$Query .= "WHERE ID=$attribute ";
		$DatabaseResult = mysql_query($Query, $DatabaseLink);
		$DatabaseRow = mysql_fetch_row($DatabaseResult);

		$itemName = $DatabaseRow[0]; 
		$itemGraphic = $DatabaseRow[1];
		$itemDisplayPrecedence = $DatabaseRow[2];

		//show form for editing
		print(StartForm("admin_attribute", 'post', 'UPDATE_ATTRIBUTE', FALSE, 
			array("attribute"=>$attribute)));


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

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

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


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


		//Delete this Item
		print("<A HREF=\"" . ScreenURL("admin_attribute") . 
			"&attribute=$attribute&ACTION=DELETE_ATTRIBUTE\">");
		print(L_EDITATTRIBUTE_DELETEATTRIBUTE);
		print("</A><BR>\n");
	}

?>
