* Adjust codes.

This commit is contained in:
caoyanyi
2021-12-09 07:12:35 +00:00
parent 60e6727f35
commit c2513ccc92
5 changed files with 33 additions and 29 deletions
+15 -10
View File
@@ -713,10 +713,11 @@ class gitlab extends control
}
/**
* Browse gitlab branch priv.
* Browse gitlab protect branch.
*
* @param int $gitlabID
* @param string $keyword
* @param int $projectID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
@@ -735,7 +736,7 @@ class gitlab extends control
$pager = new pager($recTotal, $recPerPage, $pageID);
$branchList = array_chunk($branches, $pager->recPerPage);
$this->view->keyword = urldecode(urldecode($keyword));
$this->view->keyword = $keyword;
$this->view->pager = $pager;
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseBranchPriv;
$this->view->levelLang = $this->lang->gitlab->branch->branchCreationLevelList;
@@ -748,7 +749,7 @@ class gitlab extends control
}
/**
* Set a gitlab branch protect.
* Set a gitlab protect branch.
*
* @param int $gitlabID
* @param int $projectID
@@ -766,10 +767,11 @@ class gitlab extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseBranchPriv', "gitlabID=$gitlabID&projectID=$projectID")));
}
// Initialize data, and the operation authority is the maintainers by default.
$branchPriv = new stdClass();
$branchPriv->name = '';
$branchPriv->merge_access_level = 40;
$branchPriv->push_access_level = 40;
$branchPriv->mergeAccessLevel = 40;
$branchPriv->pushAccessLevel = 40;
$gitlab = $this->gitlab->getByID($gitlabID);
$title = $this->lang->gitlab->createBranchPriv;
@@ -778,8 +780,8 @@ class gitlab extends control
{
$title = $this->lang->gitlab->editBranchPriv;
$branchPriv = $this->gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
$branchPriv->merge_access_level = $this->gitlab->checkAccessLevel($branchPriv->merge_access_levels);
$branchPriv->push_access_level = $this->gitlab->checkAccessLevel($branchPriv->push_access_levels);
$branchPriv->mergeAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->merge_access_levels);
$branchPriv->pushAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->push_access_levels);
}
$gitlabBranches = $this->gitlab->apiGetBranches($gitlabID, $projectID);
@@ -787,7 +789,8 @@ class gitlab extends control
$protectNames = array_keys($protectBranches);
$branches = array();
foreach($gitlabBranches as $oneBranch) {
foreach($gitlabBranches as $oneBranch)
{
if(!in_array($oneBranch->name, $protectNames) || $oneBranch->name == $branch) $branches[$oneBranch->name] = $oneBranch->name;
}
@@ -817,10 +820,12 @@ class gitlab extends control
}
/**
* Delete a gitlab branch priv.
* Delete a gitlab protect branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @param string $confirm
* @access public
* @return void
*/
+1 -1
View File
@@ -10,7 +10,7 @@ $(document).ready(function()
})
});
// Trigger filtering function.
function triggerSearch()
{
$("#branchPrivForm").submit();
+7 -8
View File
@@ -2289,13 +2289,12 @@ class gitlabModel extends model
}
/**
* Get branch priv of one project.
* Get protect branches of one project.
*
* @param int $gitlabID
* @param int $projectID
* @param string $keyword
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -2321,7 +2320,7 @@ class gitlabModel extends model
}
/**
* Get single branch priv by API.
* Get single protct branch by API.
*
* @param int $gitlabID
* @param int $projectID
@@ -2336,7 +2335,7 @@ class gitlabModel extends model
}
/**
* Create gitlab branch priv.
* Create gitlab potect branch.
*
* @param int $gitlabID
* @param int $projectID
@@ -2382,11 +2381,11 @@ class gitlabModel extends model
}
/**
* Delete a gitab branch priv by api.
* Delete a gitab protect branch by api.
*
* @param int $gitlabID
* @param int $groupID
* @param int $memberID
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return object
*/
+5 -5
View File
@@ -1,10 +1,10 @@
<?php
/**
* The browse view file of gitlab branch priv of ZenTaoPMS.
* The browse view file of gitlab protext branch of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
* @package gitlab
* @version $Id$
* @link http://www.zentao.net
@@ -21,8 +21,8 @@
<div class="btn-toolbar pull-left">
<div>
<form id='branchPrivForm' method='post'>
<?php echo html::input('keyword', $keyword, "class='form-control' placeholder='{$lang->gitlab->branch->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?>
<a id="branchSearch" class="btn btn-primary"><?php echo $lang->gitlab->search?></a>
<?php echo html::input('keyword', $keyword, "class='form-control' placeholder='{$lang->gitlab->branch->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?>
<a id="branchSearch" class="btn btn-primary"><?php echo $lang->gitlab->search?></a>
</form>
</div>
</div>
+5 -5
View File
@@ -1,10 +1,10 @@
<?php
/**
* The create view file of gitlab module of ZenTaoPMS.
* The create view file of protext branch of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
* @package gitlab
* @version $Id$
* @link http://www.zentao.net
@@ -26,11 +26,11 @@
</tr>
<tr>
<th><?php echo $lang->gitlab->branch->mergeAllowed;?></th>
<td><?php echo html::select('merge_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->merge_access_level, "class='form-control'");?></td>
<td><?php echo html::select('merge_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->mergeAccessLevel, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->branch->pushAllowed;?></th>
<td><?php echo html::select('push_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->push_access_level, "class='form-control'");?></td>
<td><?php echo html::select('push_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->pushAccessLevel, "class='form-control'");?></td>
</tr>
<tr>
<th></th>