diff --git a/hwe/css/board.css b/hwe/css/board.css deleted file mode 100644 index dd83ba73..00000000 --- a/hwe/css/board.css +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/hwe/t_board.php b/hwe/t_board.php deleted file mode 100644 index e5af3659..00000000 --- a/hwe/t_board.php +++ /dev/null @@ -1,125 +0,0 @@ -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?'기밀실':'회의실'; - -?> - - - -<?=UniqueConst::$serverName?>: <?=$boardName?> - - - - - - - - - - - - - - - - - - - -
-
- -
- - - - - - - - - - - - - -
새 게시물 작성
제목
내용 - -
- -
- -
-
- - - - - - -
-
- -
- - \ No newline at end of file diff --git a/hwe/ts/legacy/board.ts b/hwe/ts/legacy/board.ts deleted file mode 100644 index 79be2e77..00000000 --- a/hwe/ts/legacy/board.ts +++ /dev/null @@ -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, -} - -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($title.val())); - const text = trim(unwrap_any($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($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) { - $obj.height(1).height($obj.prop('scrollHeight') + 12); -} - -$(function () { - setAxiosXMLHttpRequest(); - - $('textarea.autosize').on('keydown keyup', function () { - resizeTextarea($(this)); - }) - - $('#submitArticle').on('click', submitArticle); - - void loadArticles(); - -}); \ No newline at end of file diff --git a/webpack.config.cjs b/webpack.config.cjs index 003a8d5a..05c416e6 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -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`,