Fix #1217 enable notifications for scrap

This commit is contained in:
Kijin Sung 2019-11-23 12:04:14 +09:00
parent 05fed158d0
commit b1e01b0fc5
9 changed files with 93 additions and 6 deletions

View file

@ -190,10 +190,20 @@ class memberController extends member
throw new Rhymix\Framework\Exception('msg_alreay_scrapped'); throw new Rhymix\Framework\Exception('msg_alreay_scrapped');
} }
// Call trigger (before)
$trigger_output = ModuleHandler::triggerCall('member.procMemberScrapDocument', 'before', $args);
if (!$trigger_output->toBool())
{
return $trigger_output;
}
// Insert // Insert
$output = executeQuery('member.addScrapDocument', $args); $output = executeQuery('member.addScrapDocument', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
// Call trigger (after)
ModuleHandler::triggerCall('member.procMemberScrapDocument', 'after', $args);
$this->setError(-1); $this->setError(-1);
$this->setMessage('success_registed'); $this->setMessage('success_registed');
} }

View file

@ -4,6 +4,11 @@ $lang->ncenterlite_install_version = 'Installed version';
$lang->ncenterlite_advenced_config = 'Advenced Setting'; $lang->ncenterlite_advenced_config = 'Advenced Setting';
$lang->ncenterlite_document = 'document'; $lang->ncenterlite_document = 'document';
$lang->ncenterlite_comment = 'comment'; $lang->ncenterlite_comment = 'comment';
$lang->ncenterlite_mention = 'Mention';
$lang->ncenterlite_cmd_vote = 'Vote';
$lang->ncenterlite_cmd_scrap = 'Scrap';
$lang->ncenterlite_comment_comment = 'Reply to Comment';
$lang->ncenterlite_admin_content = 'Admin Notification';
$lang->ncenterlite_type_message = 'message'; $lang->ncenterlite_type_message = 'message';
$lang->ncenterlite_sender = 'Sender'; $lang->ncenterlite_sender = 'Sender';
$lang->ncenterlite_addressee = 'Recipient'; $lang->ncenterlite_addressee = 'Recipient';
@ -38,7 +43,9 @@ $lang->ncenterlite_message_string_plural = 'You have <strong>%d</strong> unread
$lang->ncenterlite_message_mention = '<strong>%1$s</strong> sent you a message, "%2$s".'; $lang->ncenterlite_message_mention = '<strong>%1$s</strong> sent you a message, "%2$s".';
$lang->ncenterlite_test_noti = 'Hello, <strong>%s</strong>! This is a test notification.'; $lang->ncenterlite_test_noti = 'Hello, <strong>%s</strong>! This is a test notification.';
$lang->ncenterlite_vote = '<strong>%1$s</strong> upvoted your %3$s, "%2$s".'; $lang->ncenterlite_vote = '<strong>%1$s</strong> upvoted your %3$s, "%2$s".';
$lang->ncenterlite_vote_anonymous = 'upvoted your %2$s, "%1$s".'; $lang->ncenterlite_vote_anonymous = 'Your %2$s, "%1$s" was upvoted.';
$lang->ncenterlite_vote = '<strong>%1$s</strong> scrapped your %3$s, "%2$s".';
$lang->ncenterlite_vote_anonymous = 'Your %2$s, "%1$s" was scrapped.';
$lang->ncenterlite_admin_content_message = '<strong>%1$s</strong> wrote "%3$s" on <strong>%2$s</strong>.'; $lang->ncenterlite_admin_content_message = '<strong>%1$s</strong> wrote "%3$s" on <strong>%2$s</strong>.';
$lang->ncenterlite_insert_member_message = '<strong>%s!</strong> Welcome to the <strong>membership!!</strong>'; $lang->ncenterlite_insert_member_message = '<strong>%s!</strong> Welcome to the <strong>membership!!</strong>';
$lang->ncenterlite_content_image = '(Image)'; $lang->ncenterlite_content_image = '(Image)';
@ -109,6 +116,8 @@ $lang->about_user_notify_setting = 'Each member can set a notify settings. Warni
$lang->msg_not_use_user_setting = 'user setting\'s not use. Please contact your administrator.'; $lang->msg_not_use_user_setting = 'user setting\'s not use. Please contact your administrator.';
$lang->anonymous_voter = 'anonymous voter'; $lang->anonymous_voter = 'anonymous voter';
$lang->about_anonymous_voter = 'anonymize voter in vote notification'; $lang->about_anonymous_voter = 'anonymize voter in vote notification';
$lang->anonymous_scrap = 'anonymous scrap';
$lang->about_anonymous_scrap = 'anonymize scrapper in scrap notification';
$lang->highlight_effect = 'highlight effect'; $lang->highlight_effect = 'highlight effect';
$lang->about_highlight_effect = 'it gives highlight effect to the comment when access the comment URL.'; $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->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.';

