Merge branch 'develop' into next

This commit is contained in:
Kijin Sung 2020-05-31 23:59:17 +09:00
commit 2c6f1a2b24
12 changed files with 315 additions and 41 deletions

View file

@ -1366,7 +1366,7 @@ class moduleModel extends module
*
* @param string $module
* @param int $site_srl @deprecated
* @return object
* @return mixed
*/
public static function getModuleConfig($module, $site_srl = 0)
{
@ -1387,7 +1387,7 @@ class moduleModel extends module
}
else
{
$config = new stdClass;
$config = -1; // Use -1 as a temporary value because null cannot be cached
}
// Set cache
@ -1399,7 +1399,8 @@ class moduleModel extends module
$GLOBALS['__ModuleConfig__'][$site_srl][$module] = $config;
}
return $GLOBALS['__ModuleConfig__'][$site_srl][$module];
$config = $GLOBALS['__ModuleConfig__'][$site_srl][$module];
return $config === -1 ? null : $config;
}
/**

View file

@ -109,6 +109,10 @@ $lang->ncenterlite_commnet_event_noti_all = 'Notice every comments to the author
$lang->ncenterlite_commnet_event_noti_some = 'Notice only direct replies to the author';
$lang->ncenterlite_message_event = 'Notify message';
$lang->ncenterlite_message_event_about = 'Do not notify message (Use XE Core message notification system).';
$lang->ncenterlite_mid_use = 'Module specific settings';
$lang->ncenterlite_to_unsubscribe = 'Disable notification';
$lang->ncenterlite_subscribe = 'Activate notification';
$lang->ncenterlite_cmd_unsubscribe_settings = 'Notification settings';
$lang->ncenterlite_all_delete = 'Delete all';
$lang->ncenterlite_month_before_delete = 'Delete older than 1 month';
$lang->dont_check_notify_delete = 'Unread notifications will be deleted, too.';
@ -122,3 +126,6 @@ $lang->about_anonymous_scrap = 'anonymize scrapper in scrap notification';
$lang->highlight_effect = 'highlight effect';
$lang->about_highlight_effect = 'it gives highlight effect to the comment when access the comment URL.';
$lang->msg_denger_rhymix_user = '<strong>Warning!</strong> Rhymix includes notification center by default.<br />Please remove this XE-only module and reinstall the Rhymix native version.';
$lang->ncenterlite_content_type = 'Type of the contents';
$lang->msg_unsubscribe_not_in_list = 'This contents is not in the unsubscribed list.';

View file

@ -129,6 +129,7 @@ $lang->ncenterlite_message_event_about = '쪽지 알림을 사용하지 않음(X
$lang->ncenterlite_mid_use = '모듈별 사용 설정';
$lang->ncenterlite_to_unsubscribe = '수신 거부';
$lang->ncenterlite_subscribe = '수신 거부 안함';
$lang->ncenterlite_cmd_unsubscribe_settings = '알림 수신 설정';
$lang->this_message_unsubscribe = '이 게시글/댓글의 알림 수신 거부';
$lang->about_this_message_unsubscribe = '이 게시글/댓글의 알림을 수신 거부합니다.';
$lang->unsubscribe_list = '수신 거부 리스트';
@ -171,6 +172,7 @@ $lang->cmd_web_notify = '웹 알림';
$lang->cmd_mail_notify = '메일 알림';
$lang->cmd_sms_notify = '문자 알림';
$lang->cmd_push_notify = '푸시 알림';
$lang->ncenterlite_content_type = '컨텐츠 종류';
$lang->ncenterlite_type_id = '알림 타입 아이디';
$lang->ncenterlite_type_objects = '알림 타입 변수값';
$lang->ncenterlite_type_content = '알림 타입 내용';
@ -182,3 +184,4 @@ $lang->msg_denger_rhymix_user = '<strong>경고!</strong> 라이믹스에서는
$lang->msg_test_notifycation_success = '테스트알림더미를 정상적으로 생성하였습니다.';
$lang->msg_unsubscribe_block_not_support = '개별 수신 거부 기능을 제공하지 않습니다. 관리자에게 문의하세요.';
$lang->msg_unsubscribe_not_permission = '다른 회원의 구독리스트를 조회할 권한이 없습니다.';
$lang->msg_unsubscribe_not_in_list = '수신 거부 목록에 없는 컨텐츠입니다.';

View file

@ -31,6 +31,9 @@ class ncenterlite extends ModuleObject
array('document.moveDocumentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrash', 'after'),
array('comment.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCount', 'after'),
array('comment.updateVotedCountCancel', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCancel', 'after'),
// 2020. 05. 30 add menu when popup document menu called
array('document.getDocumentMenu', 'ncenterlite', 'controller', 'triggerGetDocumentMenu', 'after'),
array('comment.getCommentMenu', 'ncenterlite', 'controller', 'triggerGetCommentMenu', 'after'),
);
private $delete_triggers = array(

View file

@ -113,40 +113,85 @@ class ncenterliteController extends ncenterlite
throw new Rhymix\Framework\Exception('msg_unsubscribe_block_not_support');
}
$member_srl = Context::get('member_srl');
if(!$member_srl)
if(!Rhymix\Framework\Session::isMember())
{
$member_srl = $this->user->member_srl;
}
if(intval($this->user->member_srl) != intval($member_srl) && $this->user->is_admin != 'Y')
{
throw new Rhymix\Framework\Exception('ncenterlite_stop_no_permission_other_user_block_settings');
throw new Rhymix\Framework\Exception\MustLogin;
}
$obj = Context::getRequestVars();
if($obj->unsubscribe_srl)
if(!$this->user->member_srl || (!intval($obj->unsubscribe_srl) && !intval($obj->target_srl)))
{
$userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByUnsubscribeSrl($obj->unsubscribe_srl);
}
else if($obj->target_srl)
{
$userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByTargetSrl($obj->target_srl, $member_srl);
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
if($obj->target_srl)
{
$userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByTargetSrl($obj->target_srl, $this->user->member_srl);
// If there was a record directed by unsubscribe_srl, the record should be used to validate the input data.
if($userBlockData)
{
if (!intval($obj->unsubscribe_srl))
{
$obj->unsubscribe_srl = $userBlockData->unsubscribe_srl;
}
if (intval($obj->unsubscribe_srl) != intval($userBlockData->unsubscribe_srl))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
}
}
if(!$userBlockData && $obj->unsubscribe_srl)
{
$userBlockData = $oNcenterliteModel->getUserUnsubscribeConfigByUnsubscribeSrl($obj->unsubscribe_srl);
// The input member_srl from the POST or GET might not equal to the member_srl from the record of unsubscribe_srl.
if(intval($this->user->member_srl) != intval($userBlockData->member_srl))
{
throw new Rhymix\Framework\Exception('ncenterlite_stop_no_permission_other_user_block_settings');
}
// If there was a record directed by unsubscribe_srl, the record should be used to validate the input data.
if($userBlockData)
{
if (!intval($obj->target_srl))
{
$obj->target_srl = $userBlockData->target_srl;
}
if (intval($obj->target_srl) != intval($userBlockData->target_srl))
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
}
}
if($userBlockData)
{
$obj->unsubscribe_srl = $userBlockData->unsubscribe_srl;
}
// Content type can be document and comment, now. However, the default type cannot be specified, as the type can be another in the future.
if($obj->unsubscribe_type == 'document')
{
$text = cut_str(getModel('document')->getDocument($obj->target_srl)->get('title'), 30);
}
else
elseif($obj->unsubscribe_type == 'comment')
{
$comment = getModel('comment')->getComment($obj->target_srl);
$contentString = $comment->getContentText(30);
$text = strlen($contentString) ? $contentString : lang('comment.no_text_comment');
}
else
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
$args = new stdClass();
$args->member_srl = $member_srl;
$args->member_srl = $this->user->member_srl;
$args->target_srl = $obj->target_srl;
if($obj->unsubscribe_type == 'document')
{
@ -178,6 +223,11 @@ class ncenterliteController extends ncenterlite
}
else
{
if(!$obj->unsubscribe_srl && !$userBlockData)
{
throw new Rhymix\Framework\Exception('msg_unsubscribe_not_in_list');
}
$args->unsubscribe_srl = $obj->unsubscribe_srl;
$output = executeQuery('ncenterlite.deleteUnsubscribe', $args);
if(!$output->toBool())
@ -193,7 +243,7 @@ class ncenterliteController extends ncenterlite
}
else
{
$this->setRedirectUrl(getNotEncodedUrl('act', 'dispNcenterliteUnsubscribeList', 'member_srl', $member_srl));
$this->setRedirectUrl(getNotEncodedUrl('act', 'dispNcenterliteUnsubscribeList', 'member_srl', $this->user->member_srl));
}
}
@ -1621,4 +1671,53 @@ class ncenterliteController extends ncenterlite
}
return $notify_member_srls;
}
/**
* trigger for document.getDocumentMenu. Append to popup menu a button for dispNcenterliteInsertUnsubscribe()
*
* @param array &$menu_list
*
* @return object
**/
function triggerGetDocumentMenu(&$menu_list)
{
if(!Rhymix\Framework\Session::isMember()) return;
$document_srl = Context::get('target_srl');
/** @var ncenterliteModel $oNcenterliteModel */
$oNcenterliteModel = getModel('ncenterlite');
$config = $oNcenterliteModel->getConfig();
if($config->unsubscribe !== 'Y') return;
$oDocumentController = getController('document');
$url = getUrl('','module','ncenterlite','act','dispNcenterliteInsertUnsubscribe', 'target_srl', $document_srl, 'unsubscribe_type', 'document');
$oDocumentController->addDocumentPopupMenu($url,'ncenterlite_cmd_unsubscribe_settings','','popup');
}
/**
* trigger for comment.getCommentMenu. Append to popup menu a button for dispNcenterliteInsertUnsubscribe()
*
* @param array &$menu_list
*
* @return object
**/
function triggerGetCommentMenu(&$menu_list)
{
if(!Rhymix\Framework\Session::isMember()) return;
$comment_srl = Context::get('target_srl');
/** @var ncenterliteModel $oNcenterliteModel */
$oNcenterliteModel = getModel('ncenterlite');
$config = $oNcenterliteModel->getConfig();
if($config->unsubscribe !== 'Y') return;
$oCommentController = getController('comment');
$url = getUrl('','module','ncenterlite','act','dispNcenterliteInsertUnsubscribe', 'target_srl', $comment_srl, 'unsubscribe_type', 'comment');
$oCommentController->addCommentPopupMenu($url,'ncenterlite_cmd_unsubscribe_settings','','popup');
}
}

