From 91642e47a296668f03add3bb11fef299460ce25e Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 23 Mar 2021 14:07:35 +0800 Subject: [PATCH] * Fix repo menu. --- module/ci/model.php | 5 +---- module/common/lang/menu.php | 20 ++++++++++---------- module/common/lang/zh-cn.php | 1 + module/index/js/index.js | 4 ---- module/repo/control.php | 18 +++++++++++++----- module/repo/model.php | 24 ++++++++++++++++-------- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/module/ci/model.php b/module/ci/model.php index f86c6ce357..46ff711cc9 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -17,10 +17,7 @@ class ciModel extends model */ public function setMenu() { - $repoID = $this->session->repoID; - $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; + common::setMenuVars('devops', $this->session->repoID); } /** diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 8b2808347a..e1a9ee554f 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -6,7 +6,7 @@ $lang->navIcons['product'] = ""; $lang->navIcons['project'] = ""; $lang->navIcons['execution'] = ""; $lang->navIcons['qa'] = ""; -$lang->navIcons['devops'] = ""; +$lang->navIcons['devops'] = ""; $lang->navIcons['doc'] = ""; $lang->navIcons['report'] = ""; $lang->navIcons['system'] = ""; @@ -171,7 +171,7 @@ $lang->scrum->menu->execution = array('link' => "$lang->executionCommon|project| $lang->scrum->menu->story = array('link' => "$lang->SRCommon|projectstory|story|projectID=%s", 'alias' => 'story,track'); $lang->scrum->menu->doc = array('link' => "{$lang->doc->common}|doc|objectLibs|type=project&objectID=%s", 'subModule' => 'doc'); $lang->scrum->menu->qa = array('link' => "{$lang->qa->common}|project|qa|projectID=%s", 'subModule' => 'testcase,testtask,bug', 'alias' => 'bug,testtask,testcase'); -$lang->scrum->menu->devops = array('link' => "{$lang->devops->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->scrum->menu->devops = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); $lang->scrum->menu->build = array('link' => "{$lang->build->common}|project|build|project=%s"); $lang->scrum->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|project=%s", 'subModule' => 'projectrelease'); $lang->scrum->menu->dynamic = array('link' => "$lang->dynamic|project|dynamic|project=%s"); @@ -213,7 +213,7 @@ $lang->waterfall->menu->doc = array('link' => "{$lang->doc->common}|doc| $lang->waterfall->menu->weekly = array('link' => "{$lang->project->report}|weekly|index|project=%s", 'subModule' => ',milestone,'); $lang->waterfall->menu->story = array('link' => "$lang->SRCommon|projectstory|story|project=%s"); $lang->waterfall->menu->design = array('link' => "$lang->design|design|browse|product=0&project=%s"); -$lang->waterfall->menu->repo = array('link' => "{$lang->devops->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->waterfall->menu->repo = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); $lang->waterfall->menu->track = array('link' => "$lang->track|projectstory|track", 'alias' => 'track'); $lang->waterfall->menu->qa = array('link' => "{$lang->qa->common}|project|qa|projectID=%s", 'subModule' => 'testcase,testtask,bug', 'alias' => 'bug,testtask,testcase'); $lang->waterfall->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse", 'subModule' => 'projectrelease'); @@ -264,7 +264,7 @@ $lang->execution->menu->burn = array('link' => "$lang->burn|execution|burn|e $lang->execution->menu->view = array('link' => "$lang->view|execution|grouptask|executionID=%s", 'alias' => 'grouptask,tree', 'class' => 'dropdown dropdown-hover'); $lang->execution->menu->story = array('link' => "$lang->SRCommon|execution|story|executionID=%s", 'subModule' => 'story', 'alias' => 'linkstory,storykanban'); $lang->execution->menu->qa = array('link' => "{$lang->qa->common}|execution|qa|executionID=%s", 'subModule' => 'bug', 'alias' => 'qa,bug,testcase,testtask,testreport'); -$lang->execution->menu->repo = array('link' => "{$lang->devops->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); +$lang->execution->menu->repo = array('link' => "{$lang->repo->common}|repo|browse|repoID=0&objectID=%s", 'subModule' => 'repo'); $lang->execution->menu->doc = array('link' => "{$lang->doc->common}|doc|objectLibs|type=execution&objectID=%s", 'subModule' => 'doc'); $lang->execution->menu->build = array('link' => "{$lang->build->common}|execution|build|executionID=%s", 'subModule' => 'build'); $lang->execution->menu->release = array('link' => "{$lang->release->common}|projectrelease|browse|projectID=0&executionID=%s", 'subModule' => 'projectrelease'); @@ -346,7 +346,7 @@ $lang->qa->menu->automation['subMenu']->browse = array('link' => "{$lang->i /* DevOps menu. */ $lang->devops->menu = new stdclass(); -$lang->devops->menu->code = array('link' => "{$lang->devops->common}|repo|browse|repoID=%s", 'alias' => 'diff,view,revision,log,blame,showsynccomment'); +$lang->devops->menu->code = array('link' => "{$lang->repo->common}|repo|browse|repoID=%s", 'alias' => 'diff,view,revision,log,blame,showsynccomment'); $lang->devops->menu->compile = array('link' => "{$lang->devops->compile}|job|browse", 'subModule' => 'compile,job'); $lang->devops->menu->jenkins = array('link' => "Jenkins|jenkins|browse", 'alias' => 'create,edit'); $lang->devops->menu->maintain = array('link' => "{$lang->devops->repo}|repo|maintain", 'alias' => 'create,edit'); @@ -517,9 +517,6 @@ $lang->navGroup->cm = 'project'; $lang->navGroup->nc = 'project'; $lang->navGroup->projectrelease = 'project'; $lang->navGroup->build = 'project'; -$lang->navGroup->job = 'project'; -$lang->navGroup->jenkins = 'project'; -$lang->navGroup->compile = 'project'; $lang->navGroup->measrecord = 'project'; $lang->navGroup->execution = 'execution'; @@ -536,8 +533,11 @@ $lang->navGroup->testcase = 'qa'; $lang->navGroup->testtask = 'qa'; $lang->navGroup->automation = 'qa'; -$lang->navGroup->devops = 'devops'; -$lang->navGroup->repo = 'devops'; +$lang->navGroup->devops = 'devops'; +$lang->navGroup->repo = 'devops'; +$lang->navGroup->job = 'devops'; +$lang->navGroup->jenkins = 'devops'; +$lang->navGroup->compile = 'devops'; $lang->navGroup->company = 'system'; $lang->navGroup->sqlbuilder = 'system'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 36f6bae2e2..7620f5a34b 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -134,6 +134,7 @@ $lang->execution->common = $config->systemMode == 'new' ? '执行' : $lang->exe $lang->qa->common = '测试'; $lang->devops->common = 'DevOps'; $lang->doc->common = '文档'; +$lang->repo->common = '代码'; $lang->report->common = '统计'; $lang->system->common = '组织'; $lang->admin->common = '后台'; diff --git a/module/index/js/index.js b/module/index/js/index.js index b50dc34c8c..ea86e26cab 100644 --- a/module/index/js/index.js +++ b/module/index/js/index.js @@ -98,10 +98,6 @@ { return (link.params.from || link.params.$3) == 'project' ? 'project' : 'execution'; } - if(['repo', 'jenkins', 'job', 'compile'].includes(moduleName)) - { - return link.prj ? 'project' : 'repo'; - } if(moduleName === 'product') { if(methodLowerCase === 'create' && (link.params.programID || link.params.$1)) return 'program'; diff --git a/module/repo/control.php b/module/repo/control.php index 2c7d4943c3..fcb2ab7dfa 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -74,13 +74,17 @@ class repo extends control public function maintain($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $repoID = $this->session->repoID; + $this->commonAction($repoID); $this->repo->setMenu($this->repos, $repoID, false); if(common::hasPriv('repo', 'create')) $this->lang->TRActions = html::a(helper::createLink('repo', 'create'), " " . $this->lang->repo->create, '', "class='btn btn-primary'"); - $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage, $pageID); + $repoList = $this->repo->getList(0, $orderBy); - $this->view->repoList = $this->repo->getList($this->projectID, $orderBy, $pager); + /* Pager. */ + $this->app->loadClass('pager', $static = true); + $recTotal = count($repoList); + $pager = new pager($recTotal, $recPerPage, $pageID); + $repoList = array_chunk($repoList, $pager->recPerPage); $this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->browse; $this->view->position[] = $this->lang->repo->common; @@ -89,7 +93,8 @@ class repo extends control $this->view->repoID = $repoID; $this->view->orderBy = $orderBy; $this->view->pager = $pager; - $this->view->products = $this->projectID ? $this->loadModel('product')->getProductPairsByProject($this->projectID) : $this->loadModel('product')->getPairs(); + $this->view->repoList = empty($repoList) ? $repoList: $repoList[$pageID - 1];; + $this->view->products = $this->loadModel('product')->getPairs(); $this->display(); } @@ -311,6 +316,7 @@ class repo extends control $this->commonAction($objectID); /* Get path and refresh. */ + $path = ''; if($this->get->repoPath) $path = $this->get->repoPath; if(empty($refresh) and $this->cookie->repoRefresh) $refresh = $this->cookie->repoRefresh; @@ -757,7 +763,9 @@ class repo extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('setRules'))); } - $this->repo->setMenu($this->repos, $this->session->repoID, false); + $repoID = $this->session->repoID; + $this->commonAction($repoID); + $this->repo->setMenu($this->repos, $repoID, false); $this->app->loadLang('task'); $this->app->loadLang('bug'); diff --git a/module/repo/model.php b/module/repo/model.php index 7c436029a7..08a046df84 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -35,6 +35,7 @@ class repoModel extends model */ public function setMenu($repos, $repoID = '', $showSeleter = true) { + if(empty($repos)) $this->lang->switcherMenu = ''; if(empty($repoID)) $repoID = $this->session->repoID ? $this->session->repoID : key($repos); if(!isset($repos[$repoID])) $repoID = key($repos); @@ -57,7 +58,7 @@ class repoModel extends model if($showSeleter && !empty($repos)) { - $repoIndex = '