커뮤니케이션 맴버 모듈을 삭제하고, 커뮤니케이션 모듈을 생성 (기본값 사용함)

This commit is contained in:
qw5414 2016-02-13 09:28:07 +09:00
parent 4aaac39ad8
commit 29044a98bf
27 changed files with 176 additions and 229 deletions

View file

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon version="0.2">
<title xml:lang="ko">커뮤니케이션</title>
<title xml:lang="jp">コミュニケーション</title>
<title xml:lang="zh-CN">会员交流</title>
<title xml:lang="en">Communication</title>
<title xml:lang="vi">Truyền thông</title>
<title xml:lang="ge">커뮤니케이션</title>
<title xml:lang="es">커뮤니케이션</title>
<title xml:lang="ru">Общение</title>
<title xml:lang="zh-TW">交流</title>
<description xml:lang="ko">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="jp">
メッセージ・友達機能を使うにはこのアドオンを「使用」にして下さい。
</description>
<description xml:lang="zh-CN">
此插件可激活短信箱及添加好友功能。
</description>
<description xml:lang="en">
This addon enables the communication module in order to use messaging or friend functions.
Please enable this addon in case you want to use those functions.
</description>
<description xml:lang="vi">
Addon này cho phép sử dụng Module truyền thông để sử dụng tin nhắn hay chức năng bạn bè.
Hãy kích hoạt nếu bạn muốn sử dụng chức năng này.
</description>
<description xml:lang="ge">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="es">
커뮤니케이션 기능을 활성화 시켜 쪽지나 친구기능을 사용할 수 있도록 해줍니다.
쪽지, 친구기능등을 사용하기 위해서는 이 애드온을 사용으로 설정하면 됩니다.
</description>
<description xml:lang="ru">
Активизирует модуль Общение, позволяет использование сообщений между друзьями.
</description>
<description xml:lang="zh-TW">
讓會員擁有短訊和新增好友功能。
</description>
<version>1.7</version>
<date>2013-11-27</date>
<author email_address="developers@xpressengine.com" link="http://xpressengine.com/">
<name xml:lang="ko">NAVER</name>
<name xml:lang="jp">NAVER</name>
<name xml:lang="zh-CN">NAVER</name>
<name xml:lang="en">NAVER</name>
<name xml:lang="vi">NAVER</name>
<name xml:lang="ge">NAVER</name>
<name xml:lang="es">NAVER</name>
<name xml:lang="ru">NAVER</name>
<name xml:lang="zh-TW">NAVER</name>
</author>
<extra_vars>
<var name="use_alarm" type="select">
<title xml:lang="ko">알람기능 사용</title>
<title xml:lang="zh-CN">Using alarm</title>
<title xml:lang="jp">Using alarm</title>
<title xml:lang="zh-TW">Using alarm</title>
<title xml:lang="en">Using alarm</title>
<title xml:lang="ru">Using alarm</title>
<title xml:lang="vi">Using alarm</title>
<description xml:lang="ko">새로운 쪽지가 왔을때 팝업으로 알립니다.</description>
<description xml:lang="zh-CN">Pop-up alram when new message received.</description>
<description xml:lang="jp">Pop-up alram when new message received.</description>
<description xml:lang="zh-TW">Pop-up alram when new message received.</description>
<description xml:lang="en">Pop-up alram when new message received.</description>
<description xml:lang="ru">Pop-up alram when new message received.</description>
<description xml:lang="vi">Pop-up alram when new message received.</description>
<options value="">
<title xml:lang="ko">사용함</title>
<title xml:lang="zh-CN">Using</title>
<title xml:lang="jp">Using</title>
<title xml:lang="zh-TW">Using</title>
<title xml:lang="en">Using</title>
<title xml:lang="ru">Using</title>
<title xml:lang="vi">Using</title>
</options>
<options value="N">
<title xml:lang="ko">사용하지 않음</title>
<title xml:lang="zh-CN">Not using</title>
<title xml:lang="jp">Not using</title>
<title xml:lang="zh-TW">Not using</title>
<title xml:lang="en">Not using</title>
<title xml:lang="ru">Not using</title>
<title xml:lang="vi">Not using</title>
</options>
</var>
</extra_vars>
</addon>

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'У Вас новые сообщения. Проверите сейчас?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = 'Bạn có một tin nhắn mới. bạn có muốn kiểm tra ngay bây giờ không?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '您有新消息。要确认吗?';

