<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Collection,java.util.Iterator"%>
<%@ page import="com.wxpn.tutorial.servlet.Question"%>
<%@ page import="com.wxpn.tutorial.servlet.Item"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>浏览投票项目</title>
</head>
<body>
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td width="75%" bgcolor="#0000FF" height="35" align=center><b><font
			color="#FFFFFF">浏览投票项目 </font></b></td>
		<td width="75%" bgcolor="#0000FF" height="35" align=center><a href=/Vote/admin/index.jsp><b><font
			color="#FF6600">管理界面首页</font></b></a></td>
	</tr>
</table>
<table border="1" width="100%" bordercolorlight="#C0C0C0"
	bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0">
	<tr>
		<td width="10%" bgcolor="#FCCCCC">编号</td>
		<td width="40%" bgcolor="#FCCCCC">主题</td>
		<td width="10%" bgcolor="#FCCCCC">投票总数</td>
		<td width="15%" bgcolor="#FCCCCC">开始时间</td>
		<td width="15%" bgcolor="#FCCCCC">结束时间</td>
		<td width="15%" bgcolor="#FCCCCC">状态</td>
	</tr>
	<%if (request.getAttribute("c") == null) {

			%>
	<tr>
		<td width="75%" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何投票项目。</td>
	</tr>
	<%} else {
				Collection c = (Collection) request.getAttribute("c");
				if (c == null) {

				%>
	<tr>
		<td width="75%" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何投票项目。</td>
	</tr>
	<%} else {
					int totalPageNum = ((Integer) (request
							.getAttribute("totalPageNum"))).intValue();
					int currentPage = 1;
					if (request.getParameter("page") != null) {
						currentPage = Integer.parseInt(request
								.getParameter("page"));
					}
					Iterator iterator = c.iterator();
					while (iterator.hasNext()) {
						Question question = (Question) iterator.next();

						%>
	<tr>
		<td width="10%" bgcolor="#FCFCFC"><a
			href="ShowVoteServlet?id=<%=question.getId()%>&page=showvote.jsp"><%=question.getId()%></a></td>
		<td width="40%" bgcolor="#FCFCFC"><a
			href="ShowVoteServlet?id=<%=question.getId()%>&page=showvote.jsp"><%=question.getTitle()%></a></td>
		<td width="10%" bgcolor="#FCFCFC"><%=question.getVotecount()%></td>
		<td width="15%" bgcolor="#FCFCFC"><%=question.getStrStartime()%></td>
		<td width="15%" bgcolor="#FCFCFC"><%=question.getStrEndtime()%></td>
		<td width="15%" bgcolor="#FCFCFC"><%=question.getActive()==0?"已关闭":"正常"%></td>
	</tr>
	<%}%>
	<tr>
		<td width="75%" colspan=8 align=right height="50" bgcolor="#EFEFEF"><%if (totalPageNum > 1) {%>
		<a href="BrowseVoteServlet?page=1">首页</a>|<a
			href="BrowseVoteServlet?page=<%=currentPage>1?currentPage-1:1 %>">上一页</a>|<a
			href="BrowseVoteServlet?page=<%=currentPage<totalPageNum?currentPage+1:totalPageNum %>">下一页</a>|<a
			href="BrowseVoteServlet?page=<%=totalPageNum%>">末页</a> <%}

				%>
	</tr>
	<%}
			}

		%>
</table>
</center>
</body>
</html>
