From 1d6d3e8cb189ee0692698355b99fd15d90c9e092 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 5 Jan 2017 11:12:43 +0800 Subject: [PATCH] * set company field required. --- module/action/model.php | 2 +- module/admin/control.php | 21 +++++++++++++++++++ module/admin/lang/en.php | 1 + module/admin/lang/zh-cn.php | 1 + module/admin/model.php | 20 ++++++++++++++++++ module/admin/view/register.html.php | 2 +- module/admin/view/ztcompany.html.php | 31 ++++++++++++++++++++++++++++ module/mail/control.php | 5 +++-- 8 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 module/admin/view/ztcompany.html.php diff --git a/module/action/model.php b/module/action/model.php index efba220cbc..2521c462e8 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -755,7 +755,7 @@ class actionModel extends model foreach($histories as $history) { $fieldName = $history->field; - $history->fieldLabel = isset($this->lang->$objectType) && isset($this->lang->$objectType->$fieldName) ? $this->lang->$objectType->$fieldName : $fieldName; + $history->fieldLabel = (isset($this->lang->$objectType) && isset($this->lang->$objectType->$fieldName)) ? $this->lang->$objectType->$fieldName : $fieldName; if(($length = strlen($history->fieldLabel)) > $maxLength) $maxLength = $length; $history->diff ? $historiesWithDiff[] = $history : $historiesWithoutDiff[] = $history; } diff --git a/module/admin/control.php b/module/admin/control.php index 2bcb90d239..8cdcb62d98 100644 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -276,6 +276,27 @@ class admin extends control $this->display(); } + /** + * Set ztCompany. + * + * @access public + * @return void + */ + public function ztCompany() + { + if($_POST) + { + $response = $this->admin->setCompanyByAPI(); + $response = json_decode($response); + if($response->result == 'fail') die(js::alert($response->message)); + die(js::locate($this->createLink('mail', 'ztCloud'), 'parent')); + } + + $this->view->title = $this->lang->admin->ztCompany; + $this->view->position[] = $this->lang->admin->ztCompany; + $this->display(); + } + /** * Ajax send code. * diff --git a/module/admin/lang/en.php b/module/admin/lang/en.php index 06af78db03..652e13ad5b 100644 --- a/module/admin/lang/en.php +++ b/module/admin/lang/en.php @@ -17,6 +17,7 @@ $lang->admin->safeIndex = 'Security'; $lang->admin->checkWeak = 'Weak Password Check'; $lang->admin->certifyMobile = 'Verify your mobilephone'; $lang->admin->certifyEmail = 'Verifu your Email'; +$lang->admin->ztCompany = 'Verifu your company'; $lang->admin->captcha = 'Verification Code'; $lang->admin->getCaptcha = 'Get Verification Code'; diff --git a/module/admin/lang/zh-cn.php b/module/admin/lang/zh-cn.php index 82b4d3777d..673195b17a 100644 --- a/module/admin/lang/zh-cn.php +++ b/module/admin/lang/zh-cn.php @@ -17,6 +17,7 @@ $lang->admin->safeIndex = '安全'; $lang->admin->checkWeak = '弱口令检查'; $lang->admin->certifyMobile = '认证手机'; $lang->admin->certifyEmail = '认证邮箱'; +$lang->admin->ztCompany = '认证公司'; $lang->admin->captcha = '验证码'; $lang->admin->getCaptcha = '获取验证码'; diff --git a/module/admin/model.php b/module/admin/model.php index 76e76da4ee..9e64559676 100644 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -193,6 +193,26 @@ class adminModel extends model return $this->postAPI($apiURL . '?' . $param, $_POST); } + /** + * Set company by API. + * + * @access public + * @return string + */ + public function setCompanyByAPI() + { + $apiConfig = $this->getApiConfig(); + $apiURL = $this->config->admin->apiRoot . "/user-apiSetCompany.json"; + + $params['u'] = $this->config->global->community; + $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; + $params[$apiConfig->sessionVar] = $apiConfig->sessionID; + $params['k'] = $this->getSignature($params); + + $param = http_build_query($params); + return $this->postAPI($apiURL . '?' . $param, $_POST); + } + /** * Get signature. * diff --git a/module/admin/view/register.html.php b/module/admin/view/register.html.php index b6e702f9dd..9beed60a8a 100644 --- a/module/admin/view/register.html.php +++ b/module/admin/view/register.html.php @@ -41,7 +41,7 @@ user->company;?> - company, "class='form-control'");?> +
company, "class='form-control'");?> user->mobile;?> diff --git a/module/admin/view/ztcompany.html.php b/module/admin/view/ztcompany.html.php new file mode 100644 index 0000000000..363bdba2d3 --- /dev/null +++ b/module/admin/view/ztcompany.html.php @@ -0,0 +1,31 @@ + + * @package admin + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
+
+
admin->ztCompany;?>
+
+
+ + + + + + + + + +
company->name;?>
+
+
+ diff --git a/module/mail/control.php b/module/mail/control.php index 0dcbe724ee..a6a3f7d533 100755 --- a/module/mail/control.php +++ b/module/mail/control.php @@ -506,10 +506,11 @@ class mail extends control die(js::locate($this->createLink('admin', 'register', 'from=mail'))); } $result = $this->loadModel('admin')->getSecretKey(); - if(empty($result))die(js::alert($this->lang->mail->connectFail) . js::locate($this->createLink('admin', 'register', "from=admin"))); - if($result->result == 'fail' and empty($result->data)) die(js::alert($this->lang->mail->centifyFail) . js::locate($this->createLink('admin', 'register', "from=admin"))); + if(empty($result))die(js::alert($this->lang->mail->connectFail) . js::locate($this->createLink('admin', 'register', "from=mail"))); + if($result->result == 'fail' and empty($result->data)) die(js::alert($this->lang->mail->centifyFail) . js::locate($this->createLink('admin', 'register', "from=mail"))); $data = $result->data; + if($result->result == 'fail' and empty($data->company)) die(js::locate($this->createLink('admin', 'ztCompany'))); if($result->result == 'fail' and empty($data->emailCertified)) { die(js::locate($this->createLink('admin', 'certifyZtEmail', 'email=' . helper::safe64Encode($data->email))));