📄 admin_announce.asp
字号:
Response.Write " </tr>"
Response.Write " </table>"
Response.Write "</form>"
End Sub
Sub Modify()
Dim sql, rs
If ID = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>请指定要修改的公告ID!</li>"
Exit Sub
Else
ID = PE_CLng(ID)
End If
sql = "select * from PE_Announce where ID=" & ID
Set rs = Conn.Execute(sql)
If rs.BOF And rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg & "<li>找不到指定的公告!</li>"
rs.Close
Set rs = Nothing
Exit Sub
End If
Call ShowJS_AddModify
Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Announce.asp'>"
Response.Write " <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
Response.Write " <tr align='center' class='title'>"
Response.Write " <td height='22' colspan='2'><strong>修 改 公 告</strong></td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>所属频道:</td>"
Response.Write " <td>"
Response.Write " <select name='ChannelID' id='ChannelID'>" & GetChannel_Option(rs("ChannelID")) & "</select>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td width='20%' align='right'>标题:</td>"
Response.Write " <td width='80%'>"
Response.Write " <input type='text' name='Title' size='66' id='Title' value='" & rs("Title") & "'>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>内容:</td>"
Response.Write " <td>"
Response.Write " <textarea name='Content' id='Content' style='display:none' >" & Server.HTMLEncode(rs("Content")) & "</textarea>"
Response.Write " <iframe ID='editor' src='../editor.asp?ChannelID=1&ShowType=2&tContentid=Content' frameborder='1' scrolling='no' width='480' height='280' ></iframe>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>发布人:</td>"
Response.Write " <td>"
Response.Write " <input name='Author' type='text' id='Author' value='" & rs("Author") & "' size='20' maxlength='20'>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>发布时间:</td>"
Response.Write " <td>"
Response.Write " <input name='DateAndTime' type='text' id='DateAndTime' value='" & rs("DateAndTime") & "' size='20' maxlength='20'>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>有效期:</td>"
Response.Write " <td>"
Response.Write " <input name='OutTime' type='text' id='OutTime' value='" & rs("OutTime") & "' size='10' maxlength='20'> 天(为0时,表示永远有效)"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'>显示类型:</td>"
Response.Write " <td>" & GetShowType_Option(rs("ShowType")) & "</td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td align='right'> </td>"
Response.Write " <td>"
Response.Write " <input name='IsSelected' type='checkbox' id='IsSelected' value='yes' "
If rs("IsSelected") = True Then Response.Write " checked"
Response.Write " >设为最新公告</td>"
Response.Write " </tr>"
Response.Write " <tr class='tdbg'>"
Response.Write " <td height='40' colspan='2' align='center'>"
Response.Write " <input name='ID' type='hidden' id='ID' value='" & ID & "'>"
Response.Write " <input name='Action' type='hidden' id='Action' value='SaveModify'>"
Response.Write " <input type='submit' name='Submit' value=' 保 存 '>"
Response.Write " </td>"
Response.Write " </tr>"
Response.Write " </table>"
Response.Write "</form>"
rs.Close
Set rs = Nothing
End Sub
Sub SaveAnnounce()
Dim Title, Content, Author, DateAndTime, ShowType, IsSelected, OutTime
Dim rs, sql
Title = Trim(Request("Title"))
Content = Trim(Request("Content"))
Author = Trim(Request("Author"))
DateAndTime = PE_CDate(Trim(Request("DateAndTime")))
ShowType = PE_CLng(Request("ShowType"))
IsSelected = Trim(Request("IsSelected"))
OutTime = PE_CLng(Request("OutTime"))
If Title = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>公告标题不能为空!</li>"
End If
If Len(Title) > 250 Then
FoundErr = True
ErrMsg = ErrMsg & "<li>公告标题过长(应小于250)!</li>"
End If
If Content = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>公告内容不能为空!</li>"
End If
If FoundErr = True Then
Exit Sub
End If
Title = PE_HTMLEncode(Title)
Author = PE_HTMLEncode(Author)
If ShowType = "" Then
ShowType = 0
Else
ShowType = PE_CLng(ShowType)
End If
If IsSelected = "yes" Then
IsSelected = True
Else
IsSelected = False
End If
Set rs = Server.CreateObject("adodb.recordset")
If Action = "SaveAdd" Then
sql = "select top 1 * from PE_Announce"
rs.Open sql, Conn, 1, 3
rs.addnew
ElseIf Action = "SaveModify" Then
If ID = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>不能确定公告ID</li>"
Exit Sub
Else
sql = "select * from PE_Announce where ID=" & PE_CLng(ID)
rs.Open sql, Conn, 1, 3
If rs.BOF And rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg & "<li>找不到指定的公告!</li>"
rs.Close
Set rs = Nothing
Exit Sub
End If
End If
End If
rs("ChannelID") = ChannelID
rs("Title") = Title
rs("Content") = Content
rs("Author") = Author
rs("DateAndTime") = DateAndTime
rs("ShowType") = ShowType
rs("IsSelected") = IsSelected
rs("OutTime") = OutTime
rs.Update
rs.Close
Set rs = Nothing
Call ClearSiteCache(0)
Call WriteEntry(2, AdminName, "保存公告成功:" & Title)
Call CloseConn
Response.Redirect "admin_announce.asp?ChannelID=" & ChannelID
End Sub
Sub SetProperty()
Dim sqlProperty, rsProperty
Dim ShowType, MoveChannelID
If ID = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>请指定公告ID</li>"
End If
If Action = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>参数不足!</li>"
End If
If FoundErr = True Then
Exit Sub
End If
If InStr(ID, ",") > 0 Then
sqlProperty = "select * from PE_Announce where ID in (" & ID & ")"
Else
sqlProperty = "select * from PE_Announce where ID=" & ID
End If
Set rsProperty = Server.CreateObject("ADODB.Recordset")
rsProperty.Open sqlProperty, Conn, 1, 3
Do While Not rsProperty.EOF
Select Case Action
Case "SetNew"
rsProperty("IsSelected") = True
Case "CancelNew"
rsProperty("IsSelected") = False
Case "SetShowType"
ShowType = Trim(Request("ShowType"))
If ShowType = "" Then
ShowType = 0
Else
ShowType = PE_CLng(ShowType)
End If
rsProperty("ShowType") = ShowType
Case "Move"
MoveChannelID = PE_CLng(Trim(Request("ChannelID")))
rsProperty("ChannelID") = MoveChannelID
Case "Del"
rsProperty.Delete
End Select
rsProperty.Update
rsProperty.MoveNext
Loop
rsProperty.Close
Set rsProperty = Nothing
Call ClearSiteCache(0)
Call WriteEntry(2, AdminName, "设置公告属性成功:" & ID)
Call CloseConn
Response.Redirect ComeUrl
End Sub
Function GetShowType_Option(ShowType)
Dim strShowType
strShowType = "<input type='radio' name='ShowType' value='0'"
If ShowType = 0 Then
strShowType = strShowType & " checked"
End If
strShowType = strShowType & ">" & "全部 "
strShowType = strShowType & "<input type='radio' name='ShowType' value='1'"
If ShowType = 1 Then
strShowType = strShowType & " checked"
End If
strShowType = strShowType & ">" & "滚动 "
strShowType = strShowType & "<input type='radio' name='ShowType' value='2'"
If ShowType = 2 Then
strShowType = strShowType & " checked"
End If
strShowType = strShowType & ">" & "弹出 "
GetShowType_Option = strShowType
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -