diff --git a/hwe/j_board_comment_add.php b/hwe/j_board_comment_add.php index 42d56c20..9841e819 100644 --- a/hwe/j_board_comment_add.php +++ b/hwe/j_board_comment_add.php @@ -14,7 +14,7 @@ $text = Util::getReq('text'); increaseRefresh("회의실", 1); -$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID); +$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID); $con = checkLimit($me['con']); if ($con >= 2) { diff --git a/hwe/j_board_get_articles.php b/hwe/j_board_get_articles.php index 494c6fa3..c8fb0f85 100644 --- a/hwe/j_board_get_articles.php +++ b/hwe/j_board_get_articles.php @@ -62,7 +62,7 @@ foreach( ) as $comment ){ //TODO:아이콘 받아오기? - $articles[$article['no']]['comment'] = $comment; + $articles[$comment['document_no']]['comment'][] = $comment; } Json::die([ diff --git a/hwe/js/board.js b/hwe/js/board.js index 459f2008..84260a74 100644 --- a/hwe/js/board.js +++ b/hwe/js/board.js @@ -48,7 +48,8 @@ function submitArticle(){ function submitComment(){ var $this = $(this); - var $article = $this.parents('.article').eq(0); + + var $article = $this.closest('.articleObj').eq(0); var articleNo = $article.data('no'); var $text = $article.find('input.commentText'); var text = $.trim($text.val()); @@ -96,8 +97,8 @@ function drawArticle(idx, articleObj){ .data('no', articleObj.no) .data('author', articleObj.general_no); - console.log(articleObj); - + + $article.find('.articleNo').text(articleObj.no); $article.find('.authorName').text(articleObj.author); $article.find('.articleTitle').text(articleObj.title); $article.find('.date').text(articleObj.date); @@ -107,7 +108,7 @@ function drawArticle(idx, articleObj){ var $articleComment = $article.find('ul.commentList'); - $.each(articleObj.comment, function(commentObj){ + $.each(articleObj.comment, function(_, commentObj){ var $comment = $commentFrame.clone(); $comment.find('.author').text(commentObj.author); //$comment.find('.text').text(commentObj.text); @@ -116,6 +117,8 @@ function drawArticle(idx, articleObj){ $articleComment.append($comment); }); + $article.find('.submitComment').click(submitComment); + var $board = $('#board'); $board.append($article); @@ -150,7 +153,6 @@ function loadArticles(){ $(function(){ $('#submitArticle').click(submitArticle); -$('.submitComment').click(submitComment); loadArticles() .then(drawArticles, errUnknown) diff --git a/hwe/t_board.php b/hwe/t_board.php index bfaf6a91..54bb8d59 100644 --- a/hwe/t_board.php +++ b/hwe/t_board.php @@ -77,18 +77,17 @@ var isSecretBoard = =($isSecretBoard?'true':'false')?>; //