View file

@ -1,2 +0,0 @@
<?php
$lang->alert_new_message_arrived = '您收到 %d 個新訊息。要檢視嗎?';

View file

@ -1,85 +0,0 @@
<?php
/* Copyright (C) NAVER <http://www.navercorp.com> */
if(!defined('__XE__'))
exit();
/**
* @file member_communication.addon.php
* @author NAVER (developers@xpressengine.com)
* @brief Promote user communication
*
* - Pop-up the message if new message comes in
* - When calling MemberModel::getMemberMenu, feature to send a message is added
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
*/
// Stop if non-logged-in user is
if(!Context::get('is_logged') || isCrawler())
{
return;
}
$logged_info = Context::get('logged_info');
/**
* Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
* */
if($this->module != 'member' && $called_position == 'before_module_init')
{
// Load a language file from the communication module
Context::loadLang(_XE_PATH_ . 'modules/communication/lang');
// Add menus on the member login information
$oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
$flag_file = _XE_PATH_ . 'files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl;
if($addon_info->use_alarm != 'N' && file_exists($flag_file))
{
// Pop-up to display messages if a flag on new message is set
$new_message_count = (int) trim(FileHandler::readFile($flag_file));
FileHandler::removeFile($flag_file);
Context::loadLang(_XE_PATH_ . 'addons/member_communication/lang');
Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true);
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
Context::addHtmlFooter("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
}
}
elseif($this->act == 'getMemberMenu' && $called_position == 'before_module_proc')
{
$member_srl = Context::get('target_srl');
$oCommunicationModel = getModel('communication');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl)
{
$mid = Context::get('cur_mid');
$oMemberController = getController('member');
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
}
else
{
// Get member information
$oMemberModel = getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl)
{
return;
}
$oMemberController = getController('member');
// Add a menu for sending message
if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
}
}
/* End of file member_communication.addon.php */
/* Location: ./addons/member_communication/member_communication.addon.php */

View file

@ -1,26 +0,0 @@
(function($){
window.xeNotifyMessage = function(text, count){
var $bar;
$bar = $('div.message.info');
if(!$bar.length) {
$bar = $('<div class="message info" />')
.hide()
.css({
'position' : 'absolute',
'z-index' : '100',
})
.prependTo(document.body);
}
text = text.replace('%d', count);
var cur_module = current_url.getQuery('module');
if( cur_module == "admin" )
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'" target="_blank">'+text+'</a></p>').height();
else
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'">'+text+'</a></p>').height();
$bar.show().animate({top:0});
// hide after 10 seconds
setTimeout(function(){
$bar.slideUp();
}, 5000);
};
})(jQuery);

View file

@ -24,7 +24,7 @@ class communicationAdminController extends communication
function procCommunicationAdminInsertConfig()
{
// get the default information
$args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group');
$args = Context::gets('skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group', 'member_menu');
$args->editor_colorset = $args->sel_editor_colorset;
unset($args->sel_editor_colorset);

View file

@ -66,7 +66,6 @@ class communicationAdminView extends communication
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('index');
}
}
/* End of file communication.admin.view.php */
/* Location: ./modules/comment/communication.admin.view.php */

View file

@ -8,13 +8,21 @@
*/
class communication extends ModuleObject
{
private $triggers = array(
array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerAfter', 'after')
);
/**
* Implement if additional tasks are necessary when installing
* @return Object
*/
function moduleInstall()
{
$oModuleController = getController('module');
foreach($this->triggers as $trigger)
{
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
}
// Create a temporary file storage for one new private message notification
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
return new Object();
@ -46,6 +54,15 @@ class communication extends ModuleObject
}
}
}
$oModuleModel = getModel('module');
foreach($this->triggers as $trigger)
{
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
{
return TRUE;
}
}
return FALSE;
}
@ -61,6 +78,14 @@ class communication extends ModuleObject
}
$oModuleModel = getModel('module');
$oModuleController = getController('module');
foreach($this->triggers as $trigger)
{
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
{
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
}
}
$config = $oModuleModel->getModuleConfig('message');
if(!is_object($config))
{
@ -76,7 +101,6 @@ class communication extends ModuleObject
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = getController('module');
$oModuleController->updateModuleConfig('communication', $config);
}
}

