From b56e48890f3f2f5690e2ec80112d31fd6bbdf0e5 Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Tue, 23 Jul 2013 16:40:59 +0800 Subject: [PATCH] * code for task#1592. --- module/story/control.php | 11 +++++++--- module/task/js/create.js | 1 + module/testcase/js/batchcreate.js | 25 ++++++++++++++++++++++- module/testcase/view/batchcreate.html.php | 5 +++-- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 78bf042eb2..1a8600bbc6 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -785,18 +785,23 @@ class story extends control * @param int $productID * @param int $moduleID * @param int $storyID + * @param string $onlyOption * @access public * @return void */ - public function ajaxGetProductStories($productID, $moduleID = 0, $storyID = 0) + public function ajaxGetProductStories($productID, $moduleID = 0, $storyID = 0, $onlyOption = 'false') { - if($moduleID) + if($moduleID) { $moduleID = $this->loadModel('tree')->getStoryModule($moduleID); $moduleID = $this->tree->getAllChildID($moduleID); } $stories = $this->story->getProductStoryPairs($productID, $moduleID); - die(html::select('story', $stories, $storyID, "class=''")); + $select = html::select('story' . $index, $stories, $storyID, "class=''"); + + /* If only need options, remove select wrap. */ + if($onlyOption == 'true') die(substr($select, strpos($select, '>') + 1, -10)); + die($select); } /** diff --git a/module/task/js/create.js b/module/task/js/create.js index f0fe84f665..253c8f1add 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -69,6 +69,7 @@ function setAfter() } } +/* Get select of stories.*/ function setStories(moduleID, projectID, productID) { link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + productID + '&moduleID=' + moduleID); diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index 082e595fde..68992389bd 100755 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -1,4 +1,27 @@ $(document).ready(function() { - for(i = 0; i < testcaseBatchCreateNum; i++) $("#story" + i).chosen({no_results_text: noResultsMatch}); + for(var i = 0; i < testcaseBatchCreateNum; i++) + { + $("#story" + i).chosen({no_results_text: noResultsMatch}).bind('liszt:showing_dropdown', function() + { + index = $(this).attr('id').substring(5); + module = $('#module' + index).val(); + if(module == 'same') + { + for(var i = index - 1; i >=0; i--) + { + if($('#module' + i).val() != 'same') + { + module = $('#module' + i).val(); + break; + } + } + } + link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + module + '&storyID=0&onlyOption=true'); + $(this).load(link, function() + { + $('#story' + index).trigger("liszt:updated"); + }); + }); + } }); diff --git a/module/testcase/view/batchcreate.html.php b/module/testcase/view/batchcreate.html.php index 93600073d6..65aff6f447 100644 --- a/module/testcase/view/batchcreate.html.php +++ b/module/testcase/view/batchcreate.html.php @@ -13,6 +13,7 @@ testcase->batchCreate);?> +
@@ -32,9 +33,9 @@ - + - +
testcase->batchCreate;?>
testcase->typeList, $type, "class=select-1");?>