Merge branch '15.0.beta3' of http://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
leiyong
2021-04-14 09:21:49 +00:00
26 changed files with 848 additions and 96 deletions
-1
View File
@@ -431,7 +431,6 @@ $lang->action->dynamicAction->entry['created'] = '添加应用';
$lang->action->dynamicAction->entry['edited'] = '编辑应用';
/* 用来生成相应对象的链接。*/
global $config;
$lang->action->label->product = $lang->productCommon . '|product|view|productID=%s';
$lang->action->label->productplan = "计划|productplan|view|productID=%s";
$lang->action->label->release = '发布|release|view|productID=%s';
-5
View File
@@ -11,11 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<div class='btn-toolbar pull-left'><?php //common::printAdminSubMenu('system');?></div>
</div>
</div>
<div class="main-row">
<div class='side-col' id='sidebar'>
<div class='cell'>
-3
View File
@@ -11,9 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php'; ?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left"><?php //common::printAdminSubMenu('sso');?></div>
</div>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
-8
View File
@@ -11,14 +11,6 @@
*/
class automation extends control
{
/**
* Project id.
*
* @var int
* @access public
*/
public $projectID = 0;
/**
* Products.
*
-30
View File
@@ -975,34 +975,6 @@ class block extends control
$plans[$product] = $plan;
}
/* Get projects. */
$projects = $this->dao->select('t1.product, t2.status, t2.end')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->in($productIdList)
->andWhere('t2.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->fetchGroup('product');
foreach($projects as $product => $productProjects)
{
$undone= 0;
$done = 0;
$delay = 0;
foreach($productProjects as $project)
{
($project->status == 'done' or $project->status == 'closed') ? $done++ : $undone++;
if($project->status != 'done' && $project->status != 'closed' && $project->status != 'suspended' && $project->end < helper::today()) $delay++;
}
$project = array();
$project['undone'] = $undone;
$project['done'] = $done;
$project['delay'] = $delay;
$project['all'] = count($productProjects);
$projects[$product] = $project;
}
/* Get releases. */
$releases = $this->dao->select('product, status, COUNT(*) AS count')->from(TABLE_RELEASE)
->where('deleted')->eq(0)
@@ -1028,14 +1000,12 @@ class block extends control
{
$product->stories = isset($stories[$productID]) ? $stories[$productID] : 0;
$product->plans = isset($plans[$productID]) ? $plans[$productID] : 0;
$product->projects = isset($projects[$productID]) ? $projects[$productID] : 0;
$product->releases = isset($releases[$productID]) ? $releases[$productID] : 0;
$product->lastRelease = isset($lastReleases[$productID]) ? $lastReleases[$productID] : 0;
}
$this->app->loadLang('story');
$this->app->loadLang('productplan');
$this->app->loadLang('project');
$this->app->loadLang('release');
$this->view->products = $products;
-3
View File
@@ -11,7 +11,6 @@ $(function()
if($blocksList.find('#moduleBlock').val() == 'scrumtest' && $('#paramstype').val() != 'all')
{
console.log($('#paramstype').val());
$titleInput.val(value);
}
else
@@ -19,8 +18,6 @@ $(function()
var lang = config.clientLang;
if(lang.indexOf('zh') >= 0)
{
console.log(preValue, blockTitle);
console.log(blockTitle.indexOf(preValue));
if(blockTitle.indexOf(preValue) >= 0)
{
blockTitle = blockTitle.replace(preValue, value);
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Testaufgaben';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Requests';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Recettes';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Yêu cầu';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
+5 -6
View File
@@ -291,11 +291,11 @@ $lang->block->default['full']['my']['3']['params']['count'] = '20';
if($config->systemMode == 'new')
{
$lang->block->default['full']['my']['4']['title'] = '项目统计';
$lang->block->default['full']['my']['4']['block'] = 'statistic';
$lang->block->default['full']['my']['4']['source'] = 'project';
$lang->block->default['full']['my']['4']['grid'] = 8;
$lang->block->default['full']['my']['4']['params']['count'] = '20';
$lang->block->default['full']['my']['4']['title'] = '项目统计';
$lang->block->default['full']['my']['4']['block'] = 'statistic';
$lang->block->default['full']['my']['4']['source'] = 'project';
$lang->block->default['full']['my']['4']['grid'] = 8;
$lang->block->default['full']['my']['4']['params']['count'] = '20';
}
$lang->block->default['full']['my']['5']['title'] = '我的贡献';
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = '测试版本列表';
$lang->block->availableBlocks->risk = '我的风险';
$lang->block->availableBlocks->issue = '我的问题';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = '项目';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
@@ -175,10 +175,6 @@ $(function()
</div>
</div>
</div>
<?php $totalProject = $product->projects ? zget($product->projects, 'all', 0) : 0;?>
<?php $undoneProject = $product->projects ? zget($product->projects, 'undone', 0) : 0;?>
<?php $delayProject = $product->projects ? zget($product->projects, 'delay', 0) : 0;?>
<?php $undoneRate = $totalProject ? round($undoneProject / $totalProject * 100, 2) : 0;?>
<div class="product-info">
<?php $totalRelease = $product->releases ? array_sum($product->releases) : 0;?>
<?php $normalRelease = $product->releases ? zget($product->releases, 'normal', 0) : 0;?>
+6 -1
View File
@@ -509,7 +509,7 @@ class bug extends control
if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story")));
/* Get products and projects. */
$products = $this->products;
$products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
$projects = array(0 => '');
if($projectID)
{
@@ -817,6 +817,11 @@ class bug extends control
if($bug->type != $type) unset($this->lang->bug->typeList[$type]);
}
if($this->app->openApp == 'qa')
{
$this->view->products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
}
/* Set header and position. */
$this->view->title = $this->lang->bug->edit . "BUG #$bug->id $bug->title - " . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
+4
View File
@@ -42,6 +42,10 @@ $config->repo->edit->requiredFields = 'product,SCM,name,path,encoding,client';
$config->repo->svn = new stdclass();
$config->repo->svn->requiredFields = 'account,password';
$config->repo->gitlab = new stdclass;
$config->repo->gitlab->perPage = 300;
$config->repo->gitlab->apiPath = "%s/api/v4/projects/%s/repository/";
$config->repo->rules['module']['task'] = 'Task';
$config->repo->rules['module']['bug'] = 'Bug';
$config->repo->rules['module']['story'] = 'Story';
+31
View File
@@ -165,6 +165,14 @@ class repo extends control
$this->app->loadLang('action');
if($repo->SCM == 'Gitlab')
{
$projects = $this->repo->getGitlabProjects($repo->client, $repo->password);
$options = array();
foreach($projects as $project) $options[$project->id] = $project->name . ':' . $project->http_url_to_repo;
$this->view->projects = $options;
}
$repo->repoType = $repo->id . '-' . $repo->SCM;
$this->view->repo = $repo;
$this->view->repoID = $repoID;
@@ -1072,6 +1080,29 @@ class repo extends control
die($reposHtml);
}
/**
* Ajax get gitlab projects.
*
* @param string $host
* @param string $token
* @access public
* @return void
*/
public function ajaxGetGitlabProjects($host, $token)
{
$host = helper::safe64Decode($host);
$projects = $this->repo->getGitlabProjects($host, $token);
if(!$projects) $this->send(array('message' => array()));
$options = '';
foreach($projects as $project)
{
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name}:{$project->http_url_to_repo}</option>";
}
die($options);
}
/**
* Ajax get branch drop menu.
*
+27 -2
View File
@@ -6,16 +6,38 @@ $(function()
$form = $(this).closest('form');
$form.css('min-height', $form.height());
})
$('#gitlabHost, #gitlabToken').change(function()
{
host = Base64.encode($('#gitlabHost').val());
token = $('#gitlabToken').val();
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + '&token=' + token);
if(host == '' || token == '') return false;
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
$('#gitlabProject').change(function()
{
$option = $(this).find('option:selected');
$('#name').val($option.data('name'));
});
});
function scmChanged(scm) {
function scmChanged(scm)
{
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
$('.tips-git').removeClass('hidden');
$('.tips-svn').addClass('hidden');
}
}
else
{
$('.account-fields').removeClass('hidden');
@@ -23,4 +45,7 @@ function scmChanged(scm) {
$('.tips-git').addClass('hidden');
$('.tips-svn').removeClass('hidden');
}
$('tr.gitlab').toggle(scm == 'Gitlab');
$('tr.hide-gitlab').toggle(scm != 'Gitlab');
}
+28 -1
View File
@@ -6,9 +6,33 @@ $(function()
$form = $(this).closest('form');
$form.css('min-height', $form.height());
})
$('#gitlabHost, #gitlabToken').change(function()
{
host = Base64.encode($('#gitlabHost').val());
token = $('#gitlabToken').val();
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + '&token=' + token);
if(host == '' || token == '') return false;
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
$('#gitlabProject').change(function()
{
$option = $(this).find('option:selected');
if(!$option.data('name')) return false;
$('#name').val($option.data('name'));
$(this).chosen().trigger("chosen:updated");
});
});
function scmChanged(scm) {
function scmChanged(scm)
{
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
@@ -23,4 +47,7 @@ function scmChanged(scm) {
$('.tips-git').addClass('hidden');
$('.tips-svn').removeClass('hidden');
}
$('tr.gitlab').toggle(scm == 'Gitlab');
$('tr.hide-gitlab').toggle(scm != 'Gitlab');
}
+8
View File
@@ -124,6 +124,14 @@ $lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->scmList['Subversion'] = 'SVN';
$lang->repo->scmList['Gitlab'] = 'Gitlab';
$lang->repo->gitlabHost = 'Gitlab Host';
$lang->repo->gitlabToken = 'Gitlab Token';
$lang->repo->gitlabProject = 'Projects';
$lang->repo->placeholder = new stdclass;
$lang->repo->placeholder->gitlabHost = 'Input url of gitlab';
$lang->repo->notice = new stdclass();
$lang->repo->notice->syncing = 'Synchronizing. Please wait ...';
+8
View File
@@ -124,6 +124,14 @@ $lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->scmList['Subversion'] = 'Subversion';
$lang->repo->scmList['Gitlab'] = 'Gitlab';
$lang->repo->gitlabHost = 'Gitlab 地址';
$lang->repo->gitlabToken = 'Gitlab Token';
$lang->repo->gitlabProject = '项目';
$lang->repo->placeholder = new stdclass;
$lang->repo->placeholder->gitlabHost = '请填写gitlab访问地址';
$lang->repo->notice = new stdclass();
$lang->repo->notice->syncing = '正在同步中, 请稍等...';
+41 -2
View File
@@ -235,11 +235,21 @@ class repoModel extends model
if(!$this->checkConnection()) return false;
$data = fixer::input('post')
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
->skipSpecial('path,client,account,password')
->setDefault('product', '')
->join('product', ',')
->get();
if($this->post->SCM == 'Gitlab')
{
$data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
unset($data->gitlabHost);
unset($data->gitlabToken);
}
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
if($data->SCM == 'Subversion')
@@ -252,8 +262,9 @@ class repoModel extends model
}
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
$this->dao->insert(TABLE_REPO)->data($data)
$this->dao->insert(TABLE_REPO)->data($data, $skip = 'gitlabProject')
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->autoCheck()
->exec();
@@ -282,6 +293,16 @@ class repoModel extends model
->skipSpecial('path,client,account,password')
->join('product', ',')
->get();
if($this->post->SCM == 'Gitlab')
{
$data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
unset($data->gitlabHost);
unset($data->gitlabToken);
unset($data->gitlabProject);
}
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
if($data->SCM == 'Subversion' and $data->path != $repo->path)
@@ -301,9 +322,10 @@ class repoModel extends model
if(!$this->checkConnection()) return false;
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
$this->dao->update(TABLE_REPO)->data($data)
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabProject')
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
->autoCheck()
->where('id')->eq($id)->exec();
@@ -1754,4 +1776,21 @@ class repoModel extends model
return $buildedURL;
}
/**
* Get gitlab projects.
*
* @param string $host
* @param string $token
* @access public
* @return array
*/
public function getGitlabProjects($host, $token)
{
$host = rtrim($host, '/');
$host .= '/api/v4/projects';
$projects = file_get_contents($host . "?private_token=$token");
return json_decode($projects);
}
}
+17 -4
View File
@@ -10,6 +10,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/base64.js');?>
<?php if(common::checkNotCN()):?>
<style>.user-addon {padding-right: 16px; padding-left: 16px;}</style>
<?php endif;?>
@@ -31,12 +32,24 @@
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, 'Git', "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td class="tips-git"><?php echo $lang->repo->syncTips; ?></td>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabHost;?></th>
<td><?php echo html::input('gitlabHost', '', "class='form-control' placeholder='{$lang->repo->placeholder}'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabToken;?></th>
<td><?php echo html::input('gitlabToken', '', "class='form-control'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabProject;?></th>
<td><?php echo html::select('gitlabProject', array(''), '', "class='form-control chosen'");?>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', '', "class='form-control'"); ?></td>
<td class='muted'>
@@ -49,7 +62,7 @@
<td class='required'><?php echo html::input('encoding', 'utf-8', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', '', "class='form-control'")?></td>
<td class='muted'>
@@ -57,11 +70,11 @@
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
</td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
+17 -4
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/base64.js');?>
<?php if(common::checkNotCN()):?>
<style>
.user-addon{padding-right: 16px; padding-left: 16px;}
@@ -37,12 +38,24 @@
<span class="tips-git"><?php echo $lang->repo->syncTips; ?></span>
</td>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabHost;?></th>
<td><?php echo html::input('gitlabHost', $repo->client, "class='form-control' placeholder='{$lang->repo->placeholder}'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabToken;?></th>
<td><?php echo html::input('gitlabToken', $repo->password, "class='form-control'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabProject;?></th>
<td><?php echo html::select('gitlabProject', $projects, '', "class='form-control chosen'");?>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', $repo->name, "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', $repo->path, "class='form-control'"); ?></td>
<td class='muted'>
@@ -55,7 +68,7 @@
<td class='required'><?php echo html::input('encoding', $repo->encoding, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
<td class='muted'>
@@ -63,11 +76,11 @@
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
</td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', $repo->account, "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
-1
View File
@@ -335,7 +335,6 @@ function markTestStory()
var $tr = $(this);
storiesHasTest[$tr.find('select[name^="testStory"]').val()] = true;
});
console.log(storiesHasTest);
return storiesHasTest;
};
+1 -1
View File
@@ -160,7 +160,7 @@ $config->testcase->datatable->fieldList['lastRunResult']['required'] = 'no';
$config->testcase->datatable->fieldList['status']['title'] = 'statusAB';
$config->testcase->datatable->fieldList['status']['fixed'] = 'no';
$config->testcase->datatable->fieldList['status']['width'] = '60';
$config->testcase->datatable->fieldList['status']['width'] = '70';
$config->testcase->datatable->fieldList['status']['required'] = 'no';
$config->testcase->datatable->fieldList['lastEditedBy']['title'] = 'lastEditedBy';