From 5801f9c07de9d0e9cf47a72306b598b72466e71f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 23 Oct 2017 16:36:02 +0800 Subject: [PATCH] * fix bug for browse list page. --- module/bug/model.php | 13 ++++--- module/bug/view/browse.html.php | 2 +- module/product/view/browse.html.php | 2 +- module/project/view/datatabledata.html.php | 44 ---------------------- module/project/view/task.html.php | 4 +- module/story/model.php | 13 ++++--- module/task/model.php | 11 ++++-- module/testcase/control.php | 1 + module/testcase/model.php | 13 ++++--- module/testcase/view/browse.html.php | 2 +- module/testtask/model.php | 11 ++++-- module/testtask/view/cases.html.php | 2 +- 12 files changed, 45 insertions(+), 73 deletions(-) delete mode 100644 module/project/view/datatabledata.html.php diff --git a/module/bug/model.php b/module/bug/model.php index 33e52442e6..3a34f1802e 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2310,8 +2310,9 @@ class bugModel extends model * @access public * @return void */ - public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array()) + public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array(), $mode = 'datatable') { + $canView = common::hasPriv('bug', 'view'); $bugLink = inlink('view', "bugID=$bug->id"); $account = $this->app->user->account; $id = $col->id; @@ -2319,15 +2320,17 @@ class bugModel extends model { $class = ''; if($id == 'status') $class .= ' bug-' . $bug->status; - if($id == 'title') $class .= ' text-left'; + if($id == 'title') $class .= ' text-left'; + if($id == 'id') $class .= ' cell-id'; if($id == 'assignedTo' && $bug->assignedTo == $account) $class .= ' red'; if($id == 'deadline' && isset($bug->delay)) $class .= ' delayed'; echo ""; - switch ($id) + switch($id) { case 'id': - echo html::a($bugLink, sprintf('%03d', $bug->id)); + if($mode == 'table') echo " "; + echo $canView ? html::a($bugLink, sprintf('%03d', $bug->id)) : sprintf('%03d', $bug->id); break; case 'severity': echo ""; @@ -2344,7 +2347,7 @@ class bugModel extends model echo "[{$this->lang->bug->confirmedList[$bug->confirmed]}] "; if($bug->branch)echo "{$branches[$bug->branch]} "; if($modulePairs and $bug->module)echo "{$modulePairs[$bug->module]} "; - echo html::a($bugLink, $bug->title, null, "style='color: $bug->color'"); + echo $canView ? html::a($bugLink, $bug->title, null, "style='color: $bug->color'") : "{$bug->title}"; break; case 'branch': echo $branches[$bug->branch]; diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index a761bba051..4d3af96683 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -193,7 +193,7 @@ js::set('branch', $branch); - $value) $this->bug->printCell($value, $bug, $users, $builds, $branches, $modulePairs, $projects, $plans, $stories, $tasks);?> + $value) $this->bug->printCell($value, $bug, $users, $builds, $branches, $modulePairs, $projects, $plans, $stories, $tasks, $useDatatable ? 'datatable' : 'table');?> diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 8bb6c7f7b5..b7929f2910 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -130,7 +130,7 @@ - $value) $this->story->printCell($value, $story, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases);?> + $value) $this->story->printCell($value, $story, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');?> diff --git a/module/project/view/datatabledata.html.php b/module/project/view/datatabledata.html.php deleted file mode 100644 index 31ac138adf..0000000000 --- a/module/project/view/datatabledata.html.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @package project - * @version $Id$ - * @link http://www.zentao.net - */ -?> -datatable->getSetting('project'); -$widths = $this->datatable->setFixedFieldWidth($setting); -$columns = 0; -extract($widths); -?> - - - $value) - { - if($value->show) - { - $this->datatable->printHead($value, $orderBy, $vars); - $columns++; - } - } - ?> - - - - - $value) $this->task->printCell($value, $task, $users, $browseType, $branchGroups, $modulePairs);?> - - children) foreach($task->children as $child):?> - - $value) $this->task->printCell($value, $child, $users, $browseType, $branchGroups, $modulePairs);?> - - - - diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index 2f2022c87c..311b74f614 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -68,12 +68,12 @@ js::set('browseType', $browseType); - $value) $this->task->printCell($value, $task, $users, $browseType, $branchGroups, $modulePairs);?> + $value) $this->task->printCell($value, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table');?> children)):?> children as $child):?> - $value) $this->task->printCell($value, $child, $users, $browseType, $branchGroups, $modulePairs);?> + $value) $this->task->printCell($value, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table');?> diff --git a/module/story/model.php b/module/story/model.php index 402cc7fd5c..017dde597f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2247,8 +2247,9 @@ class storyModel extends model * @access public * @return void */ - public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks, $storyBugs, $storyCases) + public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks = array(), $storyBugs = array(), $storyCases = array(), $mode = 'datatable') { + $canView = common::hasPriv('story', 'view'); $storyLink = helper::createLink('story', 'view', "storyID=$story->id"); $account = $this->app->user->account; $id = $col->id; @@ -2256,7 +2257,8 @@ class storyModel extends model { $class = ''; if($id == 'status') $class .= ' story-' . $story->status; - if($id == 'title') $class .= ' text-left'; + if($id == 'title') $class .= ' text-left'; + if($id == 'id') $class .= ' cell-id'; if($id == 'assignedTo' && $story->assignedTo == $account) $class .= ' red'; $title = ''; @@ -2264,10 +2266,11 @@ class storyModel extends model if($id == 'plan') $title = $story->planTitle; echo " - $value) $this->testcase->printCell($value, $case, $users, $branches, $modulePairs, $browseType);?> + $value) $this->testcase->printCell($value, $case, $users, $branches, $modulePairs, $browseType, $useDatatable ? 'datatable' : 'table');?> diff --git a/module/testtask/model.php b/module/testtask/model.php index 200ec43d55..ad83c3fc21 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1118,8 +1118,9 @@ class testtaskModel extends model * @access public * @return void */ - public function printCell($col, $run, $users, $task, $branches) + public function printCell($col, $run, $users, $task, $branches, $mode = 'datatable') { + $canView = common::hasPriv('testcase', 'view'); $caseLink = helper::createLink('testcase', 'view', "caseID=$run->case&version=$run->version&from=testtask&taskID=$run->task"); $account = $this->app->user->account; $id = $col->id; @@ -1127,7 +1128,8 @@ class testtaskModel extends model { $class = ''; if($id == 'status') $class .= $run->status; - if($id == 'title') $class .= ' text-left'; + if($id == 'title') $class .= ' text-left'; + if($id == 'id') $class .= ' cell-id'; if($id == 'lastRunResult') $class .= " $run->lastRunResult"; if($id == 'assignedTo' && $run->assignedTo == $account) $class .= ' red'; @@ -1135,7 +1137,8 @@ class testtaskModel extends model switch ($id) { case 'id': - echo html::a($caseLink, sprintf('%03d', $run->case)); + if($mode == 'table') echo " "; + echo $canView ? html::a($caseLink, sprintf('%03d', $run->case)) : sprintf('%03d', $run->case); break; case 'pri': echo ""; @@ -1144,7 +1147,7 @@ class testtaskModel extends model break; case 'title': if($run->branch) echo "{$branches[$run->branch]}"; - echo html::a($caseLink, $run->title); + echo $canView ? html::a($caseLink, $run->title) : $run->title; break; case 'branch': echo $branches[$run->branch]; diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 05b6d970a6..e1caa1c4ef 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -71,7 +71,7 @@ var moduleID = ''; - $value) $this->testtask->printCell($value, $run, $users, $task, $branches);?> + $value) $this->testtask->printCell($value, $run, $users, $task, $branches, $useDatatable ? 'datatable' : 'table');?>
"; - switch ($id) + switch($id) { case 'id': - echo html::a($storyLink, sprintf('%03d', $story->id)); + if($mode == 'table') echo " "; + echo $canView ? html::a($storyLink, sprintf('%03d', $story->id)) : sprintf('%03d', $story->id); break; case 'pri': echo ""; @@ -2277,7 +2280,7 @@ class storyModel extends model case 'title': if($story->branch) echo "{$branches[$story->branch]} "; if($modulePairs and $story->module) echo "{$modulePairs[$story->module]} "; - echo html::a($storyLink, $story->title, null, "style='color: $story->color'"); + echo $canView ? html::a($storyLink, $story->title, '', "style='color: $story->color'") : "{$story->title}"; break; case 'plan': echo $story->planTitle; diff --git a/module/task/model.php b/module/task/model.php index 6f69dce32d..ca53e028b5 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1807,8 +1807,9 @@ class taskModel extends model * @access public * @return void */ - public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array()) + public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable') { + $canView = common::hasPriv('task', 'view'); $taskLink = helper::createLink('task', 'view', "taskID=$task->id"); $account = $this->app->user->account; $id = $col->id; @@ -1816,15 +1817,17 @@ class taskModel extends model { $class = ''; if($id == 'status') $class .= ' task-' . $task->status; + if($id == 'id') $class .= ' cell-id'; if($id == 'name' or $id == 'story') $class .= ' text-left'; if($id == 'deadline' and isset($task->delay)) $class .= ' delayed'; if($id == 'assignedTo' && $task->assignedTo == $account) $class .= ' red'; echo ""; - switch ($id) + switch($id) { case 'id': - echo html::a($taskLink, sprintf('%03d', $task->id)); + if($mode == 'table') echo " "; + echo $canView ? html::a($taskLink, sprintf('%03d', $task->id)) : sprintf('%03d', $task->id); break; case 'pri': echo ""; @@ -1834,7 +1837,7 @@ class taskModel extends model case 'name': if(!empty($task->product) && isset($branchGroups[$task->product][$task->branch])) echo "" . $branchGroups[$task->product][$task->branch] . ' '; if($modulePairs and $task->module) echo "" . $modulePairs[$task->module] . ' '; - echo html::a($taskLink, $task->name, null, "style='color: $task->color'"); + echo $canView ? html::a($taskLink, $task->name, null, "style='color: $task->color'") : "$task->name"; if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); if(!empty($task->children)) echo '    '; break; diff --git a/module/testcase/control.php b/module/testcase/control.php index bcbadf5123..c6ad633bcb 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -503,6 +503,7 @@ class testcase extends control $caseFails = $this->dao->select('COUNT(*) AS count')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->eq($caseID) ->beginIF($from == 'testtask')->andwhere('`run`')->eq($taskID)->fi() ->fetch('count'); + $case->caseFails = $caseFails; $this->view->position[] = $this->lang->testcase->common; $this->view->position[] = $this->lang->testcase->view; diff --git a/module/testcase/model.php b/module/testcase/model.php index d8970b9ff6..1d01119a47 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1232,8 +1232,9 @@ class testcaseModel extends model * @access public * @return void */ - public function printCell($col, $case, $users, $branches, $modulePairs = array(), $browseType = '') + public function printCell($col, $case, $users, $branches, $modulePairs = array(), $browseType = '', $mode = 'datatable') { + $canView = common::hasPriv('testcase', 'view'); $caseLink = helper::createLink('testcase', 'view', "caseID=$case->id&version=$case->version"); $account = $this->app->user->account; $id = $col->id; @@ -1241,14 +1242,16 @@ class testcaseModel extends model { $class = ''; if($id == 'status') $class .= $case->status; - if($id == 'title') $class .= ' text-left'; + if($id == 'title') $class .= ' text-left'; + if($id == 'id') $class .= ' cell-id'; if($id == 'lastRunResult') $class .= $case->lastRunResult; echo ""; - switch ($id) + switch($id) { case 'id': - echo html::a($caseLink, sprintf('%03d', $case->id)); + if($mode == 'table') echo " "; + echo $canView ? html::a($caseLink, sprintf('%03d', $case->id)) : sprintf('%03d', $case->id); break; case 'pri': echo ""; @@ -1258,7 +1261,7 @@ class testcaseModel extends model case 'title': if($case->branch) echo "{$branches[$case->branch]} "; if($modulePairs and $case->module) echo "{$modulePairs[$case->module]} "; - echo html::a($caseLink, $case->title, null, "style='color: $case->color'"); + echo $canView ? html::a($caseLink, $case->title, null, "style='color: $case->color'") : "$case->title"; break; case 'branch': echo $branches[$case->branch]; diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 44fbe3fda3..a2f5099c74 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -69,7 +69,7 @@ js::set('branch', $branch);