* finish task #4438.

This commit is contained in:
wangyidong
2019-12-02 13:27:43 +08:00
parent d046d52707
commit e4ce5d1c02
6 changed files with 40 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ $config->build = new stdclass();
$config->build->create = new stdclass();
$config->build->edit = new stdclass();
$config->build->create->requiredFields = 'product,name,builder,date';
$config->build->edit->requiredFields = 'product,name,builder,date';
$config->build->edit->requiredFields = 'product,project,name,builder,date';
$config->build->editor = new stdclass();
$config->build->editor->create = array('id' => 'desc', 'tools' => 'simpleTools');
+5 -1
View File
@@ -149,6 +149,9 @@ class build extends control
$project->name = '';
}
$projects = $this->loadModel('product')->getProjectPairs($build->product, $build->branch, 'nodeleted');
if(!isset($projects[$build->project])) $projects[$build->project] = $project->name;
$productGroups = $this->project->getProducts($build->project);
$products = array();
@@ -164,6 +167,7 @@ class build extends control
$this->view->position[] = $this->lang->build->edit;
$this->view->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : '';
$this->view->branches = (isset($productGroups[$build->product]) and $productGroups[$build->product]->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($build->product);
$this->view->projects = $projects;
$this->view->orderBy = $orderBy;
}
@@ -173,7 +177,7 @@ class build extends control
$this->view->build = $build;
$this->display();
}
/**
* View a build.
*
+15
View File
@@ -0,0 +1,15 @@
var projectID = $('#project').val();
function loadProjects()
{
var productID = $('#product').val();
var branchID = $('#branch').length > 0 ? $('#branch').val() : 0;
$('#projectsBox').load(createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + projectID + '&branch=' + branchID), function()
{
$('#projectsBox #project').chosen().removeAttr('onchange');
});
}
$(document).on('change', '#product,#branch', function()
{
loadProjects();
})
+3
View File
@@ -48,6 +48,9 @@ $lang->build->generatedBugs = '产生的Bug';
$lang->build->noProduct = " <span style='color:red'>该{$lang->projectCommon}没有关联{$lang->productCommon},无法创建版本,请先<a href='%s'>关联{$lang->productCommon}</a></span>";
$lang->build->noBuild = '暂时没有版本。';
$lang->build->notice = new stdclass();
$lang->build->notice->changeProduct = "已经关联{$lang->storyCommon}或Bug的版本,不能修改其所属产品";
$lang->build->finishStories = " 本次共完成 %s 个{$lang->storyCommon}";
$lang->build->resolvedBugs = ' 本次共解决 %s 个Bug';
$lang->build->createdBugs = ' 本次共产生 %s 个Bug';
+2 -1
View File
@@ -236,10 +236,11 @@ class buildModel extends model
$buildID = (int)$buildID;
$oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch();
$build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags)
->setDefault('product', $oldBuild->product)
->setDefault('branch', $oldBuild->branch)
->cleanInt('product,branch')
->remove('allchecker,resolvedBy,files,labels,uid')
->get();
if(!isset($build->branch)) $build->branch = $oldBuild->branch;
$build = $this->loadModel('file')->processImgURL($build, $this->config->build->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_BUILD)->data($build)
+14 -4
View File
@@ -26,18 +26,29 @@
<tr>
<th><?php echo $lang->build->product;?></th>
<td>
<?php
$disabled = '';
if($build->stories or $build->bugs) $disabled = 'disabled';
?>
<div class='input-group'>
<?php echo html::select('product', $products, $build->product, "onchange='loadBranches(this.value);' class='form-control chosen' required");?>
<?php echo html::select('product', $products, $build->product, "onchange='loadBranches(this.value);' class='form-control chosen' $disabled required");?>
<?php
if($build->productType != 'normal' and isset($branches[$product->branch]))
{
if($product->branch) $branches = array($product->branch => $branches[$product->branch]);
echo "<span class='input-group-addon fix-padding fix-border'></span>" . html::select('branch', $branches, $build->branch, "class='form-control chosen'");
echo "<span class='input-group-addon fix-padding fix-border'></span>" . html::select('branch', $branches, $build->branch, "class='form-control chosen' $disabled");
}
?>
</div>
</td><td></td>
</td>
<td><?php if($disabled) echo $lang->build->notice->changeProduct;?></td>
</tr>
<?php if($this->config->global->flow != 'onlyTest'):?>
<tr>
<th><?php echo $lang->build->project;?></th>
<td id='projectsBox'><?php echo html::select('project', $projects, $build->project, "class='form-control chosen' required");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->build->name;?></th>
<td><?php echo html::input('name', $build->name, "class='form-control' required");?></td>
@@ -71,7 +82,6 @@
<td colspan="3" class="text-center form-actions">
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
<?php echo $config->global->flow != 'onlyTest' ? html::hidden('project', $build->project) : '';?>
</td>
</tr>
</table>