View file

@ -6,6 +6,7 @@ $lang->ncenterlite_document = '글';
$lang->ncenterlite_comment = '댓글'; $lang->ncenterlite_comment = '댓글';
$lang->ncenterlite_mention = '멘션'; $lang->ncenterlite_mention = '멘션';
$lang->ncenterlite_cmd_vote = '추천'; $lang->ncenterlite_cmd_vote = '추천';
$lang->ncenterlite_cmd_scrap = '스크랩';
$lang->ncenterlite_comment_comment = '대댓글'; $lang->ncenterlite_comment_comment = '대댓글';
$lang->ncenterlite_type_message = '쪽지'; $lang->ncenterlite_type_message = '쪽지';
$lang->ncenterlite_type_test = '테스트'; $lang->ncenterlite_type_test = '테스트';
@ -53,6 +54,8 @@ $lang->ncenterlite_message_mention = '<strong>%s</strong>님이 <strong>"%s"</st
$lang->ncenterlite_test_noti = '<strong>%s</strong>님! 테스트 알림입니다.'; $lang->ncenterlite_test_noti = '<strong>%s</strong>님! 테스트 알림입니다.';
$lang->ncenterlite_vote = '<strong>%s</strong>님이 회원님의 <strong>"%s"</strong> %s을 추천하였습니다.'; $lang->ncenterlite_vote = '<strong>%s</strong>님이 회원님의 <strong>"%s"</strong> %s을 추천하였습니다.';
$lang->ncenterlite_vote_anonymous = '회원님의 <strong>"%s"</strong> %s이 추천되었습니다.'; $lang->ncenterlite_vote_anonymous = '회원님의 <strong>"%s"</strong> %s이 추천되었습니다.';
$lang->ncenterlite_scrap = '<strong>%s</strong>님이 회원님의 <strong>"%s"</strong> %s을 스크랩하였습니다.';
$lang->ncenterlite_scrap_anonymous = '회원님의 <strong>"%s"</strong> %s이 스크랩되었습니다.';
$lang->ncenterlite_admin_content_message = '<strong>%1$s</strong>님이 <strong>"%2$s"</strong> 게시판에 <strong>"%3$s"</strong>라고 글을 남겼습니다.'; $lang->ncenterlite_admin_content_message = '<strong>%1$s</strong>님이 <strong>"%2$s"</strong> 게시판에 <strong>"%3$s"</strong>라고 글을 남겼습니다.';
$lang->ncenterlite_insert_member_message = '<strong>%s</strong>님 <strong>회원가입</strong>을 환영합니다!!'; $lang->ncenterlite_insert_member_message = '<strong>%s</strong>님 <strong>회원가입</strong>을 환영합니다!!';
$lang->ncenterlite_content_image = '(이미지)'; $lang->ncenterlite_content_image = '(이미지)';
@ -143,6 +146,8 @@ $lang->member_phone_variable = '회원전화번호 변수';
$lang->member_phone_variable_about = '회원전화번호 변수를 선택합니다. 회원전화번호 변수가 1개일 경우 설치시 자동으로 설정이 저장됩니다. 이 경우 설정을 할 필요가 없어서 설정을 선택할 수 없습니다.'; $lang->member_phone_variable_about = '회원전화번호 변수를 선택합니다. 회원전화번호 변수가 1개일 경우 설치시 자동으로 설정이 저장됩니다. 이 경우 설정을 할 필요가 없어서 설정을 선택할 수 없습니다.';
$lang->anonymous_voter = '추천인 익명'; $lang->anonymous_voter = '추천인 익명';
$lang->about_anonymous_voter = '추천 알림시 추천인을 익명으로 처리합니다.'; $lang->about_anonymous_voter = '추천 알림시 추천인을 익명으로 처리합니다.';
$lang->anonymous_scrap = '스크랩 익명';
$lang->about_anonymous_scrap = '스크랩 알림시 스크랩한 사람을 익명으로 처리합니다.';
$lang->highlight_effect = '하이라이트 효과'; $lang->highlight_effect = '하이라이트 효과';
$lang->about_highlight_effect = '댓글 URL로 접근시 해당 댓글에 하이라이트 효과를 줍니다.'; $lang->about_highlight_effect = '댓글 URL로 접근시 해당 댓글에 하이라이트 효과를 줍니다.';
$lang->fail_module_install = '모듈설치에 실패하였습니다.'; $lang->fail_module_install = '모듈설치에 실패하였습니다.';

