Communication module mobile support enhancement

쪽지 모듈의 모바일 지원을 향상시켰습니다.
이 PR 이후에 회원 모듈의 모바일 지원을 향상 시키면 XE의 모바일 지원 수준이 한 단계 상승하게 됩니다.
꼭 반영되길 바랍니다!

## 수정 내용

* 커뮤니케이션 애드온의 회원 메뉴 설정 기능을 모듈의 트리거로 처리하여 조금 더 직관적으로 설정하게 됨.
* 기본값은 모듈이 동작 하도록 함.
* 모듈을 켜고 끌 수 있도록 함.
* 모바일에서 친구 추가를 할 수 있게 함.
* 스타일 아주 조금 다듬음.
This commit is contained in:
MinSoo Kim 2015-05-25 02:32:47 +09:00
parent ecce7e5efd
commit e75983768f
14 changed files with 428 additions and 85 deletions

View file

@ -25,13 +25,6 @@ if(!$logged_info|| isCrawler())
* */
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))
{
@ -45,40 +38,5 @@ if($this->module != 'member' && $called_position == 'before_module_init')
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

@ -23,8 +23,22 @@ class communicationAdminController extends communication
*/
function procCommunicationAdminInsertConfig()
{
// Get the configuration information
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('communication');
// 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('able_module', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_write_default','grant_write_group');
//if module IO config is off
if($args->able_module === 'Y')
{
// Re-install triggers, if it was disabled.
if($config->able_module == 'N')
{
$this->moduleUpdate();
}
$args->editor_colorset = $args->sel_editor_colorset;
unset($args->sel_editor_colorset);
@ -57,6 +71,17 @@ class communicationAdminController extends communication
$args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group);
unset($args->grant_write_default);
unset($args->grant_write_group);
}
else
{
//module IO config is OFF, Other settings will not be modified.
$config->able_module = 'N';
$args = $config;
// Delete Triggers
$oModuleController = getController('module');
$oModuleController->deleteModuleTriggers('communication');
}
// create the module module Controller object
$oModuleController = getController('module');

View file

@ -8,6 +8,10 @@
*/
class communication extends ModuleObject
{
var $triggers = array(
array('member.getMemberMenu', 'communication', 'controller', 'triggerBeforeMemberPopupMenu', 'before'),
array('moduleHandler.init', 'communication', 'controller', 'triggerAddMemberMenu', 'after')
);
/**
* Implement if additional tasks are necessary when installing
@ -15,8 +19,32 @@ class communication extends ModuleObject
*/
function moduleInstall()
{
$oModuleModel = getModel('module');
$oModuleController = getController('module');
// Create triggers
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]);
}
}
// Create a temporary file storage for one new private message notification
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
// Save Default Config.
$config = new stdClass;
$config->able_module = 'Y';
$config->skin = 'default';
$config->colorset = 'white';
$config->editor_skin = 'default';
$communication_config->mskin = 'default';
$communication_config->grant_write = array('default_grant'=>'member');
// Save configurations
$oModuleController->insertModuleConfig('communication', $config);
return new Object();
}
@ -32,6 +60,7 @@ class communication extends ModuleObject
}
$oModuleModel = getModel('module');
$oModuleController = getController('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
@ -46,6 +75,13 @@ class communication extends ModuleObject
}
}
}
// Create triggers
foreach($this->triggers as $trigger)
{
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return true;
}
return FALSE;
}
@ -61,6 +97,7 @@ class communication extends ModuleObject
}
$oModuleModel = getModel('module');
$oModuleController = getController('module');
$config = $oModuleModel->getModuleConfig('message');
if(!is_object($config))
{
@ -82,6 +119,15 @@ class communication extends ModuleObject
}
}
// Create triggers
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]);
}
}
return new Object(0, 'success_updated');
}
@ -91,9 +137,19 @@ class communication extends ModuleObject
*/
function recompileCache()
{
}
function moduleUninstall()
{
$oModuleController = getController('module');
foreach($this->triggers as $trigger)
{
$oModuleController->deleteTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
}
return new Object();
}
}
/* End of file communication.class.php */
/* Location: ./modules/comment/communication.class.php */

View file

@ -775,6 +775,81 @@ class communicationController extends communication
return executeQuery('communication.setMessageReaded', $args);
}
/**
* Create communication module menu on the member menu
* @param int $message_srl
* @return Object
*/
public function triggerAddMemberMenu()
{
// Stop if non-logged-in user is
$logged_info = Context::get('logged_info');
if(!$logged_info|| isCrawler())
{
return new Object();
}
$oCommunicationModel = getModel('communication');
$config = $oCommunicationModel->getConfig();
if($config->able_module === 'Y')
{
$oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
}
return new Object();
}
/**
* Create communication module menu on the member popup menu
* @param int $message_srl
* @return Object
*/
public function triggerBeforeMemberPopupMenu()
{
// Stop if non-logged-in user is
$logged_info = Context::get('logged_info');
if(!$logged_info|| isCrawler())
{
return;
}
$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 communication.controller.php */
/* Location: ./modules/comment/communication.controller.php */

View file

@ -182,6 +182,73 @@ class communicationMobile extends communicationView
$this->setTemplateFile('send_message');
}
/**
* display Add a friend
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationAddFriend()
{
// error appears if not logged-in
if(!Context::get('is_logged'))
{
return $this->stop('msg_not_logged');
}
$logged_info = Context::get('logged_info');
$target_srl = Context::get('target_srl');
if(!$target_srl)
{
return $this->stop('msg_invalid_request');
}
// get information of the member
$oMemberModel = getModel('member');
$oCommunicationModel = getModel('communication');
$communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl);
if($communication_info->member_srl != $target_srl)
{
return $this->stop('msg_invalid_request');
}
Context::set('target_info', $communication_info);
// get a group list
$friend_group_list = $oCommunicationModel->getFriendGroups();
Context::set('friend_group_list', $friend_group_list);
$this->setTemplateFile('add_friend');
}
/**
* display add a group of friends
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationAddFriendGroup()
{
// error apprears if not logged-in
if(!Context::get('is_logged'))
{
return $this->stop('msg_not_logged');
}
$logged_info = Context::get('logged_info');
// change to edit mode when getting the group_srl
$friend_group_srl = Context::get('friend_group_srl');
if($friend_group_srl)
{
$oCommunicationModel = getModel('communication');
$friend_group = $oCommunicationModel->getFriendGroupInfo($friend_group_srl);
if($friend_group->friend_group_srl == $friend_group_srl)
{
Context::set('friend_group', $friend_group);
}
}
$this->setTemplateFile('add_friend_group');
}
}
/* End of file communication.mobile.php */
/* Location: ./modules/comment/communication.mobile.php */

View file

@ -57,6 +57,10 @@ class communicationModel extends communication
$communication_config->grant_write = array('default_grant'=>'member');
}
if(!$communication_config->able_module)
{
$communication_config->able_module = 'Y';
}
return $communication_config;
}

View file

@ -10,6 +10,28 @@
<value xml:lang="tr"><![CDATA[İletişim]]></value>
<value xml:lang="vi"><![CDATA[Thông báo]]></value>
</item>
<item name="communication_io">
<value xml:lang="ko"><![CDATA[커뮤니케이션 모듈 켜기]]></value>
<value xml:lang="en"><![CDATA[Communication module On]]></value>
<value xml:lang="jp"><![CDATA[Communication module On]]></value>
<value xml:lang="zh-CN"><![CDATA[Communication module On]]></value>
<value xml:lang="zh-TW"><![CDATA[Communication module On]]></value>
<value xml:lang="ru"><![CDATA[Communication module On]]></value>
<value xml:lang="es"><![CDATA[Communication module On]]></value>
<value xml:lang="tr"><![CDATA[Communication module On]]></value>
<value xml:lang="vi"><![CDATA[Communication module On]]></value>
</item>
<item name="about_communication_io">
<value xml:lang="ko"><![CDATA[체크 하면 커뮤니케이션 모듈 기능을 켤 수 있습니다. 커뮤니케이션 모듈 기능을 끌 경우, 커뮤니케이션 모듈의 모든 트리거가 삭제됩니다. 커뮤니케이션 기록은 유지되지만 새로 기록 되지는 않습니다.]]></value>
<value xml:lang="en"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="jp"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="zh-CN"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="zh-TW"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="ru"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="es"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="tr"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
<value xml:lang="vi"><![CDATA[Communication module can be on or off. If you OFF this module, every triggers will be deleted from database and will not be called by XE Core. Communication record would be preserved.]]></value>
</item>
<item name="about_communication">
<value xml:lang="ko"><![CDATA[회원 간의 쪽지나 친구 관리 등 커뮤니케이션 기능을 수행합니다. 이 기능을 사용하려면 [설치된 애드온] &gt; [커뮤니케이션] 애드온을 활성화 하세요.]]></value>
<value xml:lang="en"><![CDATA[This module is used for communication between members, such as exchanging messages or mamaging friends.]]></value>

View file

@ -0,0 +1,31 @@
<load target="./css/mcommunication.css" />
<load target="./js/communication.js" />
<div class="hx h2">
<h2>{$lang->cmd_add_friend}</h2>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/m.skins/default/add_friend/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="addFriend" action="./" method="post" class="ff">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationAddFriend" />
<input type="hidden" name="target_srl" value="{$target_info->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/m.skins/default/add_friend/1" />
<ul>
<li>
<label for="nickname" class="control-label">{$lang->nick_name}</label>
<input id="nickname" name="nickname" type="text" disabled="disabled" value="{htmlspecialchars($target_info->nick_name, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}"/>
</li>
<li>
<label for="friend_group_srl">{$lang->friend_group}</label>
<select name="friend_group_srl" id="friend_group_srl">
<option value="">{$lang->default_friend_group}</option>
<option loop="$friend_group_list => $key,$val" value="{$val->friend_group_srl}">{$val->title}</option>
</select>
<a href="{getUrl('act','dispCommunicationAddFriendGroup')}" class="btn" onclick="popopen(this.href);return false;">{$lang->cmd_add_friend_group}</a>
</li>
</ul>
<div class="bna" style="border-top:0;padding:0">
<input type="submit" value="{$lang->cmd_add_friend}" class="btn btn-inverse" />
</div>
</form>

