* adjust for highlight and add story reg.

This commit is contained in:
wangyidong
2020-04-08 10:39:28 +08:00
parent 44ed0273ea
commit 54cb29a788
6 changed files with 30 additions and 9 deletions
+5 -5
View File
@@ -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';
+1
View File
@@ -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';
+1
View File
@@ -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;
+1 -1
View File
@@ -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'] = '并排';
+21 -2
View File
@@ -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;
+1 -1
View File
@@ -96,7 +96,7 @@
</table>
</div>
</div>
<?php if($case->xml):?>
<?php if(isset($case->xml)):?>
<div class='detail'>
<div class='detail-title'><?php echo $lang->testcase->xml;?></div>
<div class="detail-content article-content"><?php echo nl2br(htmlspecialchars($case->xml));?></div>