View file

@ -14,7 +14,6 @@ class communicationController extends communication
*/
function init()
{
}
/**
@ -778,6 +777,77 @@ class communicationController extends communication
return executeQuery('communication.setMessageReaded', $args);
}
function triggerModuleHandlerAfter($module)
{
if(!Context::get('is_logged') && isCrawler())
{
return new Object();
}
$oCommunicationModel = getModel('communication');
$config = $oCommunicationModel->getConfig();
if($config->member_menu != 'Y')
{
return new Object();
}
$act = Context::get('act');
$logged_info = Context::get('logged_info');
if($module->module != 'member')
{
$oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// Pop-up to display messages if a flag on new message is set
$new_message_count = $oCommunicationModel->getNewMessageCount();
if($new_message_count > 0)
{
Context::loadFile('./modules/communication/tpl/js/member_communication.js');
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
Context::addHtmlHeader("<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
}
}
elseif($act == 'getMemberMenu')
{
$member_srl = Context::get('target_srl');
$oCommunicationModel = getModel('communication');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl)
{
$mid = Context::get('cur_mid');
$oMemberController = getController('member');
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
}
else
{
// Get member information
$oMemberModel = getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl)
{
return new Object();
}
$oMemberController = getController('member');
// Add a menu for sending message
if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
}
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
}
}
}
}
}
/* End of file communication.controller.php */
/* Location: ./modules/comment/communication.controller.php */

View file

