diff --git a/common/framework/push.php b/common/framework/push.php index 041e90276..8dc5c247f 100644 --- a/common/framework/push.php +++ b/common/framework/push.php @@ -17,6 +17,9 @@ class Push protected $click_action = ''; protected $data = []; protected $errors = array(); + protected $success_tokens = array(); + protected $deleted_tokens = array(); + protected $updated_tokens = array(); protected $sent = false; /** @@ -284,12 +287,14 @@ class Push try { $tokens = $this->_getDeviceTokens(); + $output = null; + // Android FCM if(count($tokens->android)) { $fcm_driver = $this->getDriver('fcm'); $output = $fcm_driver->send($this, $tokens->android); - $this->sent = $output->invalid ? false : true; + $this->sent = count($output->success) ? true : false; $this->_deleteInvalidTokens($output->invalid); $this->_updateDeviceTokens($output->needUpdate); } @@ -299,10 +304,14 @@ class Push { $apns_driver =$this->getDriver('apns'); $output = $apns_driver->send($this, $tokens->ios); - $this->sent = $output->invalid ? false : true; + $this->sent = count($output->success) ? true : false; $this->_deleteInvalidTokens($output->invalid); $this->_updateDeviceTokens($output->needUpdate); } + + $this->success_tokens = $output ? $output->success : []; + $this->deleted_tokens = $output ? $output->invalid : []; + $this->updated_tokens = $output ? $output->needUpdate : []; } catch(\Exception $e) { @@ -428,6 +437,36 @@ class Push return $this->errors; } + /** + * Get success tokens. + * + * @return array + */ + public function getSuccessTokens(): array + { + return $this->success_tokens; + } + + /** + * Get deleted tokens. + * + * @return array + */ + public function getDeletedTokens(): array + { + return $this->deleted_tokens; + } + + /** + * Get updated tokens. + * + * @return array + */ + public function getUpdatedTokens(): array + { + return $this->updated_tokens; + } + /** * Add an error message. * diff --git a/modules/advanced_mailer/advanced_mailer.admin.controller.php b/modules/advanced_mailer/advanced_mailer.admin.controller.php index 3e575e3fe..30166ecc5 100644 --- a/modules/advanced_mailer/advanced_mailer.admin.controller.php +++ b/modules/advanced_mailer/advanced_mailer.admin.controller.php @@ -22,6 +22,8 @@ class Advanced_MailerAdminController extends Advanced_Mailer $config->log_errors = toBool($vars->log_errors); $config->log_sent_sms = toBool($vars->log_sent_sms); $config->log_sms_errors = toBool($vars->log_sms_errors); + $config->log_sent_push = toBool($vars->log_sent_push); + $config->log_push_errors = toBool($vars->log_push_errors); $output = getController('module')->insertModuleConfig('advanced_mailer', $config); if ($output->toBool()) { @@ -208,12 +210,35 @@ class Advanced_MailerAdminController extends Advanced_Mailer } } + /** + * Clear old Push sending log. + */ + public function procAdvanced_mailerAdminClearSentPush() + { + $status = Context::get('status'); + $clear_before_days = intval(Context::get('clear_before_days')); + if (!in_array($status, array('success', 'error'))) + { + $status = null; + } + if ($clear_before_days < 0) + { + throw new Rhymix\Framework\Exceptions\InvalidRequest; + } + + $obj = new stdClass(); + $obj->status = $status; + $obj->regdate = date('YmdHis', time() - ($clear_before_days * 86400) + zgap()); + $output = executeQuery('advanced_mailer.deletePushLogs', $obj); + + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminPushLog', 'status', $status)); + } + /** * Send a test mail. */ public function procAdvanced_MailerAdminTestSendMail() { - $advanced_mailer_config = $this->getConfig(); $recipient_config = Context::gets('recipient_name', 'recipient_email'); $recipient_name = $recipient_config->recipient_name; $recipient_email = $recipient_config->recipient_email; @@ -289,7 +314,6 @@ class Advanced_MailerAdminController extends Advanced_Mailer */ public function procAdvanced_MailerAdminTestSendSMS() { - $advanced_mailer_config = $this->getConfig(); $recipient_number = Context::get('recipient_number'); $country_code = intval(Context::get('country_code')); $content = trim(Context::get('content')); @@ -335,4 +359,79 @@ class Advanced_MailerAdminController extends Advanced_Mailer $this->add('test_result', Context::getLang('msg_advanced_mailer_test_success_sms')); return; } + + /** + * Send a test Push Notification. + */ + public function procAdvanced_MailerAdminTestSendPush() + { + $recipient_user_id = Context::get('recipient_user_id'); + $subject = trim(Context::get('subject')); + $content = trim(Context::get('content')); + $url = trim(Context::get('url')); + + $member_info = MemberModel::getMemberInfoByUserID($recipient_user_id); + if (!$member_info || !$member_info->member_srl) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_user_id_not_found')); + return; + } + + $args = new stdClass; + $args->member_srl = $member_info->member_srl; + $output = executeQueryArray('member.getMemberDeviceTokensByMemberSrl', $args); + if (!$output->toBool() || !count($output->data)) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_has_no_devices')); + return; + } + + if (!$subject) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_subject_is_empty')); + return; + } + if (!$content) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_content_is_empty')); + return; + } + if (!$url || !Rhymix\Framework\URL::isInternalURL($url)) + { + $this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_url_is_invalid')); + return; + } + + try + { + $oPush = new Rhymix\Framework\Push; + $oPush->addTo($member_info->member_srl); + $oPush->setSubject($subject); + $oPush->setContent($content); + $oPush->setURL($url); + $result = $oPush->send(); + + if (!$result) + { + if (count($oPush->getErrors())) + { + $this->add('test_result', nl2br(htmlspecialchars(implode("\n", $oPush->getErrors())))); + return; + } + else + { + $this->add('test_result', Context::getLang('msg_advanced_mailer_unknown_error')); + return; + } + } + } + catch (Exception $e) + { + $this->add('test_result', nl2br(htmlspecialchars($e->getMessage()))); + return; + } + + $this->add('test_result', Context::getLang('msg_advanced_mailer_test_success_sms')); + return; + } } diff --git a/modules/advanced_mailer/advanced_mailer.admin.view.php b/modules/advanced_mailer/advanced_mailer.admin.view.php index 2d96386be..2f8c0eb99 100644 --- a/modules/advanced_mailer/advanced_mailer.admin.view.php +++ b/modules/advanced_mailer/advanced_mailer.admin.view.php @@ -245,6 +245,41 @@ class Advanced_MailerAdminView extends Advanced_Mailer $this->setTemplateFile('sms_log'); } + /** + * Display the Push test form. + */ + public function dispAdvanced_MailerAdminPushTest() + { + $advanced_mailer_config = $this->getConfig(); + Context::set('advanced_mailer_config', $advanced_mailer_config); + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('push_test'); + } + + /** + * Display the Push log. + */ + public function dispAdvanced_MailerAdminPushLog() + { + $obj = new stdClass(); + $obj->status = preg_replace('/[^a-z]/', '', Context::get('status')) ?: null; + $obj->page = $page = Context::get('page') ?: 1; + $pushlog = executeQueryArray('advanced_mailer.getPushLogByType', $obj); + $pushlog = $pushlog->toBool() ? $pushlog->data : array(); + Context::set('advanced_mailer_log', $pushlog); + Context::set('advanced_mailer_status', $obj->status); + + $paging = $this->procPaging($obj->status, 'push', $page); + Context::set('total_count', $paging->total_count); + Context::set('total_page', $paging->total_page); + Context::set('page', $paging->page); + Context::set('page_navigation', $paging->page_navigation); + + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('push_log'); + } + /** * Process mail log for display. */ @@ -295,10 +330,14 @@ class Advanced_MailerAdminView extends Advanced_Mailer { $count = executeQuery('advanced_mailer.countMailLogByType', $args); } - else + elseif ($type === 'sms') { $count = executeQuery('advanced_mailer.countSMSLogByType', $args); } + else + { + $count = executeQuery('advanced_mailer.countPushLogByType', $args); + } $total_count = $count->data->count; $total_page = max(1, ceil($total_count / 20)); diff --git a/modules/advanced_mailer/advanced_mailer.class.php b/modules/advanced_mailer/advanced_mailer.class.php index b63f0f45a..21f030df3 100644 --- a/modules/advanced_mailer/advanced_mailer.class.php +++ b/modules/advanced_mailer/advanced_mailer.class.php @@ -200,6 +200,10 @@ class Advanced_Mailer extends ModuleObject { $oModuleController->insertTrigger('sms.send', 'advanced_mailer', 'controller', 'triggerAfterSMSSend', 'after'); } + if (!$oModuleModel->getTrigger('push.send', 'advanced_mailer', 'controller', 'triggerAfterPushSend', 'after')) + { + $oModuleController->insertTrigger('push.send', 'advanced_mailer', 'controller', 'triggerAfterPushSend', 'after'); + } } /** @@ -232,6 +236,10 @@ class Advanced_Mailer extends ModuleObject { return true; } + if (!$oModuleModel->getTrigger('push.send', 'advanced_mailer', 'controller', 'triggerAfterPushSend', 'after')) + { + return true; + } return false; } diff --git a/modules/advanced_mailer/advanced_mailer.controller.php b/modules/advanced_mailer/advanced_mailer.controller.php index b14930bc8..c8207b60c 100644 --- a/modules/advanced_mailer/advanced_mailer.controller.php +++ b/modules/advanced_mailer/advanced_mailer.controller.php @@ -190,4 +190,52 @@ class Advanced_MailerController extends Advanced_Mailer } } } + + /** + * After Push send trigger. + */ + public function triggerAfterPushSend($push) + { + $config = $this->getConfig(); + + if (toBool($config->log_sent_push) || (toBool($config->log_push_errors) && count($push->getErrors()))) + { + $obj = new \stdClass(); + $obj->push_from = $push->getFrom(); + $token_count = count($push->getSuccessTokens()) + count($push->getDeletedTokens()) + count($push->getUpdatedTokens()); + $obj->push_to = sprintf('%d members, %d devices', count($push->getRecipients()), $token_count); + $obj->push_to .= "\n\n" . 'members: ' . implode(', ', $push->getRecipients()); + if (count($push->getSuccessTokens())) + { + $obj->push_to .= "\n\n" . 'success: ' . "\n"; + $obj->push_to .= implode("\n", array_keys($push->getSuccessTokens())); + } + if (count($push->getDeletedTokens())) + { + $obj->push_to .= "\n\n" . 'deleted: ' . "\n"; + $obj->push_to .= implode("\n", array_keys($push->getDeletedTokens())); + } + if (count($push->getUpdatedTokens())) + { + $obj->push_to .= "\n\n" . 'updated: ' . "\n"; + foreach ($push->getUpdatedTokens() as $from => $to) + { + $obj->push_to .= $from . ' => ' . $to . "\n"; + } + } + $obj->subject = trim($push->getSubject()); + $obj->content = trim($push->getContent()); + $obj->calling_script = $push->getCaller(); + $obj->success_count = count($push->getSuccessTokens()); + $obj->deleted_count = count($push->getDeletedTokens()); + $obj->updated_count = count($push->getUpdatedTokens()); + $obj->status = $push->isSent() ? 'success' : 'error'; + $obj->errors = count($push->getErrors()) ? implode("\n", $push->getErrors()) : null; + $output = executeQuery('advanced_mailer.insertPushLog', $obj); + if (!$output->toBool()) + { + return $output; + } + } + } } diff --git a/modules/advanced_mailer/conf/info.xml b/modules/advanced_mailer/conf/info.xml index 15cfd096e..544617303 100644 --- a/modules/advanced_mailer/conf/info.xml +++ b/modules/advanced_mailer/conf/info.xml @@ -1,15 +1,15 @@ - 고급 메일 발송 모듈 (메일 및 SMS 관리) - Advanced Mailer (with SMS) + 메일, SMS 및 푸시 알림 관리 모듈 + Mail, SMS and Push Notification Manager - 라이믹스에서 발송하는 메일과 SMS를 기록하고 테스트하는 기능을 제공합니다. + 라이믹스에서 발송하는 메일, SMS, 푸시 알림 등을 기록하고 테스트하는 기능을 제공합니다. - Log and test e-mails and SMS sent from Rhymix. + Log and test e-mails, SMS, and push notifications sent from Rhymix. - 2.1.0 - 2016-12-14 + 2.2.0 + 2020-06-25 포에시스 POESIS diff --git a/modules/advanced_mailer/conf/module.xml b/modules/advanced_mailer/conf/module.xml index 5553ffb1a..3ef2a7628 100644 --- a/modules/advanced_mailer/conf/module.xml +++ b/modules/advanced_mailer/conf/module.xml @@ -11,14 +11,18 @@ + + + + diff --git a/modules/advanced_mailer/lang/en.php b/modules/advanced_mailer/lang/en.php index 1d01d5fc0..c57035f64 100644 --- a/modules/advanced_mailer/lang/en.php +++ b/modules/advanced_mailer/lang/en.php @@ -1,5 +1,5 @@ cmd_advanced_mailer = 'Advanced Mailer (with SMS)'; +$lang->cmd_advanced_mailer = 'Mail, SMS and Push Notification Manager'; $lang->cmd_advanced_mailer_general_config = 'General settings'; $lang->cmd_advanced_mailer_is_enabled = 'Enable module'; $lang->cmd_advanced_mailer_is_enabled_yes = 'Enabled'; @@ -9,6 +9,8 @@ $lang->cmd_advanced_mailer_log_mail = 'Log Mail'; $lang->cmd_advanced_mailer_log_mail_errors = 'Log Mail Errors'; $lang->cmd_advanced_mailer_log_sms = 'Log SMS'; $lang->cmd_advanced_mailer_log_sms_errors = 'Log SMS Errors'; +$lang->cmd_advanced_mailer_log_push = 'Log Push'; +$lang->cmd_advanced_mailer_log_push_errors = 'Log Push Errors'; $lang->cmd_advanced_mailer_log_yes = 'Yes'; $lang->cmd_advanced_mailer_log_no = 'No'; $lang->cmd_advanced_mailer_sending_method_config = 'Default Sending Method'; @@ -70,6 +72,7 @@ $lang->cmd_advanced_mailer_ellipsis = '(see API for full value)'; $lang->cmd_advanced_mailer_mail_test = 'Mail Test'; $lang->cmd_advanced_mailer_recipient_name = 'Recipient\'s name'; $lang->cmd_advanced_mailer_recipient_email = 'Recipient\'s email'; +$lang->cmd_advanced_mailer_recipient_user_id = 'Recipient\'s user ID'; $lang->cmd_advanced_mailer_send = 'Send'; $lang->cmd_advanced_mailer_test_result = 'Test result'; $lang->cmd_advanced_mailer_exception_domains = 'Exception domains'; @@ -104,6 +107,8 @@ $lang->msg_advanced_mailer_recipient_name_is_empty = 'Please enter the recipient $lang->msg_advanced_mailer_recipient_email_is_empty = 'Please enter the recipient\'s email address.'; $lang->msg_advanced_mailer_recipient_email_is_invalid = 'The recipient\'s email address is invalid.'; $lang->msg_advanced_mailer_test_success = 'The test was successful. Please check your email.'; +$lang->cmd_advanced_mailer_test_push_subject = 'Test Notification'; +$lang->cmd_advanced_mailer_test_push_content = 'This is a test notification.'; $lang->msg_advanced_mailer_google_account_security = 'Either your login credentials are incorrect, or the SMTP connection was blocked by Google account security settings.
Please see here for more information.'; $lang->msg_advanced_mailer_naver_smtp_disabled = 'Either your login credentials are incorrect, or POP3/SMTP is not enabled on your Naver account.'; $lang->msg_advanced_mailer_sms_config_invalid = 'There are errors or omissions in the SMS API configuration.'; @@ -114,6 +119,7 @@ $lang->cmd_advanced_mailer_status_sender = 'Sender'; $lang->cmd_advanced_mailer_status_recipient = 'Recipient'; $lang->cmd_advanced_mailer_status_subject = 'Subject'; $lang->cmd_advanced_mailer_status_content = 'Content'; +$lang->cmd_advanced_mailer_status_url = 'URL'; $lang->cmd_advanced_mailer_status_sending_method = 'Method'; $lang->cmd_advanced_mailer_status_time = 'Time'; $lang->cmd_advanced_mailer_status = 'Status'; @@ -130,6 +136,14 @@ $lang->cmd_advanced_mailer_country_code = 'Country code'; $lang->cmd_advanced_mailer_country_code_help = 'Please leave the country code empty if you are sending to a domestic number.'; $lang->cmd_advanced_mailer_test_content = 'This is an SMS test from Rhymix.'; $lang->msg_advanced_mailer_recipient_number_is_empty = 'Please enter a phone number for the recipient.'; -$lang->msg_advanced_mailer_content_is_empty = 'Please enter the content for your test SMS.'; +$lang->msg_advanced_mailer_recipient_user_id_not_found = 'No member matches the user ID you entered.'; +$lang->msg_advanced_mailer_recipient_has_no_devices = 'The user ID you entered has not registered any mobile devices.'; +$lang->msg_advanced_mailer_subject_is_empty = 'Please enter the subject for your test message.'; +$lang->msg_advanced_mailer_content_is_empty = 'Please enter the content for your test message.'; +$lang->msg_advanced_mailer_url_is_invalid = 'Please enter a valid URL that belongs to this site.'; $lang->msg_advanced_mailer_test_success_sms = 'The test was successful. Please check your SMS.'; +$lang->cmd_advanced_mailer_push_test = 'Push Test'; +$lang->cmd_advanced_mailer_success_count = 'Success'; +$lang->cmd_advanced_mailer_deleted_count = 'Deleted'; +$lang->cmd_advanced_mailer_updated_count = 'Updated'; $lang->cmd_advanced_mailer_not_rhymix = 'This module is for XE. It is incompatible with Rhymix. Please use the version included with Rhymix.'; diff --git a/modules/advanced_mailer/lang/ko.php b/modules/advanced_mailer/lang/ko.php index 674defa1a..7400b4550 100644 --- a/modules/advanced_mailer/lang/ko.php +++ b/modules/advanced_mailer/lang/ko.php @@ -1,5 +1,5 @@ cmd_advanced_mailer = '고급 메일 발송 모듈 (메일 및 SMS 관리)'; +$lang->cmd_advanced_mailer = '메일, SMS 및 푸시 알림 관리 모듈'; $lang->cmd_advanced_mailer_general_config = '기본 설정'; $lang->cmd_advanced_mailer_is_enabled = '모듈 사용'; $lang->cmd_advanced_mailer_is_enabled_yes = '사용'; @@ -9,6 +9,8 @@ $lang->cmd_advanced_mailer_log_mail = '메일 발송 내역'; $lang->cmd_advanced_mailer_log_mail_errors = '메일 에러 내역'; $lang->cmd_advanced_mailer_log_sms = 'SMS 발송 내역'; $lang->cmd_advanced_mailer_log_sms_errors = 'SMS 에러 내역'; +$lang->cmd_advanced_mailer_log_push = '푸시 알림 발송 내역'; +$lang->cmd_advanced_mailer_log_push_errors = '푸시 알림 에러 내역'; $lang->cmd_advanced_mailer_log_yes = '기록'; $lang->cmd_advanced_mailer_log_no = '기록하지 않음'; $lang->cmd_advanced_mailer_sending_method_config = '기본 발송 방법 설정'; @@ -70,6 +72,7 @@ $lang->cmd_advanced_mailer_ellipsis = '(중략)'; $lang->cmd_advanced_mailer_mail_test = '메일 테스트'; $lang->cmd_advanced_mailer_recipient_name = '받는이 이름'; $lang->cmd_advanced_mailer_recipient_email = '받는이 메일 주소'; +$lang->cmd_advanced_mailer_recipient_user_id = '받는이 아이디'; $lang->cmd_advanced_mailer_send = '발송'; $lang->cmd_advanced_mailer_test_result = '테스트 결과'; $lang->cmd_advanced_mailer_exception_domains = '예외 도메인'; @@ -104,6 +107,8 @@ $lang->msg_advanced_mailer_recipient_name_is_empty = '받는이 이름을 입력 $lang->msg_advanced_mailer_recipient_email_is_empty = '받는이 메일 주소를 입력해 주십시오.'; $lang->msg_advanced_mailer_recipient_email_is_invalid = '받는이 메일 주소가 올바른 메일 주소가 아닙니다.'; $lang->msg_advanced_mailer_test_success = '테스트에 성공하였습니다. 메일을 확인해 보시기 바랍니다.'; +$lang->cmd_advanced_mailer_test_push_subject = '테스트 알림'; +$lang->cmd_advanced_mailer_test_push_content = '테스트 알림 내용입니다.'; $lang->msg_advanced_mailer_google_account_security = '아이디 또는 비밀번호가 틀렸거나, 구글 보안 설정 때문에 SMTP 접속이 차단되었습니다.
자세한 정보는 여기를 참고하시기 바랍니다.'; $lang->msg_advanced_mailer_naver_smtp_disabled = '아이디 또는 비밀번호가 틀렸거나, 네이버 계정 환경설정에서 POP3/SMTP를 사용하지 않도록 설정되어 있습니다.'; $lang->msg_advanced_mailer_sms_config_invalid = 'SMS API 설정에 잘못되었거나 누락된 부분이 있습니다. 확인해 주십시오.'; @@ -114,6 +119,7 @@ $lang->cmd_advanced_mailer_status_sender = '보낸이'; $lang->cmd_advanced_mailer_status_recipient = '받는이'; $lang->cmd_advanced_mailer_status_subject = '제목'; $lang->cmd_advanced_mailer_status_content = '내용'; +$lang->cmd_advanced_mailer_status_url = 'URL'; $lang->cmd_advanced_mailer_status_sending_method = '발송 방법'; $lang->cmd_advanced_mailer_status_time = '발송 시간'; $lang->cmd_advanced_mailer_status = '상태'; @@ -130,6 +136,14 @@ $lang->cmd_advanced_mailer_country_code = '국가코드'; $lang->cmd_advanced_mailer_country_code_help = '국내 번호로 발송하실 경우 국가코드는 비워 두시기 바랍니다.'; $lang->cmd_advanced_mailer_test_content = '라이믹스 SMS 발송 테스트입니다.'; $lang->msg_advanced_mailer_recipient_number_is_empty = '받는이 전화번호를 입력해 주십시오.'; -$lang->msg_advanced_mailer_content_is_empty = 'SMS 내용을 입력해 주십시오.'; +$lang->msg_advanced_mailer_recipient_user_id_not_found = '입력하신 아이디와 일치하는 회원을 찾을 수 없습니다.'; +$lang->msg_advanced_mailer_recipient_has_no_devices = '입력하신 아이디로 등록된 모바일 기기가 없습니다.'; +$lang->msg_advanced_mailer_subject_is_empty = '제목을 입력해 주십시오.'; +$lang->msg_advanced_mailer_content_is_empty = '내용을 입력해 주십시오.'; +$lang->msg_advanced_mailer_url_is_invalid = '사이트 내부의 URL을 입력해 주십시오.'; $lang->msg_advanced_mailer_test_success_sms = '테스트에 성공하였습니다. SMS를 확인해 보시기 바랍니다.'; +$lang->cmd_advanced_mailer_push_test = '푸시 알림 테스트'; +$lang->cmd_advanced_mailer_success_count = '성공'; +$lang->cmd_advanced_mailer_deleted_count = '삭제'; +$lang->cmd_advanced_mailer_updated_count = '변경'; $lang->cmd_advanced_mailer_not_rhymix = '이 모듈은 XE용으로, 라이믹스와는 호환되지 않습니다. 라이믹스에 기본 포함된 버전을 사용하시기 바랍니다.'; diff --git a/modules/advanced_mailer/queries/countPushLogByType.xml b/modules/advanced_mailer/queries/countPushLogByType.xml new file mode 100644 index 000000000..675a2f38f --- /dev/null +++ b/modules/advanced_mailer/queries/countPushLogByType.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/modules/advanced_mailer/queries/deletePushLogs.xml b/modules/advanced_mailer/queries/deletePushLogs.xml new file mode 100644 index 000000000..12564d107 --- /dev/null +++ b/modules/advanced_mailer/queries/deletePushLogs.xml @@ -0,0 +1,9 @@ + + +
+ + + + + + diff --git a/modules/advanced_mailer/queries/getPushLogByType.xml b/modules/advanced_mailer/queries/getPushLogByType.xml new file mode 100644 index 000000000..c4233a5eb --- /dev/null +++ b/modules/advanced_mailer/queries/getPushLogByType.xml @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + + + + + + diff --git a/modules/advanced_mailer/queries/insertPushLog.xml b/modules/advanced_mailer/queries/insertPushLog.xml new file mode 100644 index 000000000..96c57dfc7 --- /dev/null +++ b/modules/advanced_mailer/queries/insertPushLog.xml @@ -0,0 +1,18 @@ + + +
+ + + + + + + + + + + + + + + diff --git a/modules/advanced_mailer/schemas/advanced_mailer_push_log.xml b/modules/advanced_mailer/schemas/advanced_mailer_push_log.xml new file mode 100644 index 000000000..6b427c475 --- /dev/null +++ b/modules/advanced_mailer/schemas/advanced_mailer_push_log.xml @@ -0,0 +1,14 @@ +
+ + + + + + + + + + + + +
diff --git a/modules/advanced_mailer/tpl/common.html b/modules/advanced_mailer/tpl/common.html index 29ecbd984..cc20017b5 100644 --- a/modules/advanced_mailer/tpl/common.html +++ b/modules/advanced_mailer/tpl/common.html @@ -13,4 +13,6 @@
  • {$lang->cmd_advanced_mailer_sms_test}
  • {$lang->cmd_advanced_mailer_log_sms}
  • {$lang->cmd_advanced_mailer_log_sms_errors}
  • +
  • {$lang->cmd_advanced_mailer_push_test}
  • +
  • {$lang->cmd_advanced_mailer_log_push}
  • diff --git a/modules/advanced_mailer/tpl/config.html b/modules/advanced_mailer/tpl/config.html index 852f118fa..a73331539 100644 --- a/modules/advanced_mailer/tpl/config.html +++ b/modules/advanced_mailer/tpl/config.html @@ -75,6 +75,26 @@ +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    diff --git a/modules/advanced_mailer/tpl/js/config.js b/modules/advanced_mailer/tpl/js/config.js index 9c69b13bd..9728ee8cb 100644 --- a/modules/advanced_mailer/tpl/js/config.js +++ b/modules/advanced_mailer/tpl/js/config.js @@ -46,6 +46,29 @@ ); }); + $("#advanced_mailer_test_send_push").click(function(event) { + event.preventDefault(); + $("#advanced_mailer_test_result").text(""); + $(this).attr("disabled", "disabled"); + var ajax_data = { + recipient_user_id: $("#advanced_mailer_recipient_user_id").val(), + subject: $("#advanced_mailer_subject").val(), + content: $("#advanced_mailer_content").val(), + url: $("#advanced_mailer_url").val() + }; + $.exec_json( + "advanced_mailer.procAdvanced_mailerAdminTestSendPush", ajax_data, + function(response) { + $("#advanced_mailer_test_result").html(response.test_result); + $("#advanced_mailer_test_send").removeAttr("disabled"); + }, + function(response) { + $("#advanced_mailer_test_result").text("AJAX Error"); + $("#advanced_mailer_test_send").removeAttr("disabled"); + } + ); + }); + }); })(jQuery); diff --git a/modules/advanced_mailer/tpl/push_log.html b/modules/advanced_mailer/tpl/push_log.html new file mode 100644 index 000000000..252e7ef03 --- /dev/null +++ b/modules/advanced_mailer/tpl/push_log.html @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + Total: {number_format($total_count)}, Page: {number_format($page)}/{number_format($total_page)} +
    +
    +
    {$lang->cmd_advanced_mailer_status_recipient}{$lang->cmd_advanced_mailer_status_subject}{$lang->cmd_advanced_mailer_status_content}{$lang->cmd_advanced_mailer_success_count}{$lang->cmd_advanced_mailer_deleted_count}{$lang->cmd_advanced_mailer_updated_count}{$lang->cmd_advanced_mailer_status_time}{$lang->cmd_advanced_mailer_status}
    + {substr($val->push_to, 0, strpos($val->push_to, "\n"))} + {nl2br(htmlspecialchars(cut_str($val->subject, 40)))}{nl2br(htmlspecialchars(cut_str($val->content, 40)))}{number_format($val->success_count)}{number_format($val->deleted_count)}{number_format($val->updated_count)}{(zdate($val->regdate, "Y-m-d\nH:i:s"))} + + {$lang->cmd_advanced_mailer_status_success} + + {$lang->cmd_advanced_mailer_status_error} +
    + {$lang->cmd_advanced_mailer_status_error_msg}:
    + {nl2br(htmlspecialchars(trim($val->errors)))}

    + {$lang->cmd_advanced_mailer_status_calling_script}:
    + {htmlspecialchars($val->calling_script)} +
    + +
    {$lang->msg_advanced_mailer_log_is_empty}
    + +
    +
    + + +
    +
    + + + + + +
    +
    diff --git a/modules/advanced_mailer/tpl/push_test.html b/modules/advanced_mailer/tpl/push_test.html new file mode 100644 index 000000000..90bd4e377 --- /dev/null +++ b/modules/advanced_mailer/tpl/push_test.html @@ -0,0 +1,59 @@ + + + + +
    + + + + +
    +

    {$XE_VALIDATOR_MESSAGE}

    +
    + +
    + +

    {$lang->cmd_advanced_mailer_push_test}

    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    + +
    + +
    diff --git a/modules/member/queries/getMemberDeviceTokensByMemberSrl.xml b/modules/member/queries/getMemberDeviceTokensByMemberSrl.xml index 9cea5d9e3..bafd4571b 100644 --- a/modules/member/queries/getMemberDeviceTokensByMemberSrl.xml +++ b/modules/member/queries/getMemberDeviceTokensByMemberSrl.xml @@ -8,6 +8,6 @@ - +