* Finish task #44992, task #44991, task #44990.

This commit is contained in:
hufangzhou
2021-12-01 10:02:46 +08:00
parent 2fc250b9b2
commit c04947228f
5 changed files with 20 additions and 10 deletions
+3 -1
View File
@@ -204,6 +204,7 @@ function loadProductModules(productID)
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
if(typeof(moduleID) == 'undefined') moduleID = 0;
if(config.currentMethod == 'edit') moduleID = $('#module').val();
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + moduleID);
$('#moduleIdBox').load(link, function()
{
@@ -626,7 +627,8 @@ function notice()
*/
function setBranchRelated(branchID, productID, num)
{
moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=bug&branch=' + branchID + '&num=' + num);
var currentModuleID = config.currentMethod == 'batchedit' ? $('#modules' + num).val() : 0;
moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=bug&branch=' + branchID + '&num=' + num + '&currentModuleID=' + currentModuleID);
$.get(moduleLink, function(modules)
{
if(!modules) modules = '<select id="modules' + num + '" name="modules[' + num + ']" class="form-control"></select>';
+2 -1
View File
@@ -30,7 +30,8 @@ function loadBranches(product, branch, storyID)
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID);
var currentModuleID = $('#modules' + storyID).val();
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + storyID + '&needManage=false&extra=&currentModuleID=' + currentModuleID);
$('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();});
planID = $('#plans' + storyID).val();
+2 -1
View File
@@ -30,7 +30,8 @@ function loadBranches(product, branch, caseID)
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID);
var currentModuleID = $('#modules' + caseID).val();
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + product + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + caseID + '&needManage=false&extra=&currentModuleID=' + currentModuleID);
$('#modules' + caseID).parent('td').load(moduleLink, function()
{
$("#modules" + caseID).attr('onchange', "loadStories("+ product + ", this.value, " + caseID + ")").chosen();
+2 -1
View File
@@ -84,7 +84,8 @@ function loadProductModules(productID, branch)
{
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');
var currentModuleID = config.currentMethod == 'edit' ? $('#module').val() : 0;
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + currentModuleID);
$('#moduleIdBox').load(link, function()
{
var $inputGroup = $(this);
+11 -6
View File
@@ -443,8 +443,6 @@ class tree extends control
*/
public function ajaxGetOptionMenu($rootID, $viewType = 'story', $branch = 0, $rootModuleID = 0, $returnType = 'html', $fieldID = '', $needManage = false, $extra = '', $currentModuleID = 0)
{
$currentModule = $this->tree->getById($currentModuleID);
if($viewType == 'task')
{
$optionMenu = $this->tree->getTaskOptionMenu($rootID, 0, 0, $extra);
@@ -468,8 +466,11 @@ class tree extends control
{
$changeFunc = '';
if($viewType == 'task' or $viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'";
$field = $fieldID ? "modules[$fieldID]" : 'module';
$currentModuleID = $currentModule->branch == 0 ? $currentModuleID : 0;
$field = $fieldID ? "modules[$fieldID]" : 'module';
$currentModule = $this->tree->getById($currentModuleID);
$currentModuleID = (isset($currentModule->branch) and $currentModule->branch == 0) ? $currentModuleID : 0;
$output = html::select("$field", $optionMenu, $currentModuleID, "class='form-control' $changeFunc");
if(count($optionMenu) == 1 and $needManage)
{
@@ -532,16 +533,20 @@ class tree extends control
* @param string $viewType
* @param int $branchID
* @param int $number
* @param int $currentModuleID
* @access public
* @return string the html select string.
*/
public function ajaxGetModules($productID, $viewType = 'story', $branchID, $number)
public function ajaxGetModules($productID, $viewType = 'story', $branchID, $number, $currentModuleID = 0)
{
$currentModule = $this->tree->getById($currentModuleID);
$currentModuleID = (isset($currentModule->branch) and $currentModule->branch == 0) ? $currentModuleID : 0;
$modules = $this->tree->getOptionMenu($productID, $viewType, $startModuleID = 0, $branchID);
$moduleName = $viewType == 'bug' ? "modules[$number]" : "module[$number]";
$modules = empty($modules) ? array('' => '') : $modules;
die(html::select($moduleName, $modules, '', 'class=form-control'));
die(html::select($moduleName, $modules, $currentModuleID, 'class=form-control'));
}
/**