mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
#38 쪽지 발송 권한 설정 추가
This commit is contained in:
parent
0821e47ba8
commit
08f80e42ab
6 changed files with 137 additions and 1 deletions
|
|
@ -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');
|
||||
$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);
|
||||
|
||||
|
|
@ -53,6 +53,11 @@ class communicationAdminController extends communication
|
|||
$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);
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ class communicationAdminView extends communication
|
|||
$security->encodeHTML('communication_skin_list..title');
|
||||
$security->encodeHTML('communication_mobile_skin_list..title');
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($this->site_srl);
|
||||
Context::set('group_list', $group_list);
|
||||
|
||||
// specify a template
|
||||
$this->setTemplatePath($this->module_path . 'tpl');
|
||||
$this->setTemplateFile('index');
|
||||
|
|
|
|||
|
|
@ -88,6 +88,12 @@ class communicationController extends communication
|
|||
// Check if there is a member to receive a message
|
||||
$oMemberModel = getModel('member');
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$config = $oCommunicationModel->getConfig();
|
||||
|
||||
if(!$oCommunicationModel->checkGrant($config->grant_write))
|
||||
{
|
||||
return new Object(-1, 'msg_not_permitted');
|
||||
}
|
||||
|
||||
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
||||
if($receiver_member_info->member_srl != $receiver_srl)
|
||||
|
|
|
|||
|
|
@ -52,9 +52,101 @@ class communicationModel extends communication
|
|||
$communication_config->mskin = 'default';
|
||||
}
|
||||
|
||||
if(!$communication_config->grant_write)
|
||||
{
|
||||
$communication_config->grant_write = array('default_grant'=>'member');
|
||||
}
|
||||
|
||||
return $communication_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get grant array for insert to database. table module_config's config field
|
||||
* @param string $default
|
||||
* @param array $group
|
||||
* @return array
|
||||
*/
|
||||
function getGrantArray($default, $group)
|
||||
{
|
||||
$grant = array();
|
||||
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;
|
||||
}
|
||||
}
|
||||
else if(is_array($group))
|
||||
{
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups($this->site_srl);
|
||||
|
||||
$group_grant = array();
|
||||
foreach($group as $group_srl)
|
||||
{
|
||||
$group_grant[$group_srl] = $group_list[$group_srl]->title;
|
||||
}
|
||||
$grant = array('group_grant'=>$group_grant);
|
||||
}
|
||||
return $grant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check member's grant
|
||||
* @param object $member_info
|
||||
* @param array $arrGrant
|
||||
* @return boolean
|
||||
*/
|
||||
function checkGrant($arrGrant)
|
||||
{
|
||||
if(!$arrGrant)
|
||||
return false;
|
||||
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info)
|
||||
return false;
|
||||
|
||||
if($logged_info->is_admin == "Y")
|
||||
return true;
|
||||
|
||||
if($arrGrant['default_grant'])
|
||||
{
|
||||
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(isset($group_grant[$group_srl])&&$group_grant[$group_srl]==$title)
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get the message contents
|
||||
* @param int $message_srl
|
||||
|
|
|
|||
|
|
@ -376,4 +376,12 @@
|
|||
<value xml:lang="en"><![CDATA[Friends in a mobile environment is not supported. Please go to the PC page.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[モバイル環境では友達リストページをサポートしません。PC画面へ移動してください。]]></value>
|
||||
</item>
|
||||
<item name="cmd_write_communication">
|
||||
<value xml:lang="ko"><![CDATA[작성 권한]]></value>
|
||||
<value xml:lang="en"><![CDATA[Write Grant]]></value>
|
||||
</item>
|
||||
<item name="cmd_manage_base">
|
||||
<value xml:lang="ko"><![CDATA[기본 정보]]></value>
|
||||
<value xml:lang="en"><![CDATA[Basic infomation]]></value>
|
||||
</item>
|
||||
</lang>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<load target="js/communication_admin.js" usecdn="true" />
|
||||
<load target="../../module/tpl/js/module_admin.js" />
|
||||
<load target="../../editor/tpl/js/editor_module_config.js" usecdn="true" />
|
||||
|
||||
<div class="x_page-header">
|
||||
|
|
@ -81,6 +82,24 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="mlayout_srl">{$lang->cmd_write_communication}</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>
|
||||
<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}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btnArea">
|
||||
<button class="x_btn x_btn-primary" type="submit">{$lang->cmd_registration}</button>
|
||||
</div>
|
||||
|
|
@ -89,5 +108,7 @@
|
|||
jQuery(function() {
|
||||
doGetSkinColorset("{$communication_config->skin}", 'P');
|
||||
doGetSkinColorset("{$communication_config->mskin}", 'M');
|
||||
jQuery('.grant_default').change( function(event) { doShowGrantZone(); } );
|
||||
doShowGrantZone()
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue