* rewrite the bug module.

This commit is contained in:
wangchunsheng
2009-11-12 08:56:01 +00:00
parent 8c80931c2d
commit 3ae982b8d7
10 changed files with 632 additions and 162 deletions

View File

@@ -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&param=$_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&param={$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;

View File

@@ -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 = '附件';

View File

@@ -25,93 +25,151 @@
<?php
class bugModel extends model
{
/* 构造函数。*/
public function __construct()
{
parent::__construct();
}
/* 创建一个Bug。*/
function create()
{
extract($_POST);
$openedBy = $this->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列表中提取所有出现过的账户。*/

View File

@@ -0,0 +1,47 @@
<?php
/**
* The activate file of bug module of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright: 2009 Chunsheng Wang
* @author Chunsheng Wang <wwccss@263.net>
* @package bug
* @version $Id$
* @link http://www.zentao.cn
*/
?>
<?php include '../../common/header.html.php';?>
<form method='post' target='hiddenwin'>
<div class='yui-d0'>
<table class='table-1'>
<caption><?php echo $bug->title;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->bug->assignedTo;?></td>
<td><?php echo html::select('assignedTo', $users, $bug->resolvedBy, 'class=select-3');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><textarea name='comment' rows='6' class='area-1'></textarea></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton();?>
<input type='button' value='<?php echo $lang->bug->buttonToList;?>' class='button-s'
onclick='location.href="<?php echo $this->session->bugList;?>"' />
</td>
</tr>
</table>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -24,7 +24,6 @@
?>
<?php include '../../common/header.html.php';?>
<?php include '../../common/treeview.html.php';?>
<?php include '../../common/tablesorter.html.php';?>
<script language='Javascript'>
function selectProduct(productID)
{
@@ -70,10 +69,10 @@ $("#{$type}Tab").addClass('active');
EOT;
?>
</ul>
<?php if(common::hasPriv('bug', 'create')) echo '<div>' . html::a($this->createLink('bug', 'create', "productID=$productID&moduleID=$currentModuleID"), $lang->bug->create) . '</div>';?>
<?php if(common::hasPriv('bug', 'create')) echo '<div>' . html::a($this->createLink('bug', 'create', "type=product&productID=$productID&moduleID=$currentModuleID"), $lang->bug->create) . '</div>';?>
</div>
<table class='table-1 tablesorter'>
<table class='table-1'>
<thead>
<tr class='colhead'>
<th><?php echo $lang->bug->id;?></th>
@@ -88,17 +87,18 @@ EOT;
<tbody>
<?php foreach($bugs as $bug):?>
<tr class='a-center'>
<td class='a-right'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), $bug->id);?></td>
<td class='a-right'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), sprintf('%03d', $bug->id));?></td>
<td><?php echo $bug->severity?></td>
<td width='50%' class='a-left'><?php echo $bug->title;?></td>
<td><?php echo $users[$bug->openedBy];?></td>
<td><?php echo $users[$bug->assignedTo];?></td>
<td <?php if($bug->assignedTo == $this->app->user->account) echo 'style=color:red';?>><?php echo $users[$bug->assignedTo];?></td>
<td><?php echo $users[$bug->resolvedBy];?></td>
<td><?php echo $bug->resolution;?></td>
<td><?php echo $lang->bug->resolutionList[$bug->resolution];?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<div class='a-right'><?php echo $pager;?></div>
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<?php
/**
* The close file of bug module of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright: 2009 Chunsheng Wang
* @author Chunsheng Wang <wwccss@263.net>
* @package bug
* @version $Id$
* @link http://www.zentao.cn
*/
?>
<?php include '../../common/header.html.php';?>
<form method='post' target='hiddenwin'>
<div class='yui-d0'>
<table class='table-1'>
<caption><?php echo $bug->title;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><textarea name='comment' rows='6' class='area-1'></textarea></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton();?>
<input type='button' value='<?php echo $lang->bug->buttonToList;?>' class='button-s'
onclick='location.href="<?php echo $this->session->bugList;?>"' />
</td>
</tr>
</table>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -23,13 +23,72 @@
*/
?>
<?php include '../../common/header.html.php';?>
<style>
#project{width:245px}
#product{width:245px}
#story{width:245px}
</style>
<script language='Javascript'>
/* 当选择产品时,触发这个方法。*/
function loadAll(productID)
{
$('#taskIdBox').get(0).innerHTML = ''; // 将taskID内容复位。
loadModuleMenu(productID); // 加载产品的模块列表。
loadProductStories(productID); // 加载产品的需求列表。
loadProjects(productID); // 加载项目列表。
}
/* 加载模块列表。*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug');
$('#moduleIdBox').load(link);
}
/* 加载产品的需求列表。*/
function loadProductStories(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link);
}
/* 加载项目列表。*/
function loadProjects(productID)
{
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID);
$('#projectIdBox').load(link);
}
/* 加载项目的任务列表和需求列表。*/
function loadProjectStoriesAndTasks(projectID)
{
if(projectID)
{
loadProjectTasks(projectID);
loadProjectStories(projectID);
}
else
{
$('#taskIdBox').get(0).innerHTML = '';
loadProductStories($('#product').get(0).value);
}
}
/* 加载项目的任务列表。*/
function loadProjectTasks(projectID)
{
link = createLink('task', 'ajaxGetProjectTasks', 'projectID=' + projectID);
$('#taskIdBox').load(link);
}
/* 加载项目的需求列表。*/
function loadProjectStories(projectID)
{
productID = $('#product').get(0).value;
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + productID);
$('#storyIdBox').load(link);
}
</script>
<div class='yui-doc3'>
<form method='post' target='hiddenwin'>
@@ -38,26 +97,30 @@ function loadModuleMenu(productID)
<tr>
<th class='rowhead'><?php echo $lang->bug->labProductAndModule;?></th>
<td class='a-left'>
<?php echo html::select('productID', $products, $productID, "onchange=loadModuleMenu(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('moduleID', $moduleOptionMenu, $currentModuleID, 'class=select-3');?></span>
</td>
</tr>
<!--
<tr>
<th class='rowhead'><?php echo $lang->bug->labStory;?></th>
<td class='a-left'>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, 'class=select-3');?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->labProjectAndTask;?></th>
<td class='a-left'>
<span id='projectIdBox'><?php echo html::select('project', $projects, '', 'onchange=loadProjectStoriesAndTasks(this.value)');?></span>
<span id='taskIdBox'></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->labStory;?></th>
<td class='a-left'>
<span id='storyIdBox'><?php echo html::select('story', $stories);?></span>
</td>
</tr>
<!--
<tr>
<th class='rowhead'><?php echo $lang->bug->labBuild;?></th>
<td class='a-left'>
</td>
</tr>-->
</tr>
-->
<tr>
<th class='rowhead'><?php echo $lang->bug->labTypeAndSeverity;?></th>
<td class='a-left'>
@@ -73,12 +136,17 @@ function loadModuleMenu(productID)
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->labAssignAndMail;?></nobr></th>
<th class='rowhead'><nobr><?php echo $lang->bug->labAssignedTo;?></nobr></th>
<td class='a-left'>
<?php echo html::select('assignedTo', $users, '', 'class=select-2');?>
<?php echo html::select('mailTo', $users, '', 'class=select-2');?>
<?php echo html::select('assignedTo', $users, '', 'class=select-3');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->labMailto;?></nobr></th>
<td class='a-left'>
<?php echo html::select('mailto[]', $users, '', 'class=select-3 size=5 multiple=multiple');?>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->title;?></th>
<td class='a-left'><input type='text' name='title' class='text-1' /></td>

