diff --git a/module/product/control.php b/module/product/control.php index 2788df2080..5aba794066 100755 --- a/module/product/control.php +++ b/module/product/control.php @@ -843,12 +843,14 @@ class product extends control * 设置需求列表展示的需求等级。 * Ajax set show grades. * + * @param string $module + * @param string $showGrades * @access public * @return void */ - public function ajaxSetShowGrades(string $storyType, string $showGrades) + public function ajaxSetShowGrades(string $module, string $showGrades) { - if($showGrades) $this->loadModel('setting')->updateItem("{$this->app->user->account}.$storyType.showGrades", $showGrades); + if($showGrades) $this->loadModel('setting')->updateItem("{$this->app->user->account}.$module.showGrades", $showGrades); } /** diff --git a/module/product/js/browse.ui.js b/module/product/js/browse.ui.js index 7aade0d1f8..10bb7bbdab 100644 --- a/module/product/js/browse.ui.js +++ b/module/product/js/browse.ui.js @@ -141,7 +141,8 @@ window.setShowGrades = function() const showGrades = $('[name^=showGrades]').zui('picker').$.state.value; if(oldShowGrades == showGrades) return; - const link = $.createLink('product', 'ajaxSetShowGrades', 'storyType=' + storyType + '&showGrades=' + showGrades); + const module = tab == 'product' ? storyType : tab; + const link = $.createLink('product', 'ajaxSetShowGrades', 'module=' + module + '&showGrades=' + showGrades); $.get(link, function() { loadCurrentPage(); diff --git a/module/product/ui/browse.html.php b/module/product/ui/browse.html.php index e22e631785..a06879ae19 100644 --- a/module/product/ui/browse.html.php +++ b/module/product/ui/browse.html.php @@ -313,16 +313,10 @@ jsVar('modulePairs', $modulePairs); jsVar('storyType', $storyType); jsVar('checkedSummary', $checkedSummary); -if($isProjectStory and $storyType == 'requirement') -{ - unset($lang->projectstory->featureBar['story']['linkedexecution']); - unset($lang->projectstory->featureBar['story']['unlinkedexecution']); -} - $queryMenuLink = createLink($app->rawModule, $app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=bySearch¶m={queryID}"); featureBar ( - ($showGrade || $storyType != 'story') ? to::leading + ($showGrade || $storyType != 'story' || $isProjectStory) ? to::leading ( picker ( diff --git a/module/product/zen.php b/module/product/zen.php index 93d77dfbc2..df60afe5e2 100644 --- a/module/product/zen.php +++ b/module/product/zen.php @@ -1471,9 +1471,8 @@ class productZen extends product $this->view->stories = $stories; $this->view->gradeGroup = $gradeGroup; $this->view->showGrade = count($gradeGroup[$storyType]) > 2; - $this->view->gradeMenu = $this->loadModel('story')->getGradeMenu($storyType); + $this->view->gradeMenu = $this->loadModel('story')->getGradeMenu($storyType, $project); $this->view->gradePairs = $this->story->getGradePairs($storyType); - $this->view->showGrades = isset($this->config->{$storyType}->showGrades) ? $this->config->{$storyType}->showGrades : $this->story->getDefaultShowGrades($this->view->gradeMenu); $this->view->maxGrade = $this->story->getMaxGrade($storyType); $this->view->storyType = $storyType; $this->view->browseType = $browseType; @@ -1485,6 +1484,9 @@ class productZen extends product $this->view->branchTagOption = $branchTagOpt; $this->view->projectProducts = $projectProducts; + $module = $this->app->tab == 'product' ? $storyType : $this->app->tab; + $this->view->showGrades = isset($this->config->{$module}->showGrades) ? $this->config->{$module}->showGrades : $this->story->getDefaultShowGrades($this->view->gradeMenu); + $storyType = $isProjectStory ? 'all' : $storyType; $this->view->summary = $this->product->summary($stories, $storyType); $this->view->plans = $this->loadModel('productplan')->getPairs($productID, ($branch === 'all' || empty($branch)) ? '' : $branch, 'unexpired,noclosed', true); diff --git a/module/story/model.php b/module/story/model.php index 7886025834..33e176b2df 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -5073,13 +5073,18 @@ class storyModel extends model * Get grade menu in story list. * * @param string $storyType + * @param object $project * @access public * @return array */ - public function getGradeMenu(string $storyType): array + public function getGradeMenu(string $storyType, object $project = null): array { + $storyTypes = isset($project->storyType) ? explode(',', $project->storyType) : array(); + $showEpic = $storyType == 'epic' || in_array('epic', $storyTypes); + $showRequirement = $showEpic || $storyType == 'requirement' || in_array('requirement', $storyTypes); + $menu = array(); - if($storyType == 'epic') + if($showEpic) { $items = array(); $gradePairs = $this->getGradePairs('epic', 'all'); @@ -5087,7 +5092,7 @@ class storyModel extends model $menu[] = array('text' => $this->lang->preview . $this->lang->ERCommon, 'value' => 'epic', 'items' => $items); } - if($storyType == 'requirement' || $storyType == 'epic') + if($showRequirement) { $items = array(); $gradePairs = $this->getGradePairs('requirement', 'all');