diff --git a/module/product/model.php b/module/product/model.php index 1222111415..884f03d4b5 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -563,6 +563,7 @@ class productModel extends model if($currentModule == 'product' and strpos($this->config->product->showBranchMethod, $currentMethod) !== false) $isShowBranch = true; if($this->app->tab == 'qa' and strpos(',testsuite,testreport,testtask,', ",$currentModule,") === false) $isShowBranch = true; if($this->app->tab == 'qa' and $currentModule == 'testtask' and strpos(',create,edit,browseunits,importunitresult,unitcases,', ",$currentMethod,") === false) $isShowBranch = true; + if($currentModule == 'testcase' and $currentMethod == 'showimport') $isShowBranch = false; if($isShowBranch) { $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]); diff --git a/module/testcase/control.php b/module/testcase/control.php index 85bda938e8..dc570845a5 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -2093,7 +2093,7 @@ class testcase extends control $this->view->stories = $stories; $this->view->modules = $modules; - $this->view->cases = $this->dao->select('id, module, story, stage, status, pri, type')->from(TABLE_CASE)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->fetchAll('id'); + $this->view->cases = $this->testcase->getByProduct($productID); $this->view->caseData = $caseData; $this->view->stepData = $stepData; $this->view->productID = $productID; @@ -2103,7 +2103,7 @@ class testcase extends control $this->view->allPager = $allPager; $this->view->pagerID = $pagerID; $this->view->branch = $branch; - $this->view->product = $this->products[$productID]; + $this->view->product = $this->product->getByID($productID); $this->view->maxImport = $maxImport; $this->view->dataInsert = $insert; diff --git a/module/testcase/css/showimport.css b/module/testcase/css/showimport.css index 8abde8f1e0..e3294261dd 100644 --- a/module/testcase/css/showimport.css +++ b/module/testcase/css/showimport.css @@ -1,8 +1,10 @@ .table table td,.outer .table table tbody > tr:last-child td {padding: 2px 0 2px 5px !important; border: none !important;} +.c-branch {width: 120px;} .c-line-number {width: 50px;} .c-id {width: 40px;} .c-story, .c-module, .c-type {width: 120px;} .c-stage {width: 160px;} +.c-condition {width: 80px;} .c-step {width: 300px;} .form-actions .btn {margin-right: 20px;} .table td textarea {height: 32px;} diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index b95b099be7..009b944c14 100644 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -27,38 +27,3 @@ $(document).ready(function() } }); }); - -/** - * Set modules. - * - * @param int $branchID - * @param int $productID - * @param int $num - * @access public - * @return void - */ -function setModules(branchID, productID, num) -{ - moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=story&branch=' + branchID + '&num=' + num); - $.get(moduleLink, function(modules) - { - if(!modules) modules = ''; - $('#module' + num).replaceWith(modules); - $("#module" + num + "_chosen").remove(); - $("#module" + num).next('.picker').remove(); - $("#module" + num).attr('onchange', "loadStories("+ productID + ", this.value, " + num + ")").chosen(); - }); - - loadStories(productID, 0, num); - - /* If the branch of the current row is inconsistent with the one below, clear the module and story of the nex row. */ - var nextBranchID = $('#branch' + (num + 1)).val(); - if(nextBranchID != branchID) - { - $('#module' + (num + 1)).find("option[value='ditto']").remove(); - $('#module' + (num + 1)).trigger("chosen:updated"); - - $('#plan' + (num + 1)).find("option[value='ditto']").remove(); - $('#plan' + (num + 1)).trigger("chosen:updated"); - } -} diff --git a/module/testcase/js/common.js b/module/testcase/js/common.js index d29efaf6cd..c351866f47 100644 --- a/module/testcase/js/common.js +++ b/module/testcase/js/common.js @@ -390,3 +390,38 @@ function loadStories(productID, moduleID, num) } }); } + +/** + * Set modules. + * + * @param int $branchID + * @param int $productID + * @param int $num + * @access public + * @return void + */ +function setModules(branchID, productID, num) +{ + moduleLink = createLink('tree', 'ajaxGetModules', 'productID=' + productID + '&viewType=story&branch=' + branchID + '&num=' + num); + $.get(moduleLink, function(modules) + { + if(!modules) modules = ''; + $('#module' + num).replaceWith(modules); + $("#module" + num + "_chosen").remove(); + $("#module" + num).next('.picker').remove(); + $("#module" + num).attr('onchange', "loadStories("+ productID + ", this.value, " + num + ")").chosen(); + }); + + loadStories(productID, 0, num); + + /* If the branch of the current row is inconsistent with the one below, clear the module and story of the nex row. */ + var nextBranchID = $('#branch' + (num + 1)).val(); + if(nextBranchID != branchID) + { + $('#module' + (num + 1)).find("option[value='ditto']").remove(); + $('#module' + (num + 1)).trigger("chosen:updated"); + + $('#plan' + (num + 1)).find("option[value='ditto']").remove(); + $('#plan' + (num + 1)).trigger("chosen:updated"); + } +} diff --git a/module/testcase/js/showimport.js b/module/testcase/js/showimport.js index b6490a25c1..4741a30fd6 100644 --- a/module/testcase/js/showimport.js +++ b/module/testcase/js/showimport.js @@ -10,6 +10,12 @@ $("[name^='branch']").each(function() $(this).attr('id', 'branch' + id.match(/\d+/)); }); +$("[name^='module']").each(function() +{ + var id = $(this).attr('id'); + $(this).attr('id', 'module' + id.match(/\d+/)); +}); + $("[name^='story']").each(function() { var id = $(this).attr('id'); @@ -19,6 +25,7 @@ $("[name^='story']").each(function() var moduleID = $('#module' + num).val(); var storyID = $("#story" + num).val(); var storyLink = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branchID + '&moduleID=' + moduleID + '&storyID=0&onlyOption=false&status=noclosed&limit=50&type=full&hasParent=1&executionID=0&number=' + num); + $.get(storyLink, function(stories) { if(!stories) stories = ''; @@ -29,3 +36,8 @@ $("[name^='story']").each(function() $('#story' + num).val(storyID).trigger('chosen:updated'); }); }); + +$(function() +{ + if(parseInt($('.c-name').css('width')) < 90) $('.c-name').css('width', '90px'); +}); diff --git a/module/testcase/model.php b/module/testcase/model.php index 5a40c8347f..acd61b1a33 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -643,6 +643,21 @@ class testcaseModel extends model return $this->appendData($cases); } + /** + * Get cases by product id. + * + * @param int $productID + * @access public + * @return array + */ + public function getByProduct($productID) + { + return $this->dao->select('*')->from(TABLE_CASE) + ->where('deleted')->eq(0) + ->andWhere('product')->eq($productID) + ->fetchAll('id'); + } + /** * Get cases of a story. * diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php index 2ca6320c31..219c21962e 100644 --- a/module/testcase/view/caseheader.html.php +++ b/module/testcase/view/caseheader.html.php @@ -133,21 +133,15 @@ - +
diff --git a/module/testcase/view/showimport.html.php b/module/testcase/view/showimport.html.php index 5ff2178510..85ec5cd286 100644 --- a/module/testcase/view/showimport.html.php +++ b/module/testcase/view/showimport.html.php @@ -18,149 +18,158 @@ $(function() { if(parseInt($('#maxImport').val())) $('#times').html(Math.ceil(parseInt($('#allCount').html()) / parseInt($('#maxImport').val()))); }); - $('#import').click(function(){location.href = createLink('testcase', 'showImport', "productID=&branch=&pageID=1&maxImport=" + $('#maxImport').val())}) + $('#import').click(function(){location.href = createLink('testcase', 'showImport', "productID=&branch=&pageID=1&maxImport=" + $('#maxImport').val())}); }); -
+

