From 13e8d56048c0eca54d23267034d7f1003479bc39 Mon Sep 17 00:00:00 2001 From: "shiyangyangwork@yahoo.cn" Date: Tue, 29 Nov 2011 01:54:35 +0000 Subject: [PATCH] + finish the task #628. --- module/common/lang/en.php | 1 + module/common/lang/zh-cn.php | 1 + module/project/control.php | 36 ++++++++++++++++++ module/project/view/testtask.html.php | 54 +++++++++++++++++++++++++++ module/testtask/control.php | 22 +++++++++++ module/testtask/model.php | 21 +++++++++++ 6 files changed, 135 insertions(+) create mode 100644 module/project/view/testtask.html.php diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 04ad7ed9f5..030786e20c 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -151,6 +151,7 @@ $lang->project->menu->story = array('link' => 'Story|project|story|projectID $lang->project->menu->bug = 'Bug|project|bug|projectID=%s'; $lang->project->menu->dynamic = 'Dynamic|project|dynamic|projectID=%s'; $lang->project->menu->build = array('link' => 'Build|project|build|projectID=%s', 'subModule' => 'build'); +$lang->project->menu->testtask = 'Testtask|project|testtask|projectID=%s'; $lang->project->menu->burn = 'Burn|project|burn|projectID=%s'; $lang->project->menu->team = array('link' => 'Team|project|team|projectID=%s', 'alias' => 'managemembers'); $lang->project->menu->doc = array('link' => 'Doc|project|doc|porjectID=%s', 'subModule' => 'doc'); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index e34c876f15..74a19ae8ec 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -151,6 +151,7 @@ $lang->project->menu->story = array('link' => '需求|project|story|projectI $lang->project->menu->bug = 'Bug|project|bug|projectID=%s'; $lang->project->menu->dynamic = '动态|project|dynamic|projectID=%s'; $lang->project->menu->build = array('link' => 'Build|project|build|projectID=%s', 'subModule' => 'build'); +$lang->project->menu->testtask = '测试任务|project|testtask|projectID=%s'; $lang->project->menu->burn = '燃尽图|project|burn|projectID=%s'; $lang->project->menu->team = array('link' => '团队|project|team|projectID=%s', 'alias' => 'managemembers'); $lang->project->menu->doc = array('link' => '文档|project|doc|porjectID=%s', 'subModule' => 'doc'); diff --git a/module/project/control.php b/module/project/control.php index 29c5395346..54fe93f370 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -613,6 +613,42 @@ class project extends control $this->display(); } + /** + * Browse test tasks of project. + * + * @param int $projectID + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ + public function testtask($projectID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + { + $this->loadModel('testtask'); + /* Save session. */ + $this->session->set('testtaskList', $this->app->getURI(true)); + + $project = $this->commonAction($projectID); + + /* Load pager. */ + $this->app->loadClass('pager', $static = true); + $pager = pager::init($recTotal, $recPerPage, $pageID); + + $this->view->header->title = $this->projects[$projectID] . $this->lang->colon . $this->lang->testtask->common; + $this->view->position[] = html::a($this->createLink('project', 'testtask', "projectID=$projectID"), $this->projects[$projectID]); + $this->view->position[] = $this->lang->testtask->common; + $this->view->projectID = $projectID; + $this->view->projectName = $this->projects[$projectID]; + $this->view->pager = $pager; + $this->view->orderBy = $orderBy; + $this->view->tasks = $this->testtask->getProjectTasks($projectID); + $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + + $this->display(); + } + /** * Browse burndown chart of a project. * diff --git a/module/project/view/testtask.html.php b/module/project/view/testtask.html.php new file mode 100644 index 0000000000..f66872187e --- /dev/null +++ b/module/project/view/testtask.html.php @@ -0,0 +1,54 @@ + + * @package testtask + * @version $Id: browse.html.php 1914 2011-06-24 10:11:25Z yidong@cnezsoft.com $ + * @link http://www.zentao.net + */ +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
testtask->browse;?>
+
testtask->create);?>
+
idAB;?>testtask->name;?>testtask->build;?>testtask->owner;?>testtask->begin;?>testtask->end;?>statusAB;?>actions;?>
id"), sprintf('%03d', $task->id));?>id"), $task->name);?>build == 'trunk' ? print('Trunk') : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));?>owner];?>begin?>end?>testtask->statusList[$task->status];?> + id", $lang->testtask->cases); + common::printLink('testtask', 'linkcase', "taskID=$task->id", $lang->testtask->linkCaseAB); + common::printLink('testtask', 'edit', "taskID=$task->id", $lang->edit); + common::printLink('testtask', 'delete', "taskID=$task->id", $lang->delete, 'hiddenwin'); + ?> +
+ diff --git a/module/testtask/control.php b/module/testtask/control.php index 99c9352c3f..e25834c77e 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -91,6 +91,7 @@ class testtask extends control die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); } + /* Create testtask from build of project.*/ if($projectID != 0 and $build != 0) { $products = $this->dao->select('t2.id, t2.name') @@ -110,6 +111,27 @@ class testtask extends control $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->fetchPairs('id'); } + /* Create testtask from testtask of project.*/ + 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('project')->eq($projectID)->fetchPairs('id'); + } + + /* Create testtask from testtask of test.*/ if($projectID == 0) { $projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); diff --git a/module/testtask/model.php b/module/testtask/model.php index a1ea8d2980..d02282ffe2 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -71,6 +71,27 @@ class testtaskModel extends model ->fetchAll(); } + /** + * Get test tasks of a project. + * + * @param int $projectID + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getProjectTasks($projectID, $orderBy = 'id_desc', $pager = null) + { + return $this->dao->select('t1.*, t2.name AS buildName') + ->from(TABLE_TESTTASK)->alias('t1') + ->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id') + ->where('t1.project')->eq((int)$projectID) + ->andWhere('t1.deleted')->eq(0) + ->orderBy($orderBy) + ->page($pager) + ->fetchAll(); + } + /** * Get test task info by id. *