* Finish task #44987,44988,44989.

This commit is contained in:
mayue
2021-12-01 10:44:38 +08:00
parent fc591306b5
commit c62d599292
8 changed files with 64 additions and 47 deletions

View File

@@ -510,4 +510,39 @@ class branchModel extends model
return $branches;
}
/**
* Display of branch label.
*
* @param int $productID
* @param int $moduleID
* @param int $executionID
* @access public
* @return bool
*/
public function isShowBranch($productID, $moduleID = 0, $executionID = 0)
{
$this->loadModel('product');
if(empty($productID) and empty($moduleID))
{
$productPairs = $this->product->getProductPairsByProject($executionID);
$productID = count($productPairs) == 1 ? key($productPairs) : 0;
}
elseif(empty($productID) and !empty($moduleID))
{
$module = $this->loadModel('tree')->getById($moduleID);
$productID = $module->type != 'task' ? $module->root : 0;
}
$product = $productID ? $this->product->getById($productID) : '';
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
return true;
}
return false;
}
}

View File

@@ -202,13 +202,10 @@ class bug extends control
$showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : '';
$productName = ($productID and isset($this->products[$productID])) ? $this->products[$productID] : $this->lang->product->allProduct;
$product = $this->product->getById($productID);
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Display of branch label. */
$isShowBranch = $this->loadModel('branch')->isShowBranch($productID);
/* Set view. */
$this->view->title = $productName . $this->lang->colon . $this->lang->bug->common;
@@ -240,6 +237,7 @@ class bug extends control
$this->view->setModule = true;
$this->view->isProjectBug = ($productID and !$this->projectID) ? false : true;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array();
$this->view->isShowBranch = $isShowBranch;
$this->display();
}

View File

