* finish task #2353.

This commit is contained in:
wangyidong
2015-10-26 14:15:25 +08:00
parent 5029ba6b23
commit 9bd03f5976
7 changed files with 49 additions and 8 deletions
+13 -4
View File
@@ -39,11 +39,16 @@ class build extends control
$orderBy = 'status_asc, stage_asc, id_desc';
/* Assign. */
$project = $this->loadModel('project')->getById($projectID);
$project = $this->loadModel('project')->getById($projectID);
$products = $this->project->getProducts($projectID, false);
$product = $this->loadModel('product')->getById(key($products));
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->create;
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $project->name);
$this->view->position[] = $this->lang->build->create;
$this->view->products = $this->project->getProducts($projectID);
$this->view->products = $products;
$this->view->product = $product;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->projectID = $projectID;
$this->view->lastBuild = $this->build->getLast($projectID);
$this->view->users = $this->user->getPairs('nodeleted');
@@ -86,11 +91,14 @@ class build extends control
$orderBy = 'status_asc, stage_asc, id_desc';
/* Assign. */
$project = $this->loadModel('project')->getById($build->project);
$project = $this->loadModel('project')->getById($build->project);
$products = $this->project->getProducts($build->project, false);
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->edit;
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$build->project"), $project->name);
$this->view->position[] = $this->lang->build->edit;
$this->view->products = $this->project->getProducts($build->project);
$this->view->products = $products;
$this->view->branches = $build->productType == 'normal' ? array() : $this->loadModel('branch')->getPairs($build->product);
$this->view->build = $build;
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', $build->builder);
$this->view->orderBy = $orderBy;
@@ -138,6 +146,7 @@ class build extends control
$this->view->type = $type;
$this->view->link = $link;
$this->view->param = $param;
$this->view->branchName = $build->productType == 'normal' ? '' : $this->loadModel('branch')->getById($build->branch);
$this->display();
}
+13
View File
@@ -2,3 +2,16 @@ $(document).ready(function()
{
$("a.preview").modalTrigger({width:1000, type:'iframe'});
})
function loadBranches(productID)
{
$('#branch').remove();
$.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID), function(data)
{
if(data)
{
$('#product').closest('.input-group').append(data);
$('#branch').css('width', '100px');
}
});
}
+1
View File
@@ -31,6 +31,7 @@ $lang->build->basicInfo = '基本信息';
$lang->build->id = 'ID';
$lang->build->product = $lang->productCommon;
$lang->build->branch = '所属分支';
$lang->build->project = $lang->projectCommon;
$lang->build->name = '名称编号';
$lang->build->date = '打包日期';
+1 -1
View File
@@ -23,7 +23,7 @@ class buildModel extends model
*/
public function getByID($buildID, $setImgSize = false)
{
$build = $this->dao->select('t1.*, t2.name as projectName, t3.name as productName')
$build = $this->dao->select('t1.*, t2.name as projectName, t3.name as productName, t3.type as productType')
->from(TABLE_BUILD)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
+8 -1
View File
@@ -24,7 +24,14 @@
<table class='table table-form'>
<tr>
<th class='w-110px'><?php echo $lang->build->product;?></th>
<td class='w-p25-f'><?php echo html::select('product', $products, '', "class='form-control chosen'");?></td>
<td class='w-p25-f'>
<?php if($products):?>
<div class='input-group'>
<?php echo html::select('product', $products, $product->id, "onchange='loadBranches(this.value);' class='form-control chosen'");?>
<?php if($product->type != 'normal') echo html::select('branch', $branches, '', "class='form-control' style='width:100px'");?>
</div>
<?php endif;?>
</td>
<td><?php if(empty($products)) printf($lang->build->noProduct, $this->createLink('project', 'manageproducts', "projectID=$projectID"));?></td>
</tr>
<tr>
+6 -1
View File
@@ -25,7 +25,12 @@
<table class='table table-form'>
<tr>
<th class='w-110px'><?php echo $lang->build->product;?></th>
<td class='w-p25-f'><?php echo html::select('product', $products, $build->product, "class='form-control chosen'");?></td><td></td>
<td class='w-p25-f'>
<div class='input-group'>
<?php echo html::select('product', $products, $build->product, "onchange='loadBranches(this.value);' class='form-control chosen'");?>
<?php if($build->productType != 'normal') echo html::select('branch', $branches, $build->branch, "class='form-control' style='width:100px'");?>
</div>
</td><td></td>
</tr>
<tr>
<th><?php echo $lang->build->name;?></th>
+7 -1
View File
@@ -222,10 +222,16 @@
<th class='w-80px'><?php echo $lang->build->product;?></th>
<td><?php echo $build->productName;?></td>
</tr>
<?php if($build->productType != 'normal'):?>
<tr>
<th><?php echo $lang->build->branch;?></th>
<td><?php echo $branchName;?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->build->name;?></th>
<td><?php echo $build->name;?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->build->builder;?></th>
<td><?php echo $users[$build->builder];?></td>