* Handling feedback#923.

This commit is contained in:
leiyong
2022-09-30 05:32:11 +00:00
parent 05046906ea
commit cf752602ab
2 changed files with 53 additions and 0 deletions
+32
View File
@@ -2461,6 +2461,38 @@ class story extends control
echo json_encode($storyInfo);
}
/**
* AJAX: get the user requirements of the product.
*
* @param int $productID
* @param string $labelName
* @param bool $isMultiple
* @param int $defaultID
* @access public
* @return string
*/
public function ajaxGetProductURS($productID, $labelName = '', $isMultiple = false, $defaultID = '')
{
$requirements = array('0' => '') + $this->story->getRequirements($productID);
$labelName = $isMultiple ? $labelName . '[]' : $labelName;
$misc = $isMultiple ? 'class="form-control" multiple' : 'class="form-control"';
return print(html::select($labelName, $requirements, $defaultID, $misc));
}
/**
* AJAX: get the parent story.
*
* @param int $productID
* @param string $labelName
* @access public
* @return string
*/
public function ajaxGetParentStory($productID, $labelName = '')
{
$stories = $this->story->getParentStoryPairs($productID);
return print(html::select($labelName, $stories, 0, 'class="form-control"'));
}
/**
* The report page.
*
+21
View File
@@ -36,6 +36,27 @@ function loadProduct(productID)
oldProductID = $('#product').val();
loadProductBranches(productID);
loadProductReviewers(productID);
if(typeof(storyType) == 'string' && storyType == 'story')
{
var requirementLink = createLink('story', 'ajaxGetProductURS', 'productID=' + productID + '&labelName=URS' + '&isMultiple=1');
$.get(requirementLink, function(data)
{
$('#URS').replaceWith(data);
$('#URS' + "_chosen").remove();
$('#URS').next('.picker').remove();
$('#URS').chosen();
});
var storyLink = createLink('story', 'ajaxGetParentStory', 'productID=' + productID + '&labelName=parent');
$.get(storyLink, function(data)
{
$('#parent').replaceWith(data);
$('#parent' + "_chosen").remove();
$('#parent').next('.picker').remove();
$('#parent').chosen();
});
}
}
/**