⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_field.asp

📁 正版创力4.1SQL商业版!!!ASP版。
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="Inc/Const.asp"-->
<%
'==========================
'	Powered by GDW尼奥
'	QQ:6450835
'	Email:egdw@21cn.com
'		7.16.2007
'==========================
dim Action,Num
Dim FieldID,FieldName,FieldIntro,FieldTitle,FieldType,FieldLabel,DefaultValue,Options,IsShow,AllowNull
Dim arrChannelID
Num=0
const PageSize=30
Action=Trim(Request("Action"))
CurrentPage=Cl.GetClng(request("page"))
Header
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
	<tr class="title"><td height="22" colspan="2" align="center"><strong>自定义字段管理</strong></td></tr>
	<tr class="tdbg">
		<td width="70" height="30" ><strong>管理导航:</strong></td>
		<td><a href="Admin_Field.asp">自定义字段管理首页</a>&nbsp;|&nbsp;<a href="Admin_Field.asp?Action=Add">添加新自定义字段</a></td>
  </tr>
</table>
<%
Select Case Action
Case "Add","Modify"
	Call MyField()
Case "SaveAdd", "SaveModify"
	Call SaveField()
Case "Del"
	Call DelField
Case Else
	Call Main()
End Select
Footer

Sub Main()
	Set rs=Server.CreateObject("Adodb.RecordSet")
	Sql="Select FieldID,FieldName,FieldIntro,FieldTitle,IsShow,FieldLabel From Cl_Field Order by FieldID Desc"
	OpenConn : rs.Open sql,Conn,1,1
	%>
	<form name="myform" method="post" action="">
	<table width="100%" border="0" cellspacing="1" cellpadding="2" class="border">
		<tr align="center" class="title">
			<td width="100" height="22">字段名称</td>
			<td width="120">字段标签</td>
			<td>字段默认值</td>
			<td width="60">是否显示</td>
			<td width="100" align="center">操作</td>
		</tr>
	<%
	 if rs.eof and rs.bof then
		TotalPut=0
		response.write "<tr class=""tdbg""><td align=""center"" colspan=""5""><br>没有任何记录!<br></td></tr>"
		Rs.close:Set Rs=Nothing
	else
		TotalPut=rs.recordcount
		if (TotalPut mod PageSize)=0 then
			TotalPages = TotalPut \ PageSize
		else
			TotalPages = TotalPut \ PageSize + 1
		end if
		if CurrentPage > TotalPages then CurrentPage=TotalPages
		if CurrentPage < 1 then CurrentPage=1
		rs.move (CurrentPage-1)*PageSize
		Sql=rs.GetRows(PageSize)
		Rs.close:Set Rs=Nothing
		For i=0 to Ubound(Sql,2)
		%>
		<tr class="tdbg">
			<td width="100" align="center"><a href="Admin_Field.asp?Action=Modify&FieldID=<%=Sql(0,i)%>"><%=Sql(1,i)%></a></td>
			<td width="120" align="center"><%=Sql(5,i)%></td>
			<td><%=Sql(2,i)%></td>
			<td align="center"><strong>
			<%
			If Sql(4,i)=1 Then 
				Response.write "<Font color=""green"">√</Font>"
			Else
				Response.write "<Font color=""red"">×</Font>"
			End If
			%></strong></td>
			<td width="70" align="center"><a href="Admin_Field.asp?Action=Modify&FieldID=<%=Sql(0,i)%>">修改</a>&nbsp;&nbsp;<a href="Admin_Field.asp?Action=Del&FieldID=<%=Sql(0,i)%>" onclick="return confirm('真的要删除此字段吗?如果有文件或模板中使用此字段,请注意修改!');">删除</a></td>
		</tr>
		<%
		Next
		%>
		</table>
		</form>
		<%
		Response.write Cl.showpage ("Admin_Field.asp",TotalPut,PageSize,"条","记录")
	end if
end Sub

