* Finish task #76434.
This commit is contained in:
@@ -54,7 +54,7 @@ class build extends control
|
||||
|
||||
if(defined('TUTORIAL')) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true)); // Fix bug #21095.
|
||||
|
||||
$buildID = $this->build->create($executionID, $projectID);
|
||||
$buildID = $this->build->create();
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
$this->loadModel('action')->create('build', $buildID, 'opened');
|
||||
|
||||
@@ -72,6 +72,8 @@ class build extends control
|
||||
if($this->app->tab == 'project')
|
||||
{
|
||||
$this->project->setMenu($projectID);
|
||||
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter');
|
||||
$executionID = empty($executionID) ? key($executions) : $executionID;
|
||||
$productGroups = $this->product->getProducts($projectID);
|
||||
$branchGroups = $this->project->getBranchesByProject($projectID);
|
||||
$this->session->set('project', $projectID);
|
||||
@@ -79,6 +81,7 @@ class build extends control
|
||||
elseif($this->app->tab == 'execution')
|
||||
{
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$executions = $this->execution->getPairs($execution->project);
|
||||
$projectID = $execution->project;
|
||||
$productGroups = $this->product->getProducts($executionID);
|
||||
$branchGroups = $this->project->getBranchesByProject($executionID);
|
||||
@@ -89,6 +92,7 @@ class build extends control
|
||||
{
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$projectID = $execution ? $execution->project : 0;
|
||||
$executions = $this->execution->getPairs($projectID);
|
||||
$productGroups = $this->product->getProducts($executionID);
|
||||
$branchGroups = $this->project->getBranchesByProject($executionID);
|
||||
}
|
||||
@@ -119,6 +123,7 @@ class build extends control
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->products = $products;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->executions = $executions;
|
||||
$this->view->lastBuild = $this->build->getLast($executionID, $projectID);
|
||||
$this->view->productGroups = $productGroups;
|
||||
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
|
||||
|
||||
@@ -15,5 +15,55 @@ $().ready(function()
|
||||
$('#builds').chosen();
|
||||
});
|
||||
});
|
||||
|
||||
$('input[name=type]').change(function()
|
||||
{
|
||||
if($(this).val() == 'execution')
|
||||
{
|
||||
$('#execution').closest('tr').show();
|
||||
$('#buildBox').closest('tr').hide();
|
||||
loadProducts($('#execution').val());
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#execution').closest('tr').hide();
|
||||
$('#buildBox').closest('tr').show();
|
||||
loadProducts($('#project').val());
|
||||
}
|
||||
});
|
||||
$('#product').change();
|
||||
});
|
||||
|
||||
/**
|
||||
* Load products.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadProducts(executionID)
|
||||
{
|
||||
$('#product').remove();
|
||||
$('#product_chosen').remove();
|
||||
$('#branch').remove();
|
||||
$('#branch_chosen').remove();
|
||||
$('#noProduct').remove();
|
||||
$.get(createLink('product', 'ajaxGetProducts', 'executionID=' + executionID), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
if(data.indexOf("required") != -1)
|
||||
{
|
||||
$('#productBox').addClass('required');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#productBox').removeClass('required');
|
||||
}
|
||||
|
||||
$('#productBox').append(data);
|
||||
$('#product').chosen();
|
||||
loadBranches($("#product").val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ $lang->build->project = 'Project';
|
||||
$lang->build->branch = 'Platform/Branch';
|
||||
$lang->build->branchName = '%s';
|
||||
$lang->build->execution = $lang->executionCommon;
|
||||
$lang->build->type = 'Type';
|
||||
$lang->build->builds = 'Linked Builds';
|
||||
$lang->build->name = 'Name';
|
||||
$lang->build->date = 'Datum';
|
||||
@@ -73,3 +74,7 @@ $lang->build->action->buildopened = '$date, erstellt von <strong>$actor</strong>
|
||||
$lang->backhome = 'zurück';
|
||||
|
||||
$lang->build->featureBar['browse']['all'] = 'Build List';
|
||||
|
||||
$lang->build->typeList = array();
|
||||
$lang->build->typeList['execution'] = "{$lang->executionCommon}版本";
|
||||
$lang->build->typeList['project'] = '项目版本';
|
||||
|
||||
@@ -34,6 +34,7 @@ $lang->build->branch = 'Platform/Branch';
|
||||
$lang->build->branchName = '%s';
|
||||
$lang->build->execution = $lang->executionCommon;
|
||||
$lang->build->builds = 'Linked Builds';
|
||||
$lang->build->type = 'Type';
|
||||
$lang->build->name = 'Name';
|
||||
$lang->build->date = 'Date';
|
||||
$lang->build->builder = 'Builder';
|
||||
@@ -73,3 +74,7 @@ $lang->build->action->buildopened = '$date, created by <strong>$actor</strong>,
|
||||
$lang->backhome = 'back';
|
||||
|
||||
$lang->build->featureBar['browse']['all'] = 'Build List';
|
||||
|
||||
$lang->build->typeList = array();
|
||||
$lang->build->typeList['execution'] = "{$lang->executionCommon}版本";
|
||||
$lang->build->typeList['project'] = '项目版本';
|
||||
|
||||
@@ -33,6 +33,7 @@ $lang->build->project = 'Project';
|
||||
$lang->build->branch = 'Plateforme/Branche';
|
||||
$lang->build->branchName = '%s';
|
||||
$lang->build->execution = $lang->executionCommon;
|
||||
$lang->build->type = 'Type';
|
||||
$lang->build->builds = 'Linked Builds';
|
||||
$lang->build->name = 'Nom';
|
||||
$lang->build->date = 'Date';
|
||||
@@ -73,3 +74,7 @@ $lang->build->action->buildopened = '$date, Build <strong>$extra</strong> créé
|
||||
$lang->backhome = 'Retour';
|
||||
|
||||
$lang->build->featureBar['browse']['all'] = 'Build List';
|
||||
|
||||
$lang->build->typeList = array();
|
||||
$lang->build->typeList['execution'] = "{$lang->executionCommon}版本";
|
||||
$lang->build->typeList['project'] = '项目版本';
|
||||
|
||||
@@ -33,6 +33,7 @@ $lang->build->project = '所属项目';
|
||||
$lang->build->branch = '平台/分支';
|
||||
$lang->build->branchName = '所属%s';
|
||||
$lang->build->execution = '所属' . $lang->executionCommon;
|
||||
$lang->build->type = '版本类型';
|
||||
$lang->build->builds = '关联版本';
|
||||
$lang->build->name = '名称编号';
|
||||
$lang->build->date = '打包日期';
|
||||
@@ -71,3 +72,7 @@ $lang->build->action = new stdclass();
|
||||
$lang->build->action->buildopened = '$date, 由 <strong>$actor</strong> 创建版本 <strong>$extra</strong>。' . "\n";
|
||||
|
||||
$lang->backhome = '返回';
|
||||
|
||||
$lang->build->typeList = array();
|
||||
$lang->build->typeList['execution'] = "{$lang->executionCommon}版本";
|
||||
$lang->build->typeList['project'] = '项目版本';
|
||||
|
||||
+6
-17
@@ -302,42 +302,31 @@ class buildModel extends model
|
||||
/**
|
||||
* Create a build
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($executionID = 0, $projectID = 0)
|
||||
public function create()
|
||||
{
|
||||
$build = new stdclass();
|
||||
$build->stories = '';
|
||||
$build->bugs = '';
|
||||
|
||||
if($projectID && !$executionID)
|
||||
{
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
if(!$project->multiple) $executionID = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq($projectID)->fetch('id');
|
||||
}
|
||||
else if($executionID && !$projectID)
|
||||
{
|
||||
$execution = $this->loadModel('execution')->getByID($executionID);
|
||||
$projectID = $execution->project;
|
||||
}
|
||||
|
||||
$build = fixer::input('post')
|
||||
->setDefault('project', $projectID)
|
||||
->setDefault('project', 0)
|
||||
->setDefault('execution', 0)
|
||||
->setDefault('product', 0)
|
||||
->setDefault('branch', 0)
|
||||
->setDefault('builds', '')
|
||||
->cleanInt('product,branch')
|
||||
->add('execution', $executionID)
|
||||
->add('createdBy', $this->app->user->account)
|
||||
->add('createdDate', helper::now())
|
||||
->stripTags($this->config->build->editor->create['id'], $this->config->allowedTags)
|
||||
->join('builds', ',')
|
||||
->remove('resolvedBy,allchecker,files,labels,uid')
|
||||
->remove('resolvedBy,allchecker,files,labels,type,uid')
|
||||
->get();
|
||||
|
||||
if($this->post->type == 'project') $build->execution = 0;
|
||||
|
||||
$build = $this->loadModel('file')->processImgURL($build, $this->config->build->editor->create['id'], $this->post->uid);
|
||||
$this->dao->insert(TABLE_BUILD)->data($build)
|
||||
->autoCheck()
|
||||
|
||||
@@ -19,6 +19,14 @@
|
||||
</div>
|
||||
<form class='load-indicator main-form form-ajax' id='dataform' method='post' enctype='multipart/form-data'>
|
||||
<table class='table table-form'>
|
||||
<tr class="<?php echo ($app->tab == 'project' and !empty($multipleProject)) ? '' : 'hidden';?>">
|
||||
<th><?php echo $lang->build->type;?></th>
|
||||
<td><?php echo html::radio('type', $lang->build->typeList, 'execution');?></td>
|
||||
</tr>
|
||||
<tr class="<?php echo !empty($multipleProject) ? '' : 'hidden';?>">
|
||||
<th><?php echo $lang->executionCommon;?></th>
|
||||
<td><?php echo html::select('execution', $executions, $executionID, "onchange='loadProducts(this.value);' class='form-control chosen' required");?></td>
|
||||
</tr>
|
||||
<tr class="<?php echo $hidden;?>">
|
||||
<th><?php echo $lang->build->product;?></th>
|
||||
<?php if(!empty($products)):?>
|
||||
@@ -42,13 +50,11 @@
|
||||
<?php endif;?>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php if($app->tab == 'project' && !empty($multipleProject)):?>
|
||||
<tr>
|
||||
<tr class='hide'>
|
||||
<th><?php echo $lang->build->builds;?></th>
|
||||
<td id='buildBox'><?php echo html::select('builds[]', array(), '', "class='form-control chosen' multiple");?></td>
|
||||
<td><?php echo $lang->build->notice->autoRelation;?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->build->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control' required");?></td>
|
||||
@@ -86,6 +92,7 @@
|
||||
<tr>
|
||||
<td colspan="3" class="text-center form-actions">
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::hidden('project', $projectID);?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -266,7 +266,7 @@ $lang->waterfall->menu->design = array('link' => "{$lang->design->common}|de
|
||||
$lang->waterfall->menu->qa = array('link' => "{$lang->qa->common}|project|bug|projectID=%s", 'subModule' => 'testcase,testtask,bug,testreport', 'alias' => 'bug,testtask,testcase,testreport');
|
||||
$lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc|tableContents|type=project&objectID=%s");
|
||||
$lang->waterfall->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&branchID=&objectID=%s", 'subModule' => 'repo');
|
||||
$lang->waterfall->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s");
|
||||
$lang->waterfall->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s", 'subModule' => 'projectbuild');
|
||||
$lang->waterfall->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease');
|
||||
$lang->waterfall->menu->dynamic = array('link' => "$lang->dynamic|project|dynamic|project=%s");
|
||||
|
||||
|
||||
@@ -237,7 +237,6 @@ $lang->project->methodOrder[190] = 'manageRepo';
|
||||
|
||||
$lang->resource->projectbuild = new stdclass();
|
||||
$lang->resource->projectbuild->browse = 'browse';
|
||||
$lang->resource->projectbuild->create = 'create';
|
||||
$lang->resource->projectbuild->edit = 'edit';
|
||||
$lang->resource->projectbuild->view = 'view';
|
||||
$lang->resource->projectbuild->delete = 'delete';
|
||||
@@ -249,7 +248,6 @@ $lang->resource->projectbuild->unlinkBug = 'unlinkBug';
|
||||
$lang->resource->projectbuild->batchUnlinkBug = 'batchUnlinkBug';
|
||||
|
||||
$lang->projectbuild->methodOrder[5] = 'browse';
|
||||
$lang->projectbuild->methodOrder[10] = 'create';
|
||||
$lang->projectbuild->methodOrder[15] = 'edit';
|
||||
$lang->projectbuild->methodOrder[20] = 'view';
|
||||
$lang->projectbuild->methodOrder[25] = 'delete';
|
||||
|
||||
@@ -880,6 +880,27 @@ class product extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get products.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetProducts($executionID)
|
||||
{
|
||||
$this->loadModel('build');
|
||||
$products = $this->product->getProductPairsByProject($executionID);
|
||||
if(empty($products))
|
||||
{
|
||||
return printf($this->lang->build->noProduct, $this->createLink('execution', 'manageproducts', "executionID=$executionID&from=buildCreate", '', 'true'), 'project');
|
||||
}
|
||||
else
|
||||
{
|
||||
return print(html::select('product', $products, empty($product) ? '' : $product->id, "onchange='loadBranches(this.value);' class='form-control chosen' required data-toggle='modal' data-type='iframe'"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get projects of a product in html select.
|
||||
*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> <?php echo $lang->execution->byQuery;?></a>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if(common::canModify('project', $project)) common::printLink('projectbuild', 'create', "projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->build->create, '', "class='btn btn-primary' id='createBuild'");?>
|
||||
<?php if(common::canModify('project', $project)) common::printLink('build', 'create', "executionID=&productID=&projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->build->create, '', "class='btn btn-primary' id='createBuild'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainContent">
|
||||
|
||||
Reference in New Issue
Block a user