From 55c45acae5edfafbc2e2414dbae982f7987cf1b3 Mon Sep 17 00:00:00 2001 From: jinianlan Date: Wed, 24 Jul 2019 16:24:15 +0800 Subject: [PATCH 1/9] * fix Bug #2660 --- module/testreport/lang/zh-cn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testreport/lang/zh-cn.php b/module/testreport/lang/zh-cn.php index 165e8c41d9..2434557c78 100644 --- a/module/testreport/lang/zh-cn.php +++ b/module/testreport/lang/zh-cn.php @@ -47,7 +47,7 @@ $lang->testreport->legendComment = '总结'; $lang->testreport->legendMore = '更多功能'; $lang->testreport->bugSeverityGroups = 'Bug严重级别分布'; -$lang->testreport->bugTypeGroups = 'Bug类型别分布'; +$lang->testreport->bugTypeGroups = 'Bug类型分布'; $lang->testreport->bugStatusGroups = 'Bug状态分布'; $lang->testreport->bugOpenedByGroups = 'Bug创建者分布'; $lang->testreport->bugResolvedByGroups = 'Bug解决者分布'; From aecff9993270481cfd97d5d701452b51009d11c5 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 24 Jul 2019 17:49:40 +0800 Subject: [PATCH 2/9] * Fix bug of view a flow page by path_info. --- framework/router.class.php | 68 +++++++++++++++++++++++++++++++------- lib/pager/pager.class.php | 54 ++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 12 deletions(-) diff --git a/framework/router.class.php b/framework/router.class.php index daf1c430b1..fd9aee2c1c 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -233,9 +233,7 @@ class router extends baseRouter */ public function loadConfig($moduleName, $appName = '') { - $appName = ''; - - return parent::loadModuleConfig($moduleName, $appName); + return parent::loadModuleConfig($moduleName); } /** @@ -278,16 +276,15 @@ class router extends baseRouter { if($flow->buildin && $this->methodName == 'browselabel') { - $this->workflowModule = $this->moduleName; - $this->workflowMethod = 'browse'; + $this->workflowModule = $this->moduleName; + $this->workflowMethod = 'browse'; - $this->loadModuleConfig('workflowaction'); + $this->loadModuleConfig('workflowaction'); - $moduleName = 'flow'; - $methodName = 'browse'; + $moduleName = 'flow'; + $methodName = 'browse'; - $this->setModuleName($moduleName); - $this->setMethodName($methodName); + $this->setFlowURI($moduleName, $methodName); } else { @@ -302,8 +299,7 @@ class router extends baseRouter $moduleName = 'flow'; $methodName = in_array($this->methodName, $this->config->workflowaction->default->actions) ? $this->methodName : 'operate'; - $this->setModuleName($moduleName); - $this->setMethodName($methodName); + $this->setFlowURI($moduleName, $methodName); } } } @@ -313,6 +309,54 @@ class router extends baseRouter return parent::setControlFile($exitIfNone); } + /** + * Reset URI to flow's URI. + * + * @param string $moduleName + * @param string $methodName + * @access public + * @return void + */ + public function setFlowURI($moduleName, $methodName) + { + $this->rawURI = $this->URI; + $this->setModuleName($moduleName); + $this->setMethodName($methodName); + if($this->config->requestType != 'GET') + { + $params = explode($this->config->requestFix, $this->URI); + /* Remove module and method. */ + $params = array_slice($params, 2); + /* Prepend other params. */ + array_unshift($params, $this->workflowModule); + array_unshift($params, $methodName); + array_unshift($params, $moduleName); + + $this->URI = implode($this->config->requestFix, $params); + } + else + { + $params = parse_url($this->URI); + /* Extract $path and $query from $params. */ + extract($params); + parse_str($query, $params); + /* Remove module and method. */ + unset($params[$this->config->moduleVar]); + unset($params[$this->config->methodVar]); + + $params = array_reverse($params); + + /* Prepend other params. */ + $params['module'] = $this->workflowModule; + $params[$this->config->methodVar] = $methodName; + $params[$this->config->moduleVar] = $moduleName; + + $params = array_reverse($params); + + $this->URI = $path . '?' . http_build_query($params); + } + } + /** * PATH_INFO方式解析,获取$URI和$viewType。 * Parse PATH_INFO, get the $URI and $viewType. diff --git a/lib/pager/pager.class.php b/lib/pager/pager.class.php index 4a2d462b18..09493b48a6 100644 --- a/lib/pager/pager.class.php +++ b/lib/pager/pager.class.php @@ -20,6 +20,60 @@ helper::import(dirname(dirname(__FILE__)) . '/base/pager/pager.class.php'); */ class pager extends basePager { + /** + * 设置模块名。 + * Set the $moduleName property. + * + * @access public + * @return void + */ + public function setModuleName() + { + if(isset($this->app->workflowModule)) + { + $this->moduleName = $this->app->workflowModule; + } + else + { + $this->moduleName = $this->app->getModuleName(); + } + } + + /** + * 设置方法名。 + * Set the $methodName property. + * + * @access public + * @return void + */ + public function setMethodName() + { + if(isset($this->app->workflowMethod)) + { + $this->methodName = $this->app->workflowMethod; + } + else + { + $this->methodName = $this->app->getMethodName(); + } + } + + /** + * 从请求网址中获取记录总数、每页记录数、页码。 + * Get recTotal, recPerpage, pageID from the request params, and add them to params. + * + * @access public + * @return void + */ + public function setParams() + { + parent::setParams(); + if(isset($this->app->workflowModule) && isset($this->app->workflowMethod)) + { + unset($this->params['module']); + } + } + /** * Show pager. * From 3d626b7026e946576f1b6e356ea4daa0c47a4840 Mon Sep 17 00:00:00 2001 From: chenfei Date: Wed, 24 Jul 2019 18:06:29 +0800 Subject: [PATCH 3/9] * Fix bug of view a flow page by path_info. --- framework/router.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/router.class.php b/framework/router.class.php index fd9aee2c1c..652ef70725 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -319,15 +319,17 @@ class router extends baseRouter */ public function setFlowURI($moduleName, $methodName) { - $this->rawURI = $this->URI; $this->setModuleName($moduleName); $this->setMethodName($methodName); if($this->config->requestType != 'GET') { $params = explode($this->config->requestFix, $this->URI); + /* Remove module and method. */ $params = array_slice($params, 2); + /* Prepend other params. */ + if($methodName == 'operate') array_unshift($params, $this->workflowMethod); array_unshift($params, $this->workflowModule); array_unshift($params, $methodName); array_unshift($params, $moduleName); @@ -404,7 +406,7 @@ class router extends baseRouter $passedParams = array_reverse($passedParams); if(!in_array($this->workflowMethod, $this->config->workflowaction->default->actions)) { - $passedParams['method'] = $this->workflowMethod; + $passedParams['action'] = $this->workflowMethod; } $passedParams['module'] = $this->workflowModule; From 821095baf76b3598d25a57692e6ec36fd456a85e Mon Sep 17 00:00:00 2001 From: chenfei Date: Wed, 24 Jul 2019 18:26:00 +0800 Subject: [PATCH 4/9] * Adjust execute hook for workflow. --- module/bug/control.php | 2 ++ module/build/control.php | 2 ++ module/product/control.php | 2 ++ module/productplan/control.php | 2 ++ module/project/control.php | 2 ++ module/release/control.php | 2 ++ module/story/control.php | 2 ++ module/task/control.php | 2 ++ module/testcase/control.php | 2 ++ module/testsuite/control.php | 2 ++ module/testtask/control.php | 2 ++ 11 files changed, 22 insertions(+) diff --git a/module/bug/control.php b/module/bug/control.php index 2de97222e0..d60fa5224c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -554,6 +554,8 @@ class bug extends control $productName = $this->products[$productID]; $branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product); + $this->executeHooks($this->methodName, $bugID); + /* Header and positon. */ $this->view->title = "BUG #$bug->id $bug->title - " . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName); diff --git a/module/build/control.php b/module/build/control.php index b5fe5d652a..8923f49641 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -230,6 +230,8 @@ class build extends control $this->view->type = $type; } + $this->executeHooks($this->methodName, $buildID); + /* Assign. */ $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->build = $build; diff --git a/module/product/control.php b/module/product/control.php index 0c6321c3a8..b8116a78c7 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -394,6 +394,8 @@ class product extends control $this->app->loadClass('pager', $static = true); $pager = new pager(0, 30, 1); + $this->executeHooks($this->methodName, $productID); + $this->view->title = $product->name . $this->lang->colon . $this->lang->product->view; $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name); $this->view->position[] = $this->lang->product->view; diff --git a/module/productplan/control.php b/module/productplan/control.php index 59f3f2670f..2a36115f83 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -276,6 +276,8 @@ class productplan extends control $orderBy = str_replace('id', 'order', $orderBy); } + $this->executeHooks($this->methodName, $planID); + if($plan->parent > 0) $this->view->parentPlan = $this->productplan->getById($plan->parent); if($plan->parent == '-1') $this->view->childrenPlans = $this->productplan->getChildren($plan->id); diff --git a/module/project/control.php b/module/project/control.php index ec341409ac..ed746fbd22 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1441,6 +1441,8 @@ class project extends control $this->app->loadClass('pager', $static = true); $pager = new pager(0, 30, 1); + $this->executeHooks($this->methodName, $projectID); + $this->view->title = $this->lang->project->view; $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); $this->view->position[] = $this->view->title; diff --git a/module/release/control.php b/module/release/control.php index 534073a4fc..a86f511978 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -162,6 +162,8 @@ class release extends control $this->commonAction($release->product); $product = $this->product->getById($release->product); + $this->executeHooks($this->methodName, $releaseID); + $this->view->title = "RELEASE #$release->id $release->name/" . $product->name; $this->view->position[] = $this->lang->release->view; $this->view->release = $release; diff --git a/module/story/control.php b/module/story/control.php index 9c6e72bf22..3fe0950dca 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -705,6 +705,8 @@ class story extends control if($project->status == 'done') $from = ''; } + $this->executeHooks($this->methodName, $storyID); + $title = "STORY #$story->id $story->title - $product->name"; $position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name); $position[] = $this->lang->story->common; diff --git a/module/task/control.php b/module/task/control.php index cdda54f92a..7164bd34ae 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -606,6 +606,8 @@ class task extends control $project = $this->project->getById($task->project); $this->project->setMenu($this->project->getPairs(), $project->id); + $this->executeHooks($this->methodName, $taskID); + $title = "TASK#$task->id $task->name / $project->name"; $position[] = html::a($this->createLink('project', 'browse', "projectID=$task->project"), $project->name); $position[] = $this->lang->task->common; diff --git a/module/testcase/control.php b/module/testcase/control.php index 2e9ba9e197..5558cd5689 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -516,6 +516,8 @@ class testcase extends control ->fetch('count'); $case->caseFails = $caseFails; + $this->executeHooks($this->methodName, $caseID); + $this->view->position[] = $this->lang->testcase->common; $this->view->position[] = $this->lang->testcase->view; diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 11f1887fa6..4b25be9332 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -142,6 +142,8 @@ class testsuite extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $this->executeHooks($this->methodName, $suiteID); + $this->view->title = "SUITE #$suite->id $suite->name/" . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('testsuite', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testsuite->common; diff --git a/module/testtask/control.php b/module/testtask/control.php index 524615aadc..85dd912a2e 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -216,6 +216,8 @@ class testtask extends control $this->testtask->setMenu($this->products, $productID, $task->branch, $taskID); + $this->executeHooks($this->methodName, $taskID); + $this->view->title = "TASK #$task->id $task->name/" . $this->products[$productID]; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->common; From b6b9901b82bddf229cc6994e3c6674790d216261 Mon Sep 17 00:00:00 2001 From: jinianlan Date: Wed, 24 Jul 2019 20:04:35 +0800 Subject: [PATCH 5/9] * fix Bug #2653 --- module/bug/view/browse.html.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 2200451782..c742e1d877 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -241,18 +241,18 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow createLink('bug', 'batchConfirm'); - $misc = common::hasPriv('bug', 'batchConfirm') ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : $class; + $misc = (common::hasPriv('bug', 'batchConfirm') && common::hasPriv('bug','confirmBug')) ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : ""; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->confirmBug, '', $misc) . "
  • "; $actionLink = $this->createLink('bug', 'batchClose'); - $misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : $class; + $misc = (common::hasPriv('bug', 'batchClose') && common::hasPriv('bug','close')) ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : ""; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->close, '', $misc) . "
  • "; $actionLink = $this->createLink('bug', 'batchActivate', "productID=$productID&branch=$branch"); - $misc = common::hasPriv('bug', 'batchActivate') ? "onclick=\"setFormAction('$actionLink')\"" : $class; + $misc = (common::hasPriv('bug', 'batchActivate') && common::hasPriv('bug','activate')) ? "onclick=\"setFormAction('$actionLink')\"" : ""; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->activate, '', $misc) . "
  • "; - $misc = common::hasPriv('bug', 'batchResolve') ? "id='resolveItem'" : ''; + $misc = (common::hasPriv('bug', 'batchResolve') && common::hasPriv('bug','resolve')) ? "id='resolveItem'" : ''; if($misc) { echo "
  • " . html::a('javascript:;', $lang->bug->confirmBug, '', $misc) . "
  • "; $actionLink = $this->createLink('bug', 'batchClose'); - $misc = (common::hasPriv('bug', 'batchClose') && common::hasPriv('bug','close')) ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : ""; + $misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink', 'hiddenwin')\"" : $class; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->close, '', $misc) . "
  • "; $actionLink = $this->createLink('bug', 'batchActivate', "productID=$productID&branch=$branch"); - $misc = (common::hasPriv('bug', 'batchActivate') && common::hasPriv('bug','activate')) ? "onclick=\"setFormAction('$actionLink')\"" : ""; + $misc = common::hasPriv('bug', 'batchActivate') ? "onclick=\"setFormAction('$actionLink')\"" : $class; if($misc) echo "
  • " . html::a('javascript:;', $lang->bug->activate, '', $misc) . "
  • "; - $misc = (common::hasPriv('bug', 'batchResolve') && common::hasPriv('bug','resolve')) ? "id='resolveItem'" : ''; + $misc = common::hasPriv('bug', 'batchResolve') ? "id='resolveItem'" : ''; if($misc) { echo "