diff --git a/module/repo/control.php b/module/repo/control.php index 19112b493c..972c19541a 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -1662,13 +1662,16 @@ class repo extends control $method = 'review'; } + $params = ''; + if($projectID && $method == 'browse') $params = "&branchID=&objectID=$projectID"; + /* Get repo group by type. */ $repoType = $module == 'mr' ? 'git' : ''; $repoGroup = $this->repo->getRepoGroup('project', $projectID, $repoType); $this->view->repoID = $repoID; $this->view->repoGroup = $repoGroup; - $this->view->link = $this->createLink($module, $method, "repoID=%s"); + $this->view->link = $this->createLink($module, $method, "repoID=%s" . $params) . ($projectID ? '#app=project' : ''); $this->display(); } diff --git a/module/repo/css/browse.ui.css b/module/repo/css/browse.ui.css index 6d95914336..4f57d8aa70 100644 --- a/module/repo/css/browse.ui.css +++ b/module/repo/css/browse.ui.css @@ -1,8 +1,11 @@ .repo-downloadCode{margin: 8px 10px 8px 0;} .repo-select{margin-right: 10px;} +.repo-select>div {display: inline-block;} .repo-comment{width: 100%; display: block; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;} .dtable-cell-html{width: 100%;} .container .sidebar{width: 550px;} #actionBar .dropdown-menu {margin-top: 10px; padding: 10px; display: none;} #actionBar .dropdown-menu.show{display: block;} -#actionBar>.dropdown {position: absolute!important;} \ No newline at end of file +#actionBar>.dropdown {position: absolute!important;} + +#repoDropmenu .icon-angle-right {display: none;} diff --git a/module/repo/model.php b/module/repo/model.php index b6f4ba715f..a67b47d912 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -541,9 +541,16 @@ class repoModel extends model ->fetchAll(); $productIds = $productItems = array(); - foreach($repos as $repo) + if($projectID) { - $productIds = array_merge($productIds, explode(',', $repo->product)); + $productIds = $this->loadModel('product')->getProductIDByProject($projectID, false); + } + else + { + foreach($repos as $repo) + { + $productIds = array_merge($productIds, explode(',', $repo->product)); + } } $products = $this->loadModel('product')->getByIdList(array_filter(array_unique($productIds))); foreach($products as $productID => $product) diff --git a/module/repo/ui/browse.html.php b/module/repo/ui/browse.html.php index 4e0eb67b8f..a24cefe5a6 100644 --- a/module/repo/ui/browse.html.php +++ b/module/repo/ui/browse.html.php @@ -77,6 +77,13 @@ featureBar( ( set::className('repo-select'), set::required(true), + $app->tab == 'project' ? dropmenu + ( + set::id('repoDropmenu'), + set::module('repo'), + set::text($repo->name), + set::url(createLink('repo', 'ajaxGetDropMenu', "repoID={$repo->id}&module=repo&method=browse&projectID={$objectID}")) + ) : null, dropmenu ( setID('repoBranchDropMenu'), diff --git a/module/repo/zen.php b/module/repo/zen.php index 81468313af..e896586aab 100644 --- a/module/repo/zen.php +++ b/module/repo/zen.php @@ -374,11 +374,12 @@ class repoZen extends repo } } } - if($cacheFile) file_put_contents($cacheFile, serialize($infos), LOCK_EX); + if($cacheFile && !empty($infos)) file_put_contents($cacheFile, serialize($infos), LOCK_EX); } else { $infos = unserialize(file_get_contents($cacheFile)); + if(empty($infos)) unlink($cacheFile); } foreach($infos as $info)