* Fix repo.

This commit is contained in:
zhujinyong
2021-03-22 08:59:20 +08:00
parent cb0d8872c2
commit 6231771f6c
2 changed files with 18 additions and 11 deletions
+14 -8
View File
@@ -35,25 +35,31 @@ class repo extends control
* Common actions.
*
* @param int $objectID projectID|executionID
* @param int $repoID
* @access public
* @return void
*/
public function commonAction($objectID)
public function commonAction($objectID, $repoID = 0)
{
if($this->app->openApp == 'project')
{
/* Set repo menu group. */
$this->scm = $this->app->loadClass('scm');
$this->repos = $this->repo->getRepoPairs($objectID);
if(empty($this->repos) and $this->methodName != 'create') die(js::locate($this->repo->createLink('create', "objectID=$objectID")));
$openApp = $this->app->openApp;
$this->repos = $this->repo->getRepoPairs($openApp, $objectID);
$this->scm = $this->app->loadClass('scm');
if($openApp == 'project')
{
$this->loadModel('project')->setMenu($objectID);
}
else if($this->app->openApp == 'execution')
else if($openApp == 'execution')
{
$executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode');
$this->execution->setMenu($executions, $objectID);
}
else
{
$this->repo->setMenu($repos, $repoID);
}
if(empty($this->repos) and $this->methodName != 'create') die(js::locate($this->repo->createLink('create', "objectID=$objectID")));
}
/**
+4 -3
View File
@@ -285,18 +285,19 @@ class repoModel extends model
/**
* Get repo pairs.
*
* @param string $type project|execution|repo
* @param int $projectID
* @access public
* @return array
*/
public function getRepoPairs($projectID = 0)
public function getRepoPairs($type, $projectID = 0)
{
$repos = $this->dao->select('*')->from(TABLE_REPO)
->where('deleted')->eq(0)
->fetchAll();
/* Get products. */
$productIdList = $this->loadModel('product')->getProductIDByProject($projectID, false);
$productIdList = ($type == 'project' or $type == 'execution') ? $this->loadModel('product')->getProductIDByProject($projectID, false) : array();
$repoPairs = array();
foreach($repos as $repo)
@@ -305,7 +306,7 @@ class repoModel extends model
$scm = $repo->SCM == 'Subversion' ? 'svn' : 'git';
if($this->checkPriv($repo))
{
if($projectID)
if($type == 'project' or $type == 'execution')
{
foreach($productIdList as $productID)
{