From c2513ccc92b7fe11a03e146a02f0593cd43da1a0 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 9 Dec 2021 07:12:35 +0000 Subject: [PATCH] * Adjust codes. --- module/gitlab/control.php | 25 ++++++++++++-------- module/gitlab/js/browsebranchpriv.js | 2 +- module/gitlab/model.php | 15 ++++++------ module/gitlab/view/browsebranchpriv.html.php | 10 ++++---- module/gitlab/view/createbranchpriv.html.php | 10 ++++---- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index e359263c64..2c010170ce 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -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 */ diff --git a/module/gitlab/js/browsebranchpriv.js b/module/gitlab/js/browsebranchpriv.js index 33077a1755..359b60ab85 100644 --- a/module/gitlab/js/browsebranchpriv.js +++ b/module/gitlab/js/browsebranchpriv.js @@ -10,7 +10,7 @@ $(document).ready(function() }) }); - +// Trigger filtering function. function triggerSearch() { $("#branchPrivForm").submit(); diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 5f061ba251..d1cb27bf25 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -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 */ diff --git a/module/gitlab/view/browsebranchpriv.html.php b/module/gitlab/view/browsebranchpriv.html.php index aac65f7b7e..9ef6455f88 100644 --- a/module/gitlab/view/browsebranchpriv.html.php +++ b/module/gitlab/view/browsebranchpriv.html.php @@ -1,10 +1,10 @@ + * @author Yanyi Cao * @package gitlab * @version $Id$ * @link http://www.zentao.net @@ -21,8 +21,8 @@
- gitlab->branch->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?> - gitlab->search?> + gitlab->branch->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?> + gitlab->search?>
diff --git a/module/gitlab/view/createbranchpriv.html.php b/module/gitlab/view/createbranchpriv.html.php index 25cd246d53..e5589fe36c 100644 --- a/module/gitlab/view/createbranchpriv.html.php +++ b/module/gitlab/view/createbranchpriv.html.php @@ -1,10 +1,10 @@ + * @author Yanyi Cao * @package gitlab * @version $Id$ * @link http://www.zentao.net @@ -26,11 +26,11 @@ gitlab->branch->mergeAllowed;?> - gitlab->branch->branchCreationLevelList, $branchPriv->merge_access_level, "class='form-control'");?> + gitlab->branch->branchCreationLevelList, $branchPriv->mergeAccessLevel, "class='form-control'");?> gitlab->branch->pushAllowed;?> - gitlab->branch->branchCreationLevelList, $branchPriv->push_access_level, "class='form-control'");?> + gitlab->branch->branchCreationLevelList, $branchPriv->pushAccessLevel, "class='form-control'");?>