View File

@@ -23,14 +23,94 @@
*/
?>
<?php include '../../common/header.html.php';?>
<style>#project, #story, #task{width:245px}</style>
<script language='Javascript'>
changeProductConfirmed = false;
changeProjectConfirmed = false;
oldProjectID = '<?php echo $bug->project;?>';
oldStoryID = '<?php echo $bug->story;?>';
oldTaskID = '<?php echo $bug->task;?>';
/* 当选择产品时,触发这个方法。*/
function loadAll(productID)
{
if(!changeProductConfirmed)
{
firstChoice = confirm('<?php echo $lang->bug->confirmChangeProduct;?>');
changeProductConfirmed = true; // 已经提示过,下次就不再提示了。
}
if(changeProductConfirmed || firstChoice)
{
loadModuleMenu(productID); // 加载产品的模块列表。
loadProductStories(productID); // 加载产品的需求列表。
loadProjects(productID); // 加载项目列表。
}
}
/* 加载模块列表。*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug');
$('#moduleIdBox').load(link);
}
/* 加载产品的需求列表。*/
function loadProductStories(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleId=0&storyID=' + oldStoryID);
$('#storyIdBox').load(link);
}
/* 加载项目列表。*/
function loadProjects(productID)
{
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID);
$('#projectIdBox').load(link);
}
/* 加载项目的任务列表和需求列表。*/
function loadProjectStoriesAndTasks(projectID)
{
if(projectID)
{
loadProjectTasks(projectID);
loadProjectStories(projectID);
}
else
{
/* 将projectID, taskID, storyID内容复位。*/
$('#taskIdBox').get(0).innerHTML = '';
loadProductStories($('#product').get(0).value);
}
}
/* 加载项目的任务列表。*/
function loadProjectTasks(projectID)
{
link = createLink('task', 'ajaxGetProjectTasks', 'projectID=' + projectID + '&taskID=' + oldTaskID);
$('#taskIdBox').load(link);
}
/* 加载项目的需求列表。*/
function loadProjectStories(projectID)
{
productID = $('#product').get(0).value;
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + productID + '&storyID=' + oldStoryID);
$('#storyIdBox').load(link);
}
function setDuplicate(resolution)
{
if(resolution == 'duplicate')
{
$('#duplicateBugBox').show();
}
else
{
$('#duplicateBugBox').hide();
}
}
</script>
<form method='post'>
<form method='post' target='hiddenwin'>
<div class='yui-d0'>
<div id='titlebar'>
<div id='main'>
@@ -51,7 +131,7 @@ function loadModuleMenu(productID)
<tr>
<td class='rowhead'><?php echo $lang->bug->labProductAndModule;?></td>
<td>
<?php echo html::select('product', $products, $productID, "onchange=loadModuleMenu(this.value); class='select-2'");?>
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID);?></span>
</td>
</tr>
@@ -77,38 +157,35 @@ function loadModuleMenu(productID)
<td class='rowhead'><?php echo $lang->bug->assignedTo;?></td>
<td><?php echo html::select('assignedTo', $users, $bug->assignedTo, 'class=select-2');?></td>
</tr>
<tr>
<td width='40%' class='rowhead'><?php echo $lang->bug->assignedDate;?></td>
<td><?php echo $bug->assignedDate;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->lastEditedBy;?></td>
<td><?php echo $bug->lastEditedBy;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->lastEditedDate;?></td>
<td><?php echo $bug->lastEditedDate;?></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->bug->legendStoryAndTask;?></legend>
<legend><?php echo $lang->bug->legendPrjStoryTask;?></legend>
<table class='table-1 a-left'>
<tr>
<td class='rowhead'><?php echo $lang->bug->project;?></td>
<td><span id='projectIdBox'><?php echo html::select('project', $projects, $bug->project, 'class=select-3 onchange=loadProjectStoriesAndTasks(this.value)');?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->story;?></td>
<td></td>
<td><span id='storyIdBox'><?php echo html::select('story', $stories, $bug->story, 'class=select-3');?></span></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->task;?></td>
<td></td>
<td><span id='taskIdBox'><?php echo html::select('task', $tasks, $bug->task, 'class=select-3');?></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->bug->legendMailto;?></legend>
<div>&nbsp;</div>
<table class='table-1 a-left'>
<tr>
<td class='rowhead'></td>
<td><?php echo html::input('mailto', $bug->mailto, 'class=text-3');?></div>
</tr>
</table>
</fieldset>
<fieldset>
@@ -126,10 +203,6 @@ function loadModuleMenu(productID)
<td width='40%' class='rowhead'><?php echo $lang->bug->openedBy;?></td>
<td><?php echo $users[$bug->openedBy];?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->openedDate;?></td>
<td><?php echo $bug->openedDate;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->openedBuild;?></td>
<td><?php echo html::input('openedBuild', $bug->openedBuild, 'class=text-2');?></td>
@@ -154,7 +227,11 @@ function loadModuleMenu(productID)
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->resolution;?></td>
<td><?php echo html::select('resolution', array(''=> '') + (array)$lang->bug->resolutionList, $bug->resolution, 'class=select-2');?></td>
<td><?php echo html::select('resolution', $lang->bug->resolutionList, $bug->resolution, 'class=select-2 onchange=setDuplicate(this.value)');?></td>
</tr>
<tr id='duplicateBugBox' <?php if($bug->resolution != 'duplicate') echo "style='display:none'";?>>
<td class='rowhead'><?php echo $lang->bug->duplicateBug;?></td>
<td><?php echo html::input('duplicateBug', $bug->duplicateBug, 'class=text-2');?></td>
</tr>
</table>
</fieldset>

