diff --git a/module/testcase/js/create.js b/module/testcase/js/create.js index 481f5fb464..9c790e2ddb 100644 --- a/module/testcase/js/create.js +++ b/module/testcase/js/create.js @@ -1,25 +1,3 @@ -/* Set the story priview link. */ -function setPreview() -{ - if($('#story').val() == 0) - { - $('#preview').addClass('hidden'); - } - else - { - storyLink = createLink('story', 'view', "storyID=" + $('#story').val()); - if(!isonlybody) - { - var concat = storyLink.indexOf('?') < 0 ? '?' : '&'; - storyLink = storyLink + concat + 'onlybody=yes'; - } - - $('#preview').addClass('iframe'); - $('#preview').removeClass('hidden'); - $('#preview').attr('href', storyLink); - } -} - $(function() { var $searchStories = $('#searchStories'); @@ -175,76 +153,3 @@ $(function() return false; }); }); - - -function loadAllNew(productID) -{ - loadProductBranchesNew(productID); -} - -function loadProductBranchesNew(productID) -{ - $('#branch').remove(); - - var param = page == 'create' ? 'active' : 'all'; - var oldBranch = page == 'edit' ? caseBranch : 0; - var param = "productID=" + productID + "&oldBranch=" + oldBranch + "¶m=" + param; - if(typeof(tab) != 'undefined' && (tab == 'execution' || tab == 'project')) param += "&projectID=" + objectID; - $.get(createLink('branch', 'ajaxGetBranches', param), function(data) - { - if(data) - { - $('#product').closest('.input-group').append(data); - $('#branch').css('width', config.currentMethod == 'create' ? '120px' : '95px'); - } - - loadProductModulesNew(productID); - setStories(); - }) -} - -function loadProductModulesNew(productID, branch) -{ - if(typeof(branch) == 'undefined') branch = $('#branch').val(); - if(!branch) branch = 0; - var currentModuleID = config.currentMethod == 'edit' ? $('#module').val() : 0; - link = createLink('testcase', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=¤tModuleID=' + currentModuleID); - $('#moduleIdBox').load(link, function() - { - var $inputGroup = $(this); - $inputGroup.find('select').chosen() - if(typeof(caseModule) == 'string') $('#moduleIdBox').prepend("" + caseModule + ""); - $inputGroup.fixInputGroup(); - }); - setScenes(); - setStories(); -} - -function setScenes() -{ - moduleID = $('#module').val(); - productID = $('#product').val(); - branch = $('#branch').val(); - if(typeof(branch) == 'undefined') branch = 0; - link = createLink('testcase', 'ajaxGetModuleScenes', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&stype=2&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1'); - - $('#sceneIdBox').load(link, function() - { - $(this).find('select').chosen() - }); -} - -function loadBranchNew() -{ - var branch = $('#branch').val(); - if(typeof(branch) == 'undefined') branch = 0; - loadProductModulesNew($('#product').val(), branch); - - setStories(); -} - -function loadModuleRelatedNew() -{ - setScenes(); - setStories(); -} diff --git a/module/testcase/js/edit.js b/module/testcase/js/edit.js index 8cce84d8fb..0a5fe239bf 100644 --- a/module/testcase/js/edit.js +++ b/module/testcase/js/edit.js @@ -1,18 +1,3 @@ -/** - * Get story list. - * - * @param string $module - * @access public - * @return void - */ -function getList() -{ - productID = $('#product').get(0).value; - storyID = $('#story').get(0).value; - link = createLink('search', 'select', 'productID=' + productID + '&projectID=0&module=story&moduleID=' + storyID); - $('#storyListIdBox a').attr("href", link); -} - $(document).ready(function() { /* Set secondary menu highlighting. */ @@ -39,127 +24,3 @@ $(document).ready(function() initSteps(); }); - -/** - * Load lib modules. - * - * @param int $libID - * @access public - * @return void - */ -function loadLibModules(libID) -{ - link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&fieldID=&needManage=true'); - $('#moduleIdBox').load(link, function() - { - $(this).find('select').chosen() - if(typeof(caseModule) == 'string') $('#moduleIdBox').prepend("" + caseModule + "") - }); -} - -/** - * Load by branch. - * - * @param int oldBranch - * @access public - * @return void - */ -function loadBranch(oldBranch) -{ - var branch = $('#branch').val(); - if(typeof(branch) == 'undefined') branch = 0; - - var result = true; - if(branch) - { - for(taskID in testtasks) - { - if(branch != oldBranch && testtasks[taskID]['branch'] != branch) - { - var tip = confirmUnlinkTesttask.replace("%s", caseID); - result = confirm(tip); - if(!result) $('#branch').val(oldBranch).trigger("chosen:updated"); - break; - } - } - } - - if(result) - { - loadProductModules($('#product').val(), branch); - setStories(); - } -} - -function loadAllNew(productID) -{ - loadProductBranchesNew(productID); -} - -function loadProductBranchesNew(productID) -{ - $('#branch').remove(); - - var param = page == 'create' ? 'active' : 'all'; - var oldBranch = page == 'edit' ? caseBranch : 0; - var param = "productID=" + productID + "&oldBranch=" + oldBranch + "¶m=" + param; - if(typeof(tab) != 'undefined' && (tab == 'execution' || tab == 'project')) param += "&projectID=" + objectID; - $.get(createLink('branch', 'ajaxGetBranches', param), function(data) - { - if(data) - { - $('#product').closest('.input-group').append(data); - $('#branch').css('width', config.currentMethod == 'create' ? '120px' : '95px'); - } - - loadProductModulesNew(productID); - setStories(); - }) -} - -function loadProductModulesNew(productID, branch) -{ - if(typeof(branch) == 'undefined') branch = $('#branch').val(); - if(!branch) branch = 0; - var currentModuleID = config.currentMethod == 'edit' ? $('#module').val() : 0; - link = createLink('testcase', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=¤tModuleID=' + currentModuleID); - $('#moduleIdBox').load(link, function() - { - var $inputGroup = $(this); - $inputGroup.find('select').chosen() - if(typeof(caseModule) == 'string') $('#moduleIdBox').prepend("" + caseModule + ""); - $inputGroup.fixInputGroup(); - }); - setScenes(); - setStories(); -} - -function setScenes() -{ - moduleID = $('#module').val(); - productID = $('#product').val(); - branch = $('#branch').val(); - if(typeof(branch) == 'undefined') branch = 0; - link = createLink('testcase', 'ajaxGetModuleScenes', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&stype=2&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1'); - - $('#sceneIdBox').load(link, function() - { - $(this).find('select').chosen() - }); -} - - -function loadBranchNew() -{ - var branch = $('#branch').val(); - if(typeof(branch) == 'undefined') branch = 0; - loadProductModulesNew($('#product').val(), branch); - - setStories(); -} - -function loadModuleRelatedNew() -{ - setScenes(); - setStories(); -}