237 lines
13 KiB
Plaintext
237 lines
13 KiB
Plaintext
@model dynamic
|
|
<form enctype="multipart/form-data">
|
|
<div id="commentbox" class="commentbox findbox" style="bottom: 10px;">
|
|
<h4><i class="fa fa-bars"></i> <span id="comment_title">?</span><a href="#" class="btn btn-default btn-xs f-r" onclick="hidecommentbox()">닫기</a></h4>
|
|
<div id="comment_commenttitle">
|
|
<span id="comment_userinfo" style="font-weight: bold; color: #000; font-size: 16px;"></span> 님의 코멘트 현황
|
|
</div>
|
|
<div id="commentnewinfo" style="display: none;">#@Model.SCUserName</div>
|
|
<div>
|
|
<select id="comment_memotype" onchange="" class="form-control dev disp-init" style="display: none; width: 80px; vertical-align: top; height: 50px;">
|
|
<option value="1">전화</option>
|
|
<option value="2">메일</option>
|
|
<option value="3">면접</option>
|
|
<option value="4">방문</option>
|
|
<option value="9">기타</option>
|
|
</select>
|
|
<textarea class="dev form-control disp-init" id="commenttext" style="width: 470px;"></textarea>
|
|
<a id="commentboxbtnsave" href="#" class="btn btn-primary" onclick="savecomment(0);" style="line-height: 20px;">댓글입력<br />(shift+Enter)</a>
|
|
<a id="commentboxbtnedit" href="#" class="btn btn-primary" onclick="savecomment(1);" style="line-height: 20px; display: none;">댓글수정<br/>(shift+Enter)</a>
|
|
<a id="commentboxbtnnew" href="#" class="btn btn-default" onclick="savecomment(-1);">초기화</a>
|
|
</div>
|
|
<div class="commentfilebox" style="line-height: 15px; margin-top: 5px;">
|
|
<a style="display: none; color: #0094ff; text-decoration: underline; vertical-align: top;" id="commentfilelist" href="/aCommon/DownFile?09090909" title="다운로드"> <span class="fileitem"><i class="fa fa-download"></i>OrgName</span></a>
|
|
<a id="commentboxbtndelete" style="display: none;" href="#" class="btn btn-danger btn-xxs" onclick="savecomment(-2);">삭제</a>
|
|
<input type="file" name="file" id="commentfile" />
|
|
</div>
|
|
<div class="commentlist" id="commentlist" style="position: absolute; bottom: 20px; top: 200px; overflow: auto; border-bottom: 1px solid #000; left: 25px; right: 10px;"></div>
|
|
<br /><br />
|
|
</div>
|
|
</form>
|
|
<style type="text/css">
|
|
.commentbox .commentlist ul{padding: 5px 5px;}
|
|
</style>
|
|
<script>
|
|
var _commentcmttype = '';
|
|
var _commentbaseno = 0;
|
|
var _commentboxsaved = false;
|
|
function findscommentshow(cmttype, baseno) {
|
|
_commentcmttype = cmttype;
|
|
if (cmttype == 'resume') {
|
|
$("#comment_title").text("Comment")
|
|
$("#comment_memotype").show();
|
|
}
|
|
_commentbaseno = baseno;
|
|
findcomment();
|
|
}
|
|
function findcomment() {
|
|
$("#commentlist div.commentreply, #commentlist div.commentfilebox").remove();
|
|
commentboxclear();
|
|
$("#commentlist ul").remove();
|
|
capp("/acommon/GetComment", { commenttype: _commentcmttype, baseno: _commentbaseno, getuserinfo: true}, "bindcommentlist", null, null, true);
|
|
}
|
|
function bindcommentlist() {
|
|
if (capResult.Code == 1000) {
|
|
//if ($("#commentcount").length == 1) {
|
|
// $("#commentcount").text(bindComma3($(capResult.Obj).length));
|
|
//}
|
|
$.each($(capResult.Obj.comment), function (i, d) {
|
|
if (d.CDepth == 0) {
|
|
bindcomment(d);
|
|
}
|
|
});
|
|
if (_commentcmttype == "resume") {
|
|
$("#comment_userinfo").text(capResult.Obj.user.UserName + "(" + getdb(capResult.Obj.user.Email, false, "-") + ")");
|
|
if ($(".commentcount1").length > 0) {
|
|
$(".commentcount1").text("코멘트(" + bindComma3(capResult.Obj.comment.length.toString()) + ")");
|
|
}
|
|
}
|
|
bglayer();
|
|
$("#commentbox").slideDown("fast");
|
|
$("#commenttext").focus();
|
|
}
|
|
}
|
|
|
|
|
|
$(document).ready(function () {
|
|
//findcomment();
|
|
$("#commenttext").on("keydown", function (e) {
|
|
if (e.shiftKey && e.keyCode == 13) {
|
|
savecomment($("#commentnewinfo").html() == "" ? 0 : 1);
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
$("#commentbox").on("keydown", "#commenttext2", function (e) {
|
|
if (e.shiftKey && e.keyCode == 13) {
|
|
savecomment(2);
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
$("body").on("click", "#commentlist ul a.tran", function () {
|
|
var ul = $(this).closest("ul");
|
|
commentboxdatainfo = ul.attr("data-info");
|
|
if ($(this).hasClass("cedit")) {
|
|
$("#commentnewinfo").html("#" + ul.find("li span.username").first().text() + " " + ul.find("li span.date").first().text());
|
|
if (_commentcmttype == "resume") {
|
|
$("#comment_memotype").val(ul.find("li span.memotype").first().attr("data-memotype"));
|
|
}
|
|
$("#commenttext").val(ul.find("li").eq(1).html().replace(/<br>/gi, '\n').replace(/<br\/>/gi, '\n').replace(/<br \/>/gi, '\n'));
|
|
$("#commenttext").hide(); $("#commenttext").show("fast");
|
|
$("#commentfile").val("");
|
|
$("#commentfile, #commentfilelist, #commentboxbtndelete").hide();
|
|
if (getInt(commentboxdatainfo.split(':')[3]) > 0) {
|
|
$("#commentfilelist").show();
|
|
$("#commentfilelist").text(ul.find("span.fileitem").text());
|
|
$("#commentfilelist").attr("href", "/aCommon/DownFile?fno=" + commentboxdatainfo.split(':')[3]);
|
|
$("#commentboxbtndelete").show();
|
|
}
|
|
else {
|
|
$("#commentfile").show();
|
|
}
|
|
$("#commentboxbtnsave").hide();
|
|
$("#commentboxbtnedit").show();
|
|
}
|
|
else if ($(this).hasClass("cdelete")) {
|
|
if (confirm("삭제하시겠습니까?")) {
|
|
capp("/acommon/deletecomment", { cmtno: $(this).closest("ul").attr("data-cmtno") }, "cbcommentdelete", null, null, true);
|
|
}
|
|
}
|
|
else if ($(this).hasClass("creply")) {
|
|
$("#commentlist div.commentreply, #commentlist div.commentfilebox").remove();
|
|
commentboxpcmtno = $(this).closest("ul").attr("data-cmtno");
|
|
$(this).closest("ul").after("<div class=\"commentreply\" style=\"margin-left: " + (getInt($(this).closest("li").css("margin-left")) + 30) + "px\">" +
|
|
"<select id=\"comment_memotype2\" onchange=\"\" class=\"form-control dev disp-init\" style=\"width: 80px; vertical-align: top; height: 50px;\"><option value=\"1\">전화</option><option value=\"2\">메일</option><option value=\"3\">면접</option><option value=\"4\">방문</option><option value=\"9\">기타</option></select>"+"<textarea placeholder=\"여기에 답댓글을 입력해주세요.\" class=\"dev form-control disp-init\" id=\"commenttext2\"></textarea><a href=\"#\" class=\"btn btn-info\" onclick=\"savecomment(2);\" style=\"line-height: 20px;\">답댓글입력<br />(shift+Enter)</a></div>" +
|
|
"<div class=\"commentfilebox\" style=\"line-height: 15px;margin-left: " + (getInt($(this).closest("li").css("margin-left")) + 30) +"px\"><input type=\"file\" name=\"file\" id=\"commentfile2\" /></div>");
|
|
$("#commenttext2").focus();
|
|
}
|
|
});
|
|
});
|
|
function cbcommentdelete() {
|
|
if (isCapOK()) {
|
|
_commentboxsaved = true;
|
|
findcomment();
|
|
}
|
|
else {
|
|
msg("권한이 없습니다.");
|
|
}
|
|
}
|
|
var commentboxdatainfo = "";//cno,pno,fgno,fileno,depth
|
|
var commentboxpcmtno = 0;
|
|
|
|
function savecomment(idx, a) {
|
|
if (idx > -1) {
|
|
if (idx == 2) {
|
|
if (getBytes(val("commenttext2")) < 1) {
|
|
focus("commenttext2");
|
|
msg2("답댓글을 입력해주세요.");
|
|
}
|
|
else {
|
|
var data = new FormData();
|
|
data.append("cmtno", 0);
|
|
data.append("pcmtno", commentboxpcmtno);
|
|
data.append("commenttype", _commentcmttype);
|
|
data.append("baseno", _commentbaseno);
|
|
data.append("memotype", val("comment_memotype2"));
|
|
data.append("memo", val("commenttext2"));
|
|
data.append("fgno", "");
|
|
if ($("#commentfile2")[0].files.length > 0) {
|
|
data.append("file", $("#commentfile2")[0].files[0]);
|
|
}
|
|
data.append("IsPassFile", false);
|
|
_commentboxsaved = true;
|
|
capfile("/acommon/savecomment", data, "findcomment", false);
|
|
}
|
|
}
|
|
else {
|
|
if (getBytes(val("commenttext")) < 1) {
|
|
focus("commenttext");
|
|
msg2("댓글을 입력해주세요.");
|
|
}
|
|
else {
|
|
var data = new FormData();
|
|
data.append("cmtno", commentboxdatainfo == "" ? 0 : getInt(commentboxdatainfo.split(':')[0]));
|
|
data.append("pcmtno", commentboxdatainfo == "" ? "" : commentboxdatainfo.split(':')[1]);
|
|
data.append("commenttype", _commentcmttype);
|
|
data.append("baseno", _commentbaseno);
|
|
data.append("memotype", val("comment_memotype"));
|
|
data.append("memo", val("commenttext"));
|
|
data.append("fgno", commentboxdatainfo == "" ? "" : commentboxdatainfo.split(':')[2]);
|
|
data.append("IsPassFile", false);
|
|
if ($("#commentfile")[0].files.length > 0) {
|
|
data.append("file", $("#commentfile")[0].files[0]);
|
|
}
|
|
_commentboxsaved = true;
|
|
capfile("/acommon/savecomment", data, "findcomment", false);
|
|
}
|
|
}
|
|
}
|
|
else if (idx == -2) {
|
|
if (confirm("파일을 삭제하시겠습니까?")) {
|
|
capp("/acommon/deletefile", { key: commentboxdatainfo.split(':')[3] }, "cbsavecommentfd", null, null, true);
|
|
}
|
|
}
|
|
else {
|
|
commentboxclear();
|
|
}
|
|
}
|
|
function cbsavecommentfd() {
|
|
if (isCapOK()) {
|
|
$("#commentfile").show();
|
|
$("#commentfilelist, #commentboxbtndelete").hide();
|
|
}
|
|
else {
|
|
msg("권한이 없습니다.");
|
|
}
|
|
}
|
|
function commentboxclear() {
|
|
commentboxdatainfo = "";
|
|
$("#comment_memotype").val("1");
|
|
$("#commenttext").attr("placeholder", "");
|
|
$("#commentnewinfo").html("#@(Model.SCUserName)");
|
|
$("#commenttext, #commentfile").val("");
|
|
$("#commentboxbtnsave, #commentfile").show();
|
|
$("#commentboxbtnedit, #commentfilelist,#commentboxbtndelete").hide();
|
|
}
|
|
|
|
function bindcomment(d) {
|
|
$("#commentlist").append("<ul class=\"depth" + d.CDepth + "\" data-cmtno=\"" + d.CMTNo + "\" data-info=\"" + (getdb(d.CMTNo) + ":" + getdb(d.PCMTNo) + ":" + getdb(d.FGNo) + ":" + getdb(d.FileNo) + ":" + d.CDepth) + "\"><li style=\"margin-left:" + (d.CDepth * 25) + "px\"><span class=\"username\">" + (d.CDepth > 0 ? "<i class=\"fa fa-share-square\"></i>" : "") + d.UserName + "</span><span class=\"date\">" + d.CDTName3 + "</span> <span class=\"memotype\" data-memotype=\"" + getdb(d.MemoType) + "\">" + (_commentcmttype == "resume" ? ("[" + d.MemoTypeName + "] ") : "") + "</span>" +
|
|
"<a " + (d.IsDeleted == 1 || ('@(Model.IsAdmin?1:0)' == '0' && '@(Model.SCUserNo)' != d.CNO.toString()) ? "style=\"display: none;\"" : "") + " href=\"#\" class=\"tran cedit\" title=\"Edit\"><i class=\"fa fa-edit\"></i></a>" +
|
|
"<a " + (d.IsDeleted == 1 || ('@(Model.IsAdmin?1:0)' == '0' && '@(Model.SCUserNo)' != d.CNO.toString()) ? "style=\"display: none;\"" : "") + " href=\"#\" class=\"tran cdelete\" title=\"Delete\"><i class=\"fa fa-trash-o\"></i></a>" +
|
|
"<a " + (d.IsDeleted == 1 ? "style=\"display: none;\"" : "") + " href=\"#\" class=\"tran creply\" title=\"Reply\" class=\"file\"><i class=\"fa fa-mail-forward\"></i></a>" +
|
|
(d.IsDeleted == 1 || getdb(d.FileUrl) == "" ? "" : "<a href=\"/aCommon/DownFile?fno=" + d.FileNo + "\" title=\"다운로드\"> <span class=\"fileitem\"><i class=\"fa fa-download\"></i>" + d.OrgName + "</span></a>") +
|
|
"</li><li style=\"margin-left:" + ((d.CDepth * 25) + 10) + "px\" class=\"text\">" + (d.IsDeleted == 1 ? "-삭제됨-" : d.Memo.replace(/\n/gi, '<br />')) + "</li></ul>");
|
|
$.each($(capResult.Obj.comment), function (i, d2) {
|
|
if (d2.PCMTNo == d.CMTNo) {
|
|
bindcomment(d2);
|
|
}
|
|
});
|
|
}
|
|
function hidecommentbox() {
|
|
try {
|
|
if (_commentboxsaved && (_commentboxparentrefresh || false) == true) {
|
|
timesubmitauto();
|
|
}
|
|
} catch (e) { }
|
|
$('#commentbox').slideUp('fast'); $('#bglayer').hide();
|
|
}
|
|
</script> |