Issue 2617 added send message in communication module

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12267 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
chschy 2012-11-20 10:53:33 +00:00
parent d146313145
commit 76b100e076
10 changed files with 233 additions and 43 deletions

View file

@ -88,13 +88,22 @@ class communicationController extends communication
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
{
global $lang;
htmlHeader();
alertScript($lang->success_sended);
closePopupScript();
htmlFooter();
Context::close();
exit;
if(Context::get('is_popup') != 'Y')
{
global $lang;
htmlHeader();
alertScript($lang->success_sended);
closePopupScript();
htmlFooter();
Context::close();
exit;
}
else
{
$this->setMessage('success_sended');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act','dispCommunicationMessages','message_type','S','receiver_srl',$receiver_srl,'message_srl','');
$this->setRedirectUrl($returnUrl);
}
}
return $output;
}

View file

@ -1,6 +1,11 @@
<?php
require_once(_XE_PATH_.'modules/communication/communication.view.php');
/**
* @class communicationMobile
* @author NHN (developers@xpressengine.com)
* Mobile class of communication module
*/
class communicationMobile extends communicationView
{
function init()
@ -24,6 +29,10 @@ class communicationMobile extends communicationView
}
}
/**
* Display message box
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationMessages()
{
// Error appears if not logged-in
@ -40,9 +49,12 @@ class communicationMobile extends communicationView
// Set the variables
$message_srl = Context::get('message_srl');
$message_type = 'R';
Context::set('message_type', $message_type);
$message_type = Context::get('message_type');
if(!in_array($message_type, array('R','S','T')))
{
$message_type = 'R';
Context::set('message_type', $message_type);
}
$oCommunicationModel = &getModel('communication');
// extract contents if message_srl exists
if($message_srl)
@ -50,7 +62,28 @@ class communicationMobile extends communicationView
$templateFile = 'read_message';
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl) )
switch($message->message_type)
{
case 'R':
if($message->receiver_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
case 'S':
if($message->sender_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
case 'T':
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
}
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl) )
{
stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message);
@ -76,6 +109,58 @@ class communicationMobile extends communicationView
$this->setTemplateFile($templateFile);
}
/**
* Display list of message box
* @return void
*/
function dispCommunicationMessageBoxList()
{
$this->setTemplateFile('message_box');
}
/**
* Display message sending
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationSendMessage()
{
$oCommunicationModel = &getModel('communication');
$oMemberModel = &getModel('member');
// Error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
// get receipient's information
// check inalid request
$receiver_srl = Context::get('receiver_srl');
if(!$receiver_srl) return $this->stop('msg_invalid_request');
// check receiver and sender are same
if($logged_info->member_srl == $receiver_srl) return $this->stop('msg_cannot_send_to_yourself');
// get message_srl of the original message if it is a reply
$message_srl = Context::get('message_srl');
if($message_srl)
{
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
{
$source_message->title = "[re] ".$source_message->title;
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>";
Context::set('source_message', $source_message);
}
}
$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if(!$receiver_info)
{
return $this->stop('msg_invalid_request');
}
Context::set('receiver_info', $receiver_info);
$this->setTemplateFile('send_message');
}
}
/* End of file communication.mobile.php */
/* Location: ./modules/comment/communication.mobile.php */

View file

