<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/admin/include/taglib.jsp"%>

<html>
<head>
	<title>文章管理</title>
	<meta name="decorator" content="default"/>
	<link type="text/css" rel="stylesheet" href="${ctxSite}/assets/js/jqueryui/jquery-ui.min.css" />
	<link type="text/css" rel="stylesheet" href="${ctxSite}/assets/js/jquery/easyui/themes/default/easyui.css"/>
	<script src="${ctxSite}/assets/js/jquery.min.js"></script> 
	<script src="${ctxSite}/assets/js/jqueryui/jquery-ui.min.js"></script>
	<script src="${ctxSite}/assets/js/jquery/easyui/jquery.easyui.min.js"></script>
	<link type="text/css" rel="stylesheet" href="assets/js/jquery/easyui/themes/bootstrap/easyui.css"/>
	<script type="text/javascript">
	$(document).ready(function() {
		var arg = new Array();
		arg='${page.list}';
		if(arg=='[]')
		{  $.messager.alert('消息', '当前查询条件暂无数据!'); }
	});
		function page(n,s,isFirstLoad){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
	       	return false;
	    }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/cms/article/list?category.id=${article.category.id}">文章列表</a></li>
		<li><a href="${ctx}/cms/article/form?id=${article.id}&category.id=${article.category.id}">文章添加</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="article" action="${ctx}/cms/article/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>栏目：</label><sys:treeselect id="category" name="category.id" value="${categoryId}" labelName="category.name" labelValue="${categoryName}"
					title="栏目" url="/cms/category/treeData" module="article" notAllowSelectRoot="false" cssClass="input-small"/>
		<label>标题：</label><form:input path="title" value="${title}" htmlEscape="false" maxlength="50" class="input-small"/>&nbsp;
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th>栏目</th><th>标题</th><th>点击数</th><th>发布者</th><th>更新时间</th><th>手动修改发布时间</th><th>是否发布</th><th>操作</th></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="article">
			<tr>
				<td><a href="javascript:" onclick="$('#categoryId').val('${article.category.id}');$('#categoryName').val('${article.category.name}');$('#searchForm').submit();return false;">${article.category.name}</a></td>
				<td><a href="${ctx}/cms/article/form?id=${article.id}" title="${article.title}">${fns:abbr(article.title,40)}</a></td>
				<td>${article.hits}</td>
				<c:if test="${article.publisher ==null|| empty article.publisher}">
				<td>${article.updateBy.name}</td>
				</c:if>
				<c:if test="${article.publisher!=null&&not empty article.publisher}">
				<td>${article.publisher}</td>
				</c:if>
				<td><fmt:formatDate value="${article.updateDate}" type="both"/></td>
				<td>${article.publisheDate}</td>
				<td>${article.delFlag eq 1?"否":"是"}</td>
				<td>
				     <%-- <a href="${pageContext.request.contextPath}/front/view-${article.category.id}-${article.id}${fns:getUrlSuffix()}" target="_blank">访问</a>  --%>
					<a href="${pageContext.request.contextPath}/main?sign=${pageContext.request.contextPath}/front/view-${article.category.id}-${article.id}${fns:getUrlSuffix()}" target="_blank">访问</a>
    				<a href="${ctx}/cms/article/form?id=${article.id}&TempcategoryId=${categoryId}">修改</a>
					<a href="${ctx}/cms/article/delete?id=${article.id}&categoryId=${article.category.id}" onclick="return confirmx('确认要删除该文章吗？', this.href)" >删除</a>
					<c:if test="${article.delFlag eq 1 && user.loginName!='ycjtj'}">
					
				<a href="${ctx}/cms/article/publish?id=${article.id}&categoryId=${article.category.id}" onclick="return confirmx('确认要发布该文章吗？', this.href)" >发布</a>
				</c:if>
					
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>