* fix bug : ajdust module related.
This commit is contained in:
@@ -20,23 +20,3 @@ $(function()
|
||||
$("#story").chosen({no_results_text: noResultsMatch});
|
||||
$("#preview").colorbox({width:960, height:550, iframe:true, transition:'none', scrolling:true});
|
||||
})
|
||||
|
||||
/**
|
||||
* Set story field.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setStories()
|
||||
{
|
||||
moduleID = $('#module').val();
|
||||
productID = $('#product').val();
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&moduleID=' + moduleID);
|
||||
$.get(link, function(stories)
|
||||
{
|
||||
if(!stories) stories = '<select id="story" name="story"></select>';
|
||||
$('#story').replaceWith(stories);
|
||||
$('#story_chzn').remove();
|
||||
$("#story").chosen({no_results_text: ''});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include './header.html.php';?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/form.html.php';?>
|
||||
<?php include '../../common/view/chosen.html.php';?>
|
||||
<form method='post' enctype='multipart/form-data' id='dataform' class='ajaxForm'>
|
||||
@@ -22,7 +22,7 @@
|
||||
<?php echo html::select('product', $products, $productID, "onchange=loadAll(this.value); class='select-3'");?>
|
||||
<span id='moduleIdBox'>
|
||||
<?php
|
||||
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=setStories();");
|
||||
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange=loadModuleRelated();");
|
||||
if(count($moduleOptionMenu) == 1)
|
||||
{
|
||||
echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=case"), $lang->tree->manage, '_blank');
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include './header.html.php';?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/chosen.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
|
||||
@@ -82,7 +82,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='rowhead'><?php echo $lang->testcase->module;?></td>
|
||||
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "class='select-1'");?></span></td>
|
||||
<td><span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange='loadModuleRelated()' class='select-1'");?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='rowhead'><?php echo $lang->testcase->story;?></td>
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<style>
|
||||
#story {width:90%}
|
||||
.delbutton{font-size:12px; color:red; width:80px; padding:0}
|
||||
.addbutton{font-size:12px; color:darkgreen; width:80px; padding:0}
|
||||
</style>
|
||||
<script language='Javascript'>
|
||||
var newRowID = 0;
|
||||
/**
|
||||
* Load modules and stories of a product.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadAll(productID)
|
||||
{
|
||||
loadProductModules(productID);
|
||||
loadStory(productID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load module.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadProductModules(productID)
|
||||
{
|
||||
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&rootModuleID=0&returnType=html&needManage=true');
|
||||
$('#moduleIdBox').load(link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load stories.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadStory(productID)
|
||||
{
|
||||
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
|
||||
$('#storyIdBox').load(link, function(){$('#story').chosen({no_results_text: noResultsMatch});});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a step row.
|
||||
*
|
||||
* @param int $rowID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function deleteRow(rowID)
|
||||
{
|
||||
if($('.stepID').size() == 1) return;
|
||||
$('#row' + rowID).remove();
|
||||
updateStepID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert before the step.
|
||||
*
|
||||
* @param int $rowID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function preInsert(rowID)
|
||||
{
|
||||
$('#row' + rowID).before(createRow());
|
||||
updateStepID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert after the step.
|
||||
*
|
||||
* @param int $rowID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function postInsert(rowID)
|
||||
{
|
||||
$('#row' + rowID).after(createRow());
|
||||
updateStepID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a step row.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function createRow()
|
||||
{
|
||||
if(newRowID == 0) newRowID = $('.stepID').size();
|
||||
newRowID ++;
|
||||
var lblDelete = '<?php echo $lang->testcase->deleteStep;?>';
|
||||
var lblBefore = '<?php echo $lang->testcase->insertBefore;?>';
|
||||
var lblAfter = '<?php echo $lang->testcase->insertAfter;?>';
|
||||
var newRow = "<tr class='a-center' id='row" + newRowID + "'>";
|
||||
newRow += "<th class='stepID'></th>";
|
||||
newRow += "<td class='w-p50'><textarea name='steps[]' rows=3 class='w-p100'></textarea></td>";
|
||||
newRow += "<td><textarea name='expects[]' rows=3 class='w-p100'></textarea></td>";
|
||||
newRow += "<td class='a-left w-100px'><nobr>";
|
||||
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblBefore + "' onclick='preInsert(" + newRowID + ")' /><br />";
|
||||
newRow += "<input type='button' tabindex='-1' class='addbutton' value='" + lblAfter + "' onclick='postInsert(" + newRowID + ")' /><br />";
|
||||
newRow += "<input type='button' tabindex='-1' class='delbutton' value='" + lblDelete + "' onclick='deleteRow(" + newRowID + ")' /><br />";
|
||||
newRow += "</nobr></td>";
|
||||
return newRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the step id.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function updateStepID()
|
||||
{
|
||||
var i = 1;
|
||||
$('.stepID').each(function(){$(this).html(i ++)});
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user