View file

@ -156,11 +156,11 @@ class ncenterliteView extends ncenterlite
if($unsubscribe_type == 'document')
{
$text = getModel('document')->getDocument($target_srl)->get('title');
$type = '문서';
$text = getModel('document')->getDocument($target_srl)->getTitleText();
$type = lang('document');
if(!$text)
{
$text = getModel('comment')->getComment($target_srl)->get('content');
$text = getModel('comment')->getComment($target_srl)->getContentPlainText();
if(!$text)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
@ -168,18 +168,18 @@ class ncenterliteView extends ncenterlite
else
{
Context::set('unsubscribe_type', 'comment');
$type = '댓글';
$type = lang('comment');
}
}
}
else
{
$text = getModel('comment')->getComment($target_srl)->get('content');
$type = '댓글';
$text = getModel('comment')->getComment($target_srl)->getContentPlainText();
$type = lang('comment');
if(!$text)
{
$text = getModel('document')->getDocument($target_srl)->get('title');
$text = getModel('document')->getDocument($target_srl)->getTitleText();
if(!$text)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
@ -187,7 +187,7 @@ class ncenterliteView extends ncenterlite
else
{
Context::set('unsubscribe_type', 'document');
$type = '문서';
$type = lang('document');
}
}
}

View file

@ -20,7 +20,7 @@
<!--@end-->
<section class="section">
<div class="control-group">
<label class="control-label">글 종류</label>
<label class="control-label">{lang('ncenterlite_content_type')}</label>
<div class="controls">
<p>
{$type}
@ -28,7 +28,7 @@
</div>
</div>
<div class="control-group">
<label class="control-label">내용</label>
<label class="control-label">{lang('content')}</label>
<div class="controls">
<p>
<!--@if($unsubscribeData)-->