@@ -9,7 +9,7 @@
$(function()
{
<?php if(!empty($setModule)):?>
$('#sidebar .cell .text-center:last').append("<a href='#showModuleModal' data-toggle='modal' class='btn btn-info btn-wide'><?php echo ($app->tab == 'product' or $app->tab == 'qa') ? $lang->datatable->displaySetting : $lang->datatable->moduleSetting;?></a><hr class='space-sm' />");
$('#sidebar .cell .text-center:last').append("<a href='#showModuleModal' data-toggle='modal' class='btn btn-info btn-wide'><?php echo $lang->datatable->displaySetting;?></a><hr class='space-sm' />");
<?php endif;?>
var addSettingButton = function()
@@ -89,7 +89,7 @@ $(function()
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><i class="icon-cog-outline"></i> <?php echo ($app->tab == 'product' or $app->tab == 'qa') ? $lang->datatable->displaySetting : $lang->datatable->moduleSetting;?></h4>
<h4 class="modal-title"><i class="icon-cog-outline"></i> <?php echo $lang->datatable->displaySetting;?></h4>
</div>
<div class="modal-body">
<form class='form-condensed' method='post' target='hiddenwin' action='<?php echo $this->createLink('datatable', 'ajaxSave')?>'>
@@ -104,7 +104,7 @@ $(function()
<td><?php echo html::radio('showAllModule', $lang->datatable->showAllModuleList, isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0);?></td>
</tr>
<?php endif;?>
<?php if(!empty($product) and $product->type != 'normal'):?>
<?php if($isShowBranch):?>
<tr>
<td><?php echo $lang->datatable->showBranch;?></td>
<td><?php echo html::radio('showBranch', $lang->datatable->showBranchList, isset($config->$currentModule->$currentMethod->showBranch) ? $config->$currentModule->$currentMethod->showBranch : 1);?></td>

View File

@@ -219,17 +219,10 @@ class execution extends control
}
/* Get product. */
if(empty($productID))
{
$productModule = $this->tree->getById($moduleID);
if(!empty($productModule) and $productModule->type != 'task') $product = $this->product->getById($productModule->root);
}
if(empty($product)) $product = $this->product->getById($productID);
$product = $this->product->getById($productID);
if(!empty($product) and $product->type != 'normal')
{
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Display of branch label. */
$isShowBranch = $this->loadModel('branch')->isShowBranch($productID, $moduleID, $executionID);
/* Build the search form. */
$actionURL = $this->createLink('execution', 'task', "executionID=$executionID&status=bySearch&param=myQueryID");
@@ -268,6 +261,7 @@ class execution extends control
$this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty');
$this->view->setModule = true;
$this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->view->isShowBranch = $isShowBranch;
$this->display();
}
@@ -795,22 +789,8 @@ class execution extends control
foreach($plans as $plan) $allPlans += $plan;
}
if($this->cookie->storyModuleParam)
{
$module = $this->loadModel('tree')->getById($this->cookie->storyModuleParam);
$this->view->module = $module;
$product = $this->product->getById($module->root);
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
if($this->cookie->storyProductParam)
{
$product = $this->loadModel('product')->getById($this->cookie->storyProductParam);
$this->view->product = $product;
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
if($this->cookie->storyModuleParam) $this->view->module = $this->loadModel('tree')->getById($this->cookie->storyModuleParam);
if($this->cookie->storyProductParam) $this->view->product = $this->loadModel('product')->getById($this->cookie->storyProductParam);
if($this->cookie->storyBranchParam)
{
$branchID = $this->cookie->storyBranchParam;
@@ -818,6 +798,9 @@ class execution extends control
$this->view->branch = $this->loadModel('branch')->getById($branchID, $productID);
}
/* Display of branch label. */
$isShowBranch = $this->loadModel('branch')->isShowBranch($this->cookie->storyProductParam, $this->cookie->storyModuleParam, $executionID);
/* Get execution's product. */
$productPairs = $this->loadModel('product')->getProductPairsByProject($executionID);
@@ -848,6 +831,7 @@ class execution extends control
$this->view->setModule = true;
$this->view->branchGroups = $branchGroups;
$this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->view->isShowBranch = $isShowBranch;
$this->display();
}

View File

@@ -221,7 +221,7 @@
<td class='c-pri'><span class='label-pri <?php echo 'label-pri-' . $story->pri?>' title='<?php echo zget($lang->story->priList, $story->pri, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri);?></span></td>
<td class='c-name' title="<?php echo $story->title?>">
<?php $showBranch = isset($this->config->execution->story->showBranch) ? $this->config->execution->story->showBranch : 1;?>
<?php if(isset($branchGroups[$story->product][$story->branch]) and $showBranch) echo "<span class='label label-outline label-badge'>" . $branchGroups[$story->product][$story->branch] . '</span>';?>
<?php if($isShowBranch and isset($branchGroups[$story->product][$story->branch]) and $showBranch) echo "<span class='label label-outline label-badge'>" . $branchGroups[$story->product][$story->branch] . '</span>';?>
<?php if(!empty($story->module) and isset($modulePairs[$story->module])) echo "<span class='label label-gray label-badge'>{$modulePairs[$story->module]}</span> ";?>
<?php if($story->parent > 0) echo "<span class='label'>{$lang->story->childrenAB}</span>";?>
<?php echo html::a($storyLink,$story->title, null, "style='color: $story->color' data-app='execution'");?>

View File

@@ -211,16 +211,16 @@ class product extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Display of branch label. */
$isShowBranch = $this->loadModel('branch')->isShowBranch($productID);
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Get stories and branches. */
if($this->app->rawModule == 'projectstory')
{
$isShowBranch = $this->loadModel('branch')->isShowBranch($productID, 0, $projectID);
$branches = array();
if(!empty($product))
{
@@ -309,6 +309,7 @@ class product extends control
$this->view->branch = $branch;
$this->view->branchID = $branchID;
$this->view->branches = $branches;
$this->view->isShowBranch = $isShowBranch;
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
$this->view->setModule = true;
$this->view->storyTasks = $storyTasks;

View File

@@ -3072,7 +3072,7 @@ class taskModel extends model
case 'name':
$showBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1;
if($task->parent > 0 and isset($task->parentName)) $task->name = "{$task->parentName} / {$task->name}";
if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $showBranch) echo "<span class='label label-info label-outline'>" . $branchGroups[$task->product][$task->branch] . '</span> ';
if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $showBranch) echo "<span class='label label-badge label-outline'>" . $branchGroups[$task->product][$task->branch] . '</span> ';
if($task->module and isset($modulePairs[$task->module])) echo "<span class='label label-gray label-badge'>" . $modulePairs[$task->module] . '</span> ';
if($task->parent > 0) echo '<span class="label label-badge label-light" title="' . $this->lang->task->children . '">' . $this->lang->task->childrenAB . '</span> ';
if(!empty($task->team)) echo '<span class="label label-badge label-light" title="' . $this->lang->task->multiple . '">' . $this->lang->task->multipleAB . '</span> ';

View File

@@ -186,12 +186,10 @@ class testcase extends control
$moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('projectID' => $projectID, 'productID' => $productID), $projectID ? '' : $branch);
}
/* Display of branch label. */
$isShowBranch = $this->loadModel('branch')->isShowBranch($productID);
$product = $this->product->getById($productID);
if($product and $product->type != 'normal')
{
$this->app->loadLang('datatable');
$this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]);
}
/* Assign. */
$tree = $moduleID ? $this->tree->getByID($moduleID) : '';
@@ -220,6 +218,7 @@ class testcase extends control
$this->view->suiteID = $suiteID;
$this->view->setModule = true;
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
$this->view->isShowBranch = $isShowBranch;
$this->display();
}