@ -1,32 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<permissions />
<actions>
<action name="dispCommunicationMessages" type="view" standalone="true" />
<action name="dispCommunicationSendMessage" type="view" standalone="true" />
<action name="dispCommunicationNewMessage" type="view" standalone="true" />
<grants />
<permissions />
<actions>
<action name="dispCommunicationMessages" type="view" standalone="true" />
<action name="dispCommunicationSendMessage" type="view" standalone="true" />
<action name="dispCommunicationNewMessage" type="view" standalone="true" />
<action name="dispCommunicationFriend" type="view" standalone="true" />
<action name="dispCommunicationAddFriend" type="view" standalone="true" />
<action name="dispCommunicationAddFriendGroup" type="view" standalone="true" />
<action name="dispCommunicationFriend" type="view" standalone="true" />
<action name="dispCommunicationAddFriend" type="view" standalone="true" />
<action name="dispCommunicationAddFriendGroup" type="view" standalone="true" />
<action name="dispCommunicationMessageBoxList" type="mobile" standalone="true" />
<action name="procCommunicationUpdateAllowMessage" type="controller" standalone="true" />
<action name="procCommunicationSendMessage" type="controller" standalone="true" ruleset="sendMessage" />
<action name="procCommunicationStoreMessage" type="controller" standalone="true" />
<action name="procCommunicationDeleteMessage" type="controller" standalone="true" />
<action name="procCommunicationDeleteMessages" type="controller" standalone="true" />
<action name="procCommunicationUpdateAllowMessage" type="controller" standalone="true" />
<action name="procCommunicationSendMessage" type="controller" standalone="true" ruleset="sendMessage" />
<action name="procCommunicationStoreMessage" type="controller" standalone="true" />
<action name="procCommunicationDeleteMessage" type="controller" standalone="true" />
<action name="procCommunicationDeleteMessages" type="controller" standalone="true" />
<action name="procCommunicationAddFriend" type="controller" standalone="true" ruleset="addFriend" />
<action name="procCommunicationMoveFriend" type="controller" standalone="true" ruleset="deleteCheckedFriend" />
<action name="procCommunicationDeleteFriend" type="controller" standalone="true" ruleset="deleteCheckedFriend" />
<action name="procCommunicationAddFriend" type="controller" standalone="true" ruleset="addFriend" />
<action name="procCommunicationMoveFriend" type="controller" standalone="true" ruleset="deleteCheckedFriend" />
<action name="procCommunicationDeleteFriend" type="controller" standalone="true" ruleset="deleteCheckedFriend" />
<action name="procCommunicationAddFriendGroup" type="controller" standalone="true" ruleset="addFriendGroup" />
<action name="procCommunicationRenameFriendGroup" type="controller" standalone="true" />
<action name="procCommunicationDeleteFriendGroup" type="controller" standalone="true" />
<action name="procCommunicationAddFriendGroup" type="controller" standalone="true" ruleset="addFriendGroup" />
<action name="procCommunicationRenameFriendGroup" type="controller" standalone="true" />
<action name="procCommunicationDeleteFriendGroup" type="controller" standalone="true" />
<action name="getCommunicationAdminColorset" type="model" standalone="true" />
<action name="procCommunicationAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
<action name="dispCommunicationAdminConfig" type="view" standalone="true" admin_index="true" />
</actions>
<action name="getCommunicationAdminColorset" type="model" standalone="true" />
<action name="procCommunicationAdminInsertConfig" type="controller" standalone="true" ruleset="insertConfig" />
<action name="dispCommunicationAdminConfig" type="view" standalone="true" admin_index="true" />
</actions>
</module>

View file

@ -11,7 +11,7 @@
<value xml:lang="vi"><![CDATA[Thông báo]]></value>
</item>
<item name="about_communication">
<value xml:lang="ko"><![CDATA[회원 간의 쪽지나 친구 관리 등 커뮤니케이션 기능을 수행하는 모듈입니다.]]></value>
<value xml:lang="ko"><![CDATA[회원 간의 쪽지나 친구 관리 등 커뮤니케이션 기능을 수행하는 모듈입니다.<br />이 기능을 사용하려면 [설치된 애드온] > [커뮤니케이션] 애드온을 활성화 하세요.]]></value>
<value xml:lang="en"><![CDATA[This module is used for communication between members, such as exchanging messages or mamaging friends.]]></value>
<value xml:lang="jp"><![CDATA[会員間でメッセージや友達管理などコミュニティ機能を提供するモジュールです。]]></value>
<value xml:lang="zh-CN"><![CDATA[管理在线会员间短信息及好友功能的模块。]]></value>
@ -217,6 +217,18 @@
<value xml:lang="tr"><![CDATA[Arkadaş Ekle]]></value>
<value xml:lang="vi"><![CDATA[Thêm bạn]]></value>
</item>
<item name="cmd_message_box">
<value xml:lang="ko"><![CDATA[쪽지함]]></value>
<value xml:lang="en"><![CDATA[Message Box]]></value>
<value xml:lang="jp"><![CDATA[メッセージ]]></value>
<value xml:lang="zh-CN"><![CDATA[短信箱]]></value>
<value xml:lang="zh-TW"><![CDATA[短訊箱]]></value>
<value xml:lang="fr"><![CDATA[Lire des Messages]]></value>
<value xml:lang="ru"><![CDATA[Личные сообщений]]></value>
<value xml:lang="es"><![CDATA[Buzón de mensajes]]></value>
<value xml:lang="tr"><![CDATA[Mesaj Kutusu]]></value>
<value xml:lang="vi"><![CDATA[Hộp tin nhắn]]></value>
</item>
<item name="cmd_view_message_box">
<value xml:lang="ko"><![CDATA[쪽지함 보기]]></value>
<value xml:lang="en"><![CDATA[Message Box]]></value>

