From c7ea387c259ac03fdff7c85e7446078dbcfc1272 Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 9 Jun 2023 09:44:30 +0800 Subject: [PATCH] * testcaseBrowse: refactor functions to build operate menu by configuration. --- module/testcase/ui/browse.html.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/module/testcase/ui/browse.html.php b/module/testcase/ui/browse.html.php index 14bf1d6960..1a232333b4 100644 --- a/module/testcase/ui/browse.html.php +++ b/module/testcase/ui/browse.html.php @@ -347,26 +347,26 @@ if($canBatchChangeScene) ); } -$config->testcase->dtable->fieldList['story']['map'] = $stories; -$this->testcase->buildOperateMenu(null, 'browse'); +$executionID = ($app->tab == 'project' || $app->tab == 'execution') ? $this->session->{$app->tab} : '0'; +$url = $config->testcase->dtable->fieldList['actions']['list']['edit']['url']; +$url = str_replace('%executionID%', $executionID, $url); + +$config->testcase->dtable->fieldList['story']['map'] = $stories; +$config->testcase->dtable->fieldList['actions']['list']['edit']['url'] = $url; foreach($scenes as $scene) { + $actionType = $scene->isCase == 1 ? 'testcase' : 'scene'; + $config->testcase->dtable->fieldList['actions']['menu'] = $config->$actionType->menu; + + initTableData(array($scene), $config->testcase->dtable->fieldList, $this->testcase); + if($scene->isCase != 1) continue; $stages = array_filter(explode(',', $scene->stage)); foreach($stages as $key => $stage) $stages[$key] = zget($lang->testcase->stageList, $stage); $scene->stage = implode($lang->comma, $stages); - - $actions = array(); - foreach($this->config->testcase->dtable->fieldList['actions']['actionsMap'] as $actionCode => $actionMap) - { - $isClickable = $this->testcase->isClickable($scene, $actionCode); - - $actions[] = $isClickable ? $actionCode : array('name' => $actionCode, 'disabled' => true); - } - $scene->actions = $actions; } dtable