<form id="formAdd" method="post" action="?action=addlink">
<input type="hidden" name="dosubmit" value="1">
{?if $row.catid>0?}<input type="hidden" name="catid" value="{?$row.catid?}">{?/if?}
<table width="100%" class="grid">
	<tr>
		<td class="tdleft" width="100">上级栏目：</td>
		<td><select name="pid"><option value="0"{?if 0==$Saxue.request.pid?} selected{?/if?}>≡ 作为一级栏目 ≡</option>{?$column?}</select></td>
	</tr>
	<tr>
		<td class="tdleft">栏目名称：</td>
		<td><input type="text" class="text" name="catname" id="catname" size="25" maxlength="30" value="{?$row.catname?}" /></td>
	</tr>
	<tr>
		<td class="tdleft">英文标识：</td>
		<td><input type="text" class="text" name="catdir" id="catdir" size="25" maxlength="20" value="{?$row.catdir?}" onkeyup="value=value.replace(/[^a-z0-9]/g,'');" /></td>
	</tr>
	<tr>
		<td class="tdleft">自定义页：</td>
		<td><input type="text" class="text" name="custom" id="custom" size="25" maxlength="100" value="{?$row.custom?}" /></td>
	</tr>
	<tr>
		<td class="tdleft">URL规则：</td>
		<td><select name="ruleid">{?section name=i loop=$urlrule?}<option value="{?$i['key']?}">{?$i['value']?}</option>{?/section?}</select></td>
	</tr>
	<tr>
		<td colspan="2" style="color:#999">自定义页可填写外部链接（以http://开头）或自定义文件（以/开头相对与网站根目录的文件路径）</td>
	</tr>
</table>
<div><input type="submit" name="submit" id="submit" class="button dodialog" value="提 交"/></div>
</form>
<script type="text/javascript">
$(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();})}});
	$("#catname").formValidator({onshow:"请输入栏目名称",onfocus:"请输入栏目名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入栏目名称"});
	$("#catdir").formValidator({onshow:"请输入英文标识",onfocus:"请输入英文标识"}).regexValidator({regexp:"^[a-zA-Z0-9]{0,30}$",onerror:"英文标识必须为字母、数字"}).inputValidator({min:1,onerror:"请输入英文标识"});
	$("#custom").formValidator({onshow:"请输入自定义页地址",onfocus:"请输入自定义页地址",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入自定义页地址"});
	$("#formAdd").ajaxForm({
        dataType: "json",
        success : function(data){
			if(data.flag == 0){
				doTip(data.msg);
			}else{
				window.top.mainframe.location.href='column.php';
				doDialogClose();
			}
        }
    });
})
</script>