<%@language=vbscript codepage=936 %> <% option explicit response.buffer=true Const PurviewLevel=2 Const CheckChannelID=0 Const PurviewLevel_Others="Announce" %> <% dim sql,rs,rsChannel,strFileName,UbbImagePath dim Action,Channel,FoundErr,ErrMsg Action=Trim(Request("Action")) Channel=Trim(Request("Channel")) if Channel="" then Channel=0 else Channel=CLng(Channel) end if strFileName="admin_announce.asp?Channel="&Channel UbbImagePath="images/guestbook/" %> 公告管理
网 站 公 告 管 理
管理导航: 添加新公告 | 所有频道公告 | 网站首页公告 | 文章频道公告 | 软件频道公告 | 图片频道公告 | 留言频道公告 |
<% if Action="Add" then call AddAnnounce() elseif Action="SaveAdd" then call SaveAdd() elseif Action="Modify" then call Modify() elseif Action="SaveModify" then call SaveModify() elseif Action="SetNew" then call SetNew() elseif Action="CancelNew" then call CancelNew() elseif Action="SetShowType" then call SetShowType() elseif Action="Move" then call MoveAnnounce() elseif Action="Del" then call DelAnnounce() else call main() end if if FoundErr=True then call WriteErrMsg() end if call CloseConn() sub main() sql="select * from Announce" sql=sql & " where ChannelID=" & Channel sql=sql & " order by IsSelected,id desc" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 %>
onsubmit="return ConfirmDel();"> <% response.write "您现在的位置:网站公告管理 >> " select case Channel case 0 response.write "所有频道公告" case 1 response.write "网站首页公告" case 2 response.write "文章频道公告" case 3 response.write "软件频道公告" case 4 response.write "图片频道公告" case 5 response.write "留言频道公告" case else response.write "错误的参数" end select response.write "
" %> <% if not(rs.bof and rs.eof) then do while not rs.eof %> <% rs.movenext loop %> <% end if%>
选择 公告ID 标 题 最新公告 显示方式 发布人 发布时间 操作
name="AnnounceID"> <%=rs("ID")%> " title="<%=left(nohtml(rs("content")),200)%>"><%=rs("Title")%> <%if rs("IsSelected")=true then response.write "" end if%> <% if rs("ShowType")=0 then response.write "全部" elseif rs("ShowType")=1 then response.write "滚动" elseif rs("ShowType")=2 then response.write "弹出" end if %> <%=rs("Author")%> <%=rs("DateAndTime")%> <% response.write "修改  " response.write "删除" %>
选中所有公告     说明:只有将公告设为最新公告后才会在前台显示 <% if PopAnnounce="No" then response.write "(网站配置中已将弹出公告禁用)"%>
将选定的公告:            
<% rs.close set rs=nothing end sub sub AddAnnounce() %>
>
添 加 公 告
标题:
Ubb标签: <% call showubb()%>
内容:    
发布人:
发布时间:
所属频道: 全部   首页   文章   软件   图片   留言  
显示类型: 全部   滚动   弹出  
  设为最新公告
