* finish the task #629.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-11-28 08:23:09 +00:00
parent 1e9b5980f8
commit 794795844b
9 changed files with 65 additions and 12 deletions
+2 -1
View File
@@ -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();
}
+4 -2
View File
@@ -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);
+1
View File
@@ -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--';
+1
View File
@@ -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 = '--请选择项目--';
+7 -2
View File
@@ -14,12 +14,17 @@
<?php include '../../common/view/colorize.html.php';?>
<table class='table-1 fixed colored tablesorter'>
<caption class='caption-tl'>
<div class='f-left'><?php echo $lang->project->bug;?></div>
<div class='f-left'>
<?php
if($build != 0) echo $lang->project->bug . '<span class="star">(Build:' . $build . ')</span>';
else echo $lang->project->bug;
?>
</div>
<div class='f-right'><?php common::printLink('bug', 'create', "productID=$productID&extra=projectID=$project->id", $lang->bug->create);?></div>
</caption>
<thead>
<tr class='colhead'>
<?php $vars = "projectID={$project->id}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<?php $vars = "projectID={$project->id}&orderBy=%s&build=$build&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-severity'><?php common::printOrderLink('severity', $orderBy, $vars, $lang->bug->severityAB);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
+3 -1
View File
@@ -26,7 +26,7 @@
<th><?php echo $lang->build->filePath;?></th>
<th class='w-date'><?php echo $lang->build->date;?></th>
<th class='w-user'><?php echo $lang->build->builder;?></th>
<th class='w-60px'><?php echo $lang->actions;?></th>
<th class='w-200px'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
@@ -41,6 +41,8 @@
<td><?php echo $users[$build->builder]?></td>
<td>
<?php
common::printLink('testtask', 'create', "product=0&project=$project->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');
?>
+35 -4
View File
@@ -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();
+1 -2
View File
@@ -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();
+11
View File
@@ -16,6 +16,17 @@
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->testtask->create;?></caption>
<?php if(isset($projectID)):?>
<tr>
<th class='rowhead'><?php echo $lang->testtask->product;?></th>
<td><?php echo html::select('product', $products, '', 'class=select-3');?></td>
</tr>
<?php else:?>
<tr class='hidden'>
<th><?php echo $lang->testtask->product;?></th>
<td><?php echo html::input('product', $productID, 'class=select-3');?></td>
</tr>
<?php endif;?>
<tr>
<th class='rowhead'><?php echo $lang->testtask->project;?></th>
<td><?php echo html::select('project', $projects, '', 'class=select-3');?></td>