diff --git a/module/bug/model.php b/module/bug/model.php
index c6e0d6193b..ed068e2f61 100644
--- a/module/bug/model.php
+++ b/module/bug/model.php
@@ -1408,6 +1408,49 @@ class bugModel extends model
}
}
+ /**
+ * Get statistic.
+ *
+ * @param int $productID
+ * @param string $endDate
+ * @param int $days
+ * @access public
+ * @return void
+ */
+ public function getStatistic($productID = 0, $endDate = '', $days = 30)
+ {
+ $startDate = '';
+ if(empty($endDate)) $endDate = date('Y-m-d');
+
+ $dateArr = array();
+ for($day = $days - 1; $day >= 0; $day--)
+ {
+ $time = strtotime(-$day . ' day', strtotime($endDate));
+ $date = date('m/d', $time);
+ $dateArr[$date] = new stdClass();
+ $dateArr[$date]->num = 0;
+ $dateArr[$date]->date = $date;
+
+ if($day == $days -1) $startDate = date('Y-m-d', $time) . ' 00:00:00';
+ }
+
+ $dateFields = ['openedDate', 'resolvedDate', 'closedDate'];
+ $staticData = array();
+ foreach($dateFields as $field)
+ {
+ $bugCount = $this->dao->select("count(id) as num, date_format($field, '%m/%d') as date")->from(TABLE_BUG)
+ ->where('product')->eq($productID)
+ ->andWhere($field)->ne('0000-00-00 00:00:00')
+ ->andWhere($field)->ne('')
+ ->andWhere('deleted')->eq(0)
+ ->andWhere($field)->between($startDate, $endDate . ' 23:50:59')
+ ->groupBy('date')
+ ->fetchAll('date');
+ $staticData[$field] = array_merge($dateArr, $bugCount);
+ }
+ return $staticData;
+ }
+
/**
* Build search form.
*
diff --git a/module/common/model.php b/module/common/model.php
index b3a2a78654..e9cb226a17 100644
--- a/module/common/model.php
+++ b/module/common/model.php
@@ -65,7 +65,8 @@ class commonModel extends model
if($thisModule == 'execution')
{
$executionID = $objectID;
- $execution = $this->dao->select('id, project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
+ $execution = $this->dao->select('id, project, grade, parent')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch();
+ $this->syncExecutionByChild($execution);
$project = $this->syncProjectStatus($execution);
$this->syncProgramStatus($project);
}
@@ -102,7 +103,6 @@ class commonModel extends model
->andWhere('status')->eq('wait')
->orderBy('id_desc')
->fetchPairs();
-
$now = helper::now();
$this->dao->update(TABLE_PROGRAM)->set('status')->eq('doing')->set('realBegan')->eq($now)->where('id')->in($waitList)->exec();
foreach($waitList as $programID)
@@ -137,6 +137,34 @@ class commonModel extends model
return $project;
}
+ /**
+ * Set the status of the execution to which the sub execution is linked as Ongoing.
+ *
+ * @param object $execution
+ * @access public
+ * @return object $parentExecution
+ */
+ public function syncExecutionByChild($execution)
+ {
+ if($execution->grade == 1) return false;
+
+ $parentExecutionID = $execution->parent;
+ $today = helper::today();
+ $parentExecution = $this->dao->select('*')->from(TABLE_EXECUTION)->where('id')->eq($parentExecutionID)->fetch();
+
+ if($parentExecution->status == 'wait')
+ {
+ $this->dao->update(TABLE_EXECUTION)
+ ->set('status')->eq('doing')
+ ->beginIf(helper::isZeroDate($parentExecution->realBegan))->set('realBegan')->eq($today)->fi()
+ ->where('id')->eq($parentExecutionID)
+ ->exec();
+ $this->loadModel('action')->create('execution', $parentExecutionID, 'syncexecutionbychild');
+ }
+
+ return $parentExecution;
+ }
+
/**
* Set the status of the execution to which the task is linked as Ongoing.
*
diff --git a/module/custom/lang/de.php b/module/custom/lang/de.php
index 2a0dbef906..c8c95b290d 100644
--- a/module/custom/lang/de.php
+++ b/module/custom/lang/de.php
@@ -46,7 +46,7 @@ $lang->custom->SRConcept = "SR Concept";
$lang->custom->reviewRule = 'Review Rules';
$lang->custom->switch = "Switch";
$lang->custom->oneUnit = "One {$lang->hourCommon}";
-$lang->custom->convertRelationTitle = "Please set the conversion factor of {$lang->hourCommon} to %s first";
+$lang->custom->convertRelationTitle = "Please firstly set the conversion factor from {$lang->hourCommon} to %s";
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon;
@@ -71,7 +71,7 @@ $lang->custom->regionMustNumber = 'The interval must be a number!';
$lang->custom->tipNotEmpty = 'The prompt can not be empty!';
$lang->custom->currencyNotEmpty = 'You have to select one currency at least.';
$lang->custom->defaultNotEmpty = 'The default currency can not be empty';
-$lang->custom->convertRelationTips = "After {$lang->hourCommon} is converted to %s, historical data will be uniformly converted to %s";
+$lang->custom->convertRelationTips = "After converting {$lang->hourCommon} to %s, the historical data will be converted uniformly to %s.";
$lang->custom->saveTips = 'After clicking save, the current %s will be used as the default estimation unit';
$lang->custom->numberError = 'The interval must be greater than zero!';
diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php
index a9396a720d..84ffb3fb62 100644
--- a/module/custom/lang/en.php
+++ b/module/custom/lang/en.php
@@ -47,7 +47,7 @@ $lang->custom->SRConcept = "SR Concept";
$lang->custom->reviewRule = 'Review Rules';
$lang->custom->switch = "Switch";
$lang->custom->oneUnit = "One {$lang->hourCommon}";
-$lang->custom->convertRelationTitle = "Please set the conversion factor of {$lang->hourCommon} to %s first";
+$lang->custom->convertRelationTitle = "Please firstly set the conversion factor from {$lang->hourCommon} to %s";
$lang->custom->superReviewers = "Super Reviewer";
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
@@ -73,7 +73,7 @@ $lang->custom->regionMustNumber = 'The interval must be a number!';
$lang->custom->tipNotEmpty = 'The prompt can not be empty!';
$lang->custom->currencyNotEmpty = 'You have to select one currency at least.';
$lang->custom->defaultNotEmpty = 'The default currency can not be empty';
-$lang->custom->convertRelationTips = "After {$lang->hourCommon} is converted to %s, historical data will be uniformly converted to %s";
+$lang->custom->convertRelationTips = "After converting {$lang->hourCommon} to %s, the historical data will be converted uniformly to %s.";
$lang->custom->saveTips = 'After clicking save, the current %s will be used as the default estimation unit';
$lang->custom->numberError = 'The interval must be greater than zero!';
diff --git a/module/custom/lang/fr.php b/module/custom/lang/fr.php
index bf14392a75..82808282f7 100644
--- a/module/custom/lang/fr.php
+++ b/module/custom/lang/fr.php
@@ -46,7 +46,7 @@ $lang->custom->SRConcept = "SR Concept";
$lang->custom->reviewRule = 'Review Rules';
$lang->custom->switch = "Switch";
$lang->custom->oneUnit = "One {$lang->hourCommon}";
-$lang->custom->convertRelationTitle = "Please set the conversion factor of {$lang->hourCommon} to %s first";
+$lang->custom->convertRelationTitle = "Please firstly set the conversion factor from {$lang->hourCommon} to %s";
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon;
@@ -71,7 +71,7 @@ $lang->custom->regionMustNumber = 'The interval must be a number!';
$lang->custom->tipNotEmpty = 'The prompt can not be empty!';
$lang->custom->currencyNotEmpty = 'You have to select one currency at least.';
$lang->custom->defaultNotEmpty = 'The default currency can not be empty';
-$lang->custom->convertRelationTips = "After {$lang->hourCommon} is converted to %s, historical data will be uniformly converted to %s";
+$lang->custom->convertRelationTips = "After converting {$lang->hourCommon} to %s, the historical data will be converted uniformly to %s.";
$lang->custom->saveTips = 'After clicking save, the current %s will be used as the default estimation unit';
$lang->custom->numberError = 'The interval must be greater than zero!';
diff --git a/module/custom/lang/vi.php b/module/custom/lang/vi.php
index 3db2bbe941..2d23c34019 100644
--- a/module/custom/lang/vi.php
+++ b/module/custom/lang/vi.php
@@ -46,7 +46,7 @@ $lang->custom->SRConcept = "SR Concept";
$lang->custom->reviewRule = 'Review Rules';
$lang->custom->switch = "Switch";
$lang->custom->oneUnit = "One {$lang->hourCommon}";
-$lang->custom->convertRelationTitle = "Please set the conversion factor of {$lang->hourCommon} to %s first";
+$lang->custom->convertRelationTitle = "Please firstly set the conversion factor from {$lang->hourCommon} to %s";
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon;
@@ -71,7 +71,7 @@ $lang->custom->regionMustNumber = 'The interval must be a number!';
$lang->custom->tipNotEmpty = 'The prompt can not be empty!';
$lang->custom->currencyNotEmpty = 'You have to select one currency at least.';
$lang->custom->defaultNotEmpty = 'The default currency can not bu empty';
-$lang->custom->convertRelationTips = "After {$lang->hourCommon} is converted to %s, historical data will be uniformly converted to %s";
+$lang->custom->convertRelationTips = "After converting {$lang->hourCommon} to %s, the historical data will be converted uniformly to %s.";
$lang->custom->saveTips = 'After clicking save, the current %s will be used as the default estimation unit';
$lang->custom->numberError = 'The interval must be greater than zero!';
diff --git a/module/doc/control.php b/module/doc/control.php
index e4dd5e20ba..362d8e7ef4 100644
--- a/module/doc/control.php
+++ b/module/doc/control.php
@@ -171,6 +171,8 @@ class doc extends control
if(empty($projects)) unset($libTypeList['project']);
if(empty($executions)) unset($libTypeList['execution']);
+ $this->app->loadLang('api');
+
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('nocode|noclosed');
$this->view->products = $products;
diff --git a/module/doc/js/common.js b/module/doc/js/common.js
index 13d5973f69..48edfdbc1d 100644
--- a/module/doc/js/common.js
+++ b/module/doc/js/common.js
@@ -42,7 +42,7 @@ function toggleAcl(acl, type)
var notice = typeof(noticeAcl[libType][acl]) != 'undefined' ? noticeAcl[libType][acl] : '';
$('#noticeAcl').html(notice);
- if(libType == 'custom' && acl == 'private') $('#whiteListBox').addClass('hidden');
+ if((libType == 'custom' || libType == 'api') && acl == 'private') $('#whiteListBox').addClass('hidden');
if(libType == 'project' && typeof(doclibID) != 'undefined')
{
diff --git a/module/doc/js/createlib.js b/module/doc/js/createlib.js
index 9867c1de4e..109cb8c86a 100644
--- a/module/doc/js/createlib.js
+++ b/module/doc/js/createlib.js
@@ -29,6 +29,14 @@ function changeByLibType(libType)
$('table tr.execution').addClass('hidden');
$('#execution').attr('disabled', true);
+ $('.normalLib').removeClass('hidden');
+ $('.normalLib input').attr('disabled', false);
+
+ $('table tr.apilib').addClass('hidden');
+ $('.apilib input, #desc, #baseUrl').attr('disabled', true);
+
+ $('form').removeAttr('action');
+
changeDoclibAcl(libType);
}
else if(libType == 'project')
@@ -42,6 +50,14 @@ function changeByLibType(libType)
$('table tr.execution').addClass('hidden');
$('#execution').attr('disabled', true);
+ $('.normalLib').removeClass('hidden');
+ $('.normalLib input').attr('disabled', false);
+
+ $('table tr.apilib').addClass('hidden');
+ $('.apilib input, #desc, #baseUrl').attr('disabled', true);
+
+ $('form').removeAttr('action');
+
changeDoclibAcl(libType);
}
else if(libType == 'execution')
@@ -55,6 +71,35 @@ function changeByLibType(libType)
$('table tr.project').addClass('hidden');
$('#project').attr('disabled', true);
+ $('.normalLib').removeClass('hidden');
+ $('.normalLib input').attr('disabled', false);
+
+ $('table tr.apilib').addClass('hidden');
+ $('.apilib input, #desc, #baseUrl').attr('disabled', true);
+
+ $('form').removeAttr('action');
+
+ changeDoclibAcl(libType);
+ }
+ else if(libType == 'api')
+ {
+ $('table tr.product').addClass('hidden');
+ $('#product').attr('disabled', true);
+
+ $('table tr.project').addClass('hidden');
+ $('#project').attr('disabled', true);
+
+ $('table tr.execution').addClass('hidden');
+ $('#execution').attr('disabled', true);
+
+ $('.normalLib').addClass('hidden');
+ $('.normalLib input').attr('disabled', true);
+
+ $('table tr.apilib').removeClass('hidden');
+ $('.apilib input, #desc, #baseUrl').attr('disabled', false);
+
+ $('form').attr('action', createLink('api', 'createLib'));
+
changeDoclibAcl(libType);
}
else
@@ -68,6 +113,14 @@ function changeByLibType(libType)
$('table tr.execution').addClass('hidden');
$('#execution').attr('disabled', true);
+ $('.normalLib').removeClass('hidden');
+ $('.normalLib input').attr('disabled', false);
+
+ $('table tr.apilib').addClass('hidden');
+ $('.apilib input, #desc, #baseUrl').attr('disabled', true);
+
+ $('form').removeAttr('action');
+
changeDoclibAcl(libType);
}
diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php
index 7fa62b2cd8..8dd3708511 100644
--- a/module/doc/lang/en.php
+++ b/module/doc/lang/en.php
@@ -158,6 +158,7 @@ $lang->doc->allExecutions = 'All' . $lang->executionCommon . 's';
$lang->doc->libTypeList['product'] = $lang->productCommon . ' Library';
if($config->systemMode == 'new') $lang->doc->libTypeList['project'] = 'Project Library';
$lang->doc->libTypeList['execution'] = $lang->execution->common . ' Library';
+$lang->doc->libTypeList['api'] = 'API Library';
$lang->doc->libTypeList['custom'] = 'Custom Library';
$lang->doc->libGlobalList['api'] = 'Api Libray';
@@ -248,6 +249,9 @@ $lang->doc->noticeAcl['lib']['project']['private'] = 'Users who can access the
$lang->doc->noticeAcl['lib']['project']['custom'] = 'Users in the whiltelist can access it.';
$lang->doc->noticeAcl['lib']['execution']['default'] = "Users who can access the selected {$lang->executionCommon} can access it.";
$lang->doc->noticeAcl['lib']['execution']['custom'] = "Users who can access the selected {$lang->executionCommon} or users in the whiltelist can access it.";
+$lang->doc->noticeAcl['lib']['api']['open'] = 'All users can access it.';
+$lang->doc->noticeAcl['lib']['api']['custom'] = 'Users in the whitelist can access it.';
+$lang->doc->noticeAcl['lib']['api']['private'] = 'Only the one who created it can access it.';
$lang->doc->noticeAcl['lib']['custom']['open'] = 'All users can access it.';
$lang->doc->noticeAcl['lib']['custom']['custom'] = 'Users in the whitelist can access it.';
$lang->doc->noticeAcl['lib']['custom']['private'] = 'Only the one who created it can access it.';
diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php
index c850ff1b94..ff69f8c514 100644
--- a/module/doc/lang/zh-cn.php
+++ b/module/doc/lang/zh-cn.php
@@ -21,6 +21,7 @@ $lang->doclib->execution = $lang->executionCommon . '库';
$lang->doclib->product = $lang->productCommon . '库';
$lang->doclib->apiLibName = '接口库名称';
+$lang->doclib->aclListA = array();
$lang->doclib->aclListA['default'] = '默认';
$lang->doclib->aclListA['custom'] = '自定义';
@@ -158,6 +159,7 @@ $lang->doc->allExecutions = '所有' . $lang->executionCommon;
$lang->doc->libTypeList['product'] = $lang->productCommon . '文档库';
if($config->systemMode == 'new') $lang->doc->libTypeList['project'] = '项目文档库';
$lang->doc->libTypeList['execution'] = $lang->execution->common . '文档库';
+$lang->doc->libTypeList['api'] = '接口库';
$lang->doc->libTypeList['custom'] = '自定义文档库';
$lang->doc->libGlobalList['api'] = '接口文档库';
@@ -248,6 +250,9 @@ $lang->doc->noticeAcl['lib']['project']['private'] = "有所选项目访问权
$lang->doc->noticeAcl['lib']['project']['custom'] = "白名单的用户可以访问。";
$lang->doc->noticeAcl['lib']['execution']['default'] = "有所选{$lang->executionCommon}访问权限的用户可以访问。";
$lang->doc->noticeAcl['lib']['execution']['custom'] = "有所选{$lang->executionCommon}访问权限或白名单里的用户可以访问。";
+$lang->doc->noticeAcl['lib']['api']['open'] = '所有人都可以访问。';
+$lang->doc->noticeAcl['lib']['api']['custom'] = '白名单的用户可以访问。';
+$lang->doc->noticeAcl['lib']['api']['private'] = '只有创建者自己可以访问。';
$lang->doc->noticeAcl['lib']['custom']['open'] = '所有人都可以访问。';
$lang->doc->noticeAcl['lib']['custom']['custom'] = '白名单的用户可以访问。';
$lang->doc->noticeAcl['lib']['custom']['private'] = '只有创建者自己可以访问。';
diff --git a/module/doc/model.php b/module/doc/model.php
index fb7135f2fd..76a9a7362f 100644
--- a/module/doc/model.php
+++ b/module/doc/model.php
@@ -89,6 +89,18 @@ class docModel extends model
$products = $this->loadModel('product')->getPairs();
$projects = $this->loadModel('project')->getPairsByProgram();
$executions = $this->loadModel('execution')->getPairs();
+ $waterfalls = array();
+ if(empty($objectID) and ($type == 'all' or $type == 'execution'))
+ {
+ $waterfalls = $this->dao->select('t1.id,t2.name')->from(TABLE_EXECUTION)->alias('t1')
+ ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
+ ->where('t1.type')->eq('stage')
+ ->andWhere('t2.type')->eq('project')
+ ->andWhere('t2.model')->eq('waterfall')
+ ->andWhere('t1.deleted')->eq('0')
+ ->andWhere('t2.deleted')->eq('0')
+ ->fetchPairs('id', 'name');
+ }
$libPairs = array();
while($lib = $stmt->fetch())
@@ -102,8 +114,12 @@ class docModel extends model
if(strpos($extra, 'withObject') !== false)
{
if($lib->product != 0) $lib->name = zget($products, $lib->product, '') . ' / ' . $lib->name;
- if($lib->execution != 0) $lib->name = zget($executions, $lib->execution, '') . ' / ' . $lib->name;
if($lib->project != 0) $lib->name = zget($projects, $lib->project, '') . ' / ' . $lib->name;
+ if($lib->execution != 0)
+ {
+ $lib->name = zget($executions, $lib->execution, '') . ' / ' . $lib->name;
+ if(!empty($waterfalls[$lib->execution])) $lib->name = $waterfalls[$lib->execution] . ' / ' . $lib->name;
+ }
}
$libPairs[$lib->id] = $lib->name;
@@ -2251,9 +2267,14 @@ EOT;
/**
* Get api doc module tree
*
- * @author thanatos thanatos915@163.com
+ * @param int $rootID
+ * @param pointer $docID
+ * @param int $release
+ * @param int $moduleID
+ * @access public
+ * @return string
*/
- public function getApiModuleTree($rootID, &$docID = 0, $release = 0)
+ public function getApiModuleTree($rootID, &$docID = 0, $release = 0, $moduleID = 0)
{
$startModulePath = '';
$currentMethod = $this->app->getMethodName();
@@ -2262,7 +2283,7 @@ EOT;
if($release)
{
- $rel = $this->api->getReleaseById($release);
+ $rel = $this->api->getRelease($rootID, 'byId', $release);
$docs = $this->api->getApiListByRelease($rel);
}
else
@@ -2283,9 +2304,9 @@ EOT;
$treeMenu = array();
if($release)
{
- foreach($release->snap['modules'] as $module)
+ foreach($rel->snap['modules'] as $module)
{
- $this->buildTree($treeMenu, 'api', 0, $rootID, $module, $moduleDocs, $docID);
+ $this->buildTree($treeMenu, 'api', 0, $rootID, $module, $moduleDocs, $docID, $moduleID);
}
}
else
@@ -2300,7 +2321,7 @@ EOT;
$stmt = $this->dbh->query($query);
while ($module = $stmt->fetch())
{
- $this->buildTree($treeMenu, 'api', 0, $rootID, $module, $moduleDocs, $docID);
+ $this->buildTree($treeMenu, 'api', 0, $rootID, $module, $moduleDocs, $docID, $moduleID);
}
}
@@ -2429,10 +2450,11 @@ EOT;
* @param object $module
* @param array $moduleDocs
* @param pointer $docID
+ * @param int $moduleID
* @access private
* @return string
*/
- private function buildTree(&$treeMenu, $type, $objectID, $libID, $module, $moduleDocs, &$docID)
+ private function buildTree(&$treeMenu, $type, $objectID, $libID, $module, $moduleDocs, &$docID, $moduleID = 0)
{
if(!isset($treeMenu[$module->id])) $treeMenu[$module->id] = '';
@@ -2467,7 +2489,7 @@ EOT;
if(common::hasPriv('doc', 'edit'))
{
$treeMenu[$module->id] .= "
";
- $treeMenu[$module->id] .= html::a(helper::createLink('doc', 'edit', "docID=$docID&comment=false&objectType=$type&objectID=$objectID&libID=$libID"), "", '', "title={$this->lang->doc->edit} data-app={$this->app->tab}");
+ $treeMenu[$module->id] .= html::a(helper::createLink('doc', 'edit', "docID={$doc->id}&comment=false&objectType=$type&objectID=$objectID&libID=$libID"), "", '', "title={$this->lang->doc->edit} data-app={$this->app->tab}");
$treeMenu[$module->id] .= '
';
}
$treeMenu[$module->id] .= '
';
@@ -2520,9 +2542,7 @@ EOT;
if($type == static::DOC_TYPE_API)
{
- $params = $_GET;
- $moduleID = isset($params['moduleID']) ? $params['moduleID'] : 0;
- if($moduleID && $moduleID == $module->id)
+ if($moduleID and $moduleID == $module->id)
{
array_push($class, 'active');
}
diff --git a/module/doc/view/createlib.html.php b/module/doc/view/createlib.html.php
index f9c701c3af..b0a84345ee 100644
--- a/module/doc/view/createlib.html.php
+++ b/module/doc/view/createlib.html.php
@@ -19,7 +19,7 @@