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

📄 databasedesign.asp

📁 asp源码 图片ASP整站
💻 ASP
字号:
<% Option Explicit %>
<!--#include file="../../../Inc/Cls_DB.asp" -->
<!--#include file="../../../Inc/Const.asp"-->
<!--#include file="../../../Inc/Cls_Cache.asp" -->
<!--#include file="../../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称:风讯网站信息管理系统
'当前版本:Foosun Content Manager System(FoosunCMS V3.1.0930)
'最新更新:2005.10
'==============================================================================
'Copyright (C) 2002-2004 Foosun.Net  All rights reserved.
'商业注册联系:028-85098980-601,项目开发:028-85098980-606、609,客户支持:608
'产品咨询QQ:394226379,159410,125114015
'技术支持QQ:315485710,66252421 
'项目开发QQ:415637671,655071
'程序开发:四川风讯科技发展有限公司(Foosun Inc.)
'Email:service@Foosun.cn
'MSN:skoolls@hotmail.com
'论坛支持:风讯在线论坛(http://bbs.foosun.net)
'官方网站:www.Foosun.cn  演示站点:test.cooin.com 
'网站通系列(智能快速建站系列):www.ewebs.cn
'==============================================================================
'免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接
'风讯公司保留此程序的法律追究权利
'==============================================================================
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing


'==================================
Dim HaveValueTF
if CInt(GetConfig(20)) = 1 then
	HaveValueTF = True
Else
	HaveValueTF = False
End if
%>
<!--#include file="../../../Inc/Session.asp" -->
<!--#include file="../../../Inc/CheckPopedom.asp" -->
<%
'============================
'权限判断
'if Not JudgePopedomTF(Session("Name"),"P040400") then Call ReturnError1()

Dim ColumnAddObj,RsSql
Dim ColumnID,TableName,ColumnEName,ColumnCName,InputMode,ColumnInfo,ColumnDefault,NoNull,SelectList
ColumnID=Request.QueryString("ID")
'修改字段
If Request.QueryString("Action")="Modi"  Then
	'If Not NormalPopTF("P041102") Then Call ReturnError1()
	ColumnID=CInt(ColumnID)
	If ColumnID<>0 then
		RsSql = "Select TableName,ColumnEName,ColumnCName,ColumnDefault,ColumnNoNull,ColumnInfo,InputMode from FS_ColumnInfo Where Id="&ColumnID
		Set ColumnAddObj=Conn.Execute(RsSql)
		If Not ColumnAddObj.eof then
			TableName		=ColumnAddObj(0)
			ColumnEName		=ColumnAddObj(1)
			ColumnCName		=ColumnAddObj(2)
			ColumnDefault	=ColumnAddObj(3)
			NoNull			=ColumnAddObj(4)
			ColumnInfo		=ColumnAddObj(5)
			InputMode		=ColumnAddObj(6)
			If InputMode="3" Then '如果为列表方式,则读出列表项目
				Dim SelectRs
				Set SelectRs=Conn.Execute("Select Type_Content from FS_AuxiDict Where Type_Name='"&TableName&"' and Type_No='"&ColumnEName&"'")
				If Not SelectRs.Eof then
					SelectList=SelectRs(0)	
				Else
					SelectList=""
				End If
				SelectRs.Close
				Set SelectRs=Nothing
			End If
		Else
			Response.Write "<script>alert('参数传递错误');history.back();</script>"
		end If
	End If
End If
If Request.QueryString("Action")="Del" Then
	'权限代码
	'If Not NormalPopTF("P041103") Then Call ReturnError1()
	DelColumnAndInfo()
End If
If Request.Form("Action")="Update" then
	TableName		=Request.Form("TableName")
	ColumnEName		=Request.Form("ColumnEName")
	ColumnCName		=Request.Form("ColumnCName")
	InputMode		=Request.Form("InputMode")
	ColumnInfo		=Request.Form("ColumnInfo")
	ColumnDefault	=Request.Form("ColumnDefault")
	NoNull			=Request.Form("NoNull")
	SelectList		=Request.Form("SelectList")
	ColumnEName		=AllowStr(ColumnEName,"\W")
	Set ColumnAddObj = Server.CreateObject(G_FS_RS)
	If Request.Form("ColumnID")="" then		'如果为新添加
		RsSql = "Select * from FS_ColumnInfo where ColumnEName='"&ColumnEName&"' and TableName='"&TableName&"'"
		ColumnAddObj.Open RsSql,Conn,1,3
		If ColumnAddObj.eof Then
			SaveData
			ColumnAddObj.Close
			Set ColumnAddObj=Nothing
			Response.Write "<script>alert('添加字段成功!');location='DesignColumnList.asp';</script>"
			Response.End
		Else
			ColumnAddObj.Close
			Set ColumnAddObj=Nothing
			Response.Write "<script>alert('已经存在此字段,请重新填写英文名称!');history.back();</script>"
			Response.End
		End IF
	Else
		RsSql = "Select * from FS_ColumnInfo where ID="&Cint(Request.Form("ColumnID"))
		ColumnAddObj.Open RsSql,Conn,1,3
		If Not ColumnAddObj.eof Then
			SaveData
			ColumnAddObj.Close
			Set ColumnAddObj=Nothing
			Response.Write "<script>alert('修改字段成功!');location='DesignColumnList.asp';</script>"
			Response.End
		Else
			ColumnAddObj.Close
			Set ColumnAddObj=Nothing
			Response.Write "<script>alert('参数传递错误!');location='DesignColumnList.asp';</script>"
			Response.End
		End IF
	End If
