<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
function F_GetTable(t)
	dim rsSchema,sele,ret
	ret=ret&"<option value="""">选择表</option>"
	set rsSchema=conn.openSchema(20)
	rsSchema.movefirst
	Do Until rsSchema.EOF
		if rsSchema("TABLE_TYPE")="TABLE" then
			if(rsSchema("TABLE_NAME")=t) then
				sele=" selected=""selected"""
			else
				sele=""
			end if
			ret=ret&"<option value="""&rsSchema("TABLE_NAME")&""""&sele&">"&rsSchema("TABLE_NAME")&"</option>"&Chr(10)
		end if
		rsSchema.movenext
	loop
	rsSchema.close
	set rsSchema=nothing
	F_GetTable=ret
end function

function FormMap(ftype)
	dim ret
	select case ftype
		case "text"
			ret="文本"
		case "password"
			ret="密码框"
		case "select"
			ret="下拉框"
		case "radio"
			ret="单选框"
		case "checkbox"
			ret="复选框"
		case "textarea"
			ret="多行文本框"
		case "editor"
			ret="编辑器"
		case "img"
			ret="图片"
		case "file"
			ret="文件"
		case "date"
			ret="日期"
		case "color"
			ret="颜色"
	end select
	FormMap=ret
end function
%>
<html>
<head>
<title>字段管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
<link href="/js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {color: #CCCCCC}
.style3 {color: #FFFFFF;
	font-weight: bold;
}
#PostForm label.error {
	margin-left: 10px;
	width: auto;
	display: inline;
	color:#F00;
}
-->
</style>
<script type="text/javascript" src="/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.10/js/jquery-ui-1.8.10.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.validate/jquery.validate.min.js"></script>
<script language="javascript">
function goto(frm)
{
	var gourl ="?";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
function ch(v){
	var pattern = /^[a-zA-Z0-9_]+$/; 
	var r=pattern.test(v.value);
	if(!r){
		alert('只能填写英文、数字和下划线');
		v.focus();
	}
}
function getField(tbl,fid){
	$('#ValueField')[0].options.length=0;
	$('#TextField')[0].options.length=0;
	$.ajax({ 
      url:'fields_getxml.asp?table='+tbl,      //异步方法
      type: 'get', 
      dataType: 'xml', 
      timeout: 1000,                            //延迟1秒执行
      error: function(){                        //返回失败后
      	alert('Error loading XML document'); 
      }, 
      success: function(xml){              //返回成功
       $(xml).find("field").each(function(){         //找到根节点
           var t=$(this).children("title").text(); 					 
					 $('#ValueField')[0].options.add(new Option(t,t));
           $('#TextField')[0].options.add(new Option(t,t));
       });
     } 
    });   
}
</script>
<script type="text/javascript"> 
$().ready(function() {
	// validate signup form on keyup and submit
	$("#PostForm").validate({
		rules: {
			FName: "required",
			FTitle: "required",
			FLen: {
				required: true,
				min: 1
			},
			FormTitle: "required",
			FSort: {
				required: true,
				min: 1
			}
		},
		messages: {
			FName: "请填写字段名称",
			FTitle: "请填写字段描述",
			FLen: {
				required: "请填写字段长度",
				min: "必需是大于1的数字"
			},
			FormTitle:"请填写表单名称",
			FSort: {
				required: "请填写排序",
				min: "必需是大于1的数字"
			}
		}
	});
	$('#BindDb').click(function(){
		if(this.checked){
			$('#BindDiv').show('slow');
		}else{
			$('#BindDiv').hide();
		}
	});
});
</script>


</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
dim act,moduleid
moduleid=clng(request.QueryString("moduleid"))
act=trim(request.QueryString("act"))
if isempty(act) or act="" then
	call Func_List
elseif(act="add") then
	call Func_Add
elseif(act="addok") then
	call Func_AddOk
elseif(act="mod") then
	call Func_Mod
elseif(act="modok") then
	call Func_ModOk
elseif(act="del") then
	call Func_Del
end if
%>
<%
Sub Func_Del
	dim id,rs,fname,isshowinlist,modid
	id=Clng(request.QueryString("id"))
	set rs=conn.execute("select ModuleId,FName,ShowInList from t_fields where id="&id)
	if not rs.eof then
		modid=rs(0)
		fname=rs(1)
		isshowinlist=rs(2)
	end if
	rs.close
	set rs=nothing
	conn.execute("delete from t_fields where id="&id)
	dim tbl_name,listfields
	set rs=server.createobject("adodb.recordset")
	rs.open "select TableName,ListFields from t_module where id="&modid,conn,3,1
	if not rs.eof then
		tbl_name=rs(0)
		listfields=rs(1)
	end if
	rs.close
	set rs=nothing
	conn.execute("ALTER TABLE "&tbl_name&" DROP COLUMN "&FName)
	if(isshowinlist>0) then
		listfields=replace(listfields,fname,"")
		listfields=replace(listfields,",,",",")
	end if
	conn.execute("update t_module set ListFields='"&listfields&"' where id="&modid)
	response.Redirect("fields.asp?moduleid="&moduleid)
end sub

Sub Func_Add
%>
<FORM action="?act=addok&moduleid=<%=moduleid%>" method="POST" name="PostForm" id="PostForm" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style3">添加字段</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="23%"><div align="right">字段名称：</div></TD>
  <TD width="77%"><input name="FName" type="text" id="FName" size="35" onBlur="ch(this)">
    请以英文、数字、下划线命名</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="23%"><div align="right">字段描述：</div></TD>
  <TD width="77%"><input name="FTitle" type="text" id="FTitle" size="35"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>字段类型：</TD>
  <TD align=left><select name="FType" id="FType">
    <option value="varchar">字符型(varchar)</option>
    <option value="int">整型(int)</option>
    <option value="bigint">长整型(bigint)</option>
    <option value="datetime">日期(datetime)</option>
    <option value="decimal">货币数字(decimal)</option>
    <option value="tinyint">小数字型(tinyint)</option>
    <option value="text">备注(text)</option>
  </select>
    长度：
    <input name="FLen" type="text" id="FLen" value="50" size="10"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单类型：</TD>
  <TD align=left>
  <select name="FormType" id="FormType">
  <option value="text" selected>单行文本框(text)</option>
  <option value="password">密码框(password)</option>
  <option value="select">下拉框(select)</option>
  <option value="radio">单选框(radio)</option>
  <option value="checkbox">复选框(checkbox)</option>
  <option value="textarea">多行文本框(textarea)</option>
  <option value="editor">编辑器(editor)</option>
  <option value="img">图片(img)</option>
  <option value="file">文件(file)</option>
  <option value="date">日期(date)</option>
  <option value="color">颜色(color)</option>
  </select></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单标题：</TD>
  <TD align=left><input type="text" name="FormTitle" id="FormTitle">
    排序：
      <input name="FSort" type="text" id="FSort" value="1" size="5">
      越小越靠前</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>默 认 值：</TD>
  <TD align=left><textarea name="FormDefault" id="FormDefault" cols="45" rows="5"></textarea>
    <br>
    <input name="BindDb" type="checkbox" id="BindDb" value="1">
    绑定数据表中数据<br>
    <div id="BindDiv">
    选 择 表：
      <select name="BindTable" id="BindTable" onChange="getField(this.options[this.selectedIndex].value,'')">
    <%=F_GetTable("")%>
    </select>
    <br>
    值 字 段：
    
    <select name="ValueField" id="ValueField">
    </select>
    <br>
    文本字段：
    <select name="TextField" id="TextField">
    </select>
    </div>
    </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单样式：</TD>
  <TD align=left><input name="FStyle" type="text" id="FStyle" value="style=&quot;width:100px;&quot;" size="55">
    <br>
    例：class=&quot;css_input&quot;或style=&quot;width:100px;&quot;</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>列表字段：</TD>
  <TD align=left><input name="ListField" type="radio" id="radio" value="1" checked>
    是
      <input type="radio" name="ListField" id="radio2" value="0"> 
      否
      <br>
      选择&ldquo;是&rdquo;，后台内容管理列表中将出现。</TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=left><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end Sub
Sub Func_AddOk
	dim FName,FTitle,FType,FLen,FormType,FormTitle,FSort,FormDefault,BindDb,BindTable,ValueField,TextField,FStyle,ListField
	FName=request.Form("FName")
	FTitle=request.Form("FTitle")
	FType=request.Form("FType")
	FLen=Cint(request.Form("FLen"))
	FormType=request.Form("FormType")
	FormTitle=request.Form("FormTitle")
	FSort=Cint(request.Form("FSort"))
	FormDefault=request.Form("FormDefault")
	BindDb=request.Form("BindDb")
	if(BindDb<>"") then
		BindDb=Cint(BindDb)
		BindPara=request.Form("BindTable")&"|"&request.Form("ValueField")&"|"&request.Form("TextField")
	else
		BindDb=0
		BindPara=""
	end if
	BindTable=request.Form("BindTable")
	ValueField=request.Form("ValueField")
	TextField=request.Form("TextField")
	FStyle=request.Form("FStyle")
	ListField=request.Form("ListField")
	if(ListField<>"") then
		ListField=Cint(ListField)
	else
		ListField=0
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 * from t_fields where FName='"&FName&"' and moduleid="&moduleid,conn,3,3
	if not rs.eof then
		response.Write("<script>alert(""该字段已存在!"");history.back();</script>")
		response.End()
	else
		rs.addnew
		rs("ModuleId")=moduleid
		rs("FName")=FName
		rs("FTitle")=FTitle
		rs("FType")=FType		
		rs("FLen")=FLen
		rs("FormType")=FormType		
		rs("FormTitle")=FormTitle
		rs("FSort")=FSort		
		rs("FStyle")=FStyle
		rs("FormDefault")=FormDefault
		rs("IsBindTable")=BindDb		
		rs("BindPara")=BindPara
		rs("ShowInList")=ListField
		rs.update	
		response.Write("<p align=""center"">添加字段成功~!</p>")
		response.Write("<p align=""center""><a href=""?moduleid="&moduleid&""">返回</a></p>")
	end if
	rs.close
	set rs=nothing
	dim tbl_name,listfields
	set rs=server.createobject("adodb.recordset")
	rs.open "select TableName,ListFields from t_module where id="&moduleid,conn,3,1
	if not rs.eof then
		tbl_name=rs(0)
		listfields=rs(1)
	end if
	rs.close
	set rs=nothing
	'加字段
	if(FType="varchar") then
		FType=FType&"("&FLen&")"
	end if
	conn.execute("alter table "&tbl_name&" add "&FName&" "&FType)
	'列表字段
	if(ListField=1) then
		listfields=listfields&","&FName
		conn.execute("update t_module set ListFields='"&listfields&"' where id="&moduleid)
	end if
