<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<script src="IDC/js/setToken.js"></script>
<script>
//지우기 숫자에 토큰붙여서 보내기
function clickDelete(num)
{
	var token = "&token="+$("#token").val();
	location.replace("deleteNotebook.bor?num="+num+token);
}	
</script>
<!-- 여기가 본 페이지이다 -->
<div class="row">
	<div class="col-lg-8">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h4><i class="fa fa-desktop fa-fw"></i> 메모장</h4>
			</div>
			<div class="panel-body">
				<div class="row">
				</div>
				<!-- row -->
	   			<div class="table-responsive">
					<table class="table table-bordered table-hover table-striped">
						<thead>
						</thead>
						<tbody>
							<c:forEach items="${list}" var="dto">
								<tr>									
									<!-- 
									<td class="col-lg-1">${dto.name}</td>
									 -->				
									<td class="col-lg-3">${dto.content}</td>
									<td class="col-lg-1"><font size="1">${dto.write_date} ${dto.write_time}</font></td>									
									<!-- 세션의 아이디와 dto.name가 같다면-->
									<c:if test="${dto.name == name}">
									<td class="col-lg-1"><input type="button" value="삭제" onclick="clickDelete('${dto.num}')"></td>
									</c:if>
									<c:if test="${dto.name != name}">
										<td></td>
									</c:if>				
								</tr>
							</c:forEach>
						</tbody>
						<tfoot>
						</tfoot>
					</table>
				</div>
				<!-- table-responsive -->
				<div class="input-group-btn text-center">
					<ul class="pagination" style="margin:0px;">
						<li>
							<a class="btn btn-default btn-outline" href="notebook.bor">
								<i class="fa fa-angle-double-left"></i>
							</a>
						</li>
						<c:forEach var="i" begin="1" end="${pageCnt}">
							<li><a class="btn btn-default btn-outline" href="notebook.bor?curPage=${i}">${i}</a></li>
						</c:forEach>
						<li>
							<a class="btn btn-default btn-outline" href="notebook.bor?curPage=${pageCnt }">
								<i class="fa fa-angle-double-right"></i>
							</a>
						</li>
					</ul>
				</div>
				<form action="writeNotebook.bor" method="post">
					<input type="hidden" id="token" name="token">
					<div class="row">
						<div class="col-lg-8 col-lg-offset-2">
							<div class="input-group">
								<!-- 
								<input class="form-control" type="text" name="content"/>
								 -->
								 <textarea name="content" class="form-control"></textarea>
								<div class="input-group-btn">
									<input class="btn btn-primary btn-outline" type="submit" value="전송">
								</div>
							</div>
						</div>
					</div>
					<!-- row -->
				</form>
			</div>
			<!-- panel-body -->
		</div>
		<!-- panel panel-default -->
	</div>
	<!-- col-lg-12 -->
</div>
<!-- row -->
<!-- /#page-wrapper -->