Sub MyField()
	Dim IsDisabled,StrSubmit
	if Action="Modify" then
		IsDisabled="Disabled"
		StrSubmit=" 修改字段 "
		FieldID=Clng(Request("FieldID"))
		Set Rs=Cl.Execute("Select * From Cl_Field Where FieldID="&FieldID&"")
		FieldName=Rs("FieldName")
		FieldIntro=Rs("FieldIntro")
		FieldTitle=Rs("FieldTitle")
		IsShow=Rs("IsShow")
		FieldLabel=Rs("FieldLabel")
		arrChannelID=Rs("arrChannelID")
		ModuleID=Rs("ModuleID")
		AllowNull=Rs("IsNull")
		Options=Rs("Options")
		FieldType=Rs("FieldType")
		DefaultValue=Rs("DefaultValue")
		Set Rs=Nothing
	else
		IsDisabled=""
		Action="Add"
		Set Rs=Cl.Execute("Select Max(FieldID) From Cl_Field")
		IsShow=Rs(0)
		Set Rs=Nothing
		IsShow=0
		StrSubmit=" 添加字段 "
		FieldID=""
		FieldName="Cl_"
		FieldIntro=""
		FieldTitle=""
		FieldLabel=""
		FieldType=1
		arrChannelID=0
		ModuleID=1
		AllowNull=1
		Options=""
		DefaultValue=""
	end if
	Call SetModule()
	%>
	<script language = "JavaScript">
  <!--
	function CheckForm(){
	  if (document.myform.FieldName.value==""){
		  alert("字段名称不能为空!");
		  document.myform.FieldName.focus();
		  return false;
	  }
		var str1 = document.myform.FieldName.value;
		var s = str1.indexOf("Cl_");
		if (s == -1 || s > 1){
			alert('“字段名称”必须以“Cl_”开头!');
			document.myform.FieldName.focus();
			return false;
		} 
	  if (document.myform.FieldTitle.value==""){
		 alert("字段标题不能为空!");
		 document.myform.FieldTitle.focus();
		 return false;
	  }
	  if (document.myform.FieldLabel.value==""){
		 alert("字段标签不能为空!");
		 document.myform.FieldLabel.focus();
		 return false;
	  }
	  return true;  
	}
  //检验文本框中内容是否超长
	function CheckTextareaLength(val, max_length) {
		var str_area=document.forms[0].elements[val].value;
		if (str_area!=null&&str_area.length > max_length && document.myform.FieldType.value!=2){
			alert("文本文字超长,最多可输入" + max_length +"个字符,请重新输入!");
			document.forms[0].elements[val].focus();
			return false;
		}
		return true;
	}
	function FieldCheckForm(FieldTypeValue){
		if(FieldTypeValue=='3'){
			trOptions.style.display='';
			document.myform.DefaultValue.rows=1;
		}else if(FieldTypeValue=='2'){
			trOptions.style.display='none';
			document.myform.DefaultValue.rows=10;
		}else{
			trOptions.style.display='none';
			document.myform.DefaultValue.rows=1;
		}
	}
	-->
	</script>
	<form action="Admin_Field.asp" method="post" name="myform" id="myform" onSubmit="return CheckForm();">
	<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="border">
		<tr class="title" height="22">
			<td align="center" ColSpan=2><strong><%=StrSubmit%></strong></td>
		</tr>
			<tr class="tdbg"> 
			<td width="100" align="right"><b>所属模块:</b></td>
			<td>
				<select name="ModuleID" id="ModuleID" <%if Action="Modify" then Response.write "Disabled"%>  onChange="changelocation(document.myform.ModuleID.options[document.myform.ModuleID.selectedIndex].value)" <%=IsDisabled%>>
				<option value="1" <%If ModuleID=1 Then Response.write "selected"%>>文章模块</option>
				<option value="2" <%If ModuleID=2 Then Response.write "selected"%>>下载模块</option>
				<option value="3" <%If ModuleID=3 Then Response.write "selected"%>>图片模块</option>
				<option value="4" <%If ModuleID=4 Then Response.write "selected"%>>影视模块</option>
				<option value="5" <%If ModuleID=5 Then Response.write "selected"%>>商城模块</option>
				</select>&nbsp;&nbsp;
				<font color="red"><b>注意:</b></font><font color="#0000FF">指定以后不能修改</font>
			</td>
		</tr>
		<tr class="tdbg">
		<td width="100" align="right"><strong>所属频道:</strong></td>
			<td>
				<select name="arrChannelID" id="arrChannelID" multiple style="height:90px;width:200px;">
				<%=ShowChannelList(arrChannelID,ModuleID)%>
				</select>&nbsp;&nbsp
				<font color="#FF0000"><strong>说明:</strong></font><font color="#0000FF">按“Shift”“Ctrl”可多选</font>
			</td>
			</tr>
		<tr class="tdbg">
			<td width="100" align="center"><strong>字段名称:</strong></td>
			<td><input name="FieldName" type="text" id="FieldName" size="60" maxlength="250" value="<%=FieldName%>" onchange="document.myform.FieldLabel.value='{$'+this.value+'}';" <%=IsDisabled%>><br><font color="blue">直接输入名称(注意大小写)。</font></td>
		</tr>
		<tr class="tdbg">
			<td width="100" align="center"><strong>字段标题:</strong></td>
			<td><input name="FieldTitle" type="text" id="FieldTitle" size="60" maxlength="250" value="<%=FieldTitle%>"><br><font color="blue">字段的中文标题,一般为中文。如“UpdateTime”字段的中文标题为“更新时间”</font></td>
		</tr>
		<tr class="tdbg">
			<td width="100" align="center"><strong>字段标签:</strong></td>
			<td><input name="FieldLabel" type="text" id="FieldLabel" size="60" maxlength="250" value="<%=FieldLabel%>" readonly><br><font color="blue">前台模板调用此字段内容的标签名。</font></td>
		</tr>
		<tr class="tdbg">
			<td width="100" align="center"><strong>附加提示:</strong></td>
			<td><textarea name="FieldIntro" style="width:492" rows="3" id="FieldIntro"><%=FieldIntro%></textarea><br>
			<a href="javascript:admin_Size(-3,'FieldIntro')"><img src="images/minus.gif" unselectable="on" border="0"></a> <a href="javascript:admin_Size(3,'FieldIntro')"><img src="images/plus.gif" unselectable="on" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;<font color="blue">后台录入时,在标题旁的提示信息。</font>
			</td>
		</tr>
		<tr class="tdbg">
			<td width="100" align="center"><strong>字段类型:</strong></td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -