📄 admin_vote.asp
字号:
<!--#include file="Inc/Const.asp"-->
<%
if Not Cl.TrueOtherPurview("Vote") then
Cl.ShowErr("<br /><li>您无此操作权限!</li>")
end if
dim Action
Action=Trim(Request("Action"))
ChannelID=Trim(Request("ChannelID"))
if Not IsNumeric(ChannelID) then ChannelID=-1
ChannelID=CLng(ChannelID)
FileName="admin_Vote.asp?ChannelID="&ChannelID
Header
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr class="title">
<td height="22" colspan="2" align="center"><b>网 站 调 查 管 理</b></td>
</tr>
<tr class="tdbg">
<td width="70" height="30"><strong>管理导航:</strong></td>
<td height="30"><a href="Admin_Vote.asp?Action=Add">添加新调查</a> | <a href="Admin_Vote.asp">所有</a><%
Dim Node
For Each Node In Application(Cl.CacheName & "_channellist").documentElement.selectNodes("channel[@channeltype<2]")
Response.write " | <a href=""Admin_Vote.asp?ChannelID="&Node.selectSingleNode("@channelid").text&""">"&Node.selectSingleNode("@channelname").text&"</a>"
Next
Set Node = Nothing
%></td>
</tr>
</table>
<br />
<%
Select Case Action
Case "Add"
call AddVote()
Case "SaveAdd"
call SaveAdd()
Case "Modify"
call Modify()
Case "SaveModify"
call SaveModify()
Case "Set"
call SetNew()
Case "Del"
call DelVote()
Case else
call main()
End Select
Footer
Sub main()
SQL="select * from Cl_Vote"
if ChannelID<>"" then SQL=SQL & " where ChannelID=" & ChannelID
'SQL=SQL & " order by ChannelID,id desc"
SQL=SQL & " order by ChannelID,IsNew,id desc"
set rs=Cl.Execute(SQL)
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<form action="<%=FileName%>" method="post" name="form1" id="form1">
<tr class="title">
<td width="30" height="22" align="center"><strong>选择</strong></td>
<td width="30" height="22" align="center"><strong>ID</strong></td>
<td height="22" align="center"><strong>主题</strong></td>
<td width="50" height="22" align="center"><strong>频道</strong></td>
<td width="60" height="22" align="center"><strong>操作</strong></td>
</tr>
<%
if not (rs.bof and rs.eof) then
do while not rs.eof
%>
<tr class="tdbg">
<td width="30" align="center">
<input type="radio" value="<%=rs("ID")%>" <%if rs("IsNew")=1 then response.write " checked"%> name="ID" />
</td>
<td width="30" align="center"><%=rs("ID")%></td>
<td><%=rs("Title")%></td>
<td width="50">
<%
response.write Cl.GetChannelName(rs("ChannelID"))
if rs("IsNew")=1 then response.write " <font color=#009900>新</font>"
%>
</td>
<td width="60" align="center">
<%
response.write "<a href='" & FileName & "&Action=Modify&ID=" & rs("ID") & "'>修改</a> "
response.write "<a href='" & FileName & "&Action=Del&ID=" & rs("ID") & "' onClick=""return confirm('确定要删除此调查吗?');"">删除</a>"
%>
</td>
</tr>
<%
rs.movenext
loop
%>
<tr class="tdbg">
<td colspan="5" align="center">
<input name="Action" type="hidden" id="Action" value="Set" />
<input type="submit" value="将选定的调查设为最新调查" name="Submit" />
</td>
</tr>
<%
end if
%>
</form>
</table>
<%
rs.close : set rs=Nothing
end Sub
Sub AddVote()
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<form action="<%=FileName%>" method="post" name="addform" id="addform">
<tr class="title">
<td height="22" class="title" colspan="2" align="center"><b>添 加 调 查</b></td>
</tr>
<tr class="tdbg">
<td width="15%" align="right">主题:</td>
<td width="85%">
<textarea name="Title" cols="80" rows="4"></textarea>
<br /><a href="javascript:admin_Size(-5,'Title')"><img src="images/minus.gif" unselectable="on" border='0' /></a> <a href="javascript:admin_Size(5,'Title')"><img src="images/plus.gif" unselectable="on" border='0' /></a> </td>
</tr>
<tr class="tdbg">
<td align="right">选项:</td>
<td>注:每个选项用“回车”分隔,如要加上初始值,请在每个选项后面用“|”分隔。
<textarea name="Content" cols="80" rows="10"></textarea>
<br /><a href="javascript:admin_Size(-5,'Content')"><img src="images/minus.gif" unselectable="on" border='0' /></a> <a href="javascript:admin_Size(5,'Content')"><img src="images/plus.gif" unselectable="on" border='0' /></a> </td>
</tr>
<tr class="tdbg">
<td align="right">调查类型:</td>
<td>
<select name="Type" id="Type">
<option value="0" selected="selected">单选</option>
<option value="1">多选</option>
</select>
</td>
</tr>
<tr class="tdbg">
<td align="right">所属频道:</td>
<td>
<select name="ChannelID">
<option value="-1">所有频道</option>
<%
Dim Node
For Each Node In Application(Cl.CacheName & "_channellist").DocumentElement.selectNodes("channel[@channeltype<2]")
Response.write "<option value=""" & Node.selectSingleNode("@channelid").text& """>" & Node.selectSingleNode("@channelname").text& "</option>"
Next
Set Node = Nothing%>
</select>
</td>
</tr>
<tr class="tdbg">
<td align="right"> </td>
<td>
<input name="IsNew" type="checkbox" id="IsNew" value="1" checked="checked" />
设为最新调查</td>
</tr>
<tr class="tdbg">
<td colspan="2" align="center">
<input name="Action" type="hidden" id="Action" value="SaveAdd" />
<input name="Submit" type="submit" id="Submit" value=" 添 加 " />
<input name="Reset2" type="reset" id="Reset2" value=" 清 除 " />
</td>
</tr>
</form>
</table>
<%
end Sub
Sub Modify()
Dim ID
ID=Cl.GetClng(Request("ID"))
if ID=0 then
Cl.ShowErr("<br /><li>请指定调查ID</li>")
end if
Set rs = Cl.Execute("select * from Cl_Vote where ID="& ID)
if rs.bof and rs.eof then
rs.close : set rs=Nothing
Cl.ShowErr("<br /><li>找不到指定的调查!</li>")
end if
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<form action="Admin_Vote.asp" method="post" name="modifyform" id="modifyform">
<tr class="title">
<td height="22" class="title" colspan="2" align="center"><b>修 改 调 查</b></td>
</tr>
<tr class="tdbg">
<td width="15%" align="right">主题:</td>
<td width="85%">
<textarea name="Title" cols="80" rows="4"><%=rs("Title")%></textarea>
<br /><a href="javascript:admin_Size(-5,'Title')"><img src="images/minus.gif" unselectable="on" border='0' /></a> <a href="javascript:admin_Size(5,'Title')"><img src="images/plus.gif" unselectable="on" border='0' /></a> </td>
</tr>
<tr class="tdbg">
<td align="right">选项:</td>
<td>注:每个选项用“回车”分隔,如要加上初始值,请在每个选项后面用“|”分隔。
<textarea name="Content" cols="80" rows="10"><%
dim sContent,sNums
sContent=Split(rs("Content"),"@")
sNums=Split(rs("Nums"),"@")
for i=0 to Ubound(sContent)
Response.write sContent(i)&"|"&sNums(i)
if i<Ubound(sContent) then Response.write chr(10)
next
%></textarea>
<br /><a href="javascript:admin_Size(-5,'Content')"><img src="images/minus.gif" unselectable="on" border='0' /></a> <a href="javascript:admin_Size(5,'Content')"><img src="images/plus.gif" unselectable="on" border='0' /></a> </td>
</tr>
<tr class="tdbg">
<td align="right">调查类型:</td>
<td>
<select name="Type" id="Type">
<option value="0" <% if rs("Type")=0 then %> selected="selected" <% end if%>>单选</option>
<option value="1" <% if rs("Type")=1 then %> selected="selected" <% end if%>>多选</option>
</select>
</td>
</tr>
<tr class="tdbg">
<td align="right">所属频道:</td>
<td>
<select name="ChannelID">
<option value="-1">所有频道</option>
<%
Dim Node
For Each Node In Application(Cl.CacheName & "_channellist").DocumentElement.selectNodes("channel[@channeltype<2]")
Response.write "<option value=""" & Node.selectSingleNode("@channelid").text& """>" & Node.selectSingleNode("@channelname").text& "</option>"
Next
Set Node = Nothing%>
</select></td>
</tr>
<tr class="tdbg">
<td align="right"> </td>
<td>
<input name="IsNew" type="checkbox" id="IsNew" value="1" <% if rs("IsNew")=1 then response.write "checked"%> />
设为最新调查</td>
</tr>
<tr class="tdbg">
<td colspan="2" align="center">
<input name="Action" type="hidden" id="Action" value="SaveModify" />
<input name="ID" type="hidden" id="ID" value="<%=rs("ID")%>" />
<input name="Submit" type="submit" id="Submit" value="保存修改结果" />
</td>
</tr>
</form>
</table>
<%
rs.close : set rs=Nothing
end Sub
Sub SaveAdd()
Dim Title, TData, strN, Content, Nums, totalNums, sType, IsNew, ChannelID,i
Title=Trim(request.form("Title"))
sType=Trim(request.form("Type"))
IsNew=Trim(request.form("IsNew"))
ChannelID=Clng(request.form("ChannelID"))
TData=Trim(request.form("Content"))
if Title="" or TData="" then
Cl.OutMsg 0,"请输入标题或者选项!","javascript:history.go(-1)"
end if
if IsNumeric(sType) then
sType=Clng(sType)
if sType<>0 and sType<>1 then sType=0
else
sType=0
end if
if IsNumeric(IsNew) then
IsNew=Clng(IsNew)
if IsNew<>0 and IsNew<>1 then IsNew=0
else
IsNew=0
end if
TData=Split(TData,vbcrlf)
for i=0 to Ubound(TData)
strN=0
if Instr(TData(i),"|")>0 then
strN=Split(TData(i),"|")(1)
TData(i)=Split(TData(i),"|")(0)
if IsNumeric(strN) then
strN=Clng(strN)
else
strN=0
end if
end if
if i=0 then
Content=TData(i)
Nums=strN
totalNums=strN
else
Content=Content&"@"&TData(i)
Nums=Nums&"@"&strN
totalNums=totalNums+strN
end if
next
if IsNew=1 then
Cl.Execute "Update Cl_Vote set IsNew=0 where ChannelID=" & ChannelID
if ChannelID=0 then
for i=0 to 8
Cl.DelCahe("ShowVote_" & i)
next
else
Cl.DelCahe("ShowVote_" & ChannelID)
end if
end if
Cl.Execute "Insert Into [Cl_Vote] (title,Content,Nums,Type,totalNums,IsNew,VoteTime,ChannelID) values ('"&Title&"','"&Content&"','"&Nums&"',"&sType&","&totalNums&","&IsNew&","&SQLNowString&","&ChannelID&")"
Cl.SaveAdminLog
Response.Redirect "admin_Vote.asp?ChannelID="&ChannelID
end Sub
Sub SaveModify()
dim ID,Title, TData, strN, Content, Nums, totalNums, sType, IsNew, ChannelID,i
Title=Trim(request.form("Title"))
sType=Trim(request.form("Type"))
IsNew=Trim(request.form("IsNew"))
ChannelID=Clng(request.form("ChannelID"))
TData=Trim(request.form("Content"))
ID=Cl.GetClng(Request("ID"))
if ID=0 then
Cl.ShowErr("<br /><li>请指定调查ID</li>")
end if
if Title="" or TData="" then
Cl.OutMsg 0,"请输入标题或者选项!","javascript:history.go(-1)"
end if
if IsNumeric(sType) then
sType=Clng(sType)
if sType<>0 and sType<>1 then sType=0
else
sType=0
end if
if IsNumeric(IsNew) then
IsNew=Clng(IsNew)
if IsNew<>0 and IsNew<>1 then IsNew=0
else
IsNew=0
end if
TData=Split(TData,vbcrlf)
for i=0 to Ubound(TData)
strN=0
if Instr(TData(i),"|")>0 then
strN=Split(TData(i),"|")(1)
TData(i)=Split(TData(i),"|")(0)
if IsNumeric(strN) then
strN=Clng(strN)
else
strN=0
end if
end if
if i=0 then
Content=TData(i)
Nums=strN
totalNums=strN
else
Content=Content&"@"&TData(i)
Nums=Nums&"@"&strN
totalNums=totalNums+strN
end if
next
if IsNew=1 then
Cl.Execute "Update Cl_Vote set IsNew=0 where ChannelID=" & ChannelID
if ChannelID=0 then
for i=0 to 8
Cl.DelCahe("ShowVote_" & i)
next
else
Cl.DelCahe("ShowVote_" & ChannelID)
end if
end if
Cl.Execute "Update Cl_Vote set title='"&title&"',Content='"&Content&"',Nums='"&Nums&"',Type="&stype&",totalNums="&totalNums&",IsNew="&IsNew&",VoteTime="&SQLNowString&",ChannelID="&ChannelID&" where ID=" & ID
Cl.SaveAdminLog
Response.Redirect "admin_Vote.asp?ChannelID="&ChannelID
end Sub
Sub SetNew()
dim ID
ID=Cl.GetClng(Request("ID"))
if ID=0 then
Cl.ShowErr("<br /><li>请指定调查ID</li>")
end if
Cl.Execute "Update Cl_Vote set IsNew=0 where IsNew=1 and ChannelID=" & ChannelID & ""
Cl.Execute "Update Cl_Vote set IsNew=1 Where ID=" & ID
Cl.SaveAdminLog
response.Write "<script language='JavaScript' type='text/JavaScript'>alert('设置成功!');</script>"
call main()
end Sub
Sub DelVote()
dim ID
ID=Cl.GetClng(Request("ID"))
if ID=0 then
Cl.ShowErr("<br /><li>请指定调查ID</li>")
end if
Cl.Execute "delete from Cl_Vote where ID=" & ID
Cl.SaveAdminLog
Response.Redirect FileName
end Sub
%>
<%
'<!--
'┌───────────────────────────────────────────────────────┐
'│ │
'│ CreateLive CMS Version 4.0 │
'│ Powered by Aspoo.CN │
'│ │
'│ 邮箱: support@aspoo.cn Info@aspoo.cn │
'│ QQ: 3315263 596197794 │
'│ 网站: www.aspoo.cn www.aspoo.com │
'│ 论坛: bbs.aspoo.cn bbs.aspoo.com │
'│ │
'│ Copyright (C) 2005-2007 Aspoo.CN All Rights Reserved. │
'└───────────────────────────────────────────────────────┘
'-->
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -