Merge branch 'sprint/174_xieqiyu_45080'

This commit is contained in:
liyuchun
2021-11-30 15:45:11 +08:00
9 changed files with 86 additions and 50 deletions
+6 -6
View File
@@ -55,12 +55,6 @@ function loadAll(productID)
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
$('#task').chosen();
loadProductBranches(productID)
loadProductModules(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
loadProductplans(productID);
loadProductStories(productID);
//loadTestTasks(productID);
}
}
@@ -502,6 +496,12 @@ function loadProductBranches(productID)
$('#branch').css('width', page == 'create' ? '120px' : '65px');
$('#branch').chosen();
}
loadProductModules(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
loadProductplans(productID);
loadProductStories(productID);
})
}
+21 -17
View File
@@ -448,13 +448,25 @@ class story extends control
}
}
/* Set products and module. */
/* Set branch and module. */
$product = $this->product->getById($productID);
$products = $this->product->getPairs();
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch === 'all' ? 0 : $branch);
if($product) $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
if($executionID != 0)
{
$productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $executionID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
$branch = key($branches);
}
else
{
$branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch === 'all' ? 0 : $branch);
$moduleOptionMenu['ditto'] = $this->lang->story->ditto;
/* Get reviewers. */
$reviewers = $product->reviewer;
if(!$reviewers) $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '');
@@ -478,8 +490,6 @@ class story extends control
$this->view->titles = $titles;
}
$moduleOptionMenu['ditto'] = $this->lang->story->ditto;
$plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch === 'all' ? 0 : $branch, 'skipParent|unexpired');
$plans['ditto'] = $this->lang->story->ditto;
@@ -518,16 +528,6 @@ class story extends control
$showFields = str_replace('plan', '', $showFields);
}
if($executionID != 0)
{
$productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $executionID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
}
else
{
$branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
$this->view->customFields = $customFields;
$this->view->showFields = $showFields;
@@ -647,6 +647,7 @@ class story extends control
if($product->status == 'normal' and !($product->PO == $this->app->user->account)) $othersProducts[$product->id] = $product->name;
if($product->status == 'closed') continue;
}
$products = $myProducts + $othersProducts;
/* Assign. */
$story = $this->story->getById($storyID, 0, true);
@@ -668,9 +669,12 @@ class story extends control
if($this->app->tab == 'project' or $this->app->tab == 'execution')
{
$objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
$objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
$productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($story->product, $objectID) : array();
$branches = isset($productBranches[$story->product]) ? $productBranches[$story->product] : array();
$products = $this->product->getProductPairsByProject($objectID);
$this->view->objectID = $objectID;
}
else
{
@@ -690,7 +694,7 @@ class story extends control
$this->view->users = $users;
$this->view->product = $product;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch, 'skipParent');
$this->view->products = $myProducts + $othersProducts;
$this->view->products = $products;
$this->view->branches = $branches;
$this->view->reviewers = implode(',', $reviewerList);
$this->view->reviewedReviewer = $reviewedReviewer;
+1
View File
@@ -287,4 +287,5 @@
</form>
</div>
<?php js::set('storyType', $story->type);?>
<?php js::set('executionID', isset($objectID) ? $objectID : 0);?>
<?php include '../../common/view/footer.html.php';?>
+5 -6
View File
@@ -33,11 +33,7 @@ function loadProduct(productID)
}
oldProductID = $('#product').val();
loadProductBranches(productID)
loadProductModules(productID);
loadProductPlans(productID);
loadProductReviewers(productID);
}
/**
@@ -65,7 +61,7 @@ function loadProductBranches(productID)
{
$('#branch').remove();
$('#branch_chosen').remove();
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0&param=&projectID=" + executionID), function(data)
{
var $product = $('#product');
var $inputGroup = $product.closest('.input-group');
@@ -76,6 +72,9 @@ function loadProductBranches(productID)
$('#branch').css('width', config.currentMethod == 'create' ? '120px' : '65px').chosen();
}
$inputGroup.fixInputGroup();
loadProductModules(productID, $('#branch').val());
loadProductPlans(productID, $('#branch').val());
})
}
@@ -89,7 +88,7 @@ function loadProductBranches(productID)
*/
function loadProductModules(productID, branch)
{
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(branch) == 'undefined') branch = $('#branch').val();
if(!branch) branch = 0;
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
var $moduleIDBox = $('#moduleIdBox');
+14 -12
View File
@@ -371,6 +371,20 @@ class testcase extends control
$this->qa->setMenu($this->products, $productID, $branch);
}
/* Set branch. */
$product = $this->product->getById($productID);
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $projectID : $executionID;
$productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
$branch = key($branches);
}
else
{
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
/* Init vars. */
$type = 'feature';
$stage = '';
@@ -456,18 +470,6 @@ class testcase extends control
/* Set custom. */
foreach(explode(',', $this->config->testcase->customCreateFields) as $field) $customFields[$field] = $this->lang->testcase->$field;
$product = $this->product->getById($productID);
if($this->app->tab == 'execution' or $this->app->tab == 'project')
{
$objectID = $this->app->tab == 'project' ? $projectID : $executionID;
$productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array();
$branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
$branch = key($branches);
}
else
{
$branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
}
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->testcase->custom->createFields;
+5 -4
View File
@@ -22,8 +22,6 @@ var newRowID = 0;
function loadAll(productID)
{
loadProductBranches(productID)
loadProductModules(productID);
setStories();
}
/**
@@ -58,6 +56,9 @@ function loadProductBranches(productID)
$('#product').closest('.input-group').append(data);
$('#branch').css('width', config.currentMethod == 'create' ? '120px' : '95px');
}
loadProductModules(productID);
setStories();
})
}
@@ -81,7 +82,7 @@ function loadModuleRelated()
*/
function loadProductModules(productID, branch)
{
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(branch) == 'undefined') branch = $('#branch').val();
if(!branch) branch = 0;
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
$('#moduleIdBox').load(link, function()
@@ -126,7 +127,7 @@ function setStories()
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=' + executionID);
$.get(link, function(stories)
{
var value = $('#story').val();
+30 -1
View File
@@ -22,8 +22,37 @@ $(function()
});
})
/**
* Reload.
*
* @param int $libID
* @access public
* @return void
*/
function reload(libID)
{
{
link = createLink('testcase','importFromLib','productID='+ productID + '&branch=' + branch + '&libID='+libID);
location.href = link;
}
/**
* Load modules.
*
* @param int $productID
* @param int $branch
* @param int $caseID
* @access public
* @return void
*/
function loadModules(productID, branch, caseID)
{
if(typeof(branch) == 'undefined') branch = 0;
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
var $tr = $('#module' + caseID).closest('tr');
$('#module' + caseID).parent('td').load(moduleLink, function(data)
{
$tr.find('#module').chosen();
$tr.find('#module').attr({"id": 'module' + caseID, "name": 'module[' + caseID + ']'});
});
}
+3 -3
View File
@@ -69,10 +69,10 @@
<?php
if(!isset($cases[$caseID])) continue;
$caseBranch = isset($cases[$caseID]->branch) ? $cases[$caseID]->branch : 0;
if((!$productID and !$cases[$caseID]->lib) or $app->tab != 'qa')
if(!$productID and !$cases[$caseID]->lib)
{
$caseProductID = $cases[$caseID]->product;
$product = isset($product) ? $product : $products[$caseProductID];
$product = $products[$caseProductID];
$branches = isset($branches) ? $branches : array('' => '');
if($product->type != 'normal')
{
@@ -103,7 +103,7 @@
<td class='text-left' style='overflow:visible'>
<?php $branchProductID = $productID ? $productID : $product->id;?>
<?php $disabled = (isset($product) and $product->type == 'normal') ? "disabled='disabled'" : '';?>
<?php echo html::select("branches[$caseID]", $branches, $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?>
<?php echo html::select("branches[$caseID]", array('' => '') + $branches, $product->type == 'normal' ? '' : $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?>
</td>
<?php endif;?>
<?php $caseProductID = isset($caseProductID) ? $caseProductID : $productID;?>
+1 -1
View File
@@ -55,7 +55,7 @@
<?php printf('%03d', $case->id);?>
</td>
<?php if($product->type != 'normal'):?>
<td><?php echo html::select("branch[{$case->id}]", $branches, $branch, "class='form-control'")?></td>
<td><?php echo html::select("branch[{$case->id}]", $branches, $branch, "class='form-control' onchange='loadModules($productID, this.value, $case->id)'")?></td>
<?php endif;?>
<td><span class='label-pri <?php echo 'label-pri-' . $case->pri;?>' title='<?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?>'><?php echo $case->pri == '0' ? '' : zget($lang->testcase->priList, $case->pri, $case->pri);?></span></td>
<td class='text-left nobr'><?php if(!common::printLink('testcase', 'view', "caseID=$case->id", $case->title)) echo $case->title;?></td>