* finish task #6956.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
+14
-17
@@ -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'] = '#';
|
||||
|
||||
+7
-12
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 += '<br />' + 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 += '<br />' + 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 += '<br />' + 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 += '<br />' + 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));
|
||||
}
|
||||
@@ -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.';
|
||||
|
||||
+15
-11
@@ -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 = '<i class="icon-pencil"></i>';
|
||||
$lang->repo->commentDelete = '<i class="icon-remove"></i>';
|
||||
$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方法,无法使用该功能';
|
||||
|
||||
+140
-96
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The setMatchComment view file of repo module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package repo
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->repo->setMatchComment;?></h2>
|
||||
</div>
|
||||
<form class='main-form form-ajax' method='post'>
|
||||
<table class='table table-form'>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->repo->selectModule;?></th>
|
||||
<td class='w-200px'>
|
||||
<?php
|
||||
foreach($config->repo->matchComment['module'] as $module => $match) $modules[$module] = $lang->{$module}->common;
|
||||
echo html::select('selectModule', $modules, $selectModule, "class='form-control chosen'");
|
||||
?>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->repo->module;?></th>
|
||||
<td>
|
||||
<?php foreach($config->repo->matchComment['module'] as $module => $match):?>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon hidden <?php echo $module . 'Item';?>'><?php echo $lang->{$module}->common;?></span>
|
||||
<?php echo html::input("matchComment[module][{$module}]", $match, "class='form-control hidden {$module}Item'");?>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='taskItem hidden'>
|
||||
<th><?php echo $lang->task->common;?></th>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->matchComment['task'] as $method => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->$method;?></span>
|
||||
<?php echo html::input("matchComment[task][{$method}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='bugItem hidden'>
|
||||
<th><?php echo $lang->bug->common;?></th>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->matchComment['bug'] as $method => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->bug->$method;?></span>
|
||||
<?php echo html::input("matchComment[bug][{$method}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='integrationItem hidden'>
|
||||
<th><?php echo $lang->integration->common;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->matchComment['integration'] as $method => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->integration->$method;?></span>
|
||||
<?php echo html::input("matchComment[integration][{$method}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->idAB;?></th>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->matchComment['id'] as $method => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->repo->$method;?></span>
|
||||
<?php echo html::input("matchComment[id][{$method}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='taskItem bugItem hidden'>
|
||||
<th><?php echo $lang->repo->mark;?></th>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->matchComment['mark'] as $method => $match):?>
|
||||
<?php $module = isset($lang->task->$method) ? 'task' : 'bug';?>
|
||||
<span class='input-group-addon hidden <?php echo $module . 'Item';?>'><?php echo $lang->{$module}->$method?></span>
|
||||
<?php echo html::input("matchComment[mark][{$method}]", $match, "class='form-control hidden {$module}Item'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->matchComment->exampleLabel;?></th>
|
||||
<td colspan='2' id='example'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('matchCommentExample', $lang->repo->matchComment->example);?>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#selectModule').change()
|
||||
$('input').keyup(function(){replaceExample()});
|
||||
})
|
||||
|
||||
$('#selectModule').change(function()
|
||||
{
|
||||
var module = $(this).val();
|
||||
$('[class*=Item]').addClass('hidden');
|
||||
$('.' + module + 'Item').removeClass('hidden');
|
||||
replaceExample();
|
||||
})
|
||||
|
||||
function replaceExample()
|
||||
{
|
||||
var module = $('#selectModule').val();
|
||||
var html = '';
|
||||
if(module == 'story')
|
||||
{
|
||||
html = matchCommentExample['story']['common'].replace('%story%', $('[id*=module][id*=story]').val())
|
||||
.replace('%id%', $('[id*=id][id*=mark]').val())
|
||||
.replace('%split%', $('[id*=id][id*=split]').val());
|
||||
}
|
||||
else if(module == 'task')
|
||||
{
|
||||
html = matchCommentExample['task']['start'].replace('%start%', $('[id*=start').val())
|
||||
.replace('%task%', $('[id*=module][id*=task]').val())
|
||||
.replace('%id%', $('[id*=id][id*=mark]').val())
|
||||
.replace('%split%', $('[id*=id][id*=split]').val())
|
||||
.replace('%cost%', $('[id*=task][id*=consumed]').val())
|
||||
.replace('%consumedmark%', $('[id*=mark][id*=consumed]').val())
|
||||
.replace('%left%', $('[id*=task][id*=left]').val())
|
||||
.replace('%leftmark%', $('[id*=mark][id*=left]').val());
|
||||
html += '<br />' + matchCommentExample['task']['finish'].replace('%finish%', $('[id*=finish]').val())
|
||||
.replace('%task%', $('[id*=module][id*=task]').val())
|
||||
.replace('%id%', $('[id*=id][id*=mark]').val())
|
||||
.replace('%split%', $('[id*=id][id*=split]').val())
|
||||
.replace('%cost%', $('[id*=task][id*=consumed]').val())
|
||||
.replace('%consumedmark%', $('[id*=mark][id*=consumed]').val());
|
||||
}
|
||||
else if(module == 'bug')
|
||||
{
|
||||
html = matchCommentExample['bug']['resolve'].replace('%resolve%', $('[id*=bug][id*="resolve\]"]').val())
|
||||
.replace('%bug%', $('[id*=module][id*=bug]').val())
|
||||
.replace('%id%', $('[id*=id][id*=mark]').val())
|
||||
.replace('%split%', $('[id*=id][id*=split]').val())
|
||||
.replace('%resolvedBuild%', $('[id*=bug][id*=resolvedBuild]').val())
|
||||
.replace('%buildmark%', $('[id*=mark][id*=resolvedBuild]').val());
|
||||
}
|
||||
else if(module == 'integration')
|
||||
{
|
||||
html = matchCommentExample['integration']['start'].replace('%build%', $('[id*=integration][id*=start]').val())
|
||||
.replace('%integration%', $('[id*=module][id*=integration]').val())
|
||||
.replace('%id%', $('[id*=id][id*=mark]').val())
|
||||
.replace('%split%', $('[id*=id][id*=split]').val())
|
||||
}
|
||||
|
||||
$('#example').html(html);
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* The setRules view file of repo module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package repo
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->repo->setRules;?></h2>
|
||||
</div>
|
||||
<form class='main-form form-ajax' method='post'>
|
||||
<table class='table table-form'>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class='w-110px'><?php echo $lang->repo->objectRule;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->rules['module'] as $module => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->{$module}->common;?></span>
|
||||
<?php echo html::input("rules[module][{$module}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->objectIdRule;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->repo->rules['id'] as $method => $match):?>
|
||||
<span class='input-group-addon'><?php echo $lang->repo->$method;?></span>
|
||||
<?php echo html::input("rules[id][{$method}]", $match, "class='form-control'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->actionRule;?></th>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<?php $space = common::checkNotCN() ? ' ' : '';?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->common . $space . $lang->task->start;?></span>
|
||||
<?php echo html::input("rules[task][start]", $config->repo->rules['task']['start'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->common . $space . $lang->task->finish;?></span>
|
||||
<?php echo html::input("rules[task][finish]", $config->repo->rules['task']['finish'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->common . $space . $lang->task->logEfforts;?></span>
|
||||
<?php echo html::input("rules[task][logEfforts]", $config->repo->rules['task']['logEfforts'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->bug->common . $space . $lang->bug->resolve;?></span>
|
||||
<?php echo html::input("rules[bug][resolve]", $config->repo->rules['bug']['resolve'], "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->manHourRule;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("rules[task][consumed]", $config->repo->rules['task']['consumed'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->repo->mark?></span>
|
||||
<?php echo html::input("rules[mark][consumed]", $config->repo->rules['mark']['consumed'], "class='form-control'");?>
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("rules[task][left]", $config->repo->rules['task']['left'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->repo->mark?></span>
|
||||
<?php echo html::input("rules[mark][left]", $config->repo->rules['mark']['left'], "class='form-control'");?>
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->bug->resolvedBuild?></span>
|
||||
<?php echo html::input("rules[bug][resolvedBuild]", $config->repo->rules['bug']['resolvedBuild'], "class='form-control'");?>
|
||||
<span class='input-group-addon'><?php echo $lang->repo->mark?></span>
|
||||
<?php echo html::input("rules[mark][resolvedBuild]", $config->repo->rules['mark']['resolvedBuild'], "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td colspan='2'><?php echo $lang->repo->ruleSplit;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->rules->exampleLabel;?></th>
|
||||
<td colspan='2' id='example'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('rulesExample', $lang->repo->rules->example);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user