End If
If ColumnEName="" then ColumnEName="FS_"
Function AllowStr(Str,FilterStr) '只能有英文大小写字母、数字和下划线
	Dim regEx
	Set regEx = New RegExp
	regEx.IgnoreCase = True
	regEx.Pattern = FilterStr
	If regEx.Test(LCase(Str)) Then
		Response.Write "<script>alert('英文字段名称中只能有英文大小写字母、数字和下划线构成');history.back();</script>"
		Response.End
	End If
	Set regEx = Nothing
	AllowStr=Str
End Function
Sub SaveData
	If Request.Form("ColumnID")="" Then '如果为新增加字段则添加表名和字段名信息
		ColumnAddObj.AddNew
		ColumnAddObj("TableName")	=TableName
		ColumnAddObj("ColumnEName")	=ColumnEName
	End If
	ColumnAddObj("ColumnCName")	=ColumnCName
	ColumnAddObj("InputMode")	=InputMode
	ColumnAddObj("ColumnInfo")	=ColumnInfo
	ColumnAddObj("ColumnDefault")=ColumnDefault
	ColumnAddObj("ColumnNoNull")=NoNull
	ColumnAddObj.Update
	Conn.Execute("Delete From FS_AuxiDict Where Type_Name='"&TableName&"' and Type_No='"&ColumnEName&"'")
	If InputMode="3" And SelectList<>"" Then
		Conn.Execute("Insert into FS_AuxiDict(Type_No,Type_Name,Type_Content) Values('"&ColumnEName&"','"&TableName&"','"&SelectList&"')")
	End If
End Sub

