From f2a39a0dbcf5857448b5db34df76941983e82e68 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Fri, 1 Jan 2021 16:03:51 +0800 Subject: [PATCH] * Add product program project menu group. --- config/filter.php | 2 + framework/base/router.class.php | 9 +-- module/ci/model.php | 3 +- module/common/lang/zh-cn.php | 6 +- module/common/view/header.html.php | 6 +- module/doc/control.php | 21 ++++-- module/personnel/control.php | 5 +- module/product/control.php | 39 ++++++---- module/product/lang/zh-cn.php | 1 + module/product/model.php | 18 ++--- module/product/view/project.html.php | 2 +- module/productplan/control.php | 3 +- module/program/control.php | 32 ++++---- module/program/lang/zh-cn.php | 2 + module/program/model.php | 105 +++++++++++++++++---------- module/projectrelease/control.php | 2 +- module/release/control.php | 3 +- module/repo/control.php | 10 ++- module/stakeholder/control.php | 2 +- module/story/control.php | 26 ++++--- module/testreport/model.php | 2 +- module/tree/control.php | 5 +- www/theme/default/style.css | 2 + 23 files changed, 189 insertions(+), 117 deletions(-) diff --git a/config/filter.php b/config/filter.php index 8ae6bf07a6..a47397bb0e 100644 --- a/config/filter.php +++ b/config/filter.php @@ -153,6 +153,8 @@ $filter->product->index->cookie['preBranch'] = 'int'; $filter->product->export->cookie['checkedItem'] = 'reg::checked'; $filter->product->project->cookie['PRJMine'] = 'code'; +$filter->program->default->cookie['lastPGM'] = 'int'; +$filter->program->default->cookie['lastPRJ'] = 'int'; $filter->program->prjbrowse->cookie['programType'] = 'code'; $filter->program->prjbrowse->cookie['PRJMine'] = 'code'; $filter->program->pgmproject->cookie['PRJMine'] = 'code'; diff --git a/framework/base/router.class.php b/framework/base/router.class.php index c1646bd563..0b91c6f06e 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -850,14 +850,7 @@ class baseRouter */ public function setPRJ() { - if(isset($_GET['PRJ'])) - { - $this->session->set('PRJ', $_GET['PRJ']); //Set PRJ id into session. - } - else - { - unset($_SESSION['PRJ']); - } + if(isset($_GET['PRJ'])) $this->session->set('PRJ', $_GET['PRJ']); //Set PRJ id into session. } /** diff --git a/module/ci/model.php b/module/ci/model.php index 9a7728263f..91c3170d2c 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -18,12 +18,13 @@ class ciModel extends model public function setMenu() { $repoID = $this->session->repoID; - $projectID = $this->session->PRJ; + $projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0; $moduleName = $this->app->getModuleName(); foreach($this->lang->{$moduleName}->menu as $key => $menu) common::setMenuVars($this->lang->{$moduleName}->menu, $key, $repoID); $this->lang->{$moduleName}->menuOrder = $this->lang->ci->menuOrder; if(!$projectID) { + $this->lang->navGroup->repo = 'repo'; $this->lang->navGroup->jenkins = 'repo'; $this->lang->navGroup->job = 'repo'; $this->lang->navGroup->compile = 'repo'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 9c7b65d70f..b42b99c62d 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -130,9 +130,9 @@ $lang->common->common = '公有模块'; /* 主导航菜单。*/ $lang->mainNav = new stdclass(); $lang->mainNav->my = ' 地盘|my|index|'; -$lang->mainNav->program = ' 项目集|program|pgmbrowse|'; -$lang->mainNav->product = ' 产品|product|index|'; -$lang->mainNav->project = ' 项目|program|prjbrowse|'; +$lang->mainNav->program = ' 项目集|program|pgmproduct|'; +$lang->mainNav->product = ' 产品|product|browse|'; +$lang->mainNav->project = ' 项目|program|index|'; $lang->mainNav->repo = ' 代码|repo|browse|'; $lang->mainNav->doc = ' 文档|doc|index|'; $lang->mainNav->system = ' 组织|subject|browse|'; diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index b64e2b5d81..8f42c795be 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -20,9 +20,9 @@ include 'chosen.html.php';
-
- -
+ program->mainMenuAction) ? $lang->program->mainMenuAction : '';?> + loadModel('program')->getPRJMainAction($app->rawModule, $app->rawMethod);?> + product->mainMenuAction) ? $lang->product->mainMenuAction : '';?>
diff --git a/module/doc/control.php b/module/doc/control.php index 3d8e92227c..ce5f842a64 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -27,7 +27,7 @@ class doc extends control $this->loadModel('project'); $this->from = $this->cookie->from ? $this->cookie->from : 'doc'; $this->productID = $this->cookie->product ? $this->cookie->product : '0'; - $this->projectID = $this->session->PRJ; + $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0; if(!$this->projectID) $this->lang->navGroup->doc = 'doc'; } @@ -113,7 +113,10 @@ class doc extends control { $this->lang->navGroup->doc = 'product'; $this->lang->doc->menuOrder = $this->lang->product->menuOrder; - $this->product->setMenu($this->product->getPairs(), $lib->product); + $this->product->setMenu($this->product->getPairs(), $productID); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); + $this->lang->noMenuModule[] = 'doc'; $this->lang->set('menugroup.doc', 'product'); } elseif($from == 'project') @@ -343,10 +346,13 @@ class doc extends control /* According the from, set menus. */ if($this->from == 'product') { - $this->lang->navGroup->doc = 'project'; + $this->lang->navGroup->doc = 'product'; $this->lang->doc->menu = $this->lang->product->menu; $this->lang->doc->menuOrder = $this->lang->product->menuOrder; - $this->product->setMenu($this->product->getPairs(''), $lib->product); + $this->product->setMenu($this->product->getPairs(), $lib->product); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($lib->product); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); + $this->lang->noMenuModule[] = 'doc'; $this->lang->set('menugroup.doc', 'product'); $this->lang->TRActions = common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe' data-width='70%'") : ''; @@ -770,6 +776,9 @@ class doc extends control $this->lang->doc->menu = $this->lang->product->menu; $this->lang->doc->menuOrder = $this->lang->product->menuOrder; $this->product->setMenu($this->product->getPairs(), $objectID); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($objectID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); + $this->lang->noMenuModule[] = 'doc'; $this->lang->set('menugroup.doc', 'product'); } elseif($this->from == 'project') @@ -865,7 +874,9 @@ class doc extends control $this->lang->navGroup->doc = 'product'; $this->lang->doc->menuOrder = $this->lang->product->menuOrder; $this->product->setMenu($this->product->getPairs(), $objectID); - $this->lang->product->switcherMenu = $this->product->getSwitcher($objectID); + $this->lang->product->switcherMenu = $this->product->getSwitcher($objectID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); + $this->lang->noMenuModule[] = 'doc'; $this->lang->set('menugroup.doc', 'product'); } elseif($from == 'project') diff --git a/module/personnel/control.php b/module/personnel/control.php index c6d89d40a7..596ac922d2 100644 --- a/module/personnel/control.php +++ b/module/personnel/control.php @@ -216,8 +216,9 @@ class personnel extends control public function setProgramNavMenu($programID = 0) { $this->loadModel('program'); - $this->lang->navGroup->program = 'program'; - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID, true); + $this->lang->navGroup->program = 'program'; + $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); + $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); $this->program->setPGMViewMenu($programID); } } diff --git a/module/product/control.php b/module/product/control.php index bc9b9e5b96..13a41ca23f 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -49,7 +49,8 @@ class product extends control */ public function index($locate = 'auto', $productID = 0, $status = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 10, $pageID = 1) { - $this->lang->product->switcherMenu = $this->product->getSwitcher(); + $this->lang->product->switcherMenu = $this->product->getSwitcher(); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); if($locate == 'yes') $this->locate($this->createLink($this->moduleName, 'browse')); @@ -78,7 +79,8 @@ class product extends control public function project($status = 'all', $productID = 0, $branch = 0, $PRJMine = 0) { $this->product->setMenu($this->products, $productID, $branch); - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->app->loadLang('my'); $this->app->loadLang('program'); @@ -146,7 +148,8 @@ class product extends control $this->session->set('productList', $this->app->getURI(true)); $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->product->getSwitcher($productID, "storyType=$storyType", $branch); + $this->lang->product->switcherMenu = $this->product->getSwitcher($productID, "storyType=$storyType", $branch); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->product->setMenu($this->products, $productID, $branch); } @@ -256,7 +259,8 @@ class product extends control */ public function create($programID = 0) { - $this->lang->product->switcherMenu = $this->product->getSwitcher(); + $this->lang->product->switcherMenu = $this->product->getSwitcher(); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); if(!empty($_POST)) { @@ -279,7 +283,8 @@ class product extends control $this->app->rawMethod = 'pgmproduct'; $this->lang->navGroup->program = 'program'; $this->loadModel('program')->setPGMViewMenu($programID); - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID, true); + $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); + $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); } $this->loadModel('user'); @@ -321,7 +326,8 @@ class product extends control { $this->app->loadLang('custom'); $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); if(!empty($_POST)) { @@ -357,7 +363,8 @@ class product extends control $this->app->rawMethod = 'pgmproduct'; $this->lang->navGroup->program = 'program'; $this->loadModel('program')->setPGMViewMenu($programID); - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID, true); + $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); + $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); } $product = $this->product->getById($productID); @@ -441,7 +448,8 @@ class product extends control $this->app->rawMethod = 'pgmproduct'; $this->lang->navGroup->program = 'program'; $this->loadModel('program')->setPGMViewMenu($programID); - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID, true); + $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); + $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); $this->loadModel('user'); $poUsers = $this->user->getPairs('nodeleted|pofirst', $appendPoUsers); @@ -517,7 +525,8 @@ class product extends control if(!$product) die(js::error($this->lang->notFound) . js::locate('back')); $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $product->desc = $this->loadModel('file')->setImgSize($product->desc); $this->product->setMenu($this->products, $productID); @@ -578,7 +587,8 @@ class product extends control public function roadmap($productID, $branch = 0) { $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->product->setMenu($this->products, $productID, $branch); $this->session->set('releaseList', $this->app->getURI(true)); @@ -650,7 +660,8 @@ class product extends control $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $this->products[$productID]); $this->view->position[] = $this->lang->product->dynamic; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, $type); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, $type); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed|useid'); $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted|noclosed'); @@ -866,7 +877,8 @@ class product extends control public function whitelist($productID = 0, $module = 'product', $objectType = 'product', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', 0); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', 0); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->product->setMenu($this->products, $productID, 0); echo $this->fetch('personnel', 'whitelist', "objectID=$productID&module=product&browseType=$objectType&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"); @@ -884,7 +896,8 @@ class product extends control public function addWhitelist($productID = 0, $deptID = 0, $branch = '') { $this->lang->product->menu = $this->lang->product->viewMenu; - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch); + $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch); + $this->lang->product->mainMenuAction = $this->product->getProductMainAction(); $this->product->setMenu($this->products, $productID, $branch); $moduleIndex = array_search('product', $this->lang->noMenuModule); if($moduleIndex !== false) unset($this->lang->noMenuModule[$moduleIndex]); diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index 17e4082cdf..8ed545322f 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -45,6 +45,7 @@ $lang->product->roadmap = "{$lang->productCommon}路线图"; $lang->product->doc = '文档列表'; $lang->product->project = $lang->executionCommon . '列表'; $lang->product->build = '版本列表'; +$lang->product->moreProduct = "更多产品"; $lang->product->projectInfo = "所有与此产品关联的项目"; $lang->product->currentExecution = "当前{$lang->sprintCommon}"; diff --git a/module/product/model.php b/module/product/model.php index 63523ce0ee..955500a741 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -473,17 +473,6 @@ class productModel extends model $currentModule = $this->app->moduleName; $currentMethod = $this->app->methodName; - $active = empty($productID) ? 'active' : ''; - $output = "
"; - $output .= ''; - $output .= "
"; - - if($currentModule == 'product' && ($currentMethod == 'index' || $currentMethod == 'all' || $currentMethod == 'create')) return $output; - $this->loadModel('project'); $currentProductName = $this->lang->product->common; if($productID) @@ -495,7 +484,7 @@ class productModel extends model $active = isset($currentProduct->type) && $currentProduct->type != 'normal' ? '' : 'active'; $dropMenuLink = helper::createLink('product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra"); - $output .= "
{$this->lang->productCommon}