* code for task#1592.

This commit is contained in:
xia0ta0
2013-07-23 16:40:59 +08:00
parent 0e8c1ffe05
commit b56e48890f
4 changed files with 36 additions and 6 deletions

View File

@@ -785,10 +785,11 @@ 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)
{
@@ -796,7 +797,11 @@ class story extends control
$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);
}
/**

View File

@@ -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);

View File

@@ -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");
});
});
}
});

View File

@@ -13,6 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/chosen.html.php';?>
<?php js::set('testcaseBatchCreateNum', $config->testcase->batchCreate);?>
<?php js::set('productID', $productID);?>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table align='center' class='table-1 fixed'>
<caption><?php echo $lang->testcase->batchCreate;?></caption>
@@ -32,7 +33,7 @@
<td><?php echo $i+1;?></td>
<td><?php echo html::select("module[$i]", $moduleOptionMenu, $currentModuleID, "class=select-1");?></td>
<td><?php echo html::select("type[$i]", $lang->testcase->typeList, $type, "class=select-1");?></td>
<td class='a-left'style='overflow:visible'><?php echo html::select("story[$i]", $stories, $story, 'class=select-1');?></td>
<td class='a-left'style='overflow:visible'><?php echo html::select("story[$i]", '', $story, 'class="select-1 storySelect"');?></td>
<td><?php echo html::input("title[$i]", '', "class='text-1'");?></td>
</tr>
<?php endfor;?>