@ -51,10 +51,15 @@ class communicationModel extends communication
{
$communication_config->mskin = 'default';
}
if(!$communication_config->grant_write)
{
$communication_config->grant_write = array('default_grant'=>'member');
$communication_config->grant_write = array('default_grant' => 'member');
}
if(!$communication_config->member_menu)
{
$communication_config->member_menu = 'Y';
}
return $communication_config;
@ -228,6 +233,22 @@ class communicationModel extends communication
return $message;
}
function getNewMessageCount($member_srl)
{
if(!$member_srl)
{
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
}
$args = new stdClass();
$args->receiver_srl = $member_srl;
$args->readed = 'N';
$output = executeQuery('communication.getNewMessageCount', $args);
return $output->data->count;
}
/**
* get a message list
* @param string $message_type (R: Received Message, S: Sent Message, T: Archive)

View file

@ -34,3 +34,4 @@ $lang->message_notice = 'Send a message to the author about this. If you don\'t
$lang->friends_page_does_not_support = 'Friends in a mobile environment is not supported. Please go to the PC page.';
$lang->cmd_write_communication = 'Write Grant';
$lang->cmd_manage_base = 'Basic infomation';
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';

View file

@ -28,3 +28,4 @@ $lang->msg_content_is_null = 'Por favor ingresar el contenido';
$lang->msg_allow_message_to_friend = 'Falló el envío por permitir sólo mensajes de sus amigos';
$lang->msg_disallow_message = 'Falló el envío por ser usuario rechazado para recibir mensajes';
$lang->about_allow_message = 'Usted puede decidir la recepción del mensaje';
$lang->alert_new_message_arrived = 'Usted tiene un nuevo mensaje. Quiere comprobar ahora?';

View file

@ -32,3 +32,4 @@ $lang->msg_disallow_message = 'メッセージの受信を拒否している受
$lang->about_allow_message = 'メッセージを受信するか設定します。';
$lang->message_notice = '作成者にメッセージを送信し、知らせます。作成しなければ送信されません。';
$lang->friends_page_does_not_support = 'モバイル環境では友達リストページをサポートしません。PC画面へ移動してください。';
$lang->alert_new_message_arrived = '%d件の新しいメッセージがあります。確認しますか';

View file

@ -34,3 +34,4 @@ $lang->message_notice = '저작자에게 쪽지를 발송해서 이 사실을
$lang->friends_page_does_not_support = '모바일 환경에서는 친구 보기 페이지를 지원하지 않습니다. PC 화면으로 이동하세요.';
$lang->cmd_write_communication = '작성 권한';
$lang->cmd_manage_base = '기본 정보';
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';

View file

@ -29,3 +29,4 @@ $lang->msg_content_is_null = 'Пожалуйста, введите содерж
$lang->msg_allow_message_to_friend = 'Сообщение не отправлено, поскольку являетесь пользователем, имеющим право посылать сообщения только друзьям';
$lang->msg_disallow_message = 'Сообщение не отправлено, поскольку получатель запретил прием сообщений';
$lang->about_allow_message = 'Вы можете установить режим принятия сообщений';
$lang->alert_new_message_arrived = 'У Вас новые сообщения. Проверите сейчас?';

View file

@ -29,3 +29,4 @@ $lang->msg_content_is_null = 'Xin vui lòng nhập nội dung.';
$lang->msg_allow_message_to_friend = 'Không thể gửi vì người nhận chỉ chấp nhận những tin nhắn từ bạn bè của họ.';
$lang->msg_disallow_message = 'Không thể gửi vì người nhận đã từ chối nhận tin nhắn.';
$lang->about_allow_message = 'Bạn có thể đồng ý nhận tin nhắn.';
$lang->alert_new_message_arrived = 'Bạn có một tin nhắn mới. bạn có muốn kiểm tra ngay bây giờ không?';

View file

@ -29,3 +29,4 @@ $lang->msg_content_is_null = '请输入内容。';
$lang->msg_allow_message_to_friend = '因其为只允许接收好友短消息的用户,所以不能发送短消息。';
$lang->msg_disallow_message = '因其为拒绝接收短消息的用户,所以不能发送短消息。';
$lang->about_allow_message = '可以选择短消息接收与否。';
$lang->alert_new_message_arrived = '您有新消息。要确认吗?';

View file

@ -29,3 +29,4 @@ $lang->msg_content_is_null = '請輸入內容。';
$lang->msg_allow_message_to_friend = '只允許接收好友短訊息的用戶,不能發送短訊息。';
$lang->msg_disallow_message = '拒絕接收短訊息的用戶,不能發送短訊息。';
$lang->about_allow_message = '可選擇是否接收短訊息。';
$lang->alert_new_message_arrived = '您收到 %d 個新訊息。要檢視嗎?';

View file

@ -0,0 +1,15 @@
<query id="getNewMessageCount" action="select">
<tables>
<table name="member_message" alias="message" />
<table name="member" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="message.receiver_srl" var="receiver_srl" notnull="notnull" />
<condition operation="equal" column="message.readed" var="readed" default="N" notnull="notnull" pipe="and" />
<condition operation="equal" column="message.sender_srl" var="member.member_srl" pipe="and" />
<condition operation="equal" column="message.message_type" var="message_type" default="R" pipe="and" />
</conditions>
</query>

View file

@ -99,7 +99,12 @@
</div>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">communication option</label>
<div class="x_controls">
<label class="x_inline" for="member_menu"><input type="checkbox" name="member_menu" id="member_menu" value="Y" checked="checked"|cond="$communication_config->member_menu == 'Y'" /> {$lang->about_mobile_view}</label>
</div>
</div>
<div class="btnArea">
<button class="x_btn x_btn-primary" type="submit">{$lang->cmd_registration}</button>
</div>

View file

@ -0,0 +1,26 @@
(function($){
window.xeNotifyMessage = function(text, count){
var $bar;
$bar = $('div.message.info');
if(!$bar.length) {
$bar = $('<div class="message info" />')
.hide()
.css({
'position' : 'absolute',
'z-index' : '100',
})
.prependTo(document.body);
}
text = text.replace('%d', count);
var cur_module = current_url.getQuery('module');
if( cur_module == "admin" )
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'" target="_blank">'+text+'</a></p>').height();
else
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'">'+text+'</a></p>').height();
$bar.show().animate({top:0});
// hide after 10 seconds
setTimeout(function(){
$bar.slideUp();
}, 5000);
};
})(jQuery);