View File

@@ -0,0 +1,69 @@
<?php
/**
* The resolve file of bug module of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright: 2009 Chunsheng Wang
* @author Chunsheng Wang <wwccss@263.net>
* @package bug
* @version $Id$
* @link http://www.zentao.cn
*/
?>
<?php include '../../common/header.html.php';?>
<script language='Javascript'>
function setDuplicate(resolution)
{
if(resolution == 'duplicate')
{
$('#duplicateBugBox').show();
}
else
{
$('#duplicateBugBox').hide();
}
}
</script>
<form method='post' target='hiddenwin'>
<div class='yui-d0'>
<table class='table-1'>
<caption><?php echo $bug->title;?></caption>
<tr>
<td class='rowhead'><?php echo $lang->bug->resolution;?></td>
<td><?php echo html::select('resolution', $lang->bug->resolutionList, '', 'class=select-3 onchange=setDuplicate(this.value)');?></td>
</tr>
<!--
<tr>
<td class='rowhead'><?php echo $lang->bug->resolvedBuild;?></td>
<td><?php echo html::input('resolvedBuild', '', 'class=text-3');?></td>
</tr>-->
<tr id='duplicateBugBox' style='display:none'>
<td class='rowhead'><?php echo $lang->bug->duplicateBug;?></td>
<td><?php echo html::input('duplicateBug', '', 'class=text-3');?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->comment;?></td>
<td><textarea name='comment' rows='6' class='area-1'></textarea></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton();?>
<input type='button' value='<?php echo $lang->bug->buttonToList;?>' class='button-s'
onclick='location.href="<?php echo $this->session->bugList;?>"' />
</td>
</tr>
</table>
</div>
<?php include '../../common/footer.html.php';?>

