<!--#include file="../conn.asp"-->
<!--#include file="session.asp"-->
<%
const recpage=20
dim i,catalogid
if not isempty(request("page")) then 
currentpage=Clng(request("page"))
else currentpage=1
end if
if(request.QueryString("catalogid")<>"") then
	catalogid=Clng(request.QueryString("catalogid"))
else
	catalogid=0
end if
%>
<html>
<head>
<title>投票管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="vote_manage.asp?";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href=gourl;
}
function ConfirmDel()
{
   if(confirm("确认删除?并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="7" bgcolor="#006699"><div align="center" class="style1">◆ 投票选项管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="9%" height="22" bgcolor="#FFFFCC"><div align="center">id</div></td>
    <td width="31%" bgcolor="#FFFFCC"><div align="center">标题</div></td>
    <td width="10%" bgcolor="#FFFFCC"><div align="center">选项个数</div></td>
    <td width="15%" bgcolor="#FFFFCC"><div align="center">选项类型</div></td>
    <td width="13%" bgcolor="#FFFFCC"><div align="center">添加时间</div></td>
    <td width="11%" bgcolor="#FFFFCC"><div align="center">修改</div></td>
    <td width="11%" bgcolor="#FFFFCC"><div align="center">删除</div></td>
  </tr>
  <!-- 开始按行循环----------------------->
  <%
  		set rs=server.createobject("adodb.recordset")
  		rs.open "select count(*) AS co from t_survey_vote",conn,3,1
		allrec=rs("co")
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" * from t_survey_vote where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_survey_vote where 1=1"
		if(catalogid>0) then
			sql=sql&" and catalogid="&catalogid
		end if
		sql=sql&" order by id desc) as t)"
		if(catalogid>0) then
			sql=sql&" and catalogid="&catalogid
		end if
		sql=sql&" order by id desc "
		rs.open sql,conn,3,1		
		do while not rs.eof
		'classname=conn.execute("select title from catalogs where id="&rs("classid"))(0)
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=rs("id")%></div></td>
    <td bgcolor="#FFFFFF"><div align="left"><a href="../vote_show.asp?id=<%=rs("id")%>"><%=rs("title")%></a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs("optionNum")%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
	<%
	if(rs("optionType")=0) then 
	response.Write("单选")
	elseif(rs("optionType")=1) then 
	response.Write("多选")	
	end if
	%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs("moditime")%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="vote_mod.asp?id=<%=rs("id")%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="dele.asp?id=<%=rs("id")%>&table=t_survey_vote" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  
  <%
    rs.movenext
	  i=i+1
	   if i>=recpage then 
		exit do
	   end if
	  loop
	 ' end sub
	  rs.close
	  set rs=nothing
  %>
  <tr>
    <td height="22" colspan="7" bgcolor="#FFFFFF"><div align="center"><form name="form1" method="post" action="" style="margin:0 0 0 0">
          <%n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='vote_manage.asp?page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='vote_manage.asp?page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
    </form></div></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
</body>
</html>
<%
call connclose()
%>
