{include file="page_header.htm"}
{insert_scripts files="../js/utils.js"}

<form enctype="multipart/form-data" name="theForm" action="attribute.php" method="post" onsubmit="return validate()">
{foreach from=$attribute_info item=list name=foo}
<table width="100%"  border="0" cellspacing="0" cellpadding="0" class="table_form1" {if $smarty.foreach.foo.index>0} style="display:none" {/if} id="language_{$list.language_id}-table">	

	<tr>
	<td class="label">属性名称:</td>
	<td><input name="attr_name_{$list.language_id}" type="text" value="{$list.attr_name}" style="width:200px;" class="FormSmall" /><span class="required">&nbsp;</span></td>
	</tr>
	{if $smarty.foreach.foo.index == 0}
	<tr>
	<td class="label">属性类型:</td>
	<td>
	<label><input name="attr_input_type" type="radio" value="1"{if $attribute.attr_input_type == 1} checked="checked"{/if} onclick="radio_clicked(1)" /> 文本框</label>
	<label><input name="attr_input_type" type="radio" value="4"{if $attribute.attr_input_type == 4} checked="checked"{/if} onclick="radio_clicked(4)" /> 文本区域</label>
	<label><input name="attr_input_type" type="radio" value="2"{if $attribute.attr_input_type == 2} checked="checked"{/if} onclick="radio_clicked(2)" /> 下拉框</label>
	<label><input name="attr_input_type" type="radio" value="3"{if $attribute.attr_input_type == 3} checked="checked"{/if} onclick="radio_clicked(3)" /> 复选框</label>
	</td>
	</tr>	
	{/if}
	
	<tr>
	<td class="label">可选值列表:</td>
	<td>
	<textarea name="attr_values_{$list.language_id}" id="attr_values_{$list.language_id}" style="width:200px;" rows="5" class="FormSmall">{$list.attr_values}</textarea>	
	<div>一行代表一个可选值（回车换行）。</div>
	</td>
	</tr>	
	
	{if $smarty.foreach.foo.index == 0}
	<tr>
	<td class="label">排序:</td>
	<td><input name="sort_order" type="text" value="{$attribute.sort_order}" style="width:50px;" class="FormSmall" />&nbsp;数字小排在前</td>
	</tr>		
	{/if}
</table>
{/foreach}
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_form">
	<tr>
		<td style="border:none;padding-left:120px;">
		<input type="hidden" name="id" value="{$attribute.attr_id}" />
				<input type="hidden" name="act" value="{$form_act}" />
			<input name="submit" type="submit" value=" 确定 " class="bginput" />
			<input name="reset" type="reset" value=" 重置 " class="bginput" />
		</td>
	</tr>
</table>
</form>

{literal}
<script language="JavaScript">
function validate(){
    validator = new Validator("theForm");
	validator.required("attr_name_{/literal}{$language[0].language_id}{literal}",'属性名称不能为空!');
    return validator.passed();
}

$(document).ready(function(){
	{/literal}
	radio_clicked({$attribute.attr_input_type});
	{literal}
}) 

function radio_clicked(n){
	if(n == 1 || n == 4){
		$('.table_form1').find('textarea').attr('disabled',true);
	}else{
		$('.table_form1').find('textarea').attr('disabled',false);
	}
}
</script>
{/literal}
{insert_scripts files="tab.js,validator.js"}
{include file="page_footer.htm"}