From 5dab74c63154486c195add573083945c48fa82df Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 18 Dec 2017 10:34:34 +0800 Subject: [PATCH] * finish task #3480. --- module/mail/control.php | 17 +++++++++++------ module/mail/js/edit.js | 3 ++- module/mail/lang/en.php | 1 + module/mail/lang/zh-cn.php | 1 + module/mail/view/index.html.php | 3 +++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/module/mail/control.php b/module/mail/control.php index 93b1ffe344..3c9ad804f3 100755 --- a/module/mail/control.php +++ b/module/mail/control.php @@ -55,21 +55,26 @@ class mail extends control * @access public * @return void */ - public function detect() + public function detect($type = 'smtp') { - if($_POST) + if($_POST or $type == 'gmail') { set_time_limit(30); - $error = ''; - if($this->post->fromAddress == false) $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress); - if(!validater::checkEmail($this->post->fromAddress)) $error .= '\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress); + if($type != 'gmail') + { + $error = ''; + if($this->post->fromAddress == false) $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress); + if(!validater::checkEmail($this->post->fromAddress)) $error .= '\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress); - if($error) die(js::alert($error)); + if($error) die(js::alert($error)); + } + if($type == 'gmail' and empty($_POST['fromAddress'])) $_POST['fromAddress'] = '@gmail.com'; echo ""; $mailConfig = $this->mail->autoDetect($this->post->fromAddress); $mailConfig->fromAddress = $this->post->fromAddress; $mailConfig->domain = common::getSysURL(); + if($type == 'gmail') $mailConfig->fromAddress = ''; $this->session->set('mailConfig', $mailConfig); die(js::locate(inlink('edit'), 'parent')); diff --git a/module/mail/js/edit.js b/module/mail/js/edit.js index ad537f83eb..5d6d8bd632 100644 --- a/module/mail/js/edit.js +++ b/module/mail/js/edit.js @@ -1,4 +1,5 @@ $(document).ready() { - $('#password').focus(); + $('#fromAddress').focus(); + if($('#fromAddress').val() != '')$('#password').focus(); } diff --git a/module/mail/lang/en.php b/module/mail/lang/en.php index 9309052bba..72797bb7cc 100755 --- a/module/mail/lang/en.php +++ b/module/mail/lang/en.php @@ -10,6 +10,7 @@ $lang->mail->resend = 'Resend'; $lang->mail->browse = 'Email List'; $lang->mail->delete = 'Delete Email'; $lang->mail->ztCloud = 'ZenTao CloudMail'; +$lang->mail->gmail = 'GMAIL'; $lang->mail->sendCloud = 'Notice SendCloud'; $lang->mail->batchDelete = 'Batch Delete'; $lang->mail->sendcloudUser = 'Sync Contact'; diff --git a/module/mail/lang/zh-cn.php b/module/mail/lang/zh-cn.php index 47ea0a204f..2e3795408b 100755 --- a/module/mail/lang/zh-cn.php +++ b/module/mail/lang/zh-cn.php @@ -10,6 +10,7 @@ $lang->mail->resend = '重发'; $lang->mail->browse = '邮件列表'; $lang->mail->delete = '删除邮件'; $lang->mail->ztCloud = '禅道云发信'; +$lang->mail->gmail = 'GMAIL发信'; $lang->mail->sendCloud = 'Notice发信'; $lang->mail->batchDelete = '批量删除'; $lang->mail->sendcloudUser = '同步联系人'; diff --git a/module/mail/view/index.html.php b/module/mail/view/index.html.php index fad3d328a7..2dbfb9e2eb 100755 --- a/module/mail/view/index.html.php +++ b/module/mail/view/index.html.php @@ -24,6 +24,9 @@ include '../../common/view/header.html.php'; app->getClientLang() != 'en' and common::hasPriv('mail', 'ztCloud')):?> mail->ztCloud, '', "class='btn btn-sm w-120px'")?> + app->getClientLang() == 'en'):?> + mail->gmail, '', "class='btn btn-sm w-120px'")?> + mail->smtp, '', "class='btn btn-sm w-120px'")?>