<% end sub sub Modify() dim ID ID=trim(request("ID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定要修改的公告ID!
  • " else ID=Clng(ID) end if sql="select * from Announce where ID=" & ID set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 if rs.bof and rs.eof then FoundErr=true ErrMsg=ErrMsg & "
  • 找不到指定的公告!
  • " rs.close set rs=nothing exit sub end if %>
    >
    修 改 公 告
    标题: ">
    Ubb标签: <% call showubb()%>
    内容:  
    发布人: " size="20" maxlength="20">
    发布时间: " size="20" maxlength="20">
    所属频道: > 全部   > 首页   > 文章   > 软件   > 图片   > 留言  
    显示类型: > 全部   > 滚动   > 弹出  
      > 设为最新公告
    ">
    <% rs.close set rs=nothing end sub %> <% sub SaveAdd() dim Title,Content,Author,DateAndTime,IsSelected,ChannelID,ShowType,sql Title=trim(request("Title")) Content=trim(request("Content")) Author=trim(request("Author")) DateAndTime=trim(request("DateAndTime")) IsSelected=trim(request("IsSelected")) ChannelID=Clng(request("ChannelID")) ShowType=Clng(request("ShowType")) if Title="" then FoundErr=True ErrMsg=ErrMsg & "
  • 公告标题不能为空!
  • " end if if len(Title)>250 then FoundErr=True ErrMsg=ErrMsg & "
  • 公告标题过长(应小于250)!
  • " end if if Content="" then FoundErr=True ErrMsg=ErrMsg & "
  • 公告内容不能为空!
  • " end if if FoundErr=True then exit sub end if Title=dvHtmlEncode(Title) ' Content=dvHtmlEncode(Content) Author=dvHtmlEncode(Author) if DateAndTime<>"" and IsDate(DateAndTime)=true then DateAndTime=Cdate(DateAndTime) else DateAndTime=now() end if if IsSelected="True" then IsSelected=True else IsSelected=False end if sql="select * from Announce" set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,3 rs.addnew rs("Title")=Title rs("Content")=Content rs("Author")=Author rs("DateAndTime")=DateAndTime rs("IsSelected")=IsSelected rs("ChannelID")=ChannelID rs("ShowType")=ShowType rs.update rs.close set rs=nothing call CloseConn() response.redirect "admin_announce.asp?Channel="&ChannelID end sub sub SaveModify() dim ID,Title,Content,Author,DateAndTime,IsSelected,ChannelID,ShowType ID=trim(request("ID")) Title=trim(request("Title")) Content=trim(request("Content")) Author=trim(request("Author")) DateAndTime=trim(request("DateAndTime")) IsSelected=trim(request("IsSelected")) ChannelID=Clng(request("ChannelID")) ShowType=Clng(request("ShowType")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定要修改的公告ID!
  • " else ID=Clng(ID) end if if Title="" then FoundErr=True ErrMsg=ErrMsg & "
  • 公告标题不能为空!
  • " end if if len(Title)>250 then FoundErr=True ErrMsg=ErrMsg & "
  • 公告标题过长(应小于250)!
  • " end if if Content="" then FoundErr=True ErrMsg=ErrMsg & "
  • 公告内容不能为空!
  • " end if if FoundErr=True then exit sub end if sql="select * from Announce where ID=" & ID set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,3 if rs.bof and rs.eof then FoundErr=true ErrMsg=ErrMsg & "
  • 找不到指定的公告!
  • " rs.close set rs=nothing exit sub end if Title=dvHtmlEncode(Title) ' Content=dvHtmlEncode(Content) Author=dvHtmlEncode(Author) if DateAndTime<>"" and IsDate(DateAndTime)=true then DateAndTime=Cdate(DateAndTime) else DateAndTime=now() end if if IsSelected="True" then IsSelected=True else IsSelected=false end if rs("Title")=Title rs("Content")=Content rs("Author")=Author rs("DateAndTime")=DateAndTime rs("IsSelected")=IsSelected rs("ChannelID")=ChannelID rs("ShowType")=ShowType rs.update rs.close set rs=nothing call CloseConn() response.redirect strFileName end sub sub SetNew() dim ID ID=Trim(Request("AnnounceID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定公告ID
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Announce set IsSelected=True Where ID=" & CLng(arrID(i)) next else conn.execute "Update Announce set IsSelected=True Where ID=" & CLng(ID) end if response.redirect strFileName end sub sub CancelNew() dim ID ID=Trim(Request("AnnounceID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定公告ID
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Announce set IsSelected=False Where ID=" & CLng(arrID(i)) next else conn.execute "Update Announce set IsSelected=False Where ID=" & CLng(ID) end if response.redirect strFileName end sub sub SetShowType() dim ID,ShowType ID=Trim(Request("AnnounceID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定要移动的公告ID!
  • " exit sub end if ShowType=Trim(Request("ShowType")) if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Announce set ShowType = "& ShowType & " where ID=" & CLng(arrID(i)) next else conn.execute "Update Announce set ShowType = "& ShowType & " where ID=" & CLng(ID) end if response.redirect strFileName end sub sub MoveAnnounce() dim ID,MoveChannelID ID=Trim(Request("AnnounceID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定要移动的公告ID!
  • " exit sub end if MoveChannelID=Trim(Request("ChannelID")) if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "Update Announce set ChannelID = "& MoveChannelID & " where ID=" & CLng(arrID(i)) next else conn.execute "Update Announce set ChannelID = "& MoveChannelID & " where ID=" & CLng(ID) end if response.redirect strFileName end sub sub DelAnnounce() dim ID ID=Trim(Request("AnnounceID")) if ID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定要删除的公告ID!
  • " exit sub end if if Instr(ID,",")>0 then dim arrID,i arrID=split(ID,",") for i=0 to Ubound(arrID) conn.execute "delete from Announce where ID=" & CLng(arrID(i)) next else conn.execute "delete from Announce where ID=" & CLng(ID) end if response.redirect strFileName end sub '================================================= '过程名:sub ShowUbb() '作 用:显示Ubb标签 '参 数:无 '================================================= sub ShowUbb() %> 粗体斜体下划线居中超级连接Email连接图片Flash图片Shockwave文件realplay视频文件Media Player视频文件QuickTime视频文件代码引用飞行字移动字发光字阴影字
    字体: 字体大小 颜色:  帮助 <%end sub%>