<%
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
%>
<%
rs.close
set rs=nothing
end sub
sub AddAnnounce()
%>
<%
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
%>
<%
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()
%>
字体:
字体大小
颜色:
<%end sub%>