<table width="100%" class="topmenu">
	<tr><td>
		<a href="expand.php"><em>扩展属性管理</em></a><span>|</span>
		<a href="expand.php?action=add" class="on"><em>添加扩展属性</em></a><span>|</span>
		<a href="expand.php?action=cache"><em>生成表单缓存</em></a>
	</td></tr>
</table>
<table width="100%" class="sgrid">
	<tr><td>文章扩展属性非数据表字段，不入库，更改属性名称和选项值会造成数据丢失，请不要随意更改属性名称和选项值<br>新增扩展属性，表单模版留空，系统自动生成表单模版<br>请在添加、修改或删除全部完成后，<a href="?action=cache">生成表单缓存</a></td></tr>
</table><br>
<form id="formAdd" method="post" action="?action=add">
<input type="hidden" name="dosubmit" value="1">
{?if $row.eid>0?}<input type="hidden" name="eid" value="{?$row.eid?}">{?/if?}
<table width="100%" class="grid" cellspacing="1" align="center">
	<tr>
		<td width="100" class="tdleft"><span class="red">*</span> 属性名称：</td>
		<td><input type="text" class="text" name="name" id="name" size="25" maxlength="30" value="{?$row.name?}" onkeyup="value=value.replace(/[^a-z]/g,'');" /></td>
	</tr>
	<tr>
		<td class="tdleft"><span class="red">*</span> 属性标题：</td>
		<td><input type="text" class="text" name="title" id="title" size="25" maxlength="50" value="{?$row.title?}" /></td>
	</tr>
	<tr>
		<td class="tdleft">属性类型：</td>
		<td><select class="select" name="type" onchange="changeform($(this).val())">{?section name=i loop=$types?}<option value="{?$i['key']?}"{?if $i['key']==$row.type?} selected{?/if?}>{?$i['value']?}</option>{?/section?}</select></td>
	</tr>
	<tr>
		<td class="tdleft">填写说明：</td>
		<td><input type="text" class="text" name="intro" id="intro" size="50" maxlength="100" value="{?$row.intro?}" /></td>
	</tr>
	<tr>
		<td class="tdleft">是否必填：</td>
		<td><select class="select" name="required"><option value="0"{?if 0==$row.required?} selected{?/if?}>否</option><option value="1"{?if 1==$row.required?} selected{?/if?}>是</option></select></td>
	</tr>
	<tr>
		<td class="tdleft">属性排序：</td>
		<td><input type="text" class="text" name="listorder" id="listorder" size="25" maxlength="10" value="{?$row.listorder?}" onkeyup="value=value.replace(/[^0-9]/g,'');" /></td>
	</tr>
	<tr>
		<td class="tdleft">后台表单模版：</td>
		<td><textarea class="textarea" name="adminform" id="adminform" rows="7" style="width:100%">{?$row.adminform?}</textarea><br><span class="gray">管理后台添加数据使用的表单模版，一般不用更改，留空时使用默认模版</span></td>
	</tr>
	<tr>
		<td class="tdleft">前台表单模版：</td>
		<td><textarea class="textarea" name="userform" id="userform" rows="9" style="width:100%">{?$row.userform?}</textarea><br><span class="gray">会员中心投稿使用的表单模版，默认会员中心模版不用更改，留空时使用默认模版</span></td>
	</tr>
	<tr>
		<td class="tdleft">可用选项值：</td>
		<td><textarea class="textarea" name="options" id="options" rows="5" cols="60">{?$row.options?}</textarea><br><span class="hottext">当属性类型为Checkbox，Radio，Select时，此处填写被选择的项目，用“,”分开，如“男,女”</span></td>
	</tr>
	<tr>
		<td class="tdleft">应用于分类：</td>
		<td><select name="cids[]" id="cids[]" multiple style="height:200px;">{?$cates?}</select>&nbsp;<span class="gray">按住“Ctrl”可多选</span></td>
	</tr>
	<tr>
		<td class="tdleft">&nbsp;</td>
		<td><input type="submit" class="button" name="submit"  id="submit" value="提交" /></td>
	</tr>
</table>
</form>

<script language="javascript" type="text/javascript">
function changeform(type){
	$('#adminform').val('');
	$('#userform').val('');
}
$(function(){
	$.formValidator.initConfig({formid:"formAdd",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'250',height:'50'}, function(){this.close();$(obj).focus();})}});
	$("#name").formValidator({onshow:"请输入属性名称",onfocus:"属性名称不超过30个英文字母",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入属性名称"});
	$("#title").formValidator({onshow:"请输入属性标题",onfocus:"属性标题不超过30个字符",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入属性标题"});
})
</script>