end Sub
Sub Func_ModOk
	dim id
	id=Clng(request.QueryString("id"))
	dim FName,FTitle,FType,FLen,FormType,FormTitle,FSort,FormDefault,BindDb,BindTable,ValueField,TextField,FStyle,ListField
	FName=request.Form("FName")
	FTitle=request.Form("FTitle")
	FType=request.Form("FType")
	FLen=Cint(request.Form("FLen"))
	FormType=request.Form("FormType")
	FormTitle=request.Form("FormTitle")
	FSort=Cint(request.Form("FSort"))
	FormDefault=request.Form("FormDefault")
	BindDb=request.Form("BindDb")
	if(BindDb<>"") then
		BindDb=Cint(BindDb)
		BindPara=request.Form("BindTable")&"|"&request.Form("ValueField")&"|"&request.Form("TextField")
	else
		BindDb=0
		BindPara=""
	end if
	BindTable=request.Form("BindTable")
	ValueField=request.Form("ValueField")
	TextField=request.Form("TextField")
	FStyle=request.Form("FStyle")
	ListField=request.Form("ListField")
	if(ListField<>"") then
		ListField=Cint(ListField)
	else
		ListField=0
	end if
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from t_fields where id="&id,conn,3,3
	if not rs.eof then
		rs("FTitle")=FTitle		
		rs("FLen")=FLen
		rs("FormType")=FormType		
		rs("FormTitle")=FormTitle
		rs("FSort")=FSort		
		rs("FStyle")=FStyle
		rs("FormDefault")=FormDefault
		rs("IsBindTable")=BindDb		
		rs("BindPara")=BindPara
		rs("ShowInList")=ListField
		rs.update	
		response.Write("<p align=""center"">修改字段成功~!</p>")
		response.Write("<p align=""center""><a href=""?moduleid="&moduleid&""">返回</a></p>")
	end if
	rs.close
	set rs=nothing
	dim tbl_name,listfields
	set rs=server.createobject("adodb.recordset")
	rs.open "select TableName,ListFields from t_module where id="&moduleid,conn,3,1
	if not rs.eof then
		tbl_name=rs(0)
		listfields=rs(1)
	end if
	rs.close
	set rs=nothing
	'改字段
	if(FType="varchar") then
		FType=FType&"("&FLen&")"
	end if
	'conn.execute("alter table "&tbl_name&" ALTER COLUMN  "&FName&" "&FType)
	'列表字段
	if(ListField=1) then
		if(instr(ListField,FName)>0) then
		else
			listfields=listfields&","&FName
			listfields=replace(listfields,",,",",")
			conn.execute("update t_module set ListFields='"&listfields&"' where id="&moduleid)
		end if
	else
		listfields=replace(listfields,FName,"")
		listfields=replace(listfields,",,",",")
		conn.execute("update t_module set ListFields='"&listfields&"' where id="&moduleid)
	end if
end Sub
Sub Func_Mod
	dim id,rs
	id=Clng(request.QueryString("id"))
	set rs=conn.execute("select * from t_fields where id="&id)
	if not rs.eof then
%>
<FORM action="?act=modok&id=<%=id%>&moduleid=<%=moduleid%>" method="POST" name="PostForm" id="PostForm" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style3">修改字段</div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="23%"><div align="right">字段名称：</div></TD>
  <TD width="77%"><input name="FName" type="text" id="FName" value="<%=rs("FName")%>" size="35" readonly="readonly">
    请以英文、数字、下划线命名</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="23%"><div align="right">字段描述：</div></TD>
  <TD width="77%"><input name="FTitle" type="text" id="FTitle" value="<%=rs("FTitle")%>" size="35"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>字段类型：</TD>
  <TD align=left><select name="FType" id="FType" disabled>
    <option value="varchar"<%if(rs("FType")="varchar") then response.Write(" selected=""selected""") end if%>>字符型(varchar)</option>
    <option value="int"<%if(rs("FType")="int") then response.Write(" selected=""selected""") end if%>>整型(int)</option>
    <option value="bigint"<%if(rs("FType")="bigint") then response.Write(" selected=""selected""") end if%>>长整型(bigint)</option>
    <option value="datetime"<%if(rs("FType")="datetime") then response.Write(" selected=""selected""") end if%>>日期(datetime)</option>
    <option value="decimal"<%if(rs("FType")="decimal") then response.Write(" selected=""selected""") end if%>>货币数字(decimal)</option>
    <option value="tinyint"<%if(rs("FType")="tinyint") then response.Write(" selected=""selected""") end if%>>小数字型(tinyint)</option>
    <option value="text"<%if(rs("FType")="text") then response.Write(" selected=""selected""") end if%>>备注(text)</option>
  </select>
    长度：
    <input name="FLen" type="text" id="FLen" value="<%=rs("FLen")%>" size="10"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单类型：</TD>
  <TD align=left>
  <select name="FormType" id="FormType">
  <option value="text"<%if(rs("FormType")="text") then response.Write(" selected=""selected""") end if%>>单行文本框(text)</option>
  <option value="password"<%if(rs("FormType")="password") then response.Write(" selected=""selected""") end if%>>密码框(password)</option>
  <option value="select"<%if(rs("FormType")="select") then response.Write(" selected=""selected""") end if%>>下拉框(select)</option>
  <option value="radio"<%if(rs("FormType")="radio") then response.Write(" selected=""selected""") end if%>>单选框(radio)</option>
  <option value="checkbox"<%if(rs("FormType")="checkbox") then response.Write(" selected=""selected""") end if%>>复选框(checkbox)</option>
  <option value="textarea"<%if(rs("FormType")="textarea") then response.Write(" selected=""selected""") end if%>>多行文本框(textarea)</option>
  <option value="editor"<%if(rs("FormType")="editor") then response.Write(" selected=""selected""") end if%>>编辑器(editor)</option>
  <option value="img"<%if(rs("FormType")="img") then response.Write(" selected=""selected""") end if%>>图片(img)</option>
  <option value="file"<%if(rs("FormType")="file") then response.Write(" selected=""selected""") end if%>>文件(file)</option>
  <option value="date"<%if(rs("FormType")="date") then response.Write(" selected=""selected""") end if%>>日期(date)</option>
  <option value="color"<%if(rs("FormType")="color") then response.Write(" selected=""selected""") end if%>>颜色(color)</option>
  </select></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单标题：</TD>
  <TD align=left><input name="FormTitle" type="text" id="FormTitle" value="<%=rs("FormTitle")%>">
    排序：
      <input name="FSort" type="text" id="FSort" value="<%=rs("FSort")%>" size="5">
      越小越靠前</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>默 认 值：</TD>
  <TD align=left><textarea name="FormDefault" id="FormDefault" cols="45" rows="5"><%=rs("FormDefault")%></textarea>
    <br>
    <input name="BindDb" type="checkbox" id="BindDb" value="1"<%if(rs("IsBindTable")=1) then response.Write(" checked") end if%>>
    绑定数据表中数据<br>
    <div id="BindDiv">
    <%
		dim BindPara,BindTable,ValueField,bdarr,TextField
		BindPara=rs("BindPara")
		if(BindPara<>"") then
			bdarr=split(BindPara,"|")
			BindTable=bdarr(0)
			ValueField=bdarr(1)
			TextField=bdarr(2)
		end if
		%>
    选 择 表：
      <select name="BindTable" id="BindTable">
    <%=F_GetTable(BindTable)%>
    </select>
    <br>
    值 字 段：
    <input name="ValueField" type="text" id="ValueField" value="<%=ValueField%>">
    <br>
    文本字段：
    <input name="TextField" type="text" id="TextField" value="<%=TextField%>">
    
    </div>
    </TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>表单样式：</TD>
  <%
	FStyle=rs("FStyle")
	if(FStyle<>"") then
		FStyle=replace(FStyle,"""","&quot;")
	end if
	%>
  <TD align=left><input name="FStyle" type="text" id="FStyle" value="<%=FStyle%>" size="55">
    <br>
    例：class=&quot;css_input&quot;或style=&quot;width:100px;&quot;</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD align=right>列表字段：</TD>
  <TD align=left><input name="ListField" type="radio" id="radio" value="1"<%if(rs("ShowInList")=1) then response.Write(" checked=""checked""") end if%>>
    是
      <input type="radio" name="ListField" id="radio2" value="0"<%if(rs("ShowInList")=0) then response.Write(" checked=""checked""") end if%>> 
      否
      <br>
      选择&ldquo;是&rdquo;，后台内容管理列表中将出现。</TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=left><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
	end if
	rs.close
	set rs=nothing
