📄 labeladd.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../../Conn.asp"-->
<!--#include file="../../SysCls/KS_CommonCls.asp"-->
<!--#include file="../Inc/Session.asp"-->
<%
'===================================================================================================================
'软件名称:科汛网站管理系统
'当前版本:科汛网站管理系统 V2.2 SP2 Free
'Copyright (C) 2006-2008 Kesion.Com All rights reserved.
'产品咨询QQ:9537636,41904294
'技术支持QQ:111394,54004407
'程序版权:科汛网络
'程序开发:科汛网络开发组(总策划:林文仲)
'E-Mail :kesioncms@hotmail.com webmaster@kesion.com
'官方网站:http://www.kesion.com
'演示站点:http://test.kesion.com
'郑重声明:
' ①、免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接,商业版本无此要求;
' ②、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息;
' ③、科汛网络保留此软件的法律追究权利
'===================================================================================================================
Dim KSCls
Set KSCls = New LabelAdd
KSCls.Execute()
Set KSCls = Nothing
Class LabelAdd
Private KSCMS
Private Sub Class_Initialize()
Set KSCMS=New CommonCls
End Sub
Private Sub Class_Terminate()
Call KSCMS.CloseConn()
Set KSCMS=Nothing
End Sub
Public Sub Execute()
Dim LabelID, LabelRS, SQLStr, LabelName, Descript, LabelContent, LabelFlag, ParentID
Dim Action, Page, RSCheck, FolderID
Dim KeyWord, SearchType, StartDate, EndDate
'收集搜索参数
KeyWord = Request("KeyWord")
SearchType = Request("SearchType")
StartDate = Request("StartDate")
EndDate = Request("EndDate")
Set LabelRS = Server.CreateObject("Adodb.RecordSet")
Action = Request.QueryString("Action")
Page = Request("Page")
FolderID = Request.QueryString("FolderID")
If Action = "EditLabel" Then
LabelID = Request("LabelId")
Set LabelRS = Server.CreateObject("Adodb.Recordset")
SQLStr = "SELECT * FROM [KS_Label] Where ID='" & LabelID & "'"
LabelRS.Open SQLStr, Conn, 1, 1
LabelName = Replace(Replace(LabelRS("LabelName"), "{LB_", ""), "}", "")
Descript = LabelRS("Description")
LabelContent = Server.HTMLEncode(LabelRS("LabelContent"))
LabelRS.Close
End If
Select Case Request.Form("Action")
Case "AddNewSubmit"
ParentID = Request.Form("ParentID")
LabelName = Replace(Replace(Trim(Request.Form("LabelName")), """", ""), "'", "")
Descript = Replace(Trim(Request.Form("Description")), "'", "")
LabelContent = Trim(Request.Form("LabelContent"))
LabelFlag = Request.Form("LabelFlag")
FolderID = Request.Form("FolderID")
If LabelName = "" Then
Call KSCMS.AlertHistory("标签名称不能为空!", -1)
Set KSCMS = Nothing
Response.End
End If
If LabelContent = "" Then
Call KSCMS.AlertHistory("标签内容不能为空!", -1)
Set KSCMS = Nothing
Response.End
End If
LabelName = "{LB_" & LabelName & "}"
LabelRS.Open "Select LabelName From [KS_Label] Where LabelName='" & LabelName & "'", Conn, 1, 1
If Not LabelRS.EOF Then
Call KSCMS.AlertHistory("标签名称已经存在!", -1)
LabelRS.Close
Conn.Close
Set LabelRS = Nothing
Set Conn = Nothing
Set KSCMS = Nothing
Response.End
Else
LabelRS.Close
LabelRS.Open "Select * From [KS_Label] Where (ID is Null)", Conn, 1, 3
LabelRS.AddNew
Do While True
'生成ID 年+12位随机
LabelID = Year(Now()) & KSCMS.MakeRandom(10)
Set RSCheck = Conn.Execute("Select ID from [KS_Label] Where ID='" & LabelID & "'")
If RSCheck.EOF And RSCheck.BOF Then
RSCheck.Close
Set RSCheck = Nothing
Exit Do
End If
Loop
LabelRS("ID") = LabelID
LabelRS("LabelName") = LabelName
LabelRS("LabelContent") = LabelContent
LabelRS("LabelFlag") = LabelFlag
LabelRS("Description") = Descript
LabelRS("FolderID") = FolderID
LabelRS("AddDate") = Now
LabelRS("LabelType") = 1
LabelRS("OrderID") = 1
LabelRS.Update
Response.Write ("<script>if (confirm('成功提示:\n\n添加标签成功,继续添加标签吗?')){location.href='LabelAdd.asp?Action=AddNew&LabelType=1&FolderID=" & FolderID & "';}else{parent.frames['BottomFrame'].location.href='../Split.asp?LabelFolderID=" & FolderID & "&OpStr=标签管理 >> 自由标签&ButtonSymbol=FreeLabel';parent.frames['MainFrame'].location.href='Label_Main.asp?LabelType=1&FolderID=" & FolderID & "';}</script>")
End If
Case "EditSubmit"
LabelID = Trim(Request.Form("LabelID"))
ParentID = Request.Form("ParentID")
LabelName = Replace(Replace(Trim(Request.Form("LabelName")), """", ""), "'", "")
Descript = Replace(Trim(Request.Form("Description")), "'", "")
LabelContent = Trim(Request.Form("LabelContent"))
LabelFlag = Request.Form("LabelFlag")
If LabelName = "" Then
Call KSCMS.AlertHistory("标签名称不能为空!", -1)
Set KSCMS = Nothing
Response.End
End If
If LabelContent = "" Then
Call KSCMS.AlertHistory("标签内容不能为空!", -1)
Set KSCMS = Nothing
Response.End
End If
LabelName = "{LB_" & LabelName & "}"
LabelRS.Open "Select LabelName From [KS_Label] Where ID <>'" & LabelID & "' AND LabelName='" & LabelName & "'", Conn, 1, 1
If Not LabelRS.EOF Then
Call KSCMS.AlertHistory("标签名称已经存在!", -1)
LabelRS.Close
Conn.Close
Set LabelRS = Nothing
Set Conn = Nothing
Set KSCMS = Nothing
Response.End
Else
LabelRS.Close
LabelRS.Open "Select * From [KS_Label] Where ID='" & LabelID & "'", Conn, 1, 3
LabelRS("LabelName") = LabelName
LabelRS("LabelContent") = LabelContent
LabelRS("LabelFlag") = LabelFlag
LabelRS("Description") = Descript
LabelRS("AddDate") = Now
LabelRS.Update
If KeyWord = "" Then
Response.Write ("<script>alert('成功提示:\n\n标签修改成功!');parent.frames['BottomFrame'].location.href='../Split.asp?LabelFolderID=" & ParentID & "&OpStr=标签管理 >> 自由标签&ButtonSymbol=FreeLabel';location.href='Label_main.asp?Page=" & Page & "&LabelType=1&FolderID=" & ParentID & "';</script>")
Else
Response.Write ("<script>alert('成功提示:\n\n标签修改成功!');parent.frames['BottomFrame'].location.href='../Split.asp?OpStr=标签管理 >> <font color=red>搜索自由标签结果</font>&ButtonSymbol=FreeLabelSearch';location.href='Label_main.asp?Page=" & Page & "&LabelType=1&KeyWord=" & KeyWord & "&SearchType=" & SearchType & "&StartDate=" & StartDate & "&EndDate=" & EndDate & "';</script>")
End If
End If
End Select
Response.Write "<html>"
Response.Write "<head>"
Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
Response.Write "<title>新建标签</title>"
Response.Write "</head>"
Response.Write "<link href=""../Inc/Admin_Style.CSS"" rel=""stylesheet"">"
Response.Write "<script language=""JavaScript"" src=""../JS/Common.js""></script>"
Response.Write "<body oncontextmenu=""return false"" bgcolor=""#FFFFFF"" leftmargin=""0"" topmargin=""0"" marginwidth=""0"" marginheight=""0"" scroll=no>"
Response.Write "<table width=""100%"" height=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
Response.Write " <form name=LabelForm method=post action="""" onSubmit=""return(CheckForm())"">"
Response.Write " <input type=""hidden"" name=""LabelContent"" value=""" & LabelContent & """>"
Response.Write " <input type=""hidden"" name=""LabelFlag"" value=""3"">"
Response.Write " <input type=""hidden"" name=""LabelID"" value=""" & LabelID & """>"
Response.Write " <input type=""hidden"" name=""FolderID"" value=""" & FolderID & """>"
Response.Write " <input type=""hidden"" name=""Page"" value=""" & Page & """>"
If Action = "AddNew" Or Action = "" Then Response.Write "<input type='hidden' name='Action' value='AddNewSubmit'>"
If Action = "EditLabel" Then Response.Write "<input type='hidden' name='Action' value='EditSubmit'>"
Response.Write " <tr>"
Response.Write " <td height=""25"" colspan=""2""> "
Response.Write "<table width='100%' height='25' border='0' cellpadding='0' cellspacing='1' bgcolor='#efefef' class='sort'>"
Response.Write "<tr><td><div align='center'><font color='#990000'>"
If Action = "EditLabel" Then
Response.Write "修改自由标签"
Else
Response.Write "新建自由标签"
End If
Response.Write "</font></div></td></tr>"
Response.Write "</table>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td height=""19"">标签名称</td>"
Response.Write " <td><input value=""" & LabelName & """ name=""LabelName"" style=""width:200;"">"
Response.Write " <font color=""#FF0000""> 例如标签名称:"推荐文章列表",则在模板中调用:"{LB_推荐文章列表}"(注意英文大小写及全半角)。</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td width=""60"" height=""19""> <div align=""left"">标签目录</div></td>"
Response.Write " <td>" & KSCMS.ReturnLabelFolderTree(FolderID, 1) & "<font color=""#FF0000"">请选择标签归属目录,以便日后管理标签</font></td>"
Response.Write " </tr>"
Response.Write " <tr>"
Response.Write " <td width=""60"" height=""16""><div align=""left"">标签描述</div></td>"
Response.Write " <td><textarea name=""Description"" rows=""5"" style=""width:100%;"">" & Descript & "</textarea></td>"
Response.Write " </tr>"
Response.Write " <tr valign=""top"">"
Response.Write " <td colspan='2'> <iframe id=""LabelEditor"" src=""../Editor.asp?ID=LabelContent&style=2"" scrolling=""no"" width=""100%"" height=""100%"" frameborder=""0""></iframe>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " </form>"
Response.Write "</table>"
Response.Write "</body>"
Response.Write "</html>"
Response.Write "<script language=""JavaScript"">" & vbCrLf
Response.Write "<!--" & vbCrLf
Response.Write "function CheckForm()" & vbCrLf
Response.Write "{ var form=document.LabelForm;"
Response.Write " if (frames[""LabelEditor""].CurrMode!='EDIT') {alert('其他模式下无法保存,请切换到设计模式');return false;}"
Response.Write " if (form.LabelName.value=='')"
Response.Write " {"
Response.Write " alert('请输入标签名称!');"
Response.Write " form.LabelName.focus();"
Response.Write " return false;"
Response.Write " }"
Response.Write " form.LabelContent.value=frames[""LabelEditor""].Resumeblank(frames[""LabelEditor""].KS_EditArea.document.body.innerHTML);"
Response.Write " if (form.LabelContent.value=='')"
Response.Write " {"
Response.Write " alert('请输入标签内容!');"
Response.Write " frames[""LabelEditor""].KS_EditArea.focus();"
Response.Write " return false;"
Response.Write " }"
Response.Write " if (form.Description.value.length>255)"
Response.Write " {"
Response.Write " alert(""目录名称不能超过125个汉字(255个英文字符)!"");"
Response.Write " form.Description.focus();"
Response.Write " return false;"
Response.Write " }"
Response.Write " form.submit();"
Response.Write " return true;"
Response.Write "}" & vbCrLf
Response.Write "//-->" & vbCrLf
Response.Write "</script>"
Set Conn = Nothing
End Sub
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -