diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php index 4b2373e84..8986d8b59 100644 --- a/addons/member_communication/member_communication.addon.php +++ b/addons/member_communication/member_communication.addon.php @@ -25,6 +25,13 @@ 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)) { @@ -38,5 +45,40 @@ if($this->module != 'member' && $called_position == 'before_module_init') Context::addHtmlFooter(""); } } +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 */ diff --git a/modules/communication/communication.admin.controller.php b/modules/communication/communication.admin.controller.php index 25364e145..1f9e8b028 100644 --- a/modules/communication/communication.admin.controller.php +++ b/modules/communication/communication.admin.controller.php @@ -23,66 +23,41 @@ class communicationAdminController extends communication */ function procCommunicationAdminInsertConfig() { - // Get the configuration information - $oModuleModel = getModel('module'); - $config = $oModuleModel->getModuleConfig('communication'); - // get the default information - $args = Context::gets('able_module', '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'); + $args->editor_colorset = $args->sel_editor_colorset; + unset($args->sel_editor_colorset); - //if module IO config is on - if($args->able_module === 'Y') + if(!$args->skin) { - // 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); - - if(!$args->skin) - { - $args->skin = 'default'; - } - - if(!$args->colorset) - { - $args->colorset = 'white'; - } - - if(!$args->editor_skin) - { - $args->editor_skin = 'default'; - } - - if(!$args->mskin) - { - $args->mskin = 'default'; - } - - if(!$args->layout_srl) - { - $args->layout_srl = NULL; - } - - $oCommunicationModel = getModel('communication'); - $args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group); - unset($args->grant_write_default); - unset($args->grant_write_group); + $args->skin = 'default'; } - else + + if(!$args->colorset) { - //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'); + $args->colorset = 'white'; } + if(!$args->editor_skin) + { + $args->editor_skin = 'default'; + } + + if(!$args->mskin) + { + $args->mskin = 'default'; + } + + if(!$args->layout_srl) + { + $args->layout_srl = NULL; + } + + $oCommunicationModel = getModel('communication'); + $args->grant_write = $oCommunicationModel->getGrantArray($args->grant_write_default, $args->grant_write_group); + unset($args->grant_write_default); + unset($args->grant_write_group); + // create the module module Controller object $oModuleController = getController('module'); $output = $oModuleController->insertModuleConfig('communication', $args); diff --git a/modules/communication/communication.class.php b/modules/communication/communication.class.php index 760bb75ef..155fd6413 100644 --- a/modules/communication/communication.class.php +++ b/modules/communication/communication.class.php @@ -8,10 +8,6 @@ */ 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 @@ -19,32 +15,8 @@ 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(); } @@ -60,7 +32,6 @@ class communication extends ModuleObject } $oModuleModel = getModel('module'); - $oModuleController = getController('module'); $config = $oModuleModel->getModuleConfig('message'); if($config->skin) @@ -75,17 +46,6 @@ class communication extends ModuleObject } } } - - // check if module is abled - if($config->able_module != 'N') - { - // Check triggers - foreach($this->triggers as $trigger) - { - if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4])) return true; - } - } - return FALSE; } @@ -101,7 +61,6 @@ class communication extends ModuleObject } $oModuleModel = getModel('module'); - $oModuleController = getController('module'); $config = $oModuleModel->getModuleConfig('message'); if(!is_object($config)) { @@ -122,16 +81,7 @@ 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'); } @@ -141,19 +91,9 @@ 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 */ diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 9a90bc6a3..69cba0d09 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -775,81 +775,6 @@ 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 */ diff --git a/modules/communication/communication.mobile.php b/modules/communication/communication.mobile.php index 1f32166a9..d846f4cca 100644 --- a/modules/communication/communication.mobile.php +++ b/modules/communication/communication.mobile.php @@ -182,73 +182,6 @@ 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 */ diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index d66e115aa..46e262fd3 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -51,16 +51,12 @@ class communicationModel extends communication { $communication_config->mskin = 'default'; } - + if(!$communication_config->grant_write) { $communication_config->grant_write = array('default_grant'=>'member'); } - if(!$communication_config->able_module) - { - $communication_config->able_module = 'Y'; - } return $communication_config; } diff --git a/modules/communication/lang/lang.xml b/modules/communication/lang/lang.xml index 05d9ade79..d4bac684f 100644 --- a/modules/communication/lang/lang.xml +++ b/modules/communication/lang/lang.xml @@ -10,28 +10,6 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/communication/m.skins/default/add_friend.html b/modules/communication/m.skins/default/add_friend.html deleted file mode 100644 index fd3679ed9..000000000 --- a/modules/communication/m.skins/default/add_friend.html +++ /dev/null @@ -1,31 +0,0 @@ - - -
-

{$lang->cmd_add_friend}

-
-
-

{$XE_VALIDATOR_MESSAGE}

-
-
- - - - - -
- -
-
\ No newline at end of file diff --git a/modules/communication/m.skins/default/add_friend_group.html b/modules/communication/m.skins/default/add_friend_group.html deleted file mode 100644 index dc2cde80b..000000000 --- a/modules/communication/m.skins/default/add_friend_group.html +++ /dev/null @@ -1,30 +0,0 @@ - - -
-

- - {$lang->cmd_rename_friend_group} - - {$lang->cmd_add_friend_group} - -

-
-
-

{$XE_VALIDATOR_MESSAGE}

-
-
- - - - -
    -
  • - - -
  • -
-
- - -
-
diff --git a/modules/communication/m.skins/default/css/mcommunication.css b/modules/communication/m.skins/default/css/mcommunication.css index 8f7fc8b90..7d803cbab 100644 --- a/modules/communication/m.skins/default/css/mcommunication.css +++ b/modules/communication/m.skins/default/css/mcommunication.css @@ -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;box-sizing:border-box;width:100%;font-size:14px;margin:0 0 5px 0} +.ff label+select{display:block;width:96%;font-size:14px;margin:0 0 5px 0} .ff label+input[type=text], .ff label+input[type=password], .ff label+textarea{padding:5px} diff --git a/modules/communication/m.skins/default/js/communication.js b/modules/communication/m.skins/default/js/communication.js index 07934c2f0..e37272d41 100644 --- a/modules/communication/m.skins/default/js/communication.js +++ b/modules/communication/m.skins/default/js/communication.js @@ -20,50 +20,3 @@ 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; - } - }); -}); diff --git a/modules/communication/ruleset/addFriend.xml b/modules/communication/ruleset/addFriend.xml index 94b2daa9c..27e72cf1e 100644 --- a/modules/communication/ruleset/addFriend.xml +++ b/modules/communication/ruleset/addFriend.xml @@ -1,11 +1,7 @@ - + - - - - - - - - + + + + diff --git a/modules/communication/ruleset/addFriendGroup.xml b/modules/communication/ruleset/addFriendGroup.xml index 1bcb89fcb..b65ad171e 100644 --- a/modules/communication/ruleset/addFriendGroup.xml +++ b/modules/communication/ruleset/addFriendGroup.xml @@ -1,11 +1,8 @@ - - - - - - + + + - + diff --git a/modules/communication/tpl/index.html b/modules/communication/tpl/index.html index 706f8d2ed..7f21fa105 100644 --- a/modules/communication/tpl/index.html +++ b/modules/communication/tpl/index.html @@ -15,18 +15,11 @@

{$XE_VALIDATOR_MESSAGE}

-
+ -
- -
- - {$lang->about_communication_io} -
-
@@ -112,24 +105,10 @@
\ No newline at end of file +