Merge branch 'cyy_gitea' into 'master'

Add Gitea module.

See merge request easycorp/zentaopms!4390
This commit is contained in:
李玉春
2022-07-07 01:56:40 +00:00
28 changed files with 832 additions and 13 deletions
+3 -3
View File
@@ -43,6 +43,7 @@ $lang->report = new stdclass();
$lang->repo = new stdclass();
$lang->jenkins = new stdclass();
$lang->gitlab = new stdclass();
$lang->gitea = new stdclass();
$lang->mr = new stdclass();
$lang->compile = new stdclass();
$lang->job = new stdclass();
@@ -175,8 +176,7 @@ $lang->createIcons['program'] = 'program';
$lang->createIcons['kanbanspace'] = 'cube';
$lang->createIcons['kanban'] = 'kanban';
$lang->refreshIcon = "<i class='icon icon-refresh'></i>";
$lang->noMenuModule = array('report', 'my', 'todo', 'effort', 'program', 'product', 'execution', 'task', 'build', 'productplan', 'project', 'projectrelease', 'projectstory', 'story', 'branch', 'release', 'attend', 'leave', 'makeup', 'overtime', 'lieu', 'custom', 'admin', 'mail', 'extension', 'dev', 'backup', 'action', 'cron', 'pssp', 'sms', 'message', 'webhook', 'search', 'score', 'stage', 'entry', 'jenkins', 'gitlab');
$lang->refreshIcon = "<i class='icon icon-refresh'></i>";
$lang->noMenuModule = array('report', 'my', 'todo', 'effort', 'program', 'product', 'execution', 'task', 'build', 'productplan', 'project', 'projectrelease', 'projectstory', 'story', 'branch', 'release', 'attend', 'leave', 'makeup', 'overtime', 'lieu', 'custom', 'admin', 'mail', 'extension', 'dev', 'backup', 'action', 'cron', 'pssp', 'sms', 'message', 'webhook', 'search', 'score', 'stage', 'entry', 'jenkins', 'gitlab', 'gitea');
if(isset($_SESSION['tutorialMode']) and $_SESSION['tutorialMode'] and !defined('TUTORIAL')) define('TUTORIAL', true);
+3 -1
View File
@@ -399,7 +399,7 @@ $lang->devops->menu->code = array('link' => "{$lang->repo->common}|repo|brows
$lang->devops->menu->mr = array('link' => "{$lang->devops->mr}|mr|browse|repoID=%s");
$lang->devops->menu->compile = array('link' => "{$lang->devops->compile}|job|browse|repoID=%s", 'subModule' => 'compile,job');
$lang->devops->menu->app = array('link' => "{$lang->app->common}|app|serverlink|%s");
$lang->devops->menu->set = array('link' => "{$lang->devops->set}|repo|maintain", 'subModule' => 'gitlab,jenkins,sonarqube', 'alias' => 'setrules,create,edit');
$lang->devops->menu->set = array('link' => "{$lang->devops->set}|repo|maintain", 'subModule' => 'gitlab,jenkins,sonarqube,gitea', 'alias' => 'setrules,create,edit');
$lang->devops->menuOrder[5] = 'code';
$lang->devops->menuOrder[10] = 'mr';
@@ -412,6 +412,7 @@ $lang->devops->dividerMenu = ',set,';
$lang->devops->menu->set['subMenu'] = new stdclass();
$lang->devops->menu->set['subMenu']->repo = array('link' => "{$lang->devops->repo}|repo|maintain", 'alias' => 'create,edit');
$lang->devops->menu->set['subMenu']->gitlab = array('link' => 'GitLab|gitlab|browse', 'subModule' => 'gitlab');
$lang->devops->menu->set['subMenu']->gitea = array('link' => 'Gitea|gitea|browse', 'subModule' => 'gitea');
$lang->devops->menu->set['subMenu']->jenkins = array('link' => 'Jenkins|jenkins|browse', 'subModule' => '');
$lang->devops->menu->set['subMenu']->sonarqube = array('link' => 'SonarQube|sonarqube|browse', 'subModule' => 'sonarqube');
$lang->devops->menu->set['subMenu']->setrules = array('link' => "{$lang->devops->rules}|repo|setrules");
@@ -645,6 +646,7 @@ $lang->navGroup->job = 'devops';
$lang->navGroup->jenkins = 'devops';
$lang->navGroup->mr = 'devops';
$lang->navGroup->gitlab = 'devops';
$lang->navGroup->gitea = 'devops';
$lang->navGroup->sonarqube = 'devops';
$lang->navGroup->sonarqubeproject = 'devops';
$lang->navGroup->compile = 'devops';
+6
View File
@@ -0,0 +1,6 @@
<?php
$config->gitea->create = new stdclass;
$config->gitea->create->requiredFields = 'name,url,token';
$config->gitea->edit = new stdclass;
$config->gitea->edit->requiredFields = 'name,url,token';
+167
View File
@@ -0,0 +1,167 @@
<?php
/**
* The control file of gitea module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Chenqi <chenqi@cnezsoft.com>
* @package product
* @version $Id: ${FILE_NAME} 5144 2020/1/8 8:10 下午 chenqi@cnezsoft.com $
* @link http://www.zentao.net
*/
class gitea extends control
{
/**
* The gitea constructor.
* @param string $moduleName
* @param string $methodName
*/
public function __construct($moduleName = '', $methodName = '')
{
parent::__construct($moduleName, $methodName);
/* This is essential when changing tab(menu) from gitea to repo. */
/* Optional: common::setMenuVars('devops', $this->session->repoID); */
$this->loadModel('ci')->setMenu();
}
/**
* Browse gitea.
*
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browse($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Admin user don't need bind. */
$giteaList = $this->gitea->getList($orderBy, $pager);
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->browse;
$this->view->giteaList = $giteaList;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->display();
}
/**
* Create a gitea.
*
* @access public
* @return void
*/
public function create()
{
if($_POST)
{
$this->checkToken();
$giteaID = $this->gitea->create();
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$actionID = $this->loadModel('action')->create('gitea', $giteaID, 'created');
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->lblCreate;
$this->display();
}
/**
* View a gitea.
* @param int $giteaID
* @access public
* @return void
*/
public function view($giteaID)
{
$gitea = $this->gitea->getByID($giteaID);
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->view;
$this->view->gitea = $gitea;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->actions = $this->loadModel('action')->getList('gitea', $giteaID);
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('pipeline', $giteaID);
$this->display();
}
/**
* Edit a gitea.
*
* @param int $giteaID
* @access public
* @return void
*/
public function edit($giteaID)
{
$oldGitea = $this->gitea->getByID($giteaID);
if($_POST)
{
$this->checkToken();
$this->gitea->update($giteaID);
$gitea = $this->gitea->getByID($giteaID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action');
$actionID = $this->action->create('gitea', $giteaID, 'edited');
$changes = common::createChanges($oldGitea, $gitea);
$this->action->logHistory($actionID, $changes);
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
}
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->edit;
$this->view->gitea = $oldGitea;
$this->display();
}
/**
* Delete a gitea.
*
* @param int $giteaID
* @access public
* @return void
*/
public function delete($giteaID, $confirm = 'no')
{
if($confirm != 'yes') return print(js::confirm($this->lang->gitea->confirmDelete, inlink('delete', "id=$giteaID&confirm=yes")));
$oldGitea = $this->gitea->getByID($giteaID);
$this->gitea->delete(TABLE_PIPELINE, $giteaID);
$actionID = $this->dao->lastInsertID();
$gitea = $this->gitea->getByID($giteaID);
$changes = common::createChanges($oldGitea, $gitea);
$this->loadModel('action')->logHistory($actionID, $changes);
return print(js::reload('parent'));
}
/**
* Check post token has admin permissions.
*
* @access protected
* @return void
*/
protected function checkToken()
{
$gitea = fixer::input('post')->trim('url,token')->get();
$this->dao->update('gitea')->data($gitea)->batchCheck($this->config->gitea->create->requiredFields, 'notempty');
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$result = $this->gitea->checkTokenAccess($gitea->url, $gitea->token);
if($result === false) return $this->send(array('result' => 'fail', 'message' => array('url' => array($this->lang->gitea->hostError))));
if(!$result) return $this->send(array('result' => 'fail', 'message' => array('token' => array($this->lang->gitea->tokenLimit))));
return true;
}
}
+2
View File
@@ -0,0 +1,2 @@
.c-id {width: 60px;}
.c-name {width: 200px;}
+2
View File
@@ -0,0 +1,2 @@
#publicTip {padding-left: 10px;}
.table-form>tbody>tr>th {width: 110px;}
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = 'Gitea Browse';
$lang->gitea->search = 'Search';
$lang->gitea->create = 'Create Gitea';
$lang->gitea->edit = 'Edit Gitea';
$lang->gitea->view = 'View Gitea';
$lang->gitea->delete = 'Delete Gitea';
$lang->gitea->confirmDelete = 'Do you want to delete this Gitea server?';
$lang->gitea->browseAction = 'Gitea List';
$lang->gitea->deleteAction = 'Delete Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "Server Name";
$lang->gitea->url = 'Server URL';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "The current token has no admin privilege. Please regenerate one with root user in Gitea.";
$lang->gitea->hostError = "So the current Gitea server address is invalid, please confirm that the current server can be accessed and try again.";
$lang->gitea->server = "Server List";
$lang->gitea->lblCreate = 'Create Gitea Server';
$lang->gitea->emptyError = " cannot be empty";
$lang->gitea->createSuccess = "Create success";
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = 'Gitea Browse';
$lang->gitea->search = 'Search';
$lang->gitea->create = 'Create Gitea';
$lang->gitea->edit = 'Edit Gitea';
$lang->gitea->view = 'View Gitea';
$lang->gitea->delete = 'Delete Gitea';
$lang->gitea->confirmDelete = 'Do you want to delete this Gitea server?';
$lang->gitea->browseAction = 'Gitea List';
$lang->gitea->deleteAction = 'Delete Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "Server Name";
$lang->gitea->url = 'Server URL';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "The current token has no admin privilege. Please regenerate one with root user in Gitea.";
$lang->gitea->hostError = "So the current Gitea server address is invalid, please confirm that the current server can be accessed and try again.";
$lang->gitea->server = "Server List";
$lang->gitea->lblCreate = 'Create Gitea Server';
$lang->gitea->emptyError = " cannot be empty";
$lang->gitea->createSuccess = "Create success";
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = 'Gitea Browse';
$lang->gitea->search = 'Search';
$lang->gitea->create = 'Create Gitea';
$lang->gitea->edit = 'Edit Gitea';
$lang->gitea->view = 'View Gitea';
$lang->gitea->delete = 'Delete Gitea';
$lang->gitea->confirmDelete = 'Do you want to delete this Gitea server?';
$lang->gitea->browseAction = 'Gitea List';
$lang->gitea->deleteAction = 'Delete Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "Server Name";
$lang->gitea->url = 'Server URL';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "The current token has no admin privilege. Please regenerate one with root user in Gitea.";
$lang->gitea->hostError = "So the current Gitea server address is invalid, please confirm that the current server can be accessed and try again.";
$lang->gitea->server = "Server List";
$lang->gitea->lblCreate = 'Create Gitea Server';
$lang->gitea->emptyError = " cannot be empty";
$lang->gitea->createSuccess = "Create success";
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = 'Gitea Browse';
$lang->gitea->search = 'Search';
$lang->gitea->create = 'Create Gitea';
$lang->gitea->edit = 'Edit Gitea';
$lang->gitea->view = 'View Gitea';
$lang->gitea->delete = 'Delete Gitea';
$lang->gitea->confirmDelete = 'Do you want to delete this Gitea server?';
$lang->gitea->browseAction = 'Gitea List';
$lang->gitea->deleteAction = 'Delete Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "Server Name";
$lang->gitea->url = 'Server URL';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "The current token has no admin privilege. Please regenerate one with root user in Gitea.";
$lang->gitea->hostError = "So the current Gitea server address is invalid, please confirm that the current server can be accessed and try again.";
$lang->gitea->server = "Server List";
$lang->gitea->lblCreate = 'Create Gitea Server';
$lang->gitea->emptyError = " cannot be empty";
$lang->gitea->createSuccess = "Create success";
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = '浏览Gitea';
$lang->gitea->search = '搜索';
$lang->gitea->create = '添加Gitea';
$lang->gitea->edit = '编辑Gitea';
$lang->gitea->view = '查看Gitea';
$lang->gitea->delete = '删除Gitea';
$lang->gitea->confirmDelete = '确认删除该Gitea吗?';
$lang->gitea->browseAction = 'Gitea列表';
$lang->gitea->deleteAction = '删除Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "服务器名称";
$lang->gitea->url = '服务器地址';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "Gitea Token权限不足。";
$lang->gitea->hostError = "当前Gitea服务器地址无效,请确认当前服务器可被访问";
$lang->gitea->server = "服务器列表";
$lang->gitea->lblCreate = '添加Gitea服务器';
$lang->gitea->emptyError = "不能为空";
$lang->gitea->createSuccess = "创建成功";
+26
View File
@@ -0,0 +1,26 @@
<?php
$lang->gitea = new stdclass;
$lang->gitea->common = 'Gitea';
$lang->gitea->browse = '浏览Gitea';
$lang->gitea->search = '搜索';
$lang->gitea->create = '添加Gitea';
$lang->gitea->edit = '编辑Gitea';
$lang->gitea->view = '查看Gitea';
$lang->gitea->delete = '删除Gitea';
$lang->gitea->confirmDelete = '确认删除该Gitea吗?';
$lang->gitea->browseAction = 'Gitea列表';
$lang->gitea->deleteAction = '删除Gitea';
$lang->gitea->id = 'ID';
$lang->gitea->name = "服务器名称";
$lang->gitea->url = '服务器地址';
$lang->gitea->token = 'Token';
$lang->gitea->tokenLimit = "Gitea Token权限不足。";
$lang->gitea->hostError = "当前Gitea服务器地址无效,请确认当前服务器可被访问";
$lang->gitea->server = "服务器列表";
$lang->gitea->lblCreate = '添加Gitea服务器';
$lang->gitea->emptyError = "不能为空";
$lang->gitea->createSuccess = "创建成功";
+227
View File
@@ -0,0 +1,227 @@
<?php
/**
* The model file of gitea module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Chenqi <chenqi@cnezsoft.com>
* @package product
* @version $Id: $
* @link http://www.zentao.net
*/
class giteaModel extends model
{
const HOOK_PUSH_EVENT = 'Push Hook';
/* Gitlab access level. */
public $noAccess = 0;
public $developerAccess = 30;
public $maintainerAccess = 40;
/**
* Get a gitea by id.
*
* @param int $id
* @access public
* @return object
*/
public function getByID($id)
{
return $this->loadModel('pipeline')->getByID($id);
}
/**
* Get gitea list.
*
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getList($orderBy = 'id_desc', $pager = null)
{
$giteaList = $this->loadModel('pipeline')->getList('gitea', $orderBy, $pager);
return $giteaList;
}
/**
* Get gitea pairs.
*
* @access public
* @return array
*/
public function getPairs()
{
return $this->loadModel('pipeline')->getPairs('gitea');
}
/**
* Get gitea api base url by gitea id.
*
* @param int $giteaID
* @param bool $sudo
* @access public
* @return string
*/
public function getApiRoot($giteaID, $sudo = true)
{
$gitea = $this->getByID($giteaID);
if(!$gitea) return '';
$sudoParam = '';
if($sudo == true and !$this->app->user->admin)
{
$openID = $this->getUserIDByZentaoAccount($giteaID, $this->app->user->account);
if($openID) $sudoParam = "&sudo={$openID}";
}
return rtrim($gitea->url, '/') . '/api/v1%s' . "?token={$gitea->token}" . $sudoParam;
}
/**
* Create a gitea.
*
* @access public
* @return bool
*/
public function create()
{
return $this->loadModel('pipeline')->create('gitea');
}
/**
* Update a gitea.
*
* @param int $id
* @access public
* @return bool
*/
public function update($id)
{
return $this->loadModel('pipeline')->update($id);
}
/**
* Api error handling.
*
* @param object $response
* @access public
* @return bool
*/
public function apiErrorHandling($response)
{
if(!empty($response->error))
{
dao::$errors[] = $response->error;
return false;
}
if(!empty($response->message))
{
if(is_string($response->message))
{
$errorKey = array_search($response->message, $this->lang->gitea->apiError);
dao::$errors[] = $errorKey === false ? $response->message : zget($this->lang->gitea->errorLang, $errorKey);
}
else
{
foreach($response->message as $field => $fieldErrors)
{
if(is_string($fieldErrors))
{
$errorKey = array_search($fieldErrors, $this->lang->gitea->apiError);
if($fieldErrors) dao::$errors[$field][] = $errorKey === false ? $fieldErrors : zget($this->lang->gitea->errorLang, $errorKey);
}
else
{
foreach($fieldErrors as $error)
{
$errorKey = array_search($error, $this->lang->gitea->apiError);
if($error) dao::$errors[$field][] = $errorKey === false ? $error : zget($this->lang->gitea->errorLang, $errorKey);
}
}
}
}
}
if(!$response) dao::$errors[] = false;
return false;
}
/**
* Check user access.
*
* @param int $giteaID
* @param int $projectID
* @param object $project
* @param string $maxRole
* @access public
* @return bool
*/
public function checkUserAccess($giteaID, $projectID = 0, $project = null, $groupIDList = array(), $maxRole = 'maintainer')
{
if($this->app->user->admin) return true;
if($project == null) $project = $this->apiGetSingleProject($giteaID, $projectID);
if(!isset($project->id)) return false;
$accessLevel = $this->config->gitea->accessLevel[$maxRole];
if(isset($project->permissions->project_access->access_level) and $project->permissions->project_access->access_level >= $accessLevel) return true;
if(isset($project->permissions->group_access->access_level) and $project->permissions->group_access->access_level >= $accessLevel) return true;
if(!empty($project->shared_with_groups))
{
if(empty($groupIDList))
{
$groups = $this->apiGetGroups($giteaID, 'name_asc', $maxRole);
foreach($groups as $group) $groupIDList[] = $group->id;
}
foreach($project->shared_with_groups as $group)
{
if($group->group_access_level < $accessLevel) continue;
if(in_array($group->group_id, $groupIDList)) return true;
}
}
return false;
}
/**
* Check token access.
*
* @param string $url
* @param string $token
* @access public
* @return void
*/
public function checkTokenAccess($url = '', $token = '')
{
$apiRoot = rtrim($url, '/') . '/api/v1%s' . "?token={$token}";
$url = sprintf($apiRoot, "/admin/users") . "&limit=1";
$httpData = commonModel::httpWithHeader($url);
$users = json_decode($httpData['body']);
if(empty($users)) return false;
if(isset($users->message) or isset($users->error)) return null;
return true;
}
/**
* Get Gitea id list by user account.
*
* @param string $account
* @access public
* @return array
*/
public function getGiteaListByAccount($account = '')
{
if(!$account) $account = $this->app->user->account;
return $this->dao->select('providerID,openID')->from(TABLE_OAUTH)
->where('providerType')->eq('gitea')
->andWhere('account')->eq($account)
->fetchPairs('providerID');
}
}
+72
View File
@@ -0,0 +1,72 @@
<?php
/**
* The browse view file of gitea module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @package gitea
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<?php echo html::a($this->createLink('gitea', 'browse'), "<span class='text'>{$lang->gitea->server}</span>", '', "class='btn btn-link btn-active-text'");?>
</div>
<div class="btn-toolbar pull-right">
<?php if(common::hasPriv('gitea', 'create')) common::printLink('gitea', 'create', "", "<i class='icon icon-plus'></i> " . $lang->gitea->create, '', "class='btn btn-primary'");?>
</div>
</div>
<?php if(empty($giteaList)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->noData;?></span>
<?php if(common::hasPriv('gitea', 'create')):?>
<?php echo html::a($this->createLink('gitea', 'create'), "<i class='icon icon-plus'></i> " . $lang->gitea->create, '', "class='btn btn-info'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<div id='mainContent' class='main-row'>
<form class='main-table' id='ajaxForm' method='post'>
<table id='giteaList' class='table has-sort-head table-fixed'>
<thead>
<tr>
<?php $vars = "orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<th class='c-id text-center'><?php common::printOrderLink('id', $orderBy, $vars, $lang->gitea->id);?></th>
<th class='c-name text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitea->name);?></th>
<th class='text-left'><?php common::printOrderLink('url', $orderBy, $vars, $lang->gitea->url);?></th>
<th class='c-actions-3'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach ($giteaList as $id => $gitea): ?>
<tr class='text'>
<td class='text-center'><?php echo $id;?></td>
<td class='text-c-name' title='<?php echo $gitea->name;?>'>
<?php if(common::hasPriv('gitea', 'view')):?>
<a class="iframe" href="<?php echo $this->createLink('gitea', 'view', "giteaID=$id", '', true); ?>"><?php echo $gitea->name;?></a>
<?php else:?>
<?php echo $gitea->name;?>
<?php endif;?>
</td>
<td class='text' title='<?php echo $gitea->url;?>'><?php echo html::a($gitea->url, $gitea->url, '_target');?></td>
<td class='c-actions text-left'>
<?php
common::printIcon('gitea', 'edit', "giteaID=$id", '', 'list', 'edit');
common::printIcon('gitea', 'delete', "giteaID=$id", '', 'list', 'trash', 'hiddenwin');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if($giteaList):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</form>
</div>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+46
View File
@@ -0,0 +1,46 @@
<?php
/**
* The create view file of gitea module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @package gitea
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->gitea->lblCreate;?></h2>
</div>
<form id='giteaForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitea->name;?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'");?></td>
<td class="tips-git"></td>
</tr>
<tr>
<th><?php echo $lang->gitea->url;?></th>
<td class='required'><?php echo html::input('url', '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitea->token;?></th>
<td><?php echo html::input('token', '', "class='form-control'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+46
View File
@@ -0,0 +1,46 @@
<?php
/**
* The edit view file of gitea module of ZenTaoPMS.
*
* @copyright Copyright 2009-2017 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Gang Liu <liugang@cnezsoft.com>
* @package gitea
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->gitea->edit;?></h2>
</div>
<form id='giteaForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitea->name;?></th>
<td class='required'><?php echo html::input('name', isset($gitea->name) ? $gitea->name : '', "class='form-control'");?></td>
<td class="tips-git"></td>
</tr>
<tr>
<th><?php echo $lang->gitea->url;?></th>
<td class='required'><?php echo html::input('url', isset($gitea->url) ? $gitea->url : '', "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitea->token;?></th>
<td><?php echo html::input('token', isset($gitea->token) ? $gitea->token : '', "class='form-control'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+37
View File
@@ -0,0 +1,37 @@
<?php
/**
* The view file of GitLab module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author dave.li <lichengjun@cnezsoft.com>
* @package GitLab
* @version $Id: view.html.php 4728 2013-05-03 06:14:34Z david18810279601@gmail.com $
* @link http://www.zentao.net
* */
?>
<?php include '../../common/view/header.html.php';?>
<style>.action-cell {margin-bottom: 10px;}</style>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left">
<div class="page-title">
<span class="label label-id"><?php echo $gitea->id?></span>
<span class="text" title="<?php echo $gitea->name;?>" style='color: #3c4354'><?php echo $gitea->name;?></span>
<?php if($gitea->deleted):?>
<span class='label label-danger'><?php echo $lang->gitea->deleted;?></span>
<?php endif; ?>
</div>
</div>
</div>
<div id="mainContent" class="main-row">
<div class="main-col col-8">
<div class="cell">
<div class="detail">
<div class="detail-title"><?php echo $lang->gitea->url;?></div>
<div class="detail-content article-content"><?php echo html::a($gitea->url, $gitea->url, '_target');?></div>
</div>
</div>
<div class='cell action-cell'><?php include '../../common/view/action.html.php';?></div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+3 -3
View File
@@ -62,7 +62,7 @@ class gitlab extends control
}
/**
* create a gitlab.
* Create a gitlab.
*
* @access public
* @return void
@@ -86,7 +86,7 @@ class gitlab extends control
}
/**
* view a gitlab.
* View a gitlab.
* @param int $id
* @access public
* @return void
@@ -642,7 +642,7 @@ class gitlab extends control
$userPairs = array('' => '');
foreach($users as $user)
{
if(!isset($bindedUsers[$user->account]) or $u->account == $zentaoBindAccount) $userPairs[$user->account] = $user->realname;
if(!isset($bindedUsers[$user->account]) or $user->account == $zentaoBindAccount) $userPairs[$user->account] = $user->realname;
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->user->edit;
+1 -1
View File
@@ -51,7 +51,7 @@
<tr>
<td class='text-center form-actions' colspan='4'>
<?php echo html::submitButton($lang->save);?>
<?php if(!isonlybody()) echo html::a($this->createLink('repo', 'maintain', ""), $lang->goback, '', 'class="btn btn-wide"');?>
<?php if(!isonlybody()) echo html::backButton($lang->goback, "data-app='{$app->tab}'", 'btn btn-wide');?>
</td>
</tr>
</tfoot>
+15
View File
@@ -69,6 +69,7 @@ $lang->moduleOrder[215] = 'message';
$lang->moduleOrder[220] = 'gitlab';
$lang->moduleOrder[225] = 'mr';
$lang->moduleOrder[230] = 'app';
$lang->moduleOrder[235] = 'gitea';
$lang->resource = new stdclass();
@@ -1384,6 +1385,20 @@ $lang->gitlab->methodOrder[135] = 'browseTag';
$lang->gitlab->methodOrder[140] = 'browseTagPriv';
$lang->gitlab->methodOrder[145] = 'deleteTagPriv';
/* Gitea. */
$lang->resource->gitea = new stdclass();
$lang->resource->gitea->browse = 'browse';
$lang->resource->gitea->create = 'create';
$lang->resource->gitea->edit = 'edit';
$lang->resource->gitea->view = 'view';
$lang->resource->gitea->delete = 'delete';
$lang->gitea->methodOrder[5] = 'browse';
$lang->gitea->methodOrder[10] = 'create';
$lang->gitea->methodOrder[15] = 'edit';
$lang->gitea->methodOrder[20] = 'view';
$lang->gitea->methodOrder[25] = 'delete';
/* SonarQube. */
$lang->resource->sonarqube = new stdclass();
$lang->resource->sonarqube->browse = 'browse';
+1 -1
View File
@@ -10,7 +10,7 @@ $lang->jenkins->browseAction = 'Jenkins List';
$lang->jenkins->deleteAction = 'Delete Jenkins';
$lang->jenkins->id = 'ID';
$lang->jenkins->name = 'Name';
$lang->jenkins->name = 'Server Name';
$lang->jenkins->url = 'Server URL';
$lang->jenkins->token = 'Token';
$lang->jenkins->account = 'Username';
+1 -1
View File
@@ -10,7 +10,7 @@ $lang->jenkins->browseAction = 'Jenkins列表';
$lang->jenkins->deleteAction = '删除Jenkins';
$lang->jenkins->id = 'ID';
$lang->jenkins->name = '名称';
$lang->jenkins->name = '服务器名称';
$lang->jenkins->url = '服务器地址';
$lang->jenkins->token = 'Token';
$lang->jenkins->account = '用户名';
+7
View File
@@ -0,0 +1,7 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = 'Server Name';
$lang->pipeline->url = 'Server URL';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = 'Username';
$lang->pipeline->password = 'Password';
+7
View File
@@ -0,0 +1,7 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = 'Server Name';
$lang->pipeline->url = 'Server URL';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = 'Username';
$lang->pipeline->password = 'Password';
+7
View File
@@ -0,0 +1,7 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = 'Server Name';
$lang->pipeline->url = 'Server URL';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = 'Username';
$lang->pipeline->password = 'Password';
+7
View File
@@ -0,0 +1,7 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = 'Server Name';
$lang->pipeline->url = 'Server URL';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = 'Username';
$lang->pipeline->password = 'Password';
+2 -2
View File
@@ -1,7 +1,7 @@
<?php
$lang->pipeline->id = 'ID';
$lang->pipeline->name = '名称';
$lang->pipeline->url = '服务地址';
$lang->pipeline->name = '服务器名称';
$lang->pipeline->url = '服务器地址';
$lang->pipeline->token = 'Token';
$lang->pipeline->account = '用户名';
$lang->pipeline->password = '密码';
+14 -1
View File
@@ -60,6 +60,13 @@ $(function()
{
$('#downloadCode').popover('show');
$('.copy-btn').tooltip({
trigger: 'click',
placement: 'bottom',
title: lang.copied,
tipClass: 'tooltip-success'
});
/* Set popover area. */
var left = parseFloat($('.download-popover').css('left')) - 155;
$('.download-popover').css('left', left + 'px')
@@ -71,7 +78,13 @@ $(function()
var copyText = $(this).parent().parent().find('input');
copyText .select();
document.execCommand("Copy");
alert(lang.copied);
$(this).tooltip('show');
var that = this;
setTimeout(function()
{
$(that).tooltip('hide')
}, 2000)
})
$('.download-btn').live('click', function()