* Refactor the createscene view.

This commit is contained in:
daitingting
2023-06-27 07:00:34 +00:00
parent d71bd75372
commit 6d35ded99e
3 changed files with 153 additions and 5 deletions
+4 -5
View File
@@ -2639,7 +2639,7 @@ class testcase extends control
else
{
$changeFunc = '';
if($viewType == 'bug' or $viewType == 'case') $changeFunc = "onchange='loadModuleRelatedNew()'";
if($viewType == 'bug') $changeFunc = "onchange='loadModuleRelatedNew()'";
if($viewType == 'task') $changeFunc = "";
$field = $fieldID ? "modules[$fieldID]" : 'module';
@@ -2649,10 +2649,9 @@ class testcase extends control
$output = html::select("$field", $optionMenu, $currentModuleID, "class='form-control' $changeFunc");
if(count($optionMenu) == 1 and $needManage)
{
$output .= "<span class='input-group-addon'>";
$output .= html::a($this->createLink('tree', 'browse', "rootID=$rootID&view=$viewType&currentModuleID=0&branch=$branch", '', true), $this->lang->tree->manage, '', "class='text-primary' data-toggle='modal' data-type='iframe' data-width='95%'");
$output .= '&nbsp; ';
$output .= html::a("javascript:void(0)", $this->lang->refreshIcon, '', "class='refresh' onclick='loadProductModulesNew($rootID)'");
$output .= "<div class='input-group-btn flex'>";
$output .= html::a($this->createLink('tree', 'browse', "rootID=$rootID&view=$viewType&currentModuleID=0&branch=$branch", '', true), $this->lang->tree->manage, '', "class='btn' data-toggle='modal'");
$output .= html::a("javascript:;", $this->lang->refresh, '', "class='refresh btn' onclick='loadProductModule($rootID)'");
$output .= '</span>';
}
}
+51
View File
@@ -0,0 +1,51 @@
function loadProductBranch()
{
$('#branch').remove();
var productID = $('#product').val();
var param = "productID=" + productID + "&oldBranch=0" + "&param=all";
$.get($.createLink('branch', 'ajaxGetBranches', param), function(data)
{
if(data) $('#product').closest('.input-group').append(data);
loadProductModule();
})
}
function loadProductModule()
{
var productID = $('#product').val();
var branch = $('#branch').val();
if(!branch) branch = 0;
link = $.createLink('testcase', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=case&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=0');
$('#moduleIdBox').load(link, function()
{
$('#moduleIdBox').prepend("<span class='input-group-addon'>" + caseModule + "</span>");
});
setScenes();
}
function loadModuleRelatedNew()
{
setScenes();
}
function setScenes()
{
moduleID = $('#module').val();
productID = $('#product').val();
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
link = $.createLink('testcase', 'ajaxGetModuleScenes', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&stype=1&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1');
$.get(link, function(data)
{
if(data)
{
$('#parent').remove();
$('#sceneIdBox').append(data);
}
})
}
+98
View File
@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
/**
* The create scene view file of testcase module of ZenTaoPMS.
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Tingting Dai <daitingting@easycorp.ltd>
* @package testcase
* @link https://www.zentao.net
*/
namespace zin;
jsVar('tab', $this->app->tab);
jsVar('caseModule', $lang->testcase->module);
formPanel
(
set::title($lang->testcase->createScene),
on::change('#product', 'loadProductBranch'),
on::change('#branch', 'loadProductModule'),
on::change('#module', 'loadModuleRelatedNew'),
on::click('.refresh', 'loadProductModule'),
formRow
(
formGroup
(
set::label($lang->testcase->product),
set::width('1/2'),
inputGroup
(
select
(
set::name('product'),
set::items($products),
set::value($productID),
),
isset($product->type) && $product->type != 'normal' ? select
(
zui::width('120px'),
set::name('branch'),
set::items($branches),
set::value($branch)
) : null
)
),
formGroup
(
inputGroup
(
$lang->testcase->module,
set::id('moduleIdBox'),
select
(
set::name('module'),
set::items($moduleOptionMenu),
set::value($currentModuleID),
),
count($moduleOptionMenu) == 1 ? div
(
set::class('input-group-btn flex'),
a
(
$lang->tree->manage,
set('href', createLink('tree', 'browse', "rootId=$productID&view=case&currentModuleID=0&branch=$branch")),
set('class', 'btn'),
set('data-toggle', 'mdoal'),
),
a
(
$lang->refresh,
set('href', 'javascript:;'),
set('class', 'btn refresh')
)
) : null
)
)
),
formGroup
(
set::label($lang->testcase->parentScene),
set::id('sceneIdBox'),
select
(
set::name('parent'),
set::items($sceneOptionMenu),
set::value($currentParentID),
)
),
formGroup
(
set::label($lang->testcase->sceneTitle),
set::required(true),
set::name('title')
)
);
render();