회의실 기밀실 템플릿

This commit is contained in:
2019-01-29 23:40:28 +09:00
parent 4fa9346652
commit 6b02384fb8
5 changed files with 87 additions and 38 deletions
+29 -5
View File
@@ -3,8 +3,21 @@
margin: 0 auto; margin: 0 auto;
} }
.titleInput{
width:100%;
color:white;
background-color:transparent;
border:none;
margin:1px 5px;
}
.contentInput{ .contentInput{
width:100%; width:100%;
min-height:3em;
color:white;
background-color:transparent;
border:none;
padding:1px 5px;
} }
.articleFrame{ .articleFrame{
@@ -13,13 +26,24 @@
} }
.commentText{ .commentText{
width:800px; width:100%;
} }
.authorPlate .date{ .authorName, .comment .author{
float:right; width:110px;
font-size:85%;
} }
.comment .date{ .date{
float:right; width:125px;
font-size:85%;
}
.text{
text-align:left;
padding:1px 5px;
}
.submitComment{
width:100%;
} }
+4 -1
View File
@@ -15,7 +15,7 @@ $text = Util::getReq('text');
increaseRefresh("회의실", 1); 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']); $con = checkLimit($me['con']);
if ($con >= 2) { if ($con >= 2) {
@@ -57,12 +57,15 @@ else if ($isSecretBoard && $permission < 2) {
]); ]);
} }
$icon = GetImageURL($me['imgsvr'], $me['picture']);
$db->insert('board', [ $db->insert('board', [
'nation_no'=>$me['nation'], 'nation_no'=>$me['nation'],
'is_secret'=>$isSecretBoard, 'is_secret'=>$isSecretBoard,
'date'=>TimeUtil::DatetimeNow(), 'date'=>TimeUtil::DatetimeNow(),
'general_no'=>$me['no'], 'general_no'=>$me['no'],
'author'=>$me['name'], 'author'=>$me['name'],
'author_icon'=>$icon,
'title'=>$title, 'title'=>$title,
'text'=>$text 'text'=>$text
]); ]);
+12 -2
View File
@@ -90,7 +90,7 @@ function submitComment(){
function drawArticle(idx, articleObj){ function drawArticle(idx, articleObj){
var $articleFrame = $('#articleTemplate > .articleFrame'); var $articleFrame = $('#articleTemplate > .articleFrame');
var $commentFrame = $('#commentTemplate > .comment'); var $commentFrame = $($('#commentTemplate').prop('content'));
var $article = $articleFrame.clone(); var $article = $articleFrame.clone();
$article.addClass('articleObj') $article.addClass('articleObj')
@@ -102,11 +102,14 @@ function drawArticle(idx, articleObj){
$article.find('.authorName').text(articleObj.author); $article.find('.authorName').text(articleObj.author);
$article.find('.articleTitle').text(articleObj.title); $article.find('.articleTitle').text(articleObj.title);
$article.find('.date').text(articleObj.date); $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').text(articleObj.text);
$article.find('.text').html(nl2br(escapeHtml(articleObj.text))); $article.find('.text').html(nl2br(escapeHtml(articleObj.text)));
//TODO: 바꿀 것 //TODO: 바꿀 것
var $articleComment = $article.find('ul.commentList'); var $articleComment = $article.find('.commentList');
$.each(articleObj.comment, function(_, commentObj){ $.each(articleObj.comment, function(_, commentObj){
var $comment = $commentFrame.clone(); var $comment = $commentFrame.clone();
@@ -150,7 +153,14 @@ function loadArticles(){
}); });
} }
function resizeTextarea($obj){
$obj.height(1).height($obj.prop('scrollHeight')+12 );
}
$(function(){ $(function(){
$('textarea.autosize').on('keydown keyup', function(){
resizeTextarea($(this));
})
$('#submitArticle').click(submitArticle); $('#submitArticle').click(submitArticle);
+1
View File
@@ -323,6 +323,7 @@ CREATE TABLE `board` (
`date` DATETIME NOT NULL, `date` DATETIME NOT NULL,
`general_no` INT(11) NOT NULL, `general_no` INT(11) NOT NULL,
`author` VARCHAR(32) NOT NULL, `author` VARCHAR(32) NOT NULL,
`author_icon` VARCHAR(128) NULL DEFAULT NULL,
`title` TEXT NOT NULL, `title` TEXT NOT NULL,
`text` TEXT NOT NULL, `text` TEXT NOT NULL,
PRIMARY KEY (`no`), PRIMARY KEY (`no`),
+40 -29
View File
@@ -63,44 +63,55 @@ var isSecretBoard = <?=($isSecretBoard?'true':'false')?>; //
</head> </head>
<body> <body>
<div id='newArticle'> <table id='newArticle' class='bg0'>
<div><span class='articleTitle'>제목</span><input class='titleInput' type='text' maxlength='250'></input></div> <thead>
<div class='boardArticle'> <tr><td colspan='2' class='newArticleHeader bg2'>새 게시물 작성</td>
<textarea class="contentInput" rows="10" cols="50"></textarea> </thead>
</div> <tbody>
<tr><th class='bg1' style='width:66px;'><span class='articleTitle'>제목</span></th><td><input class='titleInput' type='text' maxlength='250' placeholder='제목'></input></td></tr>
<tr><th class='bg1'>내용</th><td class='boardArticle'>
<textarea class="contentInput autosize" placeholder='내용'></textarea>
</td></tr>
</tbody>
<tfoot>
<tr><td colspan="2">
<button type='button' id='submitArticle'>등록</button> <button type='button' id='submitArticle'>등록</button>
</div> </td></tr>
</tfoot>
</table>
<div id="board"> <div id="board">
</div> </div>
<!-- 설계미스. template와 shadowdom으로 변경 --> <!-- 설계미스. template와 shadowdom으로 변경 -->
<div id='articleTemplate' style='display:none;'> <div id='articleTemplate' style='display:none;'>
<div class='articleFrame'> <table class='articleFrame bg0'>
<div>#<span class='articleNo'></span> <span class='articleTitle'></span></div> <thead>
<div class='authorPlate'><span class='authorIcon'></span><span class='authorName'></span><span class='date'></span></div> <tr class='bg1'>
<div class='text'> <th class='authorName'></th><th class='articleTitle'></th><th class='date'></th>
</tr>
</div> </thead>
<div class='commentFrame'> <tbody>
<ul class='commentList'> <tr>
<td><img class='authorIcon generalIcon' width='64' height='64'></td>
</ul> <td class='text' colspan='2'></td>
<div> </tr>
<input class='commentText' type='text' maxlength='250'> </tbody>
<button type='button' class='submitComment'>등록</button> <tbody class='commentList'>
</div> </tbody>
</div> <tfoot>
</div> <tr><td class='bg2'>댓글 달기</td><td><input class='commentText' type='text' maxlength='250'></td><td><button type='button' class='submitComment'>등록</button></td></tr>
</tfoot>
</table>
</div> </div>
<div id='commentTemplate' style='display:none;'> <template id='commentTemplate' style='display:none;'>
<li class='comment'> <tr class='comment'>
<span class='author'></span> <th class='author'></th>
<span class='text'></span> <td class='text'></td>
<span class='date'></span> <td class='date'></td>
</li> </tr>
</div> </template>
<div style='width=1000px;' class='tb_layout bg0'> <div style='width=1000px;' class='tb_layout bg0'>
<?=backButton()?><br> <?=backButton()?><br>