<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>评论管理 - S2M Admin</title>

		<meta name="description" content="Static &amp; Dynamic Tables" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<#include "/admin/include/cssjs_up.html" encoding="UTF-8"/>
	</head>

	<body>
		<#assign adminMenuPosFlag="comment">
		<#include "/admin/include/head.html" encoding="UTF-8"/>
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>
				<#include "/admin/include/menu.html" encoding="UTF-8"/>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="/admin/">Home</a>
							</li>
							<li class="active">评论管理</li>
						</ul><!-- .breadcrumb -->
					</div>

					<div class="page-content">
						<div class="page-header">
							<h1>
								列表
								<small>
									<i class="icon-double-angle-right"></i>
									评论管理 数据列表
								</small>
							</h1>
							<div class="hr-18"></div>
							<button class="btn btn-primary" onclick="location.href='/admin/comment/add'">
								<i class="icon-plus align-top bigger-125"></i>
								添加
							</button>
						</div><!-- /.page-header -->
						<div class="row">
							<form method="post" action="">
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">编号:</div>
									<input type="text" class="form-control" name="id" value="${bean.id}">
									</div>
								</div>
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">博客编号:</div>
									<input type="text" class="form-control" name="aid" value="${bean.aid}">
									</div>
								</div>
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">昵称:</div>
									<input type="text" class="form-control" name="name" value="${bean.name}">
									</div>
								</div>
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">联系方式:</div>
									<input type="text" class="form-control" name="linkMsg" value="${bean.linkMsg}">
									</div>
								</div>
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">内容:</div>
									<input type="text" class="form-control" name="msg" value="${bean.msg}">
									</div>
								</div>
								<div class="col-xs-3 form-group">
									<div class="input-group">
									  <div class="input-group-addon">ip地址:</div>
									<input type="text" class="form-control" name="ip" value="${bean.ip}">
									</div>
								</div>
							   <div class="col-xs-2 form-group">
									<input type="hidden" name="token" value="${token}" />
									<button class="btn btn-primary" type="submit">查询</button>
								</div>
							</form>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->

								<div class="row">
									<div class="col-xs-12">
										<div class="table-responsive">
											<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														<th>编号</th>
														<th>文章编号</th>
														<th>昵称</th>
														<th>ip</th>
														<th>评论时间</th>
														<th>操作</th>
													</tr>
												</thead>

												<tbody>
													<#list pageBean.result as bean>
													<tr>
														<td>
														${bean.id}
														</td>
														<td>
														${bean.aid}
														</td>
														<td>
														${bean.name}
														</td>
														<td>
														${bean.ip}
														</td>
														<td>
														<#if bean.dateAdd?exists>
														${bean.dateAdd?string("yyyy-MM-dd HH:mm:ss")}
														<#else>
														-
														</#if>
														</td>
														<td>
															<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
																<a class="green" href="/admin/comment/add/?id=${bean.id}">
																	<i class="icon-edit bigger-120"></i>
																</a>
																<a class="red" href="javascript:" onclick="deleteMsg('${bean.id}')">
																	<i class="icon-trash bigger-120"></i>
																</a>
															</div>
														</td>
													</tr>
													</#list>
												</tbody>
											</table>
											${pageBean.pageToolBar}
										</div><!-- /.table-responsive -->
									</div><!-- /span -->
								</div><!-- /row -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->
			</div><!-- /.main-container-inner -->
			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
		<#include "/admin/include/cssjs_down.html" encoding="UTF-8"/>
		<script src="/assets/js/bootbox.min.js"></script>
		<script type="text/javascript">
		function deleteMsg(id){
			bootbox.confirm("确定要删除吗?", function(result) {
				if(result) {
					$.ajax({
						url:"/admin/comment/del/",
						type:"POST",
						data:{"id":id,"rnd":Math.random(),"token":"${token}"},
						success:function(a){
							if(a == "success"){
								location.reload();
							}else{
								alert("删除失败" + a);
							}
						}
					});
				}
			});
		}
		</script>
	</body>
</html>