diff --git a/module/testcase/control.php b/module/testcase/control.php index c855353ec9..e83d97a5bd 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -164,7 +164,7 @@ class testcase extends control } $queryCondition = ''; - $topObjects = $this->testcase->getList($productParam,$branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); + $topObjects = $this->testcase->getList($productParam,$branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); /* Get children cases and scenes.*/ $scenes = $this->testcase->getList($productParam, $branch,$moduleID, $caseIdList, null, 'child', array_keys($topObjects), $browseType, $queryCondition); @@ -373,14 +373,16 @@ class testcase extends control { $this->loadModel('project')->setMenu($this->session->project); $products = $this->product->getProducts($this->session->project, 'all', '', false); - $productID = $this->product->saveState($productID, $products); + $productID = $this->product->saveVisitState($productID, $products); + $productID = (int)$productID; $product = $this->product->getByID($productID); if(!$product->shadow) $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'zeroCase', $projectID, $branchID); } else { $products = $this->product->getPairs(); - $productID = $this->product->saveState($productID, $products); + $productID = $this->product->saveVisitState($productID, $products); + $productID = (int)$productID; $product = $this->product->getByID($productID); $this->loadModel('qa'); $this->app->rawModule = 'testcase'; diff --git a/module/testcase/js/browse.ui.js b/module/testcase/js/browse.ui.js index 93cdff3e17..226c96fed6 100644 --- a/module/testcase/js/browse.ui.js +++ b/module/testcase/js/browse.ui.js @@ -1,23 +1,3 @@ -$(document).off('click', '.batch-btn').on('click', '.batch-btn', function() -{ - const dtable = zui.DTable.query($(this).target); - const checkedList = dtable.$.getChecks(); - if(!checkedList.length) return; - - const url = $(this).data('url'); - const form = new FormData(); - checkedList.forEach((id) => form.append('caseIdList[]', id)); - - if($(this).hasClass('ajax-btn')) - { - $.ajaxSubmit({url, data:form}); - } - else - { - postAndLoadPage(url, form); - } -}); - /** * 移除场景名称的链接。 * Remove link of scene's title. diff --git a/module/testcase/js/common.ui.js b/module/testcase/js/common.ui.js new file mode 100644 index 0000000000..4dd02a39cb --- /dev/null +++ b/module/testcase/js/common.ui.js @@ -0,0 +1,19 @@ +$(document).off('click', '.batch-btn').on('click', '.batch-btn', function() +{ + const dtable = zui.DTable.query($(this).target); + const checkedList = dtable.$.getChecks(); + if(!checkedList.length) return; + + const url = $(this).data('url'); + const form = new FormData(); + checkedList.forEach((id) => form.append('caseIdList[]', id)); + + if($(this).hasClass('ajax-btn')) + { + $.ajaxSubmit({url, data:form}); + } + else + { + postAndLoadPage(url, form); + } +}); diff --git a/module/testcase/ui/zerocase.html.php b/module/testcase/ui/zerocase.html.php new file mode 100644 index 0000000000..630b7b20fe --- /dev/null +++ b/module/testcase/ui/zerocase.html.php @@ -0,0 +1,73 @@ + + * @package testcase + * @link https://www.zentao.net + */ +namespace zin; + +$canBatchEdit = hasPriv('story', 'batchEdit'); +$canBatchChangeStage = hasPriv('story', 'batchChangeStage'); +$canBatchReview = hasPriv('story', 'batchReview'); +$canBatchAction = $canBatchEdit || $canBatchChangeStage || $canBatchReview; + +$footToolbar = $canBatchAction ? array('items' => array +( + array('text' => $lang->edit, 'className' => 'batch-btn' . ($canBatchEdit ? '': 'hidden'), 'data-url' => createLink('story', 'batchEdit', "productID={$productID}&projectID={$projectID}&branch={$branch}")), + array('text' => $lang->story->review, 'className' => ($canBatchReview ? '' : 'hidden') , 'caret' => 'up', 'url' => '#navReview', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), + array('text' => $lang->story->stageAB, 'className' => ($canBatchChangeStage ? '' : 'hidden'), 'caret' => 'up', 'url' => '#navStage', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), +), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null; + +$reviewItems = array(); +foreach($lang->story->reviewResultList as $key => $result) +{ + if(!$key || $key == 'revert') continue; + + if($key == 'reject') + { + $reviewItems[] = array('text' => $result, 'class' => 'not-hide-menu', 'items' => $rejectItems); + } + else + { + $reviewItems[] = array('text' => $result, 'class' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchReview', "result=$key")); + } +} + +$rejectItems = array(); +foreach($lang->story->reasonList as $key => $reason) $rejectItems[] = array('text' => $reason, 'class' => 'batch-btn ajax-btn', 'data-url' => createLink('story', 'batchReview', "result=reject&reason=$key")) ; + +menu +( + set::id('navReview'), + set::class('dropdown-menu'), + set::items($reviewItems) +); + +$stageItems = array(); +$lang->story->stageList[''] = $lang->null; +foreach($lang->story->stageList as $key => $stage) $stageItems[] = array('text' => $stage, 'class' => 'batch-btn ajax-btn', 'data-url' => helper::createLink('story', 'batchChangeStage', "stage=$key")); + +menu +( + set::id('navStage'), + set::class('dropdown-menu'), + set::items($stageItems), +); + +$stories = initTableData($stories, $config->testcase->zerocase->dtable->fieldList, $this->story); + +dtable +( + set::cols($config->testcase->zerocase->dtable->fieldList), + set::data(array_values($stories)), + set::userMap($users), + set::footPager(usePager()), + set::footToolbar($footToolbar), + set::checkable($canBatchAction), +); + +render();