View file

@ -31,6 +31,7 @@ class ncenterliteAdminController extends ncenterlite
'variable_name', 'variable_name',
'user_notify_setting', 'user_notify_setting',
'anonymous_voter', 'anonymous_voter',
'anonymous_scrap',
'highlight_effect', 'highlight_effect',
'comment_all', 'comment_all',
'comment_all_notify_module_srls', 'comment_all_notify_module_srls',

View file

@ -9,6 +9,7 @@ class ncenterlite extends ModuleObject
var $_TYPE_MESSAGE = 'E'; // 쪽지 mEssage var $_TYPE_MESSAGE = 'E'; // 쪽지 mEssage
var $_TYPE_DOCUMENTS = 'P'; // 글 작성 알림 var $_TYPE_DOCUMENTS = 'P'; // 글 작성 알림
var $_TYPE_VOTED = 'V'; // 추천글 안내 알림 var $_TYPE_VOTED = 'V'; // 추천글 안내 알림
var $_TYPE_SCRAPPED = 'R'; // 스크랩 알림
var $_TYPE_TEST = 'T'; // Test Notify create. var $_TYPE_TEST = 'T'; // Test Notify create.
var $_TYPE_ADMIN_DOCUMENT = 'B'; // Admin Document Alert var $_TYPE_ADMIN_DOCUMENT = 'B'; // Admin Document Alert
var $_TYPE_CUSTOM = 'U'; //Updated alert(uses type table) var $_TYPE_CUSTOM = 'U'; //Updated alert(uses type table)
@ -23,7 +24,8 @@ class ncenterlite extends ModuleObject
array('moduleHandler.proc', 'ncenterlite', 'controller', 'triggerAfterModuleHandlerProc', 'after'), array('moduleHandler.proc', 'ncenterlite', 'controller', 'triggerAfterModuleHandlerProc', 'after'),
array('member.deleteMember', 'ncenterlite', 'controller', 'triggerAfterDeleteMember', 'after'), array('member.deleteMember', 'ncenterlite', 'controller', 'triggerAfterDeleteMember', 'after'),
array('communication.sendMessage', 'ncenterlite', 'controller', 'triggerAfterSendMessage', 'after'), array('communication.sendMessage', 'ncenterlite', 'controller', 'triggerAfterSendMessage', 'after'),
array('document.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterVotedupdate', 'after'), array('document.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterDocumentVotedUpdate', 'after'),
array('member.procMemberScrapDocument', 'ncenterlite', 'controller', 'triggerAfterScrap', 'after'),
array('moduleHandler.init', 'ncenterlite', 'controller', 'triggerAddMemberMenu', 'after'), array('moduleHandler.init', 'ncenterlite', 'controller', 'triggerAddMemberMenu', 'after'),
array('document.moveDocumentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrash', 'after'), array('document.moveDocumentToTrash', 'ncenterlite', 'controller', 'triggerAfterMoveToTrash', 'after'),
array('comment.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCount', 'after'), array('comment.updateVotedCount', 'ncenterlite', 'controller', 'triggerAfterCommentVotedCount', 'after'),

