📄 category.asp
字号:
<%
Class ImplMocomWAPmoManagerCategory
Private blnError
Private strError
Private rs
Private strSQL
Private objPage
Private Sub Class_Initialize()
blnError = True
strError = "无错误"
End Sub
Private Sub Class_Terminate()
End Sub
Public Sub main()
If MyIO.Env("REQUEST_METHOD") = "POST" Then
Call doPost
Else
Call doGet
End If
End Sub
Private Sub doGet()
Select Case LCase(MyIO.QueryString("Handle"))
Case "option"
Call doGetOption
Case "list"
Call doGetList
Case "add"
Call doGetAdd
Case "modify"
Call doGetModify
Case Else
Call doGetMain
End Select
End Sub
Private Sub doPost()
Select Case LCase(MyIO.QueryString("Handle"))
Case "add"
MyIO.CodePage = 65001
Call doPostAdd
Case "modify"
MyIO.CodePage = 65001
Call doPostModify
Case "remove"
Call doPostRemove
Case "sort"
Call doPostSort
Case "staple"
Call doPostStaple
Case Else
End Select
End Sub
Private Sub doGetMain()
MyIO.Echo "<html>"
MyIO.Echo "<head>"
MyIO.Echo "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />"
MyIO.Echo "<meta http-equiv=""Cache-Control"" content=""no-cache, max-age=0"" />"
MyIO.Echo "<title>帖子管理</title>"
MyIO.Echo "<link rel=""stylesheet"" href=""images/xw.css"" />"
MyIO.Echo "<script language=""javascript"" src=""jspp/jspp.js""></script>"
MyIO.Echo "<script language=""javascript"" src=""images/wm_cate.js""></script>"
MyIO.Echo "</head>"
MyIO.Echo "<body style=""padding:5;margin:0;overflow:auto;border:0"">"
MyIO.Echo "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""border:1px solid #000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td align=""right"" bgcolor=""#A2ADC4"" style=""border-bottom:1px solid #000000;padding-right:1px;padding-top:1px"" height=""24""><img src=""images/xw_cls0.gif"" border=""0"" align=""absMiddle"" onMouseOver=""this.src='images/xw_cls1.gif'"" onMouseOut=""this.src='images/xw_cls0.gif'"" onMouseDown=""this.src='images/xw_cls2.gif'"" onMouseUp=""this.src='images/xw_cls1.gif'"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td>"
MyIO.Echo "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td height=""24"" style=""background-image:url(images/xw_back4.gif)""> </td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td>"
MyIO.Echo "<table width=""98%"" border=""0"" cellpadding=""0"" cellspacing=""0"" align=""center"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""_OPTION"" class=""f12""></td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "<iframe id=""console"" name=""console"" frameborder=""0"" scrolling=""no"" width=""0"" height=""0"" style=""display:none""></iframe>"
MyIO.Echo "</body>"
MyIO.Echo "</html>"
End Sub
Private Sub doGetOption()
Select Case MyIO.QueryString("Option")
Case "0"
MyIO.Echo "<form id=""frmMain"" onsubmit=""return(false)"">"
MyIO.Echo "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""0"" align=""center"" style=""border-collapse:collapse"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td class=""winT0"" colspan=""2""><b>类别管理</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td width=""10%"">大类</td>"
MyIO.Echo "<td width=""90%"">"
MyIO.Echo "<select name=""Parent"" class=""sel"" onchange=""jspp.Cate.setCate(this.form.Child, this.value, 1)"">"
MyIO.Echo "<option value=""0"">选择大类</option>"
MyIO.Echo "</select>"
MyIO.Echo " <input type=""button"" value=""编辑"" class=""btn"" onclick=""jspp.Cate.modify(this.form.Parent, 0)"" />"
MyIO.Echo " <input type=""button"" value=""排序"" class=""btn"" onclick=""jspp.Cate.sort(0)"" />"
MyIO.Echo " <input type=""button"" value=""删除"" class=""btn"" onclick=""jspp.Cate.remove(this.form.Parent.value)"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td>小类</td>"
MyIO.Echo "<td>"
MyIO.Echo "<select name=""Child"" class=""sel"">"
MyIO.Echo "<option value=""0"">选择小类</option>"
MyIO.Echo "</select>"
MyIO.Echo " <input type=""button"" value=""编辑"" class=""btn"" onclick=""jspp.Cate.modify(this.form.Child, 1)"" />"
MyIO.Echo " <input type=""button"" value=""排序"" class=""btn"" onclick=""jspp.Cate.sort(this.form.Parent.value)"" />"
MyIO.Echo " <input type=""button"" value=""删除"" class=""btn"" onclick=""jspp.Cate.remove(this.form.Child.value)"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td colspan=""2"">"
MyIO.Echo " <input type=""button"" value=""新建大类"" class=""btn"" onclick=""jspp.Cate.add(0)"" />"
MyIO.Echo " <input type=""button"" value=""新建小类"" class=""btn"" onclick=""jspp.Cate.add(1)"" />"
MyIO.Echo " <input type=""button"" value=""应用分类"" class=""btn"" onclick=""jspp.Cate.staple()"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
Case Else
MyIO.Echo "未知选项"
End Select
End Sub
Private Sub doGetList()
Dim xmlDoc, xmlNode
Dim strTemp
Set xmlDoc = WM_GetCache("category")
MyIO.Echo "$cate = new Array();"
For Each xmlNode In xmlDoc.documentElement.childNodes
strTemp = "$cate.push({SeqId:$(SeqId),Title:""$(Title)"",Follow:$(Follow),Intime:$(Intime)});"
strTemp = Replace(strTemp, "$(SeqId)", XMLAttr(xmlNode, "seqid"))
strTemp = Replace(strTemp, "$(Title)", JSEncode(XMLAttr(xmlNode, "title")))
strTemp = Replace(strTemp, "$(Follow)", XMLAttr(xmlNode, "follow"))
strTemp = Replace(strTemp, "$(Intime)", XMLAttr(xmlNode, "intime"))
MyIO.Echo strTemp
Next
Set xmlDoc = Nothing
End Sub
Private Sub doGetAdd()
Dim intType
intType = atoi(MyIO.QueryString("Type"))
MyIO.Echo "<form id=""frmTemplet"" onsubmit=""return(false)"">"
MyIO.Echo "<table width=""300"" border=""1"" cellpadding=""2"" cellspacing=""0"" style=""border-collapse:collapse"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" class=""winT0""><b>新建" & IIf(intType = 0, "大类", "小类") & "</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td width=""80"">类别名称</td>"
MyIO.Echo "<td width=""220""><input type=""text"" name=""Title"" class=""txt"" /></td>"
MyIO.Echo "</tr>"
If intType = 1 Then
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>所属大类</td>"
MyIO.Echo "<td>"
MyIO.Echo "<select name=""Follow"" class=""sel"">"
MyIO.Echo "<option value=""0"">所属大类</option>"
MyIO.Echo "</select>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
Else
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>并列个数</td>"
MyIO.Echo "<td><input type=""text"" name=""Count"" class=""txt"" /> 在输出所有分类时一行内并列显示二级分类的个数</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>间隔字符</td>"
MyIO.Echo "<td><input type=""text"" name=""Space"" class=""txt"" /> 在输出所有分类时二级分类间的间隔字符</td>"
MyIO.Echo "</tr>"
End If
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""2"" align=""center"">"
MyIO.Echo " <input name=""Accept"" type=""button"" value=""确 定"" class=""btn"" />"
MyIO.Echo " <input name=""Cancel"" type=""button"" value=""取 消"" class=""btn"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
End Sub
Private Sub doGetModify()
Dim objCate
Set objCate = MyKernel.Command(T_CATEGORY)
objCate.CommandType = "SELECT"
objCate.Where = "SeqId=" & atol(MyIO.QueryString("SeqId"))
If Not objCate.Exec Then
MyIO.Echo "找不到您要编辑的大分类"
Else
MyIO.Echo "<form id=""frmTemplet"" onsubmit=""return(false)"">"
MyIO.Echo "<table width=""300"" border=""1"" cellpadding=""2"" cellspacing=""0"" style=""border-collapse:collapse"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" class=""winT0""><b>编辑" & IIf(objCate("Follow") = 0, "大类", "小类") & "</b></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td width=""80"">类别名称</td>"
MyIO.Echo "<td width=""220""><input type=""text"" name=""Title"" class=""txt"" value=""" & objCate("Title") & """ /></td>"
MyIO.Echo "</tr>"
If objCate("Follow") > 0 Then
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>所属大类</td>"
MyIO.Echo "<td>"
MyIO.Echo "<select name=""Follow"" class=""sel"">"
MyIO.Echo "<option value=""0"">所属大类</option>"
MyIO.Echo "</select>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
Else
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>并列个数</td>"
MyIO.Echo "<td><input type=""text"" name=""Count"" class=""txt"" value=""" & objCate("C_Count") & """ /> 在输出所有分类时一行内并列显示二级分类的个数</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td>间隔字符</td>"
MyIO.Echo "<td><input type=""text"" name=""Space"" class=""txt"" value=""" & objCate("C_Space") & """ /> 在输出所有分类时二级分类间的间隔字符</td>"
MyIO.Echo "</tr>"
End If
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""2"" align=""center"">"
MyIO.Echo " <input name=""Accept"" type=""button"" value=""确 定"" class=""btn"" />"
MyIO.Echo " <input name=""Cancel"" type=""button"" value=""取 消"" class=""btn"" />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
End If
Set objCate = Nothing
End Sub
Private Sub doPostAdd()
Dim intType
Dim strTitle, lngFollow
Dim objCmd
intType = atoi(MyIO.QueryString("Type"))
strTitle = Trim(MyIO.Form("Title"))
lngFollow = atol(MyIO.Form("Follow"))
If strTitle = "" Then
MyIO.Echo "请输入类别名称"
ElseIf intType = 1 And lngFollow < 1 Then
MyIO.Echo "请选择所属大类"
Else
Set objCmd = MyKernel.Command(T_CATEGORY)
objCmd.CommandType = "SELECT"
objCmd.Where = "TITLE='" & SafeString(strTitle) & "' AND FOLLOW=" & lngFollow
If objCmd.Exec Then
MyIO.Echo "该类别名称已被占用"
Else
objCmd.CommandType = "INSERT"
objCmd.Add "Title", strTitle
objCmd.Add "Follow", lngFollow
objCmd.Add "Serial", 0
objCmd.Add "C_Count", atoi(MyIO.Form("Count"))
objCmd.Add "C_Space", MyIO.Form("Space")
objCmd.Add "Intime", GetTime(Now())
objCmd.Exec
WM_SetCache "category"
MyIO.Echo "OK"
End If
Set objCmd = Nothing
End If
End Sub
Private Sub doPostModify()
Dim strTitle
Dim lngId
Dim objCmd
strTitle = MyIO.Form("Title")
lngId = atol(MyIO.QueryString("SeqId"))
If strTitle = "" Then
MyIO.Echo "请输入类别名称"
ElseIf lngId < 1 Then
MyIO.Echo "请选择类别"
Else
Set objCmd = MyKernel.Command(T_CATEGORY)
objCmd.CommandType = "SELECT"
objCmd.Where = "SEQID=" & lngId
If Not objCmd.Exec Then
MyIO.Echo "找不到您要编辑的类别"
Else
objCmd.CommandType = "UPDATE"
objCmd.Where = "SEQID=" & lngId
objCmd.Add "Title", strTitle
objCmd.Add "Follow", atol(MyIO.Form("Follow"))
objCmd.Add "C_Count", atoi(MyIO.Form("Count"))
objCmd.Add "C_Space", MyIO.Form("Space")
objCmd.Exec
WM_SetCache "category"
MyIO.Echo "OK"
End If
Set objCmd = Nothing
End If
End Sub
Private Sub doPostRemove()
Dim arr
arr = Split(MyIO.Form("SeqId"), ",")
If Not IsNumericArray(arr) Then
MyIO.Echo "请选择您要删除的类别"
Else
strSQL = "DELETE FROM $(Table) WHERE SEQID IN ($(SeqId)) OR FOLLOW IN ($(SeqId))"
strSQL = Replace(strSQL, "$(Table)", T_CATEGORY)
strSQL = Replace(strSQL, "$(SeqId)", Join(arr, ","))
MyKernel.DB.Exec strSQL
WM_SetCache "category"
MyIO.Echo "OK"
End If
End Sub
Private Sub doPostSort()
Dim lngId
Dim arr, i
lngId = atol(MyIO.Form("SeqId"))
arr = Split(MyIO.Form("List"), ",")
If Not IsNumericArray(arr) Then
MyIO.Echo "请选择您要排序的类别"
Else
strSQL = "UPDATE $(Table) SET SERIAL=$(Serial) WHERE SEQID=$(SeqId) AND FOLLOW=$(Follow)"
strSQL = Replace(strSQL, "$(Table)", T_CATEGORY)
strSQL = Replace(strSQL, "$(Follow)", lngId)
For i = 0 To UBound(arr)
MyKernel.DB.Exec Replace(Replace(strSQL, "$(Serial)", i), "$(SeqId)", atol(arr(i)))
Next
WM_SetCache "category"
MyIO.Echo "OK"
End If
End Sub
Private Sub doPostStaple()
Dim arr
arr = Split(MyIO.Form("List"), ",")
MyKernel.DB.Exec "UPDATE " & T_STAPLE & " SET Cate=0"
If IsNumericArray(arr) Then
strSQL = "UPDATE $(Table) SET CATE=1 WHERE SEQID IN ($(SeqId))"
strSQL = Replace(strSQL, "$(Table)", T_STAPLE)
strSQL = Replace(strSQL, "$(SeqId)", Join(arr, ","))
MyKernel.DB.Exec strSQL
End If
WM_SetCache "staple"
MyIO.Echo "OK"
End Sub
Public Function newInstance()
Set newInstance = New ImplMocomWAPmoManagerCategory
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -