<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("12")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">


<%
action=request("ok")
if action="" then 
Set rs = conn.Execute("select * from vote") 
%>

	<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
	<form action=vote.asp method=post name=vote>
	
	<tr class=backs><td colspan=2 class=td height=18>调查投票管理</td></tr>
	
	<tr><td width=20% align=right height="18">调查标题 &nbsp; &nbsp;</td><td>
	<input type=text value="<%=rs("title")%>" name=title size=30 maxlength=30> [建议12汉字以内]

	<tr><td width=20% align=right height="18">投票类型  &nbsp; &nbsp;</td><td>
	<input type=radio value="dan" <%if rs("VoteType")="dan" then%>checked<%end if%> name="VoteType">单选  &nbsp;  
	<input type=radio value="duo" <%if rs("VoteType")="duo" then%>checked<%end if%> name="VoteType">多选

	<tr><td width=20% align=right height="18">选 项 一 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select1")%>" name=select1 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer1")%>" name=answer1 size=4 maxlength=4> 
	
	<tr><td width=20% align=right height="18">选 项 二 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select2")%>" name=select2 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer2")%>" name=answer2 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 三 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select3")%>" name=select3 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer3")%>" name=answer3 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 四 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select4")%>" name=select4 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer4")%>" name=answer4 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 五 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select5")%>" name=select5 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer5")%>" name=answer5 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 六 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select6")%>" name=select6 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer6")%>" name=answer6 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 七 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select7")%>" name=select7 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer7")%>" name=answer7 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">选 项 八 &nbsp; &nbsp;</td><td> 
	<input type=text value="<%=rs("select8")%>" name=select8 size=30 maxlength=30> 
	&nbsp; &nbsp; 投票数：<input type=text value="<%=rs("answer8")%>" name=answer8 size=4 maxlength=4> 

	<tr><td width=20% align=right height="18">开 关 &nbsp; &nbsp;</td><td>
	<input type=radio value="0" <%if rs("view")="0" then%>checked<%end if%> name="view">关闭  &nbsp;  
	<input type=radio value="1" <%if rs("view")="1" then%>checked<%end if%> name="view">打开

	<tr><td colspan=2>
<INPUT name="ok" TYPE="hidden" value="ok"><INPUT name=action TYPE="submit" value="保存设置"></td></tr>
</form></table>
	<%
	rs.close
	conn.close
	set rs=nothing
	set conn=nothing
end if%>

<%              
if action="ok" then

if trim(request("select8"))<>"" then
	if trim(request("select7"))="" then
	er=1
	else
		if trim(request("select6"))="" then
		er=1
		else
			if trim(request("select5"))="" then
			er=1
			else
				if trim(request("select4"))="" then
				er=1
				else
					if trim(request("select3"))="" then
					er=1
					else
						if trim(request("select2"))="" then
						er=1
						else
							if trim(request("select1"))="" then
							er=1
							end if
						end if
					end if
				end if
			end if
		end if
	end if
end if

	if er=1 then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，请按顺序添加投票项目，单击“确定”返回上一页修改！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

if trim(request("select1"))<>"" then 
	if not isNumeric(trim(request("answer1"))) then er=2
end if
if trim(request("select2"))<>"" then 
	if not isNumeric(trim(request("answer2"))) then er=2
end if
if trim(request("select3"))<>"" then 
	if not isNumeric(trim(request("answer3"))) then er=2
end if
if trim(request("select4"))<>"" then 
	if not isNumeric(trim(request("answer4"))) then er=2
end if
if trim(request("select5"))<>"" then 
	if not isNumeric(trim(request("answer5"))) then er=2
end if
if trim(request("select6"))<>"" then 
	if not isNumeric(trim(request("answer6"))) then er=2
end if
if trim(request("select7"))<>"" then 
	if not isNumeric(trim(request("answer7"))) then er=2
end if
if trim(request("select8"))<>"" then 
	if not isNumeric(trim(request("answer8"))) then er=2
end if

	if er=2 then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，投票数必须是数字，单击“确定”返回上一页修改！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

if trim(request("select1"))="" or trim(request("select2"))="" then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，最少应添加2个投票项目，单击“确定”返回上一页修改！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
end if


     Set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from vote"
	rs.open sql,conn,1,3
	rs("title")=trim(request("title"))		'标题	

	rs("select1")=trim(request("select1"))		'项目一
	rs("select2")=trim(request("select2"))
	rs("select3")=trim(request("select3"))
	rs("select4")=trim(request("select4"))
	rs("select5")=trim(request("select5"))
	rs("select6")=trim(request("select6"))
	rs("select7")=trim(request("select7"))
	rs("select8")=trim(request("select8"))

if trim(request("select1"))<>"" then rs("answer1")=trim(request("answer1")) else rs("answer1")=0
if trim(request("select2"))<>"" then rs("answer2")=trim(request("answer2")) else rs("answer2")=0
if trim(request("select3"))<>"" then rs("answer3")=trim(request("answer3")) else rs("answer3")=0
if trim(request("select4"))<>"" then rs("answer4")=trim(request("answer4")) else rs("answer4")=0
if trim(request("select5"))<>"" then rs("answer5")=trim(request("answer5")) else rs("answer5")=0
if trim(request("select6"))<>"" then rs("answer6")=trim(request("answer6")) else rs("answer6")=0
if trim(request("select7"))<>"" then rs("answer7")=trim(request("answer7")) else rs("answer7")=0
if trim(request("select8"))<>"" then rs("answer8")=trim(request("answer8")) else rs("answer8")=0

	rs("VoteType")=request("VoteType")		'类型
	rs("view")=request("view")

	rs.update
	rs.close
	set rs=nothing

	conn.close
	set conn=nothing

	response.write "<script language='javascript'>"
	response.write "alert('投票调查项目设置成功！');"
	response.write "location.href='vote.asp';"
	response.write "</script>"
	response.end
end if%>

</body>
</html>