View file

@ -5,9 +5,9 @@
<table class="table table-striped table-hover" style="margin-top:20px;">
<thead class="bg_f_f9">
<tr>
<th scope="col">타입</th>
<th scope="col">콘텐츠</th>
<th scope="col">차단설정</th>
<th scope="col">{lang('ncenterlite_content_type')}</th>
<th scope="col">{lang('content')}</th>
<th scope="col">{lang('ncenterlite_notify_settings')}</th>
</tr>
</thead>
<tbody>
@ -15,9 +15,9 @@
<tr>
<td>
<!--@if($val->unsubscribe_type == 'document')-->
<span>문서</span>
<span>{lang('document')}</span>
<!--@else-->
<span>댓글</span>
<span>{lang('comment')}</span>
<!--@end-->
</td>
<td>

View file

@ -0,0 +1,63 @@
<load target="../../../member/skins/default/css/member.css" />
<include target="../../../member/skins/default/common_header.html" />
<div class="xm">
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/ncenterlite/skins/default_bottom/unsubscribe/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="insertConfig" action="./" method="post" class="form-horizontal" id="fo_ncenterlite">
<input type="hidden" name="module" value="ncenterlite" />
<input type="hidden" name="act" value="procNcenterliteInsertUnsubscribe" />
<input type="hidden" name="xe_validator_id" value="modules/ncenterlite/skins/default_bottom/unsubscribe/1" />
<!--@if($unsubscribeData)-->
<input type="hidden" name="target_srl" value="{$unsubscribeData->target_srl}" />
<input type="hidden" name="unsubscribe_srl" value="{$unsubscribeData->unsubscribe_srl}" />
<input type="hidden" name="unsubscribe_type" value="{$unsubscribeData->unsubscribe_type}" />
<!--@else-->
<input type="hidden" name="target_srl" value="{$target_srl}" />
<input type="hidden" name="unsubscribe_srl" value="{$unsubscribe_srl}" />
<input type="hidden" name="unsubscribe_type" value="{$unsubscribe_type}" />
<!--@end-->
<section class="section">
<div class="control-group">
<label class="control-label">{lang('ncenterlite_content_type')}</label>
<div class="controls">
<p>
{$type}
</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{lang('content')}</label>
<div class="controls">
<p>
<!--@if($unsubscribeData)-->
{escape($unsubscribeData->text, false)}
<!--@else-->
{escape($text, false)}
<!--@end-->
</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->this_message_unsubscribe}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="value" value="Y" checked="checked"|cond="$unsubscribeData->value != 'N'" /> {$lang->ncenterlite_to_unsubscribe}
</label>
<label class="inline">
<input type="radio" name="value" value="N" checked="checked"|cond="$unsubscribeData->value == 'N'" /> {$lang->ncenterlite_subscribe}
</label>
<p>{$lang->about_this_message_unsubscribe}</p>
</div>
</div>
</section>
<div class="clearfix btnArea">
<div class="pull-right">
<button class="btn btn-primary" type="submit">{$lang->cmd_registration}</button>
</div>
</div>
</form>
</div>
<include target="../../../member/skins/default/common_footer.html" />

