delete-old: board
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#newArticle{
|
||||
width:1000px;
|
||||
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{
|
||||
width:1000px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.authorName, .comment .author{
|
||||
width:110px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.date{
|
||||
width:125px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.text{
|
||||
text-align:left;
|
||||
padding:1px 5px;
|
||||
}
|
||||
|
||||
.submitComment{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
padding:1px 5px;
|
||||
}
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
//increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
printLimitMsg($me['turntime']);
|
||||
exit();
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
}
|
||||
else if ($isSecretBoard && $permission < 2) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아닙니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
$boardName = $isSecretBoard?'기밀실':'회의실';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=UniqueConst::$serverName?>: <?=$boardName?></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<!--<?=WebUtil::printCSS('../e_lib/tui.editor/tui-editor.min.css')?>-->
|
||||
<!--<?=WebUtil::printCSS('../e_lib/tui.editor/tui-editor-contents.min.css')?>-->
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('../css/config.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/board.css')?>
|
||||
<script>
|
||||
var isSecretBoard = <?=($isSecretBoard?'true':'false')?>; //
|
||||
</script>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/board.js')?>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div style='width:1000px;margin:auto;' class='tb_layout bg0'>
|
||||
<?=$boardName?><br>
|
||||
<?=backButton()?>
|
||||
</div>
|
||||
|
||||
|
||||
<table id='newArticle' class='bg0'>
|
||||
<thead>
|
||||
<tr><td colspan='2' class='newArticleHeader bg2'>새 게시물 작성</td>
|
||||
</thead>
|
||||
<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>
|
||||
</td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div id="board">
|
||||
</div>
|
||||
|
||||
<!-- 설계미스. template와 shadowdom으로 변경 -->
|
||||
<div id='articleTemplate' style='display:none;'>
|
||||
<table class='articleFrame bg0'>
|
||||
<thead>
|
||||
<tr class='bg1'>
|
||||
<th class='authorName'></th><th class='articleTitle'></th><th class='date'></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><img class='authorIcon generalIcon' width='64' height='64'></td>
|
||||
<td class='text' colspan='2'></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class='commentList'>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td class='bg2 inputCommentHeader'>댓글 달기</td><td><input class='commentText' type='text' maxlength='250' placeholder='새 댓글 내용'></td><td><button type='button' class='submitComment'>등록</button></td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<template id='commentTemplate' style='display:none;'>
|
||||
<tr class='comment'>
|
||||
<th class='author'></th>
|
||||
<td class='text'></td>
|
||||
<td class='date'></td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<div style='width:1000px;margin:auto;' class='tb_layout bg0'>
|
||||
<?=backButton()?><br>
|
||||
<?=banner()?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,232 +0,0 @@
|
||||
|
||||
import axios from 'axios';
|
||||
import $ from 'jquery';
|
||||
import { trim } from 'lodash';
|
||||
import { escapeHtml } from "./escapeHtml";
|
||||
import { nl2br } from "../util/nl2br";
|
||||
import { InvalidResponse } from '../defs';
|
||||
import { convertFormData } from '../util/convertFormData';
|
||||
import { setAxiosXMLHttpRequest } from '../util/setAxiosXMLHttpRequest';
|
||||
import { unwrap_any } from '../util/unwrap_any';
|
||||
|
||||
declare const isSecretBoard: boolean;
|
||||
|
||||
type BoardResponse = {
|
||||
result: true,
|
||||
articles: Record<number, BoardArticle>,
|
||||
}
|
||||
|
||||
type BoardArticle = {
|
||||
no: number,
|
||||
nation_no: number,
|
||||
is_secret?: boolean,
|
||||
date: string,
|
||||
general_no: number,
|
||||
author: string,
|
||||
author_icon: string,
|
||||
title: string,
|
||||
text: string,
|
||||
comment: BoardComment[],
|
||||
}
|
||||
|
||||
type BoardComment = {
|
||||
no: number,
|
||||
nation_no: number,
|
||||
is_secret?: boolean,
|
||||
date: string,
|
||||
document_no: number,
|
||||
general_no: number,
|
||||
author: string,
|
||||
text: string,
|
||||
}
|
||||
|
||||
async function submitArticle(e: JQuery.Event) {
|
||||
e.preventDefault();
|
||||
|
||||
const $article = $('#newArticle');
|
||||
const $title = $article.find('.titleInput');
|
||||
const $text = $article.find('.contentInput');
|
||||
const title = trim(unwrap_any<string>($title.val()));
|
||||
const text = trim(unwrap_any<string>($text.val()));
|
||||
|
||||
|
||||
if (!text && !title) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let result: InvalidResponse;
|
||||
|
||||
try {
|
||||
const response = await axios({
|
||||
url: 'j_board_article_add.php',
|
||||
method: 'post',
|
||||
responseType: 'json',
|
||||
data: convertFormData({
|
||||
isSecret: isSecretBoard,
|
||||
title: title,
|
||||
text: text
|
||||
})
|
||||
});
|
||||
result = response.data;
|
||||
}
|
||||
catch(e){
|
||||
console.error(e);
|
||||
alert(`실패했습니다. :${e}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!result.result){
|
||||
alert(`글을 올리는데 실패했습니다. ${result.reason}`);
|
||||
return;
|
||||
}
|
||||
|
||||
$title.val('');
|
||||
$text.val('');
|
||||
|
||||
void loadArticles();
|
||||
}
|
||||
|
||||
async function submitComment(this: HTMLElement, e: JQuery.Event) {
|
||||
e.preventDefault();
|
||||
|
||||
const $this = $(this);
|
||||
|
||||
const $article = $this.closest('.articleObj').eq(0);
|
||||
const articleNo = $article.data('no');
|
||||
const $text = $article.find('input.commentText');
|
||||
const text = trim(unwrap_any<string>($text.val()));
|
||||
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let result: InvalidResponse;
|
||||
|
||||
|
||||
try {
|
||||
const response = await axios({
|
||||
url: 'j_board_comment_add.php',
|
||||
method: 'post',
|
||||
responseType: 'json',
|
||||
data: convertFormData({
|
||||
articleNo: articleNo,
|
||||
text: text
|
||||
})
|
||||
});
|
||||
result = response.data;
|
||||
}
|
||||
catch(e){
|
||||
console.error(e);
|
||||
alert(`실패했습니다. :${e}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!result.result){
|
||||
alert(`댓글을 다는데 실패했습니다. ${result.reason}`);
|
||||
return;
|
||||
}
|
||||
|
||||
$text.val('');
|
||||
|
||||
void loadArticles();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawArticle(articleObj: BoardArticle) {
|
||||
const $articleFrame = $('#articleTemplate > .articleFrame');
|
||||
const $commentFrame = $($('#commentTemplate').prop('content'));
|
||||
|
||||
const $article = $articleFrame.clone();
|
||||
$article.addClass('articleObj')
|
||||
.data('no', articleObj.no)
|
||||
.data('author', articleObj.general_no);
|
||||
|
||||
|
||||
$article.find('.articleNo').text(articleObj.no);
|
||||
$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: 바꿀 것
|
||||
|
||||
const $articleComment = $article.find('.commentList');
|
||||
|
||||
for (const commentObj of articleObj.comment) {
|
||||
const $comment = $commentFrame.clone();
|
||||
$comment.find('.author').text(commentObj.author);
|
||||
//$comment.find('.text').text(commentObj.text);
|
||||
$comment.find('.text').html(nl2br(escapeHtml(commentObj.text)));
|
||||
$comment.find('.date').text(commentObj.date);
|
||||
$articleComment.append($comment);
|
||||
}
|
||||
|
||||
$article.find('.submitComment').on('click', submitComment);
|
||||
$article.find('.commentText').on('keypress', function (e) {
|
||||
if (e.which === 13) {
|
||||
$article.find('.submitComment').trigger('click');
|
||||
}
|
||||
});
|
||||
$article.find('.inputCommentHeader').click(function () {
|
||||
$article.find('.commentText').trigger('focus');
|
||||
})
|
||||
|
||||
const $board = $('#board');
|
||||
|
||||
$board.prepend($article);
|
||||
}
|
||||
|
||||
function drawArticles(articlesObj: BoardResponse | InvalidResponse) {
|
||||
if (!articlesObj.result) {
|
||||
alert(`에러: ${articlesObj.reason}`);
|
||||
return;
|
||||
}
|
||||
|
||||
$('.articleObj').detach();//첫 버전이니까 일괄 삭제 일괄 로드
|
||||
for (const article of Object.values(articlesObj.articles)) {
|
||||
drawArticle(article);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function loadArticles() {
|
||||
try {
|
||||
const response = await axios({
|
||||
url: 'j_board_get_articles.php',
|
||||
responseType: 'json',
|
||||
method: 'post',
|
||||
data: convertFormData({
|
||||
isSecret: isSecretBoard
|
||||
})
|
||||
});
|
||||
drawArticles(response.data);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
alert(`에러: ${e}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function resizeTextarea($obj: JQuery<HTMLElement>) {
|
||||
$obj.height(1).height($obj.prop('scrollHeight') + 12);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setAxiosXMLHttpRequest();
|
||||
|
||||
$('textarea.autosize').on('keydown keyup', function () {
|
||||
resizeTextarea($(this));
|
||||
})
|
||||
|
||||
$('#submitArticle').on('click', submitArticle);
|
||||
|
||||
void loadArticles();
|
||||
|
||||
});
|
||||
@@ -186,7 +186,6 @@ module.exports = (env, argv) => {
|
||||
processing: `${tsDir}/processing.ts`,
|
||||
select_npc: `${tsDir}/select_npc.ts`,
|
||||
betting: `${tsDir}/betting.ts`,
|
||||
board: `${tsDir}/legacy/board.ts`,
|
||||
bossInfo: `${tsDir}/bossInfo.ts`,
|
||||
myPage: `${tsDir}/myPage.ts`,
|
||||
extExpandCity: `${tsDir}/extExpandCity.ts`,
|
||||
|
||||
Reference in New Issue
Block a user