end Sub
Sub Func_List
	dim BeginTime,i,currentpage,allrec,totalpage,n,p
	BeginTime=Timer
	const recpage=20
	if not isempty(request("page")) and request("page")<>"" then 
		currentpage=Clng(request("page"))
	else
		currentpage=1
	end if
%>
<div class="topic"><a href="?act=add&moduleid=<%=moduleid%>">添加新字段--&gt;</a></div>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="10"><div align="center"><span class="style3">◆ 管理字段 ◆</span></div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="5%" height="22"><div align="center">id</div></td>
    <td width="18%"><div align="center">字段名</div></td>
    <td width="17%"><div align="center">描述</div></td>
    <td width="15%" align="center">字段类型</td>
    <td width="15%" align="center">表单类型</td>
    <td width="10%" align="center">列表字段</td>    
    <td width="10%"><div align="center">修改</div></td>
    <td width="10%"><div align="center">删除</div></td>
  </tr>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center">#</div></td>    
    <td bgcolor="#FFFFFF"><div align="center" class="style1">Title</div></td>
    <td bgcolor="#FFFFFF"><div align="center">标题(系统字段)</div></td>
    <td align="center" bgcolor="#FFFFFF">varchar</td>
    <td align="center" bgcolor="#FFFFFF">文本</td>
    <td align="center" bgcolor="#FFFFFF">&nbsp;</td>    
    <td bgcolor="#FFFFFF"><div align="center"><em>修改</em></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><em>删除</em></div></td>
  </tr>  
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center">#</div></td>    
    <td bgcolor="#FFFFFF"><div align="center" class="style1">ClassId</div></td>
    <td bgcolor="#FFFFFF"><div align="center">栏目分类(系统字段)</div></td>
    <td align="center" bgcolor="#FFFFFF">int</td>
    <td align="center" bgcolor="#FFFFFF">下拉列表</td>
    <td align="center" bgcolor="#FFFFFF">&nbsp;</td>    
    <td bgcolor="#FFFFFF"><div align="center"><em>修改</em></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><em>删除</em></div></td>
  </tr>
  <%
  		set rs=server.createobject("adodb.recordset")
  		rs.open "select count(*) AS co from t_fields where ModuleId="&moduleid,conn,3,1
		allrec=rs(0)
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select id,FName,FTitle,Ftype,FormType,ShowInList from t_fields where ModuleId="&moduleid&" order by FSort asc"
		rs.open sql,conn,3,1		
		do while not rs.eof		
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=rs(0)%></div></td>    
    <td bgcolor="#FFFFFF"><div align="center"><%=rs(1)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs(2)%></div></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs(3)%></td>
    <td align="center" bgcolor="#FFFFFF"><%=FormMap(rs(4))%></td>
    <td align="center" bgcolor="#FFFFFF"><%if(rs(5)=1) then response.Write("<span style=""color:red;"">是</span>") else response.Write("否") end if%></td>    
    <td bgcolor="#FFFFFF"><div align="center"><a href="?act=mod&id=<%=rs(0)%>&moduleid=<%=moduleid%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="?act=del&id=<%=rs(0)%>&moduleid=<%=moduleid%>" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>  
  <%
    	rs.movenext
	  loop
	  rs.close
	  set rs=nothing
  %>  
</table>
<div class="topic">
提示：自定义字段如果要在模型的内容详细页中显示，请使用标签：$<span class="style1">字段名</span>$(将红色字替换为您设计的字段名称)<br>
提示：自定义模型列表页发布的分页标签设置说明，<a href="func.htm#custom_pages">请点击此处查看-&gt;</a></div>
<%end Sub%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="40"><div align="center"></div></td>
  </tr>
</table>
</body>
</html>
<%
call connclose()
%>