testcase->import;?>

- - - - - - - - - - - - - - - - - - - - - - - $case):?> - title)) continue;?> - - - - - - - - - - - - loadModel('flow');?> - - - - - - - - - - - - + + + + + $case):?> + title)) continue;?> + + + + + type != 'normal'):?> lang->save : $this->lang->file->saveAndNext; - if(!$insert and $dataInsert === '') - { - echo ""; - } - else - { - echo html::submitButton($submitText); - if($dataInsert !== '') echo html::hidden('insert', $dataInsert); - } - echo html::hidden('isEndPage', $isEndPage ? 1 : 0); - echo html::hidden('pagerID', $pagerID); - echo html::linkButton($lang->goback, $this->inlink('browse', "productID=$productID"), 'self', '', 'btn btn-wide'); - echo sprintf($lang->file->importPager, $allCount, $pagerID, $allPager); + if(isset($case->branch)) $branchID = $case->branch; + if(!empty($case->id) and !empty($cases[$case->id]->branch)) $branchID = $cases[$case->id]->branch; + if(!isset($branches[$branchID])) $branchID = $branch; ?> - - - -
lineNumber?>idAB?>testcase->title?>testcase->module?>testcase->story?>testcase->pri?>testcase->type?>testcase->stage?>testcase->precondition?>testcase->{$appendField->field}?> - - - - - -
testcase->stepDesc?>testcase->stepExpect?>
-
- id)) - { - echo $case->id . html::hidden("id[$key]", $case->id); - $insert = false; - } - else - { - echo "{$lang->testcase->new}"; - } - echo html::hidden("product[$key]", $productID); - if(!empty($branches)) - { - $branchID = $branch; - if(isset($case->branch)) $branchID = $case->branch; - if(!empty($case->id) and !empty($cases[$case->id]->branch)) $branchID = $cases[$case->id]->branch; - echo html::hidden("branch[$key]", $branchID); - } - echo html::hidden("keywords[$key]", isset($case->keywords) ? $case->keywords : ""); - ?> - title, ENT_QUOTES), "class='form-control'")?> - branch) and $case->branch != 0) ? $modules[BRANCH_MAIN] + $modules[$case->branch] : $modules[BRANCH_MAIN];?> - module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange' onchange='loadStories($productID, this.value, $key)'")?> - - story) ? $case->story : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->story : '');?> - zget($stories, $storyID, '')), $storyID, "class='form-control chosen storyChange'")?>testcase->priList, isset($case->pri) ? $case->pri : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->pri : ''), "class='form-control chosen'")?>testcase->typeList, isset($case->type) ? $case->type : '', "class='form-control chosen'")?>testcase->stageList, !empty($case->stage) ? $case->stage : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?>precondition) ? htmlSpecialString($case->precondition) : "", "class='form-control'")?>flow->buildControl($appendField, zget($case, $appendField->field, ''), "{$appendField->field}[$key]");?> - - - - $desc):?> - - - - - - - +
+
+ + + + + type != 'normal'):?> + + + + + + + + + + + + - - - - - - -
lineNumber?>idAB?>testcase->branch?>testcase->title?>testcase->module?>testcase->story?>testcase->pri?>testcase->type?>testcase->stage?>testcase->precondition?>testcase->{$appendField->field}?>
- - - - - - - -
- -
+ + + + + + +
testcase->stepDesc?>testcase->stepExpect?>
+
+ id)) + { + echo $case->id . html::hidden("id[$key]", $case->id); + $insert = false; + } + else + { + echo "{$lang->testcase->new}"; + } + echo html::hidden("product[$key]", $productID); + echo html::hidden("keywords[$key]", isset($case->keywords) ? $case->keywords : ""); + ?> +
+ + + title, ENT_QUOTES), "class='form-control'")?> + + + module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange' onchange='loadStories($productID, this.value, $key)'")?> + + + story) ? $case->story : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->story : '');?> + zget($stories, $storyID, '')), $storyID, "class='form-control chosen storyChange'")?> + testcase->priList, isset($case->pri) ? $case->pri : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->pri : ''), "class='form-control chosen'")?> + testcase->typeList, isset($case->type) ? $case->type : '', "class='form-control chosen'")?> + testcase->stageList, !empty($case->stage) ? $case->stage : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->stage : ''), "multiple='multiple' class='form-control chosen'")?> + precondition) ? htmlSpecialString($case->precondition) : "", "class='form-control'")?> + + loadModel('flow');?> + + flow->buildControl($appendField, zget($case, $appendField->field, ''), "{$appendField->field}[$key]");?> + + + + + + + $desc):?> + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + lang->save : $this->lang->file->saveAndNext; + if(!$insert and $dataInsert === '') + { + echo ""; + } + else + { + echo html::submitButton($submitText); + if($dataInsert !== '') echo html::hidden('insert', $dataInsert); + } + echo html::hidden('isEndPage', $isEndPage ? 1 : 0); + echo html::hidden('pagerID', $pagerID); + echo html::linkButton($lang->goback, $this->inlink('browse', "productID=$productID"), 'self', '', 'btn btn-wide'); + echo sprintf($lang->file->importPager, $allCount, $pagerID, $allPager); + ?> + + + + +