diff --git a/modules/ncenterlite/lang/en.php b/modules/ncenterlite/lang/en.php index 8d1cc10f8..3c511549e 100644 --- a/modules/ncenterlite/lang/en.php +++ b/modules/ncenterlite/lang/en.php @@ -50,6 +50,7 @@ $lang->ncenterlite_date['5'] = 'second'; $lang->ncenterlite_sir = ' '; $lang->ncenterlite_message = 'You have %s new notification.'; $lang->ncenterlite_messages = 'You have %s new notifications.'; +$lang->ncenterlite_not_have_message = 'You have read all the notifications.'; $lang->ncenterlite_thisistest = '[*] This is a test notice.'; $lang->ncenterlite_delete_all = 'delete all'; $lang->ncenterlite_more = 'More'; @@ -72,6 +73,8 @@ $lang->ncenterlite_display_pc = 'Only PC'; $lang->ncenterlite_display_mobile = 'Only Mobile'; $lang->ncenterlite_display_none = 'Not display.'; $lang->ncenterlite_display_about = 'You can hide notifications from Notification Center Lite if you are using a layout or widget that handles notifications for you.'; +$lang->ncenterlite_always_display = 'Always ncenterlite display'; +$lang->ncenterlite_always_display_about = 'This feature allows there to display the Notification Center even if there is no notification of the user.'; $lang->ncenterlite_mention_target = 'Mention target'; $lang->ncenterlite_mention_target_about = 'Mention target can be nicknames or IDs (@Nickname or @ID).'; $lang->ncenterlite_skin_settings = 'Skin settings'; diff --git a/modules/ncenterlite/lang/ko.php b/modules/ncenterlite/lang/ko.php index 7bf194d5d..5660a6116 100644 --- a/modules/ncenterlite/lang/ko.php +++ b/modules/ncenterlite/lang/ko.php @@ -60,6 +60,7 @@ $lang->ncenterlite_date['5'] = '초'; $lang->ncenterlite_sir = '님'; $lang->ncenterlite_message = '%s개의 알림이 있습니다.'; $lang->ncenterlite_messages = '%s개의 알림이 있습니다.'; +$lang->ncenterlite_not_have_message = '알림을 모두 읽으셨습니다.'; $lang->ncenterlite_thisistest = '[*] 시험용 알림입니다'; $lang->ncenterlite_delete_all = '모두 삭제'; $lang->ncenterlite_more = '더보기'; @@ -82,6 +83,8 @@ $lang->ncenterlite_display_pc = 'PC만 표시'; $lang->ncenterlite_display_mobile = '모바일만 표시'; $lang->ncenterlite_display_none = '표시하지 않음'; $lang->ncenterlite_display_about = '사용하는 레이아웃이나 위젯에 알림을 표시하는 기능이 있는 경우 중복을 막기 위해 알림센터의 알림을 숨길 수 있습니다.'; +$lang->ncenterlite_always_display = '알림센터 항상 표기'; +$lang->ncenterlite_always_display_about = '이 기능을 사용할 경우 유저들의 알림이 없을 경우에도 알림센터를 출력합니다.'; $lang->ncenterlite_mention_target = '멘션 타겟'; $lang->ncenterlite_mention_target_about = '멘션 알림을 @아이디 소유자에게 보낼지 @닉네임 소유자에게 보낼지 선택할 수 있습니다.'; $lang->ncenterlite_skin_settings = '스킨 설정'; diff --git a/modules/ncenterlite/m.skins/default/ncenterlite.html b/modules/ncenterlite/m.skins/default/ncenterlite.html index 07c776b5d..ec535c639 100644 --- a/modules/ncenterlite/m.skins/default/ncenterlite.html +++ b/modules/ncenterlite/m.skins/default/ncenterlite.html @@ -12,6 +12,8 @@ {sprintf($lang->ncenterlite_messages, $ncenterlite_page_navigation->total_count)} + + {$lang->ncenterlite_not_have_message} {sprintf($lang->ncenterlite_message, $ncenterlite_page_navigation->total_count)} diff --git a/modules/ncenterlite/ncenterlite.admin.controller.php b/modules/ncenterlite/ncenterlite.admin.controller.php index edf5b4d23..a768366ee 100644 --- a/modules/ncenterlite/ncenterlite.admin.controller.php +++ b/modules/ncenterlite/ncenterlite.admin.controller.php @@ -10,6 +10,7 @@ class ncenterliteAdminController extends ncenterlite $config_vars = array( 'use', 'display_use', + 'always_display', 'user_config_list', 'mention_names', 'mention_suffixes', diff --git a/modules/ncenterlite/ncenterlite.controller.php b/modules/ncenterlite/ncenterlite.controller.php index e0f01cb63..9597b36b5 100644 --- a/modules/ncenterlite/ncenterlite.controller.php +++ b/modules/ncenterlite/ncenterlite.controller.php @@ -53,11 +53,13 @@ class ncenterliteController extends ncenterlite $this->setMessage('success_updated'); - if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) + if (Context::get('success_return_url')) { - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act', 'dispNcenterliteUserConfig', 'member_srl', $member_srl); - header('location: ' . $returnUrl); - return; + $this->setRedirectUrl(Context::get('success_return_url')); + } + else + { + $this->setRedirectUrl(getNotEncodedUrl('act', 'dispNcenterliteUserConfig', 'member_srl', $member_srl)); } } @@ -80,6 +82,13 @@ class ncenterliteController extends ncenterlite { $this->removeFlagFile($args->member_srl); } + + // Delete to user setting. + $userSetOutput = executeQuery('ncenterlite.deleteNcenterliteUserSettingData', $args); + if(!$userSetOutput->toBool()) + { + return $userSetOutput; + } } function triggerAfterInsertDocument(&$obj) @@ -194,6 +203,10 @@ class ncenterliteController extends ncenterlite { $obj->admin_comment_notify = true; } + else + { + return $output; + } } } @@ -253,7 +266,11 @@ class ncenterliteController extends ncenterlite $args->regdate = $regdate; $args->target_browser = $module_info->browser_title; $args->notify = $this->_getNotifyId($args); - $this->_insertNotify($args, $is_anonymous); + $output = $this->_insertNotify($args, $is_anonymous); + if(!$output->toBool()) + { + return $output; + } $notify_member_srls[] = abs($member_srl); } } @@ -297,7 +314,11 @@ class ncenterliteController extends ncenterlite $args->regdate = $regdate; $args->target_browser = $module_info->browser_title; $args->notify = $this->_getNotifyId($args); - $this->_insertNotify($args, $is_anonymous); + $output = $this->_insertNotify($args, $is_anonymous); + if(!$output->toBool()) + { + return $output; + } } } } @@ -341,7 +362,11 @@ class ncenterliteController extends ncenterlite $args->regdate = date('YmdHis'); $args->notify = $this->_getNotifyId($args); $args->target_url = getNotEncodedFullUrl('', 'act', 'dispCommunicationMessages', 'message_srl', $obj->related_srl); - $this->_insertNotify($args); + $output = $this->_insertNotify($args); + if(!$output->toBool()) + { + return $output; + } } function triggerAfterVotedupdate(&$obj) @@ -373,6 +398,10 @@ class ncenterliteController extends ncenterlite $args->notify = $this->_getNotifyId($args); $args->target_url = getNotEncodedFullUrl('', 'document_srl', $obj->document_srl); $output = $this->_insertNotify($args); + if(!$output->toBool()) + { + return $output; + } } function triggerAfterCommentVotedCount($obj) @@ -539,19 +568,6 @@ class ncenterliteController extends ncenterlite { return; } - $this->_hide_ncenterlite = false; - if($oModule->module == 'beluxe' && Context::get('is_modal')) - { - $this->_hide_ncenterlite = true; - } - if($oModule->module == 'bodex' && Context::get('is_iframe')) - { - $this->_hide_ncenterlite = true; - } - if($oModule->getLayoutFile() == 'popup_layout.html') - { - $this->_hide_ncenterlite = true; - } if($oModule->act == 'dispBoardReplyComment') { @@ -635,7 +651,7 @@ class ncenterliteController extends ncenterlite } // 지식인 모듈의 의견 - // TODO: 코드 분리 + // TODO: 지식인 모듈을 사용하는지 안하는지 현재로써는 모르기 때문에 일단은 이 코드를 유지 하였다가 나중에 라이믹스용 지식인이 나온다면 변경하기 if($oModule->act == 'procKinInsertComment') { // 글, 댓글 구분 @@ -671,6 +687,10 @@ class ncenterliteController extends ncenterlite $args->regdate = date('YmdHis'); $args->notify = $this->_getNotifyId($args); $output = $this->_insertNotify($args); + if(!$output->toBool()) + { + return $output; + } } } else if($oModule->act == 'dispKinView' || $oModule->act == 'dispKinIndex') @@ -711,7 +731,6 @@ class ncenterliteController extends ncenterlite function triggerBeforeDisplay(&$output_display) { - $act = Context::get('act'); // 팝업창이면 중지 if(Context::get('ncenterlite_is_popup')) { @@ -719,7 +738,7 @@ class ncenterliteController extends ncenterlite } // 자신의 알림목록을 보고 있을 경우엔 알림센터창을 띄우지 않는다. - if($act == 'dispNcenterliteNotifyList') + if(Context::get('act') == 'dispNcenterliteNotifyList') { return; } @@ -743,7 +762,6 @@ class ncenterliteController extends ncenterlite $module_info = Context::get('module_info'); - // admin 모듈이면 중지 if($module_info->module == 'admin') { @@ -765,23 +783,24 @@ class ncenterliteController extends ncenterlite } // 노티바 제외 페이지이면 중지 - if(in_array($module_info->module_srl, $config->hide_module_srls)) + if(is_array($config->hide_module_srls) && in_array($module_info->module_srl, $config->hide_module_srls)) { return; } Context::set('ncenterlite_config', $config); + + Context::loadFile(array('./modules/ncenterlite/tpl/js/ncenterlite.js', 'body', '', 100000)); - $js_args = array('./modules/ncenterlite/tpl/js/ncenterlite.js', 'body', '', 100000); - Context::loadFile($js_args); - - // 알림 목록 가져오기 $logged_info = Context::get('logged_info'); $_output = $oNcenterliteModel->getMyNotifyList($logged_info->member_srl); - // 알림 메시지가 없어도 항상 표시하게 하려면 이 줄을 제거 또는 주석 처리하세요. - if(!$_output->data) + + if($config->always_display !== 'Y') { - return; + if(!$_output->data) + { + return; + } } $_latest_notify_id = array_slice($_output->data, 0, 1); @@ -848,6 +867,11 @@ class ncenterliteController extends ncenterlite $target_srl = Context::get('target_srl'); $oMemberController->addMemberMenu('dispNcenterliteNotifyList', 'ncenterlite_my_list'); + } + + if($config->user_notify_setting == 'Y') + { + $oMemberController->addMemberMenu('dispNcenterliteUserConfig', 'ncenterlite_my_settings'); if($logged_info->is_admin == 'Y') { @@ -856,11 +880,6 @@ class ncenterliteController extends ncenterlite $oMemberController->addMemberPopupMenu($url, $str, ''); } } - - if($config->user_notify_setting == 'Y') - { - $oMemberController->addMemberMenu('dispNcenterliteUserConfig', 'ncenterlite_my_settings'); - } } function _addFile() @@ -922,7 +941,6 @@ class ncenterliteController extends ncenterlite $args->member_srl = $member_srl; $args->notify = $notify; $output = executeQuery('ncenterlite.updateNotifyReaded', $args); - //$output = executeQuery('ncenterlite.deleteNotify', $args); //Remove flag files $this->removeFlagFile($args->member_srl); @@ -935,7 +953,6 @@ class ncenterliteController extends ncenterlite $args->member_srl = $member_srl; $args->target_srl = $target_srl; $output = executeQuery('ncenterlite.updateNotifyReadedByTargetSrl', $args); - //$output = executeQuery('ncenterlite.deleteNotifyByTargetSrl', $args); //Remove flag files $this->removeFlagFile($args->member_srl); @@ -947,7 +964,6 @@ class ncenterliteController extends ncenterlite $args = new stdClass(); $args->member_srl = $member_srl; $output = executeQuery('ncenterlite.updateNotifyReadedAll', $args); - //$output = executeQuery('ncenterlite.deleteNotifyByMemberSrl', $args); //Remove flag files $this->removeFlagFile($args->member_srl); @@ -1085,23 +1101,18 @@ class ncenterliteController extends ncenterlite } $output = executeQuery('ncenterlite.insertNotify', $args); - if(!$output->toBool()) - { - return $output; - } - else + if($output->toBool()) { ModuleHandler::triggerCall('ncenterlite._insertNotify', 'after', $args); + $this->sendSmsMessage($args); + $this->sendMailMessage($args); + $this->removeFlagFile($args->member_srl); } - $this->sendSmsMessage($args); - $this->sendMailMessage($args); - $this->removeFlagFile($args->member_srl); - return $output; } - public static function updateFlagFile($member_srl = null, $output) + public static function updateFlagFile($member_srl = null, $output = null) { if(!$member_srl) { diff --git a/modules/ncenterlite/ncenterlite.model.php b/modules/ncenterlite/ncenterlite.model.php index 6037ec8d9..8dded7870 100644 --- a/modules/ncenterlite/ncenterlite.model.php +++ b/modules/ncenterlite/ncenterlite.model.php @@ -76,7 +76,7 @@ class ncenterliteModel extends ncenterlite return self::$config; } - function getNotifyTypebySrl($notify_srl='') + function getNotifyTypebySrl($notify_srl) { $args = new stdClass(); $args->notify_type_srl = $notify_srl; @@ -86,7 +86,7 @@ class ncenterliteModel extends ncenterlite return $output; } - function getNotifyTypeString($notify_srl='',$notify_args) + function getNotifyTypeString($notify_srl, $notify_args) { $this->notify_args = $notify_args; @@ -113,7 +113,7 @@ class ncenterliteModel extends ncenterlite return $this->notify_args->{$match[1]}; } - function isNotifyTypeExistsbySrl($notify_srl='') + function isNotifyTypeExistsbySrl($notify_srl) { $args = new stdClass(); $args->notify_type_srl = $notify_srl; @@ -229,6 +229,8 @@ class ncenterliteModel extends ncenterlite function _getMyNotifyList($member_srl=null, $page=1, $readed='N') { + $oNcenterliteController = getController('ncenterlite'); + if(!$member_srl) { if (!Context::get('is_logged')) @@ -262,7 +264,6 @@ class ncenterliteModel extends ncenterlite if($create_time <= $deleteOutput->regdate) { - $oNcenterliteController = getController('ncenterlite'); $oNcenterliteController->removeFlagFile($member_srl); } else @@ -292,12 +293,17 @@ class ncenterliteModel extends ncenterlite if (Rhymix\Framework\Cache::getDriverName() !== 'dummy') { - Rhymix\Framework\Cache::set($cache_key, $output); + if($page <= 1) + { + Rhymix\Framework\Cache::set($cache_key, $output); + } } - elseif($page <= 1) + else { - $oNcenterliteController = getController('ncenterlite'); - $oNcenterliteController->updateFlagFile($member_srl, $output); + if($page <= 1) + { + $oNcenterliteController->updateFlagFile($member_srl, $output); + } } return $output; @@ -407,29 +413,27 @@ class ncenterliteModel extends ncenterlite */ public function getNotificationText($notification) { - global $lang; - // Get the type of notification. switch ($notification->type) { // Document. case 'D': - $type = $lang->ncenterlite_document; + $type = lang('ncenterlite_document'); break; // Comment. case 'C': - $type = $lang->ncenterlite_comment; + $type = lang('ncenterlite_comment'); break; // Message. case 'E': - $type = $lang->ncenterlite_type_message; + $type = lang('ncenterlite_type_message'); break; // Test. case 'T': - $type = $lang->ncenterlite_type_test; + $type = lang('ncenterlite_type_test'); break; // Custom string. @@ -438,16 +442,16 @@ class ncenterliteModel extends ncenterlite // Insert member case 'I': - $type = $lang->cmd_signup; + $type = lang('cmd_signup'); break; // Custom language. case 'Y': - return $lang->{$notification->target_body}; + return lang($notification->target_body); // Custom language with string interpolation. case 'Z': - return vsprintf($lang->{$notification->target_body}, array( + return vsprintf(lang($notification->target_body), array( $notification->target_member_srl, // %1$d $notification->target_nick_name, // %2$s $notification->target_user_id, // %3$s @@ -468,63 +472,63 @@ class ncenterliteModel extends ncenterlite { // Comment on your document. case 'C': - $str = sprintf($lang->ncenterlite_commented, $notification->target_nick_name, $type, $notification->target_summary); + $str = sprintf(lang('ncenterlite_commented'), $notification->target_nick_name, $type, $notification->target_summary); break; // Comment on a board. case 'A': - $str = sprintf($lang->ncenterlite_commented_board, $notification->target_nick_name, $notification->target_browser, $notification->target_summary); + $str = sprintf(lang('ncenterlite_commented_board'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary); break; // Mentioned. case 'M': - $str = sprintf($lang->ncenterlite_mentioned, $notification->target_nick_name, $notification->target_browser, $notification->target_summary, $type); + $str = sprintf(lang('ncenterlite_mentioned'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary, $type); break; // Message arrived. case 'E': - $str = sprintf($lang->ncenterlite_message_mention, $notification->target_nick_name, $notification->target_summary); + $str = sprintf(lang('ncenterlite_message_mention'), $notification->target_nick_name, $notification->target_summary); break; // Test notification. case 'T': - $str = sprintf($lang->ncenterlite_test_noti, $notification->target_nick_name); + $str = sprintf(lang('ncenterlite_test_noti'), $notification->target_nick_name); break; // New document on a board. case 'P': - $str = sprintf($lang->ncenterlite_board, $notification->target_nick_name, $notification->target_browser, $notification->target_summary); + $str = sprintf(lang('ncenterlite_board'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary); break; // New document. case 'S': if($notification->target_browser) { - $str = sprintf($lang->ncenterlite_board, $notification->target_nick_name, $notification->target_browser, $notification->target_summary); + $str = sprintf(lang('ncenterlite_board'), $notification->target_nick_name, $notification->target_browser, $notification->target_summary); } else { - $str = sprintf($lang->ncenterlite_article, $notification->target_nick_name, $notification->target_summary); + $str = sprintf(lang('ncenterlite_article'), $notification->target_nick_name, $notification->target_summary); } break; // Voted. case 'V': - $str = sprintf($lang->ncenterlite_vote, $notification->target_nick_name, $notification->target_summary, $type); + $str = sprintf(lang('ncenterlite_vote'), $notification->target_nick_name, $notification->target_summary, $type); break; // Admin notification. 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); break; case 'I': - $str = sprintf($lang->ncenterlite_insert_member_message, $notification->target_nick_name); + $str = sprintf(lang('ncenterlite_insert_member_message'), $notification->target_nick_name); break; // Other. default: - $str = $lang->ncenterlite; + $str = lang('ncenterlite'); } return $str; diff --git a/modules/ncenterlite/queries/deleteNcenterliteUserSettingData.xml b/modules/ncenterlite/queries/deleteNcenterliteUserSettingData.xml new file mode 100644 index 000000000..1c3784d11 --- /dev/null +++ b/modules/ncenterlite/queries/deleteNcenterliteUserSettingData.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/modules/ncenterlite/queries/deleteNotify.xml b/modules/ncenterlite/queries/deleteNotify.xml deleted file mode 100644 index 53f3b42a6..000000000 --- a/modules/ncenterlite/queries/deleteNotify.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml b/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml deleted file mode 100644 index 202147b77..000000000 --- a/modules/ncenterlite/queries/deleteNotifyByTargetSrl.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/modules/ncenterlite/skins/default/ncenterlite.html b/modules/ncenterlite/skins/default/ncenterlite.html index 39d6ebe10..9351c3b15 100644 --- a/modules/ncenterlite/skins/default/ncenterlite.html +++ b/modules/ncenterlite/skins/default/ncenterlite.html @@ -12,6 +12,8 @@ {sprintf($lang->ncenterlite_messages, $ncenterlite_page_navigation->total_count)} + + {$lang->ncenterlite_not_have_message} {sprintf($lang->ncenterlite_message, $ncenterlite_page_navigation->total_count)} diff --git a/modules/ncenterlite/skins/default_bottom/ncenterlite.html b/modules/ncenterlite/skins/default_bottom/ncenterlite.html index b4a5b5703..4a767dfe3 100644 --- a/modules/ncenterlite/skins/default_bottom/ncenterlite.html +++ b/modules/ncenterlite/skins/default_bottom/ncenterlite.html @@ -12,6 +12,8 @@ {sprintf($lang->ncenterlite_messages, $ncenterlite_page_navigation->total_count)} + + {$lang->ncenterlite_not_have_message} {sprintf($lang->ncenterlite_message, $ncenterlite_page_navigation->total_count)} diff --git a/modules/ncenterlite/tpl/config.html b/modules/ncenterlite/tpl/config.html index e5f06c1a9..1595f1d7c 100644 --- a/modules/ncenterlite/tpl/config.html +++ b/modules/ncenterlite/tpl/config.html @@ -68,6 +68,18 @@ {$lang->ncenterlite_display_about} + + {$lang->ncenterlite_always_display} + + + always_display == 'Y'" /> {$lang->use} + + + always_display != 'Y'" /> {$lang->notuse} + + {$lang->ncenterlite_always_display_about} + + {$lang->member_menu_view}
{$lang->ncenterlite_display_about}
{$lang->ncenterlite_always_display_about}