content.jsp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  2. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  3. <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  4. <%@ page language="java" contentType="text/html; charset=UTF-8"
  5. pageEncoding="UTF-8"%>
  6. <jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
  7. <script>
  8. function deleteConfirm(){
  9. alertBox({ type : "confirm",
  10. txt : "정말로 삭제할까요? (해당 게시글이 삭제되며 복구가 불가능합니다)",
  11. callBack : function( result ){
  12. if( result ){
  13. $( "#sendForm" ).attr( "action", "./content/delete" );
  14. $( "#sendForm" ).submit();
  15. }
  16. }
  17. });
  18. return false;
  19. }
  20. function answerConfirm(){
  21. alertBox({ type : "confirm",
  22. txt : "답변을 등록하시겠습니까?",
  23. callBack : function( result ){
  24. console.log( result );
  25. if( result ){
  26. var newForm = $( "#sendForm" ).clone();
  27. newForm.attr("id", "answerForm");
  28. newForm.attr("method", "post");
  29. newForm.attr("action", "./content/answer");
  30. $(document.body).append(newForm);
  31. newForm.submit();
  32. $("#answerForm").remove();
  33. // $( "#sendForm" ).attr( "action", "./content/answer" );
  34. // $( "#sendForm" ).submit();
  35. }
  36. }
  37. });
  38. return false;
  39. }
  40. var listPage = '<c:out value="${referer}"/>'.replaceAll( "&amp;", "&" );
  41. if( listPage.includes( '/qna/list' ) ) {
  42. encodeURIComponent(listPage);
  43. setCookie( "boardQnalistPage", listPage );
  44. }
  45. function goListPage(){
  46. var referer = getCookie( "boardQnalistPage" );
  47. if( referer == "" ) {
  48. referer = "/qna/list";
  49. }
  50. location.href = referer;
  51. }
  52. </script>
  53. </head>
  54. <body>
  55. <div class="wrapper">
  56. <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
  57. <div class="main">
  58. <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>
  59. <main class="content">
  60. <div class="container-fluid p-0">
  61. <div class="row">
  62. <div class="col-12 col-lg-6">
  63. <h1 class="h3 mb-3">의견 게시판</h1>
  64. </div>
  65. <div class="col-12 col-lg-6 text-right">
  66. <nav aria-label="breadcrumb">
  67. <ol class="breadcrumb">
  68. <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
  69. <li class="breadcrumb-item">의견 게시판</li>
  70. </ol>
  71. </nav>
  72. </div>
  73. </div>
  74. <div class="row">
  75. <div class="col-12">
  76. <div class="card">
  77. <form id="sendForm" action="./qna/content/delete" method="post">
  78. <input type="hidden" name="postSeq" value="${content.postSeq}" >
  79. <input type="hidden" name="createBy" value="${content.createBy}" >
  80. <input type="hidden" name="fileName" value="${content.fileName}" >
  81. <div class="card-body">
  82. <table class="table mobile-table">
  83. <colgroup>
  84. <col style="width:75%">
  85. <col style="width:">
  86. <col style="width:">
  87. </colgroup>
  88. <tr>
  89. <td>조회수 : <c:out value="${content.views}"></c:out></td>
  90. <th class="text-center">작성자</th>
  91. <td><c:out value="${content.createByName}(${content.createBy})" /></td>
  92. </tr>
  93. <tr>
  94. <td class="text-bold text-info"><c:out value="${content.title}" /></td>
  95. <th class="text-center">작성일</th>
  96. <td><c:out value="${content.createDate}" /></td>
  97. </tr>
  98. <tr>
  99. <td colspan="3" style="white-space: pre-line;"><div style="min-height:200px;"><c:out value="${content.content}" /></div></td>
  100. </tr>
  101. <tr>
  102. <td colspan="3">
  103. <span class="badge bg-primary">첨부파일</span>
  104. <a href="./content/file?postSeq=${content.postSeq}" class="text-dark" target="_blank"><c:out value="${content.fileOriginalName}" /></a>
  105. </td>
  106. </tr>
  107. </table>
  108. <c:if test="${groupIdx eq 1}">
  109. <input type="hidden" name="answerId" value="${sesId}">
  110. <table class="mt-3 table mobile-table">
  111. <colgroup>
  112. <col style="width:10%">
  113. <col style="width:">
  114. </colgroup>
  115. <tr>
  116. <th>작성자</th>
  117. <!-- <td> -->
  118. <%-- <c:out value="${sesName}(${sesId})" /> --%>
  119. <!-- </td> -->
  120. <c:if test="${content.answerId eq ''}">
  121. <td>
  122. <c:out value="${sesName}(${sesId})" />
  123. </td>
  124. </c:if>
  125. <c:if test="${content.answerId ne ''}">
  126. <td>
  127. <c:out value="${content.answerName}(${content.answerId})" />
  128. </td>
  129. </c:if>
  130. </tr>
  131. <tr>
  132. <th>답변</th>
  133. <c:if test="${content.answerContent eq ''}">
  134. <td>
  135. <textarea class="form-control" rows="2" cols="" name="answerContent" placeholder="내용을 입력하세요" maxlength="1000" required><c:out value="${item.content}" /></textarea>
  136. </td>
  137. </c:if>
  138. <c:if test="${content.answerContent ne ''}">
  139. <td colspan="3" style="white-space: pre-line;"><div style="min-height:100px;"><c:out value="${content.answerContent}" /></div></td>
  140. </c:if>
  141. </tr>
  142. </table>
  143. <c:if test="${content.answerId eq ''}">
  144. <div class="row mt-3">
  145. <div class="col-12">
  146. <div class="text-right">
  147. <button type="button" onclick="answerConfirm()" class="btn btn-primary w100">답변</button>
  148. </div>
  149. </div>
  150. </div>
  151. </c:if>
  152. </c:if>
  153. <table class="mt-3 table mobile-table">
  154. <colgroup>
  155. <col style="width:10%">
  156. <col style="width:">
  157. </colgroup>
  158. <tr>
  159. <th>이전글 ▲</th>
  160. <td>
  161. <c:if test="${prePostCnt eq 0}">
  162. 이전 글이 없습니다.
  163. </c:if>
  164. <c:if test="${prePostCnt ne 0}">
  165. <a href="./content?postSeq=${prePost.prePostSeq}"><c:out value="${prePost.prePostTitle}" /></a>
  166. </c:if>
  167. </td>
  168. </tr>
  169. <tr>
  170. <th>다음글 ▼</th>
  171. <td>
  172. <c:if test="${nextPostCnt eq 0}">
  173. 다음 글이 없습니다.
  174. </c:if>
  175. <c:if test="${nextPostCnt ne 0}">
  176. <a href="./content?postSeq=${nextPost.nextPostSeq}"><c:out value="${nextPost.nextPostTitle}" /></a>
  177. </c:if>
  178. </td>
  179. </tr>
  180. </table>
  181. <div class="row mt-3">
  182. <div class="col-12">
  183. <div class="text-right">
  184. <c:if test="${sesId eq content.createBy}">
  185. <button type="button" onclick="location.href='./edit?postSeq=${content.postSeq}';" class="btn btn-primary w100">수정</button>
  186. <button type="button" onclick="deleteConfirm();" class="btn btn-danger w100">삭제</button>
  187. </c:if>
  188. <button type="button" class="btn btn-outline-primary w100" onclick="goListPage();">목록</button>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </form>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </main>
  199. <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
  200. </div>
  201. </div>
  202. </body>
  203. </html>