Fix #1282 display attachment list in message

This commit is contained in:
Kijin Sung 2020-07-04 23:46:57 +09:00
parent c35d739443
commit 22cb4c552a
8 changed files with 73 additions and 24 deletions

View file

@ -22,7 +22,7 @@ class communicationModel extends communication
* get the configuration
* @return object config of communication module
*/
function getConfig()
public static function getConfig()
{
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('communication');
@ -71,7 +71,7 @@ class communicationModel extends communication
* @param array $group
* @return array
*/
function getGrantArray($default, $group)
public static function getGrantArray($default, $group)
{
$grant = array();
if($default)
@ -97,7 +97,7 @@ class communicationModel extends communication
* @param array $arrGrant
* @return boolean
*/
function checkGrant($arrGrant)
public static function checkGrant($arrGrant)
{
if(!$arrGrant) return false;
@ -110,10 +110,6 @@ class communicationModel extends communication
{
if(Context::get('is_logged')) return true;
}
else if($arrGrant['default'] == 'site')
{
if($this->site_srl == $logged_info->site_srl) return true;
}
else if($arrGrant['default'] == 'manager')
{
if($logged_info->is_admin == 'Y') return true;
@ -136,7 +132,7 @@ class communicationModel extends communication
* @param array $columnList
* @return object message information
*/
function getSelectedMessage($message_srl, $columnList = array())
public static function getSelectedMessage($message_srl, $columnList = array())
{
$logged_info = Context::get('logged_info');
@ -199,7 +195,7 @@ class communicationModel extends communication
* @param array $columnList
* @return object message information
*/
function getNewMessage($columnList = array())
public static function getNewMessage($columnList = array())
{
$logged_info = Context::get('logged_info');
@ -229,7 +225,7 @@ class communicationModel extends communication
return $message;
}
function getNewMessageCount($member_srl = null)
public static function getNewMessageCount($member_srl = null)
{
if(!$member_srl)
{
@ -251,7 +247,7 @@ class communicationModel extends communication
* @param array $columnList
* @return Object
*/
function getMessages($message_type = "R", $columnList = array())
public static function getMessages($message_type = "R", $columnList = array())
{
$logged_info = Context::get('logged_info');
$args = new stdClass();
@ -306,6 +302,19 @@ class communicationModel extends communication
return $output;
}
/**
* Get a list of files attached to a message.
*
* @param object $message
* @return array
*/
public static function getMessageFiles($message)
{
$upload_target_srl = $message->message_type === 'S' ? $message->message_srl : $message->related_srl;
$file_list = getModel('file')->getFiles($upload_target_srl);
return $file_list ?: [];
}
/**
* Get a list of friends
@ -313,7 +322,7 @@ class communicationModel extends communication
* @param array $columnList
* @return Object
*/
function getFriends($friend_group_srl = 0, $columnList = array())
public static function getFriends($friend_group_srl = 0, $columnList = array())
{
$logged_info = Context::get('logged_info');
@ -337,7 +346,7 @@ class communicationModel extends communication
* @param int $member_srl
* @return int
*/
function isAddedFriend($member_srl)
public static function isAddedFriend($member_srl)
{
$logged_info = Context::get('logged_info');
@ -355,7 +364,7 @@ class communicationModel extends communication
* @param int $friend_group_srl
* @return object
*/
function getFriendGroupInfo($friend_group_srl)
public static function getFriendGroupInfo($friend_group_srl)
{
$logged_info = Context::get('logged_info');
@ -372,7 +381,7 @@ class communicationModel extends communication
* Get a list of groups
* @return array
*/
function getFriendGroups()
public static function getFriendGroups()
{
$logged_info = Context::get('logged_info');
@ -392,7 +401,7 @@ class communicationModel extends communication
* @param int $target_srl
* @return boolean (true : friend, false : not friend)
*/
function isFriend($target_srl)
public static function isFriend($target_srl)
{
$logged_info = Context::get('logged_info');

View file

@ -64,7 +64,7 @@ class communicationView extends communication
$logged_info = Context::get('logged_info');
// Set the variables
$message_srl = Context::get('message_srl');
$message_srl = intval(Context::get('message_srl'));
$message_type = Context::get('message_type');
if(!in_array($message_type, array('R', 'S', 'T', 'N')))
@ -78,7 +78,7 @@ class communicationView extends communication
$template_filename = 'messages';
if($message_srl)
{
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
$columnList = array('message_srl', 'message_type', 'related_srl', 'sender_srl', 'receiver_srl', 'title', 'content', 'readed', 'regdate');
$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
switch($message->message_type)
@ -116,15 +116,21 @@ class communicationView extends communication
{
stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message);
Context::set('message_files', CommunicationModel::getMessageFiles($message));
if(Mobile::isFromMobilePhone())
{
$template_filename = 'read_message';
}
}
else
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
}
// Extract a list
$columnList = array('message_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
$columnList = array('message_srl', 'message_type', 'related_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
$output = $oCommunicationModel->getMessages($message_type, $columnList);
// set a template file
@ -160,8 +166,6 @@ class communicationView extends communication
throw new Rhymix\Framework\Exceptions\MustLogin;
}
$logged_info = Context::get('logged_info');
$oCommunicationModel = getModel('communication');
// get a new message

View file

@ -19,6 +19,8 @@ input[type=radio]{width:13px;height:13px;margin:0;padding:0}
.bd{background:#f8f8f8;padding:1px 0}
.co{margin:10px;line-height:1.4;font-size:14px;color:#333}
.co:after{content:"";display:block;clear:both;zoom:1}
.co .attachments { border-top: 1px solid #ccc8be; margin: 16px 0 0 0; padding: 16px 0 16px 24px; }
.co .attachments span.file_size { color: #666; }
/* Hx */
.hx{position:relative;border-bottom:1px solid #ccc8be;padding:8px 10px;margin:0}
.hx:after{content:"";margin:0 -10px;position:relative;top:10px;display:block;clear:both;height:1px;background:#fff}

View file

@ -5,6 +5,13 @@
</div>
<div class="co">
<div class="xe_content">{$message->content|noescape}</div>
<!--@if(count($message_files))-->
<ul class="attachments">
<!--@foreach($message_files as $file)-->
<li><a href="{getUrl('')}{$file->download_url}">{$file->source_filename}</a> <span class="file_size">({FileHandler::filesize($file->file_size)})</li>
<!--@endforeach-->
</ul>
<!--@endif-->
</div>
<div class="bna">
<span class="fl"><a href="{getUrl('message_srl', '')}" class="bn white">{$lang->cmd_list}</a></span>

View file

@ -10,7 +10,14 @@
<div class="xe_content">
{$message->content}
</div>
<div class="prn-anchor-buttons">
<!--@if(count($message_files))-->
<ul class="attachments">
<!--@foreach($message_files as $file)-->
<li><a href="{getUrl('')}{$file->download_url}">{$file->source_filename}</a> <span class="file_size">({FileHandler::filesize($file->file_size)})</li>
<!--@endforeach-->
</ul>
<!--@endif-->
<div class="prn-anchor-buttons">
<a cond="$message->message_type != 'S' && $message->member_srl != $logged_info->member_srl" href="#" onclick="doSendMessage('{$message->sender_srl}','{$message->message_srl}');">{$lang->cmd_reply_message}</a>
<a cond="$message->message_type == 'R'" href="#" onclick="doStoreMessage('{$message->message_srl}');">{$lang->cmd_store}</a>
<a href="#" onclick="doDeleteMessage('{$message->message_srl}');">{$lang->cmd_delete}</a>

View file

@ -211,6 +211,8 @@
.xc .table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}
.xc .table-hover tbody tr:hover>td,
.xc .table-hover tbody tr:hover>th{background-color:#f5f5f5}
.xc .table ul.attachments { margin: 0; padding-left: 20px; }
.xc .table ul.attachments span.file_size { color: #666; }
.xc .explanation { display: inline-block; margin-left: 8px; color: #999; }
/* Pangination */
.xc .pagination{margin:20px 0}

View file

@ -17,7 +17,7 @@
</form>
<div style="clear:both"></div>
</div>
<table class="table table-striped table-hover" style="table-layout: fixed" cond="$message">
<table class="table table-striped" style="table-layout: fixed" cond="$message">
<tr>
<th>{$message->title}</th>
</tr>
@ -32,6 +32,17 @@
{$message->content|noescape}
</td>
</tr>
<!--@if(count($message_files))-->
<tr>
<td>
<ul class="attachments">
<!--@foreach($message_files as $file)-->
<li><a href="{getUrl('')}{$file->download_url}">{$file->source_filename}</a> <span class="file_size">({FileHandler::filesize($file->file_size)})</li>
<!--@endforeach-->
</ul>
</td>
</tr>
<!--@endif-->
</table>
<div class="btnArea btn-group" cond="$message" style="margin-bottom:20px">
<button class="btn" cond="$message->message_type != 'S' && $message->member_srl != $logged_info->member_srl" type="button" onclick="doSendMessage('{$message->sender_srl}','{$message->message_srl}');">{$lang->cmd_reply_message}</button>

View file

@ -8,8 +8,15 @@
</div>
<div class="xe_content">
{$message->content}
<!--@if(count($message_files))-->
<ul class="attachments">
<!--@foreach($message_files as $file)-->
<li><a href="{getUrl('')}{$file->download_url}">{$file->source_filename}</a> <span class="file_size">({FileHandler::filesize($file->file_size)})</li>
<!--@endforeach-->
</ul>
<!--@endif-->
</div>
<div class="sw-footer sw-anchor-buttons">
<div class="sw-footer sw-anchor-buttons">
<a cond="$message->message_type != 'S' && $message->member_srl != $logged_info->member_srl" href="#" onclick="doSendMessage('{$message->sender_srl}','{$message->message_srl}');">{$lang->cmd_reply_message}</a>
<a cond="$message->message_type == 'R'" href="#" onclick="doStoreMessage('{$message->message_srl}');">{$lang->cmd_store}</a>
<a href="#" onclick="doDeleteMessage('{$message->message_srl}');">{$lang->cmd_delete}</a>