diff --git a/module/repo/config.php b/module/repo/config.php
index f29e7746f3..ce59d1621e 100644
--- a/module/repo/config.php
+++ b/module/repo/config.php
@@ -54,3 +54,5 @@ $config->repo->rules['id']['split'] = ',';
$config->repo->rules['mark']['consumed'] = ':';
$config->repo->rules['mark']['left'] = ':';
$config->repo->rules['mark']['resolvedBuild'] = '#';
+$config->repo->rules['unit']['consumed'] = 'h';
+$config->repo->rules['unit']['left'] = 'h';
diff --git a/module/repo/js/setrules.js b/module/repo/js/setrules.js
index fc5c5be0a2..2763cd8db4 100644
--- a/module/repo/js/setrules.js
+++ b/module/repo/js/setrules.js
@@ -15,6 +15,8 @@ function replaceExample()
var consumedmark = $('[id*=mark][id*=consumed]').val().split(';');
var lefts = $('[id*=task][id*=left]').val().split(';');
var leftMarks = $('[id*=mark][id*=left]').val().split(';');
+ var cunits = $('[id*=unit][id*=consumed]').val().split(';');
+ var lunits = $('[id*=unit][id*=left]').val().split(';');
for(i in startTask)
{
@@ -40,14 +42,24 @@ function replaceExample()
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);
+ for(q in cunits)
+ {
+ cunit = cunits[q];
+ for(r in cunits)
+ {
+ lunit = lunits[q];
+ 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)
+ .replace('%cunit%', cunit)
+ .replace('%lunit%', lunit);
+ }
+ }
}
}
}
@@ -76,12 +88,22 @@ function replaceExample()
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)
+ for(o in cunits)
+ {
+ cunit = cunits[o];
+ for(p in cunits)
+ {
+ lunit = lunits[p];
+ html += '
' + rulesExample['task']['finish'].replace('%finish%', finish)
+ .replace('%task%', task)
+ .replace('%id%', id)
+ .replace('%split%', split)
+ .replace('%cost%', cost)
+ .replace('%consumedmark%', consumed)
+ .replace('%cunit%', cunit)
+ .replace('%lunit%', lunit);
+ }
+ }
}
}
}
@@ -114,14 +136,24 @@ function replaceExample()
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);
+ for(q in cunits)
+ {
+ cunit = cunits[q];
+ for(r in cunits)
+ {
+ lunit = lunits[r];
+ 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)
+ .replace('%cunit%', cunit)
+ .replace('%lunit%', lunit);
+ }
+ }
}
}
}
diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php
index aec07f18a2..ac989f738e 100644
--- a/module/repo/lang/zh-cn.php
+++ b/module/repo/lang/zh-cn.php
@@ -102,6 +102,7 @@ $lang->repo->objectRule = '对象匹配规则';
$lang->repo->objectIdRule = '对象ID匹配规则';
$lang->repo->actionRule = '动作匹配规则';
$lang->repo->manHourRule = '工时匹配规则';
+$lang->repo->ruleUnit = "单位";
$lang->repo->ruleSplit = "多关键字用';'分割,如:任务多关键字: Task;task";
$lang->repo->viewDiffList['inline'] = '直列';
@@ -133,9 +134,9 @@ $lang->repo->notice->lastSyncTime = '最后更新于:';
$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['task']['start'] = "%start% %task% %id%1%split%2 %cost%%consumedmark%1%cunit% %left%%leftmark%3%lunit%";
+$lang->repo->rules->example['task']['finish'] = "%finish% %task% %id%1%split%2 %cost%%consumedmark%10%cunit%";
+$lang->repo->rules->example['task']['effort'] = "%effort% %task% %id%1%split%2 %cost%%consumedmark%1%cunit% %left%%leftmark%3%lunit%";
$lang->repo->rules->example['bug']['resolve'] = "%resolve% %bug% %id%1%split%2 %resolvedBuild% %buildmark%10";
$lang->repo->error = new stdclass();
diff --git a/module/repo/model.php b/module/repo/model.php
index ed439adafb..0099e0b4d0 100644
--- a/module/repo/model.php
+++ b/module/repo/model.php
@@ -978,7 +978,7 @@ class repoModel extends model
$tasks[$id] = $id;
$actions['task'][$id]['action'] = 'start';
$actions['task'][$id]['consumed'] = $matches[11][$i];
- $actions['task'][$id]['left'] = $matches[15][$i];
+ $actions['task'][$id]['left'] = $matches[16][$i];
}
}
}
@@ -994,7 +994,7 @@ class repoModel extends model
$tasks[$id] = $id;
$actions['task'][$id]['action'] = 'recordEstimate';
$actions['task'][$id]['consumed'] = $matches[11][$i];
- $actions['task'][$id]['left'] = $matches[15][$i];
+ $actions['task'][$id]['left'] = $matches[16][$i];
}
}
}
@@ -1098,6 +1098,8 @@ class repoModel extends model
$buildMarks = str_replace(';', '|', preg_replace('/([^;])/', '\\\\\1', trim($rules['mark']['resolvedBuild'], ';')));
$taskModule = str_replace(';', '|', trim($rules['module']['task'], ';'));
$bugModule = str_replace(';', '|', trim($rules['module']['bug'], ';'));
+ $costUnit = str_replace(';', '|', trim($rules['unit']['consumed'], ';'));
+ $leftUnit = str_replace(';', '|', trim($rules['unit']['left'], ';'));
$startAction = str_replace(';', '|', trim($rules['task']['start'], ';'));
$finishAction = str_replace(';', '|', trim($rules['task']['finish'], ';'));
$effortAction = str_replace(';', '|', trim($rules['task']['logEfforts'], ';'));
@@ -1105,8 +1107,8 @@ class repoModel extends model
$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]+))";
+ $costReg = "($costs) *(($costMarks)([0-9]+)($costUnit))";
+ $leftReg = "($lefts) *(($leftMarks)([0-9]+)($leftUnit))";
$buildReg = "($builds) *(($buildMarks)([0-9]+))";
$startTaskReg = "({$startAction}) *{$taskReg} +$costReg +$leftReg";
diff --git a/module/repo/view/setrules.html.php b/module/repo/view/setrules.html.php
index 1653a027f5..2eda04630b 100644
--- a/module/repo/view/setrules.html.php
+++ b/module/repo/view/setrules.html.php
@@ -64,12 +64,16 @@
repo->rules['task']['consumed'], "class='form-control'");?>
repo->mark?>
repo->rules['mark']['consumed'], "class='form-control'");?>
+ repo->ruleUnit?>
+ repo->rules['unit']['consumed'], "class='form-control'");?>