* finish the task #664.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-12-29 08:05:55 +00:00
parent 9230a53e22
commit 1d099a6ac9
6 changed files with 73 additions and 8 deletions

View File

@@ -28,13 +28,29 @@ class build extends control
die(js::locate($this->createLink('project', 'build', "project=$projectID"), 'parent'));
}
/* Load these models. */
$this->loadModel('story');
$this->loadModel('bug');
$this->loadModel('task');
$this->loadModel('project');
$this->loadModel('user');
/* Set menu. */
$this->loadModel('project')->setMenu($this->project->getPairs(), $projectID);
$this->project->setMenu($this->project->getPairs(), $projectID);
/* Get stories. */
$orderBy = 'status_asc, stage_asc, id_desc';
$stories = $this->story->getProjectStories($projectID, $orderBy);
$bugs = $this->project->getResolvedBugs($projectID);
/* Assign. */
$this->view->header->title = $this->lang->build->create;
$this->view->products = $this->project->getProducts($projectID);
$this->view->users = $this->loadModel('user')->getPairs();
$this->view->products = $this->project->getProducts($projectID);
$this->view->projectID = $projectID;
$this->view->users = $this->user->getPairs();
$this->view->stories = $stories;
$this->view->bugs = $bugs;
$this->view->orderBy = $orderBy;
$this->display();
}

View File

@@ -28,3 +28,4 @@ $lang->build->builder = 'Builder';
$lang->build->scmPath = 'Source code path';
$lang->build->filePath = 'Package file path';
$lang->build->desc = 'Desc';
$lang->build->linkStoriesAndBugs = 'stories and bugs';

View File

@@ -28,3 +28,4 @@ $lang->build->builder = '构建者';
$lang->build->scmPath = '源代码地址';
$lang->build->filePath = '存储地址';
$lang->build->desc = '描述';
$lang->build->linkStoriesAndBugs = '关联需求和Bug';

View File

@@ -113,7 +113,13 @@ class buildModel extends model
*/
public function create($projectID)
{
$build = fixer::input('post')->stripTags('name')->add('project', (int)$projectID)->get();
$build->stories = '';
$build->bugs = '';
$build = fixer::input('post')->stripTags('name')
->join('stories', ',')
->join('bugs', ',')
->add('project', (int)$projectID)->get();
$this->dao->insert(TABLE_BUILD)->data($build)->autoCheck()->batchCheck($this->config->build->create->requiredFields, 'notempty')->check('name','unique')->exec();
if(!dao::isError()) return $this->dao->lastInsertID();
}

View File

@@ -14,7 +14,7 @@
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<table class='table-1 fixed'>
<caption><?php echo $lang->build->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->build->product;?></th>
@@ -40,6 +40,47 @@
<th class='rowhead'><?php echo $lang->build->filePath;?></th>
<td><?php echo html::input('filePath', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->linkStoriesAndBugs;?></th>
<td>
<div class='half-left' style="height:300px; overflow-y:auto">
<table class='table-1'>
<caption>story</caption>
<tr class='colhead'>
<?php $vars = "projectID=$projectID&orderBy=%s"; ?>
<th class='w-id {sorter:false}'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class= '{sorter:false}'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th class='w-100px {sorter:false}'> <?php common::printOrderLink('stage', $orderBy, $vars, $lang->story->stageAB);?></th>
</tr>
<?php foreach($stories as $key => $story):?>
<?php
$storyLink = $this->createLink('story', 'view', "storyID=$story->id");
?>
<tr class='a-center'>
<td><input type='checkbox' name='stories[]' value="<?php echo $story->id;?>"> <?php echo sprintf('%03d', $story->id);?></td>
<td class='a-left nobr'><?php echo html::a($storyLink,$story->title);?></td>
<td><?php echo $lang->story->stageList[$story->stage];?></td>
</tr>
<?php endforeach;?>
</table>
</div>
<div class='half-right' style="height:300px; overflow-y:auto">
<table class='table-1'>
<caption>bug</caption>
<tr class='colhead'>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th><?php echo $lang->bug->title;?></th>
</tr>
<?php foreach($bugs as $bug):?>
<tr class='a-center'>
<td><input type='checkbox' name='bugs[]' value="<?php echo $bug->id;?>"> <?php echo sprintf('%03d', $bug->id);?></td>
<td class='a-left nobr'><?php common::printLink('bug', 'view', "bugID=$bug->id", $bug->title, '', "class='preview'");?></td>
</tr>
<?php endforeach;?>
</table>
</div>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->build->desc;?></th>
<td><?php echo html::textarea('desc', '', "rows='15' class='area-1'");?></td>

View File

@@ -1027,10 +1027,10 @@ class projectModel extends model
*/
public function getResolvedBugs($projectID)
{
$project = $this->findById($projectID);
$project = $this->getById($projectID);
return $this->dao->select('id, title, status')->from(TABLE_BUG)
->where('status')->eq('resovled')
->andWhere('resovledDate')->ge($project->begin)
->where('status')->eq('resolved')
->andWhere('resolvedDate')->ge($project->begin)
->fetchAll();
}
}