diff --git a/module/common/lang/en.php b/module/common/lang/en.php
index a51ce5b176..32a59f7e33 100644
--- a/module/common/lang/en.php
+++ b/module/common/lang/en.php
@@ -338,7 +338,7 @@ $lang->ci->menu->code = array('link' => 'Code|repo|browse|repoID=%s', 'alias
$lang->ci->menu->build = array('link' => 'Build|integration|browse', 'subModule' => 'compile,integration');
$lang->ci->menu->jenkins = array('link' => 'Jenkins|jenkins|browse', 'alias' => 'create,edit');
$lang->ci->menu->maintain = array('link' => 'Repo|repo|maintain', 'alias' => 'create,edit');
-$lang->ci->menu->rule = array('link' => 'Rule|repo|setmatchcomment');
+$lang->ci->menu->rule = array('link' => 'Rule|repo|setrules');
$lang->repo = new stdclass();
$lang->jenkins = new stdclass();
diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php
index 1780d13f03..a1c8d015f3 100644
--- a/module/common/lang/zh-cn.php
+++ b/module/common/lang/zh-cn.php
@@ -338,7 +338,7 @@ $lang->ci->menu->code = array('link' => '代码|repo|browse|repoID=%s', 'ali
$lang->ci->menu->build = array('link' => '构建|integration|browse', 'subModule' => 'compile,integration');
$lang->ci->menu->jenkins = array('link' => 'Jenkins|jenkins|browse', 'alias' => 'create,edit');
$lang->ci->menu->maintain = array('link' => '版本库|repo|maintain', 'alias' => 'create,edit');
-$lang->ci->menu->rule = array('link' => '指令|repo|setmatchcomment');
+$lang->ci->menu->rule = array('link' => '指令|repo|setrules');
$lang->repo = new stdclass();
$lang->jenkins = new stdclass();
diff --git a/module/repo/config.php b/module/repo/config.php
index 7a0c7ed085..f29e7746f3 100644
--- a/module/repo/config.php
+++ b/module/repo/config.php
@@ -40,20 +40,17 @@ $config->repo->edit->requiredFields = 'SCM,name,path,encoding,client';
$config->repo->svn = new stdclass();
$config->repo->svn->requiredFields = 'account,password';
-$config->repo->matchComment['module']['story'] = 'Story';
-$config->repo->matchComment['module']['task'] = 'Task';
-$config->repo->matchComment['module']['bug'] = 'Bug';
-$config->repo->matchComment['module']['integration'] = 'Build';
-$config->repo->matchComment['task']['start'] = 'Start';
-$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'] = 'Fix';
-$config->repo->matchComment['bug']['resolvedBuild'] = 'Build';
-$config->repo->matchComment['integration']['start'] = 'Start';
-$config->repo->matchComment['id']['mark'] = '#';
-$config->repo->matchComment['id']['split'] = ',';
-$config->repo->matchComment['mark']['consumed'] = ':';
-$config->repo->matchComment['mark']['left'] = ':';
-$config->repo->matchComment['mark']['resolvedBuild'] = '#';
+$config->repo->rules['module']['task'] = 'Task';
+$config->repo->rules['module']['bug'] = 'Bug';
+$config->repo->rules['task']['start'] = 'Start';
+$config->repo->rules['task']['finish'] = 'Finish';
+$config->repo->rules['task']['logEfforts'] = 'Effort';
+$config->repo->rules['task']['consumed'] = 'Cost';
+$config->repo->rules['task']['left'] = 'Left';
+$config->repo->rules['bug']['resolve'] = 'Fix';
+$config->repo->rules['bug']['resolvedBuild'] = 'Build';
+$config->repo->rules['id']['mark'] = '#';
+$config->repo->rules['id']['split'] = ',';
+$config->repo->rules['mark']['consumed'] = ':';
+$config->repo->rules['mark']['left'] = ':';
+$config->repo->rules['mark']['resolvedBuild'] = '#';
diff --git a/module/repo/control.php b/module/repo/control.php
index bc9da02aa3..765cd5295c 100644
--- a/module/repo/control.php
+++ b/module/repo/control.php
@@ -640,33 +640,28 @@ class repo extends control
}
/**
- * Set matchComment.
+ * Set Rules.
*
* @access public
* @return void
*/
- public function setMatchComment($module = '')
+ public function setRules($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', "module={$module}")));
+ $this->loadModel('setting')->setItem('system.repo.rules', json_encode($this->post->rules));
+ $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setRules')));
}
$this->repo->setMenu($this->repos, $this->session->repoID, false);
$this->app->loadLang('task');
$this->app->loadLang('bug');
- $this->app->loadLang('story');
- $this->app->loadLang('integration');
- if(is_string($this->config->repo->matchComment)) $this->config->repo->matchComment = json_decode($this->config->repo->matchComment, true);
+ 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->setMatchComment;
- $this->view->position[] = $this->lang->repo->setMatchComment;
+ $this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->setRules;
+ $this->view->position[] = $this->lang->repo->setRules;
- $this->view->selectModule = $module;
$this->display();
}
diff --git a/module/repo/js/setrules.js b/module/repo/js/setrules.js
new file mode 100644
index 0000000000..fc5c5be0a2
--- /dev/null
+++ b/module/repo/js/setrules.js
@@ -0,0 +1,170 @@
+$(function()
+{
+ replaceExample();
+ $('input').keyup(function(){replaceExample()});
+})
+
+function replaceExample()
+{
+ var html = '';
+ var startTask = $('[id*=start').val().split(';');
+ var taskModule = $('[id*=module][id*=task]').val().split(';');
+ var idMark = $('[id*=id][id*=mark]').val().split(';');
+ var idSplit = $('[id*=id][id*=split]').val().split(';');
+ var costs = $('[id*=task][id*=consumed]').val().split(';');
+ var consumedmark = $('[id*=mark][id*=consumed]').val().split(';');
+ var lefts = $('[id*=task][id*=left]').val().split(';');
+ var leftMarks = $('[id*=mark][id*=left]').val().split(';');
+
+ for(i in startTask)
+ {
+ start = startTask[i];
+ for(j in taskModule)
+ {
+ task = taskModule[j];
+ for(k in idMark)
+ {
+ id = idMark[k];
+ for(l in idSplit)
+ {
+ split = idSplit[l];
+ for(m in costs)
+ {
+ cost = costs[m];
+ for(n in consumedmark)
+ {
+ consumed = consumedmark[n];
+ for(o in lefts)
+ {
+ left = lefts[o];
+ for(p in leftMarks)
+ {
+ leftMark = leftMarks[p];
+ html += '
' + rulesExample['task']['start'].replace('%start%', start)
+ .replace('%task%', task)
+ .replace('%id%', id)
+ .replace('%split%', split)
+ .replace('%cost%', cost)
+ .replace('%consumedmark%', consumed)
+ .replace('%left%', left)
+ .replace('%leftmark%', leftMark);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ var finishTask = $('[id*=finish').val().split(';');
+ for(i in finishTask)
+ {
+ finish = finishTask[i];
+ for(j in taskModule)
+ {
+ task = taskModule[j];
+ for(k in idMark)
+ {
+ id = idMark[k];
+ for(l in idSplit)
+ {
+ split = idSplit[l];
+ for(m in costs)
+ {
+ cost = costs[m];
+ for(n in consumedmark)
+ {
+ consumed = consumedmark[n];
+ html += '
' + rulesExample['task']['finish'].replace('%finish%', finish)
+ .replace('%task%', task)
+ .replace('%id%', id)
+ .replace('%split%', split)
+ .replace('%cost%', cost)
+ .replace('%consumedmark%', consumed)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ var effortTask = $('[id*=logEfforts').val().split(';');
+ for(i in effortTask)
+ {
+ effort = effortTask[i];
+ for(j in taskModule)
+ {
+ task = taskModule[j];
+ for(k in idMark)
+ {
+ id = idMark[k];
+ for(l in idSplit)
+ {
+ split = idSplit[l];
+ for(m in costs)
+ {
+ cost = costs[m];
+ for(n in consumedmark)
+ {
+ consumed = consumedmark[n];
+ for(o in lefts)
+ {
+ left = lefts[o];
+ for(p in leftMarks)
+ {
+ leftMark = leftMarks[p];
+ html += '
' + rulesExample['task']['effort'].replace('%effort%', effort)
+ .replace('%task%', task)
+ .replace('%id%', id)
+ .replace('%split%', split)
+ .replace('%cost%', cost)
+ .replace('%consumedmark%', consumed)
+ .replace('%left%', left)
+ .replace('%leftmark%', leftMark);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ var resolveBug = $('[id*=bug][id*="resolve\]"]').val().split(';');
+ var bugModule = $('[id*=module][id*=bug]').val().split(';');
+ var builds = $('[id*=bug][id*=resolvedBuild]').val().split(';');
+ var buildMarks = $('[id*=mark][id*=resolvedBuild]').val().split(';');
+ for(i in resolveBug)
+ {
+ resolve = resolveBug[i];
+ for(j in bugModule)
+ {
+ bug = bugModule[j];
+ for(k in idMark)
+ {
+ id = idMark[k];
+ for(l in idSplit)
+ {
+ split = idSplit[l];
+ for(m in builds)
+ {
+ build = builds[m];
+ for(n in buildMarks)
+ {
+ buildMark = buildMarks[n];
+ html += '
' + rulesExample['bug']['resolve'].replace('%resolve%', resolve)
+ .replace('%bug%', bug)
+ .replace('%id%', id)
+ .replace('%split%', split)
+ .replace('%resolvedBuild%', build)
+ .replace('%buildmark%', buildMark);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $('#example').html(html.substr(6));
+}
diff --git a/module/repo/lang/en.php b/module/repo/lang/en.php
index c794c9ff6a..73ebdc05fe 100644
--- a/module/repo/lang/en.php
+++ b/module/repo/lang/en.php
@@ -9,7 +9,7 @@ $lang->repo->editAction = 'Edit Repo';
$lang->repo->delete = 'Delete Repo';
$lang->repo->showSyncComment = 'Display Synchronization';
$lang->repo->ajaxSyncComment = 'Interface: Ajax Sync Note';
-$lang->repo->setMatchComment = 'Set match comment';
+$lang->repo->setRules = 'Set rules';
$lang->repo->download = 'Download File';
$lang->repo->downloadDiff = 'Download Diff';
$lang->repo->diffAction = 'Revision Diff';
@@ -126,11 +126,11 @@ $lang->repo->notice->deleteBug = 'Are you sure to delete this bug?';
$lang->repo->notice->deleteComment = 'Are you sure to delete this comment?';
$lang->repo->notice->lastSyncTime = 'Last Sync:';
-$lang->repo->matchComment = new stdclass();
-$lang->repo->matchComment->exampleLabel = "Comment Example";
-$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->rules = new stdclass();
+$lang->repo->rules->exampleLabel = "Comment Example";
+$lang->repo->rules->example['task']['start'] = "%start% %task% %id%1%split%2 %cost%%consumedmark%1 %left%%leftmark%3";
+$lang->repo->rules->example['task']['finish'] = "%finish% %task% %id%1%split%2 %cost%%consumedmark%10";
+$lang->repo->rules->example['bug']['resolve'] = "%resolve% %bug% %id%1%split%2 %resolvedBuild% %buildmark%10";
$lang->repo->error = new stdclass();
$lang->repo->error->useless = 'Your server disabled exec and shell_exec, so it cannot be applied.';
diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php
index f6a32e107c..aec07f18a2 100644
--- a/module/repo/lang/zh-cn.php
+++ b/module/repo/lang/zh-cn.php
@@ -9,7 +9,7 @@ $lang->repo->editAction = '编辑版本库';
$lang->repo->delete = '删除版本库';
$lang->repo->showSyncComment = '显示同步进度';
$lang->repo->ajaxSyncComment = '接口:AJAX同步注释';
-$lang->repo->setMatchComment = '注释指令配置';
+$lang->repo->setRules = '指令配置';
$lang->repo->download = '下载';
$lang->repo->downloadDiff = '下载Diff';
$lang->repo->diffAction = '版本对比';
@@ -21,7 +21,6 @@ $lang->repo->deleteBug = '删除评审';
$lang->repo->addComment = '添加备注';
$lang->repo->editComment = '编辑备注';
$lang->repo->deleteComment = '删除备注';
-$lang->repo->selectModule = '选择模块';
$lang->repo->submit = '提交';
$lang->repo->cancel = '取消';
@@ -96,8 +95,14 @@ $lang->repo->commentEdit = '';
$lang->repo->commentDelete = '';
$lang->repo->allChanges = "其他改动";
$lang->repo->commitTitle = "第%s次提交";
-$lang->repo->mark = "匹配标记";
-$lang->repo->split = "分割匹配";
+$lang->repo->mark = "开始标记";
+$lang->repo->split = "多ID间隔";
+
+$lang->repo->objectRule = '对象匹配规则';
+$lang->repo->objectIdRule = '对象ID匹配规则';
+$lang->repo->actionRule = '动作匹配规则';
+$lang->repo->manHourRule = '工时匹配规则';
+$lang->repo->ruleSplit = "多关键字用';'分割,如:任务多关键字: Task;task";
$lang->repo->viewDiffList['inline'] = '直列';
$lang->repo->viewDiffList['appose'] = '并排';
@@ -126,13 +131,12 @@ $lang->repo->notice->deleteBug = '确认删除该Bug?';
$lang->repo->notice->deleteComment = '确认删除该回复?';
$lang->repo->notice->lastSyncTime = '最后更新于:';
-$lang->repo->matchComment = new stdclass();
-$lang->repo->matchComment->exampleLabel = "注释示例";
-$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->rules = new stdclass();
+$lang->repo->rules->exampleLabel = "注释示例";
+$lang->repo->rules->example['task']['start'] = "%start% %task% %id%1%split%2 %cost%%consumedmark%1 %left%%leftmark%3";
+$lang->repo->rules->example['task']['finish'] = "%finish% %task% %id%1%split%2 %cost%%consumedmark%10";
+$lang->repo->rules->example['task']['effort'] = "%effort% %task% %id%1%split%2 %cost%%consumedmark%1 %left%%leftmark%3";
+$lang->repo->rules->example['bug']['resolve'] = "%resolve% %bug% %id%1%split%2 %resolvedBuild% %buildmark%10";
$lang->repo->error = new stdclass();
$lang->repo->error->useless = '你的服务器禁用了exec,shell_exec方法,无法使用该功能';
diff --git a/module/repo/model.php b/module/repo/model.php
index 4c3a0b373d..ed439adafb 100644
--- a/module/repo/model.php
+++ b/module/repo/model.php
@@ -908,18 +908,12 @@ class repoModel extends model
*/
public function replaceCommentLink($comment)
{
+ $rules = $this->processRules();
$stories = array();
$tasks = array();
$bugs = array();
- $commonReg = "(?:\s){0,}((?:#|:|��){0,})([0-9, ]{1,})";
- $taskReg = '/task' . $commonReg . '/i';
- $storyReg = '/story' . $commonReg . '/i';
- $bugReg = '/bug' . $commonReg . '/i';
- if(preg_match_all($storyReg, $comment, $result))
- {
- $storyLinks = $this->addLink($result, 'story');
- foreach($storyLinks as $search => $replace) $comment = str_replace($search, $replace, $comment);
- }
+ $taskReg = '/' . $rules['taskReg'] . '/i';
+ $bugReg = '/' . $rules['bugReg'] . '/i';
if(preg_match_all($taskReg, $comment, $result))
{
$taskLinks = $this->addLink($result, 'task');
@@ -945,16 +939,15 @@ class repoModel extends model
{
if(empty($matches)) return null;
$replaceLines = array();
- foreach($matches[2] as $key => $ids)
+ foreach($matches[3] as $i => $idList)
{
- $spit = strpos($ids, ',') !== false ? ',' : ' ';
- $ids = explode(' ', str_replace(',', ' ', $ids));
- $links = $method . " " . $matches[1][$key];
- foreach($ids as $id)
+ $links = $matches[2][$i] . ' ' . $matches[4][$i];
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id)
{
- if($id) $links .= html::a(helper::createLink($method, 'view', "id=$id"), $id) . $spit;
+ $links .= html::a(helper::createLink($method, 'view', "id=$id"), $id) . $matches[6][$i];
}
- $replaceLines[$matches[0][$key]] = rtrim($links, $spit);
+ $replaceLines[$matches[0][$i]] = rtrim($links, $matches[6][$i]);
}
return $replaceLines;
}
@@ -968,94 +961,95 @@ class repoModel extends model
*/
public function parseComment($comment)
{
- if(is_string($this->config->repo->matchComment)) $this->config->repo->matchComment = json_decode($this->config->repo->matchComment, true);
- $matchComment = $this->config->repo->matchComment;
+ $rules = $this->processRules();
+ $stories = array();
+ $tasks = array();
+ $bugs = array();
+ $actions = array();
- $matches = array();
- $stories = array();
- $tasks = array();
- $bugs = array();
- $integrations = array();
- $actions = array();
- while(true)
+ preg_match_all("/{$rules['startTaskReg']}/", $comment, $matches);
+ if($matches[0])
{
- $found = preg_match("/{$matchComment['id']['mark']}[0-9]+({$matchComment['id']['split']}[0-9]+)*/", $comment, $matches);
- if(empty($found)) break;
- if($found)
+ foreach($matches[4] as $i => $idList)
{
- $position = strpos($comment, $matches[0]);
- $subComment = substr($comment, 0, $position + strlen($matches[0]));
- $comment = substr($comment, $position + strlen($matches[0]) + 1);
-
- $idList = explode($matchComment['id']['mark'], str_replace($matchComment['id']['split'], '', $matches[0]));
- foreach($matchComment['module'] as $module => $moduleMatch)
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id)
{
- if(stripos($subComment, $moduleMatch) !== false)
- {
- if($module == 'story')
- {
- foreach($idList as $id) $stories[$id] = $id;
- }
- elseif($module == 'task')
- {
- foreach($idList as $id) $tasks[$id] = $id;
- foreach($matchComment['task'] as $method => $match)
- {
- if(strpos($subComment, $match) !== false)
- {
- $consumed = 0;
- preg_match("/{$matchComment['task']['consumed']}{$matchComment['mark']['consumed']}([0-9]+)/", $comment, $costMatch);
- if($costMatch) $consumed = $costMatch[1];
-
- $left = 0;
- preg_match("/{$matchComment['task']['left']}{$matchComment['mark']['left']}([0-9]+)/", $comment, $leftMatch);
- if($leftMatch) $left = $leftMatch[1];
-
- foreach($idList as $id)
- {
- $actions['task'][$id]['action'] = $method;
- $actions['task'][$id]['consumed'] = $consumed;
- $actions['task'][$id]['left'] = $left;
- }
- }
- }
- }
- elseif($module == 'bug')
- {
- foreach($idList as $id) $bugs[$id] = $id;
- foreach($matchComment['bug'] as $method => $match)
- {
- if(strpos($subComment, $match) !== false)
- {
- $buildID = 0;
- preg_match("/{$matchComment['bug']['resolvedBuild']}{$matchComment['mark']['resolvedBuild']}([0-9]+)/", $comment, $buildMatch);
- if($buildMatch) $buildID = $buildMatch[1];
-
- foreach($idList as $id)
- {
- $actions['bug'][$id]['action'] = $method;
- $actions['bug'][$id]['resolvedBuild'] = $buildID;
- }
- }
- }
- }
- elseif($module == 'integration')
- {
- foreach($idList as $id) $integrations[$id] = $id;
- foreach($matchComment['integration'] as $method => $match)
- {
- if(strpos($subComment, $match) !== false)
- {
- foreach($idList as $id) $actions['integration'][$id]['action'] = $method;
- }
- }
- }
- }
+ $tasks[$id] = $id;
+ $actions['task'][$id]['action'] = 'start';
+ $actions['task'][$id]['consumed'] = $matches[11][$i];
+ $actions['task'][$id]['left'] = $matches[15][$i];
}
}
}
- return array('stories' => $stories, 'tasks' => $tasks, 'bugs' => $bugs, 'integrations' => $integrations, 'actions' => $actions);
+ preg_match_all("/{$rules['effortTaskReg']}/", $comment, $matches);
+ if($matches[0])
+ {
+ foreach($matches[4] as $i => $idList)
+ {
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id)
+ {
+ $tasks[$id] = $id;
+ $actions['task'][$id]['action'] = 'recordEstimate';
+ $actions['task'][$id]['consumed'] = $matches[11][$i];
+ $actions['task'][$id]['left'] = $matches[15][$i];
+ }
+ }
+ }
+
+ preg_match_all("/{$rules['finishTaskReg']}/", $comment, $matches);
+ if($matches[0])
+ {
+ foreach($matches[4] as $i => $idList)
+ {
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id)
+ {
+ $tasks[$id] = $id;
+ $actions['task'][$id]['action'] = 'finish';
+ $actions['task'][$id]['consumed'] = $matches[11][$i];
+ }
+ }
+ }
+
+ preg_match_all("/{$rules['resolveBugReg']}/", $comment, $matches);
+ if($matches[0])
+ {
+ foreach($matches[4] as $i => $idList)
+ {
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id)
+ {
+ $bugs[$id] = $id;
+ $actions['bug'][$id]['action'] = 'resolve';
+ $actions['bug'][$id]['build'] = $matches[11][$i];
+ }
+ }
+ }
+
+ preg_match_all("/{$rules['taskReg']}/", $comment, $matches);
+ if($matches[0])
+ {
+ foreach($matches[3] as $i => $idList)
+ {
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id) $tasks[$id] = $id;
+ }
+ }
+
+ preg_match_all("/{$rules['bugReg']}/", $comment, $matches);
+ if($matches[0])
+ {
+ foreach($matches[3] as $i => $idList)
+ {
+ preg_match_all('/\d+/', $idList, $idMatches);
+ foreach($idMatches[0] as $id) $bugs[$id] = $id;
+ }
+ }
+
+ return array('stories' => $stories, 'tasks' => $tasks, 'bugs' => $bugs, 'actions' => $actions);
}
/**
@@ -1082,4 +1076,54 @@ class repoModel extends model
return $comment;
}
+
+ /**
+ * Process rules to REG.
+ *
+ * @access public
+ * @return array
+ */
+ public function processRules()
+ {
+ if(is_string($this->config->repo->rules)) $this->config->repo->rules = json_decode($this->config->repo->rules, true);
+ $rules = $this->config->repo->rules;
+
+ $idMarks = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['id']['mark'], ';')));
+ $idSplits = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['id']['split'], ';')));
+ $costs = str_replace(';', '|', trim($rules['task']['consumed'], ';'));
+ $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'], ';')));
+ $builds = str_replace(';', '|', trim($rules['bug']['resolvedBuild'], ';'));
+ $buildMarks = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['mark']['resolvedBuild'], ';')));
+ $taskModule = str_replace(';', '|', trim($rules['module']['task'], ';'));
+ $bugModule = str_replace(';', '|', trim($rules['module']['bug'], ';'));
+ $startAction = str_replace(';', '|', trim($rules['task']['start'], ';'));
+ $finishAction = str_replace(';', '|', trim($rules['task']['finish'], ';'));
+ $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]+)*))";
+ $costReg = "($costs) *(($costMarks)([0-9]+))";
+ $leftReg = "($lefts) *(($leftMarks)([0-9]+))";
+ $buildReg = "($builds) *(($buildMarks)([0-9]+))";
+
+ $startTaskReg = "({$startAction}) *{$taskReg} +$costReg +$leftReg";
+ $effortTaskReg = "({$effortAction}) *{$taskReg} +$costReg +$leftReg";
+ $finishTaskReg = "({$finishAction}) *{$taskReg} +$costReg";
+ $resolveBugReg = "({$resolveAction}) *{$bugReg} +$buildReg";
+
+ $reg = array();
+ $reg['taskReg'] = $taskReg;
+ $reg['bugReg'] = $bugReg;
+ $reg['costReg'] = $costReg;
+ $reg['leftReg'] = $leftReg;
+ $reg['buildReg'] = $buildReg;
+ $reg['startTaskReg'] = $startTaskReg;
+ $reg['effortTaskReg'] = $effortTaskReg;
+ $reg['finishTaskReg'] = $finishTaskReg;
+ $reg['resolveBugReg'] = $resolveBugReg;
+ return $reg;
+ }
}
diff --git a/module/repo/view/setmatchcomment.html.php b/module/repo/view/setmatchcomment.html.php
deleted file mode 100644
index df726aeca2..0000000000
--- a/module/repo/view/setmatchcomment.html.php
+++ /dev/null
@@ -1,175 +0,0 @@
-
- * @package repo
- * @version $Id$
- * @link http://www.zentao.net
- */
-?>
-
-