Function DelColumnAndInfo()
	On Error Resume Next
	Dim ColumnIDList,i,DelColumnRs
	ColumnIDList=split(ColumnID,",")
	For i = 0 to Ubound(ColumnIDList)
		Set DelColumnRs=Conn.Execute("Select ColumnEName,TableName From FS_ColumnInfo Where Id="&ColumnIDList(i))
		Conn.Execute("Delete From FS_AuxiTable Where ColumnName='"&DelColumnRs(0) &"' and TableEName='"&DelColumnRs(1)&"'")'在辅助表中删除字段保存的内容
		Conn.Execute("Delete From FS_ColumnInfo Where ID ="&ColumnIDList(i))'在字段信息表中删除相关信息
		Conn.Execute("Delete From FS_AuxiDict Where Type_Name='"&DelColumnRs(1)&"' and Type_No='"&DelColumnRs(0)&"'")'删除列表项
	Next
	If Err=0 then 
		Response.Write "<script>alert('删除字段成功!');location='DesignColumnList.asp';</script>"
	Else
		Response.Write "<script>alert(""删除字段完成!"&Err.Description&""");location='DesignColumnList.asp';</script>"
	End If
	Response.End
End Function
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>DataBase Design</title>
<style type="text/css">
<!--
-->
</style>
</head>
<link href="../../../CSS/FS_css.css" rel="stylesheet">
<script src="../../SysJS/PublicJS.js" language="JavaScript"></script>
<body scroll=yes topmargin="2" leftmargin="2">
<form name="CustColumn" method="post" action="DataBaseDesign.asp">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
        <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#999999">
          <tr bgcolor="#EEEEEE">
            <td height="26" colspan="5" valign="middle">
              <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width=35 align="center" alt="保存" onClick="SubmitFun();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">保存</td>
                  <td width=2 class="Gray">|</td>
                  <td width=35 align="center" alt="后退" onClick="top.GetEkMainObject().history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">后退</td>
                  <td>&nbsp;
                    <input name="action" type="hidden" id="action3" value="Update">
					<input name="ColumnID" type="hidden" id="ColumnID" value="<%=ColumnID%>">
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="120" valign="top">
        <div align="center">
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td colspan="5" height="2"></td>
            </tr>
            <tr>
              <td>
                <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#D5D5D5">
                  <tr bgcolor="#F7F7F7">
                    <th colspan="2" bgcolor="#F7F7F7">自定义字段设计</th>
                  </tr>
				  <tr bgcolor="#F7F7F7">
                    <td width="17%"><div align="center">新字段所属表</div>
                    </td>
                    <td width="83%">
		<select name="TableName" size="1" class="select" id="TableName" <%If ColumnID<>"" Then Response.Write "disabled"%>>
			<option value="FS_NewsClass" <%If TableName="FS_NewsClass" then response.write "Selected"%>>栏目表</option>
            <option value="FS_News" <%If TableName="FS_News" then response.write "Selected"%>>新闻表</option>
			<option value="FS_DownLoad" <%If TableName="FS_DownLoad" then response.write "Selected"%>>下载表</option>
			<%If HaveValueTF=True Then%>
			    <option value="FS_Shop_Products" <%If TableName="FS_Shop_Products" then response.write "Selected"%>>商城表</option>
			<%End If%>
			<!-- 这里可以扩展库结构 -->
			<!--<option value="FS_News" <%If TableName="FS_News" then response.write "Selected"%>>新闻表</option>
			<option value="FS_News" <%If TableName="FS_News" then response.write "Selected"%>>新闻表</option>
			<option value="FS_News" <%If TableName="FS_News" then response.write "Selected"%>>新闻表</option>-->
                        
        </select>
					<%
					  If ColumnID<>"" Then
					  	Response.Write "<input Name=""TableName"" Value="&TableName&" Type=""hidden"">"
					  End If%>
                    </td>
                  </tr>
                  <tr bgcolor="#F7F7F7">
                    <td width="17%">
                      <div align="center">字段英文名称</div>
                    </td>
                    <td width="83%">
                      <input name="ColumnEName" type="text" id="ColumnEName" value="<%=ColumnEName%>" maxlength="20" <% If ColumnID<>"" then response.write("readonly")%>>
                    </td>
                  </tr>
                  <tr bgcolor="#F7F7F7">
                    <td>
                      <div align="center">字段中文名称</div>
                    </td>
                    <td>
                      <input name="ColumnCName" type="text" id="ColumnCName" value ="<%=ColumnCName%>" maxlength="50">
                    </td>
                  </tr>
                  <tr bgcolor="#F7F7F7">
                    <td>
                      <div align="center">采用输入方式</div>
                    </td>
                    <td>
                      <select name="InputMode" size="1" class="select" id="InputMode" onChange="if(this.value=='3'){OptionsList.style.display='';} else {OptionsList.style.display='none';}">
                        <option value="1" <%If InputMode="1" then response.write "Selected"%>>单行文本</option>
                        <option value="2" <%If InputMode="2" then response.write "Selected"%>>多行文本</option>
                        <option value="3" <%If InputMode="3" then response.write "Selected"%>>列表选择</option>
                        <option value="4" <%If InputMode="4" then response.write "Selected"%>>日期</option>
                        <option value="5" <%If InputMode="5" then response.write "Selected"%>>数字</option>
                      </select>
                    </td>
                  </tr>
				  <tr bgcolor="#F7F7F7">
                    <td>
                      <div align="center">输入时默认值</div>
                    </td>
                    <td>
                      <input name="ColumnDefault" type="text" id="ColumnDefault" value="<%=ColumnDefault%>" maxlength="255">
                    </td>
                  </tr>
                  <tr bgcolor="#F7F7F7" id="OptionsList" style="display:<%If InputMode<>"3" then response.write "none;"%>">
                    <td width="17%">
                      <div align="center">输入列表项目<br>
                        每一行为一个列表项目</div>
                    </td>
                    <td>
                      <textarea name="SelectList" cols="40" rows="4" id='SelectList'><%=SelectList%></textarea>
                    </td>
                  </tr>
                  <tr bgcolor="#F7F7F7">
                    <td>
                      <div align="center">字段提示信息<br>
                        输入时的提示 </div>
                    </td>
                    <td>
                      <textarea name="ColumnInfo" cols="40" rows="4" id="ColumnInfo"><%=ColumnInfo%></textarea>
                    </td>
                  </tr>
                  
                  <tr bgcolor="#F7F7F7">
                    <td>
                      <div align="center">是否必填项目</div>
                    </td>
                    <td>
                      <input type="radio" name="NoNull" value="1" <%If NoNull="1" then response.write "checked"%>>
                      <input type="radio" name="NoNull" value="0" <%If NoNull<>"1" then response.write "checked"%>>
                      否 </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
<script>
function SubmitFun()
{
	if(CustColumn.ColumnEName.value =="" ) {
		alert("请输入字段英文名称!");
		CustColumn.ColumnEName.focus();
		return false;
	}
	if(CustColumn.ColumnCName.value =="" ) {
		alert("请输入字段中文名称!");
		CustColumn.ColumnCName.focus();
		return false;
	}
	if(CustColumn.InputMode.value =="" ) {
		alert("请选择输入方式!");
		CustColumn.InputMode.focus();
		return false;
	}
	if(CustColumn.InputMode.value =="3" ) {
		if (CustColumn.SelectList.value==""){
		alert("请输入列表项目!");
		CustColumn.SelectList.focus();
		return false;
		}
	}
	document.CustColumn.submit();
}
</script>

⌨️ 快捷键说明

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