<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="com.blogmethods.basic.domain.Article"%>
<%@ include file="/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><c:out value="${blog.title}"/></title>
<meta name="generator" content="BlogMethods Basic 1.0.0" />
<meta name="description" content="<c:out value="${blog.subTitle}" />" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="<c:url value="/themes/${blog.options.theme_dir_name.value}/resources/styles/style.css"/>" type="text/css" media="screen, projection" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<c:url value="/feeds/"/>" />
<link rel="shortcut icon" href="<c:url value="/favicon.ico"/>" type="image/x-icon" />
<script src="<c:url value="/js/blog.js"/>" type="text/javascript" language="JavaScript"></script>
</head>
<body>

<div id="divAll">
<div id="divPage">
<div id="divMiddle">
<c:import url="/include.do">
	<c:param name="path" value="/include_header.jsp" />
</c:import>

<c:import url="/blog.do?method=nav" />

<div id="divMain">
<c:set var="date" value=""/>
<c:forEach var="article" items="${pageResult.results}">
<div class="post">
<fmt:formatDate var="_date" value="${article.createdOn}" pattern="${blog.dateFormat}"/>
<c:if test="${_date!=date}">
<c:set value="${_date}" var="date"/>
<h4 class="post-date"><c:out value="${date}"/></h4>
</c:if>
<h2 class="post-title"><a href="<c:url value="/articles.do?method=article&id=${article.id}"/>" title="Permalink"><c:out value="${article.title}" /></a></h2>
<div class="post-body">
<c:out value="${article.content}" escapeXml="false" />
</div>
<h6 class="post-footer"> 时间:<fmt:formatDate value="${article.createdOn}" pattern="${blog.timeFormat}"/> | 标签:<c:forEach var="tag" items="${article.tags}">&nbsp;<a href="<c:url value="/articles.do?method=byTag&id=${tag.id}"/>"><c:out value="${tag.title}"/></a></c:forEach> | 评论:<a
		href="<c:url value='/articles.do?method=article&id=${article.id}'/>#comments"
		class="commentlink"><c_rt:out value="<%=((Article)pageContext.getAttribute("article")).getComments().size()+""%>"/></a> | 引用:<a
		href="<c:url value='/articles.do?method=article&id=${article.id}'/>#trackbacks"
		class="trackbacklink"><c_rt:out value="<%=((Article)pageContext.getAttribute("article")).getTrackbacks().size()+""%>"/></a>  </h6>
</div>
</c:forEach>

<div class="post">
<p class="pagebar">
		<c:if test="${pageResult.pageIndex!=1}"><A HREF="<c:url value="/articles.do?method=index&p=${pageResult.prevIndex}"/>">上一页</A></c:if>
		<c:set var="begin" value="1"/>
		<c:if test="${(pageResult.pageIndex-6)>0}"><c:set var="begin" value="${pageResult.pageIndex-6}"/></c:if>
		<c:set var="end" value="${pageResult.pagesAmount}"/>
		<c:if test="${pageResult.pagesAmount==0}"><c:set var="end" value="1"/></c:if>
		<c:if test="${(pageResult.pagesAmount-pageResult.pageIndex)>5}"><c:set var="end" value="${pageResult.pageIndex+4}"/></c:if>
		<c:forEach var="i" begin="${begin}" end="${end}">
		<c:choose>
		<c:when test="${i==pageResult.pageIndex}"><em><c:out value="${i}"/></em></c:when>
		<c:otherwise><a href="<c:url value="/articles.do?method=index&p=${i}"/>"><c:out value="${i}"/></a></c:otherwise>
		</c:choose>
		</c:forEach>
		<c:if test="${(pageResult.pagesAmount-pageResult.pageIndex)>0}"><A HREF="<c:url value="/articles.do?method=index&p=${pageResult.nextIndex}"/>">下一页</A></c:if>
		<span>(共<b><c:out value="${pageResult.allResultsAmount}"/></b>篇文章)</span></p>
</div>
</div>

<div id="divSidebar">
	<div class="function">
	<h3>搜索</h3>
	<ul><li class="none">
	<form name="search" action="<c:url value="/search.do"/>" method="post" onsubmit="return validateSearchForm();">
	<input value="<c:out value="${keyword}"/>" name="s" id="s" /> <input type="submit" value="搜索" id="searchbutton" name="searchbutton" /></form></li></ul>
	</div>
	<c:import url="/pages.do?method=pages" /> 
	<c:import url="/articles.do?method=recentArticles" /> 
	<c:import url="/articles.do?method=recentComments" /> 
	<c:import url="/articles.do?method=recentTrackbacks" />
	<c:import url="/articles.do?method=tags" /> 
	<c:import url="/articles.do?method=archives" />
	<c:import url="/links.do" />
	<c:import url="/message.do?method=recentMessages"/>
	<c:import url="/include.do"><c:param name="path" value="/include_feeds.jsp" /></c:import>
</div>

<c:import url="/include.do">
	<c:param name="path" value="/include_footer.jsp" />
</c:import>
</div>
</div>
</div>
</body>
</html>