View file

@ -0,0 +1,63 @@
<include target="../../../member/skins/default/common_header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/ncenterlite/skins/default_bottom/unsubscribe/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<table class="table table-striped table-hover" style="margin-top:20px;">
<thead class="bg_f_f9">
<tr>
<th scope="col">{lang('ncenterlite_content_type')}</th>
<th scope="col">{lang('content')}</th>
<th scope="col">{lang('ncenterlite_notify_settings')}</th>
</tr>
</thead>
<tbody>
<!--@foreach($unsubscribe_list as $no => $val)-->
<tr>
<td>
<!--@if($val->unsubscribe_type == 'document')-->
<span>{lang('document')}</span>
<!--@else-->
<span>{lang('comment')}</span>
<!--@end-->
</td>
<td>
<!--@if($val->unsubscribe_type == 'document')-->
<a href="{getUrl('', 'document_srl', $val->target_srl)}">{escape($val->text, false)}</a>
<!--@else-->
<a href="{getUrl('', 'document_srl', $val->document_srl)}#{$val->target_srl}">{escape($val->text, false)}</a>
<!--@end-->
</td>
<td>
<form action="./" method="post">
<fieldset>
<input type="hidden" name="module" value="ncenterlite" />
<input type="hidden" name="act" value="procNcenterliteInsertUnsubscribe" />
<input type="hidden" name="xe_validator_id" value="modules/ncenterlite/skins/default_bottom/unsubscribe/1" />
<input type="hidden" name="target_srl" value="{$val->target_srl}" />
<input type="hidden" name="unsubscribe_type" value="{$val->unsubscribe_type}" />
<input type="hidden" name="unsubscribe_srl" value="{$val->unsubscribe_srl}" />
<select name="value" style="width:175px;">
<option value="Y">{$lang->ncenterlite_to_unsubscribe}</option>
<option value="N">{$lang->ncenterlite_subscribe}</option>
</select>
<button type="submit" class="x_btn">{$lang->cmd_setup}</button>
</fieldset>
</form>
</td>
</tr>
<!--@endforeach-->
</tbody>
</table>
<div class="pagination pagination-centered">
<ul>
<li><a href="{getUrl('page','')}" class="direction">&laquo; {$lang->first_page}</a></li>
<!--@if($page_navigation)-->
<!--@while($page_no = $page_navigation->getNextPage())-->
<li class="active"|cond="$page == $page_no"><a href="{getUrl('page',$page_no)}">{$page_no}</a></li>
<!--@end-->
<!--@end-->
<li><a href="{getUrl('page',$page_navigation->last_page)}" class="direction">{$lang->last_page} &raquo;</a></li>
</ul>
</div>
<include target="../../../member/skins/default/common_footer.html" />

