From 6c975adff82de1c2f096401c5bb44f9a27993d7d Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 22 Jun 2022 17:21:55 +0800 Subject: [PATCH 1/5] * Add some code. --- db/zentao.sql | 11 +++++++++++ module/build/view/view.html.php | 15 ++++++++++++--- module/execution/js/kanban.js | 11 ++++++----- module/execution/view/kanban.html.php | 3 +++ module/execution/view/linkstory.html.php | 9 ++++++++- module/execution/view/story.html.php | 1 - module/execution/view/storykanban.html.php | 11 ++++++++++- module/task/js/create.js | 2 +- module/task/view/create.html.php | 2 ++ module/upgrade/model.php | 15 +++++++++++++++ 10 files changed, 68 insertions(+), 12 deletions(-) diff --git a/db/zentao.sql b/db/zentao.sql index 4b4f835107..bf2ad9f7e5 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -2021,6 +2021,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (1,'execution','putoff'), (1,'execution','start'), (1,'execution','story'), +(1,'execution','storyView'), (1,'execution','storyEstimate'), (1,'execution','storyKanban'), (1,'execution','storySort'), @@ -2571,6 +2572,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (2,'execution','manageMembers'), (2,'execution','printKanban'), (2,'execution','story'), +(2,'execution','storyView'), (2,'execution','storyEstimate'), (2,'execution','storyKanban'), (2,'execution','task'), @@ -2869,6 +2871,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (3,'execution','index'), (3,'execution','kanban'), (3,'execution','story'), +(3,'execution','storyView'), (3,'execution','task'), (3,'execution','team'), (3,'execution','testcase'), @@ -3223,6 +3226,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (4,'execution','putoff'), (4,'execution','start'), (4,'execution','story'), +(4,'execution','storyView'), (4,'execution','storyEstimate'), (4,'execution','storyKanban'), (4,'execution','storySort'), @@ -3719,6 +3723,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (5,'execution','putoff'), (5,'execution','start'), (5,'execution','story'), +(5,'execution','storyView'), (5,'execution','storyEstimate'), (5,'execution','storyKanban'), (5,'execution','storySort'), @@ -4168,6 +4173,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (6,'execution','putoff'), (6,'execution','start'), (6,'execution','story'), +(6,'execution','storyView'), (6,'execution','storyEstimate'), (6,'execution','storyKanban'), (6,'execution','storySort'), @@ -4535,6 +4541,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (7,'execution','linkStory'), (7,'execution','manageProducts'), (7,'execution','story'), +(7,'execution','storyView'), (7,'execution','storyKanban'), (7,'execution','storySort'), (7,'execution','task'), @@ -4938,6 +4945,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (8,'execution','index'), (8,'execution','kanban'), (8,'execution','story'), +(8,'execution','storyView'), (8,'execution','storyKanban'), (8,'execution','task'), (8,'execution','team'), @@ -5316,6 +5324,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (9,'execution','kanban'), (9,'execution','manageMembers'), (9,'execution','story'), +(9,'execution','storyView'), (9,'execution','storyKanban'), (9,'execution','storySort'), (9,'execution','task'), @@ -5633,6 +5642,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (10,'execution','index'), (10,'execution','kanban'), (10,'execution','story'), +(10,'execution','storyView'), (10,'execution','task'), (10,'execution','team'), (10,'execution','testtask'), @@ -5866,6 +5876,7 @@ INSERT INTO `zt_grouppriv` (`group`, `module`, `method`) VALUES (11,'execution','index'), (11,'execution','kanban'), (11,'execution','story'), +(11,'execution','storyView'), (11,'execution','task'), (11,'execution','team'), (11,'execution','testcase'), diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 4aa19b8b94..8cf2726cdc 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -91,9 +91,7 @@ tbody tr td:first-child input {display: none;} - app->tab == 'execution' ? $build->execution : $build->project;?> $story):?> - app->tab == 'execution' ? $this->createLink('execution', 'storyView', "storyID=$story->id", '', true) : $this->createLink('story', 'view', "storyID=$story->id&version=0¶m=$objectID", '', true);?> @@ -106,7 +104,18 @@ tbody tr td:first-child input {display: none;} parent > 0) echo "{$lang->story->childrenAB}"; - echo html::a($storyLink,$story->title, '', isonlybody() ? "data-width='1000'" : "class='iframe' data-width='1000'"); + if($this->app->tab == 'execution' and common::hasPriv('execution', 'storyView')) + { + echo html::a($this->createLink('execution', 'storyView', "storyID=$story->id", '', true), $story->title, '', isonlybody() ? "data-width='1000'" : "class='iframe' data-width='1000'"); + } + elseif($this->app->tab == 'project' and common::hasPriv('projectstory', 'view')) + { + echo html::a($this->createLink('projectstory', 'view', "storyID=$story->id&version=0¶m=$build->project", '', true), $story->title, '', isonlybody() ? "data-width='1000'" : "class='iframe' data-width='1000'"); + } + else + { + echo '' . $story->title . ''; + } ?> openedBy);?> diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 4ee4827f82..ada070e212 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -500,8 +500,8 @@ function renderStoryItem(item, $item, col) var $title = $item.find('.title'); if(!$title.length) { - $title = $('' + (scaleSize <= 1 ? ' ' : '') + '') - .attr('href', $.createLink('execution', 'storyView', 'storyID=' + item.id + '&version=0¶m=' + execution.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '95%'); + $title = $('' + (scaleSize <= 1 ? ' ' : '') + ''); + if(priv.canViewStory) $title = $title.attr('href', $.createLink('execution', 'storyView', 'storyID=' + item.id + '&version=0¶m=' + execution.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '95%'); $title.appendTo($item); } var title = rdSearchValue != '' ? "" + item.title.replaceAll(rdSearchValue, "" + rdSearchValue + "") + "": "" + item.title + ""; @@ -565,8 +565,8 @@ function renderBugItem(item, $item, col) var $title = $item.find('.title'); if(!$title.length) { - $title = $('' + (scaleSize <= 1 ? ' ' : '') + '') - .attr('href', $.createLink('bug', 'view', 'bugID=' + item.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '80%'); + $title = $('' + (scaleSize <= 1 ? ' ' : '') + ''); + if(priv.canViewBug) $title =$title.attr('href', $.createLink('bug', 'view', 'bugID=' + item.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '80%'); $title.appendTo($item); } var title = rdSearchValue != '' ? "" + item.title.replaceAll(rdSearchValue, "" + rdSearchValue + "") + "": "" + item.title + ""; @@ -632,7 +632,8 @@ function renderTaskItem(item, $item, col) var $title = $item.find('.title'); if(!$title.length) { - $title = $('' + (scaleSize <= 1 ? ' ' : '') + '').attr('href', $.createLink('task', 'view', 'taskID=' + item.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '80%'); + $title = $('' + (scaleSize <= 1 ? ' ' : '') + ''); + if(priv.canViewTask) $title = $title.attr('href', $.createLink('task', 'view', 'taskID=' + item.id, '', true)).attr('data-toggle', 'modal').attr('data-width', '80%'); $title.appendTo($item); } var name = rdSearchValue != '' ? "" + item.name.replaceAll(rdSearchValue, "" + rdSearchValue + "") + "": "" + item.name + ""; diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 04093d163c..9b4129dd49 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -87,6 +87,7 @@ js::set('priv', 'canBatchCreateStory' => $canBatchCreateStory, 'canLinkStory' => $canLinkStory, 'canLinkStoryByPlan' => $canLinkStoryByPlan, + 'canViewBug' => common::hasPriv('bug', 'view'), 'canAssignBug' => common::hasPriv('bug', 'assignto'), 'canConfirmBug' => common::hasPriv('bug', 'confirmBug'), 'canResolveBug' => common::hasPriv('bug', 'resolve'), @@ -94,6 +95,7 @@ js::set('priv', 'canEditBug' => common::hasPriv('bug', 'edit'), 'canDeleteBug' => common::hasPriv('bug', 'delete'), 'canActivateBug' => common::hasPriv('bug', 'activate'), + 'canViewTask' => common::hasPriv('task', 'view'), 'canAssignTask' => common::hasPriv('task', 'assignto'), 'canFinishTask' => common::hasPriv('task', 'finish'), 'canPauseTask' => common::hasPriv('task', 'pause'), @@ -113,6 +115,7 @@ js::set('priv', 'canChangeStory' => common::hasPriv('story', 'change'), 'canCloseStory' => common::hasPriv('story', 'close'), 'canUnlinkStory' => common::hasPriv('execution', 'unlinkStory'), + 'canViewStory' => common::hasPriv('execution', 'storyView'), ) ); ?> diff --git a/module/execution/view/linkstory.html.php b/module/execution/view/linkstory.html.php index cf48937571..8c2aa6ae74 100644 --- a/module/execution/view/linkstory.html.php +++ b/module/execution/view/linkstory.html.php @@ -65,7 +65,14 @@ parent > 0) echo "{$lang->story->childrenAB}"; - echo html::a($storyLink, $story->title, '', "class='iframe' data-width='80%'"); + if(common::hasPriv('execution', 'storyView')) + { + echo html::a($storyLink, $story->title, '', "class='iframe' data-width='80%'"); + } + else + { + echo '' . $story->title . ''; + } ?> createLink('product', 'browse', "productID=$story->product&branch=$story->branch"), $products[$story->product]->name);?> diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index ced92cc055..d0e2e3f059 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -225,7 +225,6 @@ $story):?> createLink('execution', 'storyView', "storyID=$story->id&version=$story->version¶m=$execution->id"); $totalEstimate += $story->estimate; ?> diff --git a/module/execution/view/storykanban.html.php b/module/execution/view/storykanban.html.php index a124d33f96..3a8659fc6e 100644 --- a/module/execution/view/storykanban.html.php +++ b/module/execution/view/storykanban.html.php @@ -85,7 +85,16 @@ $account = $this->app->user->account;
- createLink('execution', 'storyView', "story=$story->id", '', true), "#{$story->id} {$story->title}", '', 'class="title kanbaniframe" title="' . $story->title . '"');?> + createLink('execution', 'storyView', "story=$story->id", '', true), "#{$story->id} {$story->title}", '', 'class="title kanbaniframe" title="' . $story->title . '"'); + } + else + { + echo "" . "#" . $story->id . $story->title . ""; + } + ?>
story->priList, $story->pri);?> story->statusList[$story->status];?> diff --git a/module/task/js/create.js b/module/task/js/create.js index ec3449172a..3c3c133f7b 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -184,7 +184,7 @@ function setPreview() } else { - storyLink = createLink('story', 'view', "storyID=" + $('#story').val()); + storyLink = createLink('execution', 'storyView', "storyID=" + $('#story').val()); var concat = storyLink.indexOf('?') < 0 ? '?' : '&'; if(storyLink.indexOf("onlybody=yes") < 0) storyLink = storyLink + concat + 'onlybody=yes'; diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index e6997fac75..e9a1510f9a 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -104,7 +104,9 @@ task->noticeLinkStory, html::a($this->createLink('execution', 'linkStory', "executionID=$execution->id"), $lang->execution->linkStory, '', 'class="text-primary"'), html::a("javascript:loadStories($execution->id)", $lang->refresh, '', 'class="text-primary"'));?>
story, "class='form-control chosen' onchange='setStoryRelated();'");?> + preview;?> +
diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 8d8d3a8325..6dbbf121ac 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -515,6 +515,9 @@ class upgradeModel extends model $this->replaceSetLanePriv(); $this->updateProjectData(); break; + case '17_1': + $this->addStoryViewPriv(); + break; } $this->deletePatch(); @@ -6437,4 +6440,16 @@ class upgradeModel extends model return true; } + + /** + * Insert story view of execution. + * + * @access public + * @return bool + */ + public function addStoryViewPriv() + { + $groupIdList = $this->dao->select('id')->from(TABLE_GROUPPRIV)->where() + + } } From 2befa7a8ba403b2a122e4fc55fe51d3733ad7a51 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 23 Jun 2022 08:46:13 +0800 Subject: [PATCH 2/5] * Add upgrade script. --- module/upgrade/model.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 6dbbf121ac..5cbf184e6b 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6449,7 +6449,17 @@ class upgradeModel extends model */ public function addStoryViewPriv() { - $groupIdList = $this->dao->select('id')->from(TABLE_GROUPPRIV)->where() - + $groupIdList = $this->dao->select('id')->from(TABLE_GROUPPRIV) + ->where('module')->eq('story') + ->andWhere('method')->eq('view') + ->fetchPairs('id'); + foreach($groupIdList as $groupID) + { + $this->dao->insert(TABLE_GROUPPRIV) + ->set('group')->eq($groupID) + ->set('module')->eq('execution') + ->set('method')->eq('storyView') + ->exec(); + } } } From 1e8049788d09177594b9804f16218fd38dd545d0 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 23 Jun 2022 09:35:54 +0800 Subject: [PATCH 3/5] * Optimize code. --- module/upgrade/model.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 5cbf184e6b..519a6c500c 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6449,10 +6449,11 @@ class upgradeModel extends model */ public function addStoryViewPriv() { - $groupIdList = $this->dao->select('id')->from(TABLE_GROUPPRIV) + $groupIdList = $this->dao->select('group')->from(TABLE_GROUPPRIV) ->where('module')->eq('story') ->andWhere('method')->eq('view') - ->fetchPairs('id'); + ->fetchPairs('group'); + foreach($groupIdList as $groupID) { $this->dao->insert(TABLE_GROUPPRIV) @@ -6461,5 +6462,7 @@ class upgradeModel extends model ->set('method')->eq('storyView') ->exec(); } + + return true; } } From 35915964624644ea3972b1c358deba7207ac29b6 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 23 Jun 2022 09:58:19 +0800 Subject: [PATCH 4/5] * Optimize code. --- module/upgrade/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 519a6c500c..0220c581c9 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6449,7 +6449,7 @@ class upgradeModel extends model */ public function addStoryViewPriv() { - $groupIdList = $this->dao->select('group')->from(TABLE_GROUPPRIV) + $groupIdList = $this->dao->select('`group`')->from(TABLE_GROUPPRIV) ->where('module')->eq('story') ->andWhere('method')->eq('view') ->fetchPairs('group'); From 243392a075cb3d752939d66aff2db3fb20c7b9d1 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 23 Jun 2022 13:27:22 +0800 Subject: [PATCH 5/5] * Optimize code. --- module/upgrade/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 0220c581c9..3eed0e4332 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -6456,8 +6456,8 @@ class upgradeModel extends model foreach($groupIdList as $groupID) { - $this->dao->insert(TABLE_GROUPPRIV) - ->set('group')->eq($groupID) + $this->dao->replace(TABLE_GROUPPRIV) + ->set('`group`')->eq($groupID) ->set('module')->eq('execution') ->set('method')->eq('storyView') ->exec();