From 7367eb1c45b0211b80033b55b2650849d92eb178 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 4 Jun 2018 01:03:05 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=8B=9C?= =?UTF-8?q?=EC=8A=A4=ED=85=9C=EC=97=90=209=EC=9E=90=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/css/msg.css | 11 +++++++++++ hwe/func_template.php | 10 +++++----- hwe/j_msg_get_recent.php | 7 ++++--- hwe/js/msg.js | 14 ++++++++++++++ hwe/js/templates/message.html | 25 ++++++++++++++++++------- hwe/lib.php | 2 +- hwe/process_war.php | 2 +- i_entrance/entrance.php | 2 +- 8 files changed, 55 insertions(+), 18 deletions(-) diff --git a/hwe/css/msg.css b/hwe/css/msg.css index b7ea5adc..403fb00d 100644 --- a/hwe/css/msg.css +++ b/hwe/css/msg.css @@ -35,6 +35,10 @@ background-color:#5d1e1a; } +.msg_plate_private.msg_plate_dest{ + background-color:#5d461a; +} + .msg_plate_public{ background-color:#141c65; @@ -42,7 +46,14 @@ .msg_plate_national, .msg_plate_diplomacy{ background-color:#00582c; +} +.msg_plate_national.msg_plate_dest, .msg_plate_diplomacy.msg_plate_dest { + background-color:#704615; +} + +.msg_plate_national.msg_plate_src, .msg_plate_diplomacy.msg_plate_src { + background-color:#70153b; } .public_message{ diff --git a/hwe/func_template.php b/hwe/func_template.php index 93c827f4..5e026431 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -77,11 +77,11 @@ function allButton() { $call = "설문조사"; } - if(\file_exists("d_setting/templates/allButton.php")){ - $templates = new \League\Plates\Engine('d_setting/templates'); + if(\file_exists(__dir__."/d_setting/templates/allButton.php")){ + $templates = new \League\Plates\Engine(__dir__.'/d_setting/templates'); } else{ - $templates = new \League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine(__dir__.'/templates'); } @@ -113,7 +113,7 @@ function commandButton() { $bgColor = Util::array_get($nation['color'])?:'#000000'; $fgColor = newColor($bgColor); - $templates = new \League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine(__dir__.'/templates'); $showSecret = false; if($me['level'] >= 2){ $showSecret = true; @@ -170,7 +170,7 @@ function formatName(string $name, int $npc): string{ function getMapHtml(){ //NOTE: 필요한가? - $templates = new \League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine(__dir__.'/templates'); return $templates->render('map'); } \ No newline at end of file diff --git a/hwe/j_msg_get_recent.php b/hwe/j_msg_get_recent.php index ceb85cf5..d41cad51 100644 --- a/hwe/j_msg_get_recent.php +++ b/hwe/j_msg_get_recent.php @@ -11,8 +11,8 @@ $jsonPost = WebUtil::parseJsonPost(); $reqSequence = (int)Util::array_get($jsonPost['sequence'], 0); -list($generalID, $nationID) = DB::db()->queryFirstList( - 'select `no`, `nation` from `general` where owner = %i', +list($generalID, $nationID, $generalName) = DB::db()->queryFirstList( + 'select `no`, `nation`, `name` from `general` where owner = %i', $userID ); @@ -58,5 +58,6 @@ $result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence){ }, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0)); $result['sequence'] = $nextSequence; - +$result['nationID'] = $nationID; +$result['generalName'] = $generalName; Json::die($result); \ No newline at end of file diff --git a/hwe/js/msg.js b/hwe/js/msg.js index 39dfd38f..8f3558a0 100644 --- a/hwe/js/msg.js +++ b/hwe/js/msg.js @@ -134,7 +134,21 @@ function redrawMsg(deferred){ $('#last_contact').val(contactTarget).html(generalList[contactTarget].textName).show(); } + msg.nationID = obj.nationID; + msg.generalName = obj.generalName; msg.msgType = msgType; + + if(msg.src.nation_id == msg.dest.nation_id){ + msg.nationType = 'local'; + } + else if(msg.nationID == msg.src.nation_id){ + msg.nationType = 'src'; + } + else{ + msg.nationType = 'dest'; + } + + msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg'; var msgHtml = TemplateEngine(messageTemplate, msg); diff --git a/hwe/js/templates/message.html b/hwe/js/templates/message.html index 11895e03..d37568c5 100644 --- a/hwe/js/templates/message.html +++ b/hwe/js/templates/message.html @@ -1,10 +1,10 @@
- <%if(src.icon) { %> + <%if(src.icon){ %> <%} else {%> @@ -13,15 +13,26 @@
<%if(msgType == 'private') {%> - <%e(src.name)%>:<%e(src.nation)%> + <%e(dest.name)%>:<%e(dest.nation)%> - <%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%> - <%e(src.name)%>:<%e(src.nation)%> - <%} else if(msgType == 'national' || msgType == 'diplomacy'){%> + <%}else{%> <%e(src.name)%>:<%e(src.nation)%> + <%}%> + <%} else if(msgType == 'national' && src.nation_id == dest.nation_id){%> + <%e(src.name)%> + <%} else if(msgType == 'national' || msgType == 'diplomacy'){%> + <%if(src.nation_id == nationID){%> + <%e(src.name)%><%e(dest.nation)%> + <%}else{%> + <%e(src.name)%>:<%e(src.nation)%> + <%}%> <%} else {%> <%e(src.name)%>:<%e(src.nation)%> <%} %> diff --git a/hwe/lib.php b/hwe/lib.php index 070f19e5..d5e0d5ea 100644 --- a/hwe/lib.php +++ b/hwe/lib.php @@ -37,7 +37,7 @@ function Error($message='', $url="") } file_put_contents(__dir__."/logs/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND); - $templates = new \League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine(__dir__.'/templates'); ob_get_flush(); WebUtil::setHeaderNoCache(); diff --git a/hwe/process_war.php b/hwe/process_war.php index a42afaf1..c1b6aa34 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -9,7 +9,7 @@ function processWar($general, $city) { $gameStor = KVStorage::getStorage($db, 'game_env'); $connect=$db->get(); - $templates = new \League\Plates\Engine('templates'); + $templates = new \League\Plates\Engine(__dir__.'/templates'); $date = substr($general['turntime'],11,5); diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php index 339df4e3..b50f2c81 100644 --- a/i_entrance/entrance.php +++ b/i_entrance/entrance.php @@ -6,7 +6,7 @@ require(__dir__.'/../vendor/autoload.php'); WebUtil::setHeaderNoCache(); $session = Session::requireLogin()->setReadOnly(); -$templates = new \League\Plates\Engine('templates'); +$templates = new \League\Plates\Engine(__dir__.'/templates'); $db = RootDB::db(); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1');