From 6b02384fb88c1e32c5bb1de5de0ea6aa4900d6bc Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 29 Jan 2019 23:40:28 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9D=98=EC=8B=A4=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=80=EC=8B=A4=20=ED=85=9C=ED=94=8C=EB=A6=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/css/board.css | 34 +++++++++++++++--- hwe/j_board_article_add.php | 5 ++- hwe/js/board.js | 16 +++++++-- hwe/sql/schema.sql | 1 + hwe/t_board.php | 69 +++++++++++++++++++++---------------- 5 files changed, 87 insertions(+), 38 deletions(-) diff --git a/hwe/css/board.css b/hwe/css/board.css index ff874676..a6884e87 100644 --- a/hwe/css/board.css +++ b/hwe/css/board.css @@ -3,8 +3,21 @@ margin: 0 auto; } +.titleInput{ + width:100%; + color:white; + background-color:transparent; + border:none; + margin:1px 5px; +} + .contentInput{ width:100%; + min-height:3em; + color:white; + background-color:transparent; + border:none; + padding:1px 5px; } .articleFrame{ @@ -13,13 +26,24 @@ } .commentText{ - width:800px; + width:100%; } -.authorPlate .date{ - float:right; +.authorName, .comment .author{ + width:110px; + font-size:85%; } -.comment .date{ - float:right; +.date{ + width:125px; + font-size:85%; +} + +.text{ + text-align:left; + padding:1px 5px; +} + +.submitComment{ + width:100%; } \ No newline at end of file diff --git a/hwe/j_board_article_add.php b/hwe/j_board_article_add.php index 7c90dba2..580dc730 100644 --- a/hwe/j_board_article_add.php +++ b/hwe/j_board_article_add.php @@ -15,7 +15,7 @@ $text = Util::getReq('text'); increaseRefresh("회의실", 1); -$me = $db->queryFirstRow('SELECT no, nation, name, 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, `picture`,`imgsvr` FROM general WHERE owner=%i', $userID); $con = checkLimit($me['con']); if ($con >= 2) { @@ -57,12 +57,15 @@ else if ($isSecretBoard && $permission < 2) { ]); } +$icon = GetImageURL($me['imgsvr'], $me['picture']); + $db->insert('board', [ 'nation_no'=>$me['nation'], 'is_secret'=>$isSecretBoard, 'date'=>TimeUtil::DatetimeNow(), 'general_no'=>$me['no'], 'author'=>$me['name'], + 'author_icon'=>$icon, 'title'=>$title, 'text'=>$text ]); diff --git a/hwe/js/board.js b/hwe/js/board.js index 3ab66dcc..a3067127 100644 --- a/hwe/js/board.js +++ b/hwe/js/board.js @@ -90,7 +90,7 @@ function submitComment(){ function drawArticle(idx, articleObj){ var $articleFrame = $('#articleTemplate > .articleFrame'); - var $commentFrame = $('#commentTemplate > .comment'); + var $commentFrame = $($('#commentTemplate').prop('content')); var $article = $articleFrame.clone(); $article.addClass('articleObj') @@ -102,11 +102,14 @@ function drawArticle(idx, articleObj){ $article.find('.authorName').text(articleObj.author); $article.find('.articleTitle').text(articleObj.title); $article.find('.date').text(articleObj.date); + if(articleObj.author_icon){ + $article.find('.authorIcon').attr('src', articleObj.author_icon); + } //$article.find('.text').text(articleObj.text); $article.find('.text').html(nl2br(escapeHtml(articleObj.text))); //TODO: 바꿀 것 - var $articleComment = $article.find('ul.commentList'); + var $articleComment = $article.find('.commentList'); $.each(articleObj.comment, function(_, commentObj){ var $comment = $commentFrame.clone(); @@ -150,8 +153,15 @@ function loadArticles(){ }); } -$(function(){ +function resizeTextarea($obj){ + $obj.height(1).height($obj.prop('scrollHeight')+12 ); +} +$(function(){ + $('textarea.autosize').on('keydown keyup', function(){ + resizeTextarea($(this)); + }) + $('#submitArticle').click(submitArticle); loadArticles() diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index f233627e..a2869408 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -323,6 +323,7 @@ CREATE TABLE `board` ( `date` DATETIME NOT NULL, `general_no` INT(11) NOT NULL, `author` VARCHAR(32) NOT NULL, + `author_icon` VARCHAR(128) NULL DEFAULT NULL, `title` TEXT NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (`no`), diff --git a/hwe/t_board.php b/hwe/t_board.php index 54bb8d59..978f4e58 100644 --- a/hwe/t_board.php +++ b/hwe/t_board.php @@ -63,44 +63,55 @@ var isSecretBoard = ; // -
-
제목
-
- -
+ + + + + + + + + + + +
새 게시물 작성
제목
내용 + +
- +
- +