* Fix repo.
This commit is contained in:
+14
-8
@@ -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")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user