Support user config of notification types, fixes #994

코어에서 지원하는 알림 종류 및 알림 수신 방법이 늘어남에 따라,
관리자가 설정한 범위 내에서 회원들이 알림 수신 방법을 선택할 수 있도록 합니다.
기존에는 수신 여부만 선택할 수 있었으나 이제 더 세부적인 설정이 가능합니다.
예를 들어 웹 알림과 푸시알림은 받고, 메일 알림과 문자 알림은 끌 수 있습니다.

이 기능을 지원하기 위해 ncenterlite_user_set 테이블 스키마를 대폭 조정합니다.
기존 설정은 가능하면 그대로 유지하려고 노력하였습니다.
This commit is contained in:
Kijin Sung 2020-12-17 23:41:31 +09:00
parent 3032784ca7
commit c52187a8f2
14 changed files with 435 additions and 531 deletions

View file

@ -20,78 +20,33 @@
</h1>
<p>{$lang->ncenterlite_userconfig_about} <strong style="color:#ff0000" cond="$member_srl && $member_srl != $logged_info->member_srl">({$lang->ncenterlite_userconfig_about_warning})</strong></p>
<div class="control-group">
<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 != '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}
</label>
<p class="help-block">{$lang->ncenterlite_comment_noti_about}</p>
</div>
</div>
<div class="control-group">
<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 != '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}
</label>
<p class="help-block">{$lang->ncenterlite_mention_noti_about}</p>
</div>
</div>
<div class="control-group">
<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 != '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}
</label>
<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>
{@ $uc = get_object_vars($user_config)}
<!--@foreach($notify_types as $notify_type => $notify_srl)-->
<!--@if($notify_type !== 'admin_content' && $notify_type !== 'custom')-->
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
{@ $available = isset($module_config->use[$notify_type]['web']) && $module_config->use[$notify_type]['web'] !== 'N'}
{@ $selected = in_array('web', $uc[$notify_type])}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][web]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_web_notify}</label>
{@ $available = isset($module_config->use[$notify_type]['mail']) && $module_config->use[$notify_type]['mail'] !== 'N'}
{@ $selected = in_array('mail', $uc[$notify_type])}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][mail]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_mail_notify}</label>
<!--@if($sms_available)-->
{@ $available = isset($module_config->use[$notify_type]['sms']) && $module_config->use[$notify_type]['sms'] !== 'N'}
{@ $selected = in_array('sms', $uc[$notify_type])}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][sms]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_sms_notify}</label>
<!--@endif-->
<!--@if($push_available)-->
{@ $available = isset($module_config->use[$notify_type]['push']) && $module_config->use[$notify_type]['push'] !== 'N'}
{@ $selected = in_array('push', $uc[$notify_type])}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][push]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_push_notify}</label>
<!--@endif-->
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
</div>
<!--@endif-->
<!--@endforeach-->
</section>
<div class="clearfix btnArea">
<div class="pull-right">