choi

each board can view picture and video

...@@ -60,7 +60,8 @@ create table picvideo( ...@@ -60,7 +60,8 @@ create table picvideo(
60 idx int not null primary key auto_increment, 60 idx int not null primary key auto_increment,
61 picname varchar(300) unique, 61 picname varchar(300) unique,
62 vidname varchar(300) unique, 62 vidname varchar(300) unique,
63 - bulletin_id int not null 63 + bulletin_id int not null,
64 + boardtitle varchar(50) not null
64 )engine=innodb; 65 )engine=innodb;
65 ``` 66 ```
66 67
...@@ -87,7 +88,7 @@ create table picvideo( ...@@ -87,7 +88,7 @@ create table picvideo(
87 >건의사항: suggestion_board 88 >건의사항: suggestion_board
88 89
89 --- 90 ---
90 -### 최종 수정: 2021-12-02 02:22<br> 91 +### 최종 수정: 2021-12-03 05:28<br>
91 ### 수정 내용: 92 ### 수정 내용:
92 1. 채팅 구현(팝업) 93 1. 채팅 구현(팝업)
93 2. 시간 실시간 반영 94 2. 시간 실시간 반영
...@@ -101,4 +102,5 @@ create table picvideo( ...@@ -101,4 +102,5 @@ create table picvideo(
101 10. 채팅 중 서버 재시작시 기존 참여자들 리셋시킴 102 10. 채팅 중 서버 재시작시 기존 참여자들 리셋시킴
102 11. 요소 좌우 길이 80%로 조절 103 11. 요소 좌우 길이 80%로 조절
103 12. 게시판 [공지사항/작곡가 구인/가수 구인/자유게시판/건의사항]으로 분화 104 12. 게시판 [공지사항/작곡가 구인/가수 구인/자유게시판/건의사항]으로 분화
104 -13. 공지사항 게시판에는 운영자만 글쓰기 가능하게 함.
...\ No newline at end of file ...\ No newline at end of file
105 +13. 공지사항 게시판에는 운영자만 글쓰기 가능하게 함.
106 +14. 게시판별 게시글 사진 및 동영상 열람기능 추가. 하지만 아직 업로드기능 개발중
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -165,7 +165,33 @@ router.get('/read/notice/:idx', function(req,res,next){ ...@@ -165,7 +165,33 @@ router.get('/read/notice/:idx', function(req,res,next){
165 var sql_comment = "select idx, nickname, comment from notice_comment where bulletin_id =?" 165 var sql_comment = "select idx, nickname, comment from notice_comment where bulletin_id =?"
166 board.query(sql_comment, [idx], function(err,comment){ 166 board.query(sql_comment, [idx], function(err,comment){
167 if (err) console.error("err : " + err); 167 if (err) console.error("err : " + err);
168 - res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"공지사항 글 상세", row:row[0], comment:comment, comment_length : comment.length, usernick:req.user.nickname}) 168 + var sql_picvideo = "select * from picvideo where bulletin_id=? and boardtitle = 'notice'"
169 + board.query(sql_picvideo, [idx], function(err, picvideos) {
170 + if (err) console.error("err : " + err);
171 + var picarr = []
172 + var vidarr = []
173 + for(var i=0; i<picvideos.length; i++){
174 + var picadd = "../../../assets/img/" + picvideos[i].picname;
175 + var vidadd = "../../../assets/video/" + picvideos[i].vidname;
176 + if(picvideos[i].picname != null){
177 + picarr.push(picadd)
178 + }
179 + if(picvideos[i].vidname != null){
180 + vidarr.push(vidadd)
181 + }
182 + }
183 +
184 + res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"공지사항 글 상세",
185 + row:row[0],
186 + comment:comment,
187 + comment_length : comment.length,
188 + usernick:req.user.nickname,
189 + picarr:picarr,
190 + picarr_length:picarr.length,
191 + vidarr:vidarr,
192 + vidarr_length:vidarr.length
193 + })
194 + })
169 }) 195 })
170 console.log(logString+req.user.ID+'('+nickname+') 유저가 공지사항 '+idx+'번 게시글을 보고있습니다.('+ip+')') 196 console.log(logString+req.user.ID+'('+nickname+') 유저가 공지사항 '+idx+'번 게시글을 보고있습니다.('+ip+')')
171 } 197 }
...@@ -407,7 +433,33 @@ router.get('/read/composer/:idx', function(req,res,next){ ...@@ -407,7 +433,33 @@ router.get('/read/composer/:idx', function(req,res,next){
407 var sql_comment = "select idx, nickname, comment from composer_comment where bulletin_id =?" 433 var sql_comment = "select idx, nickname, comment from composer_comment where bulletin_id =?"
408 board.query(sql_comment, [idx], function(err,comment){ 434 board.query(sql_comment, [idx], function(err,comment){
409 if (err) console.error("err : " + err); 435 if (err) console.error("err : " + err);
410 - res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"작곡가 구인 글 상세", row:row[0], comment:comment, comment_length : comment.length, usernick:req.user.nickname}) 436 + var sql_picvideo = "select * from picvideo where bulletin_id=? and boardtitle = 'composer'"
437 + board.query(sql_picvideo, [idx], function(err, picvideos) {
438 + if (err) console.error("err : " + err);
439 + var picarr = []
440 + var vidarr = []
441 + for(var i=0; i<picvideos.length; i++){
442 + var picadd = "../../../assets/img/" + picvideos[i].picname;
443 + var vidadd = "../../../assets/video/" + picvideos[i].vidname;
444 + if(picvideos[i].picname != null){
445 + picarr.push(picadd)
446 + }
447 + if(picvideos[i].vidname != null){
448 + vidarr.push(vidadd)
449 + }
450 + }
451 +
452 + res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"작곡가 구인 글 상세",
453 + row:row[0],
454 + comment:comment,
455 + comment_length : comment.length,
456 + usernick:req.user.nickname,
457 + picarr:picarr,
458 + picarr_length:picarr.length,
459 + vidarr:vidarr,
460 + vidarr_length:vidarr.length
461 + })
462 + })
411 }) 463 })
412 console.log(logString+req.user.ID+'('+nickname+') 유저가 작곡가 구인 '+idx+'번 게시글을 보고있습니다.('+ip+')') 464 console.log(logString+req.user.ID+'('+nickname+') 유저가 작곡가 구인 '+idx+'번 게시글을 보고있습니다.('+ip+')')
413 } 465 }
...@@ -649,7 +701,33 @@ router.get('/read/singer/:idx', function(req,res,next){ ...@@ -649,7 +701,33 @@ router.get('/read/singer/:idx', function(req,res,next){
649 var sql_comment = "select idx, nickname, comment from singer_comment where bulletin_id =?" 701 var sql_comment = "select idx, nickname, comment from singer_comment where bulletin_id =?"
650 board.query(sql_comment, [idx], function(err,comment){ 702 board.query(sql_comment, [idx], function(err,comment){
651 if (err) console.error("err : " + err); 703 if (err) console.error("err : " + err);
652 - res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"가수 구인 글 상세", row:row[0], comment:comment, comment_length : comment.length, usernick:req.user.nickname}) 704 + var sql_picvideo = "select * from picvideo where bulletin_id=? and boardtitle = 'singer'"
705 + board.query(sql_picvideo, [idx], function(err, picvideos) {
706 + if (err) console.error("err : " + err);
707 + var picarr = []
708 + var vidarr = []
709 + for(var i=0; i<picvideos.length; i++){
710 + var picadd = "../../../assets/img/" + picvideos[i].picname;
711 + var vidadd = "../../../assets/video/" + picvideos[i].vidname;
712 + if(picvideos[i].picname != null){
713 + picarr.push(picadd)
714 + }
715 + if(picvideos[i].vidname != null){
716 + vidarr.push(vidadd)
717 + }
718 + }
719 +
720 + res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"가수 구인 글 상세",
721 + row:row[0],
722 + comment:comment,
723 + comment_length : comment.length,
724 + usernick:req.user.nickname,
725 + picarr:picarr,
726 + picarr_length:picarr.length,
727 + vidarr:vidarr,
728 + vidarr_length:vidarr.length
729 + })
730 + })
653 }) 731 })
654 console.log(logString+req.user.ID+'('+nickname+') 유저가 가수 구인 '+idx+'번 게시글을 보고있습니다.('+ip+')') 732 console.log(logString+req.user.ID+'('+nickname+') 유저가 가수 구인 '+idx+'번 게시글을 보고있습니다.('+ip+')')
655 } 733 }
...@@ -891,7 +969,33 @@ router.get('/read/free/:idx', function(req,res,next){ ...@@ -891,7 +969,33 @@ router.get('/read/free/:idx', function(req,res,next){
891 var sql_comment = "select idx, nickname, comment from free_comment where bulletin_id =?" 969 var sql_comment = "select idx, nickname, comment from free_comment where bulletin_id =?"
892 board.query(sql_comment, [idx], function(err,comment){ 970 board.query(sql_comment, [idx], function(err,comment){
893 if (err) console.error("err : " + err); 971 if (err) console.error("err : " + err);
894 - res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"자유게시판 글 상세", row:row[0], comment:comment, comment_length : comment.length, usernick:req.user.nickname}) 972 + var sql_picvideo = "select * from picvideo where bulletin_id=? and boardtitle = 'free'"
973 + board.query(sql_picvideo, [idx], function(err, picvideos) {
974 + if (err) console.error("err : " + err);
975 + var picarr = []
976 + var vidarr = []
977 + for(var i=0; i<picvideos.length; i++){
978 + var picadd = "../../../assets/img/" + picvideos[i].picname;
979 + var vidadd = "../../../assets/video/" + picvideos[i].vidname;
980 + if(picvideos[i].picname != null){
981 + picarr.push(picadd)
982 + }
983 + if(picvideos[i].vidname != null){
984 + vidarr.push(vidadd)
985 + }
986 + }
987 +
988 + res.render('read.ejs', {'ID':id, 'nickname': nickname, title:"자유게시판 글 상세",
989 + row:row[0],
990 + comment:comment,
991 + comment_length : comment.length,
992 + usernick:req.user.nickname,
993 + picarr:picarr,
994 + picarr_length:picarr.length,
995 + vidarr:vidarr,
996 + vidarr_length:vidarr.length
997 + })
998 + })
895 }) 999 })
896 console.log(logString+req.user.ID+'('+nickname+') 유저가 자유게시판 '+idx+'번 게시글을 보고있습니다.('+ip+')') 1000 console.log(logString+req.user.ID+'('+nickname+') 유저가 자유게시판 '+idx+'번 게시글을 보고있습니다.('+ip+')')
897 } 1001 }
...@@ -1133,7 +1237,7 @@ router.get('/read/suggestion/:idx', function(req,res,next){ ...@@ -1133,7 +1237,7 @@ router.get('/read/suggestion/:idx', function(req,res,next){
1133 var sql_comment = "select idx, nickname, comment from suggestion_comment where bulletin_id =?" 1237 var sql_comment = "select idx, nickname, comment from suggestion_comment where bulletin_id =?"
1134 board.query(sql_comment, [idx], function(err,comment){ 1238 board.query(sql_comment, [idx], function(err,comment){
1135 if (err) console.error("err : " + err); 1239 if (err) console.error("err : " + err);
1136 - var sql_picvideo = 'select * from picvideo where bulletin_id=?' 1240 + var sql_picvideo = "select * from picvideo where bulletin_id=? and boardtitle = 'suggestion'"
1137 board.query(sql_picvideo, [idx], function(err, picvideos) { 1241 board.query(sql_picvideo, [idx], function(err, picvideos) {
1138 if (err) console.error("err : " + err); 1242 if (err) console.error("err : " + err);
1139 var picarr = [] 1243 var picarr = []
...@@ -1141,7 +1245,9 @@ router.get('/read/suggestion/:idx', function(req,res,next){ ...@@ -1141,7 +1245,9 @@ router.get('/read/suggestion/:idx', function(req,res,next){
1141 for(var i=0; i<picvideos.length; i++){ 1245 for(var i=0; i<picvideos.length; i++){
1142 var picadd = "../../../assets/img/" + picvideos[i].picname; 1246 var picadd = "../../../assets/img/" + picvideos[i].picname;
1143 var vidadd = "../../../assets/video/" + picvideos[i].vidname; 1247 var vidadd = "../../../assets/video/" + picvideos[i].vidname;
1144 - picarr.push(picadd) 1248 + if(picvideos[i].picname != null){
1249 + picarr.push(picadd)
1250 + }
1145 if(picvideos[i].vidname != null){ 1251 if(picvideos[i].vidname != null){
1146 vidarr.push(vidadd) 1252 vidarr.push(vidadd)
1147 } 1253 }
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
106 var viddata = vidarr[i] 106 var viddata = vidarr[i]
107 107
108 %> 108 %>
109 - <video id="video_<%=i%>" class="video-js vjs-big-play-button vjs-big-play-centered vjs-fluid" controls preload="auto" width="640" height="268" data-setup='{}'> 109 + <video id="video_<%=i%>" class="video-js vjs-big-play-button vjs-big-play-centered vjs-fluid" controls preload="auto" width="1000" height="450" data-setup='{}'>
110 <source src="<%=viddata%>" type="video/mp4" label="720P" selected="true"> 110 <source src="<%=viddata%>" type="video/mp4" label="720P" selected="true">
111 </video> 111 </video>
112 <% 112 <%
......