From 6e08c62f815d843c29ec65913d0d29bdedce7f10 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 14 May 2018 15:35:57 +0800 Subject: [PATCH] * Refact cases page and link case page of testtask. --- module/product/view/browse.html.php | 1 - module/testreport/control.php | 2 +- module/testsuite/view/browse.html.php | 2 + module/testsuite/view/library.html.php | 10 +- module/testsuite/view/linkcase.html.php | 4 +- module/testtask/control.php | 2 +- module/testtask/css/cases.css | 15 +- module/testtask/model.php | 15 +- module/testtask/view/caseheader.html.php | 66 ++++--- module/testtask/view/cases.html.php | 207 +++++++++++---------- module/testtask/view/linkcase.html.php | 223 +++++++++++------------ 11 files changed, 281 insertions(+), 266 deletions(-) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index e5d9062ae6..8641ca966e 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -97,7 +97,6 @@ -
diff --git a/module/testreport/control.php b/module/testreport/control.php index fb9d70ff46..9319fd9b29 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -151,7 +151,7 @@ class testreport extends control $build = $this->build->getById($task->build); $stories = empty($build->stories) ? array() : $this->story->getByList($build->stories); - $builds[$build->id] = $build; + if(!empty($build->id)) $builds[$build->id] = $build; $bugs = $this->testreport->getBugs4Test($builds, $productID, $begin, $end); } diff --git a/module/testsuite/view/browse.html.php b/module/testsuite/view/browse.html.php index e906e30136..71122a97cc 100644 --- a/module/testsuite/view/browse.html.php +++ b/module/testsuite/view/browse.html.php @@ -67,6 +67,8 @@ + +
diff --git a/module/testsuite/view/library.html.php b/module/testsuite/view/library.html.php index 1ad400f9b8..f85ca98cf6 100644 --- a/module/testsuite/view/library.html.php +++ b/module/testsuite/view/library.html.php @@ -69,6 +69,9 @@ js::set('flow', $this->config->global->flow);
'>
+
+ " . $lang->testsuite->view, '', "class='btn'");?> +
-
- " . $lang->testsuite->view, '', "class='btn'");?> -
diff --git a/module/testsuite/view/linkcase.html.php b/module/testsuite/view/linkcase.html.php index 16cdd1d84b..e0bf1e3442 100644 --- a/module/testsuite/view/linkcase.html.php +++ b/module/testsuite/view/linkcase.html.php @@ -72,15 +72,15 @@ + + diff --git a/module/testtask/control.php b/module/testtask/control.php index e106b7eb9a..4a3fe25ae9 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -980,6 +980,6 @@ class testtask extends control ->where('task')->eq((int)$taskID) ->andWhere('`case`')->in($this->post->caseIDList) ->exec(); - die(js::locate($this->session->caseList)); + die(js::locate($this->session->caseList, 'parent')); } } diff --git a/module/testtask/css/cases.css b/module/testtask/css/cases.css index 902a7fe6ca..b3bcb1b041 100644 --- a/module/testtask/css/cases.css +++ b/module/testtask/css/cases.css @@ -1,10 +1,13 @@ tbody > tr > td > .btn-icon {margin-right: 3px;} tbody > tr > td .icon-bug {margin-left: -8px;} -tfoot .table-actions #assignedTo_chosen a.chosen-default{height:26px;line-height:15px} -tfoot .table-actions .input-group-addon{padding:4px 12px;} +.table-footer .table-actions .input-group {float: left;} +.table-footer .table-actions #assignedTo_chosen a.chosen-default{height:28px;line-height:15px} +.table-footer .table-actions .input-group-addon{padding:4px 12px;} +.table-footer +.table-footer.fixedTfootAction .chosen-results li.active-result {color: black;} +.table-footer .table-actions .input-group #assignedTo_chosen .chosen-single{height:28px;padding:3px 6px} +.table-footer .table-actions .input-group #assignedTo_chosen .chosen-single span{font-size:12px;} +.table-footer .table-actions .input-group #assignedTo_chosen .chosen-single div{line-height:10px;} -tfoot.fixedTfootAction .chosen-results li.active-result {color: black;} -tfoot .table-actions .input-group #assignedTo_chosen .chosen-single{height:24px;padding:3px 6px} -tfoot .table-actions .input-group #assignedTo_chosen .chosen-single span{font-size:12px;} -tfoot .table-actions .input-group #assignedTo_chosen .chosen-single div{line-height:10px;} +#pageActions {top: -60px;} diff --git a/module/testtask/model.php b/module/testtask/model.php index 79e6ac8b4a..228b7b2e74 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1132,16 +1132,23 @@ class testtaskModel extends model if($id == 'id') $class .= ' cell-id'; if($id == 'lastRunResult') $class .= " $run->lastRunResult"; if($id == 'assignedTo' && $run->assignedTo == $account) $class .= ' red'; + if($id == 'actions') $class .= 'c-actions'; echo ""; switch ($id) { case 'id': - if($mode == 'table') echo " "; - echo $canView ? html::a($caseLink, sprintf('%03d', $run->case)) : sprintf('%03d', $run->case); + if($mode == 'table') + { + echo html::checkbox('caseIDList', array($run->case => sprintf('%03d', $run->case))); + } + else + { + echo $canView ? html::a($caseLink, sprintf('%03d', $run->case)) : sprintf('%03d', $run->case); + } break; case 'pri': - echo ""; + echo ""; echo zget($this->lang->testcase->priList, $run->pri, $run->pri); echo ""; break; @@ -1222,7 +1229,7 @@ class testtaskModel extends model if(common::hasPriv('testtask', 'unlinkCase', $run)) { $unlinkURL = helper::createLink('testtask', 'unlinkCase', "caseID=$run->id&confirm=yes"); - echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"casesForm\",confirmUnlink)", '', '', "title='{$this->lang->testtask->unlinkCase}' class='btn-icon'"); + echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"casesForm\",confirmUnlink)", '', '', "title='{$this->lang->testtask->unlinkCase}' class='btn'"); } common::printIcon('testcase', 'createBug', "product=$run->product&branch=$run->branch&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,version=$run->version,runID=$run->id,testtask=$task->id", $run, 'list', 'bug', '', 'iframe', '', "data-width='90%'"); diff --git a/module/testtask/view/caseheader.html.php b/module/testtask/view/caseheader.html.php index b2c6c5a946..06ccf2cb0c 100644 --- a/module/testtask/view/caseheader.html.php +++ b/module/testtask/view/caseheader.html.php @@ -1,36 +1,39 @@ -
-
- " . html::icon($lang->icons['usecase']) . '' . $task->name . '';?> +
+ {$lang->testtask->view}", '', "class='btn'");?> + {$lang->testtask->reportField}", '', "class='btn'");?> +
+ testtask->confirmUnlinkCase)?> session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?> - -
- -
-
-
icons['product']);?>
-
- -
-
+ + +
+ -
-
- -
- id&browseType=$browseType¶m=$param&orderBy=%s&recToal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; - $datatableId = $this->moduleName . ucfirst($this->methodName); - $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); +
+
+ + id&browseType=$browseType¶m=$param&orderBy=%s&recToal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; + $datatableId = $this->moduleName . ucfirst($this->methodName); + $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); - $canBatchEdit = common::hasPriv('testcase', 'batchEdit'); - $canBatchAssign = common::hasPriv('testtask', 'batchAssign'); - $canBatchRun = common::hasPriv('testtask', 'batchRun'); - $hasCheckbox = ($canBatchEdit or $canBatchAssign or $canBatchRun); + $canBatchEdit = common::hasPriv('testcase', 'batchEdit'); + $canBatchUnlink = common::hasPriv('testtask', 'batchUnlinkCases'); + $canBatchAssign = common::hasPriv('testtask', 'batchAssign'); + $canBatchRun = common::hasPriv('testtask', 'batchRun'); + $hasCheckbox = ($canBatchEdit or $canBatchUnlink or $canBatchAssign or $canBatchRun); - if($useDatatable) include '../../common/view/datatable.html.php'; - if(!$useDatatable) include '../../common/view/tablesorter.html.php'; + if($useDatatable) include '../../common/view/datatable.html.php'; + if(!$useDatatable) include '../../common/view/tablesorter.html.php'; - $this->config->testcase->datatable->defaultField = $this->config->testtask->datatable->defaultField; - $this->config->testcase->datatable->fieldList['actions']['width'] = '100'; + $this->config->testcase->datatable->defaultField = $this->config->testtask->datatable->defaultField; + $this->config->testcase->datatable->fieldList['actions']['width'] = '156'; - $setting = $this->datatable->getSetting('testtask'); - $widths = $this->datatable->setFixedFieldWidth($setting); - $columns = 0; - ?> - ' id='caseList' data-checkable='' data-fixed-left-width='' data-fixed-right-width='' data-custom-menu='true' data-checkbox-name='caseIDList[]'> - - - $value) - { - if($value->show) - { - $this->datatable->printHead($value, $orderBy, $vars); - $columns ++; - } - } - ?> - - - - - - $value) $this->testtask->printCell($value, $run, $users, $task, $branches, $useDatatable ? 'datatable' : 'table');?> - - - - - - - - -
- -
- -
- createLink('testcase', 'batchEdit', "productID=$productID"); - $misc = $canBatchEdit ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'"; - echo html::commonButton($lang->edit, $misc); - ?> - - -
+ $setting = $this->datatable->getSetting('testtask'); + $widths = $this->datatable->setFixedFieldWidth($setting); + $columns = 0; + ?> + + + + $value) + { + if($value->show) + { + $this->datatable->printHead($value, $orderBy, $vars); + $columns ++; + } + } + ?> + + + + + + $value) $this->testtask->printCell($value, $run, $users, $task, $branches, $useDatatable ? 'datatable' : 'table');?> + + + +
+ +
- +
+ +
+ + +
+ + testtask->runCase, "onclick=\"setFormAction('$actionLink')\""); + } + ?> +
+ + show('right', 'pagerjs');?> +
+ + +