Skip to content

Commit b3edfa1

Browse files
eeu12eeu12
authored andcommitted
도영자유게시판공지사항마무리
1 parent fbb2b35 commit b3edfa1

File tree

4 files changed

+601
-89
lines changed

4 files changed

+601
-89
lines changed

ybusadmin/src/main/java/com/test/spring/camsns/controller/SnsboardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public String main(HttpServletRequest request
124124

125125

126126

127-
word="";
127+
//word="";
128128
num = "0"; // 0부터 5개 게시글
129129

130130
// 글불러옴

ybusadmin/src/main/webapp/WEB-INF/views/camsns/main.jsp

Lines changed: 88 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
}
266266
.postTitle{
267267
float:left;
268-
width:85%;
268+
width:93%;
269269
font-size:1em;
270270
font-family : 'Pretendard-Bold';
271271
color:#00264D;
@@ -274,8 +274,6 @@
274274
.postShare{
275275
position:relative;
276276
height:25%;
277-
width:10%;
278-
float:right;
279277
text-align:right;
280278
}
281279
.postShareImg{
@@ -397,21 +395,61 @@
397395
background-repeat: no-repeat;
398396
}
399397
</style>
400-
<script>
401-
//url복사버튼
402-
function clip(){
398+
<script>
399+
var index = 0; //글 5개씩 넘기기 위한 변수
400+
var cntList = "${cntList}";// 총 글 갯수
401+
var flag = false;//마지막 글 이후 ajax 요청 안하기위한 flag
402+
var alertFlag =false;//마지막글 alert 창 1번만띄우는 flag
403+
404+
405+
$(function() {
406+
if(cntList ==0){ $("#contentArea").html("글이 존재하지 않습니다.");}
407+
408+
409+
/* 검색 */
410+
$("#searchInput").keydown(function (key) {
411+
412+
if(key.keyCode == 13){//키가 13이면 실행 (엔터는 13)
413+
//검색 index 초기화
414+
index = 0;
415+
416+
var word = $(this).val();//검색어 가져옴
417+
$("#contentsBox").html("");//기존 자료 초기화
418+
search(word);//ajax
419+
}
420+
421+
});
422+
423+
424+
share();//공유버튼인식
403425
404-
var url = '';
405-
var textarea = document.createElement("textarea");
406-
document.body.appendChild(textarea);
407-
url = window.document.location.href;
408-
textarea.value = url;
409-
textarea.select();
410-
document.execCommand("copy");
411-
document.body.removeChild(textarea);
412-
alert("URL이 복사되었습니다.")
413-
}
414-
</script>
426+
427+
})//onload
428+
429+
function share(){
430+
/* 카카오톡 글 url 보내기 */
431+
$(".shareBtn")
432+
.click(
433+
function() {
434+
var name = $(this).attr('name');
435+
436+
var boardSeq = $(this).val();
437+
var hostUrl = "http://ybus.kr";
438+
var shareUrl = "/spring/camsns/snsboard/snsboardview.action?boardSeq=" + boardSeq;
439+
var url = hostUrl +shareUrl
440+
441+
//함수실행
442+
sendLink(url,name);
443+
444+
})
445+
}
446+
447+
//검색
448+
function search(word){
449+
location.href="/spring/camsns/snsMain.action?word="+word;
450+
451+
}
452+
</script>
415453
</head>
416454
<body>
417455

@@ -457,19 +495,19 @@
457495
<div id="contentsContainer">
458496
<c:forEach items="${boardDtoList}" var="boardDtoList">
459497
<!-- 게시글 반복-->
460-
<div class="contentsBox">
498+
<div class="contentsBox" onclick = "location.href='/spring/camsns/snsboard/snsboardview.action?boardSeq=${boardDtoList.snsboardSeq}'">
461499
<!-- 글번호-->
462-
<div class="content_category" onclick = "location.href='/spring/camsns/snsboard/snsboardview.action?boardSeq=${boardDtoList.snsboardSeq}'">
500+
<div class="content_category">
463501
<div class="postNo ${boardDtoList.categoryType}">#${boardDtoList.snsboardSeq}</div>
464502
</div>
465503

466504
<!-- 글 제목-->
467505
<div class="content_title">
468-
<div class="postTitle" onclick="location.href='/spring/camsns/snsboard/snsboardview.action?boardSeq=${boardDtoList.snsboardSeq}'">${boardDtoList.snsboardSubject}
506+
<div class="postTitle">${boardDtoList.snsboardSubject}
469507
<div class="postDate">${boardDtoList.snsboardRegdate}</div>
470508
</div>
471509
<div class="postShare">
472-
<img src="/spring/images/camsns/postShare.png" value="${boardDtoList.snsboardSeq}" name="${boardDtoList.snsboardSeq}" class="postShareImg shareBtn" onclick="clip(); return false;">
510+
<img src="/spring/images/camsns/postShare.png" value="${boardDtoList.snsboardSeq}" name="${boardDtoList.snsboardSeq}" class="postShareImg shareBtn">
473511
</div>
474512
<div class="clear"></div>
475513
<div class="postContents">
@@ -478,7 +516,7 @@
478516
</div>
479517

480518
<!-- 글 하단 -->
481-
<div class="content_bottom" onclick = "location.href='/spring/camsns/snsboard/snsboardview.action?boardSeq=${boardDtoList.snsboardSeq}'">
519+
<div class="content_bottom">
482520
<div class="comment_preview">
483521
<c:if test="${boardDtoList.commentFirst == null}"><div class="txt_padding">댓글이 없습니다</div></c:if>
484522
<c:if test="${boardDtoList.commentFirst != null}"><div class="img_padding"><img src="/spring/images/camsns/new.png"></div><div class="txt_padding">${boardDtoList.commentFirst}</div></c:if>
@@ -502,5 +540,33 @@
502540

503541

504542

543+
544+
<script type="text/javascript">
545+
//<![CDATA[
546+
// 사용할 앱의 JavaScript 키를 설정해 주세요.
547+
/* Kakao.init('497e3896cc14549676d2ada05a95e0fd'); */
548+
549+
550+
551+
552+
553+
554+
function sendLink(url,name) {
555+
Kakao.Link.sendTalkLink({
556+
label: '#'+name+'번째 이야기', // 공유할 메세지의 제목을 설정
557+
image: {
558+
src: 'http://mud-kage.kakao.co.kr/14/dn/btqfJfuXWcY/P7iGH1pyo5w9X1pp8lf9Pk/o.jpg',
559+
width: '150',
560+
height: '150'
561+
} // 이건 썸네일을 설정 하는 겁니다.
562+
,
563+
webButton: {
564+
text: '글 보기',
565+
url : url // 각각의 포스팅 본문의 링크를 거는 코드입니다.
566+
}
567+
});
568+
}
569+
//]]>
570+
</script>
505571
</body>
506572
</html>

ybusadmin/src/main/webapp/WEB-INF/views/camsns/snsboard/boardview.jsp

Lines changed: 8 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
<meta charset="UTF-8">
88
<meta name="viewport" content="width=device-width,initial-scale=1">
99
<title>공지사항::글쓰기</title>
10-
<!-- import 시작 -->
11-
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
12-
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
13-
crossorigin="anonymous"></script>
14-
<!-- ck에디터 -->
15-
<script src="/spring/util/ckeditor/ckeditor.js"></script>
10+
1611
<style>
1712
@font-face {
1813
font-family: "Pretendard-Bold";
@@ -203,7 +198,7 @@
203198
204199
#leftFooter{position:relative;width:90%;padding:5%;}
205200
206-
.titleInput{
201+
#titleInput{
207202
width:90%;
208203
height:35px;
209204
border:transparent;
@@ -222,7 +217,7 @@
222217
font-family : 'Pretendard-Regular';
223218
padding-left:5%;
224219
}
225-
.sendButton{
220+
#sendButton{
226221
float:right;
227222
width:10%;
228223
height:37px;
@@ -268,54 +263,14 @@
268263
background-position: center center;
269264
background-repeat: no-repeat;
270265
}
271-
</style>
272-
<script>
273-
274-
//url복사버튼
275-
function clip(){
276-
277-
var url = '';
278-
var textarea = document.createElement("textarea");
279-
document.body.appendChild(textarea);
280-
url = window.document.location.href;
281-
textarea.value = url;
282-
textarea.select();
283-
document.execCommand("copy");
284-
document.body.removeChild(textarea);
285-
alert("URL이 복사되었습니다.")
286-
}
287-
288-
</script>
289-
290-
<script>
291-
$(function() {
292-
293-
294-
295-
$("#commConfirm").click(function(){
296-
//if(CKEDITOR.instances.content.getData().length < 1){
297-
if($('#content').val().length < 1){
298-
alert("내용을 입력해 주세요.");
299-
return;
300-
}else{
301-
$("#content").val();
302-
$("#frm").submit();
303-
}
304-
305-
});
306-
307-
});
308-
</script>
309-
310-
311-
266+
</style>
312267
</head>
313268
<body>
314269
<div id="header">
315270
<div id="infoPage">
316271
<div id="txtBox">
317272
<div id="txtType">
318-
<img src="/spring/images/camsns/backBtn.png" style="height:20px;width:auto;" onclick="location.href='/spring/camsns/snsMain.action'" /> 자유게시판
273+
<img src="/spring/images/camsns/backBtn.png" style="height:20px;width:auto;"> 자유게시판
319274
</div>
320275
</div>
321276
<div id="btnBox">
@@ -333,7 +288,7 @@
333288
#${boardDto.snsboardSeq}
334289
</div>
335290
<div id="title">${boardDto.snsboardSubject}
336-
<img src="/spring/images/camsns/postShare.png" style="float:right;width: 6%;" onclick="clip(); return false;">
291+
<img src="/spring/images/camsns/postShare.png" style="float:right;width: 6%;">
337292
</div>
338293
<div id="titleInfo">${boardDto.snsboardRegdate}</div>
339294
</div>
@@ -381,29 +336,16 @@
381336
<div id="footerContents">
382337
<div id="btnFooterGroup">
383338
<div id="leftFooter">
384-
<form action="/spring/snsboard/addComment.action" method="POST" enctype="multipart/form-data" id="frm">
385-
<input type="hidden" value="${boardDto.snsboardSeq}" name="snsboardSeqFk">
386-
<input type="textarea" class='titleInput'id="content" name="snscommentContent" placeholder="내용을 입력하세요">
387-
<div class = "sendButton" id="commConfirm">
339+
<input type="text" id="titleInput" placeholder="내용을 입력하세요">
340+
<div id = "sendButton">
388341
<img src="/spring/images/camsns/sendBtn.png" style='height:22px;margin-top:7.5px;'></div>
389342
</div>
390343
<div class="clear"></div>
391-
</form>
392344
</div>
393345
</div>
394346
</div>
395347

396348

397349
</div>
398-
<script>
399-
/*
400-
CKEDITOR.replace('content',{
401-
width:'100%',
402-
height:'35px',
403-
toolbar :['/']
404-
});
405-
*/
406-
</script>
407350
</body>
408-
409351
</html>

0 commit comments

Comments
 (0)