From 3ae982b8d7e46f48d7b4604c59f4060db3302817 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Thu, 12 Nov 2009 08:56:01 +0000 Subject: [PATCH] * rewrite the bug module. --- trunk/module/bug/control.php | 150 ++++++++++++++---- trunk/module/bug/lang/zh-cn.php | 23 +-- trunk/module/bug/model.php | 192 +++++++++++++++--------- trunk/module/bug/view/activate.html.php | 47 ++++++ trunk/module/bug/view/browse.html.php | 12 +- trunk/module/bug/view/close.html.php | 43 ++++++ trunk/module/bug/view/create.html.php | 92 ++++++++++-- trunk/module/bug/view/edit.html.php | 123 ++++++++++++--- trunk/module/bug/view/resolve.html.php | 69 +++++++++ trunk/module/bug/view/view.html.php | 43 +++--- 10 files changed, 632 insertions(+), 162 deletions(-) create mode 100644 trunk/module/bug/view/activate.html.php create mode 100644 trunk/module/bug/view/close.html.php create mode 100644 trunk/module/bug/view/resolve.html.php diff --git a/trunk/module/bug/control.php b/trunk/module/bug/control.php index 51cac1e0d1..7322557124 100644 --- a/trunk/module/bug/control.php +++ b/trunk/module/bug/control.php @@ -33,6 +33,8 @@ class bug extends control $this->loadModel('tree'); $this->loadModel('user'); $this->loadModel('action'); + $this->loadModel('story'); + $this->loadModel('task'); $this->products = $this->product->getPairs(); if(empty($this->products)) $this->locate($this->createLink('product', 'create')); $this->assign('products', $this->products); @@ -45,8 +47,10 @@ class bug extends control } /* 浏览一个产品下面的bug。*/ - public function browse($productID = 0, $type = 'byModule', $param = 0) + public function browse($productID = 0, $type = 'byModule', $param = 0, $orderBy = 'id|desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->session->set('bugList', $this->app->getURI(true)); + $productID = common::saveProductState($productID, key($this->products)); $currentModuleID = ($type == 'byModule') ? (int)$param : 0; if($currentModuleID == 0) @@ -61,11 +65,13 @@ class bug extends control if($type == "byModule") { + $this->app->loadClass('pager', $static = true); + $pager = pager::init($recTotal, $recPerPage, $pageID); $childModuleIds = $this->tree->getAllChildId($currentModuleID); - $bugs = $this->bug->getModuleBugs($productID, $childModuleIds); + $bugs = $this->bug->getModuleBugs($productID, $childModuleIds, $orderBy, $pager); } - $users = array('' => '', 'Closed' => 'Closed') + $this->user->getRealNames($this->bug->extractAccountsFromList($bugs)); + $users = $this->user->getPairs($this->app->company->id, 'noletter'); $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->common; $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); @@ -79,6 +85,7 @@ class bug extends control $this->assign('type', $type); $this->assign('bugs', $bugs); $this->assign('users', $users); + $this->assign('pager', $pager->get()); $this->assign('currentModuleID', $currentModuleID); $this->assign('currentModuleName', $currentModuleName); @@ -88,47 +95,47 @@ class bug extends control /* 创建Bug。*/ public function create($productID, $moduleID = 0) { - if(!empty($_POST)) - { - $_POST['severity'] = str_replace('item', '', $_POST['severity']); - $bugID = $this->bug->create(); - $this->action->create('bug', $bugID, 'Opened'); - die(js::locate($this->createLink('bug', 'browse', "productID=$_POST[productID]&type=byModule¶m=$_POST[moduleID]"), 'parent')); - } - if(empty($this->products)) $this->locate($this->createLink('product', 'create')); - $productID = (int)$productID; - if($productID == 0) $productID = key($this->products); + if(!empty($_POST)) + { + $bugID = $this->bug->create(); + if(dao::isError()) die(js::error(dao::getError())); + $this->action->create('bug', $bugID, 'Opened'); + die(js::locate($this->createLink('bug', 'browse', "productID={$this->post->product}&type=byModule¶m={$this->post->module}"), 'parent')); + } + + $productID = common::saveProductState($productID, key($this->products)); $currentModuleID = (int)$moduleID; $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->create; $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $position[] = $this->lang->bug->create; - $users = array('' => '') + $this->user->getPairs($this->app->company->id); - $this->assign('header', $header); - $this->assign('position', $position); - $this->assign('productID', $productID); - $this->assign('productName', $this->products[$productID]); + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('productID', $productID); + $this->assign('productName', $this->products[$productID]); $this->assign('moduleOptionMenu', $this->tree->getOptionMenu($productID, $viewType = 'bug', $rooteModuleID = 0)); $this->assign('currentModuleID', $currentModuleID); - $this->assign('users', $users); - + $this->assign('stories', $this->story->getProductStoryPairs($productID)); + $this->assign('users', $this->user->getPairs($this->app->company->id, 'noclosed')); + $this->assign('projects', $this->product->getProjectPairs($productID)); $this->display(); } /* 查看一个bug。*/ public function view($bugID) { - $bug = $this->bug->getById($bugID); + $bug = $this->bug->getById($bugID); $productID = $bug->product; $productName = $this->products[$productID]; + $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->view; $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $productName); $position[] = $this->lang->bug->view; - $users = array('' => '') + $this->user->getRealNames($this->bug->extractAccountsFromSingle($bug)); + $users = $this->user->getPairs($this->app->company->id, 'noletter'); $actions = $this->action->getList('bug', $bugID); $this->assign('header', $header); $this->assign('position', $position); @@ -148,8 +155,13 @@ class bug extends control if(!empty($_POST)) { $changes = $this->bug->update($bugID); - $actionID = $this->action->create('bug', $bugID, 'Edited', $_POST['comment']); - $this->action->logHistory($actionID, $changes); + if(dao::isError()) die(js::error(dao::getError())); + if($this->post->comment != '' or !empty($changes)) + { + $action = !empty($changes) ? 'Edited' : 'Commented'; + $actionID = $this->action->create('bug', $bugID, $action, $this->post->comment); + $this->action->logHistory($actionID, $changes); + } die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } @@ -161,7 +173,11 @@ class bug extends control $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $position[] = $this->lang->bug->edit; - $users = array('' => '') + $this->user->getPairs($this->app->company->id); + $projects = $this->product->getProjectPairs($bug->product); + $stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product); + $tasks = $this->task->getProjectTaskPairs($bug->project); + + $users = $this->user->getPairs($this->app->company->id); $this->assign('header', $header); $this->assign('position', $position); $this->assign('productID', $productID); @@ -170,6 +186,10 @@ class bug extends control $this->assign('currentModuleID', $currentModuleID); $this->assign('users', $users); + $this->assign('projects', $projects); + $this->assign('stories', $stories); + $this->assign('tasks', $tasks); + $this->assign('header', $header); $this->assign('position', $position); $this->assign('bug', $bug); @@ -177,13 +197,87 @@ class bug extends control $this->display(); } - public function delete($id) + /* 解决bug。*/ + public function resolve($bugID) { - $header['title'] = $this->lang->page->delete; - $this->assign('header', $header); + /* 更新bug信息。*/ + if(!empty($_POST)) + { + $this->bug->resolve($bugID); + if(dao::isError()) die(js::error(dao::getError())); + $actionID = $this->action->create('bug', $bugID, 'Resolved', $this->post->comment); + die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); + } + + /* 生成表单。*/ + $bug = $this->bug->getById($bugID); + $productID = $bug->product; + $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve; + $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); + $position[] = $this->lang->bug->resolve; + + $users = $this->user->getPairs($this->app->company->id); + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('bug', $bug); $this->display(); } + /* 激活bug。*/ + public function activate($bugID) + { + /* 更新bug信息。*/ + if(!empty($_POST)) + { + $this->bug->activate($bugID); + if(dao::isError()) die(js::error(dao::getError())); + $this->action->create('bug', $bugID, 'Activated', $this->post->comment); + die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); + } + + /* 生成表单。*/ + $bug = $this->bug->getById($bugID); + $productID = $bug->product; + $users = $this->user->getPairs($this->app->company->id); + + $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->activate; + $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); + $position[] = $this->lang->bug->activate; + + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('bug', $bug); + $this->assign('users', $users); + $this->display(); + } + + /* 激活bug。*/ + public function close($bugID) + { + /* 更新bug信息。*/ + if(!empty($_POST)) + { + $this->bug->close($bugID); + if(dao::isError()) die(js::error(dao::getError())); + $this->action->create('bug', $bugID, 'Closed', $this->post->comment); + die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); + } + + /* 生成表单。*/ + $bug = $this->bug->getById($bugID); + $productID = $bug->product; + + $header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->bug->activate; + $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); + $position[] = $this->lang->bug->activate; + + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('bug', $bug); + $this->display(); + } + + /* 获得用户的bug列表。*/ public function ajaxGetUserBugs($account = '') { if($account == '') $account = $this->app->user->account; diff --git a/trunk/module/bug/lang/zh-cn.php b/trunk/module/bug/lang/zh-cn.php index 77e7e57fe4..f4d101d81f 100644 --- a/trunk/module/bug/lang/zh-cn.php +++ b/trunk/module/bug/lang/zh-cn.php @@ -49,7 +49,10 @@ $lang->bug->labStory = '相关需求'; $lang->bug->labBuild = '程序编译版本'; $lang->bug->labTypeAndSeverity = '类型::严重程度'; $lang->bug->labSystemBrowserAndHardware = '系统::浏览器'; -$lang->bug->labAssignAndMail = '指派给::抄送给'; +$lang->bug->labAssignedTo = '指派给'; +$lang->bug->labMailto = '抄送给'; + +$lang->bug->confirmChangeProduct = '修改产品会导致相应的项目、需求和任务发生变化,确定吗?'; $lang->bug->legendRelated = '相关信息'; $lang->bug->legendBasicInfo = '基本信息'; @@ -59,7 +62,7 @@ $lang->bug->legendLinkBugs = '相关Bug'; $lang->bug->legendOpenInfo = '创建信息'; $lang->bug->legendResolveInfo = '解决信息'; $lang->bug->legendCloseInfo = '关闭信息'; -$lang->bug->legendStoryAndTask= '需求::任务'; +$lang->bug->legendPrjStoryTask= '项目::需求::任务'; $lang->bug->legendCases = '相关用例'; $lang->bug->legendSteps = '重现步骤'; $lang->bug->legendAction = '操作'; @@ -107,13 +110,14 @@ $lang->bug->statusList->active = 'active'; $lang->bug->statusList->resolved = 'resolved'; $lang->bug->statusList->closed = 'closed'; -$lang->bug->resolutionList->bydesign = 'By Design'; -$lang->bug->resolutionList->duplicate = 'Duplicate'; -$lang->bug->resolutionList->external = 'External'; -$lang->bug->resolutionList->fixed = 'Fixed'; -$lang->bug->resolutionList->notrepro = 'Not Repro'; -$lang->bug->resolutionList->postponed = 'Postponed'; -$lang->bug->resolutionList->willnotfix = "Won not Fix"; +$lang->bug->resolutionList[''] = ''; +$lang->bug->resolutionList['bydesign'] = 'By Design'; +$lang->bug->resolutionList['duplicate'] = 'Duplicate'; +$lang->bug->resolutionList['external'] = 'External'; +$lang->bug->resolutionList['fixed'] = 'Fixed'; +$lang->bug->resolutionList['notrepro'] = 'Not Repro'; +$lang->bug->resolutionList['postponed'] = 'Postponed'; +$lang->bug->resolutionList['willnotfix'] = "Won't Fix"; $lang->bug->id = 'Bug编号'; $lang->bug->product = '所属产品'; @@ -143,6 +147,7 @@ $lang->bug->resolvedBuild = '解决Build'; $lang->bug->resolvedDate = '解决日期'; $lang->bug->closedBy = '由谁关闭'; $lang->bug->closedDate = '关闭日期'; +$lang->bug->duplicateBug = '重复Bug'; $lang->bug->lastEditedBy = '最后修改者'; $lang->bug->lastEditedDate = '最后修改日期'; $lang->bug->files = '附件'; diff --git a/trunk/module/bug/model.php b/trunk/module/bug/model.php index e344a838e2..ae6269d25b 100644 --- a/trunk/module/bug/model.php +++ b/trunk/module/bug/model.php @@ -25,93 +25,151 @@ app->user->account; - $openedDate = time(); - $assignedDate = !empty($assignedTo) ? time() : 0; - $sql = "INSERT INTO " . TABLE_BUG . " (product, module, type, severity, os, browser, assignedTo, assignedDate, mailTo, title, steps, openedBy, openedDate) - VALUES('$productID', '$moduleID', '$type', '$severity', '$os', '$browser', '$assignedTo', '$assignedDate', '$mailTo', '$title', '$steps', '$openedBy', '$openedDate' )"; - $this->dbh->exec($sql); - return $this->dbh->lastInsertID(); + $bug = fixer::input('post') + ->add('openedBy', $this->app->user->account) + ->add('openedDate', time()) + ->setDefault('project,story,task', 0) + ->setIF($this->post->assignedTo != '', 'assignedDate', time()) + ->stripTags('title') + ->cleanInt('product, module, severity') + ->specialChars('steps') + ->join('mailto', ',') + ->get(); + $this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->check('title', 'notempty')->exec(); + return $this->dao->lastInsertID(); } /* 获得某一个产品,某一个模块下面的所有bug。*/ - public function getModuleBugs($productID, $moduleIds = 0) + public function getModuleBugs($productID, $moduleIds = 0, $orderBy = 'id|desc', $pager = null) { - $where = " WHERE `product` = '$productID'"; - $where .= !empty($moduleIds) ? " AND module " . helper::dbIN($moduleIds) : ''; - $sql = "SELECT * FROM " . TABLE_BUG . $where . " ORDER BY id DESC"; - $stmt = $this->dbh->query($sql); - return $stmt->fetchAll(); + $sql = $this->dao->select('*')->from(TABLE_BUG)->where('product')->eq((int)$productID); + if(!empty($moduleIds)) $sql->andWhere('module')->in($moduleIds); + return $sql->orderBy($orderBy)->page($pager)->fetchAll(); } /* 获取一个bug的详细信息。*/ public function getById($bugID) { - $bug = $this->dbh->query("SELECT * FROM " . TABLE_BUG . " WHERE id = '$bugID'")->fetch(); - foreach($bug as $key => $value) - { - if(strpos($key, 'Date') !== false) - { - if(empty($value)) - { - $bug->$key = ''; - } - else - { - $bug->$key = date('Y-m-d H:i:s', $value); - } - } - } + $bug = $this->dao->select('t1.*, t2.name AS projectName, t3.title AS storyTitle, t4.name AS taskName') + ->from(TABLE_BUG)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id') + ->leftJoin(TABLE_TASK)->alias('t4')->on('t1.task = t4.id') + ->where('t1.id')->eq((int)$bugID)->fetch(); + foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !strtotime($value)) $bug->$key = ''; + $bug->mailto = ltrim(trim($bug->mailto), ','); + if($bug->duplicateBug) $bug->duplicateBugTitle = $this->dao->findById($bug->duplicateBug)->from(TABLE_BUG)->fields('title')->fetch('title'); return $bug; } /* 更新bug信息。*/ public function update($bugID) { - $bug = $this->getById($bugID); - $changes = array(); - foreach($_POST as $key => $value) - { - if($key == 'comment') continue; - if(strpos($key, 'Date') !== false) $_POST[$key] = strtotime($value); - if($key == 'severity') $value = str_replace('item', '', $value); - if($value != $bug->$key) - { - $change['field'] = $key; - $change['old'] = $bug->$key; - $change['new'] = $value; - $changes[] = $change; - } - } - extract($_POST); - $now = time(); - $severity = str_replace('item', '', $severity); - $lastEditedDate = $now; - $assignedDate = $bug->assignedDate; + $oldBug = $this->getById($bugID); + $now = date('Y-m-d H:i:s'); + $bug = fixer::input('post') + ->cleanInt('product,module,severity,project,story,task') + ->stripTags('title') + ->specialChars('steps') + ->remove('comment') + ->setDefault('project,module,project,story,task,duplicateBug', 0) + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->setIF($this->post->assignedTo != $oldBug->assignedTo, 'assignedDate', $now) + ->setIF($this->post->resolvedBy != '' and $this->post->resolvedDate == '', 'resolvedDate', $now) + ->setIF($this->post->resolution != '' and $this->post->resolvedDate == '', 'resolvedDate', $now) + ->setIF($this->post->resolution != '' and $this->post->resolvedBy == '', 'resolvedBy', $this->app->user->account) + ->setIF($this->post->closedBy != '' and $this->post->closedDate == '', 'closedDate', $now) + ->setIF($this->post->closedDate != '' and $this->post->closedBy == '', 'closedBy', $this->app->user->account) + ->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedTo', 'closed') + ->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'assignedDate', $now) + ->setIF($this->post->resolution != '' or $this->post->resolvedDate != '', 'status', 'resolved') + ->setIF($this->post->closedBy != '' or $this->post->closedDate != '', 'status', 'closed') + ->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedTo', $oldBug->openedBy) + ->setIF(($this->post->resolution != '' or $this->post->resolvedDate != '') and $this->post->assignedTo == '', 'assignedDate', $now) + ->setIF($this->post->resolution == '' and $this->post->resolvedDate =='', 'status', 'active') + ->get(); - if($assignedTo != $bug->assignedTo) $assignedDate = $now; - if($resolution != '' and empty($resolvedDate)) $resolvedDate = $now; - if($closedBy != '' and empty($closedDate)) $closedDate = $now; + $this->dao->update(TABLE_BUG)->data($bug) + ->autoCheck() + ->check('title', 'notempty') + ->checkIF($bug->resolvedBy, 'resolution', 'notempty') + ->checkIF($bug->closedBy, 'resolution', 'notempty') + ->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty') + ->where('id')->eq((int)$bugID) + ->exec(); + if(!dao::isError()) return common::createChanges($oldBug, $bug); + } - $sql = "UPDATE " . TABLE_BUG . " SET - title = '$title', product='$product', module = '$module', - type='$type', severity = '$severity', os = '$os', status = '$status', - assignedTo='$assignedTo', assignedDate = '$assignedDate', resolvedBy = '$resolvedBy', resolvedDate = '$resolvedDate', resolution='$resolution', - closedBy = '$closedBy', closedDate = '$closedDate', steps = '$steps', - lastEditedBy = '{$this->app->user->account}', lastEditedDate = '$lastEditedDate' - WHERE id ='$bugID' LIMIT 1 "; - $this->dbh->exec($sql); - return $changes; + /* 解决Bug。*/ + public function resolve($bugID) + { + $oldBug = $this->getById($bugID); + $now = date('Y-m-d H:i:s'); + $bug = fixer::input('post') + ->add('resolvedBy', $this->app->user->account) + ->add('resolvedDate', $now) + ->add('status', 'resolved') + ->add('assignedTo', $oldBug->openedBy) + ->add('assignedDate', $now) + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->setDefault('duplicateBug', 0) + ->remove('comment') + ->get(); + + $this->dao->update(TABLE_BUG)->data($bug) + ->autoCheck() + ->check('resolution', 'notempty') + ->checkIF($bug->resolution == 'duplicate', 'duplicateBug', 'notempty') + ->where('id')->eq((int)$bugID) + ->exec(); + } + + /* 激活Bug。*/ + public function activate($bugID) + { + $oldBug = $this->getById($bugID); + $now = date('Y-m-d H:i:s'); + $bug = fixer::input('post') + ->add('assignedTo', $oldBug->resolvedBy) + ->add('assignedDate', $now) + ->add('resolution', '') + ->add('status', 'active') + ->add('resolvedDate', '0000-00-00') + ->add('resolvedBy', '') + ->add('resolvedBuild', '') + ->add('closedBy', '') + ->add('closedDate', '0000-00-00') + ->add('duplicateBug', 0) + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->remove('comment') + ->get(); + + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); + } + + /* 关闭Bug。*/ + public function close($bugID) + { + $oldBug = $this->getById($bugID); + $now = date('Y-m-d H:i:s'); + $bug = fixer::input('post') + ->add('assignedTo', 'closed') + ->add('assignedDate', $now) + ->add('status', 'closed') + ->add('closedBy', $this->app->user->account) + ->add('closedDate', $now) + ->add('lastEditedBy', $this->app->user->account) + ->add('lastEditedDate', $now) + ->remove('comment') + ->get(); + + $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); } /* 从bug列表中提取所有出现过的账户。*/ diff --git a/trunk/module/bug/view/activate.html.php b/trunk/module/bug/view/activate.html.php new file mode 100644 index 0000000000..b57b9f2821 --- /dev/null +++ b/trunk/module/bug/view/activate.html.php @@ -0,0 +1,47 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package bug + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + +
+
+ + + + + + + + + + + + + +
title;?>
bug->assignedTo;?>resolvedBy, 'class=select-3');?>
comment;?>
+ + +
+
+ diff --git a/trunk/module/bug/view/browse.html.php b/trunk/module/bug/view/browse.html.php index 0b174336f0..c88693546c 100644 --- a/trunk/module/bug/view/browse.html.php +++ b/trunk/module/bug/view/browse.html.php @@ -24,7 +24,6 @@ ?> -
@@ -38,26 +97,30 @@ function loadModuleMenu(productID) bug->labProductAndModule;?> - - - - - + + --> bug->labTypeAndSeverity;?> @@ -73,12 +136,17 @@ function loadModuleMenu(productID) - bug->labAssignAndMail;?> + bug->labAssignedTo;?> - - + + + bug->labMailto;?> + + + + bug->title;?> diff --git a/trunk/module/bug/view/edit.html.php b/trunk/module/bug/view/edit.html.php index 1e5dd0434f..644b2ed249 100644 --- a/trunk/module/bug/view/edit.html.php +++ b/trunk/module/bug/view/edit.html.php @@ -23,14 +23,94 @@ */ ?> + - +
@@ -51,7 +131,7 @@ function loadModuleMenu(productID) bug->labProductAndModule;?> - + @@ -77,38 +157,35 @@ function loadModuleMenu(productID) bug->assignedTo;?> assignedTo, 'class=select-2');?> - - bug->assignedDate;?> - assignedDate;?> - - - bug->lastEditedBy;?> - lastEditedBy;?> - - - bug->lastEditedDate;?> - lastEditedDate;?> -
- bug->legendStoryAndTask;?> + bug->legendPrjStoryTask;?> + + + + - + - +
bug->project;?>project, 'class=select-3 onchange=loadProjectStoriesAndTasks(this.value)');?>
bug->story;?>story, 'class=select-3');?>
bug->task;?>task, 'class=select-3');?>
bug->legendMailto;?> -
 