View file

@ -24,7 +24,7 @@
<label class="control-label">{$lang->ncenterlite_comment_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="comment_notify" value="Y" checked="checked"|cond="$user_config->comment_notify == 'Y'" /> {$lang->ncenterlite_activate}
<input type="radio" name="comment_notify" value="Y" checked="checked"|cond="$user_config->comment_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="comment_notify" value="N" checked="checked"|cond="$user_config->comment_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -36,7 +36,7 @@
<label class="control-label">{$lang->ncenterlite_mention_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="mention_notify" value="Y" checked="checked"|cond="$user_config->mention_notify == 'Y'" /> {$lang->ncenterlite_activate}
<input type="radio" name="mention_notify" value="Y" checked="checked"|cond="$user_config->mention_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="mention_notify" value="N" checked="checked"|cond="$user_config->mention_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -48,7 +48,7 @@
<label class="control-label">{$lang->ncenterlite_message_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="message_notify" value="Y" checked="checked"|cond="$user_config->message_notify == 'Y'" /> {$lang->ncenterlite_activate}
<input type="radio" name="message_notify" value="Y" checked="checked"|cond="$user_config->message_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="message_notify" value="N" checked="checked"|cond="$user_config->message_notify == 'N'" /> {$lang->ncenterlite_inactivate}
@ -56,7 +56,42 @@
<p class="help-block">{$lang->ncenterlite_message_noti_about}</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_vote_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="vote_notify" value="Y" checked="checked"|cond="$user_config->vote_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="vote_notify" value="N" checked="checked"|cond="$user_config->vote_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_vote_noti_about}</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_scrap_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="scrap_notify" value="Y" checked="checked"|cond="$user_config->scrap_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="scrap_notify" value="N" checked="checked"|cond="$user_config->scrap_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_scrap_noti_about}</p>
</div>
</div>
<div class="control-group">
<label class="control-label">{$lang->ncenterlite_comment_comment_noti}</label>
<div class="controls">
<label class="inline">
<input type="radio" name="comment_comment_notify" value="Y" checked="checked"|cond="$user_config->comment_comment_notify != 'N'" /> {$lang->ncenterlite_activate}
</label>
<label class="inline">
<input type="radio" name="comment_comment_notify" value="N" checked="checked"|cond="$user_config->comment_comment_notify == 'N'" /> {$lang->ncenterlite_inactivate}
</label>
<p class="help-block">{$lang->ncenterlite_comment_comment_noti_about}</p>
</div>
</div>
</section>
<div class="clearfix btnArea">
<div class="pull-right">

View file

@ -195,7 +195,7 @@
</tr>
<tr>
<td>1</td>
<td><img src="{getUrl()}/modules/point/icons/{$config->level_icon}/1.gif" alt="1" /></td>
<td><img src="{getUrl()}modules/point/icons/{$config->level_icon}/1.gif" alt="1" /></td>
<td><label for="level_step_1" style="margin:0"><input type="number" id="level_step_1" name="level_step_1" value="{$config->level_step[1]}" style="width:120px;text-align:right" /> {$config->point_name}</label></td>
{@$point_group_item = $point_group[1]}
{@$title=array()}
@ -219,7 +219,7 @@
<!--@end-->
<tr class="row{(($i-1)%2+1)}">
<td>{$i}</td>
<td><img src="{getUrl()}/modules/point/icons/{$config->level_icon}/{$i}.gif" alt="{$i}" /></td>
<td><img src="{getUrl()}modules/point/icons/{$config->level_icon}/{$i}.gif" alt="{$i}" /></td>
<td><label for="level_step_{$i}" style="margin:0"><input type="number" id="level_step_{$i}" name="level_step_{$i}" value="{$config->level_step[$i]}" style="width:120px;text-align:right" /> {$config->point_name}</label></td>
<td>{implode(', ', $title)}</td>
</tr>