📄 admin_announce.asp
字号:
<td align="right" class="TableRow2"><strong>所属频道:</strong></td>
<td class="TableRow1"><select name="ChannelID" id="ChannelID">
<option value="0"<%If isEdit Then If Rs("ChannelID") = 0 Then Response.Write " selected"%>>首页公告</option>
<%
Set oRs = Newasp.Execute("Select ChannelID,ChannelName,ChannelType From NC_Channel where ChannelType < 2 Order By orders")
Do While Not oRs.EOF
Response.Write "<option value="""& oRs("ChannelID") &""""
If isEdit Then
If oRs("ChannelID") = Rs("ChannelID") Then Response.Write " selected"
End If
Response.Write ">"
Response.Write oRs("ChannelName")
Response.Write "</option>"
oRs.movenext
Loop
oRs.Close:Set oRs = Nothing
%>
<option value="999"<%If isEdit Then If Rs("ChannelID") = 999 Then Response.Write " selected"%>>所有频道显示</option>
</select></td>
</tr>
<tr>
<td align="right" class="TableRow2"><strong>公告类型:</strong></td>
<td class="TableRow1"><input name="AnnounceType" type="radio" value="0"<%If isEdit Then If Rs("AnnounceType") = 0 Then Response.Write " checked" End If:Else Response.Write " checked" End If%>>
列表公告
<input type="radio" name="AnnounceType" value="1"<%If isEdit Then If Rs("AnnounceType") = 1 Then Response.Write " checked"%>>
内容公告</td>
</tr>
<tr>
<td align="right" class="TableRow2"><strong>公告内容:</strong></td>
<td class="TableRow1"><textarea name="content" style="display:none" id="content"><%If isEdit Then Response.Write Server.HTMLEncode(Rs("content"))%></textarea>
<script src='../editor/edit.js' type=text/javascript></script></td>
</tr>
<tr>
<td align="right" class="TableRow2"><strong>上传文件:</strong></td>
<td class="TableRow1"><iframe name="image" frameborder=0 width='100%' height=45 scrolling=no src=upfiles.asp></iframe></td>
</tr>
<tr>
<td align="right" class="TableRow2"><strong>发布人:</strong></td>
<td class="TableRow1"><input name="writer" type="text" id="writer" size="15" value='<%If isEdit Then Response.Write Rs("writer") Else Response.Write AdminName End If%>'>
<span class="style1">* </span>
<%If isEdit Then%>
<input name="update" type="checkbox" id="update" value="yes">
更新公告时间
<%End If%></td>
</tr>
<tr>
<td align="right" class="TableRow2"> </td>
<td align="center" class="TableRow1">
<input type="button" name="Submit2" onclick="CheckLength();" value="查看内容长度" class=Button>
<input type="button" name="Submit4" onclick="javascript:history.go(-1)" value="返回上一页" class=Button>
<input name="Submit1" type="submit" class="Button" value="保存公告" class=Button></td>
</tr></form>
<tr>
<td colspan="2" class="TableRow1"><strong>说明:</strong><br>
所属频道 ---- 只有频道首页才显示公告;<br>
公告类型 ---- 列表显示是指公告以列表的形式显示公告,需要用户点击才可以看到公告内容;内容公告是指公告以内容的方式显示在所在的频道首页,注意只显示最新的一条公告。</td>
</tr>
</table>
</div>
<%
If isEdit Then Rs.Close:Set Rs = Nothing
End Sub
Private Sub CheckSave()
If Trim(Request.Form("title")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>公告标题不能为空!</li>"
End If
If Trim(Request.Form("ChannelID")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>频道ID不能为空!</li>"
End If
If Trim(Request.Form("AnnounceType")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>公告类型不能为空!</li>"
End If
If Trim(Request.Form("content")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>公告内容不能为空!</li>"
End If
If Trim(Request.Form("writer")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>公告发布人不能为空!</li>"
End If
TextContent = ""
For i = 1 To Request.Form("content").Count
TextContent = TextContent & Request.Form("content")(i)
Next
End Sub
Private Sub SaveAnnounce()
CheckSave
If Founderr = True Then Exit Sub
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from NC_Announce where (AnnounceID is null)"
Rs.Open SQL,Conn,1,3
Rs.Addnew
Rs("ChannelID") = Trim(Request.Form("ChannelID"))
Rs("title") = Newasp.ChkFormStr(Request.Form("title"))
Rs("AnnounceType") = Request.Form("AnnounceType")
Rs("Content") = TextContent
Rs("writer") = Newasp.ChkFormStr(Request.Form("writer"))
Rs("PostTime") = Now()
Rs("hits") = 0
Rs.update
Rs.Close
Rs.Open "select top 1 AnnounceID from NC_Announce order by AnnounceID desc", Conn, 1, 1
AnnounceID = Rs("AnnounceID")
Rs.Close:Set Rs = Nothing
Succeed("<li>恭喜您!添加新的公告成功。</li><li><a href=?action=view&AnnounceID=" & AnnounceID & ">点击此处查看该公告</a></li>")
End Sub
Private Sub ModifyAnnounce()
CheckSave
If Founderr = True Then Exit Sub
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from NC_Announce where AnnounceID = " & Request("AnnounceID")
Rs.Open SQL,Conn,1,3
Rs("ChannelID") = Trim(Request.Form("ChannelID"))
Rs("title") = Newasp.ChkFormStr(Request.Form("title"))
Rs("AnnounceType") = Request.Form("AnnounceType")
Rs("Content") = TextContent
Rs("writer") = Newasp.ChkFormStr(Request.Form("writer"))
If LCase(Request.Form("Update")) = "yes" Then Rs("PostTime") = Now()
Rs.update
AnnounceID = Rs("AnnounceID")
Rs.Close:Set Rs = Nothing
Succeed("<li>恭喜您!修改公告成功。</li><li><a href=?action=view&AnnounceID=" & AnnounceID & ">点击此处查看该公告</a></li>")
End Sub
Private Sub DelAnnounce()
If Trim(Request("AnnounceID")) = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>请输入公告ID!</li>"
Exit Sub
End If
Newasp.Execute("Delete From NC_Announce where AnnounceID = " & Request("AnnounceID"))
OutHintScript("公告删除成功!")
End Sub
Private Sub ViewAnnounce()
If Request("AnnounceID") = "" Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!您选择了错误的系统参数。</li>"
Exit Sub
End If
dim n
n = 1
Newasp.Execute ("update NC_Announce set hits = hits + "&n&" where AnnounceID=" & Request("AnnounceID"))
SQL = "select * from NC_Announce where AnnounceID=" & Request("AnnounceID")
Set Rs = Newasp.Execute(SQL)
If Rs.bof And Rs.EOF Then
FoundErr = True
ErrMsg = ErrMsg + "<li>Sorry!没有找到任何公告。或者您选择了错误的系统参数!</li>"
Exit Sub
Else
%>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="TableBorder">
<tr>
<th colspan="2">查看公告</th>
</tr>
<tr>
<td align="center" class="TableRow2" colspan="2"><a href=?action=edit&AnnounceID=<%=Rs("AnnounceID")%>><font size=4><%=Rs("title")%></font></a></td>
</tr>
<tr>
<td align="center" class="TableRow1"><strong>发布时间:</strong> <%=Rs("PostTime")%>
<strong>发 布 人:</strong> <%=Rs("writer")%> <strong>浏览次数:</strong> <%=Rs("hits")%></td>
</tr>
<tr>
<td class="TableRow1"><strong>公告内容:</strong><br><%=Newasp.ReadContent(Rs("content"))%></td>
</tr>
<tr>
<td class="TableRow2">上一公告:<%=FrontAnnounce(Rs("AnnounceID"))%>
<br>下一公告:<%=NextAnnounce(Rs("AnnounceID"))%></td>
</tr>
<tr>
<td align="center" colspan="2" class="TableRow2"><input type="button" onclick="javascript:window.close()" value="关闭本窗口" name="B2" class=Button>
<input type="button" onclick="javascript:history.go(-1)" value="返回上一页" name="B1" class=Button>
<input type="button" name="Submit1" onclick="javascript:location.href='#'" value="返回顶部" class=button>
<input type="button" name="Submit1" onclick="javascript:location.href='?action=edit&AnnounceID=<%=Rs("AnnounceID")%>'" value="编辑公告" class=button></td>
</tr>
</table>
<%
End If
Rs.Close
Set Rs = Nothing
End Sub
Private Function FrontAnnounce(AnnounceID)
Dim Rss, SQL
SQL = "select Top 1 AnnounceID,title from NC_Announce where AnnounceID < " & AnnounceID & " order by AnnounceID desc"
Set Rss = Newasp.Execute(SQL)
If Rss.EOF And Rss.bof Then
FrontAnnounce = "已经没有了"
Else
FrontAnnounce = "<a href=admin_Announce.asp?action=view&AnnounceID=" & Rss("AnnounceID") & ">" & Rss("title") & "</a>"
End If
Rss.Close
Set Rss = Nothing
End Function
Private Function NextAnnounce(AnnounceID)
Dim Rss, SQL
SQL = "select Top 1 AnnounceID,title from NC_Announce where AnnounceID > " & AnnounceID & " order by AnnounceID asc"
Set Rss = Newasp.Execute(SQL)
If Rss.EOF And Rss.bof Then
NextAnnounce = "已经没有了"
Else
NextAnnounce = "<a href=admin_Announce.asp?action=view&AnnounceID=" & Rss("AnnounceID") & ">" & Rss("title") & "</a>"
End If
Rss.Close
Set Rss = Nothing
End Function
Private Sub showpage()
Dim n
If totalnumber Mod maxperpage = 0 Then
n = totalnumber \ maxperpage
Else
n = totalnumber \ maxperpage + 1
End If
Response.Write "<table cellspacing=1 width='100%' border=0><form method=Post action=?ChannelID=" & Request("ChannelID") & "><tr><td align=center> " & vbCrLf
If CurrentPage < 2 Then
Response.Write "共有公告 <font COLOR=#FF0000><strong>" & totalnumber & "</strong></font> 篇 首 页 上一页 | "
Else
Response.Write "共有公告 <font COLOR=#FF0000><strong>" & totalnumber & "</strong></font> 篇 <a href=?page=1&ChannelID=" & Request("ChannelID") & ">首 页</a> "
Response.Write "<a href=?page=" & CurrentPage - 1 & "&ChannelID=" & Request("ChannelID") & ">上一页</a> | "
End If
If n - CurrentPage < 1 Then
Response.Write "下一页 尾 页" & vbCrLf
Else
Response.Write "<a href=?page=" & (CurrentPage + 1) & "&ChannelID=" & Request("ChannelID") & ">下一页</a>"
Response.Write " <a href=?page=" & n & "&ChannelID=" & Request("ChannelID") & ">尾 页</a>" & vbCrLf
End If
Response.Write " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
Response.Write " 转到:"
Response.Write "<input name=page size=3 value='" & CurrentPage & "'> <input class=Button type=submit name=Submit value='转到'>"
Response.Write "</td></tr></FORM></table>" & vbCrLf
End Sub
Public Sub CreateAnnounce()
Dim rsAnnounce,sqlAnnounce
sqlAnnounce = "select A.AnnounceID,A.title,A.PostTime,A.AnnounceType,C.ChannelDir,C.ChannelUrl,C.BindDomain,C.DomainName from [NC_Announce] A inner join [NC_Channel] C On A.ChannelID=C.ChannelID where A.ChannelID=" & ChannelID & ""
Set rsAnnounce = Newasp.Execute(sqlAnnounce)
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -