답글 및 댓글 복사 하기 처리

dev_bert
kyebyungha 3 years ago
parent 54fdaa4d01
commit 614eceada5

@ -6,6 +6,7 @@ import java.util.List;
import javax.xml.crypto.Data;
import com.backoffice.m.util.M_Util;
import com.renastudio.creative.web.util.AbstractBOManager;
import com.renastudio.creative.web.util.DataMap;
import com.renastudio.creative.web.util.RenaStringUtil;
@ -276,11 +277,13 @@ public class M_Bf_boardBOImpl extends AbstractBOManager implements M_Bf_boardBO
generalDAO.setNamespace(SQLMAP_NAMESPACE);
generalDAO.startTransaction();
if( paramMap.get("ct_no") !=null && !paramMap.get("ct_no").toString().equals("")) {
paramMap.put("ct_no", Integer.parseInt(paramMap.get("ct_no").toString()));
result = (int)generalDAO.update("update_bf_board_comment_by_b_no", paramMap);
if( M_Util.null2Str(paramMap.get("reply_new"),"Y").equals("Y")){
if(!M_Util.null2Str(paramMap.get("ct_no"),"").equals(""))
paramMap.put("p_ct_no", Integer.parseInt(paramMap.get("ct_no").toString()));
result = (int) generalDAO.insert("insert_bf_board_comment_by_b_no", paramMap);
}else {
result = (int) generalDAO.insert("insert_bf_board_comment_by_b_no", paramMap);
paramMap.put("ct_no", Integer.parseInt(paramMap.get("ct_no").toString())); // 댓글 수정
result = (int)generalDAO.update("update_bf_board_comment_by_b_no", paramMap);
}
generalDAO.commitTransaction();
} catch (SQLException e) {

@ -9,6 +9,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.backoffice.m.util.M_Util;
import com.renastudio.creative.web.util.AbstractBOManager;
import com.renastudio.creative.web.util.DataMap;
import com.renastudio.creative.web.util.RenaStringUtil;
@ -242,7 +243,7 @@ public class M_Bf_daily_nutritionBOImpl extends AbstractBOManager implements M_B
//이미 게시판에 저장한 경우 저장 하지 않음
if(paramMap.get("share_tp").equals("Y") && paramMap.get("bd_no") !=null && !paramMap.get("bd_no").equals("") ) {
if(paramMap.get("share_tp").equals("Y") && !M_Util.null2Str(paramMap.get("bd_no"),"").equals("") ) {
paramMap.put("share_tp","N");
}

@ -454,4 +454,12 @@ public class M_Util {
return "";
}
}
public static String null2Str(Object str, String strDefault)
{
if(str == null || str == "null" || str.toString().length() == 0)
return strDefault;
else
return str.toString();
}
}

@ -10,7 +10,6 @@
,tmf.mt_file_local_url
,v_content
FROM (
SELECT
x.bd_no
,x.bd_tp
@ -79,6 +78,7 @@
x.*
,m.profile_path
,m.name
,m.nickname
,v_content
FROM (
SELECT
@ -309,23 +309,38 @@
</update>
<select id="select_bf_board_comment_by_b_no" resultClass="dataMap" parameterClass="dataMap">
SELECT
x.ct_no
,x.p_ct_no
,x.bd_no
,x.comment
,x.member_id
,t.name
,t.nickname
,t.profile_path
,x.use_yn
,x.v_nt
,DATE_FORMAT(x.reg_dt,'%H:%i') reg_tm
FROM tbl_bf_board_comment x
left join tbl_member t
on x.member_id = t.member_id
WHERE x.bd_no = #bd_no#
ORDER BY p_ct_no desc, ct_no desc
select
x.*
, (case when substr(x.seq, 1,instr(x.seq,'>') -1) ='' then ct_no else substr(x.seq, 1,instr(x.seq,'>') -1) end) as r_ct_no
from (SELECT a.bd_no
, a.ct_no
, a.p_ct_no
, a.member_id
, a.comment
, CONCAT_WS('>',k.ct_no,j.ct_no,i.ct_no, g.ct_no,f.ct_no,e.ct_no, d.ct_no, c.ct_no, b.ct_no, a.ct_no) seq
,(LENGTH( CONCAT_WS('>',k.ct_no,j.ct_no,i.ct_no, g.ct_no,f.ct_no,e.ct_no, d.ct_no, c.ct_no, b.ct_no, a.ct_no))
- LENGTH(REPLACE( CONCAT_WS('>', k.ct_no,j.ct_no,i.ct_no, g.ct_no,f.ct_no,e.ct_no, d.ct_no, c.ct_no, b.ct_no, a.ct_no), '>', ''))) / LENGTH('>') as lv
,t.name
,t.nickname
,t.profile_path
,a.v_nt
,DATE_FORMAT(a.reg_dt,'%H:%i') reg_tm
FROM tbl_bf_board_comment a
LEFT OUTER JOIN tbl_bf_board_comment b ON a.p_ct_no = b.ct_no
LEFT OUTER JOIN tbl_bf_board_comment c ON b.p_ct_no = c.ct_no
LEFT OUTER JOIN tbl_bf_board_comment d ON c.p_ct_no = d.ct_no
LEFT OUTER JOIN tbl_bf_board_comment e ON d.p_ct_no = e.ct_no
LEFT OUTER JOIN tbl_bf_board_comment f ON e.p_ct_no = f.ct_no
LEFT OUTER JOIN tbl_bf_board_comment g ON f.p_ct_no = g.ct_no
LEFT OUTER JOIN tbl_bf_board_comment h ON g.p_ct_no = h.ct_no
LEFT OUTER JOIN tbl_bf_board_comment i ON h.p_ct_no = i.ct_no
LEFT OUTER JOIN tbl_bf_board_comment j ON i.p_ct_no = j.ct_no
LEFT OUTER JOIN tbl_bf_board_comment k ON j.p_ct_no = k.ct_no
left join tbl_member t
on a.member_id = t.member_id
WHERE a.bd_no = #bd_no# ) x
order by r_ct_no desc , seq
</select>
</sqlMap>

@ -1552,8 +1552,9 @@
<select id="select_homemade_list" resultClass="dataMap" parameterClass="dataMap">
SELECT
x.dhb_no
,x.dhb_cd
,x.name
,x.water_qty
,nvl(x.water_qty,'') water_qty
FROM tbl_db_home_bf x
WHERE 1 = 1
AND name like N'%$prd_nm$%'

@ -4,6 +4,17 @@
<script src="${URL_STATIC_ROOT}/m/js/swiper.min.js"></script>
<script src="${URL_STATIC_ROOT}/m/js/jquery_popupoverlay.js"></script>
<script src="${URL_STATIC_ROOT}/m/js/design.js"></script>
<style>
#copy {
position: absolute;
top: 0;
left: 0;
width: 1px;
height: 1px;
margin: 0;
padding: 0;
border: 0;
</style>
<body>
<!-- wrap -->
@ -22,6 +33,7 @@
<input type="hidden" id="bd_tp" name="bd_tp" value="${model['bd_tp']!}" />
<input type="hidden" id="pick_img_index" name="pick_img_index" value=""/>
<input type="hidden" id="list_tag" name="list_tag" value=""/>
<input type="text" id="copy" name="copy" value=""/>
<!-- content -->
<div class="community_view01">
@ -73,11 +85,15 @@
<div class="profile_cont">
<!-- 프로필 사진 -->
<div class="profile_img">
<img src="${URL_STATIC_ROOT}/m/img/community/community_writer_img.png" alt="프로필 사진">
</div>
<#if model['rm']['profile_path']?if_exists>
<img src="${URL_ROOT}/file/get_img.do?mt_file_seq=${model['rm']['profile_path']!}" alt="프로필 사진">
<#else>
<img src="${URL_ROOT}/m/img/community/person-fill.svg" alt="프로필 사진">
</#if>
</div>
<div class="profile_info">
<!-- 닉네임 -->
<p>${model ['rm']['name']!}</p>
<p>${model ['rm']['nickname']!}</p>
<!-- 작성시각 . 조회수 -->
<p>${model ['rm']['reg_tm']!} &#183; 조회 ${model ['rm']['h_nt']!}</p>
</div>
@ -148,7 +164,8 @@
<!-- 댓글 -->
<div class="comment_header">
<p>댓글</p>
<button type="button" id="" name="" class="refresh">
<button type="button" class="btn_reply" data-ct_no="">댓글쓰기</button>
<button type="button" id="" name="" class="refresh" onclick="window.location.reload();">
<span class="hidden">아이콘</span>
</button>
</div>
@ -158,17 +175,25 @@
<!-- 댓글 -->
<#if model['lm_comment']?has_content >
<#list model['lm_comment'] as item>
<div class="comment">
<div class="comment" <#if item['p_ct_no']?has_content>style="padding-left:${item['lv']!}rem"</#if>" >
<!-- profile & option box -->
<div class="comment_profile">
<!-- profile -->
<div class="profile_cont">
<div class="profile_img">
<img src="${URL_ROOT}/m/img/community/community_writer_img.png" alt="프로필 사진">
<#if item['profile_path']?if_exists>
<img src="${URL_ROOT}/file/get_img.do?mt_file_seq=${item['profile_path']!}" alt="프로필 사진">
<#else>
<img src="${URL_ROOT}/m/img/community/person-fill.svg" alt="프로필 사진">
</#if>
</div>
<div class="profile_info">
<p>${item['name']!}</p>
<p>${item['reg_tm']!}</p>
<p>${item['nickname']!}</p>
<div>
<p>${item['reg_tm']!}</p>
<p>&nbsp;&#183;&nbsp;</p>
<button type="button" class="btn_reply" data-ct_no="${item['ct_no']!}">답글쓰기</button>
</div>
</div>
</div>
<#if item['member_id']! == model ['rm']['member_id']!>
@ -194,11 +219,17 @@
<div class="comment_input_cont">
<div class="reply_cont">
<div class="reply_to">
닉네임 님에게 답글쓰는 중
</div>
<button class="reply_del">
<img src="${URL_ROOT}/m/img/close_ico.png" alt="취소 버튼">
</button>
</div>
<div class="input">
<!--
<label class="file_icon" for="image-upload"></label>
<input type="file" accept="image/*;capture=camera" id="image-upload" style="display:none;">
-->
<textarea placeholder="댓글 남기기" id="reply" name="reply" ></textarea>
</div>
<div class="submit">
@ -221,7 +252,6 @@
<div class="content">
<!-- 옵션 모달 -->
<ul>
<li>
<a id="edit_board">
<div class="edit_icon"></div>
@ -245,6 +275,12 @@
<div class="content">
<!-- 옵션 모달 -->
<ul>
<li>
<a id="edit_copy">
<div class="copy_icon"></div>
복사하기
</a>
</li>
<li>
<a id="edit_reply">
<div class="edit_icon reply"></div>
@ -297,6 +333,7 @@
<script>
var $ct_no ;
var $reply_new_yn = "Y" ;
function fncRemove(e) {
$(e).parent().remove();
}
@ -355,6 +392,7 @@
var data = {
bd_no : ${model ['rm']['bd_no']!}
,ct_no : $ct_no
,reply_new : $reply_new_yn
,comment : $("#reply").val()
}
$.ajax({
@ -366,45 +404,8 @@
Swal.fire({text:"등록되지 않았습니다"})
},
success:function(result){
if($ct_no == null) {
var tag ="<div class=\"comment\">";
tag +=" <div class=\"comment_profile\">";
tag +=" <!-- profile -->";
tag +=" <div class=\"profile_cont\">";
tag +=" <div class=\"profile_img\">";
tag +=" <img src=\"${URL_ROOT}/m/img/community/community_writer_img.png\" alt=\"프로필 사진\">";
tag +=" </div>";
tag +=" <div class=\"profile_info\">";
tag +=" <p>"+result.reply.replyer+"</p>";
tag +=" <p>"+result.reply.reg_tm+"</p>";
tag +=" </div>";
tag +=" </div>";
tag +=" <!-- option -->";
tag +=" <div class=\"option2_btn\" data-ctno ="+result.reply.ct_no+">";
tag +=" <div href=\"#\" class=\"option\"></div>";
tag +=" </div>";
tag +=" </div>";
tag +=" <div class=\"comment_text\" data-ctno="+result.reply.ct_no+">";
tag += result.reply.comment;
tag +=" </div>";
tag +="</div>";
$(".community_comment").prepend(tag);
} else {
$(".comment_text").each( function(idx,ele) {
if(ele.dataset.ctno == $ct_no) {
ele.innerText = $("#reply").val() ;
return;
}
});
}
$ct_no = null;
$("#reply").val('');
Swal.fire({text:"처리 되었습니다"}) ;
$(".option2_btn").on("click", function() {
$("#option2").toggleClass("open");
})
// location.href = '${URL_ROOT}/m/bf_board/view_bf_detail_board.do?bd_no=${model ['rm']['bd_no']!}';
window.location.reload();
},
});
}
@ -436,59 +437,7 @@
}
});
/*********사진 추가*********/
$(function() {
// File Upload + Preview
$(document).on('click', '.input_file_upload .btn_upfile', function(){
$(this).siblings('.upfile').trigger('click');
});
$(document).on('click', '.input_file_upload .ibtn_x', function(){
$(this).parent().parent().remove();
});
$(document).on('change', ".input_file_upload input[type=file]", function(){
var file = $(this)[0].files[0];
//console.log(file.name + "\n" + file.type + "\n" + file.size + "\n" + file.lastModifiedDate); // upfile var
if ($(this).hasClass('file_mypage')) {
$(this).talkImage(file, '.add_thumb');
}else{
$(this).displayImage(file, '.add_thumb');
} $(this).siblings('.add_thumb').removeClass('off').siblings('.ibtn_x').removeClass('off');
});
$.fn.extend({
// Upload preview Function
displayImage : function(file, classname) {
if (typeof FileReader !== "undefined") {
// var container = document.getElementsByClassName(classname),
// img = document.createElement("img"),
// reader;
$(this).siblings(classname).find('img').remove();
var container = $(this).siblings(classname),
img = document.createElement("img"),
reader;
img.setAttribute('width', '100%'),
img.setAttribute('height', '100%'),
container.append(img);
reader = new FileReader();
reader.onload = (function (theImg) {
return function (evt) {
theImg.src = evt.target.result;
};
}(img));
reader.readAsDataURL(file);
}
},
});
});
/* 셀렉트박스 보이게 하기 */
/* 셀렉트박스 보이게 하기 */
$("body").on("click", ".selectbox", function() {
$(this).siblings();
$(this).siblings().toggle();
@ -537,9 +486,57 @@
</#if>
</#list>
</#if>
/*********사진 추가*********/
$(function() {
// File Upload + Preview
$(document).on('click', '.input_file_upload .btn_upfile', function(){
$(this).siblings('.upfile').trigger('click');
});
$(document).on('click', '.input_file_upload .ibtn_x', function(){
$(this).parent().parent().remove();
});
$(document).on('change', ".input_file_upload input[type=file]", function(){
var file = $(this)[0].files[0];
//console.log(file.name + "\n" + file.type + "\n" + file.size + "\n" + file.lastModifiedDate); // upfile var
if ($(this).hasClass('file_mypage')) {
$(this).talkImage(file, '.add_thumb');
}else{
$(this).displayImage(file, '.add_thumb');
} $(this).siblings('.add_thumb').removeClass('off').siblings('.ibtn_x').removeClass('off');
});
$.fn.extend({
// Upload preview Function
displayImage : function(file, classname) {
if (typeof FileReader !== "undefined") {
// var container = document.getElementsByClassName(classname),
// img = document.createElement("img"),
// reader;
$(this).siblings(classname).find('img').remove();
$(function() {
var container = $(this).siblings(classname),
img = document.createElement("img"),
reader;
img.setAttribute('width', '100%'),
img.setAttribute('height', '100%'),
container.append(img);
reader = new FileReader();
reader.onload = (function (theImg) {
return function (evt) {
theImg.src = evt.target.result;
};
}(img));
reader.readAsDataURL(file);
}
},
});
$(".community_header ul li a").on("click", function() {
$(this).addClass("active")
.parents(".community_header ul li").siblings().find("a").removeClass("active")
@ -568,6 +565,7 @@
});
$(".option2_btn").on("click", function() {
$ct_no = this.dataset.ctno;
$reply_new_yn ="N";
$("#option2").toggleClass("open");
})
$(".shared_btn").on("click", function() {
@ -593,10 +591,27 @@
location.href = "${URL_ROOT}/m/bf_board/view_bf_delete_board.do?bd_tp=${model ['rm']['bd_tp']!}&bd_no=${model ['rm']['bd_no']!}";
});
});
$("#edit_copy").on("click", function(e) {
e.preventDefault();
var target = $("#copy");
$(".comment_text").each( function(idx,ele) {
if(ele.dataset.ctno == $ct_no) {
target.val(ele.innerText);
return;
}
});
var urlbox = document.getElementById( 'copy' );
urlbox.select();
document.execCommand('copy');
alert( '댓글 이 복사 되었습니다.' );
$("#option2").removeClass("open");
});
$("#edit_reply").on("click", function() {
$("#option2").removeClass("open");
debugger;
$(".comment_input_cont").show();
$(".comment_text").each( function(idx,ele) {
if(ele.dataset.ctno == $ct_no) {
$("#reply").val(ele.innerText);
@ -641,10 +656,24 @@
});
});
$(".btn_reply").on("click", function() {
$(".comment_input_cont").show();
var nickName = this.parentNode.parentNode.childNodes[1].textContent;
$(".reply_to").text(nickName+'에게 답글을 쓰는중...');
$(".reply_cont").addClass("active");
$reply_new_yn ="Y";
$ct_no = this.dataset.ct_no;
});
$(".reply_del").on("click", function() {
$(".reply_cont").removeClass("active");
$(".comment_input_cont").hide();
$ct_no = "";
});
$('.submit').on('click', function () {
insert_reply();
});
$(".comment_input_cont").hide();
<#if model['bd_tp']! =='BF_CT_TP_3'>
$(".community_write_review").show();
<#else>

@ -442,8 +442,10 @@
var prd_nm = result.list[i].name;
var company = result.list[i].company;
var barcode = result.list[i].barcode;
var water_qty = result.list[i].water_qty;
html +='<li><a href="javascript:save_set(\'db_dhb_no\', \'' + dhb_no + '\', \'' + prd_nm + '\', \'bf\');">(' + water_qty +')&nbsp;&nbsp;&nbsp;&nbsp;' + prd_nm + '</a></li>';
var water_qty = (result.list[i].water_qty ? '('+result.list[i].water_qty +')&nbsp;&nbsp;&nbsp;&nbsp;':'' );
var imgurl1 = "<img src=\"${URL_STATIC_ROOT}/m/db/ingre/"+result.list[i].dhb_cd+".png\" onerror=\"this.src='${URL_STATIC_ROOT}/m/db/homemade/bowl.png';\">";
html +='<li><a href="javascript:save_set(\'db_dhb_no\', \'' + dhb_no + '\', \'' + prd_nm + '\', \'bf\');">'+ imgurl1 + water_qty + prd_nm + '</a></li>';
}
var ul_board = $('#ul_board');
@ -516,9 +518,8 @@
for(var i=0;i<result.list.length;i++) {
var dhb_no = result.list[i].dhb_no;
var prd_nm = result.list[i].name;
var imgurl1 = result.list[i].imgurl1;
// html +='<li><a href="javascript:save_set(\'db_dhb_no\', \'' + dhb_no + '\', \'' + prd_nm + '\', \'sf\' );">' + prd_nm + '</a></li>';
html +='<li><a href="javascript:save_set(\'db_dhb_no\', \'' + dhb_no + '\', \'' + prd_nm + '\' ,\'sf\');"><img src="${URL_ROOT}/file/get.do?mt_file_seq=' + imgurl1 + '" width="200px" />' + prd_nm + '</a></li>';
var imgurl1 = "<img src=\"${URL_ROOT}/file/get.do?mt_file_seq=/"+result.list[i].imgurl1+"\" onerror=\"this.src='${URL_STATIC_ROOT}/m/db/homemade/bowl.png'\" width=\"200px\" >";
html +='<li><a href="javascript:save_set(\'db_dhb_no\', \'' + dhb_no + '\', \'' + prd_nm + '\' ,\'sf\');">'+imgurl1 + prd_nm + '</a></li>';
}
var ul_board1 = $('#ul_board1');
@ -593,7 +594,6 @@
var name_real = result.list[i].name_real;
var company = result.list[i].company;
var barcode = result.list[i].barcode;
var imgurl1 = result.list[i].imgurl1;
html +='<li><a href="javascript:save_set2(\'db_dbi_no\', \'' + dbi_no + '\', \'' + name_real + '\' );">' + name_real + '</a>';
html +='<div class="basket"><span></span><a href="javascript:save_set2(\'db_dbi_no\', \'' + dbi_no + '\', \'' + name_real + '\' );" class="hidden">재료 담기</a></div>';
@ -658,7 +658,7 @@
$("body").on("click", ".selectlist p", function() {
var text = $(this).html();
$(this).parent().siblings().html(text)
$(this).parent().toggle();
// $(this).parent().toggle();
$("#srv_unit").val(text);
});

@ -176,6 +176,7 @@
padding: 5,
fontColor: '#252525',
fontSize: '11',
stepSize: 5,
}
}]
},

@ -220,6 +220,7 @@
padding: 5,
fontColor: '#252525',
fontSize: '11',
stepSize: 5,
}
}]
},
@ -338,6 +339,7 @@
padding: 5,
fontColor: '#252525',
fontSize: '11',
stepSize: 5,
}
}]
},

Loading…
Cancel
Save