mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Extend advanced_mailer module to log and test Push Notifications
This commit is contained in:
parent
04da475562
commit
4271bb9862
20 changed files with 540 additions and 16 deletions
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="0.2">
|
||||
<title xml:lang="ko">고급 메일 발송 모듈 (메일 및 SMS 관리)</title>
|
||||
<title xml:lang="en">Advanced Mailer (with SMS)</title>
|
||||
<title xml:lang="ko">메일, SMS 및 푸시 알림 관리 모듈</title>
|
||||
<title xml:lang="en">Mail, SMS and Push Notification Manager</title>
|
||||
<description xml:lang="ko">
|
||||
라이믹스에서 발송하는 메일과 SMS를 기록하고 테스트하는 기능을 제공합니다.
|
||||
라이믹스에서 발송하는 메일, SMS, 푸시 알림 등을 기록하고 테스트하는 기능을 제공합니다.
|
||||
</description>
|
||||
<description xml:lang="en">
|
||||
Log and test e-mails and SMS sent from Rhymix.
|
||||
Log and test e-mails, SMS, and push notifications sent from Rhymix.
|
||||
</description>
|
||||
<version>2.1.0</version>
|
||||
<date>2016-12-14</date>
|
||||
<version>2.2.0</version>
|
||||
<date>2020-06-25</date>
|
||||
<author link="https://www.poesis.org">
|
||||
<name xml:lang="ko">포에시스</name>
|
||||
<name xml:lang="en">POESIS</name>
|
||||
|
|
|
|||
|
|
@ -11,14 +11,18 @@
|
|||
<action name="dispAdvanced_mailerAdminSMSTest" type="view" />
|
||||
<action name="dispAdvanced_mailerAdminSMSLog" type="view" />
|
||||
<action name="dispAdvanced_mailerAdminSMSErrors" type="view" />
|
||||
<action name="dispAdvanced_mailerAdminPushTest" type="view" />
|
||||
<action name="dispAdvanced_mailerAdminPushLog" type="view" />
|
||||
|
||||
<action name="procAdvanced_mailerAdminInsertConfig" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminInsertExceptions" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminCheckDNSRecord" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminClearSentMail" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminClearSentSMS" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminClearSentPush" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminTestSendMail" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminTestSendSMS" type="controller" />
|
||||
<action name="procAdvanced_mailerAdminTestSendPush" type="controller" />
|
||||
</actions>
|
||||
<menus>
|
||||
<menu name="advanced_mailer" type="all">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
$lang->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.<br />Please <a href="https://support.google.com/mail/answer/14257" target="_blank">see here</a> 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.';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
$lang->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 접속이 차단되었습니다.<br />자세한 정보는 <a href="https://support.google.com/mail/answer/14257?hl=ko" target="_blank">여기</a>를 참고하시기 바랍니다.';
|
||||
$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용으로, 라이믹스와는 호환되지 않습니다. 라이믹스에 기본 포함된 버전을 사용하시기 바랍니다.';
|
||||
|
|
|
|||
11
modules/advanced_mailer/queries/countPushLogByType.xml
Normal file
11
modules/advanced_mailer/queries/countPushLogByType.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="countPushLogByType" action="select">
|
||||
<tables>
|
||||
<table name="advanced_mailer_push_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="status" var="status" />
|
||||
</conditions>
|
||||
</query>
|
||||
9
modules/advanced_mailer/queries/deletePushLogs.xml
Normal file
9
modules/advanced_mailer/queries/deletePushLogs.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<query id="deletePushLogs" action="delete">
|
||||
<tables>
|
||||
<table name="advanced_mailer_push_log" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="status" var="status" />
|
||||
<condition operation="less" column="regdate" var="regdate" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
17
modules/advanced_mailer/queries/getPushLogByType.xml
Normal file
17
modules/advanced_mailer/queries/getPushLogByType.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<query id="getPushLogByType" action="select">
|
||||
<tables>
|
||||
<table name="advanced_mailer_push_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="status" var="status" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="push_id" order="desc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
18
modules/advanced_mailer/queries/insertPushLog.xml
Normal file
18
modules/advanced_mailer/queries/insertPushLog.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<query id="insertPushLog" action="insert">
|
||||
<tables>
|
||||
<table name="advanced_mailer_push_log" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="push_from" var="push_from" notnull="notnull" />
|
||||
<column name="push_to" var="push_to" notnull="notnull" />
|
||||
<column name="subject" var="subject" notnull="notnull" />
|
||||
<column name="content" var="content" notnull="notnull" />
|
||||
<column name="calling_script" var="calling_script" notnull="notnull" />
|
||||
<column name="success_count" var="success_count" notnull="notnull" />
|
||||
<column name="deleted_count" var="deleted_count" notnull="notnull" />
|
||||
<column name="updated_count" var="updated_count" notnull="notnull" />
|
||||
<column name="regdate" var="regdate" notnull="notnull" default="curdate()" />
|
||||
<column name="status" var="status" notnull="notnull" default="success" />
|
||||
<column name="errors" var="errors" />
|
||||
</columns>
|
||||
</query>
|
||||
14
modules/advanced_mailer/schemas/advanced_mailer_push_log.xml
Normal file
14
modules/advanced_mailer/schemas/advanced_mailer_push_log.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<table name="advanced_mailer_push_log">
|
||||
<column name="push_id" type="number" size="11" notnull="notnull" primary_key="primary_key" auto_increment="auto_increment" />
|
||||
<column name="push_from" type="varchar" size="250" notnull="notnull" />
|
||||
<column name="push_to" type="bigtext" notnull="notnull" />
|
||||
<column name="subject" type="varchar" size="250" notnull="notnull" />
|
||||
<column name="content" type="text" notnull="notnull" />
|
||||
<column name="calling_script" type="varchar" size="250" notnull="notnull" />
|
||||
<column name="success_count" type="int" notnull="notnull" />
|
||||
<column name="deleted_count" type="int" notnull="notnull" />
|
||||
<column name="updated_count" type="int" notnull="notnull" />
|
||||
<column name="regdate" type="date" notnull="notnull" index="idx_regdate" />
|
||||
<column name="status" type="varchar" size="40" notnull="notnull" index="idx_status" />
|
||||
<column name="errors" type="bigtext" />
|
||||
</table>
|
||||
|
|
@ -13,4 +13,6 @@
|
|||
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminSMSTest'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSMSTest')}">{$lang->cmd_advanced_mailer_sms_test}</a></li>
|
||||
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminSMSLog'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSMSLog')}">{$lang->cmd_advanced_mailer_log_sms}</a></li>
|
||||
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminSMSErrors'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSMSErrors')}">{$lang->cmd_advanced_mailer_log_sms_errors}</a></li>
|
||||
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminPushTest'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminPushTest')}">{$lang->cmd_advanced_mailer_push_test}</a></li>
|
||||
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminPushLog'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminPushLog')}">{$lang->cmd_advanced_mailer_log_push}</a></li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,26 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="advanced_mailer_log_sent_push">{$lang->cmd_advanced_mailer_log_push}</label>
|
||||
<div class="x_controls">
|
||||
<select name="log_sent_push" id="advanced_mailer_log_sent_push">
|
||||
<option value="Y" selected="selected"|cond="toBool($advanced_mailer_config->log_sent_push)" />{$lang->cmd_advanced_mailer_log_yes}</option>
|
||||
<option value="N" selected="selected"|cond="!toBool($advanced_mailer_config->log_sent_push)" />{$lang->cmd_advanced_mailer_log_no}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cmd_advanced_mailer_log_push_errors}</label>
|
||||
<div class="x_controls">
|
||||
<select name="log_push_errors" id="advanced_mailer_log_push_errors">
|
||||
<option value="Y" selected="selected"|cond="toBool($advanced_mailer_config->log_push_errors)" />{$lang->cmd_advanced_mailer_log_yes}</option>
|
||||
<option value="N" selected="selected"|cond="!toBool($advanced_mailer_config->log_push_errors)" />{$lang->cmd_advanced_mailer_log_no}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<div class="btnArea x_clearfix">
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
86
modules/advanced_mailer/tpl/push_log.html
Normal file
86
modules/advanced_mailer/tpl/push_log.html
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<include target="./common.html" />
|
||||
<load target="css/view_log.css" />
|
||||
<load target="js/view_log.js" />
|
||||
|
||||
<table id="advanced_mailer_log" class="x_table x_table-striped x_table-hover">
|
||||
<caption>
|
||||
<div style="float: left">
|
||||
<a href="{getUrl('status', null)}" class="active"|cond="!$status">{$lang->all}</a> <i>|</i>
|
||||
<a href="{getUrl('status', 'success')}" class="active"|cond="$status == 'success'">{$lang->cmd_advanced_mailer_status_success}</a> <i>|</i>
|
||||
<a href="{getUrl('status', 'error')}" class="active"|cond="$status == 'error'">{$lang->cmd_advanced_mailer_status_error}</a>
|
||||
</div>
|
||||
<div style="float: right">
|
||||
<strong>Total: {number_format($total_count)}, Page: {number_format($page)}/{number_format($total_page)}</strong>
|
||||
</div>
|
||||
<div class="clear: both"></div>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_recipient}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_subject}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_content}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_success_count}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_deleted_count}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_updated_count}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_time}</th>
|
||||
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr loop="$advanced_mailer_log => $push_id, $val">
|
||||
<td class="nowr">
|
||||
{substr($val->push_to, 0, strpos($val->push_to, "\n"))}
|
||||
</td>
|
||||
<td class="nowr" style="white-space:normal">{nl2br(htmlspecialchars(cut_str($val->subject, 40)))}</td>
|
||||
<td class="nowr" style="white-space:normal">{nl2br(htmlspecialchars(cut_str($val->content, 40)))}</td>
|
||||
<td class="nowr">{number_format($val->success_count)}</td>
|
||||
<td class="nowr">{number_format($val->deleted_count)}</td>
|
||||
<td class="nowr">{number_format($val->updated_count)}</td>
|
||||
<td class="nowr">{(zdate($val->regdate, "Y-m-d\nH:i:s"))}</td>
|
||||
<td class="nowr">
|
||||
<!--@if($val->status === 'success')-->
|
||||
{$lang->cmd_advanced_mailer_status_success}
|
||||
<!--@else-->
|
||||
<a href="javascript:void(0)" class="show-errors">{$lang->cmd_advanced_mailer_status_error}</a>
|
||||
<div class="mail-log-errors">
|
||||
<strong>{$lang->cmd_advanced_mailer_status_error_msg}:</strong><br />
|
||||
{nl2br(htmlspecialchars(trim($val->errors)))}<br /><br />
|
||||
<strong>{$lang->cmd_advanced_mailer_status_calling_script}:</strong><br />
|
||||
{htmlspecialchars($val->calling_script)}
|
||||
</div>
|
||||
<!--@end-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr cond="!$advanced_mailer_log">
|
||||
<td>{$lang->msg_advanced_mailer_log_is_empty}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="x_clearfix">
|
||||
<form class="x_pagination x_pull-left" style="margin-top:8px" action="{Context::getUrl('')}" method="post" no-error-return-url="true">
|
||||
<input loop="$param => $key, $val" cond="!in_array($key, array('mid', 'vid', 'act'))" type="hidden" name="{$key}" value="{$val}" />
|
||||
<ul>
|
||||
<li class="x_disabled"|cond="$page == 1"><a href="{getUrl('page', '')}">« {$lang->first_page}</a></li>
|
||||
<!--@while($page_no = $page_navigation->getNextPage())-->
|
||||
<li class="x_active"|cond="$page_no == $page"><a href="{getUrl('page', $page_no)}">{$page_no}</a></li>
|
||||
<!--@end-->
|
||||
<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}">{$lang->last_page} »</a></li>
|
||||
</ul>
|
||||
</form>
|
||||
<form class="x_pull-right x_input-append" style="margin-top:8px" action="{Context::getUrl('')}" method="post">
|
||||
<input type="hidden" name="module" value="advanced_mailer" />
|
||||
<input type="hidden" name="act" value="procAdvanced_mailerAdminClearSentPush" />
|
||||
<input type="hidden" name="status" value="{$advanced_mailer_status}" />
|
||||
<select name="clear_before_days" style="width:120px">
|
||||
<option value="0">{$lang->cmd_advanced_mailer_clear_log_condition_all}</option>
|
||||
<option value="1">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 1)}</option>
|
||||
<option value="3">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 3)}</option>
|
||||
<option value="7" selected="selected">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 7)}</option>
|
||||
<option value="14">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 14)}</option>
|
||||
<option value="30">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 30)}</option>
|
||||
<option value="60">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 60)}</option>
|
||||
</select>
|
||||
<button class="x_btn" type="submit" disabled="disabled"|cond="!count($advanced_mailer_log)">{$lang->cmd_advanced_mailer_clear_log_button}</button>
|
||||
</form>
|
||||
</div>
|
||||
59
modules/advanced_mailer/tpl/push_test.html
Normal file
59
modules/advanced_mailer/tpl/push_test.html
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<include target="./common.html" />
|
||||
<load target="css/config.css" />
|
||||
<load target="js/config.js" />
|
||||
|
||||
<form class="x_form-horizontal" action="./" method="post" id="advanced_mailer">
|
||||
<input type="hidden" name="module" value="advanced_mailer" />
|
||||
<input type="hidden" name="act" value="procAdvanced_mailerAdminTestSendPush" />
|
||||
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
|
||||
|
||||
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
|
||||
<p>{$XE_VALIDATOR_MESSAGE}</p>
|
||||
</div>
|
||||
|
||||
<section class="section">
|
||||
|
||||
<h2>{$lang->cmd_advanced_mailer_push_test}</h2>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="advanced_mailer_recipient_user_id">{$lang->cmd_advanced_mailer_recipient_user_id}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="advanced_mailer_recipient_user_id" value="{$this->user->user_id}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="advanced_mailer_subject">{$lang->cmd_advanced_mailer_status_subject}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="advanced_mailer_subject" value="{$lang->cmd_advanced_mailer_test_push_subject}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="advanced_mailer_content">{$lang->cmd_advanced_mailer_status_content}</label>
|
||||
<div class="x_controls">
|
||||
<textarea id="advanced_mailer_content">{$lang->cmd_advanced_mailer_test_push_content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="advanced_mailer_url">{$lang->cmd_advanced_mailer_status_url}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" id="advanced_mailer_url" value="{getFullUrl('')}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cmd_advanced_mailer_test_result}</label>
|
||||
<div class="x_controls">
|
||||
<div id="advanced_mailer_test_result"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<div class="btnArea x_clearfix">
|
||||
<button id="advanced_mailer_test_send_push" type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_advanced_mailer_send}</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
|
@ -8,6 +8,6 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="member_srl" var="member_srl" notnull="notnull" />
|
||||
<condition operation="in" column="device_type" var="device_type" notnull="notnull" pipe="and" />
|
||||
<condition operation="in" column="device_type" var="device_type" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue