Merge branch ztflow-sunguangming-release/21.7.4#sunguangming of zentao/zentaopms (#10539)
This commit is contained in:
@@ -153,6 +153,7 @@ function formSettingBtn(): formSettingBtn {return createWg('formSettingBtn', fun
|
||||
function overviewBlock(): overviewBlock {return createWg('overviewBlock', func_get_args());}
|
||||
function statisticBlock(): statisticBlock {return createWg('statisticBlock', func_get_args());}
|
||||
function picker(): picker {return createWg('picker', func_get_args());}
|
||||
function remotePicker(): remotePicker {return createWg('remotePicker', func_get_args());}
|
||||
function priPicker(): priPicker {return createWg('priPicker', func_get_args());}
|
||||
function severityPicker(): severityPicker {return createWg('severityPicker', func_get_args());}
|
||||
function hr(): hr {return createWg('hr', func_get_args());}
|
||||
|
||||
@@ -29,6 +29,9 @@ class remotePicker extends wg
|
||||
case 'user':
|
||||
$items = createLink('user', 'ajaxGetItems', 'params=' . $params);
|
||||
break;
|
||||
case 'casestories':
|
||||
$items = createLink('story', 'ajaxGetCaseStories', $params);
|
||||
break;
|
||||
default:
|
||||
$items = createLink('user', 'ajaxGetItems', 'params=' . $params);
|
||||
break;
|
||||
@@ -48,4 +51,4 @@ class remotePicker extends wg
|
||||
set($this->props->pick(array('id', 'name', 'value', 'items', 'toolbar', 'menu', 'multiple'))),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1686,6 +1686,47 @@ class story extends control
|
||||
return print(json_encode($items));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用例可关联的需求下拉列表。
|
||||
* AJAX: get the stories of a case.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
* @param int $branch
|
||||
* @param int $storyID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetCaseStories(int $productID = 0, int $moduleID = 0, int|string $branch = '', int $storyID = 0)
|
||||
{
|
||||
if($storyID)
|
||||
{
|
||||
$story = $this->story->fetchByID($storyID);
|
||||
if(empty($moduleID)) $moduleID = $story->module;
|
||||
}
|
||||
|
||||
$modules = array();
|
||||
if($moduleID)
|
||||
{
|
||||
$productModules = $this->loadModel('tree')->getOptionMenu($productID, 'story');
|
||||
$storyModuleID = array_key_exists($moduleID, $productModules) ? $moduleID : 0;
|
||||
$modules = $this->tree->getStoryModule($storyModuleID);
|
||||
$modules = $this->tree->getAllChildID($modules);
|
||||
}
|
||||
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch, $modules, 'active,reviewing', 'id_desc', 0, '', 'story', false);
|
||||
if($this->app->tab != 'qa' && $this->app->tab != 'product' && $this->app->tab != 'my')
|
||||
{
|
||||
$projectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
|
||||
if($projectID) $stories = $this->story->getExecutionStoryPairs($projectID, $productID, $branch, $modules, 'full', 'all', 'story', false);
|
||||
}
|
||||
|
||||
if($storyID && !isset($stories[$storyID])) $stories = $this->story->formatStories(array($storyID => $story)) + $stories;
|
||||
|
||||
$stories = $this->story->addGradeLabel($stories);
|
||||
return print(json_encode($stories));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需求详情和操作日志。
|
||||
* AJAX: get the actions and detail of the story for web app.
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
namespace zin;
|
||||
global $lang, $config, $app;
|
||||
|
||||
$fields = defineFieldList('testcase.create');
|
||||
$fields = defineFieldList('testcase.create');
|
||||
$productID = data('productID');
|
||||
$moduleID = data('currentModuleID');
|
||||
$branch = data('branch');
|
||||
$storyID = data('case.story') ? data('case.story') : '';
|
||||
|
||||
$fields->field('product')
|
||||
->hidden(data('product.shadow'))
|
||||
@@ -25,8 +29,8 @@ $fields->field('story')
|
||||
->label($lang->testcase->lblStory)
|
||||
->control('inputGroup')
|
||||
->items(false)
|
||||
->itemBegin('story')->control('picker')->id('story')->items(data('stories'))->value(data('case.story'))->itemEnd()
|
||||
->itemBegin()->control('btn', array('url' => helper::createLink('story', 'view', 'storyID=' . data('case.story')), 'data-toggle' => 'modal', 'data-size' => 'lg'))->className('hidden', empty(data('case.story')))->icon('eye text-primary')->hint($lang->preview)->id('preview')->itemEnd();
|
||||
->itemBegin('story')->control(array('control' => 'remotepicker', 'params' => "productID=$productID&moduleID=$moduleID&branch=$branch&storyID=$storyID", 'type' => 'casestories'))->id('story')->value($storyID)->itemEnd()
|
||||
->itemBegin()->control('btn', array('url' => helper::createLink('story', 'view', 'storyID=' . $storyID), 'data-toggle' => 'modal', 'data-size' => 'lg'))->className('hidden', empty($storyID))->icon('eye text-primary')->hint($lang->preview)->id('preview')->itemEnd();
|
||||
|
||||
$fields->field('scene')
|
||||
->control(array('control' => 'picker', 'required' => true))
|
||||
|
||||
@@ -215,11 +215,12 @@ detailBody
|
||||
formGroup
|
||||
(
|
||||
setID('storyIdBox'),
|
||||
picker
|
||||
remotePicker
|
||||
(
|
||||
setID('story'),
|
||||
set::name('story'),
|
||||
set::items($stories),
|
||||
set::type('casestories'),
|
||||
set::params("productID={$case->product}&moduleID={$case->module}&branch={$case->branch}&storyID={$case->story}"),
|
||||
set::value($case->story)
|
||||
)
|
||||
)
|
||||
|
||||
+4
-61
@@ -284,7 +284,7 @@ class testcaseZen extends testcase
|
||||
|
||||
/* 设置模块和需求。 */
|
||||
/* Set modules. */
|
||||
$this->assignModulesAndStoriesForCreate($productID, $moduleID, $branch, $case->story, $branches);
|
||||
$this->assignModulesForCreate($productID, $moduleID, $branch, $case->story, $branches);
|
||||
|
||||
$this->view->product = $product;
|
||||
$this->view->projectID = isset($projectID) ? $projectID : 0;
|
||||
@@ -392,8 +392,8 @@ class testcaseZen extends testcase
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示创建 testcase 的需求和模块变量。
|
||||
* Show the modules and stoires associated with the creation testcase.
|
||||
* 展示创建 testcase 的模块变量。
|
||||
* Show the modules associated with the creation testcase.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $moduleID
|
||||
@@ -403,7 +403,7 @@ class testcaseZen extends testcase
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function assignModulesAndStoriesForCreate(int $productID, int $moduleID, string $branch, int $storyID, array $branches)
|
||||
protected function assignModulesForCreate(int $productID, int $moduleID, string $branch, int $storyID, array $branches)
|
||||
{
|
||||
if($storyID)
|
||||
{
|
||||
@@ -413,26 +413,6 @@ class testcaseZen extends testcase
|
||||
|
||||
$currentModuleID = !$moduleID && $productID == (int)$this->cookie->lastCaseProduct ? (int)$this->cookie->lastCaseModule : $moduleID;
|
||||
|
||||
$modules = array();
|
||||
if($currentModuleID)
|
||||
{
|
||||
$productModules = $this->loadModel('tree')->getOptionMenu($productID, 'story');
|
||||
$storyModuleID = array_key_exists($currentModuleID, $productModules) ? $currentModuleID : 0;
|
||||
$modules = $this->tree->getStoryModule($storyModuleID);
|
||||
$modules = $this->tree->getAllChildID($modules);
|
||||
}
|
||||
|
||||
/* 获取未关闭的需求。 */
|
||||
/* Get the status of stories are not closed. */
|
||||
$stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch, $modules, 'active,reviewing', 'id_desc', 50, '', 'story', false);
|
||||
if($this->app->tab != 'qa' && $this->app->tab != 'product' && $this->app->tab != 'my')
|
||||
{
|
||||
$projectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
|
||||
if($projectID) $stories = $this->story->getExecutionStoryPairs($projectID, $productID, $branch, $modules, 'full', 'all', 'story', false);
|
||||
}
|
||||
if($storyID && !isset($stories[$storyID]) && $story->product == $productID) $stories = $this->story->formatStories(array($storyID => $story)) + $stories;
|
||||
|
||||
$this->view->stories = $this->story->addGradeLabel($stories);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, 'case', 0, $branch === 'all' || !isset($branches[$branch]) ? '0' : $branch);
|
||||
$this->view->sceneOptionMenu = $this->testcase->getSceneMenu($productID, $moduleID, $branch === 'all' || !isset($branches[$branch]) ? '0' : $branch);
|
||||
@@ -819,7 +799,6 @@ class testcaseZen extends testcase
|
||||
$this->view->branch = $this->cookie->preBranch;
|
||||
|
||||
$this->assignBranchForEdit($case, $executionID);
|
||||
$this->assignStoriesForEdit($case);
|
||||
$this->assignModuleOptionMenuForEdit($case);
|
||||
}
|
||||
|
||||
@@ -851,42 +830,6 @@ class testcaseZen extends testcase
|
||||
$this->view->branchTagOption = $branchTagOption;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定编辑用例的需求。
|
||||
* Assign stories for editing case.
|
||||
*
|
||||
* @param object $case
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function assignStoriesForEdit(object $case): void
|
||||
{
|
||||
$moduleIdList = array();
|
||||
if($case->module)
|
||||
{
|
||||
$moduleID = $this->loadModel('tree')->getStoryModule($case->module);
|
||||
$moduleIdList = $this->tree->getAllChildID($moduleID);
|
||||
}
|
||||
|
||||
$storyStatus = $this->loadModel('story')->getStatusList('noclosed');
|
||||
if(in_array($this->app->tab, array('project', 'execution')))
|
||||
{
|
||||
$objectID = $this->app->tab == 'project' ? $case->project : $case->execution;
|
||||
$stories = $this->loadModel('story')->getExecutionStoryPairs($objectID, $case->product, $case->branch, $moduleIdList, 'full', 'all', 'story', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$stories = $this->loadModel('story')->getProductStoryPairs($case->product, $case->branch, $moduleIdList, $storyStatus, 'id_desc', 0, '', 'story', false);
|
||||
}
|
||||
if(!isset($stories[$case->story]))
|
||||
{
|
||||
$story = $this->story->fetchByID($case->story);
|
||||
if($story) $stories = $stories + array($story->id => $story->id . ':' . $story->title);
|
||||
}
|
||||
|
||||
$this->view->stories = $this->story->addGradeLabel($stories);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定编辑用的模块选项。
|
||||
* Assign module option menu for editing case.
|
||||
|
||||
Reference in New Issue
Block a user