@@ -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=¤tModuleID=' + 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 + '¤tModuleID=' + currentModuleID);
|
||||
$.get(moduleLink, function(modules)
|
||||
{
|
||||
if(!modules) modules = '<select id="modules' + num + '" name="modules[' + num + ']" class="form-control"></select>';
|
||||
|
||||
@@ -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=¤tModuleID=' + currentModuleID);
|
||||
$('#modules' + storyID).parent('td').load(moduleLink, function(){$('#modules' + storyID).chosen();});
|
||||
|
||||
planID = $('#plans' + storyID).val();
|
||||
|
||||
@@ -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=¤tModuleID=' + currentModuleID);
|
||||
$('#modules' + caseID).parent('td').load(moduleLink, function()
|
||||
{
|
||||
$("#modules" + caseID).attr('onchange', "loadStories("+ product + ", this.value, " + caseID + ")").chosen();
|
||||
|
||||
@@ -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=¤tModuleID=' + currentModuleID);
|
||||
$('#moduleIdBox').load(link, function()
|
||||
{
|
||||
var $inputGroup = $(this);
|
||||
|
||||
+11
-6
@@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user