* commit unfinished job for task #38934.
This commit is contained in:
@@ -132,6 +132,7 @@ $filter->user->ajaxgetmore = new stdclass();
|
||||
$filter->repo->ajaxsynccommit = new stdclass();
|
||||
$filter->search->index = new stdclass();
|
||||
$filter->gitlab->webhook = new stdclass();
|
||||
$filter->gitlab->importissue = new stdclass();
|
||||
|
||||
$filter->bug->batchcreate->cookie['preBranch'] = 'int';
|
||||
$filter->bug->browse->cookie['bugModule'] = 'int';
|
||||
@@ -315,3 +316,8 @@ $filter->gitlab->webhook->get['gitlab'] = 'int';
|
||||
$filter->gitlab->webhook->get['product'] = 'int';
|
||||
$filter->gitlab->webhook->get['project'] = 'int';
|
||||
$filter->gitlab->webhook->get['token'] = 'reg::any';
|
||||
|
||||
$filter->gitlab->importissue->get['gitlab'] = 'int';
|
||||
$filter->gitlab->importissue->get['product'] = 'int';
|
||||
$filter->gitlab->importissue->get['project'] = 'int';
|
||||
|
||||
|
||||
@@ -96,3 +96,5 @@ $config->gitlab->objectTables->story = TABLE_STORY;
|
||||
$config->gitlab->objectTables->task = TABLE_TASK;
|
||||
$config->gitlab->objectTables->bug = TABLE_BUG;
|
||||
|
||||
$config->gitlab->objectTypes = array('', 'task', 'bug', 'story');
|
||||
|
||||
|
||||
+23
-19
@@ -251,28 +251,32 @@ class gitlab extends control
|
||||
exit;
|
||||
}
|
||||
|
||||
public function transferIssue()
|
||||
public function importIssue()
|
||||
{
|
||||
//TODO(dingguodong) todo next.
|
||||
if(!empty($this->post))
|
||||
if($_POST)
|
||||
{
|
||||
$project;
|
||||
$product;
|
||||
$execution;
|
||||
$objetcType;
|
||||
$gitlab;
|
||||
$gitlabProject;
|
||||
$gitlabIssue;
|
||||
$this->post->a();
|
||||
}
|
||||
|
||||
$this->view->programs = array('') + $this->loadModel('program')->getTopPairs('', 'noclosed');
|
||||
|
||||
$this->view->products = '$projects';
|
||||
$this->view->execution = '$projects';
|
||||
$this->view->objectTypes = '$projects';
|
||||
$this->view->gitlabs = '$projects';
|
||||
$this->view->gitlabProjects = '$projects';
|
||||
$this->view->gitlabIssues = '$projects';
|
||||
|
||||
$productID = $this->get->product;
|
||||
$gitlabID = $this->get->gitlab;
|
||||
$projectID = $this->get->project;
|
||||
$relations = $this->gitlab->getExecutionsByProduct($productID);
|
||||
|
||||
$executions = array();
|
||||
foreach($relations as $relation)
|
||||
{
|
||||
if($relation->execution) $executions[] = $this->loadModel("execution")->getByID($relation->execution)->name;
|
||||
}
|
||||
|
||||
$this->view->productName = $this->loadModel("product")->getByID($productID)->name;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->gitlabID = $gitlabID;
|
||||
$this->view->gitlabProjectID = $projectID;
|
||||
$this->view->executions = $executions;
|
||||
$this->view->objectTypes = $this->config->gitlab->objectTypes;
|
||||
|
||||
$this->view->gitlabIssues = $this->gitlab->apiGetIssues($gitlabID, $projectID);
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('[name^=gitlabID').change(function()
|
||||
{
|
||||
var gitlab = $(this);
|
||||
host = gitlab.val();
|
||||
if(host == '') return false;
|
||||
projects = '';
|
||||
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host);
|
||||
|
||||
$.get(url, function(response)
|
||||
{
|
||||
project = gitlab.parent().next().find('select');
|
||||
project.html('').append(response);
|
||||
project.chosen().trigger("chosen:updated");
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -6,6 +6,7 @@ $lang->gitlab->create = '添加gitlab';
|
||||
$lang->gitlab->edit = '编辑gitlab';
|
||||
$lang->gitlab->bindUser = '绑定用户';
|
||||
$lang->gitlab->bindProduct = '关联产品';
|
||||
$lang->gitlab->importIssue = '关联议题';
|
||||
$lang->gitlab->delete = '删除';
|
||||
$lang->gitlab->confirmDelete = '确认删除该gitlab吗?';
|
||||
$lang->gitlab->gitlabAccount = 'gitlab用户';
|
||||
@@ -13,11 +14,13 @@ $lang->gitlab->zentaoAccount = '禅道用户';
|
||||
|
||||
$lang->gitlab->browseAction = 'gitlab列表';
|
||||
$lang->gitlab->deleteAction = '删除gitlab';
|
||||
$lang->gitlab->gitlabProject = 'gitlab项目';
|
||||
$lang->gitlab->gitlabProject = "{$lang->gitlab->common}项目";
|
||||
$lang->gitlab->gitlabIssue = "{$lang->gitlab->common}议题";
|
||||
$lang->gitlab->zentaoProduct = '禅道产品';
|
||||
$lang->gitlab->objectType = '类型'; // task, bug, story
|
||||
|
||||
$lang->gitlab->id = 'ID';
|
||||
$lang->gitlab->name = '名称';
|
||||
$lang->gitlab->name = "{$lang->gitlab->common}名称";
|
||||
$lang->gitlab->url = '服务地址';
|
||||
$lang->gitlab->token = 'Token';
|
||||
$lang->gitlab->defaultProject = '默认项目';
|
||||
|
||||
+23
-1
@@ -198,7 +198,24 @@ class gitlabModel extends model
|
||||
->andWhere('product')->eq($productID)
|
||||
->fetchGroup('AID');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get executions by one product for gitlab module.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionsByProduct($productID)
|
||||
{
|
||||
return $this->dao->select('distinct execution')->from(TABLE_RELATION)
|
||||
->where('relation')->eq('interrated')
|
||||
->andWhere('AType')->eq('gitlab')
|
||||
->andWhere('BType')->eq('gitlabProject')
|
||||
->andWhere('product')->eq($productID)
|
||||
->fetchAll('execution');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gitlabID and projectID.
|
||||
*
|
||||
@@ -326,6 +343,11 @@ class gitlabModel extends model
|
||||
return $allResults;
|
||||
}
|
||||
|
||||
public function apiGetIssues($gitlabID, $projectID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hooks.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* The batch create view of story 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)
|
||||
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
|
||||
* @package story
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->gitlab->importIssue;?></h2>
|
||||
</div>
|
||||
<form method='post' class='load-indicator main-form form-ajax' enctype='multipart/form-data'>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width='30px'><?php echo $lang->product->common;?></th>
|
||||
<th width='30px'><?php echo $lang->execution->common;?></th>
|
||||
<th width='60px'><?php echo $lang->gitlab->gitlabIssue;?></th>
|
||||
<th width='30px'><?php echo $lang->gitlab->objectType;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo $productName; ?></td>
|
||||
<input type='hidden' name='productID' value='<?php echo $productID;?>' />
|
||||
<input type='hidden' name='gitlabID' value='<?php echo $gitlabID;?>' />
|
||||
<input type='hidden' name='gitlabProjectID' value='<?php echo $gitlabProjectID;?>' />
|
||||
<td><?php echo html::select("executionName", $executions, '', "class='form-control select chosen'" );?></td>
|
||||
<td><?php echo html::select("gitlabIssueID", $gitlabIssues, '', "class='form-control select chosen'" );?></td>
|
||||
<td><?php echo html::select("objectType", $objectTypes, '', "class='form-control select chosen'" );?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="text-center form-actions">
|
||||
<?php echo html::submitButton($lang->save);?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The batch create view of story 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)
|
||||
* @author Yangyang Shi <shiyangyang@cnezsoft.com>
|
||||
* @package story
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainContent" class="main-content">
|
||||
<div class="main-header">
|
||||
<h2><?php echo $lang->gitlab->transferIssue;?></h2>
|
||||
</div>
|
||||
<form method='post' class='load-indicator main-form form-ajax' enctype='multipart/form-data'>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless w-600px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan='2'><?php echo $lang->gitlab->gitlabAccount;?></th>
|
||||
<th><?php echo $lang->gitlab->zentaoAccount;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($gitlabUsers as $gitlabUser):?>
|
||||
<?php if(isset($gitlabUser->zentaoAccount)) continue;?>
|
||||
<tr>
|
||||
<td class='w-60px'> <?php echo html::image($gitlabUser->avatar, "height=40");?> </td>
|
||||
<td class='text-left'>
|
||||
<strong> <?php echo $gitlabUser->realname;?> </strong>
|
||||
<br><?php echo $gitlabUser->account . " <" . $gitlabUser->email . ">"; ?>
|
||||
</td>
|
||||
<td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, '', "class='form-control select chosen'" );?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php foreach($gitlabUsers as $gitlabUser):?>
|
||||
<?php if(!isset($gitlabUser->zentaoAccount)) continue;?>
|
||||
<tr>
|
||||
<td class='w-60px'> <?php echo html::image($gitlabUser->avatar, "height=40");?> </td>
|
||||
<td>
|
||||
<strong><?php echo $gitlabUser->realname;?></strong>
|
||||
<br><?php echo $gitlabUser->account . " <" . $gitlabUser->email . ">";?>
|
||||
</td>
|
||||
<td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen'" );?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" class="text-center form-actions">
|
||||
<?php echo html::submitButton($lang->save);?>
|
||||
<?php echo html::backButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -49,6 +49,7 @@
|
||||
<td class='text-left c-actions'>
|
||||
<?php
|
||||
common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit');
|
||||
common::printIcon('gitlab', 'importissue', "product={$repo->product}&gitlab={$repo->gitlab}&project={$repo->project}", '', 'list', 'link');
|
||||
if(common::hasPriv('repo', 'delete')) echo html::a($this->createLink('repo', 'delete', "repoID=$repo->id&objectID=$objectID"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->repo->delete}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user