@@ -99,7 +101,7 @@ printExtendFields($story, 'div', 'position=left');?> -
+
story->changeSyncTip;?> @@ -107,12 +109,8 @@
    - $sibling):?> -
  • - branch];?> - title;?> -
  • - + +
diff --git a/module/story/view/header.html.php b/module/story/view/header.html.php index 5d84b1a6b8..94df67a275 100644 --- a/module/story/view/header.html.php +++ b/module/story/view/header.html.php @@ -11,6 +11,17 @@ */ function loadProduct(productID) { + if(page == 'edit' && siblings && productID != oldProductID) + { + confirmRelievedSiblings = confirm(relievedSiblingsTip); + if(!confirmRelievedSiblings) + { + $('#product').val(oldProductID); + $('#product').trigger("chosen:updated"); + return false; + } + } + if(typeof parentStory != 'undefined' && parentStory) { confirmLoadProduct = confirm(moveChildrenTips); @@ -81,20 +92,79 @@ function loadProductBranches(productID) if(page == 'create') param = 'active'; $('#branch').remove(); $('#branch_chosen').remove(); - $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0¶m=" + param + "&projectID=" + executionID), function(data) - { - var $product = $('#product'); - var $inputGroup = $product.closest('.input-group'); - $inputGroup.find('.input-group-addon').toggleClass('hidden', !data); - if(data) - { - $inputGroup.append(data); - $('#branch').css('width', config.currentMethod == 'create' ? '120px' : '65px').chosen(); - } - $inputGroup.fixInputGroup(); - loadProductModules(productID, $('#branch').val()); - loadProductPlans(productID, $('#branch').val()); + var isSiblings = storyType == 'story' ? 'yes' : 'no'; + $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0¶m=" + param + "&projectID=" + executionID + "&withMainBranch=1&isSiblings=" + isSiblings), function(data) + { + if(storyType == 'story') + { + var newProductType = data ? 'normal' : 'branch'; + if(originProductType != newProductType) + { + $('.switchBranch').toggleClass('hidden'); + $('.switchBranch').toggleClass('disable'); + } + originProductType = newProductType; + + $('tr[class^="addBranchesBox"]').remove(); + + if(data) + { + gap = $('#product').closest('td').next().width(); + $('#planIdBox').css('flex', '0 0 ' + gap + 'px') + $.get(createLink('product', 'ajaxGetProductById', "productID=" + productID), function(data) + { + $('.switchBranch #branchBox .input-group .input-group-addon').html(data.branchSourceName) + $('.switchBranch #branchBox').closest('td').prev().html(data.branchName) + $.cookie('branchSourceName', data.branchSourceName) + }, 'json') + + /* reload branch */ + $('#branches0').replaceWith(data); + $('#branches0' + "_chosen").remove(); + $('#branches0').next('.picker').remove(); + $('#branches0').chosen(); + + $.get(createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=0' + '&rootModuleID=0&returnType=html&fieldID=0' + '&needManage=false&extra=¤tModuleID=0'), function(moduleData) + { + if(moduleData) + { + $('#modules0').replaceWith(moduleData); + $('#modules0' + "_chosen").remove(); + $('#modules0').next('.picker').remove(); + $('#modules0').chosen(); + } + }); + + var expired = config.currentMethod == 'create' ? 'unexpired' : ''; + $.get(createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=0' + '&planID=' + $('#plan').val() + '&fieldID=0' + '&needCreate=false&expired='+ expired +'¶m=skipParent,' + config.currentMethod), function(planData) + { + if(planData) + { + $('#plans0').replaceWith(planData); + $('#plans0' + "_chosen").remove(); + $('#plans0').next('.picker').remove(); + $('#plans0').chosen(); + } + }); + } + } + else + { + var $product = $('#product'); + var $inputGroup = $product.closest('.input-group'); + $inputGroup.find('.input-group-addon').toggleClass('hidden', !data); + if(data) + { + $inputGroup.append(data); + $('#branch').css('width', config.currentMethod == 'create' ? '120px' : '65px').chosen(); + } + $inputGroup.fixInputGroup(); + + loadProductModules(productID, $('#branch').val()); + loadProductPlans(productID, $('#branch').val()); + } + }) } diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index db46505375..18656c1c2e 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -401,27 +401,27 @@
- type != 'normal'):?> -
+ +
config->URAndSR):?> -
+
' id='legendStories'>
    type == 'story'):?> -
    +
      tasks as $executionTasks) diff --git a/module/tree/control.php b/module/tree/control.php index 49ac28269b..a4c8277215 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -538,13 +538,13 @@ class tree extends control $changeFunc = ''; if($viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelated()'"; if($viewType == 'task') $changeFunc = "onchange='setStories(this.value, $rootID)'"; - $field = $fieldID ? "modules[$fieldID]" : 'module'; + $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) + if(count($optionMenu) == 1 and $needManage !== 'false') { $output .= ""; $output .= html::a($this->createLink('tree', 'browse', "rootID=$rootID&view=$viewType¤tModuleID=0&branch=$branch", '', true), $this->lang->tree->manage, '', "class='text-primary' data-toggle='modal' data-type='iframe' data-width='95%'");