View file

@ -33,7 +33,7 @@ input[type=radio]{width:13px;height:13px;margin:0;padding:0}
.hx a{color:#000}
.hx .ex{font-size:12px}
.hx .tg{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;padding:0;overflow:visible;border:0;cursor:pointer;opacity:0;background:none}
.hx .ca{font-size:12px;text-decoration:underline;color:#333}
.hx .ca{font-size:12px;text-decoration:underline;color:#333;margin-left:10px}
.hx .ca:after{content:"";display:inline-block;position:relative;left:4px;width:0;height:0;border:4px solid;border-color:transparent;border-left-color:#8d7de1;margin:0 -8px 0 0}
.hx .write{position:absolute;top:8px;right:10px;background-position:0 0;display:inline-block;width:28px;height:27px;font-size:0;overflow:hidden;text-indent:-28px}
/* Global Navigation */
@ -104,6 +104,7 @@ input[type=radio]{width:13px;height:13px;margin:0;padding:0}
.ff label+input[type=text],
.ff label+input[type=password],
.ff label+textarea{padding:5px}
.ff .memberInfo{padding:5px 5px 5px 28px;background:url(../img/member.png) no-repeat 0px center;}
/* Button Area */
.bna{text-align:center;padding:0 10px;margin:10px 0;zoom:1}
.bna:after{content:"";display:block;clear:both}
@ -112,7 +113,7 @@ input[type=radio]{width:13px;height:13px;margin:0;padding:0}
.bn[type=button]{height:28px}
.bn[href]{height:26px}
.bn.dark{border-color:#666;background:#777 -webkit-gradient(linear,0% 0%,0% 100%,from(#7e7c78),to(#5c5b58));background:#777 -moz-linear-gradient(top,#7e7c78,#5c5b58);background-color:#777;color:#fff;box-shadow:0 0 1px #fff inset;-moz-box-shadow:0 0 1px #fff inset;-webkit-box-shadow:0 0 1px #fff inset}
.bn.white{border-color:#b5b5b5;background:#1b1b1b -webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#f6f6f6),color-stop(0.5,#f0f0f0),color-stop(0.5,#e4e4e4));background:#1b1b1b -moz-linear-gradient(top,#fff,#e4e4e4);background-color:#fff;color:#000}
.bn.white{border-color:#b5b5b5;background:#1b1b1b -webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#f6f6f6),color-stop(0.5,#f0f0f0),color-stop(0.5,#e4e4e4));background:#1b1b1b -moz-linear-gradient(top,#fff,#e4e4e4);background-color:#fff;color:#000;margin-right:2px}
/* Pagination */
.pn{font-size:12px;text-align:center;background:#f2f0ec;padding:15px 0;border-top:1px solid #fff}
.pn a{color:#333;text-decoration:none}

View file

@ -0,0 +1,22 @@
/* 개별 쪽지 삭제 */
function doDeleteMessage(message_srl) {
if(!message_srl) return;
if(!confirm(confirm_delete_msg)) return;
var params = new Array();
params['message_srl'] = message_srl;
exec_xml('communication', 'procCommunicationDeleteMessage', params, completeDeleteMessage);
}
function completeDeleteMessage(ret_obj) {
alert(ret_obj['message']);
location.href = current_url.setQuery('message_srl','');
}
function mergeContents()
{
var $form = jQuery('#fo_comm');
var content = $form.find('textarea[name=new_content]').val() + $form.find('input[name=source_content]').val();
$form.find('input[name=content]').val(content);
$form.submit();
}

View file

@ -0,0 +1,11 @@
<load target="./css/mcommunication.css" />
<div class="bd">
<div class="hx h2">
<h2>{$lang->cmd_message_box}</h2>
</div>
<ul class="gn">
<li loop="$lang->message_box=>$key,$val">
<a href="{getUrl('act','dispCommunicationMessages','message_type',$key)}">{$lang->message_box[$key]}</a>
</li>
</ul>
</div>

View file

@ -1,7 +1,6 @@
<load target="css/mcommunication.css" />
<div class="bd">
<div class="hx h2">
<h2>{$lang->message_box['R']}</h2>
<h2>{$lang->message_box[$message_type]}<a href="{getUrl('page','','act','dispCommunicationMessageBoxList','')}" class="ca">{$lang->cmd_message_box}</a></h2>
</div>
<ul class="lt">
<li loop="$message_list => $no,$val" class="read"|cond="$val->readed == 'Y'" class="unread"|cond="$val->readed != 'Y'">
@ -14,4 +13,3 @@
<strong>{$page} / {$page_navigation->last_page}</strong>
<a cond="$page != $page_navigation->last_page" href="{getUrl('page',$page+1,'document_srl','')}" class="next">{$lang->cmd_next}</a>
</div>
</div>

View file

@ -1,12 +1,19 @@
{@ Context::addJsFile("./common/js/jquery.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/xe.min.js", true, '', -100000) }
<load target="css/mcommunication.css" />
<load target="./js/communication.js" />
<div class="hx h2">
<h2>{$message->title}</h2><span class="ex">{$message->nick_name} | {zdate($message->regdate, "Y.m.d H:i")}</span>
</div>
<div class="co">
<div class="xe_content">{$message->content}</div>
<div class="xe_content">{$message->content}</div>
</div>
<div class="bna">
<span class="fl"><a href="{getUrl('message_srl', '')}" class="bn white">{$lang->cmd_list}</a></span>
<span class="fr"><a href="#" onClick="doDeleteMessage('{$message->message_srl}');" class="bn white">{$lang->cmd_delete}</a></span>
<span class="fr" cond="$message->sender_srl != $logged_info->member_srl"><a href="{getUrl('act','dispCommunicationSendMessage','receiver_srl',$message->sender_srl,'message_srl',$message->message_srl)}" class="bn white">{$lang->cmd_reply_message}</a></span>
</div>
<script>
var confirm_delete_msg = "{$lang->confirm_delete}";
</script>

View file

@ -0,0 +1,44 @@
{@ Context::addJsFile("./common/js/jquery.min.js", true, '', -100000) }
{@ Context::addJsFile("./common/js/xe.min.js", true, '', -100000) }
<load target="./css/mcommunication.css" />
<load target="js/communication.js" />
<div class="hx h2">
<h2>{$lang->cmd_send_message}</h2>
</div>
<div cond="$XE_VALIDATOR_MESSAGE" class="x_alert x_alert-{$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="sendMessage" action="./" method="post" class="ff" id="fo_comm">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="is_popup" value="Y" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="source_content" value="{htmlspecialchars($source_message->content)}" />
<input type="hidden" name="content" value="" />
<ul>
<li>
<span class="memberInfo">{$receiver_info->nick_name}</span>
</li>
<li>
<label for="message_title">{$lang->title}</label>
<input type="text" name="title" id="message_title" value="{$source_message->title}"/>
</li>
<li class="xe_content">
{$source_message->content}
</li>
<li>
<label for="message_content">{$lang->content}</label>
<textarea id="message_content" name="new_content" rows="8" style="width:100%"></textarea>
</li>
<li>
<span id="message_send_mail"><input type="checkbox" value="Y" name="send_mail" /> {$lang->cmd_send_mail}</span>
</li>
</ul>
<div class="bna">
<span class="fl"><a href="{getUrl('act', 'dispCommunicationMessages')}" class="bn white">{$lang->cmd_back}</a></span>
<span class="fr"><button type="button" class="bn white" onClick="mergeContents();">{$lang->cmd_send_message}</button></span>
</div>
</form>