📄 msgbox
字号:
Private blnError
Private strError
Private objPage
Private rs, strSQL
Private Sub Class_Initialize()
blnError = True
strError = "无错误"
End Sub
Public Sub main()
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Call doPost
Else
Call doGet
End If
End Sub
Private Sub doGet()
Select Case LCase(Request.QueryString("Handle"))
Case "list"
MyIO.CodePage = 65001
Call doGetList
Case "option"
Call doGetOption
Case Else
Call doGetMain
End Select
End Sub
Private Sub doPost()
Select Case LCase(Request.QueryString("Handle"))
Case "remove"
Call doPostRemove
Case Else
MyIO.Echo "未知操作"
End Select
End Sub
Private Sub doGetMain()
MyIO.Echo "<html>"
MyIO.Echo "<head>"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""no-cache"" />"
MyIO.Echo "<meta http-equiv=""cache-control"" content=""max-age=0"" />"
MyIO.Echo "<meta http-equiv=""content-type"" content=""text/html; charset=gb2312"" />"
MyIO.Echo "<title>" & MyKernel.Env("WM_VNAME") & " - 短消息管理</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"">"
MyIO.Echo "jspp.Caption = """ & MyKernel.Env("WM_NAME") & """;"
MyIO.Echo "</script>"
MyIO.Echo "<script language=""javascript"" src=""images/wm_msg.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()
Response.Charset = "utf-8"
Select Case Request.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 colspan=""2"" class=""winT0"">"
MyIO.Echo " <b>所有短信息</b>"
MyIO.Echo " <a href=""javascript:void(0)"" class=""a1"" onclick=""jspp.Msg.doPage(jspp.Msg.page)"">刷新短信息列表</a>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td colspan=""2"" id=""_list_""></td>"
MyIO.Echo "</tr>"
MyIO.Echo "</table>"
MyIO.Echo "</form>"
Case Else
MyIO.Echo "未知选项"
End Select
End Sub
Private Sub doGetList()
Response.Charset = "utf-8"
Dim i
Dim strKey
Dim strWhere
strKey = Trim(MyIO.QueryString("Keyword"))
Set objPage = MyKernel.Page()
objPage.PageNum = MyIO.QueryString("Page")
objPage.PageSize = 20
objPage.dataType = WM_DataType
objPage.Increment = "Intime"
objPage.Column = "*"
objPage.Table = T_MSGBOX
strWhere = "1=1"
If strKey <> "" Then
strWhere = strWhere & Replace(" AND (SenderName LIKE '%$(Keyword)%' Or SendtoName LIKE '%$(Keyword)%' Or TITLE LIKE '%$(Keyword)%' Or Content LIKE '%$(Keyword)%')", "$(Keyword)", SafeString(strKey))
End If
objPage.Where = strWhere
objPage.Sort = "Intime DESC"
objPage.SortType = True
Set rs = objPage.Execute()
MyIO.Echo "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""0"" align=""center"" style=""border-collapse:collapse;word-break:break-all;word-wrap:break-word;"" bordercolor=""#000000"">"
MyIO.Echo "<tr>"
MyIO.Echo "<td width=""8%"" class=""winT0""><b>选择</b></td>"
MyIO.Echo "<td width=""10%"" class=""winT0""><b>发件人<b/></td>"
MyIO.Echo "<td width=""10%"" class=""winT0""><b>收件人<b/></td>"
MyIO.Echo "<td width=""50%"" class=""winT0""><b>短信息<b/></td>"
MyIO.Echo "<td width=""14%"" class=""winT0""><b>时间<b/></td>"
MyIO.Echo "<td width=""8%"" class=""winT0""><b>管理</b></td>"
MyIO.Echo "</tr>"
If objPage.TotalRow > 0 Then
i = 0
Dim objMsg
Set objMsg = MyKernel.Table(T_MSGBOX)
Do While rs.EOF = False And i < objPage.PageSize
objMsg.Source = rs
MyIO.Echo "<tr class=""winT1"">"
MyIO.Echo "<td align=""center""><input type=""checkbox"" id=""SeqId"" name=""SeqId"" value=""" & objMsg("SeqId") & """ /></td>"
If objMsg("Sender") = 0 Then
MyIO.Echo "<td>站长</td>"
Else
MyIO.Echo "<td><a href=""javascript:void(0)"" onclick=""getUserDetail(" & objMsg("Sender") & ")"">" & Server.HTMLEncode(objMsg("SenderName")) & "</a></td>"
End If
If objMsg("Sendto") = 0 Then
MyIO.Echo "<td>所有用户</td>"
Else
MyIO.Echo "<td><a href=""javascript:void(0)"" onclick=""getUserDetail(" & objMsg("Sendto") & ")"">" & Server.HTMLEncode(objMsg("SendtoName")) & "</a></td>"
End If
MyIO.Echo "<td>" & Server.HTMLEncode(objMsg("Title")) & "</td>"
MyIO.Echo "<td align=""right"">" & FormatTime(getDate(objMsg("Intime")), "YY-MM-DD HH24:MI") & "</td>"
MyIO.Echo "<td align=""center"">"
MyIO.Echo "<select class=""sel"" onchange=""jspp.Msg.control(this, " & objMsg("SeqId") & ")"">"
MyIO.Echo "<option value=""0"">管理</option>"
MyIO.Echo "<option value=""1"">删除</option>"
MyIO.Echo "</select>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
rs.MoveNext
i = i + 1
Loop
Set objMsg = Nothing
Call ShowControl
Call ShowPage
Else
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""6"">尚无任何短信息</td>"
MyIO.Echo "</tr>"
Call ShowControl
End If
MyIO.Echo "</table>"
If Not rs Is Nothing Then rs.Close
Set rs = Nothing
Set objPage = Nothing
End Sub
Private Sub ShowControl()
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td align=""center""><input type=""checkbox"" onclick=""chkAll(this)"" /></td>"
MyIO.Echo "<td colspan=""5"">"
MyIO.Echo " <input type=""button"" class=""btn"" value=""删除"" onclick=""jspp.Msg.removeAll(this.form)"" />"
MyIO.Echo " <input type=""button"" class=""btn"" value=""搜索"" onclick=""jspp.Msg.query(this.form)"" />"
MyIO.Echo " <input name=""Keyword"" type=""text"" class=""txt"" value=""" & Server.HTMLEncode(MyIO.QueryString("Keyword")) & """ />"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
End Sub
Private Sub ShowPage()
MyIO.Echo "<tr class=""winT4"">"
MyIO.Echo "<td colspan=""7"" align=""right"">"
MyIO.Echo "共 " & objPage.TotalRow & " 条信息 "
MyIO.Echo objPage.PageSize & " 条/页 "
MyIO.Echo objPage.PageNum & "/" & objPage.TotalPage & " 页"
If objPage.PageNum > 1 Then
MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Msg.doPage(1)"" class=""a1"" />首 页</a>"
MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Msg.doPage(" & (objPage.PageNum - 1) & ")"" class=""a1"" />上一页</a>"
Else
MyIO.Echo " <a class=""a1"">首 页</a>"
MyIO.Echo " <a class=""a1"">上一页</a>"
End If
If objPage.PageNum < objPage.TotalPage Then
MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Msg.doPage(" & (objPage.PageNum + 1) & ")"" class=""a1"" />下一页</a>"
MyIO.Echo " <a href=""javascript:void(0)"" onclick=""jspp.Msg.doPage(" & objPage.TotalPage & ")"" class=""a1"" />尾 页</a>"
Else
MyIO.Echo " <a class=""a1"">下一页</a>"
MyIO.Echo " <a class=""a1"">尾 页</a>"
End If
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
End Sub
Private Sub doPostRemove()
Response.Charset = "utf-8"
If MyPower("DeleteRemark") = 0 Then
MyIO.Echo "您没有删除短信息的权限"
Else
Dim strId
Dim objMsg
strId = Trim(Request.Form("SeqId"))
If Not IsNumbers(strId) Then
MyIO.Echo "请选择您要删除的短消息"
Else
strSQL = "SELECT * FROM $(Table) WHERE SEQID IN ($(SeqId))"
strSQL = Replace(strSQL, "$(Table)", T_MSGBOX)
strSQL = Replace(strSQL, "$(SeqId)", strId)
Set rs = MyKernel.DB.Query(strSQL, adOpenKeyset, adLockOptimistic, adCmdText)
Set objMsg = MyKernel.Table(T_MSGBOX)
If rs.EOF Then
MyIO.Echo "找不到您要删除的短消息"
Else
Dim blnUpdate
blnUpdate = False
Do While Not rs.EOF
objMsg.Source = rs
If objMsg("Sender") > 0 Then
strSQL = "UPDATE $(Table) SET MSGSEND=MSGSEND-1 WHERE USERID=$(UserId)"
strSQL = Replace(strSQL, "$(Table)", T_USER)
strSQL = Replace(strSQL, "$(UserId)", objMsg("Sender"))
MyKernel.DB.Exec strSQL
ElseIf objMsg("Sendto") > 0 Then
If objMsg("Status") = 0 Then
strSQL = "UPDATE $(Table) SET MSGRECV=MSGRECV-1 WHERE USERID=$(UserId)"
Else
strSQL = "UPDATE $(Table) SET MSGRECV=MSGRECV-1,MSGNEW=MSGNEW-1 WHERE USERID=$(UserId)"
End If
strSQL = Replace(strSQL, "$(Table)", T_USER)
strSQL = Replace(strSQL, "$(UserId)", objMsg("Sendto"))
MyKernel.DB.Exec strSQL
Else
blnUpdate = True
End If
rs.Delete adAffectCurrent
rs.MoveNext
Loop
If blnUpdate Then
setCache "WAPmo.MsgCount", atol(MyKernel.DB.getRecord("SELECT COUNT(SeqId) FROM " & T_MSGBOX & " WHERE SENDER=0"))
End If
MyIO.Echo "OK"
End If
Set objMsg = Nothing
rs.Close
Set rs = Nothing
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -