Merge branch 'zentaopms_239' of https://gitlab.zcorp.cc/easycorp/zentaopms into 239
This commit is contained in:
@@ -392,7 +392,8 @@ $lang->action->label->updatetolib = 'updated';
|
||||
$lang->action->label->ganttmove = 'sorted';
|
||||
$lang->action->label->submitreview = 'submitted';
|
||||
$lang->action->label->switchtolean = 'switch from new mode to lean mode';
|
||||
$lang->action->label->managerepo = 'Linked Code Repo';
|
||||
$lang->action->label->linkrepo = 'Linked Code Repo';
|
||||
$lang->action->label->unlinkrepo = 'Unlinked Code Repo';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
|
||||
@@ -392,7 +392,8 @@ $lang->action->label->updatetolib = 'updated';
|
||||
$lang->action->label->ganttmove = 'sorted';
|
||||
$lang->action->label->submitreview = 'submitted';
|
||||
$lang->action->label->switchtolean = 'switch from new mode to lean mode';
|
||||
$lang->action->label->managerepo = 'Linked Code Repo';
|
||||
$lang->action->label->linkrepo = 'Linked Code Repo';
|
||||
$lang->action->label->unlinkrepo = 'Unlinked Code Repo';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
|
||||
@@ -392,7 +392,8 @@ $lang->action->label->updatetolib = 'MàJ';
|
||||
$lang->action->label->ganttmove = 'sorted';
|
||||
$lang->action->label->submitreview = 'submitted';
|
||||
$lang->action->label->switchtolean = 'switch from new mode to lean mode';
|
||||
$lang->action->label->managerepo = 'Linked Code Repo';
|
||||
$lang->action->label->linkrepo = 'Linked Code Repo';
|
||||
$lang->action->label->unlinkrepo = 'Unlinked Code Repo';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
|
||||
@@ -306,7 +306,8 @@ $lang->action->label->syncproject = 'start';
|
||||
$lang->action->label->syncexecution = 'start';
|
||||
$lang->action->label->startProgram = '(The start of the project sets the status of the program as Ongoing)';
|
||||
$lang->action->label->submitreview = 'submitted';
|
||||
$lang->action->label->managerepo = 'Linked Code Repo';
|
||||
$lang->action->label->linkrepo = 'Linked Code Repo';
|
||||
$lang->action->label->unlinkrepo = 'Unlinked Code Repo';
|
||||
|
||||
/* Dynamic information is grouped by object. */
|
||||
$lang->action->dynamicAction = new stdclass;
|
||||
|
||||
@@ -392,7 +392,8 @@ $lang->action->label->updatetolib = '更新了';
|
||||
$lang->action->label->ganttmove = '排序了';
|
||||
$lang->action->label->submitreview = '提交了评审';
|
||||
$lang->action->label->switchtolean = '从综合模式切换为迅捷模式';
|
||||
$lang->action->label->managerepo = '关联了代码库';
|
||||
$lang->action->label->linkrepo = '关联了代码库';
|
||||
$lang->action->label->unlinkrepo = '取消关联代码库';
|
||||
|
||||
/* 动态信息按照对象分组 */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
|
||||
@@ -324,7 +324,8 @@ $lang->action->label->importfromgitlab = '從Gitlab關聯創建了';
|
||||
$lang->action->label->archived = '歸檔了';
|
||||
$lang->action->label->restore = '還原了';
|
||||
$lang->action->label->mergedbranch = '合併分支';
|
||||
$lang->action->label->managerepo = '關聯了代碼庫';
|
||||
$lang->action->label->linkrepo = '關聯了代碼庫';
|
||||
$lang->action->label->unlinkrepo = '取消關聯了代碼庫';
|
||||
|
||||
/* 動態信息按照對象分組 */
|
||||
$lang->action->dynamicAction = new stdclass();
|
||||
|
||||
+58
-24
@@ -2927,7 +2927,7 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Update linked repos.
|
||||
* Update linked repos. This method only for project without product.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $repos
|
||||
@@ -2936,27 +2936,67 @@ class projectModel extends model
|
||||
*/
|
||||
public function updateRepoRelations($projectID, $repos)
|
||||
{
|
||||
/* Delete old relations. */
|
||||
$this->dao->delete()->from(TABLE_RELATION)
|
||||
->where('AType')->eq('project')
|
||||
->andWhere('AID')->eq($projectID)
|
||||
->andWhere('BType')->eq('repo')
|
||||
->exec();
|
||||
$this->loadModel('action');
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Insert new relations. */
|
||||
foreach($repos as $repoID)
|
||||
$linkedRepos = $this->dao->select('*')->from(TABLE_REPO)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere("CONCAT(',', projects, ',')")->like("%,$projectID,%")
|
||||
->fetchAll('id');
|
||||
|
||||
/* 1. Delete old relations. */
|
||||
/* Get relations should be deleted. */
|
||||
$shouldDeleteRepos = array_diff(array_keys($linkedRepos), $repos);
|
||||
foreach($shouldDeleteRepos as $repoID)
|
||||
{
|
||||
$newRelation = new stdclass;
|
||||
$newRelation->AType = 'project';
|
||||
$newRelation->AID = $projectID;
|
||||
$newRelation->BType = 'repo';
|
||||
$newRelation->BID = $repoID;
|
||||
/* Remove project id form this repo. */
|
||||
$repo = zget($linkedRepos, $repoID, null);
|
||||
$oldProjects = explode(',', $repo->projects);
|
||||
$newProjects = array_filter($oldProjects, function($oldProjectID) use ($projectID)
|
||||
{
|
||||
return $projectID != $oldProjectID;
|
||||
});
|
||||
|
||||
$this->dao->insert(TABLE_RELATION)->data($newRelation)->exec();
|
||||
/* Remove products */
|
||||
$shadowProduct = $this->loadModel('product')->getShadowProductByProject($projectID);
|
||||
$oldProducts = explode(',', $repo->product);
|
||||
$newProducts = array_filter($oldProducts, function($oldProductID)use($shadowProduct)
|
||||
{
|
||||
return $oldProductID != $shadowProduct->id;
|
||||
});
|
||||
|
||||
$this->dao->update(TABLE_REPO)
|
||||
->set('product')->eq(implode(',', $newProducts))
|
||||
->set('projects')->eq(implode(',', $newProjects))
|
||||
->where('id')->eq($repo->id)->exec();
|
||||
|
||||
/* Save action log. */
|
||||
$this->action->create('project', $projectID, 'unlinkRepo', $repo->name);
|
||||
}
|
||||
|
||||
$this->loadModel('action');
|
||||
$this->action->create('project', $projectID, 'manageRepo');
|
||||
/* 2. Add new relations. */
|
||||
$products = $this->product->getProductPairsByProject($projectID); // There will be only one (shadow) product for project without product.
|
||||
$addedProducts = array_keys($products);
|
||||
|
||||
$addedRepos = array_diff($repos, array_keys($linkedRepos));
|
||||
$newRepos = $this->dao->select('*')->from(TABLE_REPO)->where('id')->in($addedRepos)->fetchAll();
|
||||
foreach($newRepos as $repo)
|
||||
{
|
||||
$oldProducts = explode(',', $repo->product);
|
||||
$newProducts = array_merge($oldProducts, $addedProducts);
|
||||
$newProducts = array_unique($newProducts);
|
||||
|
||||
$oldProjects = explode(',', $repo->projects);
|
||||
$oldProjects[] = $projectID;
|
||||
$newProjects = array_unique($oldProjects);
|
||||
|
||||
$this->dao->update(TABLE_REPO)
|
||||
->set('product')->eq(implode(',', $newProducts))
|
||||
->set('projects')->eq(implode(',', $newProjects))
|
||||
->where('id')->eq($repo->id)->exec();
|
||||
|
||||
$this->action->create('project', $projectID, 'linkRepo', $repo->name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2968,15 +3008,9 @@ class projectModel extends model
|
||||
*/
|
||||
public function linkedRepoPairs($projectID)
|
||||
{
|
||||
$repoIDList = $this->dao->select('BID')->from(TABLE_RELATION)
|
||||
->where('AType')->eq('project')
|
||||
->andWhere('AID')->eq($projectID)
|
||||
->andWhere('BType')->eq('repo')
|
||||
->fetchPairs('BID', 'BID');
|
||||
|
||||
$repos = $this->dao->select('*')->from(TABLE_REPO)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('id')->in($repoIDList)
|
||||
->andWhere("CONCAT(',', projects, ',')")->like("%,$projectID,%")
|
||||
->fetchAll();
|
||||
|
||||
$repoPairs = array();
|
||||
|
||||
+25
-32
@@ -146,16 +146,16 @@ class repo extends control
|
||||
$shadowProduct = null;
|
||||
if($this->app->tab == 'project' && $objectID) $shadowProduct = $this->loadModel('product')->getShadowProductByProject($objectID);
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted|noclosed');
|
||||
$this->view->products = $products;
|
||||
$this->view->projects = array();
|
||||
$this->view->productID = $productID;
|
||||
$this->view->serviceHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->shadowProduct = $shadowProduct;
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted|noclosed');
|
||||
$this->view->products = $products;
|
||||
$this->view->relatedProjects = array();
|
||||
$this->view->productID = $productID;
|
||||
$this->view->serviceHosts = $this->loadModel('gitlab')->getPairs();
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->shadowProduct = $shadowProduct;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -208,27 +208,20 @@ class repo extends control
|
||||
$this->view->projects = $options;
|
||||
}
|
||||
|
||||
$projectOptions = $this->repo->filterProject(explode(',', $repo->product), explode(',', $repo->projects));
|
||||
$products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
$linkedProducts = $this->loadModel('product')->getByIdList($repo->product);
|
||||
$linkedProductPairs = array_combine(array_keys($linkedProducts), array_column($linkedProducts, 'name'));
|
||||
$products = $products + $linkedProductPairs;
|
||||
|
||||
$shadowProduct = null;
|
||||
$productIDList = explode(',', $repo->product);
|
||||
/* Code repository linked only one project without product. */
|
||||
if(count($productIDList) == 1)
|
||||
{
|
||||
$shadowProduct = $this->loadModel('product')->getByID($productIDList[0]);
|
||||
$shadowProduct = $shadowProduct && $shadowProduct->shadow ? $shadowProduct : null;
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted|noclosed');
|
||||
$this->view->products = $objectID ? $this->loadModel('product')->getProductPairsByProject($objectID) : $this->loadModel('product')->getPairs();
|
||||
$this->view->projects = $projectOptions;
|
||||
$this->view->serviceHosts = array('' => '') + $this->loadModel('pipeline')->getPairs($repo->SCM);
|
||||
$this->view->shadowProduct = $shadowProduct;
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted|noclosed');
|
||||
$this->view->products = $products;
|
||||
$this->view->relatedProjects = $this->repo->filterProject(explode(',', $repo->product), explode(',', $repo->projects));
|
||||
$this->view->serviceHosts = array('' => '') + $this->loadModel('pipeline')->getPairs($repo->SCM);
|
||||
|
||||
$this->view->position[] = html::a(inlink('maintain'), $this->lang->repo->common);
|
||||
$this->view->position[] = $this->lang->repo->edit;
|
||||
@@ -1191,7 +1184,7 @@ class repo extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetDropMenu($repoID, $module = 'repo', $method = 'browse')
|
||||
public function ajaxGetDropMenu($repoID, $module = 'repo', $method = 'browse', $projectID = 0)
|
||||
{
|
||||
if($module == 'repo' and !in_array($method, array('review', 'diff'))) $method = 'browse';
|
||||
if($module == 'mr') $method = 'browse';
|
||||
@@ -1204,7 +1197,7 @@ class repo extends control
|
||||
}
|
||||
|
||||
/* Get repo group by type. */
|
||||
$repoGroup = $this->repo->getRepoGroup($this->app->tab);
|
||||
$repoGroup = $this->repo->getRepoGroup($this->app->tab, $projectID);
|
||||
if($module == 'mr')
|
||||
{
|
||||
foreach($repoGroup as $type => $group)
|
||||
|
||||
@@ -32,3 +32,7 @@
|
||||
.download-popover .table {margin-bottom: 0;}
|
||||
.download-popover .table td {padding-right: 0;}
|
||||
.download-popover .popover-title {padding: 8px;}
|
||||
|
||||
#mainMenu #swapper {padding: 0;}
|
||||
#mainMenu #swapper #currentItem {color: #313c52;}
|
||||
#mainMenu #swapper #currentItem:hover {color: #0b0f18; background-color: rgba(0, 0, 0, 0.075);}
|
||||
|
||||
@@ -91,7 +91,8 @@ class repoModel extends model
|
||||
return $output;
|
||||
}
|
||||
|
||||
$dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu', "repoID=$repoID&module=$currentModule&method=$currentMethod");
|
||||
$projectID = $this->app->tab == 'project' ? $this->get->objectID : 0;
|
||||
$dropMenuLink = helper::createLink('repo', 'ajaxGetDropMenu', "repoID=$repoID&module=$currentModule&method=$currentMethod&projectId=$projectID");
|
||||
|
||||
$output = "<div class='btn-group header-btn' id='swapper'><button data-toggle='dropdown' type='button' class='btn' id='currentItem' title='{$currentRepoName}'><span class='text'>{$currentRepoName}</span> <span class='caret' style='margin-bottom: -1px'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='$dropMenuLink'>";
|
||||
$output .= '<div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input" /><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div>'; $output .= "</div></div>";
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<?php if(!empty($branchesAndTags)):?>
|
||||
<?php if($this->app->tab == 'project'):?>
|
||||
<div class='btn-group'>
|
||||
<?php echo $this->repo->getSwitcher($repoID);?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class='btn-group'>
|
||||
<a href='javascript:;' class='btn btn-link btn-limit text-ellipsis' data-toggle='dropdown' style="max-width: 120px;"><span class='text' title='<?php echo $branchesAndTags[$branchID];?>'><?php echo $branchesAndTags[$branchID];?></span> <span class='caret'></span></a>
|
||||
<div id='dropMenuBranch' class='dropdown-menu search-list' data-ride='searchList' data-url=''>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
<form id='repoForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<?php if($shadowProduct):?>
|
||||
<?php if($this->app->tab =='project' and $shadowProduct):?>
|
||||
<?php echo html::hidden('product[]', $shadowProduct->id);?>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
@@ -32,7 +32,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->projects;?></th>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $projects, array(), "class='form-control chosen' multiple");?></td>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $relatedProjects, array(), "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
|
||||
@@ -27,18 +27,14 @@
|
||||
</div>
|
||||
<form id='repoForm' method='post' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<?php if($shadowProduct):?>
|
||||
<?php echo html::hidden('product[]', $shadowProduct->id);?>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->product;?></th>
|
||||
<td class='required'><?php echo html::select('product[]', $products, $repo->product, "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->repo->projects;?></th>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $projects, $repo->projects, "class='form-control chosen' multiple");?></td>
|
||||
<td id='projectContainer'><?php echo html::select('projects[]', $relatedProjects, $repo->projects, "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->repo->type;?></th>
|
||||
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, $repo->SCM, "onchange='scmChanged(this.value)' class='form-control chosen'");?></td>
|
||||
|
||||
Reference in New Issue
Block a user