View file

@ -0,0 +1,30 @@
<load target="./css/mcommunication.css" />
<load target="./js/communication.js" />
<div class="hx h2">
<h2>
<!--@if($friend_group->friend_group_srl)-->
{$lang->cmd_rename_friend_group}
<!--@else-->
{$lang->cmd_add_friend_group}
<!--@end-->
</h2>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/default/add_friend_group/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="addFriendGroup" action="./" method="post" class="ff">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationAddFriendGroup" />
<input type="hidden" name="friend_group_srl" value="{$friend_group->friend_group_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/add_friend_group/1" />
<ul>
<li>
<label for="title" class="control-label">{$lang->msg_insert_group_name}</label>
<input name="title" id="title" type="text" value="{htmlspecialchars($friend_group->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}"/>
</li>
</ul>
<div class="bna">
<input cond="$friend_group->friend_group_srl" type="submit" value="{$lang->cmd_modify}" class="btn btn-inverse" />
<input cond="!$friend_group->friend_group_srl" type="submit" value="{$lang->cmd_insert}" class="btn btn-inverse" />
</div>
</form>

View file

@ -100,7 +100,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,
.ff label+select{display:block;width:96%;font-size:14px;margin:0 0 5px 0}
.ff label+select{display:block;box-sizing:border-box;width:100%;font-size:14px;margin:0 0 5px 0}
.ff label+input[type=text],
.ff label+input[type=password],
.ff label+textarea{padding:5px}

View file

@ -20,3 +20,50 @@ function mergeContents()
$form.find('input[name=content]').val(content);
$form.submit();
}
/* 친구 그룹 삭제 */
function doDeleteFriendGroup() {
var friend_group_srl = jQuery('#friend_group_list option:selected').val();
if(!friend_group_srl) return;
var fo_obj = jQuery('#for_delete_group').get(0);
fo_obj.friend_group_srl.value = friend_group_srl;
procFilter(fo_obj, delete_friend_group);
}
function completeDeleteFriendGroup(ret_obj) {
alert(ret_obj['message']);
location.href = current_url.setQuery('friend_group_srl','');
}
/* 친구 그룹의 이름 변경 */
function doRenameFriendGroup() {
var friend_group_srl = jQuery('#friend_group_list option:selected').val();
if(!friend_group_srl) return;
popopen("./?module=communication&act=dispCommunicationAddFriendGroup&friend_group_srl="+friend_group_srl);
}
/* 친구 그룹 이동 */
function doMoveFriend() {
var fo_obj = jQuery('#fo_friend_list').get(0);
procFilter(fo_obj, move_friend);
}
/* 친구 그룹 선택 */
function doJumpFriendGroup() {
var sel_val = jQuery('#jumpMenu option:selected').val();
location.href = current_url.setQuery('friend_group_srl', sel_val);
}
jQuery(function($){
$('.__submit_group button[type=submit]').click(function(e){
var sel_val = $('input[name="friend_srl_list[]"]:checked').length;
if(sel_val == 0)
{
e.preventDefault();
return false;
}
});
});

View file

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="module" required="true" rule="alpha" />
<field name="act" required="true" rule="alpha" />
<field name="target_srl" required="true" rule="number" />
<field name="friend_group_srl" required="false" rule="number" />
</fields>
</ruleset>

View file

@ -3,6 +3,9 @@
<customrules>
</customrules>
<fields>
<field name="module" required="true" rule="alpha" />
<field name="act" required="true" rule="alpha" />
<field name="friend_group_srl" required="false" rule="number" />
<field name="title" required="true" length="1:240"/>
</fields>
</ruleset>

View file

@ -15,11 +15,18 @@
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="insertConfig" action="./" method="post" class="x_form-horizontal">
<form ruleset="insertConfig" action="./" method="post" class="x_form-horizontal" id="communication_module_config_form">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationAdminInsertConfig">
<input type="hidden" name="xe_validator_id" value="modules/communication/tpl/index/1" />
<div class="x_control-group module_io">
<label for="able_module" class="x_control-label">{$lang->communication_io}</label>
<div class="x_controls" style="padding-top:3px">
<input type="checkbox" name="able_module" id="able_module" value="Y" checked="checked"|cond="!$communication_config->able_module||$communication_config->able_module=='Y'" />
<span class="x_help-inline">{$lang->about_communication_io}</span>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="editor_skin">{$lang->editor_skin}</label>
<div class="x_controls">
@ -111,4 +118,18 @@
jQuery('.grant_default').change( function(event) { doShowGrantZone(); } );
doShowGrantZone()
});
jQuery(function($){
var communication_module_cfg = $('#communication_module_config_form .x_control-group:not(.module_io)');
if(!$('#able_module').is(':checked'))
{
communication_module_cfg.hide();
}
$('#able_module').change(function(){
if($(this).is(':checked')){
communication_module_cfg.slideDown(200);
} else {
communication_module_cfg.slideUp(200);
}
});
});
</script>