From 90211f67fae5f3b65f5d83a6c1cb90cbab2c99f7 Mon Sep 17 00:00:00 2001 From: liugang Date: Thu, 9 Nov 2017 15:16:22 +0800 Subject: [PATCH] * Finish task #3337,3338,3357,3358,3365,3366,3367. --- db/zentao.sql | 4 +-- module/common/lang/en.php | 25 +++++++++----- module/common/lang/zh-cn.php | 25 +++++++++----- module/common/lang/zh-tw.php | 25 +++++++++----- module/common/model.php | 52 +++++++++++++---------------- module/entry/control.php | 35 ++++++++++++------- module/entry/css/create.css | 1 + module/entry/css/edit.css | 1 + module/entry/lang/zh-tw.php | 10 +++--- module/entry/view/create.html.php | 11 +++--- module/entry/view/edit.html.php | 11 +++--- module/score/lang/zh-tw.php | 6 ++-- module/task/lang/zh-tw.php | 3 +- module/testreport/lang/zh-tw.php | 22 ++++++------ module/webhook/control.php | 29 +++++++++++----- module/webhook/lang/en.php | 15 +++++---- module/webhook/lang/zh-cn.php | 25 ++++++++------ module/webhook/lang/zh-tw.php | 27 ++++++++------- module/webhook/model.php | 2 ++ module/webhook/view/create.html.php | 6 ++-- module/webhook/view/edit.html.php | 4 +-- module/webhook/view/header.html.php | 2 +- 22 files changed, 197 insertions(+), 144 deletions(-) create mode 100644 module/entry/css/create.css create mode 100644 module/entry/css/edit.css diff --git a/db/zentao.sql b/db/zentao.sql index 7563612aa2..631413d3ca 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -621,7 +621,7 @@ CREATE TABLE IF NOT EXISTS `zt_taskestimate` ( `consumed` float unsigned NOT NULL, `account` char(30) NOT NULL default '', `work` text, - PRIMARY KEY (`id`), + PRIMARY KEY (`id`), KEY `task` (`task`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `zt_team`; @@ -638,7 +638,7 @@ CREATE TABLE IF NOT EXISTS `zt_team` ( `consumed` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0', `left` DECIMAL(12,2) UNSIGNED NOT NULL DEFAULT '0', `order` TINYINT(3) NOT NULL DEFAULT '0', - PRIMARY KEY (`project`, `task`, `account`) + PRIMARY KEY (`project`, `task`, `account`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `zt_testreport`; CREATE TABLE IF NOT EXISTS `zt_testreport` ( diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 5eeab17c66..419b6f566c 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -433,15 +433,24 @@ $lang->error->noData = 'No Data'; $lang->error->editedByOther = 'This record might have been changed. Please refresh and try to edit again!'; $lang->error->tutorialData = 'No data can be imported in tutorial mode. Please exit tutorial first!'; +if(!defined('PARAM_CODE_MISSING')) define('PARAM_CODE_MISSING', 301); +if(!defined('PARAM_TOKEN_MISSING')) define('PARAM_TOKEN_MISSING', 302); +if(!defined('INVALID_ENTRY')) define('INVALID_ENTRY', 311); +if(!defined('EMPTY_KEY')) define('EMPTY_KEY', 312); +if(!defined('IP_DENIED')) define('IP_DENIED', 321); +if(!defined('INVALID_TOKEN')) define('INVALID_TOKEN', 331); +if(!defined('SESSION_CODE_MISSING')) define('SESSION_CODE_MISSING', 341); +if(!defined('SESSION_VERIFY_FAILED')) define('SESSION_VERIFY_FAILED', 342); + $lang->error->entry = array(); -$lang->error->entry['301'] = 'Param code not set.'; -$lang->error->entry['302'] = 'Param token not set.'; -$lang->error->entry['311'] = 'Entry not exist.'; -$lang->error->entry['312'] = 'Key of entry not set.'; -$lang->error->entry['321'] = 'IP denied.'; -$lang->error->entry['331'] = 'Invalid token.'; -$lang->error->entry['341'] = 'Session code not set.'; -$lang->error->entry['342'] = 'Session verify failed.'; +$lang->error->entry['PARAM_CODE_MISSING'] = 'Param code not set.'; +$lang->error->entry['PARAM_TOKEN_MISSING'] = 'Param token not set.'; +$lang->error->entry['INVALID_ENTRY'] = 'Entry not exist.'; +$lang->error->entry['EMPTY_KEY'] = 'Key of entry not set.'; +$lang->error->entry['IP_DENIED'] = 'IP denied.'; +$lang->error->entry['INVALID_TOKEN'] = 'Invalid token.'; +$lang->error->entry['SESSION_CODE_MISSING'] = 'Session code not set.'; +$lang->error->entry['SESSION_VERIFY_FAILED'] = 'Session verify failed.'; /* 分页信息。*/ $lang->pager = new stdclass(); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 0ad5af85b3..423be19ed4 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -433,15 +433,24 @@ $lang->error->noData = '没有数据'; $lang->error->editedByOther = '该记录可能已经被改动。请刷新页面重新编辑!'; $lang->error->tutorialData = '新手模式下不会插入数据,请退出新手模式操作'; +if(!defined('PARAM_CODE_MISSING')) define('PARAM_CODE_MISSING', 301); +if(!defined('PARAM_TOKEN_MISSING')) define('PARAM_TOKEN_MISSING', 302); +if(!defined('INVALID_ENTRY')) define('INVALID_ENTRY', 311); +if(!defined('EMPTY_KEY')) define('EMPTY_KEY', 312); +if(!defined('IP_DENIED')) define('IP_DENIED', 321); +if(!defined('INVALID_TOKEN')) define('INVALID_TOKEN', 331); +if(!defined('SESSION_CODE_MISSING')) define('SESSION_CODE_MISSING', 341); +if(!defined('SESSION_VERIFY_FAILED')) define('SESSION_VERIFY_FAILED', 342); + $lang->error->entry = array(); -$lang->error->entry['301'] = '缺少code参数'; -$lang->error->entry['302'] = '缺少token参数'; -$lang->error->entry['311'] = '应用不存在'; -$lang->error->entry['312'] = '应用未设置密钥'; -$lang->error->entry['321'] = '该IP访问被限制访问'; -$lang->error->entry['331'] = '不合法的token参数'; -$lang->error->entry['341'] = '缺少session code'; -$lang->error->entry['342'] = 'session验证失败'; +$lang->error->entry['PARAM_CODE_MISSING'] = '缺少code参数'; +$lang->error->entry['PARAM_TOKEN_MISSING'] = '缺少token参数'; +$lang->error->entry['INVALID_ENTRY'] = '应用不存在'; +$lang->error->entry['EMPTY_KEY'] = '应用未设置密钥'; +$lang->error->entry['IP_DENIED'] = '该IP访问被限制访问'; +$lang->error->entry['INVALID_TOKEN'] = '不合法的token参数'; +$lang->error->entry['SESSION_CODE_MISSING'] = '缺少session code'; +$lang->error->entry['SESSION_VERIFY_FAILED'] = 'session验证失败'; /* 分页信息。*/ $lang->pager = new stdclass(); diff --git a/module/common/lang/zh-tw.php b/module/common/lang/zh-tw.php index c8398f658f..2e82870d20 100644 --- a/module/common/lang/zh-tw.php +++ b/module/common/lang/zh-tw.php @@ -433,15 +433,24 @@ $lang->error->noData = '沒有數據'; $lang->error->editedByOther = '該記錄可能已經被改動。請刷新頁面重新編輯!'; $lang->error->tutorialData = '新手模式下不會插入數據,請退出新手模式操作'; +if(!defined('PARAM_CODE_MISSING')) define('PARAM_CODE_MISSING', 301); +if(!defined('PARAM_TOKEN_MISSING')) define('PARAM_TOKEN_MISSING', 302); +if(!defined('INVALID_ENTRY')) define('INVALID_ENTRY', 311); +if(!defined('EMPTY_KEY')) define('EMPTY_KEY', 312); +if(!defined('IP_DENIED')) define('IP_DENIED', 321); +if(!defined('INVALID_TOKEN')) define('INVALID_TOKEN', 331); +if(!defined('SESSION_CODE_MISSING')) define('SESSION_CODE_MISSING', 341); +if(!defined('SESSION_VERIFY_FAILED')) define('SESSION_VERIFY_FAILED', 342); + $lang->error->entry = array(); -$lang->error->entry['301'] = '缺少code參數'; -$lang->error->entry['302'] = '缺少token參數'; -$lang->error->entry['311'] = '應用不存在'; -$lang->error->entry['312'] = '應用未設置密鑰'; -$lang->error->entry['321'] = '該IP訪問被限制訪問'; -$lang->error->entry['331'] = '不合法的token參數'; -$lang->error->entry['341'] = '缺少session code'; -$lang->error->entry['342'] = 'session驗證失敗'; +$lang->error->entry['PARAM_CODE_MISSING'] = '缺少code參數'; +$lang->error->entry['PARAM_TOKEN_MISSING'] = '缺少token參數'; +$lang->error->entry['INVALID_ENTRY'] = '應用不存在'; +$lang->error->entry['EMPTY_KEY'] = '應用未設置密鑰'; +$lang->error->entry['IP_DENIED'] = '該IP訪問被限制訪問'; +$lang->error->entry['INVALID_TOKEN'] = '不合法的token參數'; +$lang->error->entry['SESSION_CODE_MISSING'] = '缺少session code'; +$lang->error->entry['SESSION_VERIFY_FAILED'] = 'session驗證失敗'; /* 分頁信息。*/ $lang->pager = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index 703bc1f869..d0ef2adc66 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1156,7 +1156,17 @@ class commonModel extends model return false; } - public static function hasDBPriv($object, $module = null, $method = null) + /** + * Check db priv. + * + * @param object $object + * @param string $module + * @param string $method + * @static + * @access public + * @return void + */ + public static function hasDBPriv($object, $module = '', $method = '') { global $app; @@ -1203,14 +1213,15 @@ class commonModel extends model /** * Check whether IP in white list. * + * @param string $ipWhiteList * @access public * @return bool */ - public function checkIP() + public function checkIP($ipWhiteList = '') { $ip = $this->server->remote_addr; - $ipWhiteList = $this->config->ipWhiteList; + if(!$ipWhiteList) $ipWhiteList = $this->config->ipWhiteList; /* If the ip white list is '*'. */ if($ipWhiteList == '*') return true; @@ -1363,42 +1374,25 @@ class commonModel extends model { if($this->session->valid_entry) { - if(!$this->session->entry_code) $this->response(341); - if($this->session->valid_entry != md5(md5($this->get->code) . $this->server->remote_addr)) $this->response(342); + if(!$this->session->entry_code) $this->response(SESSION_CODE_MISSING); + if($this->session->valid_entry != md5(md5($this->get->code) . $this->server->remote_addr)) $this->response(SESSION_VERIFY_FAILED); return true; } - if(!$this->get->code) $this->response(301); - if(!$this->get->token) $this->response(302); + if(!$this->get->code) $this->response(PARAM_CODE_MISSING); + if(!$this->get->token) $this->response(PARAM_TOKEN_MISSING); $entry = $this->loadModel('entry')->getByCode($this->get->code); - if(!$entry) $this->response(311); - if(!$entry->key) $this->response(312); - - $this->checkEntryIP($entry->ip); - $this->checkEntryToken($entry->key); + if(!$entry) $this->response(INVALID_ENTRY); + if(!$entry->key) $this->response(EMPTY_KEY); + if(!$this->checkIP($entry->ip)) $this->response(IP_DENIED); + if(!$this->checkEntryToken($entry->key)) $this->response(INVALID_TOKEN); $this->session->set('ENTRY_CODE', $this->get->code); $this->session->set('VALID_ENTRY', md5(md5($this->get->code) . $this->server->remote_addr)); $this->loadModel('entry')->saveLog($entry->id, $this->server->request_uri); } - /** - * Check ip of an entry. - * - * @param string $ip - * @access public - * @return void - */ - public function checkEntryIP($ip) - { - $ipWhiteList = $this->config->ipWhiteList; - $this->config->ipWhiteList = $ip; - $result = $this->checkIP(); - $this->config->ipWhiteList = $ipWhiteList; - if(!$result) $this->response(321); - } - /** * Check token of an entry. * @@ -1411,7 +1405,7 @@ class commonModel extends model parse_str($this->server->query_String, $queryString); unset($queryString['token']); $queryString = http_build_query($queryString); - if($_GET['token'] != md5(md5($queryString) . $key)) $this->response(331); + return $this->get->token == md5(md5($queryString) . $key); } /** diff --git a/module/entry/control.php b/module/entry/control.php index 64bfeefe00..b9cdaaedf5 100644 --- a/module/entry/control.php +++ b/module/entry/control.php @@ -26,10 +26,12 @@ class entry extends control $pager = $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $this->view->title = $this->lang->entry->api . $this->lang->colon . $this->lang->entry->list; - $this->view->entries = $this->entry->getList($orderBy, $pager); - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; + $this->view->title = $this->lang->entry->api . $this->lang->colon . $this->lang->entry->list; + $this->view->entries = $this->entry->getList($orderBy, $pager); + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api); + $this->view->position[] = $this->lang->entry->common; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; $this->display(); } @@ -50,7 +52,10 @@ class entry extends control $this->send(array('result' => 'success', 'message' => $this->lang->entry->saveSuccess, 'locate' => inlink('browse'))); } - $this->view->title = $this->lang->entry->api . $this->lang->colon . $this->lang->entry->create; + $this->view->title = $this->lang->entry->api . $this->lang->colon . $this->lang->entry->create; + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->common); + $this->view->position[] = $this->lang->entry->create; $this->display(); } @@ -77,8 +82,11 @@ class entry extends control } $entry = $this->entry->getById($id); - $this->view->title = $this->lang->entry->edit . $this->lang->colon . $entry->name; - $this->view->entry = $entry; + $this->view->title = $this->lang->entry->edit . $this->lang->colon . $entry->name; + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->common); + $this->view->position[] = $this->lang->entry->edit; + $this->view->entry = $entry; $this->display(); } @@ -114,11 +122,14 @@ class entry extends control $pager = new pager($recTotal, $recPerPage, $pageID); $entry = $this->entry->getByID($id); - $this->view->title = $this->lang->entry->log . $this->lang->colon . $entry->name; - $this->view->logs = $this->entry->getLogList($id, $orderBy, $pager); - $this->view->entry = $entry; - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; + $this->view->title = $this->lang->entry->log . $this->lang->colon . $entry->name; + $this->view->logs = $this->entry->getLogList($id, $orderBy, $pager); + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->entry->common); + $this->view->position[] = $this->lang->entry->log; + $this->view->entry = $entry; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; $this->display(); } } diff --git a/module/entry/css/create.css b/module/entry/css/create.css new file mode 100644 index 0000000000..1d87206e8d --- /dev/null +++ b/module/entry/css/create.css @@ -0,0 +1 @@ +.help {margin-left: 10px;} diff --git a/module/entry/css/edit.css b/module/entry/css/edit.css new file mode 100644 index 0000000000..1d87206e8d --- /dev/null +++ b/module/entry/css/edit.css @@ -0,0 +1 @@ +.help {margin-left: 10px;} diff --git a/module/entry/lang/zh-tw.php b/module/entry/lang/zh-tw.php index 919c4ee055..e0968266e5 100644 --- a/module/entry/lang/zh-tw.php +++ b/module/entry/lang/zh-tw.php @@ -1,9 +1,9 @@ entry->common = '應用'; -$lang->entry->list = '應用列表'; -$lang->entry->api = '介面'; -$lang->entry->webhook = 'webhook'; -$lang->entry->log = '日誌'; +$lang->entry->common = '應用'; +$lang->entry->list = '應用列表'; +$lang->entry->api = '介面'; +$lang->entry->webhook = 'Webhook'; +$lang->entry->log = '日誌'; $lang->entry->browse = '瀏覽應用'; $lang->entry->create = '添加應用'; diff --git a/module/entry/view/create.html.php b/module/entry/view/create.html.php index 3af89cffa2..bf35a75bab 100644 --- a/module/entry/view/create.html.php +++ b/module/entry/view/create.html.php @@ -53,16 +53,15 @@ - - entry->help;?> - entry->help, '', "target='_blank'");?> - - + + + entry->help, $lang->entry->help, '_blank', "class='help'");?> + - + diff --git a/module/entry/view/edit.html.php b/module/entry/view/edit.html.php index d682de2005..db4248dda9 100644 --- a/module/entry/view/edit.html.php +++ b/module/entry/view/edit.html.php @@ -53,16 +53,15 @@ desc, "rows='3' class='form-control'");?> - - entry->help;?> - entry->help, '', "target='_blank'");?> - - + + + entry->help, $lang->entry->help, '_blank', "class='help'");?> + - + diff --git a/module/score/lang/zh-tw.php b/module/score/lang/zh-tw.php index fb609cb1e6..5c4362e37f 100644 --- a/module/score/lang/zh-tw.php +++ b/module/score/lang/zh-tw.php @@ -81,9 +81,9 @@ $lang->score->methods['search']['saveQuery'] = '保存搜索條件'; $lang->score->methods['search']['saveQueryAdvanced'] = '使用高級搜索'; $lang->score->extended = new stdClass(); -$lang->score->extended->userchangePassword = '密碼強度中的,額外獲得#changePassword,strength,1#個積分,強的,額外獲得#changePassword,strength,2#個積分。'; +$lang->score->extended->userchangePassword = '密碼強度為中,額外獲得#changePassword,strength,1#個積分;為強,額外獲得#changePassword,strength,2#個積分。'; $lang->score->extended->projectclose = '項目經理增加#projectClose,manager,close#個積分,項目成員增加#projectClose,member,close#個積分。按期或者提前完成,項目經理額外增加#projectClose,manager,in#個積分,項目成員額外增加#projectClose,member,in#個積分。'; $lang->score->extended->bugresolve = 'Bug解決後,額外增加嚴重程度積分:s1 + #bugResolve,severity,3#, s2 + #bugResolve,severity,2#, s3 + #bugResolve,severity,1#。'; $lang->score->extended->bugconfirmBug = 'Bug確認後,額外增加嚴重程度積分:s1 + #bugConfirmBug,severity,3#, s2 + #bugConfirmBug,severity,2#, s3 + #bugConfirmBug,severity,1#。'; -$lang->score->extended->taskfinish = '額外增加工時積分 round(工時 /10 * 預計 / 消耗) + 優先順序積分(p1 #taskFinish,pri,1#, p2, #taskFinish,pri,2#)。'; -$lang->score->extended->storyclose = '需求的創建者額外增加#storyClose,createID#分'; \ No newline at end of file +$lang->score->extended->taskfinish = '額外增加工時積分 round(工時 / 10 * 預計 / 消耗) + 優先順序積分(p1 #taskFinish,pri,1#, p2 #taskFinish,pri,2#)。'; +$lang->score->extended->storyclose = '需求的創建者額外增加#storyClose,createID#分'; diff --git a/module/task/lang/zh-tw.php b/module/task/lang/zh-tw.php index 0af35e2b09..1f476620a6 100644 --- a/module/task/lang/zh-tw.php +++ b/module/task/lang/zh-tw.php @@ -176,9 +176,8 @@ $lang->task->error->left = '請填寫"剩餘"'; $lang->task->error->work = '"備註"必須小於%d個字元'; $lang->task->error->skipClose = '任務:%s 不是“已完成”或“已取消”狀態,確定要關閉嗎?'; $lang->task->error->consumed = '任務:%s工時不能小於0,忽略該任務工時的改動'; -$lang->task->error->isFinish = '已完成任務,勿重複提交'; -/* 統計報表。*/ +/* Report. */ $lang->task->report = new stdclass(); $lang->task->report->common = '報表'; $lang->task->report->select = '請選擇報表類型'; diff --git a/module/testreport/lang/zh-tw.php b/module/testreport/lang/zh-tw.php index bc351539d2..1797cee618 100644 --- a/module/testreport/lang/zh-tw.php +++ b/module/testreport/lang/zh-tw.php @@ -52,18 +52,18 @@ $lang->testreport->legacyBugs = '遺留的Bug'; $lang->testreport->bugConfirmedRate = '有效Bug率 (方案為已解決或延期 / 狀態為已解決或已關閉)'; $lang->testreport->bugCreateByCaseRate = '用例發現Bug率 (用例創建的Bug / 時間區間中新增的Bug)'; -$lang->testreport->caseSummary = '共有%s個用例,共執行%s個用例,產生了%s個結果,失敗的用例有%s個。'; -$lang->testreport->buildSummary = '共測試了%s個版本。'; -$lang->testreport->confirmDelete = '是否刪除該報告?'; -$lang->testreport->moreNotice = '更多功能可以參考禪道擴展機制進行擴展,也可以聯繫我們進行定製。'; -$lang->testreport->exportNotice = "由禪道項目管理軟件導出"; -$lang->testreport->noReport = "報表還沒有生成,請稍候查看。"; -$lang->testreport->foundBugTip = "影響版本在測試輪次內,並且創建時間在測試時間範圍內產生的Bug數。"; -$lang->testreport->legacyBugTip = "Bug狀態是激活,或Bug的解決時間在測試結束時間之後。"; -$lang->testreport->fromCaseBugTip= "測試時間範圍內,用例執行失敗後創建的Bug"; -$lang->testreport->errorTrunk = "主幹版本不能創建測試報告,請修改關聯版本!"; +$lang->testreport->caseSummary = '共有%s個用例,共執行%s個用例,產生了%s個結果,失敗的用例有%s個。'; +$lang->testreport->buildSummary = '共測試了%s個版本。'; +$lang->testreport->confirmDelete = '是否刪除該報告?'; +$lang->testreport->moreNotice = '更多功能可以參考禪道擴展機制進行擴展,也可以聯繫我們進行定製。'; +$lang->testreport->exportNotice = "由禪道項目管理軟件導出"; +$lang->testreport->noReport = "報表還沒有生成,請稍候查看。"; +$lang->testreport->foundBugTip = "影響版本在測試輪次內,並且創建時間在測試時間範圍內產生的Bug數。"; +$lang->testreport->legacyBugTip = "Bug狀態是激活,或Bug的解決時間在測試結束時間之後。"; +$lang->testreport->fromCaseBugTip = "測試時間範圍內,用例執行失敗後創建的Bug"; +$lang->testreport->errorTrunk = "主幹版本不能創建測試報告,請修改關聯版本!"; -$lang->testreport->bugSummary = <<testreport->bugSummary = <<%s個Bug , 遺留%s個Bug 。 用例執行產生%s個Bug 。 diff --git a/module/webhook/control.php b/module/webhook/control.php index da9d02bc5c..4aecf53d51 100644 --- a/module/webhook/control.php +++ b/module/webhook/control.php @@ -26,10 +26,12 @@ class webhook extends control $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->list; - $this->view->webhooks = $this->webhook->getList($orderBy, $pager); - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; + $this->view->title = $this->lang->webhook->api . $this->lang->colon . $this->lang->webhook->list; + $this->view->webhooks = $this->webhook->getList($orderBy, $pager); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api); + $this->view->position[] = $this->lang->webhook->common; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; $this->display(); } @@ -54,6 +56,9 @@ class webhook extends control $this->view->projects = $this->loadModel('project')->getPairs(); $this->view->objectTypes = $this->webhook->getObjectTypes(); $this->view->objectActions = $this->webhook->getObjectActions(); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common); + $this->view->position[] = $this->lang->webhook->create; $this->display(); } @@ -80,6 +85,9 @@ class webhook extends control $this->view->projects = $this->loadModel('project')->getPairs(); $this->view->objectTypes = $this->webhook->getObjectTypes(); $this->view->objectActions = $this->webhook->getObjectActions(); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common); + $this->view->position[] = $this->lang->webhook->edit; $this->view->webhook = $webhook; $this->display(); } @@ -116,11 +124,14 @@ class webhook extends control $pager = new pager($recTotal, $recPerPage, $pageID); $webhook = $this->webhook->getByID($id); - $this->view->title = $this->lang->webhook->log . $this->lang->colon . $webhook->name; - $this->view->logs = $this->webhook->getLogList($id, $orderBy, $pager); - $this->view->webhook = $webhook; - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; + $this->view->title = $this->lang->webhook->log . $this->lang->colon . $webhook->name; + $this->view->logs = $this->webhook->getLogList($id, $orderBy, $pager); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->api); + $this->view->position[] = html::a(inlink('browse'), $this->lang->webhook->common); + $this->view->position[] = $this->lang->webhook->log; + $this->view->webhook = $webhook; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; $this->display(); } diff --git a/module/webhook/lang/en.php b/module/webhook/lang/en.php index 94ee063af6..e803669768 100644 --- a/module/webhook/lang/en.php +++ b/module/webhook/lang/en.php @@ -17,8 +17,8 @@ $lang->webhook->name = 'Name'; $lang->webhook->url = 'Webhook Address'; $lang->webhook->contentType = 'Content Type'; $lang->webhook->sendType = 'Send Type'; -$lang->webhook->product = 'Product'; -$lang->webhook->project = 'Project'; +$lang->webhook->product = "{$lang->productCommon}"; +$lang->webhook->project = "{$lang->projectCommon}"; $lang->webhook->params = 'Params'; $lang->webhook->action = 'Action'; $lang->webhook->desc = 'Desc'; @@ -39,8 +39,8 @@ $lang->webhook->sendTypeList['async'] = 'Asynchronous'; $lang->webhook->paramsList['objectType'] = 'Object Type'; $lang->webhook->paramsList['objectID'] = 'Object ID'; -$lang->webhook->paramsList['product'] = 'Product'; -$lang->webhook->paramsList['project'] = 'Project'; +$lang->webhook->paramsList['product'] = "{$lang->productCommon}"; +$lang->webhook->paramsList['project'] = "{$lang->projectCommon}"; $lang->webhook->paramsList['action'] = 'Action'; $lang->webhook->paramsList['actor'] = 'Actor'; $lang->webhook->paramsList['date'] = 'Date'; @@ -54,9 +54,12 @@ $lang->webhook->trimWords = ''; $lang->webhook->note = new stdClass(); $lang->webhook->note->async = 'If the send type is asynchronous, need open cron.'; -$lang->webhook->note->product = 'All actions will trigger the hook if the product is empty, else only actions of the product will trigger it.'; -$lang->webhook->note->project = 'All actions will trigger the hook if the project is empty, else only actions of the project will trigger it.'; +$lang->webhook->note->product = "All actions will trigger the hook if the {$lang->productCommon} is empty, else only actions of the {$lang->productCommon} will trigger it."; +$lang->webhook->note->project = "All actions will trigger the hook if the {$lang->projectCommon} is empty, else only actions of the {$lang->projectCommon} will trigger it."; $lang->webhook->note->typeList['bearychat'] = 'Add a zentao bot in bearychat and get the webhook address.'; $lang->webhook->note->typeList['dingding'] = 'Add a customed bot in dingding and get the webhook address.'; $lang->webhook->note->typeList['default'] = 'Get webhook address from others'; + +$lang->webhook->error = new stdclass(); +$lang->webhook->error->curl = 'Load php-curl in php.ini.'; diff --git a/module/webhook/lang/zh-cn.php b/module/webhook/lang/zh-cn.php index f04a3780a0..4c6342c5a4 100644 --- a/module/webhook/lang/zh-cn.php +++ b/module/webhook/lang/zh-cn.php @@ -1,15 +1,15 @@ webhook->common = 'Webhook'; -$lang->webhook->list = '钩子列表'; +$lang->webhook->list = 'Webhook列表'; $lang->webhook->api = '接口'; $lang->webhook->entry = '应用'; $lang->webhook->log = '日志'; $lang->webhook->assigned = '指派给'; -$lang->webhook->browse = '浏览钩子'; -$lang->webhook->create = '添加钩子'; -$lang->webhook->edit = '编辑钩子'; -$lang->webhook->delete = '删除钩子'; +$lang->webhook->browse = '浏览Webhook'; +$lang->webhook->create = '添加Webhook'; +$lang->webhook->edit = '编辑Webhook'; +$lang->webhook->delete = '删除Webhook'; $lang->webhook->id = 'ID'; $lang->webhook->type = '类型'; @@ -17,8 +17,8 @@ $lang->webhook->name = '名称'; $lang->webhook->url = 'Hook地址'; $lang->webhook->contentType = '内容类型'; $lang->webhook->sendType = '发送方式'; -$lang->webhook->product = '关联产品'; -$lang->webhook->project = '关联项目'; +$lang->webhook->product = "关联{$lang->productCommon}"; +$lang->webhook->project = "关联{$lang->projectCommon}"; $lang->webhook->params = '参数'; $lang->webhook->action = '触发动作'; $lang->webhook->desc = '描述'; @@ -39,8 +39,8 @@ $lang->webhook->sendTypeList['async'] = '异步'; $lang->webhook->paramsList['objectType'] = '对象类型'; $lang->webhook->paramsList['objectID'] = '对象ID'; -$lang->webhook->paramsList['product'] = '所属产品'; -$lang->webhook->paramsList['project'] = '所属项目'; +$lang->webhook->paramsList['product'] = "所属{$lang->productCommon}"; +$lang->webhook->paramsList['project'] = "所属{$lang->projectCommon}"; $lang->webhook->paramsList['action'] = '动作'; $lang->webhook->paramsList['actor'] = '操作者'; $lang->webhook->paramsList['date'] = '操作日期'; @@ -54,9 +54,12 @@ $lang->webhook->trimWords = '了'; $lang->webhook->note = new stdClass(); $lang->webhook->note->async = '异步需要打开计划任务'; -$lang->webhook->note->product = '此项为空时所有产品的动作都会触发钩子,否则只有关联产品的动作才会触发。'; -$lang->webhook->note->project = '此项为空时所有项目的动作都会触发钩子,否则只有关联项目的动作才会触发。'; +$lang->webhook->note->product = "此项为空时所有{$lang->productCommon}的动作都会触发钩子,否则只有关联{$lang->productCommon}的动作才会触发。"; +$lang->webhook->note->project = "此项为空时所有{$lang->projectCommon}的动作都会触发钩子,否则只有关联{$lang->projectCommon}的动作才会触发。"; $lang->webhook->note->typeList['bearychat'] = '请在倍洽中添加一个禅道机器人,并将其webhook填写到此处。'; $lang->webhook->note->typeList['dingding'] = '请在钉钉中添加一个自定义机器人,并将其webhook填写到此处。'; $lang->webhook->note->typeList['default'] = '从第三方系统获取webhook并填写到此处。'; + +$lang->webhook->error = new stdclass(); +$lang->webhook->error->curl = '需要加载php-curl扩展。'; diff --git a/module/webhook/lang/zh-tw.php b/module/webhook/lang/zh-tw.php index da971b2b59..b7128942e4 100644 --- a/module/webhook/lang/zh-tw.php +++ b/module/webhook/lang/zh-tw.php @@ -1,15 +1,15 @@ webhook->common = 'webhook'; -$lang->webhook->list = '鈎子列表'; +$lang->webhook->common = 'Webhook'; +$lang->webhook->list = 'Webhook列表'; $lang->webhook->api = '介面'; $lang->webhook->entry = '應用'; $lang->webhook->log = '日誌'; $lang->webhook->assigned = '指派給'; -$lang->webhook->browse = '瀏覽鈎子'; -$lang->webhook->create = '添加鈎子'; -$lang->webhook->edit = '編輯鈎子'; -$lang->webhook->delete = '刪除鈎子'; +$lang->webhook->browse = '瀏覽Webhook'; +$lang->webhook->create = '添加Webhook'; +$lang->webhook->edit = '編輯Webhook'; +$lang->webhook->delete = '刪除Webhook'; $lang->webhook->id = 'ID'; $lang->webhook->type = '類型'; @@ -17,8 +17,8 @@ $lang->webhook->name = '名稱'; $lang->webhook->url = 'Hook地址'; $lang->webhook->contentType = '內容類型'; $lang->webhook->sendType = '發送方式'; -$lang->webhook->product = '關聯產品'; -$lang->webhook->project = '關聯項目'; +$lang->webhook->product = "關聯{$lang->productCommon}"; +$lang->webhook->project = "關聯{$lang->projectCommon}"; $lang->webhook->params = '參數'; $lang->webhook->action = '觸發動作'; $lang->webhook->desc = '描述'; @@ -39,8 +39,8 @@ $lang->webhook->sendTypeList['async'] = '非同步'; $lang->webhook->paramsList['objectType'] = '對象類型'; $lang->webhook->paramsList['objectID'] = '對象ID'; -$lang->webhook->paramsList['product'] = '所屬產品'; -$lang->webhook->paramsList['project'] = '所屬項目'; +$lang->webhook->paramsList['product'] = "所屬{$lang->productCommon}"; +$lang->webhook->paramsList['project'] = "所屬{$lang->projectCommon}"; $lang->webhook->paramsList['action'] = '動作'; $lang->webhook->paramsList['actor'] = '操作者'; $lang->webhook->paramsList['date'] = '操作日期'; @@ -54,9 +54,12 @@ $lang->webhook->trimWords = '了'; $lang->webhook->note = new stdClass(); $lang->webhook->note->async = '非同步需要打開計劃任務'; -$lang->webhook->note->product = '此項為空時所有產品的動作都會觸發鈎子,否則只有關聯產品的動作才會觸發。'; -$lang->webhook->note->project = '此項為空時所有項目的動作都會觸發鈎子,否則只有關聯項目的動作才會觸發。'; +$lang->webhook->note->product = "此項為空時所有{$lang->productCommon}的動作都會觸發鈎子,否則只有關聯{$lang->productCommon}的動作才會觸發。"; +$lang->webhook->note->project = "此項為空時所有{$lang->projectCommon}的動作都會觸發鈎子,否則只有關聯{$lang->projectCommon}的動作才會觸發。"; $lang->webhook->note->typeList['bearychat'] = '請在倍洽中添加一個禪道機器人,並將其webhook填寫到此處。'; $lang->webhook->note->typeList['dingding'] = '請在釘釘中添加一個自定義機器人,並將其webhook填寫到此處。'; $lang->webhook->note->typeList['default'] = '從第三方系統獲取webhook並填寫到此處。'; + +$lang->webhook->error = new stdclass(); +$lang->webhook->error->curl = '需要加載php-curl擴展。'; diff --git a/module/webhook/model.php b/module/webhook/model.php index ae3087d75b..105303d264 100644 --- a/module/webhook/model.php +++ b/module/webhook/model.php @@ -399,6 +399,8 @@ class webhookModel extends model */ public function fetchHook($webhook, $sendData) { + if(!extension_loaded('curl')) die(helper::jsonEncode($this->lang->webhook->error->curl)); + $header[] = "Content-Type: {$webhook->contentType};charset=utf-8"; $ch = curl_init(); diff --git a/module/webhook/view/create.html.php b/module/webhook/view/create.html.php index f449c1d048..0ac100cbf2 100644 --- a/module/webhook/view/create.html.php +++ b/module/webhook/view/create.html.php @@ -70,11 +70,11 @@ webhook->objectTypes as $objectType => $actions):?> - @@ -93,4 +93,4 @@
+ - +
- + diff --git a/module/webhook/view/edit.html.php b/module/webhook/view/edit.html.php index 53e351327c..53b62af97b 100644 --- a/module/webhook/view/edit.html.php +++ b/module/webhook/view/edit.html.php @@ -68,7 +68,7 @@ webhook->objectTypes as $objectType => $actions):?> -
+
- + diff --git a/module/webhook/view/header.html.php b/module/webhook/view/header.html.php index 3458d7405e..6f1ed0676a 100644 --- a/module/webhook/view/header.html.php +++ b/module/webhook/view/header.html.php @@ -13,7 +13,7 @@