diff --git a/module/testcase/js/browse.js b/module/testcase/js/browse.js index 50a6d3b638..6b8f8ae982 100644 --- a/module/testcase/js/browse.js +++ b/module/testcase/js/browse.js @@ -27,7 +27,7 @@ function changeAction(url) $(document).ready(function() { - $(".runCase").colorbox({width:900, height:550, iframe:true, transition:'none'}); + $(".runCase").colorbox({width:900, height:550, iframe:true, transition:'none', onCleanup:function(){parent.location.href=parent.location.href;}}); $('#' + browseType + 'Tab').addClass('active'); $('#module' + moduleID).addClass('active'); if(browseType == 'bysearch') ajaxGetSearchForm(); diff --git a/module/testtask/control.php b/module/testtask/control.php index ee64c1fd89..d92cb9841d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -508,12 +508,23 @@ class testtask extends control */ public function runCase($runID, $caseID = 0, $version = 0) { + $preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID); if(!empty($_POST)) { $this->testtask->createResult($runID); if(dao::isError()) die(js::error(dao::getError())); - echo js::reload('parent'); - die(js::closeWindow()); + if($preAndNext->next) + { + $nextRunID = $runID ? $preAndNext->next->id : 0; + $nextCaseID = $runID ? $preAndNext->next->case : $preAndNext->next->id; + $nextVersion = $preAndNext->next->version; + die(js::locate(inlink('runCase', "runID=$nextRunID&caseID=$nextCaseID&version=$nextVersion"))); + } + else + { + echo js::reload('parent'); + die(js::closeWindow()); + } } if(!$caseID) $run = $this->testtask->getRunById($runID); @@ -523,10 +534,16 @@ class testtask extends control $run->case = $this->loadModel('testcase')->getById($caseID, $version); } - $nextCase = ''; - $caseID = $caseID ? $caseID : $run->case->id; - $preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID); + $preCase = ''; + $nextCase = ''; + $caseID = $caseID ? $caseID : $run->case->id; if($runID and $preAndNext->next) $preAndNext->next = $this->dao->select('*')->from(TABLE_TESTRUN)->where('`case`')->eq($preAndNext->next->id)->fetch(); + if($preAndNext->pre) + { + $preCase['runID'] = $runID ? $preAndNext->pre->id : 0; + $preCase['caseID'] = $runID ? $preAndNext->pre->case : $preAndNext->pre->id; + $preCase['version'] = $preAndNext->pre->version; + } if($preAndNext->next) { $nextCase['runID'] = $runID ? $preAndNext->next->id : 0; @@ -535,6 +552,7 @@ class testtask extends control } $this->view->run = $run; + $this->view->preCase = $preCase; $this->view->nextCase = $nextCase; die($this->display()); diff --git a/module/testtask/lang/en.php b/module/testtask/lang/en.php index a47475c01c..749dde6d7c 100644 --- a/module/testtask/lang/en.php +++ b/module/testtask/lang/en.php @@ -25,6 +25,7 @@ $lang->testtask->results = "Result"; $lang->testtask->createBug = "Bug(+)"; $lang->testtask->assign = 'Assign'; $lang->testtask->cases = 'Cases'; +$lang->testtask->pre = 'Previous'; $lang->testtask->next = 'Next'; $lang->testtask->start = "Start"; $lang->testtask->close = "Close"; diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index 371e28512b..c6f8ed8c6c 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -25,6 +25,7 @@ $lang->testtask->results = "结果"; $lang->testtask->createBug = "提Bug"; $lang->testtask->assign = '指派'; $lang->testtask->cases = '用例'; +$lang->testtask->pre = '上一个'; $lang->testtask->next = '下一个'; $lang->testtask->start = "开始"; $lang->testtask->close = "关闭"; diff --git a/module/testtask/view/runcase.html.php b/module/testtask/view/runcase.html.php index 396df5ed69..7a207661f4 100644 --- a/module/testtask/view/runcase.html.php +++ b/module/testtask/view/runcase.html.php @@ -37,6 +37,7 @@