View file

@ -399,8 +399,37 @@ class ncenterliteController extends ncenterlite
return $output; return $output;
} }
} }
function triggerAfterScrap($obj)
{
$oNcenterliteModel = getModel('ncenterlite');
$config = $oNcenterliteModel->getConfig();
if(!isset($config->use['scrap']))
{
return;
}
$args = new stdClass();
$args->config_type = 'scrap';
$args->target_member_srl = $obj->member_srl;
$args->member_srl = $obj->target_member_srl;
$args->srl = $obj->document_srl;
$args->target_p_srl = '1';
$args->target_srl = $obj->document_srl;
$args->type = $this->_TYPE_DOCUMENT;
$args->target_type = $this->_TYPE_SCRAPPED;
$args->target_summary = $obj->title;
$args->regdate = date('YmdHis');
$args->notify = $this->_getNotifyId($args);
$args->target_url = getNotEncodedUrl('', 'document_srl', $obj->document_srl);
$output = $this->_insertNotify($args);
if(!$output->toBool())
{
return $output;
}
}
function triggerAfterVotedupdate(&$obj) function triggerAfterDocumentVotedUpdate(&$obj)
{ {
$oNcenterliteModel = getModel('ncenterlite'); $oNcenterliteModel = getModel('ncenterlite');
$config = $oNcenterliteModel->getConfig(); $config = $oNcenterliteModel->getConfig();

View file

@ -563,6 +563,18 @@ class ncenterliteModel extends ncenterlite
} }
break; break;
// Scrapped.
case 'R':
if($config->anonymous_scrap === 'Y')
{
$str = sprintf(lang('ncenterlite_scrap_anonymous'), $notification->target_summary, $type);
}
else
{
$str = sprintf(lang('ncenterlite_scrap'), $notification->target_nick_name, $notification->target_summary, $type);
}
break;
// Admin notification. // Admin notification.
case 'B': case 'B':
$str = sprintf(lang('ncenterlite_admin_content_message'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary); $str = sprintf(lang('ncenterlite_admin_content_message'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary);

View file

@ -62,7 +62,7 @@
<label class="x_control-label">{$lang->anonymous_voter}</label> <label class="x_control-label">{$lang->anonymous_voter}</label>
<div class="x_controls"> <div class="x_controls">
<label class="x_inline"> <label class="x_inline">
<input type="radio" name="anonymous_voter" value="Y" checked="checked"|cond="$config->anonymous_voter === 'Y'" /> {$lang->use} <input type="radio" name="anonymous_voter" value="Y" checked="checked"|cond="$config->anonymous_voter !== 'N'" /> {$lang->use}
</label> </label>
<label class="x_inline"> <label class="x_inline">
<input type="radio" name="anonymous_voter" value="N" checked="checked"|cond="$config->anonymous_voter === 'N'" /> {$lang->notuse} <input type="radio" name="anonymous_voter" value="N" checked="checked"|cond="$config->anonymous_voter === 'N'" /> {$lang->notuse}
@ -70,11 +70,23 @@
<p class="x_help-block">{$lang->about_anonymous_voter}</p> <p class="x_help-block">{$lang->about_anonymous_voter}</p>
</div> </div>
</div> </div>
<div class="x_control-group">
<label class="x_control-label">{$lang->anonymous_scrap}</label>
<div class="x_controls">
<label class="x_inline">
<input type="radio" name="anonymous_scrap" value="Y" checked="checked"|cond="$config->anonymous_scrap !== 'N'" /> {$lang->use}
</label>
<label class="x_inline">
<input type="radio" name="anonymous_scrap" value="N" checked="checked"|cond="$config->anonymous_scrap === 'N'" /> {$lang->notuse}
</label>
<p class="x_help-block">{$lang->about_anonymous_scrap}</p>
</div>
</div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->highlight_effect}</label> <label class="x_control-label">{$lang->highlight_effect}</label>
<div class="x_controls"> <div class="x_controls">
<label class="x_inline"> <label class="x_inline">
<input type="radio" name="highlight_effect" value="Y" checked="checked"|cond="$config->highlight_effect === 'Y'" /> {$lang->use} <input type="radio" name="highlight_effect" value="Y" checked="checked"|cond="$config->highlight_effect !== 'N'" /> {$lang->use}
</label> </label>
<label class="x_inline"> <label class="x_inline">
<input type="radio" name="highlight_effect" value="N" checked="checked"|cond="$config->highlight_effect === 'N'" /> {$lang->notuse} <input type="radio" name="highlight_effect" value="N" checked="checked"|cond="$config->highlight_effect === 'N'" /> {$lang->notuse}

View file

@ -37,6 +37,13 @@
<label for="vote_sms" class="x_inline" disabled="disabled"|cond="!$sms_available"><input type="checkbox" name="use[vote][sms]" id="vote_sms" value="1" disabled="disabled"|cond="!$sms_available" checked="checked"|cond="isset($config->use['vote']['sms'])" /> {$lang->cmd_sms_notify}</label> <label for="vote_sms" class="x_inline" disabled="disabled"|cond="!$sms_available"><input type="checkbox" name="use[vote][sms]" id="vote_sms" value="1" disabled="disabled"|cond="!$sms_available" checked="checked"|cond="isset($config->use['vote']['sms'])" /> {$lang->cmd_sms_notify}</label>
<label for="vote_push" class="x_inline" disabled="disabled"|cond="!$push_available"><input type="checkbox" name="use[vote][push]" id="vote_push" value="1" disabled="disabled"|cond="!$push_available" checked="checked"|cond="isset($config->use['vote']['push'])" /> {$lang->cmd_push_notify}</label> <label for="vote_push" class="x_inline" disabled="disabled"|cond="!$push_available"><input type="checkbox" name="use[vote][push]" id="vote_push" value="1" disabled="disabled"|cond="!$push_available" checked="checked"|cond="isset($config->use['vote']['push'])" /> {$lang->cmd_push_notify}</label>
</div> </div>
<label class="x_control-label">{$lang->ncenterlite_cmd_scrap}</label>
<div class="x_controls">
<label for="scrap_web" class="x_inline"><input type="checkbox" name="use[scrap][web]" id="scrap_web" value="1" checked="checked"|cond="isset($config->use['scrap']['web'])" /> {$lang->cmd_web_notify}</label>
<label for="scrap_mail" class="x_inline"><input type="checkbox" name="use[scrap][mail]" id="scrap_mail" value="1" checked="checked"|cond="isset($config->use['scrap']['mail'])" /> {$lang->cmd_mail_notify}</label>
<label for="scrap_sms" class="x_inline" disabled="disabled"|cond="!$sms_available"><input type="checkbox" name="use[scrap][sms]" id="scrap_sms" value="1" disabled="disabled"|cond="!$sms_available" checked="checked"|cond="isset($config->use['scrap']['sms'])" /> {$lang->cmd_sms_notify}</label>
<label for="scrap_push" class="x_inline" disabled="disabled"|cond="!$push_available"><input type="checkbox" name="use[scrap][push]" id="scrap_push" value="1" disabled="disabled"|cond="!$push_available" checked="checked"|cond="isset($config->use['scrap']['push'])" /> {$lang->cmd_push_notify}</label>
</div>
<label class="x_control-label">{$lang->ncenterlite_message_noti}</label> <label class="x_control-label">{$lang->ncenterlite_message_noti}</label>
<div class="x_controls"> <div class="x_controls">
<label for="message_web" class="x_inline"><input type="checkbox" name="use[message][web]" id="message_web" value="1" checked="checked"|cond="isset($config->use['message']['web'])" /> {$lang->cmd_web_notify}</label> <label for="message_web" class="x_inline"><input type="checkbox" name="use[message][web]" id="message_web" value="1" checked="checked"|cond="isset($config->use['message']['web'])" /> {$lang->cmd_web_notify}</label>