mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
Merge pull request #335 from conory/pr/communication
커뮤니케이션 애드온 흡수 후 모듈 문제 수정
This commit is contained in:
commit
1db9ef8f30
10 changed files with 310 additions and 286 deletions
|
|
@ -24,39 +24,14 @@ 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', 'member_menu');
|
||||
$args = Context::gets('enable_message', 'enable_friend', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_send_default','grant_send_group');
|
||||
$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->grant_send = $oCommunicationModel->getGrantArray($args->grant_send_default, $args->grant_send_group);
|
||||
unset($args->grant_send_default);
|
||||
unset($args->grant_send_group);
|
||||
|
||||
// create the module module Controller object
|
||||
$oModuleController = getController('module');
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class communicationAdminView extends communication
|
|||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// get the configurations of communication module
|
||||
Context::set('communication_config', $oCommunicationModel->getConfig());
|
||||
Context::set('config', $oCommunicationModel->getConfig());
|
||||
|
||||
// get a list of layout
|
||||
Context::set('layout_list', $oLayoutModel->getLayoutList());
|
||||
|
|
@ -39,10 +39,10 @@ class communicationAdminView extends communication
|
|||
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList());
|
||||
|
||||
// get a list of communication skins
|
||||
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path));
|
||||
Context::set('skin_list', $oModuleModel->getSkins($this->module_path));
|
||||
|
||||
// get a list of communication skins
|
||||
Context::set('communication_mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins'));
|
||||
Context::set('mobile_skin_list', $oModuleModel->getSkins($this->module_path, 'm.skins'));
|
||||
|
||||
// Get a layout list
|
||||
$layout_list = $oLayoutModel->getLayoutList();
|
||||
|
|
@ -52,11 +52,11 @@ class communicationAdminView extends communication
|
|||
Context::set('mlayout_list', $mlayout_list);
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('communication_config..');
|
||||
$security->encodeHTML('config..');
|
||||
$security->encodeHTML('layout_list..');
|
||||
$security->encodeHTML('editor_skin_list..');
|
||||
$security->encodeHTML('communication_skin_list..title');
|
||||
$security->encodeHTML('communication_mobile_skin_list..title');
|
||||
$security->encodeHTML('skin_list..title');
|
||||
$security->encodeHTML('mobile_skin_list..title');
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($this->site_srl);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@
|
|||
class communication extends ModuleObject
|
||||
{
|
||||
private $triggers = array(
|
||||
array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerAfter', 'after')
|
||||
array('moduleHandler.init', 'communication', 'controller', 'triggerModuleHandlerBefore', 'before'),
|
||||
array('member.getMemberMenu', 'communication', 'controller', 'triggerMemberMenu', 'before')
|
||||
);
|
||||
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
|
|
@ -18,6 +20,7 @@ class communication extends ModuleObject
|
|||
function moduleInstall()
|
||||
{
|
||||
$oModuleController = getController('module');
|
||||
|
||||
foreach($this->triggers as $trigger)
|
||||
{
|
||||
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
|
||||
|
|
@ -25,6 +28,7 @@ class communication extends ModuleObject
|
|||
|
||||
// Create a temporary file storage for one new private message notification
|
||||
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
@ -34,28 +38,8 @@ class communication extends ModuleObject
|
|||
*/
|
||||
function checkUpdate()
|
||||
{
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
|
||||
foreach($this->triggers as $trigger)
|
||||
{
|
||||
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
|
||||
|
|
@ -63,6 +47,12 @@ class communication extends ModuleObject
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -72,13 +62,9 @@ class communication extends ModuleObject
|
|||
*/
|
||||
function moduleUpdate()
|
||||
{
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
||||
}
|
||||
|
||||
$oModuleModel = getModel('module');
|
||||
$oModuleController = getController('module');
|
||||
|
||||
foreach($this->triggers as $trigger)
|
||||
{
|
||||
if(!$oModuleModel->getTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]))
|
||||
|
|
@ -86,24 +72,10 @@ class communication extends ModuleObject
|
|||
$oModuleController->insertTrigger($trigger[0], $trigger[1], $trigger[2], $trigger[3], $trigger[4]);
|
||||
}
|
||||
}
|
||||
$config = $oModuleModel->getModuleConfig('message');
|
||||
if(!is_object($config))
|
||||
|
||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||
{
|
||||
$config = new stdClass();
|
||||
}
|
||||
|
||||
if($config->skin)
|
||||
{
|
||||
$config_parse = explode('.', $config->skin);
|
||||
if(count($config_parse) > 1)
|
||||
{
|
||||
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
|
||||
if(is_dir($template_path))
|
||||
{
|
||||
$config->skin = implode('|@|', $config_parse);
|
||||
$oModuleController->updateModuleConfig('communication', $config);
|
||||
}
|
||||
}
|
||||
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
||||
}
|
||||
|
||||
return new Object(0, 'success_updated');
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class communicationController extends communication
|
|||
$oCommunicationModel = getModel('communication');
|
||||
$config = $oCommunicationModel->getConfig();
|
||||
|
||||
if(!$oCommunicationModel->checkGrant($config->grant_write))
|
||||
if(!$oCommunicationModel->checkGrant($config->grant_send))
|
||||
{
|
||||
return new Object(-1, 'msg_not_permitted');
|
||||
}
|
||||
|
|
@ -254,15 +254,17 @@ class communicationController extends communication
|
|||
$oDB->rollback();
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
// create a flag that message is sent (in file format)
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl);
|
||||
FileHandler::makeDir($flag_path);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
|
||||
$flag_count = FileHandler::readFile($flag_file);
|
||||
FileHandler::writeFile($flag_file, ++$flag_count);
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$new_message_count = $oCommunicationModel->getNewMessageCount($receiver_srl);
|
||||
FileHandler::writeFile($flag_file, $new_message_count);
|
||||
|
||||
return new Object(0, 'success_sended');
|
||||
}
|
||||
|
|
@ -771,88 +773,141 @@ class communicationController extends communication
|
|||
*/
|
||||
function setMessageReaded($message_srl)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args = new stdClass;
|
||||
$args->message_srl = $message_srl;
|
||||
$args->related_srl = $message_srl;
|
||||
return executeQuery('communication.setMessageReaded', $args);
|
||||
}
|
||||
|
||||
function triggerModuleHandlerAfter($module)
|
||||
{
|
||||
if(!Context::get('is_logged') && isCrawler())
|
||||
$output = executeQuery('communication.setMessageReaded', $args);
|
||||
|
||||
// Renew a flag
|
||||
$logged_info = Context::get('logged_info');
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
if(file_exists($flag_file))
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
if($module->module == 'admin')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$config = $oCommunicationModel->getConfig();
|
||||
|
||||
if($config->member_menu != 'Y')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
$act = Context::get('act');
|
||||
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
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$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(lang('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');
|
||||
$logged_info = Context::get('logged_info');
|
||||
// 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
|
||||
FileHandler::writeFile($flag_file, $new_message_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get member information
|
||||
$oMemberModel = getModel('member');
|
||||
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
||||
if(!$target_member_info->member_srl)
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
FileHandler::removeFile($flag_file);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
$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)))
|
||||
function triggerModuleHandlerBefore($obj)
|
||||
{
|
||||
if(!Context::get('is_logged') || $obj->module == 'member')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$config = $oCommunicationModel->getConfig();
|
||||
|
||||
if($config->enable_message == 'N' && $config->enable_friend == 'N')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
// Add menus on the member login information
|
||||
$oMemberController = getController('member');
|
||||
if($config->enable_message == 'Y')
|
||||
{
|
||||
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
|
||||
}
|
||||
|
||||
if($config->enable_friend == 'Y')
|
||||
{
|
||||
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
|
||||
}
|
||||
|
||||
if($config->enable_message == 'Y' && $obj->act != 'dispCommunicationNewMessage')
|
||||
{
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
if(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));
|
||||
if($new_message_count > 0)
|
||||
{
|
||||
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
|
||||
$text = preg_replace('@\r?\n@', '\\n', addslashes(lang('alert_new_message_arrived')));
|
||||
Context::addHtmlFooter("<script>jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
|
||||
Context::loadFile(array('./modules/communication/tpl/js/member_communication.js'), true);
|
||||
}
|
||||
// Add a menu for listing friends (if a friend is new)
|
||||
if(!$oCommunicationModel->isAddedFriend($member_srl))
|
||||
else
|
||||
{
|
||||
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', Context::get('cur_mid'), 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
|
||||
FileHandler::removeFile($flag_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function triggerMemberMenu()
|
||||
{
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$config = $oCommunicationModel->getConfig();
|
||||
|
||||
if($config->enable_message == 'N' && $config->enable_friend == 'N')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
|
||||
$mid = Context::get('cur_mid');
|
||||
$member_srl = Context::get('target_srl');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$oMemberController = getController('member');
|
||||
|
||||
// Add a feature to display own message box.
|
||||
if($logged_info->member_srl == $member_srl)
|
||||
{
|
||||
// Add your own viewing Note Template
|
||||
if($config->enable_message == 'Y')
|
||||
{
|
||||
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
|
||||
}
|
||||
|
||||
// Display a list of friends
|
||||
if($config->enable_friend == 'Y')
|
||||
{
|
||||
$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();
|
||||
}
|
||||
|
||||
// Add a menu for sending message
|
||||
if($config->enable_message == 'Y' && ($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', $mid, 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
|
||||
}
|
||||
|
||||
// Add a menu for listing friends (if a friend is new)
|
||||
if($config->enable_friend == 'Y' && !$oCommunicationModel->isAddedFriend($member_srl))
|
||||
{
|
||||
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file communication.controller.php */
|
||||
/* Location: ./modules/comment/communication.controller.php */
|
||||
|
|
|
|||
|
|
@ -25,44 +25,44 @@ class communicationModel extends communication
|
|||
function getConfig()
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
$communication_config = $oModuleModel->getModuleConfig('communication');
|
||||
$config = $oModuleModel->getModuleConfig('communication');
|
||||
|
||||
if(!is_object($communication_config))
|
||||
if(!$config->skin)
|
||||
{
|
||||
$communication_config = new stdClass();
|
||||
$config->skin = 'default';
|
||||
}
|
||||
|
||||
if(!$communication_config->skin)
|
||||
if(!$config->colorset)
|
||||
{
|
||||
$communication_config->skin = 'default';
|
||||
$config->colorset = 'white';
|
||||
}
|
||||
|
||||
if(!$communication_config->colorset)
|
||||
if(!$config->editor_skin)
|
||||
{
|
||||
$communication_config->colorset = 'white';
|
||||
$config->editor_skin = 'ckeditor';
|
||||
}
|
||||
|
||||
if(!$communication_config->editor_skin)
|
||||
if(!$config->mskin)
|
||||
{
|
||||
$communication_config->editor_skin = 'ckeditor';
|
||||
$config->mskin = 'default';
|
||||
}
|
||||
|
||||
if(!$config->grant_send)
|
||||
{
|
||||
$config->grant_send = array('default' => 'member');
|
||||
}
|
||||
|
||||
if(!$communication_config->mskin)
|
||||
if(!$config->enable_message)
|
||||
{
|
||||
$communication_config->mskin = 'default';
|
||||
$config->enable_message = 'Y';
|
||||
}
|
||||
|
||||
if(!$config->enable_friend)
|
||||
{
|
||||
$config->enable_friend = 'Y';
|
||||
}
|
||||
|
||||
if(!$communication_config->grant_write)
|
||||
{
|
||||
$communication_config->grant_write = array('default_grant' => 'member');
|
||||
}
|
||||
|
||||
if(!$communication_config->member_menu)
|
||||
{
|
||||
$communication_config->member_menu = 'Y';
|
||||
}
|
||||
|
||||
return $communication_config;
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,82 +74,60 @@ class communicationModel extends communication
|
|||
function getGrantArray($default, $group)
|
||||
{
|
||||
$grant = array();
|
||||
if($default!="")
|
||||
if($default)
|
||||
{
|
||||
switch($default)
|
||||
{
|
||||
case "-2":
|
||||
$grant = array("default_grant"=>"site");
|
||||
break;
|
||||
case "-3":
|
||||
$grant = array("default_grant"=>"manager");
|
||||
break;
|
||||
default :
|
||||
$grant = array("default_grant"=>"member");
|
||||
break;
|
||||
}
|
||||
}
|
||||
$grant = array('default' => $default);
|
||||
}
|
||||
else if(is_array($group))
|
||||
{
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($this->site_srl);
|
||||
|
||||
$group_grant = array();
|
||||
$grant_group = array();
|
||||
foreach($group as $group_srl)
|
||||
{
|
||||
$group_grant[$group_srl] = $group_list[$group_srl]->title;
|
||||
$grant_group[$group_srl] = true;
|
||||
}
|
||||
$grant = array('group_grant'=>$group_grant);
|
||||
|
||||
$grant = array('group' => $grant_group);
|
||||
}
|
||||
|
||||
return $grant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check member's grant
|
||||
* @param object $member_info
|
||||
* @brief Check Grant
|
||||
* @param array $arrGrant
|
||||
* @return boolean
|
||||
*/
|
||||
function checkGrant($arrGrant)
|
||||
{
|
||||
if(!$arrGrant)
|
||||
return false;
|
||||
|
||||
if(!Context::get('is_logged'))
|
||||
return false;
|
||||
if(!$arrGrant) return false;
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin == "Y")
|
||||
return true;
|
||||
if($logged_info->is_admin == 'Y') return true;
|
||||
|
||||
if($arrGrant['default_grant'])
|
||||
if($arrGrant['default'])
|
||||
{
|
||||
if($arrGrant['default_grant'] == "member" && $logged_info)
|
||||
return true;
|
||||
|
||||
if($arrGrant['default_grant'] == "site" && $this->site_srl == $logged_info->site_srl)
|
||||
return true;
|
||||
|
||||
if($arrGrant['default_grant'] == "manager" && $logged_info->is_admin == "Y")
|
||||
return true;
|
||||
}
|
||||
|
||||
if($arrGrant['group_grant'])
|
||||
{
|
||||
$group_grant = $arrGrant['group_grant'];
|
||||
if(!is_array($group_grant))
|
||||
return false;
|
||||
|
||||
foreach($logged_info->group_list as $group_srl=>$title)
|
||||
if($arrGrant['default'] == 'member')
|
||||
{
|
||||
if(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title)
|
||||
return true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if(is_array($arrGrant['group']))
|
||||
{
|
||||
foreach($logged_info->group_list as $group_srl => $title)
|
||||
{
|
||||
if(isset($arrGrant['group'][$group_srl])) return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class communicationView extends communication
|
|||
{
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$this->communication_config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->communication_config->skin;
|
||||
$this->config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->config->skin;
|
||||
|
||||
Context::set('communication_config', $this->communication_config);
|
||||
Context::set('communication_config', $this->config);
|
||||
|
||||
$config_parse = explode('|@|', $skin);
|
||||
|
||||
|
|
@ -36,10 +36,10 @@ class communicationView extends communication
|
|||
$this->setTemplatePath($tpl_path);
|
||||
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($this->communication_config->layout_srl);
|
||||
$layout_info = $oLayoutModel->getLayout($this->config->layout_srl);
|
||||
if($layout_info)
|
||||
{
|
||||
$this->module_info->layout_srl = $this->communication_config->layout_srl;
|
||||
$this->module_info->layout_srl = $this->config->layout_srl;
|
||||
$this->setLayoutPath($layout_info->path);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,11 @@ class communicationView extends communication
|
|||
*/
|
||||
function dispCommunicationMessages()
|
||||
{
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -58,11 +63,6 @@ class communicationView extends communication
|
|||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Set the variables
|
||||
$message_srl = Context::get('message_srl');
|
||||
$message_type = Context::get('message_type');
|
||||
|
|
@ -138,6 +138,11 @@ class communicationView extends communication
|
|||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -157,11 +162,6 @@ class communicationView extends communication
|
|||
Context::set('message', $message);
|
||||
}
|
||||
|
||||
// Delete a flag
|
||||
$flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
FileHandler::removeFile($flag_file);
|
||||
|
||||
$this->setTemplateFile('new_message');
|
||||
}
|
||||
|
||||
|
|
@ -174,9 +174,11 @@ class communicationView extends communication
|
|||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -199,6 +201,9 @@ class communicationView extends communication
|
|||
return $this->stop('msg_cannot_send_to_yourself');
|
||||
}
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
// get message_srl of the original message if it is a reply
|
||||
$message_srl = Context::get('message_srl');
|
||||
if($message_srl)
|
||||
|
|
@ -235,8 +240,8 @@ class communicationView extends communication
|
|||
$option->resizable = FALSE;
|
||||
$option->disable_html = TRUE;
|
||||
$option->height = 300;
|
||||
$option->skin = $this->communication_config->editor_skin;
|
||||
$option->colorset = $this->communication_config->editor_colorset;
|
||||
$option->skin = $this->config->editor_skin;
|
||||
$option->colorset = $this->config->editor_colorset;
|
||||
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option);
|
||||
Context::set('editor', $editor);
|
||||
|
||||
|
|
@ -249,12 +254,17 @@ class communicationView extends communication
|
|||
*/
|
||||
function dispCommunicationFriend()
|
||||
{
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// get a group list
|
||||
|
|
@ -307,7 +317,12 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -349,7 +364,12 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// error apprears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ $lang->msg_disallow_message = 'Failed to send a message because the recipient bl
|
|||
$lang->about_allow_message = 'You can set whether to receive messages or not.';
|
||||
$lang->message_notice = 'Send a message to the author about this. If you don\'t write a message, it is not sent.';
|
||||
$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->communication_send_message_grant = 'Send Message 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?';
|
||||
$lang->enable_communication_friend = 'Friend Enable';
|
||||
$lang->enable_communication_message = 'Message Enable';
|
||||
|
|
@ -32,6 +32,8 @@ $lang->msg_disallow_message = '쪽지 수신을 거부한 사용자라서 쪽지
|
|||
$lang->about_allow_message = '쪽지 수신 여부를 결정할 수 있습니다.';
|
||||
$lang->message_notice = '저작자에게 쪽지를 발송해서 이 사실을 알립니다. 작성하지 않으면 발송하지 않습니다.';
|
||||
$lang->friends_page_does_not_support = '모바일 환경에서는 친구 보기 페이지를 지원하지 않습니다. PC 화면으로 이동하세요.';
|
||||
$lang->cmd_write_communication = '작성 권한';
|
||||
$lang->communication_send_message_grant = '쪽지 발송 권한';
|
||||
$lang->cmd_manage_base = '기본 정보';
|
||||
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';
|
||||
$lang->enable_communication_friend = '친구기능 사용';
|
||||
$lang->enable_communication_message = '쪽지기능 사용';
|
||||
|
|
@ -20,18 +20,37 @@
|
|||
<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">
|
||||
<div class="x_control-label">{$lang->enable_communication_message}</div>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline" for="enable_message_yes">
|
||||
<input type="radio" name="enable_message" id="enable_message_yes" value="Y" checked="checked"|cond="$config->enable_message == 'Y'" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="enable_message_no">
|
||||
<input type="radio" name="enable_message" id="enable_message_no" value="N" checked="checked"|cond="$config->enable_message == 'N'" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<div class="x_control-label">{$lang->enable_communication_friend}</div>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline" for="enable_friend_yes">
|
||||
<input type="radio" name="enable_friend" id="enable_friend_yes" value="Y" checked="checked"|cond="$config->enable_friend == 'Y'" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="enable_friend_no">
|
||||
<input type="radio" name="enable_friend" id="enable_friend_no" value="N" checked="checked"|cond="$config->enable_friend == 'N'" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="editor_skin">{$lang->editor_skin}</label>
|
||||
<div class="x_controls">
|
||||
<select name="editor_skin" id="editor_skin" onchange="getEditorSkinColorList(this.value)">
|
||||
<option loop="$editor_skin_list => $editor_skin" value="{$editor_skin}" selected="selected"|cond="$editor_skin==$communication_config->editor_skin">{$editor_skin}</option>
|
||||
</select>
|
||||
<select name="sel_editor_colorset" style="display:none">
|
||||
<option loop="$editor_skin_list => $editor_skin" value="{$editor_skin}" selected="selected"|cond="$editor_skin==$config->editor_skin">{$editor_skin}</option>
|
||||
</select>
|
||||
<select name="sel_editor_colorset" style="display:none"></select>
|
||||
<script>
|
||||
//<![CDATA[
|
||||
getEditorSkinColorList('{$communication_config->editor_skin}','{$communication_config->editor_colorset}');
|
||||
//]]>
|
||||
getEditorSkinColorList('{$config->editor_skin}','{$config->editor_colorset}');
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -40,7 +59,7 @@
|
|||
<div class="x_controls">
|
||||
<select id="layout" name="layout_srl" style="width:auto">
|
||||
<option value="0">{$lang->notuse}</option>
|
||||
<option loop="$layout_list => $key,$val" value="{$val->layout_srl}" selected="selected"|cond="$val->layout_srl == $communication_config->layout_srl">{$val->title} ({$val->layout})</option>
|
||||
<option loop="$layout_list => $key,$val" value="{$val->layout_srl}" selected="selected"|cond="$val->layout_srl == $config->layout_srl">{$val->title} ({$val->layout})</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -48,7 +67,7 @@
|
|||
<label class="x_control-label" for="skin">{$lang->skin}</label>
|
||||
<div class="x_controls">
|
||||
<select name="skin" id="skin" style="width:auto" onchange="doGetSkinColorset(this.options[this.selectedIndex].value, 'P')">
|
||||
<option loop="$communication_skin_list => $key, $val" value="{$key}" selected="selected"|cond="$key==$communication_config->skin">{$val->title}</option>
|
||||
<option loop="$skin_list => $key, $val" value="{$key}" selected="selected"|cond="$key==$config->skin">{$val->title}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -63,7 +82,7 @@
|
|||
<div class="x_controls">
|
||||
<select id="mlayout_srl" name="mlayout_srl" style="width:auto">
|
||||
<option value="0">{$lang->notuse}</option>
|
||||
<option loop="$mlayout_list => $key,$val" value="{$val->layout_srl}" selected="selected"|cond="$val->layout_srl == $communication_config->mlayout_srl">{$val->title} ({$val->layout})</option>
|
||||
<option loop="$mlayout_list => $key,$val" value="{$val->layout_srl}" selected="selected"|cond="$val->layout_srl == $config->mlayout_srl">{$val->title} ({$val->layout})</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -71,7 +90,7 @@
|
|||
<label class="x_control-label" for="mskin">{$lang->mobile_skin}</label>
|
||||
<div class="x_controls">
|
||||
<select name="mskin" id="mskin" style="width:auto" onchange="doGetSkinColorset(this.options[this.selectedIndex].value, 'M')">
|
||||
<option loop="$communication_mobile_skin_list => $key,$val" value="{$key}" selected="selected"|cond="$key==$communication_config->mskin" >{$val->title}</option>
|
||||
<option loop="$mobile_skin_list => $key,$val" value="{$key}" selected="selected"|cond="$key==$config->mskin" >{$val->title}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -81,39 +100,41 @@
|
|||
<div id="communication_mcolorset"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="mlayout_srl">{$lang->cmd_write_communication}</label>
|
||||
<label class="x_control-label" for="grant_send">{$lang->communication_send_message_grant}</label>
|
||||
<div class="x_controls">
|
||||
<select name="grant_write_default" class="grant_default">
|
||||
<option value="-1" selected="selected"|cond="$communication_config->grant_write['default_grant']=='member'">{$lang->grant_to_login_user}</option>
|
||||
<option value="-2" selected="selected"|cond="$communication_config->grant_write['default_grant']=='site'">{$lang->grant_to_site_user}</option>
|
||||
<option value="-3" selected="selected"|cond="$communication_config->grant_write['default_grant']=='manager'">{$lang->grant_to_admin}</option>
|
||||
<option value="" selected="selected"|cond="$communication_config->grant_write['default_grant']==''">{$lang->grant_to_group}</option>
|
||||
<select name="grant_send_default" class="grant_default" id="grant_send">
|
||||
<option value="member" selected="selected"|cond="$config->grant_send['default'] == 'member'">
|
||||
{$lang->grant_to_login_user}
|
||||
</option>
|
||||
<option value="site" selected="selected"|cond="$config->grant_send['default'] == 'site'">
|
||||
{$lang->grant_to_site_user}
|
||||
</option>
|
||||
<option value="manager" selected="selected"|cond="$config->grant_send['default'] == 'manager'">
|
||||
{$lang->grant_to_admin}
|
||||
</option>
|
||||
<option value="" selected="selected"|cond="$config->grant_send['default'] == ''">
|
||||
{$lang->grant_to_group}
|
||||
</option>
|
||||
</select>
|
||||
<div id="zone_grant_write" hidden style="margin:8px 0 0 0">
|
||||
<label loop="$group_list => $group_srl, $group_item" for="grant_write_group_{$group_srl}">
|
||||
<input type="checkbox" class="checkbox" name="grant_write_group[]" value="{$group_item->group_srl}" id="grant_write_group_{$group_item->group_srl}" checked="checked"|cond="isset($communication_config->grant_write['group_grant'][$group_srl])&&$communication_config->grant_write['group_grant'][$group_srl]==$group_item->title"/>
|
||||
{$group_item->title}
|
||||
|
||||
<div id="zone_grant_send" style="margin:8px 0 0 0" hidden>
|
||||
<label loop="$group_list => $group_srl, $item" for="group_{$group_srl}">
|
||||
<input type="checkbox" name="grant_send_group[]" value="{$group_srl}" checked="checked"|cond="isset($config->grant_send['group'][$group_srl])" id="group_{$group_srl}"/>
|
||||
{$item->title}
|
||||
</label>
|
||||
</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>
|
||||
</form>
|
||||
<script>
|
||||
jQuery(function() {
|
||||
doGetSkinColorset("{$communication_config->skin}", 'P');
|
||||
doGetSkinColorset("{$communication_config->mskin}", 'M');
|
||||
doGetSkinColorset("{$config->skin}", 'P');
|
||||
doGetSkinColorset("{$config->mskin}", 'M');
|
||||
jQuery('.grant_default').change( function(event) { doShowGrantZone(); } );
|
||||
doShowGrantZone()
|
||||
doShowGrantZone();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(function($){
|
||||
var $bar;
|
||||
window.xeNotifyMessage = function(text, count){
|
||||
var $bar;
|
||||
$bar = $('div.message.info');
|
||||
if(!$bar.length) {
|
||||
$bar = $('<div class="message info" />')
|
||||
|
|
@ -11,16 +11,15 @@
|
|||
})
|
||||
.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.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationNewMessage')+'" onclick="popopen(this.href, \'popup\');xeNotifyMessageClose(); return false;">'+text+'</a></p>').height();
|
||||
$bar.show().animate({top:0});
|
||||
// hide after 10 seconds
|
||||
};
|
||||
|
||||
window.xeNotifyMessageClose = function(){
|
||||
setTimeout(function(){
|
||||
$bar.slideUp();
|
||||
}, 5000);
|
||||
}, 2000);
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue