From 54cb29a788ccaef4e21c834a7e67f319dfc501a9 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 8 Apr 2020 10:39:28 +0800 Subject: [PATCH] * adjust for highlight and add story reg. --- module/common/lang/zh-cn.php | 10 +++++----- module/repo/config.php | 1 + module/repo/control.php | 1 + module/repo/lang/zh-cn.php | 2 +- module/repo/model.php | 23 +++++++++++++++++++++-- module/testcase/view/view.html.php | 2 +- 6 files changed, 30 insertions(+), 9 deletions(-) diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index f64458fb25..c5febad524 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -699,7 +699,7 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyStory') unset($lang->menuOrder[15]); unset($lang->menuOrder[20]); - unset($lang->menuOrder[30]); + unset($lang->menuOrder[35]); /* Adjust sub menu of my dashboard. */ unset($lang->my->menu->bug); @@ -735,7 +735,7 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTask') unset($lang->menuOrder[10]); unset($lang->menuOrder[20]); - unset($lang->menuOrder[30]); + unset($lang->menuOrder[35]); /* Adjust sub menu of my dashboard. */ unset($lang->my->menu->bug); @@ -772,7 +772,7 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTest') unset($lang->menuOrder[15]); unset($lang->menuOrder[20]); - unset($lang->menuOrder[30]); + unset($lang->menuOrder[35]); /* Rename product module. */ $lang->menu->product = "{$lang->productCommon}|product|index"; @@ -790,14 +790,14 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTest') /* Add bug, testcase and testtask module. */ $lang->menu->bug = 'Bug|bug|index'; - $lang->menu->feature = '功能测试|testcase|browse'; + $lang->menu->testcase = '功能测试|testcase|browse'; $lang->menu->unit = '单元测试|testtask|browseUnits'; $lang->menu->testsuite = '套件|testsuite|index'; $lang->menu->testtask = '测试单|testtask|index'; $lang->menu->caselib = '用例库|caselib|browse'; $lang->menuOrder[6] = 'bug'; - $lang->menuOrder[7] = 'feature'; + $lang->menuOrder[7] = 'testcase'; $lang->menuOrder[8] = 'unit'; $lang->menuOrder[9] = 'testsuite'; $lang->menuOrder[10] = 'testtask'; diff --git a/module/repo/config.php b/module/repo/config.php index 6089114f8d..86e31f4308 100644 --- a/module/repo/config.php +++ b/module/repo/config.php @@ -42,6 +42,7 @@ $config->repo->svn->requiredFields = 'account,password'; $config->repo->rules['module']['task'] = 'Task'; $config->repo->rules['module']['bug'] = 'Bug'; +$config->repo->rules['module']['story'] = 'Story'; $config->repo->rules['task']['start'] = 'Start'; $config->repo->rules['task']['finish'] = 'Finish'; $config->repo->rules['task']['logEfforts'] = 'Effort'; diff --git a/module/repo/control.php b/module/repo/control.php index 9bd8d0de8b..05e193f169 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -657,6 +657,7 @@ class repo extends control $this->app->loadLang('task'); $this->app->loadLang('bug'); + $this->app->loadLang('story'); if(is_string($this->config->repo->rules)) $this->config->repo->rules = json_decode($this->config->repo->rules, true); $this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->setRules; diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index bec02c0421..6fe790f7f5 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -104,7 +104,7 @@ $lang->repo->objectIdRule = '对象ID匹配规则'; $lang->repo->actionRule = '动作匹配规则'; $lang->repo->manHourRule = '工时匹配规则'; $lang->repo->ruleUnit = "单位"; -$lang->repo->ruleSplit = "多关键字用';'分割,如:任务多关键字: Task;task"; +$lang->repo->ruleSplit = "多关键字用';'分割,如:任务多关键字: Task;任务"; $lang->repo->viewDiffList['inline'] = '直列'; $lang->repo->viewDiffList['appose'] = '并排'; diff --git a/module/repo/model.php b/module/repo/model.php index 6acc262d95..cf76035b18 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -991,6 +991,7 @@ class repoModel extends model $stories = array(); $tasks = array(); $bugs = array(); + $storyReg = '/' . $rules['storyReg'] . '/i'; $taskReg = '/' . $rules['taskReg'] . '/i'; $bugReg = '/' . $rules['bugReg'] . '/i'; if(preg_match_all($taskReg, $comment, $result)) @@ -1003,6 +1004,11 @@ class repoModel extends model $bugLinks = $this->addLink($result, 'bug'); foreach($bugLinks as $search => $replace) $comment = str_replace($search, $replace, $comment); } + if(preg_match_all($storyReg, $comment, $result)) + { + $storyLinks = $this->addLink($result, 'story'); + foreach($storyLinks as $search => $replace) $comment = str_replace($search, $replace, $comment); + } return $comment; } @@ -1124,6 +1130,16 @@ class repoModel extends model } } + preg_match_all("/{$rules['storyReg']}/i", $comment, $matches); + if($matches[0]) + { + foreach($matches[3] as $i => $idList) + { + preg_match_all('/\d+/', $idList, $idMatches); + foreach($idMatches[0] as $id) $stories[$id] = $id; + } + } + return array('stories' => $stories, 'tasks' => $tasks, 'bugs' => $bugs, 'actions' => $actions); } @@ -1169,6 +1185,7 @@ class repoModel extends model $costMarks = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['mark']['consumed'], ';'))); $lefts = str_replace(';', '|', trim($rules['task']['left'], ';')); $leftMarks = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['mark']['left'], ';'))); + $storyModule = str_replace(';', '|', trim($rules['module']['story'], ';')); $taskModule = str_replace(';', '|', trim($rules['module']['task'], ';')); $bugModule = str_replace(';', '|', trim($rules['module']['bug'], ';')); $costUnit = str_replace(';', '|', trim($rules['unit']['consumed'], ';')); @@ -1178,8 +1195,9 @@ class repoModel extends model $effortAction = str_replace(';', '|', trim($rules['task']['logEfforts'], ';')); $resolveAction = str_replace(';', '|', trim($rules['bug']['resolve'], ';')); - $taskReg = "(($taskModule) +(({$idMarks})[0-9]+(({$idSplits})[0-9]+)*))"; - $bugReg = "(($bugModule) +(({$idMarks})[0-9]+(({$idSplits})[0-9]+)*))"; + $storyReg = "(($storyModule) *(({$idMarks})[0-9]+(({$idSplits})[0-9]+)*))"; + $taskReg = "(($taskModule) *(({$idMarks})[0-9]+(({$idSplits})[0-9]+)*))"; + $bugReg = "(($bugModule) *(({$idMarks})[0-9]+(({$idSplits})[0-9]+)*))"; $costReg = "($costs) *(($costMarks)([0-9]+)($costUnit))"; $leftReg = "($lefts) *(($leftMarks)([0-9]+)($leftUnit))"; @@ -1189,6 +1207,7 @@ class repoModel extends model $resolveBugReg = "({$resolveAction}) *{$bugReg}"; $reg = array(); + $reg['storyReg'] = $storyReg; $reg['taskReg'] = $taskReg; $reg['bugReg'] = $bugReg; $reg['costReg'] = $costReg; diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index e8626998b7..47967a8ebc 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -96,7 +96,7 @@ - xml):?> + xml)):?>
testcase->xml;?>
xml));?>