* Finish task #36764.

This commit is contained in:
holan20180123
2021-03-16 14:36:45 +08:00
parent 7fbc4a0e47
commit 07532a914c
10 changed files with 71 additions and 7 deletions
+10
View File
@@ -476,12 +476,20 @@ class bug extends control
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story")));
/* Get products and projects. */
$products = $this->products;
if($projectID)
{
$products = array();
$productList = $this->product->getOrderedProducts('all', 40, $projectID);
foreach($productList as $product) $products[$product->id] = $product->name;
$project = $this->loadModel('project')->getByID($projectID);
$projects = array($projectID => $project->name);
}
else
{
$projects = $this->product->getProjectPairsByProduct($productID, $branch);
}
/* Set custom. */
@@ -498,9 +506,11 @@ class bug extends control
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->stories = $stories;
$this->view->projects = $projects;
$this->view->executions = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'id_desc', $projectID);
$this->view->builds = $builds;
$this->view->moduleID = (int)$moduleID;
$this->view->projectID = $projectID;
$this->view->executionID = $executionID;
$this->view->taskID = $taskID;
$this->view->storyID = $storyID;
+28 -5
View File
@@ -55,7 +55,7 @@ function loadAll(productID)
$('#task').chosen();
loadProductBranches(productID)
loadProductModules(productID);
loadProductExecutions(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
loadProductplans(productID);
loadProductStories(productID);
@@ -75,7 +75,7 @@ function loadBranch()
$('#task').chosen();
productID = $('#product').val();
loadProductModules(productID);
loadProductExecutions(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
loadProductplans(productID);
loadProductStories(productID);
@@ -232,19 +232,42 @@ function loadProductStories(productID)
}
/**
* Load executions of product.
* Load projects of product.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductExecutions(productID)
function loadProductProjects(productID)
{
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&branch=' + branch + '&projectID=' + oldProjectID);
$('#projectBox').load(link, function()
{
$(this).find('select').chosen();
var projectID = $('#project').find("option:selected").val();
loadProductExecutions(productID, projectID);
});
}
/**
* Load executions of product.
*
* @param int $productID
* @param int $projectID
* @access public
* @return void
*/
function loadProductExecutions(productID, projectID = 0)
{
if(!projectID) projectID = $('#project').find("option:selected").val();
required = $('#execution_chosen').hasClass('required');
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&executionID=' + oldExecutionID + '&branch=' + branch);
link = createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&projectID=' + projectID + '&branch=' + branch);
$('#executionIdBox').load(link, function()
{
$(this).find('select').chosen();
+1 -1
View File
@@ -92,7 +92,7 @@ $(function()
var assignedto = $('#assignedTo').val();
changeProductConfirmed = true;
oldStoryID = $('#story').val() || 0;
oldExecutionID = 0;
oldExecutionID = 0;
oldOpenedBuild = '';
oldTaskID = $('#oldTaskID').val() || 0;
+1
View File
@@ -17,6 +17,7 @@ $lang->bug->branch = 'Branch/Platform';
$lang->bug->productplan = 'Plan';
$lang->bug->module = 'Modul';
$lang->bug->moduleAB = 'Modul';
$lang->bug->project = 'Project';
$lang->bug->execution = $lang->executionCommon;
$lang->bug->story = 'Story';
$lang->bug->storyVersion = 'Story Version';
+1
View File
@@ -17,6 +17,7 @@ $lang->bug->branch = 'Branch/Platform';
$lang->bug->productplan = 'Plan';
$lang->bug->module = 'Module';
$lang->bug->moduleAB = 'Module';
$lang->bug->project = 'Project';
$lang->bug->execution = $lang->executionCommon;
$lang->bug->story = 'Story';
$lang->bug->storyVersion = 'Story Version';
+1
View File
@@ -17,6 +17,7 @@ $lang->bug->branch = 'Branche/Plateforme';
$lang->bug->productplan = 'Plan';
$lang->bug->module = 'Module';
$lang->bug->moduleAB = 'Module';
$lang->bug->project = 'Project';
$lang->bug->execution = $lang->executionCommon;
$lang->bug->story = 'Story';
$lang->bug->storyVersion = 'Version Story';
+1
View File
@@ -17,6 +17,7 @@ $lang->bug->branch = 'Branch/Platform';
$lang->bug->productplan = 'Kế hoạch';
$lang->bug->module = 'Module';
$lang->bug->moduleAB = 'Module';
$lang->bug->project = 'Project';
$lang->bug->execution = $lang->executionCommon;
$lang->bug->story = 'Câu chuyện';
$lang->bug->storyVersion = 'Phiên bản câu chuyện';
+1
View File
@@ -17,6 +17,7 @@ $lang->bug->branch = '分支/平台';
$lang->bug->productplan = '所属' . '计划';
$lang->bug->module = '所属模块';
$lang->bug->moduleAB = '模块';
$lang->bug->project = '所属项目';
$lang->bug->execution = '所属' . $lang->executionCommon;
$lang->bug->story = "相关{$lang->SRCommon}";
$lang->bug->storyVersion = "{$lang->SRCommon}版本";
+10 -1
View File
@@ -23,6 +23,7 @@ js::set('flow', $config->global->flow);
js::set('stepsRequired', $stepsRequired);
js::set('stepsNotEmpty', $lang->bug->stepsNotEmpty);
js::set('isStepsTemplate', $isStepsTemplate);
js::set('oldProjectID', $projectID);
?>
<div id="mainContent" class="main-content fade">
<div class="center-block">
@@ -91,7 +92,15 @@ js::set('isStepsTemplate', $isStepsTemplate);
</td>
<?php endif;?>
<?php if($showExecution):?>
<td><span id='executionIdBox'><?php echo html::select('execution', $executions, $executionID, "class='form-control chosen' onchange='loadExecutionRelated(this.value)'");?></span></td>
<td>
<div class='table-row'>
<div class='table-col' id='projectBox'>
<?php echo html::select('project', $projects, $projectID, "class='form-control chosen'");?>
</div>
<div class='table-col' id='executionIdBox'>
<?php echo html::select('execution', $executions, $executionID, "class='form-control chosen' onchange='loadExecutionRelated(this.value)'");?>
</div>
</td>
<?php endif;?>
<td>
<div class='input-group' id='buildBox'>
+17
View File
@@ -837,6 +837,23 @@ class product extends control
$this->display();
}
/**
* AJAX: get projects of a product in html select.
*
* @param int $productID
* @param int $branch
* @param int $projectID
* @access public
* @return void
*/
public function ajaxGetProjects($productID, $branch = 0, $projectID = 0)
{
$projects = $this->product->getProjectPairsByProduct($productID, $branch ? "0,$branch" : $branch);
if($this->app->getViewType() == 'json') die(json_encode($peojects));
die(html::select('project', $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID})'"));
}
/**
* AJAX: get executions of a product in html select.
*