View File

@@ -29,11 +29,11 @@
<div id='main'>BUG #<?php echo $bug->id . $lang->colon . $bug->title;?></div>
<div>
<?php
if(common::hasPriv('bug', 'edit')) echo html::a($this->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);
?>
</div>
</div>
@@ -96,22 +96,26 @@
</fieldset>
<fieldset>
<legend><?php echo $lang->bug->legendStoryAndTask;?></legend>
<legend><?php echo $lang->bug->legendPrjStoryTask;?></legend>
<table class='table-1 a-left'>
<tr>
<td class='rowhead'><?php echo $lang->bug->project;?></td>
<td><?php echo $bug->projectName;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->story;?></td>
<td><?php //echo $bug->story;?></td>
<td><?php echo $bug->storyTitle;?></td>
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->task;?></td>
<td><?php //echo $bug->task;?></td>
<td><?php echo $bug->taskName;?></td>
</tr>
</table>
</fieldset>
<fieldset>
<legend><?php echo $lang->bug->legendMailto;?></legend>
<div></div>
<div><?php $mailto = explode(',', $bug->mailto); foreach($mailto as $account) echo ' ' . $users[$account]; ?></div>
</fieldset>
<fieldset>
@@ -157,7 +161,12 @@
</tr>
<tr>
<td class='rowhead'><?php echo $lang->bug->resolution;?></td>
<td><?php if(!empty($bug->resolution)) echo $lang->bug->resolutionList->{$bug->resolution};?></td>
<td>
<?php
echo $lang->bug->resolutionList[$bug->resolution];
if(isset($bug->duplicateBugTitle)) echo " #$bug->duplicateBug:" . html::a($this->createLink('bug', 'view', "bugID=$bug->duplicateBug"), $bug->duplicateBugTitle);
?>
</td>
</tr>
</table>
</fieldset>
@@ -194,13 +203,13 @@
<fieldset>
<legend><?php echo $lang->bug->legendAction;?></legend>
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
if(common::hasPriv('bug', 'edit')) echo html::a($this->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);
?>
<?php
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);
?>
</div>
</fieldset>
<fieldset>