From c00a40a60a08a475becc92757042ad3a62d0ee0e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 26 Feb 2020 10:45:55 +0800 Subject: [PATCH] * adjust for task #6893. --- module/integration/js/create.js | 3 - module/integration/js/edit.js | 3 - module/integration/lang/en.php | 3 +- module/integration/lang/zh-cn.php | 3 +- module/integration/model.php | 10 +- module/integration/view/create.html.php | 7 +- module/integration/view/edit.html.php | 7 +- module/repo/config.php | 2 +- module/repo/control.php | 7 +- module/repo/lang/en.php | 1 + module/repo/lang/zh-cn.php | 9 +- module/repo/view/setmatchcomment.html.php | 123 ++++++++++++++-------- 12 files changed, 108 insertions(+), 70 deletions(-) diff --git a/module/integration/js/create.js b/module/integration/js/create.js index 2894b9a9b9..06b63e32f5 100644 --- a/module/integration/js/create.js +++ b/module/integration/js/create.js @@ -66,19 +66,16 @@ $('#triggerType').change(function() var type = $(this).val(); if(type == 'tag') { - $('.tag-fields').removeClass('hidden'); $('.comment-fields').addClass('hidden'); $('.custom-fields').addClass('hidden'); } else if(type == 'commit') { - $('.tag-fields').addClass('hidden'); $('.comment-fields').removeClass('hidden'); $('.custom-fields').addClass('hidden'); } else if(type == 'schedule') { - $('.tag-fields').addClass('hidden'); $('.comment-fields').addClass('hidden'); $('.custom-fields').removeClass('hidden'); } diff --git a/module/integration/js/edit.js b/module/integration/js/edit.js index b66621326a..a772843d13 100644 --- a/module/integration/js/edit.js +++ b/module/integration/js/edit.js @@ -68,19 +68,16 @@ $('#triggerType').change(function() var type = $(this).val(); if(type == 'tag') { - $('.tag-fields').removeClass('hidden'); $('.comment-fields').addClass('hidden'); $('.custom-fields').addClass('hidden'); } else if(type == 'commit') { - $('.tag-fields').addClass('hidden'); $('.comment-fields').removeClass('hidden'); $('.custom-fields').addClass('hidden'); } else if(type == 'schedule') { - $('.tag-fields').addClass('hidden'); $('.comment-fields').addClass('hidden'); $('.custom-fields').removeClass('hidden'); } diff --git a/module/integration/lang/en.php b/module/integration/lang/en.php index d3706339cd..148eb157e0 100644 --- a/module/integration/lang/en.php +++ b/module/integration/lang/en.php @@ -18,8 +18,7 @@ $lang->integration->scheduleDay = 'Custom Days'; $lang->integration->lastExec = 'Last Executed'; $lang->integration->example = 'e.g.'; -$lang->integration->tagEx = 'build_#15, to build Jenkins job that id is 15.'; -$lang->integration->commitEx = 'start build #15, to build Jenkins job that id is 15.'; +$lang->integration->commitEx = '%build% %integration% %id%15, to build Jenkins job that id is 15.'; $lang->integration->cronSample = 'e.g. 0 0 2 * * 2-6/1 means 2:00 a.m. every weekday.'; $lang->integration->sendExec = 'Send execute request success.'; diff --git a/module/integration/lang/zh-cn.php b/module/integration/lang/zh-cn.php index f4ef638185..dc327991d9 100644 --- a/module/integration/lang/zh-cn.php +++ b/module/integration/lang/zh-cn.php @@ -20,8 +20,7 @@ $lang->integration->scheduleDay = '自定义天数'; $lang->integration->lastExec = '最后执行'; $lang->integration->example = '举例'; -$lang->integration->tagEx = 'build_#15,其中15为Jenkins任务编号'; -$lang->integration->commitEx = 'start build #15,其中15为Jenkins任务编号'; +$lang->integration->commitEx = '%build% %integration% %id%15,其中15为Jenkins任务编号'; $lang->integration->cronSample = '如 0 0 2 * * 2-6/1 表示每个工作日凌晨2点'; $lang->integration->sendExec = '发送执行请求成功!'; diff --git a/module/integration/model.php b/module/integration/model.php index a99d8210ba..1f446e07d2 100644 --- a/module/integration/model.php +++ b/module/integration/model.php @@ -75,6 +75,10 @@ class integrationModel extends model if(!isset($integration->scheduleDay)) $integration->scheduleDay = array(); $integration->scheduleDay = join(',', $integration->scheduleDay); } + else + { + $integration->scheduleDay = ''; + } $this->dao->insert(TABLE_INTEGRATION)->data($integration) ->batchCheck($this->config->integration->create->requiredFields, 'notempty') @@ -99,7 +103,7 @@ class integrationModel extends model public function update($id) { $oldIntegration = $this->getById($id); - $integration = fixer::input('post') + $integration = fixer::input('post') ->add('editedBy', $this->app->user->account) ->add('editedDate', helper::now()) ->remove('repoType') @@ -109,6 +113,10 @@ class integrationModel extends model if(!isset($integration->scheduleDay)) $integration->scheduleDay = array(); $integration->scheduleDay = join(',', $integration->scheduleDay); } + else + { + $integration->scheduleDay = ''; + } $this->dao->update(TABLE_INTEGRATION)->data($integration) ->batchCheck($this->config->integration->edit->requiredFields, 'notempty') diff --git a/module/integration/view/create.html.php b/module/integration/view/create.html.php index 7056779d96..40becea011 100644 --- a/module/integration/view/create.html.php +++ b/module/integration/view/create.html.php @@ -45,13 +45,10 @@ integration->triggerTypeList, '', "class='form-control chosen'");?> - - integration->example; ?> - integration->tagEx; ?> - integration->example; ?> - integration->commitEx; ?> + repo->matchComment)) $config->repo->matchComment = json_decode($config->repo->matchComment, true);?> + repo->matchComment['integration']['start'], $config->repo->matchComment['module']['integration'], $config->repo->matchComment['id']['mark']), $lang->integration->commitEx);?> integration->scheduleDay; ?> diff --git a/module/integration/view/edit.html.php b/module/integration/view/edit.html.php index dcd6b1b47f..f75dd42000 100644 --- a/module/integration/view/edit.html.php +++ b/module/integration/view/edit.html.php @@ -49,13 +49,10 @@ integration->triggerTypeList, $job->triggerType, "class='form-control chosen'"); ?> - - integration->example; ?> - integration->tagEx; ?> - integration->example; ?> - integration->commitEx; ?> + repo->matchComment)) $config->repo->matchComment = json_decode($config->repo->matchComment, true);?> + repo->matchComment['integration']['start'], $config->repo->matchComment['module']['integration'], $config->repo->matchComment['id']['mark']), $lang->integration->commitEx);?> integration->scheduleDay;?> diff --git a/module/repo/config.php b/module/repo/config.php index 2637495f26..7a0c7ed085 100644 --- a/module/repo/config.php +++ b/module/repo/config.php @@ -49,7 +49,7 @@ $config->repo->matchComment['task']['finish'] = 'Finish'; $config->repo->matchComment['task']['cancel'] = 'Cancel'; $config->repo->matchComment['task']['consumed'] = 'Cost'; $config->repo->matchComment['task']['left'] = 'Left'; -$config->repo->matchComment['bug']['resolve'] = 'Resolve'; +$config->repo->matchComment['bug']['resolve'] = 'Fix'; $config->repo->matchComment['bug']['resolvedBuild'] = 'Build'; $config->repo->matchComment['integration']['start'] = 'Start'; $config->repo->matchComment['id']['mark'] = '#'; diff --git a/module/repo/control.php b/module/repo/control.php index 0c3961a45a..7d23a76cda 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -577,12 +577,14 @@ class repo extends control * @access public * @return void */ - public function setMatchComment() + public function setMatchComment($module = '') { if($_POST) { + $module = $this->post->selectModule; + unset($_POST['selectModule']); $this->loadModel('setting')->setItem('system.repo.matchComment', json_encode($this->post->matchComment)); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setMatchComment'))); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setMatchComment', "module={$module}"))); } $this->repo->setMenu($this->repos, $this->session->repoID, false); @@ -596,6 +598,7 @@ class repo extends control $this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->setMatchComment; $this->view->position[] = $this->lang->repo->setMatchComment; + $this->view->selectModule = $module; $this->display(); } diff --git a/module/repo/lang/en.php b/module/repo/lang/en.php index 00438e65d9..aa36fd26c4 100644 --- a/module/repo/lang/en.php +++ b/module/repo/lang/en.php @@ -21,6 +21,7 @@ $lang->repo->deleteBug = 'Delete Bug'; $lang->repo->addComment = 'Add Comment'; $lang->repo->editComment = 'Edit Comment'; $lang->repo->deleteComment = 'Delete Comment'; +$lang->repo->selectModule = 'Select Module'; $lang->repo->submit = 'Submit'; $lang->repo->cancel = 'Cancel'; diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index 9240bcdf95..c680f543ff 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -21,6 +21,7 @@ $lang->repo->deleteBug = '删除评审'; $lang->repo->addComment = '添加备注'; $lang->repo->editComment = '编辑备注'; $lang->repo->deleteComment = '删除备注'; +$lang->repo->selectModule = '选择模块'; $lang->repo->submit = '提交'; $lang->repo->cancel = '取消'; @@ -127,9 +128,11 @@ $lang->repo->notice->lastSyncTime = '最后更新于:'; $lang->repo->matchComment = new stdclass(); $lang->repo->matchComment->exampleLabel = "注释示例"; -$lang->repo->matchComment->example['task']['start'] = "%start% %task% %id%1%split%2 %cost%%consumedmark%1 %left%%leftmark%3"; -$lang->repo->matchComment->example['task']['finish'] = "%finish% %task% %id%1%split%2 %cost%%consumedmark%10"; -$lang->repo->matchComment->example['bug']['resolve'] = "%resolve% %bug% %id%1%split%2 %resolvedBuild% %buildmark%10"; +$lang->repo->matchComment->example['story']['common'] = "%story% %id%1%split%2"; +$lang->repo->matchComment->example['task']['start'] = "%start% %task% %id%1%split%2 %cost%%consumedmark%1 %left%%leftmark%3"; +$lang->repo->matchComment->example['task']['finish'] = "%finish% %task% %id%1%split%2 %cost%%consumedmark%10"; +$lang->repo->matchComment->example['bug']['resolve'] = "%resolve% %bug% %id%1%split%2 %resolvedBuild% %buildmark%10"; +$lang->repo->matchComment->example['integration']['start'] = "%build% %integration% %id%1%split%2"; $lang->repo->error = new stdclass(); $lang->repo->error->useless = '你的服务器禁用了exec,shell_exec方法,无法使用该功能'; diff --git a/module/repo/view/setmatchcomment.html.php b/module/repo/view/setmatchcomment.html.php index ec7e1fecdc..df726aeca2 100644 --- a/module/repo/view/setmatchcomment.html.php +++ b/module/repo/view/setmatchcomment.html.php @@ -19,19 +19,29 @@ - - + + - + + + + + - + - - + - - + - - + - @@ -102,36 +113,62 @@
repo->module;?> -
- repo->matchComment['module'] as $module => $match):?> - {$module}->common;?> - - -
+
repo->selectModule;?> + repo->matchComment['module'] as $module => $match) $modules[$module] = $lang->{$module}->common; + echo html::select('selectModule', $modules, $selectModule, "class='form-control chosen'"); + ?>
task->common;?>repo->module;?> + repo->matchComment['module'] as $module => $match):?> +
+ + +
+ +
idAB;?> +
repo->matchComment['id'] as $method => $match):?> repo->$method;?> @@ -73,23 +83,24 @@
repo->matchComment->exampleLabel;?>
+