From 794795844b846caa23d638e4e8d2de663ae9cd04 Mon Sep 17 00:00:00 2001 From: "shiyangyangwork@yahoo.cn" Date: Mon, 28 Nov 2011 08:23:09 +0000 Subject: [PATCH] * finish the task #629. --- module/bug/model.php | 3 ++- module/project/control.php | 6 +++-- module/project/lang/en.php | 1 + module/project/lang/zh-cn.php | 1 + module/project/view/bug.html.php | 9 +++++-- module/project/view/build.html.php | 4 ++- module/testtask/control.php | 39 +++++++++++++++++++++++++--- module/testtask/model.php | 3 +-- module/testtask/view/create.html.php | 11 ++++++++ 9 files changed, 65 insertions(+), 12 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 1d5ad08873..8fb1536a79 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -405,10 +405,11 @@ class bugModel extends model * @access public * @return array */ - public function getProjectBugs($projectID, $orderBy = 'id_desc', $pager = null) + public function getProjectBugs($projectID, $orderBy = 'id_desc', $pager = null, $build = 0) { return $this->dao->select('*')->from(TABLE_BUG) ->where('project')->eq((int)$projectID) + ->beginIF($build != 0)->andWhere('openedBuild')->eq($build)->fi() ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); } diff --git a/module/project/control.php b/module/project/control.php index 87312b07f2..29c5395346 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -549,7 +549,7 @@ class project extends control * @access public * @return void */ - public function bug($projectID = 0, $orderBy = 'status,id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function bug($projectID = 0, $orderBy = 'status,id_desc', $build = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Load these two models. */ $this->loadModel('bug'); @@ -570,7 +570,7 @@ class project extends control /* Load pager and get bugs, user. */ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $bugs = $this->bug->getProjectBugs($projectID, $orderBy, $pager); + $bugs = $this->bug->getProjectBugs($projectID, $orderBy, $pager, $build); $users = $this->user->getPairs('noletter'); /* Assign. */ @@ -578,6 +578,7 @@ class project extends control $this->view->position = $position; $this->view->bugs = $bugs; $this->view->tabID = 'bug'; + $this->view->build = $build; $this->view->pager = $pager; $this->view->orderBy = $orderBy; $this->view->users = $users; @@ -595,6 +596,7 @@ class project extends control */ public function build($projectID = 0) { + $this->loadModel('testtask'); $this->session->set('buildList', $this->app->getURI(true)); $project = $this->commonAction($projectID); diff --git a/module/project/lang/en.php b/module/project/lang/en.php index a758374a5f..71f23f29a8 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -44,6 +44,7 @@ $lang->project->totalEstimate= 'Est'; $lang->project->totalConsumed= 'Done'; $lang->project->totalLeft = 'Left'; $lang->project->progess = 'Progess'; +$lang->project->viewBug = 'View bug'; $lang->project->noProduct = 'No product'; $lang->project->select = '--select project--'; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index a0f88d619d..14cd1064bf 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -44,6 +44,7 @@ $lang->project->totalEstimate= '总预计'; $lang->project->totalConsumed= '总消耗'; $lang->project->totalLeft = '总剩余'; $lang->project->progess = '进度'; +$lang->project->viewBug = '查看bug'; $lang->project->noProduct = '无产品项目'; $lang->project->select = '--请选择项目--'; diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php index 3c021b5232..2f5fef10a3 100644 --- a/module/project/view/bug.html.php +++ b/module/project/view/bug.html.php @@ -14,12 +14,17 @@ - id}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?> + id}&orderBy=%s&build=$build&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?> diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php index 05744c42d2..2946eda68a 100644 --- a/module/project/view/build.html.php +++ b/module/project/view/build.html.php @@ -26,7 +26,7 @@ - + @@ -41,6 +41,8 @@
-
project->bug;?>
+
+ project->bug . '(Build:' . $build . ')'; + else echo $lang->project->bug; + ?> +
id", $lang->bug->create);?>
idAB);?> bug->severityAB);?> priAB);?>build->filePath;?> build->date;?> build->builder;?>actions;?>actions;?>
builder]?> id&build=$build->id", $lang->testtask->create); + common::printLink('project', 'bug', "project=$project->id&orderBy=status&build=$build->id", $lang->project->viewBug); common::printLink('build', 'edit', "buildID=$build->id", $lang->edit); common::printLink('build', 'delete', "buildID=$build->id", $lang->delete, 'hiddenwin'); ?> diff --git a/module/testtask/control.php b/module/testtask/control.php index e6463ca777..99c9352c3f 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -81,16 +81,41 @@ class testtask extends control * @access public * @return void */ - public function create($productID) + public function create($productID, $projectID = 0, $build = 0) { if(!empty($_POST)) { - $taskID = $this->testtask->create($productID); + $taskID = $this->testtask->create(); if(dao::isError()) die(js::error(dao::getError())); $this->loadModel('action')->create('testtask', $taskID, 'opened'); die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); } + if($projectID != 0 and $build != 0) + { + $products = $this->dao->select('t2.id, t2.name') + ->from(TABLE_PROJECTPRODUCT)->alias('t1') + ->leftJoin(TABLE_PRODUCT)->alias('t2') + ->on('t1.product = t2.id') + ->where('t1.project')->eq($projectID) + ->fetchPairs('id'); + + foreach($products as $key => $value) + { + $productID = $key; + break; + } + + $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetchPairs('id'); + $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->fetchPairs('id'); + } + + if($projectID == 0) + { + $projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); + $builds = $this->loadModel('build')->getProductBuildPairs($productID); + } + /* Set menu. */ $productID = $this->product->saveState($productID, $this->products); $this->testtask->setMenu($this->products, $productID); @@ -99,8 +124,14 @@ class testtask extends control $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->create; - $this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); - $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); + if($projectID != 0) + { + $this->view->products = $products; + $this->view->projectID = $projectID; + } + $this->view->projects = $projects; + $this->view->productID = $productID; + $this->view->builds = $builds; $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted'); $this->display(); diff --git a/module/testtask/model.php b/module/testtask/model.php index fec879aa0a..a1ea8d2980 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -39,10 +39,9 @@ class testtaskModel extends model * @access public * @return void */ - function create($productID) + function create() { $task = fixer::input('post') - ->add('product', $productID) ->stripTags('name') ->get(); $this->dao->insert(TABLE_TESTTASK)->data($task)->autoCheck()->batchcheck($this->config->testtask->create->requiredFields, 'notempty')->exec(); diff --git a/module/testtask/view/create.html.php b/module/testtask/view/create.html.php index daf0aec052..68a84befd0 100644 --- a/module/testtask/view/create.html.php +++ b/module/testtask/view/create.html.php @@ -16,6 +16,17 @@
+ + + + + + + + + + +
testtask->create;?>
testtask->product;?>
testtask->project;?>