+ + + + +
mailto, 'class=text-3');?> +
@@ -126,10 +203,6 @@ function loadModuleMenu(productID) bug->openedBy;?> openedBy];?> - - bug->openedDate;?> - openedDate;?> - bug->openedBuild;?> openedBuild, 'class=text-2');?> @@ -154,7 +227,11 @@ function loadModuleMenu(productID) bug->resolution;?> - '') + (array)$lang->bug->resolutionList, $bug->resolution, 'class=select-2');?> + bug->resolutionList, $bug->resolution, 'class=select-2 onchange=setDuplicate(this.value)');?> + + resolution != 'duplicate') echo "style='display:none'";?>> + bug->duplicateBug;?> + duplicateBug, 'class=text-2');?>
diff --git a/trunk/module/bug/view/resolve.html.php b/trunk/module/bug/view/resolve.html.php new file mode 100644 index 0000000000..d9444c5851 --- /dev/null +++ b/trunk/module/bug/view/resolve.html.php @@ -0,0 +1,69 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package bug + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + + + +
+ + + + + + + + + + + + + + + + + + +
title;?>
bug->resolution;?>bug->resolutionList, '', 'class=select-3 onchange=setDuplicate(this.value)');?>
comment;?>
+ + +
+
+ diff --git a/trunk/module/bug/view/view.html.php b/trunk/module/bug/view/view.html.php index e15f35aa03..03378ed759 100644 --- a/trunk/module/bug/view/view.html.php +++ b/trunk/module/bug/view/view.html.php @@ -29,11 +29,11 @@
BUG #id . $lang->colon . $bug->title;?>
createLink('bug', 'edit', "bugID=$bug->id"), $lang->bug->buttonEdit); - //echo html::a($this->createLink('bug', 'resolve', "bugID=$bug->id"), $lang->bug->buttonResolve); - //echo html::a($this->createLink('bug', 'close', "bugID=$bug->id"), $lang->bug->buttonClose); - //echo html::a($this->createLink('bug', 'activate', "bugID=$bug->id"), $lang->bug->buttonActivate); - echo html::a($this->createLink('bug', 'browse', "productID=$bug->product"), $lang->bug->buttonToList); + if(common::hasPriv('bug', 'edit')) echo html::a($this->createLink('bug', 'edit', "bugID=$bug->id"), $lang->bug->buttonEdit); + if(common::hasPriv('bug', 'resolve') and $bug->status == 'active') echo html::a($this->createLink('bug', 'resolve', "bugID=$bug->id"), $lang->bug->buttonResolve); else echo $lang->bug->buttonResolve . ' '; + if(common::hasPriv('bug', 'close') and $bug->status == 'resolved') echo html::a($this->createLink('bug', 'close', "bugID=$bug->id"), $lang->bug->buttonClose); else echo $lang->bug->buttonClose . ' '; + if(common::hasPriv('bug', 'activate') and ($bug->status == 'closed' or $bug->status == 'resolved')) echo html::a($this->createLink('bug', 'activate', "bugID=$bug->id"), $lang->bug->buttonActivate); else echo $lang->bug->buttonActivate . ' '; + if(common::hasPriv('bug', 'browse')) echo html::a($this->session->bugList, $lang->bug->buttonToList); ?>
@@ -96,22 +96,26 @@
- bug->legendStoryAndTask;?> + bug->legendPrjStoryTask;?> + + + + - + - +
bug->project;?>projectName;?>
bug->story;?>story;?>storyTitle;?>
bug->task;?>task;?>taskName;?>
bug->legendMailto;?> -
+
mailto); foreach($mailto as $account) echo ' ' . $users[$account]; ?>
@@ -157,7 +161,12 @@ bug->resolution;?> - resolution)) echo $lang->bug->resolutionList->{$bug->resolution};?> + + bug->resolutionList[$bug->resolution]; + if(isset($bug->duplicateBugTitle)) echo " #$bug->duplicateBug:" . html::a($this->createLink('bug', 'view', "bugID=$bug->duplicateBug"), $bug->duplicateBugTitle); + ?> +
@@ -194,13 +203,13 @@
bug->legendAction;?>
- createLink('bug', 'edit', "bugID=$bug->id"), $lang->bug->buttonEdit); - //echo html::a($this->createLink('bug', 'resolve', "bugID=$bug->id"), $lang->bug->buttonResolve); - //echo html::a($this->createLink('bug', 'close', "bugID=$bug->id"), $lang->bug->buttonClose); - //echo html::a($this->createLink('bug', 'activate', "bugID=$bug->id"), $lang->bug->buttonActivate); - echo html::a($this->createLink('bug', 'browse', "productID=$bug->product"), $lang->bug->buttonToList); - ?> + createLink('bug', 'edit', "bugID=$bug->id"), $lang->bug->buttonEdit); + if(common::hasPriv('bug', 'resolve') and $bug->status == 'active') echo html::a($this->createLink('bug', 'resolve', "bugID=$bug->id"), $lang->bug->buttonResolve); else echo $lang->bug->buttonResolve . ' '; + if(common::hasPriv('bug', 'close') and $bug->status == 'resolved') echo html::a($this->createLink('bug', 'close', "bugID=$bug->id"), $lang->bug->buttonClose); else echo $lang->bug->buttonClose . ' '; + if(common::hasPriv('bug', 'activate') and ($bug->status == 'closed' or $bug->status == 'resolved')) echo html::a($this->createLink('bug', 'activate', "bugID=$bug->id"), $lang->bug->buttonActivate); else echo $lang->bug->buttonActivate . ' '; + if(common::hasPriv('bug', 'browse')) echo html::a($this->session->bugList, $lang->bug->buttonToList); + ?>