This commit is contained in:
wangyidong
2022-07-20 10:59:50 +08:00
66 changed files with 1223 additions and 434 deletions
+3
View File
@@ -0,0 +1,3 @@
ALTER TABLE `zt_mr` CHANGE COLUMN `gitlabID` `hostID` mediumint(8) UNSIGNED NOT NULL AFTER `id`;
ALTER TABLE `zt_mr` MODIFY COLUMN `sourceProject` varchar(50) NOT NULL AFTER `hostID`;
ALTER TABLE `zt_mr` MODIFY COLUMN `targetProject` varchar(50) NOT NULL AFTER `sourceBranch`;
+3 -3
View File
@@ -955,10 +955,10 @@ CREATE TABLE IF NOT EXISTS `zt_module` (
-- DROP TABLE IF EXISTS `zt_mr`;
CREATE TABLE IF NOT EXISTS `zt_mr` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`gitlabID` mediumint(8) unsigned NOT NULL,
`sourceProject` int unsigned NOT NULL,
`hostID` mediumint(8) unsigned NOT NULL,
`sourceProject` varchar(50) NOT NULL,
`sourceBranch` varchar(100) NOT NULL,
`targetProject` int unsigned NOT NULL,
`targetProject` varchar(50) NOT NULL,
`targetBranch` varchar(100) NOT NULL,
`mriid` int unsigned NOT NULL,
`title` varchar(255) NOT NULL,
+1 -1
View File
@@ -29,7 +29,7 @@ class ciModel extends model
if($this->session->repoID)
{
$repo = $this->loadModel('repo')->getRepoByID($this->session->repoID);
if($repo->SCM != 'Gitlab') unset($this->lang->devops->menu->mr);
if(!in_array(strtolower($repo->SCM), $this->config->mr->gitServiceList)) unset($this->lang->devops->menu->mr);
$this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID);
}
+1
View File
@@ -150,6 +150,7 @@ $lang->openedByAB = 'Ersteller';
$lang->assignedToAB = 'Bearbeiter';
$lang->typeAB = 'Typ';
$lang->nameAB = 'Name';
$lang->code = 'Code';
$lang->pri = 'Priority';
$lang->delayed = 'Delayed';
+1
View File
@@ -150,6 +150,7 @@ $lang->openedByAB = 'CreatedBy';
$lang->assignedToAB = 'AssignedTo';
$lang->typeAB = 'Type';
$lang->nameAB = 'Name';
$lang->code = 'Code';
$lang->pri = 'Priority';
$lang->delayed = 'Delayed';
+1
View File
@@ -150,6 +150,7 @@ $lang->openedByAB = 'Créé par';
$lang->assignedToAB = 'Affecté à';
$lang->typeAB = 'Type';
$lang->nameAB = 'Name';
$lang->code = 'Code';
$lang->pri = 'Priority';
$lang->delayed = 'Delayed';
+5 -2
View File
@@ -488,7 +488,7 @@ $lang->admin->menu = new stdclass();
$lang->admin->menu->index = array('link' => "$lang->indexPage|admin|index", 'alias' => 'register,certifytemail,certifyztmobile,ztcompany');
$lang->admin->menu->company = array('link' => "{$lang->personnel->common}|company|browse|", 'subModule' => ',user,dept,group,');
$lang->admin->menu->model = array('link' => "$lang->model|custom|browsestoryconcept|", 'class' => 'dropdown dropdown-hover', 'exclude' => 'custom-index,custom-set,custom-product,custom-execution,custom-kanban,custom-required,custom-flow,custom-score,custom-feedback,custom-timezone,custom-mode');
$lang->admin->menu->custom = array('link' => "{$lang->custom->common}|custom|index", 'exclude' => 'custom-browsestoryconcept,custom-timezone,custom-estimate');
$lang->admin->menu->custom = array('link' => "{$lang->custom->common}|custom|index", 'exclude' => 'custom-browsestoryconcept,custom-timezone,custom-estimate,custom-code');
$lang->admin->menu->extension = array('link' => "{$lang->extension->common}|extension|browse", 'subModule' => 'extension');
$lang->admin->menu->dev = array('link' => "$lang->redev|dev|api", 'alias' => 'db', 'subModule' => 'dev,editor,entry');
$lang->admin->menu->message = array('link' => "{$lang->message->common}|message|index", 'subModule' => 'message,mail,webhook');
@@ -506,7 +506,10 @@ if($config->systemMode == 'new')
$lang->admin->menu->allModel['subMenu'] = new stdclass();
$lang->admin->menu->allModel['subMenu']->storyConcept = array('link' => "{$lang->storyConcept}|custom|browsestoryconcept|");
$lang->admin->menu->allModel['menuOrder'][5] = 'storyConcept';
$lang->admin->menu->allModel['subMenu']->code = array('link' => "{$lang->code}|custom|code|");
$lang->admin->menu->allModel['menuOrder'][5] = 'storyConcept';
$lang->admin->menu->allModel['menuOrder'][30] = 'code';
$lang->admin->menu->waterfall['subMenu'] = new stdclass();
$lang->admin->menu->waterfall['subMenu']->stage = array('link' => "{$lang->stage->common}|stage|setType|", 'subModule' => 'stage');
+1
View File
@@ -150,6 +150,7 @@ $lang->openedByAB = '创建';
$lang->assignedToAB = '指派';
$lang->typeAB = '类型';
$lang->nameAB = '名称';
$lang->code = '代号';
$lang->pri = '优先级';
$lang->delayed = '已延期';
+5 -2
View File
@@ -3083,11 +3083,13 @@ EOD;
* @param string|array $data
* @param array $options This is option and value pair, like CURLOPT_HEADER => true. Use curl_setopt function to set options.
* @param array $headers Set request headers.
* @param string $dataType
* @param string $method POST|PATCH|PUT
* @static
* @access public
* @return string
*/
public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data')
public static function http($url, $data = null, $options = array(), $headers = array(), $dataType = 'data', $method = 'POST')
{
global $lang, $app;
if(!extension_loaded('curl'))
@@ -3124,7 +3126,8 @@ EOD;
if(!empty($data))
{
if(is_object($data)) $data = (array) $data;
curl_setopt($curl, CURLOPT_POST, true);
if($method == 'POST') curl_setopt($curl, CURLOPT_POST, true);
if(in_array($method, array('PATCH', 'PUT'))) curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
+19
View File
@@ -848,4 +848,23 @@ class custom extends control
$this->loadModel('setting')->deleteItems("owner=system&module={$module}&key=requiredFields");
return print(js::reload('parent.parent'));
}
/**
* Set code.
*
* @access public
* @return void
*/
public function code()
{
if($_POST)
{
$this->loadModel('setting')->setItem('system.common.setCode', $this->post->code);
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'reload'));
}
$this->view->title = $this->lang->custom->code;
$this->display();
}
}
+5
View File
@@ -0,0 +1,5 @@
#readOnlyOfCode {font-size: 13px; color: #5e626d; display: flex; width: 200%;}
#readOnlyOfCode i {font-size: 14px; color: #0075ff; margin-right: 3px;}
.c-setCode {width: 150px !important;}
[lang^=en] .c-setCode, [lang^=de] .c-setCode {width: 160px !important;}
[lang^=fr] .c-setCode {width: 200px !important;}
+3
View File
@@ -54,6 +54,8 @@ $lang->custom->allUsers = 'All Users';
$lang->custom->account = 'Users';
$lang->custom->role = 'Role';
$lang->custom->dept = 'Dept';
$lang->custom->code = $lang->code;
$lang->custom->setCode = 'Enable or Disable Code';
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = 'Execution';
@@ -208,6 +210,7 @@ $lang->custom->notice->confirmReviewCase = 'Set the case in Wait to Normal?';
$lang->custom->notice->storyReviewTip = 'After selecting by individual, position, and department, take the union of these three filters. ';
$lang->custom->notice->selectAllTip = 'After selecting all people, the reviewers will be emptied and grayed out while hiding their positions and departments.';
$lang->custom->notice->repeatKey = 'Repeat Key %s';
$lang->custom->notice->readOnlyOfCode = 'A code is a management term that exists for secrecy or as an antonym. When code management is enabled, the code information of product, project, and execution in the system will be displayed in the creation, editing, detail, and list pages.';
$lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Homepage. Do you want to go to Product Homepage?";
$lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Homepage. Do you want to go to Project Homepage?";
+3
View File
@@ -54,6 +54,8 @@ $lang->custom->allUsers = 'All Users';
$lang->custom->account = 'Users';
$lang->custom->role = 'Role';
$lang->custom->dept = 'Dept';
$lang->custom->code = $lang->code;
$lang->custom->setCode = 'Enable or Disable Code';
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon;
@@ -208,6 +210,7 @@ $lang->custom->notice->confirmReviewCase = 'Set the case in Wait to Normal?';
$lang->custom->notice->storyReviewTip = 'After selecting by individual, position, and department, take the union of these three filters. ';
$lang->custom->notice->selectAllTip = 'After selecting all people, the reviewers will be emptied and grayed out while hiding their positions and departments.';
$lang->custom->notice->repeatKey = 'Repeat Key %s';
$lang->custom->notice->readOnlyOfCode = 'A code is a management term that exists for secrecy or as an antonym. When code management is enabled, the code information of product, project, and execution in the system will be displayed in the creation, editing, detail, and list pages.';
$lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ has Product Home. Do you want to go to Product Home?";
$lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ has Project Home. Do you want to go to Project Home?";
+3
View File
@@ -54,6 +54,8 @@ $lang->custom->allUsers = 'All Users';
$lang->custom->account = 'Users';
$lang->custom->role = 'Role';
$lang->custom->dept = 'Dept';
$lang->custom->code = $lang->code;
$lang->custom->setCode = 'Activer ou Désactiver le Code';
if($config->systemMode == 'new') $lang->custom->execution = 'Execution';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = 'Execution';
@@ -208,6 +210,7 @@ $lang->custom->notice->confirmReviewCase = 'Set the case in Wait to Normal?';
$lang->custom->notice->storyReviewTip = 'After selecting by individual, position, and department, take the union of these three filters. ';
$lang->custom->notice->selectAllTip = 'After selecting all people, the reviewers will be emptied and grayed out while hiding their positions and departments.';
$lang->custom->notice->repeatKey = 'Repeat Key %s';
$lang->custom->notice->readOnlyOfCode = "Le code est un terme de gestion utilisé pour la confidentialité ou comme alias. Lorsque la gestion du code est activée, le produit, le projet et l'exécution dans le système afficheront les informations de code sur les pages de création, de modification, de détails et de liste.";
$lang->custom->notice->indexPage['product'] = "ZenTao 8.2+ possède une page d'accueil. Voulez-vous consulter la page d'accueil du produit ?";
$lang->custom->notice->indexPage['project'] = "ZenTao 8.2+ possède une page d'accueil. Voulez-vous consulter la page d'accueil du produit ?";
+3
View File
@@ -54,6 +54,8 @@ $lang->custom->allUsers = '所有人员';
$lang->custom->account = '人员';
$lang->custom->role = '职位';
$lang->custom->dept = '部门';
$lang->custom->code = $lang->code;
$lang->custom->setCode = '是否启用代号';
if($config->systemMode == 'new') $lang->custom->execution = '执行';
if($config->systemMode == 'classic' || !$config->systemMode) $lang->custom->execution = $lang->executionCommon;
@@ -208,6 +210,7 @@ $lang->custom->notice->confirmReviewCase = '是否将待评审的用例修改
$lang->custom->notice->storyReviewTip = '按人员、职位、部门勾选后,取所有人员的并集。';
$lang->custom->notice->selectAllTip = '勾选所有人员后,会清空并置灰评审人员,同时隐藏职位、部门。';
$lang->custom->notice->repeatKey = '%s键重复';
$lang->custom->notice->readOnlyOfCode = '代号是一种管理话术,主要便于保密或作为别名存在。启用代号管理后,系统中的产品、项目、执行在创建、编辑、详情、列表等页面均会展示代号信息。';
$lang->custom->notice->indexPage['product'] = "从8.2版本起增加了产品主页视图,是否默认进入产品主页?";
$lang->custom->notice->indexPage['project'] = "从8.2版本起增加了项目主页视图,是否默认进入项目主页?";
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* The code view file of custom module of ZenTaoPMS.
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(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 Shujie Tian <tianshujie@cnezsoft.com>
* @package custom
* @version $Id$
* @link https://www.zentao.net
*/
?>
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
<div id='mainContent' class='main-content'>
<form class="load-indicator main-form form-ajax" method='post'>
<table class='table table-form'>
<tr>
<th class='c-setCode'><?php echo $lang->custom->setCode;?></th>
<td class='c-code text-left'>
<?php $checkedKey = isset($config->setCode) ? $config->setCode : 1;?>
<?php foreach($lang->custom->conceptOptions->URAndSR as $key => $value):?>
<label class="radio-inline"><input type="radio" name="code" value="<?php echo $key?>"<?php echo $key == $checkedKey ? " checked='checked'" : ''?> id="code<?php echo $key;?>"><?php echo $value;?></label>
<?php endforeach;?>
</td>
<td></td>
</tr>
<tr>
<th></th>
<td colspan="2" id="readOnlyOfCode">
<div class="inline-block"><i class="icon-exclamation-sign"></i>&nbsp;</div>
<div class="inline-block"><?php echo $lang->custom->notice->readOnlyOfCode;?></div>
</td>
</tr>
<tr>
<th></th>
<td class='form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>
+15 -5
View File
@@ -139,7 +139,14 @@ $config->execution->gantt->linkType['end']['end'] = 2;
$config->execution->gantt->linkType['begin']['end'] = 3;
$config->execution->datatable = new stdclass();
$config->execution->datatable->defaultField = array('id', 'name', 'code', 'project', 'PM', 'status', 'progress', 'percent', 'attribute', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn', 'actions');
if(!isset($config->setCode) or $config->setCode == 1)
{
$config->execution->datatable->defaultField = array('id', 'name', 'code', 'project', 'PM', 'status', 'progress', 'percent', 'attribute', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn', 'actions');
}
else
{
$config->execution->datatable->defaultField = array('id', 'name', 'project', 'PM', 'status', 'progress', 'percent', 'attribute', 'begin', 'end', 'estimate', 'consumed', 'left', 'burn', 'actions');
}
$config->execution->datatable->fieldList['id']['title'] = 'idAB';
$config->execution->datatable->fieldList['id']['fixed'] = 'left';
@@ -151,10 +158,13 @@ $config->execution->datatable->fieldList['name']['fixed'] = 'left';
$config->execution->datatable->fieldList['name']['width'] = 'auto';
$config->execution->datatable->fieldList['name']['required'] = 'yes';
$config->execution->datatable->fieldList['code']['title'] = 'code';
$config->execution->datatable->fieldList['code']['fixed'] = 'no';
$config->execution->datatable->fieldList['code']['width'] = '95';
$config->execution->datatable->fieldList['code']['required'] = 'no';
if(!isset($config->setCode) or $config->setCode == 1)
{
$config->execution->datatable->fieldList['code']['title'] = 'code';
$config->execution->datatable->fieldList['code']['fixed'] = 'no';
$config->execution->datatable->fieldList['code']['width'] = '95';
$config->execution->datatable->fieldList['code']['required'] = 'no';
}
$config->execution->datatable->fieldList['project']['title'] = 'project';
$config->execution->datatable->fieldList['project']['fixed'] = 'no';
+5 -4
View File
@@ -462,7 +462,7 @@ class executionModel extends model
$oldExecution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch();
/* Judgment of required items. */
if($oldExecution->type != 'stage' and $this->post->code == '')
if($oldExecution->type != 'stage' and $this->post->code == '' and (!isset($this->config->setCode) or $this->config->setCode == 1))
{
dao::$errors['code'] = sprintf($this->lang->error->notempty, $this->lang->execution->code);
return false;
@@ -660,13 +660,12 @@ class executionModel extends model
foreach($data->executionIDList as $executionID)
{
$executionName = $data->names[$executionID];
$executionCode = $data->codes[$executionID];
if(isset($data->codes)) $executionCode = $data->codes[$executionID];
$executionID = (int)$executionID;
$executions[$executionID] = new stdClass();
$executions[$executionID]->id = $executionID;
$executions[$executionID]->name = $executionName;
$executions[$executionID]->code = $executionCode;
$executions[$executionID]->PM = $data->PMs[$executionID];
$executions[$executionID]->PO = $data->POs[$executionID];
$executions[$executionID]->QD = $data->QDs[$executionID];
@@ -680,13 +679,15 @@ class executionModel extends model
$executions[$executionID]->days = $data->dayses[$executionID];
$executions[$executionID]->lastEditedBy = $this->app->user->account;
$executions[$executionID]->lastEditedDate = helper::now();
if(isset($data->codes)) $executions[$executionID]->code = $executionCode;
if(isset($data->projects)) $executions[$executionID]->project = zget($data->projects, $executionID, 0);
if(isset($data->attributes)) $executions[$executionID]->attribute = zget($data->attributes, $executionID, '');
if($executions[$executionID]->status == 'closed') $executions[$executionID]->closedDate = helper::now();
if($executions[$executionID]->status == 'suspended') $executions[$executionID]->suspendedDate = helper::today();
/* Check unique code for edited executions. */
if($projectModel == 'scrum' and empty($executionCode))
if($projectModel == 'scrum' and isset($executionCode) and empty($executionCode))
{
dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->notempty, $this->lang->project->code);
return false;
+11 -9
View File
@@ -35,14 +35,12 @@
}
}
$minWidth = (count($visibleFields) > 5) ? 'w-150px' : '';
$name = $from == 'execution' ? 'execName' : 'name';
$code = $from == 'execution' ? 'execCode' : 'code';
$PM = $from == 'execution' ? 'execPM' : 'PM';
$type = $from == 'execution' ? 'execType' : 'type';
$desc = $from == 'execution' ? 'execDesc' : 'desc';
$status = $from == 'execution' ? 'execStatus' : 'status';
$name = $from == 'execution' ? 'execName' : 'name';
$code = $from == 'execution' ? 'execCode' : 'code';
$PM = $from == 'execution' ? 'execPM' : 'PM';
$type = $from == 'execution' ? 'execType' : 'type';
$desc = $from == 'execution' ? 'execDesc' : 'desc';
$status = $from == 'execution' ? 'execStatus' : 'status';
?>
<form class='main-form' method='post' target='hiddenwin' id='executionForm' action='<?php echo inLink('batchEdit');?>'>
<div class="table-responsive">
@@ -54,7 +52,9 @@
<th class='c-project required' style="width:100%"><?php echo $lang->execution->projectName;?></th>
<?php endif;?>
<th class='required <?php echo $minWidth?>' style="width:100%"><?php echo $lang->execution->$name;?></th>
<?php if(!isset($config->setCode) and $config->setCode == 1):?>
<th class='c-code required'><?php echo $lang->execution->$code;?></th>
<?php endif;?>
<th class='c-user<?php echo zget($visibleFields, 'PM', ' hidden') . zget($requiredFields, 'PM', '', ' required');?>'><?php echo $lang->execution->$PM;?></th>
<th class='c-user<?php echo zget($visibleFields, 'PO', ' hidden') . zget($requiredFields, 'PO', '', ' required');?>'><?php echo $lang->execution->PO;?></th>
<th class='c-user<?php echo zget($visibleFields, 'QD', ' hidden') . zget($requiredFields, 'QD', '', ' required');?>'><?php echo $lang->execution->QD;?></th>
@@ -86,7 +86,9 @@
<td class='text-left' style='overflow:visible'><?php echo html::select("projects[$executionID]", $allProjects, $executions[$executionID]->project, "class='form-control picker-select' data-lastselected='{$executions[$executionID]->project}' onchange='changeProject(this, $executionID, {$executions[$executionID]->project})'");?></td>
<?php endif;?>
<td title='<?php echo $executions[$executionID]->name?>'><?php echo html::input("names[$executionID]", $executions[$executionID]->name, "id='names{$executionID}' class='form-control'");?></td>
<td><?php echo html::input("codes[$executionID]", $executions[$executionID]->code, "class='form-control'");?></td>
<?php if(!isset($config->setCode) and $config->setCode == 1):?>
<td><?php echo html::input("codes[$executionID]", $executions[$executionID]->code, "class='form-control'");?></td>
<?php endif;?>
<td class='text-left<?php echo zget($visibleFields, 'PM', ' hidden')?>' style='overflow:visible'><?php echo html::select("PMs[$executionID]", $pmUsers, $executions[$executionID]->PM, "class='form-control picker-select'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'PO', ' hidden')?>' style='overflow:visible'><?php echo html::select("POs[$executionID]", $poUsers, $executions[$executionID]->PO, "class='form-control picker-select'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'QD', ' hidden')?>' style='overflow:visible'><?php echo html::select("QDs[$executionID]", $qdUsers, $executions[$executionID]->QD, "class='form-control picker-select'");?></td>
+2
View File
@@ -70,10 +70,12 @@
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td>
<td colspan='2'></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $showExecutionExec ? $lang->execution->execCode : $lang->execution->code;?></th>
<td><?php echo html::input('code', $code, "class='form-control' required");?></td><td></td><td></td>
</tr>
<?php endif;?>
<tr>
<th id='dateRange'><?php echo $lang->execution->dateRange;?></th>
<td>
+2
View File
@@ -39,10 +39,12 @@
<th class='w-120px'><?php echo $lang->execution->name;?></th>
<td><?php echo html::input('name', $execution->name, "class='form-control' required");?></td><td></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $lang->execution->code;?></th>
<td><?php echo html::input('code', $execution->code, "class='form-control' required");?></td>
</tr>
<?php endif;?>
<tr>
<th id="dateRange"><?php echo $lang->execution->dateRange;?></th>
<td>
+2 -1
View File
@@ -158,7 +158,8 @@
<div class="col-sm-12">
<div class="cell">
<div class="detail">
<h2 class="detail-title"><span class="label-id"><?php echo $execution->id;?></span> <span class="label label-light label-outline"><?php echo $execution->code;?></span> <?php echo $execution->name;?></h2>
<?php $hiddenCode = (isset($config->setCode) and $config->setCode == 0) ? 'hidden' : '';?>
<h2 class="detail-title"><span class="label-id"><?php echo $execution->id;?></span> <span class="label label-light label-outline <?php echo $hiddenCode;?>"><?php echo $execution->code;?></span> <?php echo $execution->name;?></h2>
<div class="detail-content article-content">
<div><span class="text-limit hidden" data-limit-size="40"><?php echo $execution->desc;?></span><a class="text-primary text-limit-toggle small" data-text-expand="<?php echo $lang->expand;?>" data-text-collapse="<?php echo $lang->collapse;?>"></a></div>
<p>
+22
View File
@@ -197,4 +197,26 @@ class gitea extends control
$this->view->matchedResult = $this->gitea->getMatchedUsers($giteaID, $this->view->giteaUsers, $zentaoUsers);
$this->display();
}
/**
* Ajax getProjectBranches
*
* @param int $giteaID
* @param string $project
* @access public
* @return void
*/
public function ajaxGetProjectBranches($giteaID, $project)
{
if(!$giteaID or !$project) return $this->send(array('message' => array()));
$project = urldecode(base64_decode($project));
$branches = $this->gitea->apiGetBranches($giteaID, $project);
$options = "<option value=''></option>";
foreach($branches as $branch)
{
$options .= "<option value='{$branch->name}'>{$branch->name}</option>";
}
$this->send($options);
}
}
+114 -2
View File
@@ -376,8 +376,17 @@ class giteaModel extends model
$apiRoot = $this->getApiRoot($giteaID);
if(!$apiRoot) return array();
$url = sprintf($apiRoot, "/repos/$projectID");
return json_decode(commonModel::http($url));
$url = sprintf($apiRoot, "/repos/$projectID");
$project = json_decode(commonModel::http($url));
if(isset($project->name))
{
$project->name_with_namespace = $project->full_name;
$project->path_with_namespace = $project->full_name;
$project->http_url_to_repo = $project->html_url;
$project->name_with_namespace = $project->full_name;
}
return $project;
}
/**
@@ -454,4 +463,107 @@ class giteaModel extends model
return $users;
}
/**
* Get project repository branches by api.
*
* @param int $giteaID
* @param string $project
* @access public
* @return object
*/
public function apiGetBranches($giteaID, $project, $pager = null)
{
$url = sprintf($this->getApiRoot($giteaID), "/repos/{$project}/branches");
$allResults = array();
for($page = 1; true; $page++)
{
$results = json_decode(commonModel::http($url . "&page={$page}&limit=50"));
if(!is_array($results)) break;
if(!empty($results)) $allResults = array_merge($allResults, $results);
if(count($results) < 100) break;
}
return $allResults;
}
/**
* Get Forks of a project by API.
*
* @param int $giteaID
* @param string $projectID
* @access public
* @return object
*/
public function apiGetForks($giteaID, $projectID)
{
$url = sprintf($this->getApiRoot($giteaID), "/repos/$projectID/forks");
return json_decode(commonModel::http($url));
}
/**
* Get upstream project by API.
*
* @param int $giteaID
* @param string $projectID
* @access public
* @return void
*/
public function apiGetUpstream($giteaID, $projectID)
{
$currentProject = $this->apiGetSingleProject($giteaID, $projectID);
if(isset($currentProject->parent->full_name)) return $currentProject->parent->full_name;
return array();
}
/**
* Get branches.
*
* @param int $giteaID
* @param string $project
* @access public
* @return array
*/
public function getBranches($giteaID, $project)
{
$rawBranches = $this->apiGetBranches($giteaID, $project);
$branches = array();
foreach($rawBranches as $branch) $branches[] = $branch->name;
return $branches;
}
/**
* Get gitea user id and realname pairs of one gitea.
*
* @param int $giteaID
* @access public
* @return array
*/
public function getUserIdRealnamePairs($giteaID)
{
return $this->dao->select('oauth.openID as openID,user.realname as realname')
->from(TABLE_OAUTH)->alias('oauth')
->leftJoin(TABLE_USER)->alias('user')
->on("oauth.account = user.account")
->where('providerType')->eq('gitea')
->andWhere('providerID')->eq($giteaID)
->fetchPairs();
}
/**
* Get single branch by API.
*
* @param int $giteaID
* @param int $projectID
* @param string $branch
* @access public
* @return object
*/
public function apiGetSingleBranch($giteaID, $projectID, $branch)
{
$url = sprintf($this->getApiRoot($giteaID), "/repos/$projectID/branches/$branch");
return json_decode(commonModel::http($url));
}
}
+1 -1
View File
@@ -720,7 +720,7 @@ class gitlab extends control
}
$gitlab = $this->gitlab->getByID($gitlabID);
$repos = $this->loadModel('repo')->getGitLabRepoList($gitlabID);
$repos = $this->loadModel('repo')->getRepoListByClient($gitlabID);
$repoPairs = array();
foreach($repos as $repo) $repoPairs[$repo->path] = $repo->id;
+3
View File
@@ -1284,6 +1284,7 @@ $lang->resource->custom->browseStoryConcept = 'browseStoryConcept';
$lang->resource->custom->setDefaultConcept = 'setDefaultConcept';
$lang->resource->custom->deleteStoryConcept = 'deleteStoryConcept';
$lang->resource->custom->kanban = 'kanban';
$lang->resource->custom->code = 'code';
$lang->custom->methodOrder[5] = 'index';
$lang->custom->methodOrder[10] = 'set';
@@ -1300,6 +1301,8 @@ $lang->custom->methodOrder[60] = 'editStoryConcept';
$lang->custom->methodOrder[65] = 'browseStoryConcept';
$lang->custom->methodOrder[70] = 'setDefaultConcept';
$lang->custom->methodOrder[75] = 'deleteStoryConcept';
$lang->custom->methodOrder[80] = 'kanban';
$lang->custom->methodOrder[85] = 'code';
$lang->resource->datatable = new stdclass();
$lang->resource->datatable->setGlobal = 'setGlobal';
+1 -1
View File
@@ -1,5 +1,5 @@
.tree .active{font-weight: bold;}
.with-side .side {position: absolute; width: 130px;}
.with-side .main {padding-left: 145px; float: left;}
.side-col {width: 140px;}
.side-col {width: 160px;}
.panel-sm .panel-body {padding: 10px;}
+3 -4
View File
@@ -1852,11 +1852,10 @@ class kanban extends control
public function ajaxGetContactUsers($field, $contactListID)
{
$this->loadModel('user');
$list = $contactListID ? $this->user->getContactListByID($contactListID) : '';
$list = $contactListID ? $this->user->getContactListByID($contactListID) : '';
$users = $this->user->getPairs('nodeleted|noclosed', '', $this->config->maxCount);
$users = $this->user->getPairs('devfirst|nodeleted|noclosed', $list ? $list->userList : '', $this->config->maxCount);
if(!$contactListID) return print(html::select($field . '[]', $users, '', "class='form-control picker-select' multiple"));
if(!$contactListID or !isset($list->userList)) return print(html::select($field . '[]', $users, '', "class='form-control picker-select' multiple"));
return print(html::select($field . '[]', $users, $list->userList, "class='form-control picker-select' multiple"));
}
+4 -2
View File
@@ -23,5 +23,7 @@
#copyKanbanModal .copyContentBox > .checkbox-primary {display: inline-block; margin-left: 10px; margin-top: -1px;}
#copyKanbanModal .copyContentBox > .checkbox-primary:first-child {margin-left: 20px;}
#copyContentbasicInfo {cursor: not-allowed;}
#team ~ #contactListMenu_chosen, #whitelist ~ #contactListMenu_chosen {vertical-align: top;}
#team ~ #contactListMenu_chosen > .chosen-drop, #whitelist ~ #contactListMenu_chosen > .chosen-drop {top: 32px;}
#team ~ #contactListMenu_chosen {vertical-align: top;}
#whitelist ~ #contactListMenu_chosen {vertical-align: bottom;}
#team ~ #contactListMenu_chosen > .chosen-drop {top: 32px;}
#whitelist ~ #contactListMenu_chosen > .chosen-drop {bottom: 32px;}
+4 -2
View File
@@ -10,5 +10,7 @@
#mainContent .objectBox .checkbox-primary>label:after {width: 14px; height: 14px;}
[lang^='en'] .columnWidth {width: 120px;}
[lang^='zh-cn'] .columnWidth {width: 80px;}
#team ~ #contactListMenu_chosen, #whitelist ~ #contactListMenu_chosen {vertical-align: top;}
#team ~ #contactListMenu_chosen > .chosen-drop, #whitelist ~ #contactListMenu_chosen > .chosen-drop {top: 32px;}
#team ~ #contactListMenu_chosen {vertical-align: top;}
#whitelist ~ #contactListMenu_chosen {vertical-align: bottom;}
#team ~ #contactListMenu_chosen > .chosen-drop {top: 32px;}
#whitelist ~ #contactListMenu_chosen > .chosen-drop {bottom: 32px;}
+20
View File
@@ -128,3 +128,23 @@ function loadAllUsers()
$('#owner').chosen();
});
}
/**
* The owners that loads kanban.
*
* @oaram int spaceID
* @access public
* @return void
*/
function loadOwners(spaceID)
{
var link = createLink('kanban', 'ajaxLoadUsers', 'spaceID='+ spaceID + '&field=owner&selectedUser=' + $('#owner').val());
$.get(link, function(data)
{
$('#owner').replaceWith(data);
$('#owner' + "_chosen").remove();
$('#owner').next('.picker').remove();
$('#owner').chosen();
});
}
-20
View File
@@ -92,23 +92,3 @@ function loadUsers(spaceID)
if(spaceType != 'private') loadOwners(spaceID);
}
/**
* The owners that loads kanban.
*
* @oaram int spaceID
* @access public
* @return void
*/
function loadOwners(spaceID)
{
var link = createLink('kanban', 'ajaxLoadUsers', 'spaceID='+ spaceID + '&field=owner&selectedUser=' + $('#owner').val());
$.get(link, function(data)
{
$('#owner').replaceWith(data);
$('#owner' + "_chosen").remove();
$('#owner').next('.picker').remove();
$('#owner').chosen();
});
}
+2 -2
View File
@@ -59,7 +59,7 @@
<td colspan='2'>
<div class="input-group">
<?php echo html::select('team[]', $users, isset($copyKanban->team) ? $copyKanban->team : '', "class='form-control picker-select' multiple data-dropDirection='bottom'");?>
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=team');?>
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=team");?>
</div>
</td>
</tr>
@@ -100,7 +100,7 @@
<td colspan='2'>
<div class="input-group">
<?php echo html::select('whitelist[]', $users, isset($copyKanban->whitelist) ? $copyKanban->whitelist : '', 'class="form-control picker-select" multiple');?>
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=whitelist');?>
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=whitelist&attr=data-drop_direction='up'");?>
</div>
</td>
</tr>
+1 -1
View File
@@ -36,7 +36,7 @@
<td colspan='2'>
<div class="input-group">
<?php echo html::select('team[]', $users, '', "class='form-control picker-select' multiple data-drop-direction='bottom'");?>
<?php echo $this->fetch('my', 'buildContactLists');?>
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=team");?>
</div>
</td>
</tr>
+2 -2
View File
@@ -22,7 +22,7 @@
<table class='table table-form'>
<tr>
<th><?php echo $lang->kanban->space;?></th>
<td><?php echo html::select('space', $spacePairs, $kanban->space, "class='form-control chosen'");?></td>
<td><?php echo html::select('space', $spacePairs, $kanban->space, "class='form-control chosen' onchange='loadOwners(this.value)'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanban->WIPCount;?></th>
@@ -99,7 +99,7 @@
<td colspan='2'>
<div class="input-group">
<?php echo html::select('whitelist[]', $users, $kanban->whitelist, 'class="form-control picker-select" multiple');?>
<?php echo $this->fetch('my', 'buildContactLists', 'dropdownName=whitelist');?>
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=whitelist&attr=data-drop_direction='up'");?>
</div>
</td>
</tr>
+1 -1
View File
@@ -37,7 +37,7 @@
<td colspan='2'>
<div class="input-group">
<?php echo html::select('team[]', $users, $team, "class='form-control picker-select' multiple data-drop-direction='bottom'");?>
<?php echo $this->fetch('my', 'buildContactLists');?>
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=team");?>
</div>
</td>
</tr>
+2
View File
@@ -32,3 +32,5 @@ $config->mrapproval = new stdclass();
$config->mrapproval->create = new stdclass();
$config->mrapproval->create->skippedFields = '';
$config->mrapproval->create->requiredFields = 'mrID,account,date,action';
$config->mr->gitServiceList = array('gitlab', 'gitea');
+104 -85
View File
@@ -34,25 +34,24 @@ class mr extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$repos = $this->loadModel('repo')->getListBySCM('Gitlab');
$repos = $this->loadModel('repo')->getListBySCM(array('Gitlab', 'Gitea'));
if(empty($repos)) $this->locate($this->repo->createLink('create'));
$repoID = $this->repo->saveState($repoID, $objectID);
$repo = $this->repo->getRepoByID($repoID);
if($repo->SCM != 'Gitlab') $repo = $repos[0];
if(!in_array(strtolower($repo->SCM), $this->config->mr->gitServiceList)) $repo = $repos[0];
$this->loadModel('ci')->setMenu($repo->id);
$projects = $this->mr->getAllGitlabProjects($repoID);
$projects = $this->mr->getAllProjects($repoID, $repo->SCM);
$MRList = $this->mr->getList($mode, $param, $orderBy, $pager, empty($projects) ? false : $projects, $repoID);
/* Save current URI to session. */
$this->session->set('mrList', $this->app->getURI(true), 'repo');
/* Sync GitLab MR to ZenTao Database. */
$MRList = $this->mr->batchSyncMR($MRList);
$MRList = $this->mr->batchSyncMR($MRList, $repo->SCM);
/* Check whether Mr is linked with the product. */
$this->loadModel('gitlab');
foreach($MRList as $MR)
{
$product = $this->mr->getMRProduct($MR);
@@ -63,7 +62,17 @@ class mr extends control
$this->app->loadLang('compile');
$openIDList = array();
if(!$this->app->user->admin) $openIDList = $this->loadModel('gitlab')->getGitLabListByAccount($this->app->user->account);
if(!$this->app->user->admin)
{
if($repo->SCM == 'Gitlab')
{
$openIDList = $this->loadModel('gitlab')->getGitLabListByAccount($this->app->user->account);
}
else
{
$openIDList = $this->loadModel('gitea')->getGiteaListByAccount($this->app->user->account);
}
}
$this->view->title = $this->lang->mr->common . $this->lang->colon . $this->lang->mr->browse;
$this->view->MRList = $MRList;
@@ -95,19 +104,30 @@ class mr extends control
return $this->send($result);
}
$gitlabHosts = $this->loadModel('gitlab')->getPairs();
$gitlabUsers = $this->gitlab->getGitLabListByAccount();
foreach($gitlabHosts as $gitlabID=> $gitlabHost)
$hosts = $this->loadModel('pipeline')->getList(array('gitea', 'gitlab'));
if(!$this->app->user->admin)
{
if(!$this->app->user->admin and !isset($gitlabUsers[$gitlabID])) unset($gitlabHosts[$gitlabID]);
$gitlabUsers = $this->loadModel('gitlab')->getGitLabListByAccount();
$giteaUsers = $this->loadModel('gitea')->getGiteaListByAccount();
foreach($hosts as $hostID => $host)
{
if($host->type == 'gitLab' and isset($gitlabUsers[$hostID])) continue;
if($host->type == 'gitea' and isset($giteaUsers[$hostID])) continue;
unset($hosts[$hostID]);
}
}
$hostPairs = array();
foreach($hosts as $host) $hostPairs[$host->id] = '[' . ucfirst($host->type) . "] {$host->name}";
$this->app->loadLang('repo'); /* Import lang in repo module. */
$this->app->loadLang('compile');
$this->view->title = $this->lang->mr->create;
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->jobList = $this->loadModel('job')->getList();
$this->view->gitlabHosts = $gitlabHosts;
$this->view->title = $this->lang->mr->create;
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->jobList = $this->loadModel('job')->getList();
$this->view->hostPairs = $hostPairs;
$this->view->hosts = $hosts;
$this->display();
}
@@ -126,38 +146,33 @@ class mr extends control
}
$MR = $this->mr->getByID($MRID);
if(isset($MR->gitlabID)) $rawMR = $this->mr->apiGetSingleMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
if(isset($MR->hostID)) $rawMR = $this->mr->apiGetSingleMR($MR->hostID, $MR->targetProject, $MR->mriid);
$this->view->title = $this->lang->mr->edit;
$this->view->MR = $MR;
$this->view->rawMR = isset($rawMR) ? $rawMR : false;
if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display();
$branchList = $this->loadModel('gitlab')->getBranches($MR->gitlabID, $MR->targetProject);
$host = $this->loadModel('pipeline')->getByID($MR->hostID);
$scm = $host->type;
$branchList = $this->loadModel($scm)->getBranches($MR->hostID, $MR->targetProject);
$targetBranchList = array();
foreach($branchList as $branch) $targetBranchList[$branch] = $branch;
/* Fetch user list both in Zentao and current GitLab project. */
$bindedUsers = $this->gitlab->getUserIdRealnamePairs($MR->gitlabID);
$rawProjectUsers = $this->gitlab->apiGetProjectUsers($MR->gitlabID, $MR->targetProject);
$users = array();
foreach($rawProjectUsers as $rawProjectUser)
{
if(!empty($bindedUsers[$rawProjectUser->id])) $users[$rawProjectUser->id] = $bindedUsers[$rawProjectUser->id];
}
$gitlabUsers = $this->gitlab->getUserAccountIdPairs($MR->gitlabID);
$bindedUsers = $this->$scm->getUserIdRealnamePairs($MR->hostID);
$gitUsers = $this->$scm->getUserAccountIdPairs($MR->hostID);
/* Check permissions. */
if(!$this->app->user->admin)
if(!$this->app->user->admin and $scm == 'gitlab')
{
$groupIDList = array(0 => 0);
$groups = $this->gitlab->apiGetGroups($MR->gitlabID, 'name_asc', 'developer');
$groups = $this->scm->apiGetGroups($MR->hostID, 'name_asc', 'developer');
foreach($groups as $group) $groupIDList[] = $group->id;
$sourceProject = $this->gitlab->apiGetSingleProject($MR->gitlabID, $MR->sourceProject);
$isDeveloper = $this->gitlab->checkUserAccess($MR->gitlabID, 0, $sourceProject, $groupIDList, 'developer');
$sourceProject = $this->scm->apiGetSingleProject($MR->hostID, $MR->sourceProject);
$isDeveloper = $this->scm->checkUserAccess($MR->hostID, 0, $sourceProject, $groupIDList, 'developer');
if(!isset($gitlabUsers[$this->app->user->account]) or !$isDeveloper) return print(js::alert($this->lang->mr->errorLang[3]) . js::locate($this->createLink('mr', 'browse')));
if(!isset($gitUsers[$this->app->user->account]) or !$isDeveloper) return print(js::alert($this->lang->mr->errorLang[3]) . js::locate($this->createLink('mr', 'browse')));
}
/* Import lang for required modules. */
@@ -166,7 +181,7 @@ class mr extends control
$this->loadModel('compile');
$repoList = array();
$rawRepoList = $this->repo->getGitLabRepoList($MR->gitlabID, $MR->sourceProject);
$rawRepoList = $this->repo->getRepoListByClient($MR->hostID, $MR->sourceProject);
foreach($rawRepoList as $rawRepo) $repoList[$rawRepo->id] = "[$rawRepo->id] $rawRepo->name";
$jobList = array();
@@ -181,10 +196,11 @@ class mr extends control
$this->view->title = $this->lang->mr->edit;
$this->view->MR = $MR;
$this->view->host = $host;
$this->view->targetBranchList = $targetBranchList;
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->view->assignee = $MR->assignee;
$this->view->reviewer = zget($gitlabUsers, $MR->reviewer, '');
$this->view->reviewer = zget($gitUsers, $MR->reviewer, '');
$this->display();
}
@@ -204,12 +220,12 @@ class mr extends control
if($MR->synced)
{
$res = $this->mr->apiDeleteMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
$res = $this->mr->apiDeleteMR($MR->hostID, $MR->targetProject, $MR->mriid);
if(isset($res->message)) return print(js::alert($this->mr->convertApiError($res->message)));
}
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($id)->exec();
echo js::locate(inlink('browse'), 'parent');
echo js::reload('parent');
}
/**
@@ -223,23 +239,25 @@ class mr extends control
{
$MR = $this->mr->getByID($id);
if(!$MR) return print(js::error($this->lang->notFound) . js::locate($this->createLink('mr', 'browse')));
if(isset($MR->gitlabID)) $rawMR = $this->mr->apiGetSingleMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
if(isset($MR->hostID)) $rawMR = $this->mr->apiGetSingleMR($MR->hostID, $MR->targetProject, $MR->mriid);
if($MR->synced and (!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR))) return $this->display();
$this->loadModel('gitlab');
$host = $this->loadModel('pipeline')->getByID($MR->hostID);
$scm = $host->type;
$this->loadModel($scm);
$this->loadModel('job');
/* Sync MR from GitLab to ZentaoPMS. */
$MR = $this->mr->apiSyncMR($MR);
$sourceProject = $this->gitlab->apiGetSingleProject($MR->gitlabID, $MR->sourceProject);
$targetProject = $this->gitlab->apiGetSingleProject($MR->gitlabID, $MR->targetProject);
$sourceBranch = $this->gitlab->apiGetSingleBranch($MR->gitlabID, $MR->sourceProject, $MR->sourceBranch);
$targetBranch = $this->gitlab->apiGetSingleBranch($MR->gitlabID, $MR->targetProject, $MR->targetBranch);
$sourceProject = $this->$scm->apiGetSingleProject($MR->hostID, $MR->sourceProject);
$targetProject = $this->$scm->apiGetSingleProject($MR->hostID, $MR->targetProject);
$sourceBranch = $this->$scm->apiGetSingleBranch($MR->hostID, $MR->sourceProject, $MR->sourceBranch);
$targetBranch = $this->$scm->apiGetSingleBranch($MR->hostID, $MR->targetProject, $MR->targetBranch);
$projectOwner = true;
if(isset($MR->gitlabID) and !$this->app->user->admin)
if(isset($MR->hostID) and !$this->app->user->admin)
{
$openID = $this->gitlab->getUserIDByZentaoAccount($MR->gitlabID, $this->app->user->account);
$openID = $this->$scm->getUserIDByZentaoAccount($MR->hostID, $this->app->user->account);
if(!$projectOwner and isset($sourceProject->owner->id) and $sourceProject->owner->id == $openID) $projectOwner = true;
}
@@ -320,22 +338,10 @@ class mr extends control
}
}
/* Accept MR by using the mapped user in GitLab. */
$sudoUser = $this->mr->getSudoUsername($MR->gitlabID, $MR->targetProject);
if(isset($MR->gitlabID))
{
if(!empty($sudoUser)) $rawMR = $this->mr->apiAcceptMR($MR->gitlabID, $MR->targetProject, $MR->mriid, $sudoUser);
if(empty($sudoUser)) $rawMR = $this->mr->apiAcceptMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
}
if(isset($MR->hostID)) $rawMR = $this->mr->apiAcceptMR($MR->hostID, $MR->targetProject, $MR->mriid, $MR);
if(isset($rawMR->state) and $rawMR->state == 'merged')
{
///* Force reload when locate to the url. */
//$random = uniqid();
//return $this->send(array('result' => 'success', 'message' => $this->lang->mr->mergeSuccess, 'locate' => helper::createLink('mr', 'browse', "random={$random}")));
$this->mr->logMergedAction($MR);
return $this->send(array('result' => 'success', 'message' => $this->lang->mr->mergeSuccess, 'locate' => helper::createLink('mr', 'browse')));
}
@@ -372,7 +378,7 @@ class mr extends control
$rawMR = null;
if($MR->synced)
{
$rawMR = $this->mr->apiGetSingleMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
$rawMR = $this->mr->apiGetSingleMR($MR->hostID, $MR->targetProject, $MR->mriid);
if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display();
}
$this->view->rawMR = $rawMR;
@@ -594,7 +600,7 @@ class mr extends control
$this->loadModel('search')->setSearchParams($this->config->product->search);
$MR = $this->mr->getByID($MRID);
$relatedStories = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'story');
$relatedStories = $this->mr->getCommitedLink($MR->hostID, $MR->targetProject, $MR->mriid, 'story');
$linkedStories = $this->mr->getLinkList($MRID, $product->id, 'story');
if($browseType == 'bySearch')
@@ -679,7 +685,7 @@ class mr extends control
$this->loadModel('search')->setSearchParams($this->config->bug->search);
$MR = $this->mr->getByID($MRID);
$relatedBugs = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'bug');
$relatedBugs = $this->mr->getCommitedLink($MR->hostID, $MR->targetProject, $MR->mriid, 'bug');
$linkedBugs = $this->mr->getLinkList($MRID, $product->id, 'bug');
if($browseType == 'bySearch')
@@ -751,7 +757,7 @@ class mr extends control
$this->loadModel('search')->setSearchParams($this->config->execution->search);
$MR = $this->mr->getByID($MRID);
$relatedTasks = $this->mr->getCommitedLink($MR->gitlabID, $MR->targetProject, $MR->mriid, 'task');
$relatedTasks = $this->mr->getCommitedLink($MR->hostID, $MR->targetProject, $MR->mriid, 'task');
$linkedTasks = $this->mr->getLinkList($MRID, $product->id, 'task');
/* Get executions by product. */
@@ -884,46 +890,57 @@ class mr extends control
/**
* AJAX: Get MR target projects.
*
* @param int $gitlabID
* @param int $hostID
* @param int $projectID
* @param string $scm
* @access public
* @return void
*/
public function ajaxGetMRTargetProjects($gitlabID, $projectID)
public function ajaxGetMRTargetProjects($hostID, $projectID, $scm = 'gitlab')
{
$this->loadModel('gitlab');
$this->loadModel($scm);
if($scm != 'gitlab') $projectID = urldecode(base64_decode($projectID));
/* First step: get forks. Only get first level forks(not recursively). */
$projects = $this->gitlab->apiGetForks($gitlabID, $projectID);
$projects = $scm == 'gitlab' ? $this->$scm->apiGetForks($hostID, $projectID) : array();
/* Second step: get project itself. */
$projects[] = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
$projects[] = $this->$scm->apiGetSingleProject($hostID, $projectID);
/* Last step: find its upstream recursively. */
$project = $this->gitlab->apiGetUpstream($gitlabID, $projectID);
$project = $this->$scm->apiGetUpstream($hostID, $projectID);
if(!empty($project)) $projects[] = $project;
while(!empty($project) and isset($project->id))
if(!empty($project) and isset($project->id))
{
$project = $this->gitlab->apiGetUpstream($gitlabID, $project->id);
if(empty($project)) break;
$projects[] = $project;
$project = $this->$scm->apiGetUpstream($hostID, $project->id);
if(!empty($project)) $projects[] = $project;
}
$groupIDList = array(0 => 0);
$groups = $this->gitlab->apiGetGroups($gitlabID, 'name_asc', 'developer');
foreach($groups as $group) $groupIDList[] = $group->id;
foreach($projects as $key => $project)
if($scm == 'gitlab')
{
if($this->gitlab->checkUserAccess($gitlabID, 0, $project, $groupIDList, 'developer') == false) unset($projects[$key]);
}
$groupIDList = array(0 => 0);
$groups = $this->$scm->apiGetGroups($hostID, 'name_asc', 'developer');
foreach($groups as $group) $groupIDList[] = $group->id;
foreach($projects as $key => $project)
{
if($this->$scm->checkUserAccess($hostID, 0, $project, $groupIDList, 'developer') == false) unset($projects[$key]);
}
if(!$projects) return $this->send(array('message' => array()));
if(!$projects) return $this->send(array('message' => array()));
}
$options = "<option value=''></option>";
foreach($projects as $project)
{
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name_with_namespace}</option>";
if($scm == 'gitlab')
{
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name_with_namespace}</option>";
}
else
{
$options .= "<option value='{$project->full_name}' data-name='{$project->full_name}'>{$project->full_name}</option>";
}
}
$this->send($options);
@@ -932,14 +949,16 @@ class mr extends control
/**
* AJAX: Get repo list.
*
* @param int $gitlabID
* @param int $hostID
* @param int $projectID
* @return void
*/
public function ajaxGetRepoList($gitlabID, $projectID)
public function ajaxGetRepoList($hostID, $projectID)
{
$this->loadModel('repo');
$repoList = $this->repo->getGitLabRepoList($gitlabID, $projectID);
$host = $this->loadModel('pipeline')->getByID($hostID);
if($host->type != 'gitlab') $projectID =urldecode(base64_decode($projectID));
$repoList = $this->loadModel('repo')->getRepoListByClient($hostID, $projectID);
if(!$repoList) return $this->send(array('message' => array()));
$options = "<option value=''></option>";
@@ -984,18 +1003,18 @@ class mr extends control
/**
* Ajax check same opened mr for source branch.
*
* @param int $gitlabID
* @param int $hostID
* @access public
* @return void
*/
public function ajaxCheckSameOpened($gitlabID)
public function ajaxCheckSameOpened($hostID)
{
$sourceProject = $this->post->sourceProject;
$sourceBranch = $this->post->sourceBranch;
$targetProject = $this->post->targetProject;
$targetBranch = $this->post->targetBranch;
$result = $this->mr->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
$result = $this->mr->checkSameOpened($hostID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
echo json_encode($result);
}
}
+39 -35
View File
@@ -1,11 +1,33 @@
/**
* Urlencode param.
*
* @param param $param
* @access public
* @return string
*/
function urlencode(param)
{
var hostID = $('#hostID').val();
if(hosts[hostID].type != 'gitlab') return Base64.encode(encodeURIComponent(param));
return param;
}
$(function()
{
$('#gitlabID').change(function()
$('#hostID').change(function()
{
var gitlabID = $('#gitlabID').val();
if(gitlabID == '') return false;
var hostID = $('#hostID').val();
if(hostID == '') return false;
var url = createLink('repo', 'ajaxgetgitlabprojects', "gitlabID=" + gitlabID + "&projectIdList=&filter=IS_DEVELOPER");
if(hosts[hostID].type == 'gitlab')
{
var url = createLink('repo', 'ajaxGetGitlabProjects', "gitlabID=" + hostID + "&projectIdList=&filter=IS_DEVELOPER");
}
else
{
var url = createLink('repo', 'ajaxGetGiteaProjects', "giteaID=" + hostID);
}
$.get(url, function(response)
{
$('#sourceProject').html('').append(response);
@@ -15,10 +37,10 @@ $(function()
$('#sourceProject,#targetProject').change(function()
{
var gitlabID = $('#gitlabID').val();
var sourceProject = $(this).val();
var hostID = $('#hostID').val();
var sourceProject = urlencode($(this).val());
var branchSelect = $(this).parents('td').find('select[name*=Branch]');
var branchUrl = createLink('gitlab', 'ajaxgetprojectbranches', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
var branchUrl = createLink(hosts[hostID].type, 'ajaxGetProjectBranches', hosts[hostID].type + "ID=" + hostID + "&projectID=" + sourceProject);
$.get(branchUrl, function(response)
{
branchSelect.html('').append(response);
@@ -29,16 +51,16 @@ $(function()
$('#sourceProject').change(function()
{
var gitlabID = $('#gitlabID').val();
var sourceProject = $(this).val();
var projectUrl = createLink('mr', 'ajaxGetMRTargetProjects', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
var hostID = $('#hostID').val();
var sourceProject = urlencode($(this).val());
var projectUrl = createLink('mr', 'ajaxGetMRTargetProjects', "hostID=" + hostID + "&projectID=" + sourceProject + "&scm=" + hosts[hostID].type);
$.get(projectUrl, function(response)
{
$('#targetProject').html('').append(response);
$('#targetProject').chosen().trigger("chosen:updated");;
});
var repoUrl = createLink('mr', 'ajaxGetRepoList', "gitlabID=" + gitlabID + "&projectID=" + sourceProject);
var repoUrl = createLink('mr', 'ajaxGetRepoList', "hostID=" + hostID + "&projectID=" + sourceProject);
$.get(repoUrl, function(response)
{
$('#repoID').html('').append(response);
@@ -48,15 +70,15 @@ $(function()
$('#sourceBranch,#targetBranch').change(function()
{
var sourceProject = $('#sourceProject').val();
var sourceBranch = $('#sourceBranch').val();
var targetProject = $('#targetProject').val();
var targetBranch = $('#targetBranch').val();
var sourceProject = urlencode($('#sourceProject').val());
var sourceBranch = urlencode($('#sourceBranch').val());
var targetProject = urlencode($('#targetProject').val());
var targetBranch = urlencode($('#targetBranch').val());
if(!sourceProject || !sourceBranch || !targetProject || !targetBranch) return false;
var $this = $(this);
var gitlabID = $('#gitlabID').val();
var repoUrl = createLink('mr', 'ajaxCheckSameOpened', "gitlabID=" + gitlabID);
var hostID = $('#hostID').val();
var repoUrl = createLink('mr', 'ajaxCheckSameOpened', "hostID=" + hostID);
$.post(repoUrl, {"sourceProject": sourceProject, "sourceBranch": sourceBranch, "targetProject": targetProject, "targetBranch": targetBranch}, function(response)
{
response = $.parseJSON(response);
@@ -69,24 +91,6 @@ $(function()
});
});
/*
$('#targetProject').change(function()
{
targetProject = $(this).val();
var gitlabID = $('#gitlabID').val();
var assignee = $("#assignee").parents('td').find('select[name*=assignee]');
var reviewer = $("#reviewer").parents('td').find('select[name*=reviewer]');
usersUrl = createLink('gitlab', 'ajaxgetmruserpairs', "gitlabID=" + gitlabID + "&projectID=" + targetProject);
$.get(usersUrl, function(response)
{
assignee.html('').append(response);
assignee.chosen().trigger("chosen:updated");;
reviewer.html('').append(response);
reviewer.chosen().trigger("chosen:updated");;
});
});
*/
$('#repoID').change(function()
{
var repoID = $(this).val();
+10 -5
View File
@@ -1,6 +1,7 @@
<?php
$lang->mr = new stdclass;
$lang->mr->common = "Merge Request";
$lang->mr->server = "Server";
$lang->mr->view = "Survey";
$lang->mr->create = "Create";
$lang->mr->apiCreate = "Interface: Create";
@@ -13,7 +14,7 @@ $lang->mr->source = 'source';
$lang->mr->target = 'target';
$lang->mr->viewDiff = 'View diff';
$lang->mr->diff = 'View diff';
$lang->mr->viewInGitlab = 'View in GitLab';
$lang->mr->viewInGit = 'View in APP';
$lang->mr->link = 'Link of stories,Bugs,tasks';
$lang->mr->createAction = '%s, <strong>%s</strong> submitted a <a href="%s">Merge Request</a>.';
@@ -38,8 +39,8 @@ $lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = 'Repo';
$lang->mr->jobID = 'Compile job';
$lang->mr->canMerge = "Can merge";
$lang->mr->cantMerge = "不可合并";
$lang->mr->canMerge = "Can be merged";
$lang->mr->cantMerge = "Can not be merged";
$lang->mr->approval = 'Approval';
$lang->mr->approve = 'Approve';
@@ -116,11 +117,15 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
$lang->mr->apiErrorMap[4] = "403 Forbidden";
$lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/";
$lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base";
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
$lang->mr->errorLang[3] = "Unauthorized";
$lang->mr->errorLang[4] = 'Permission denied';
$lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch';
$lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->from = "from";
$lang->mr->to = "to";
@@ -177,7 +182,7 @@ $lang->mr->commandDocument = <<< EOD
git merge --no-ff "%s"</pre>
</p>
<p>
step 4. Push the result of the merge to GitLab
step 4. Push the result of the merge to Git
<pre> git push origin "%s" </pre>
</p>
</div>
@@ -185,7 +190,7 @@ EOD;
$lang->mr->noChanges = "Currently there are no changes in this merge request's source branch. Please push new commits or use a different branch.";
$lang->mr->linkTask = 'Link Tasks';
$lang->mr->linkTask = "Link task";
$lang->mr->unlinkTask = "Remove task";
$lang->mr->linkedTasks = 'Task';
$lang->mr->unlinkedTasks = 'Task not linked';
+9 -4
View File
@@ -1,6 +1,7 @@
<?php
$lang->mr = new stdclass;
$lang->mr->common = "Merge Request";
$lang->mr->server = "Server";
$lang->mr->view = "Survey";
$lang->mr->create = "Create";
$lang->mr->apiCreate = "Interface: Create";
@@ -13,7 +14,7 @@ $lang->mr->source = 'source';
$lang->mr->target = 'target';
$lang->mr->viewDiff = 'View diff';
$lang->mr->diff = 'View diff';
$lang->mr->viewInGitlab = 'View in GitLab';
$lang->mr->viewInGit = 'View in APP';
$lang->mr->link = 'Link of stories,Bugs,tasks';
$lang->mr->createAction = '%s, <strong>%s</strong> submitted a <a href="%s">Merge Request</a>.';
@@ -38,8 +39,8 @@ $lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = 'Repo';
$lang->mr->jobID = 'Compile job';
$lang->mr->canMerge = "Can merge";
$lang->mr->cantMerge = "不可合并";
$lang->mr->canMerge = "Can be merged";
$lang->mr->cantMerge = "Can not be merged";
$lang->mr->approval = 'Approval';
$lang->mr->approve = 'Approve';
@@ -116,11 +117,15 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
$lang->mr->apiErrorMap[4] = "403 Forbidden";
$lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/";
$lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base";
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
$lang->mr->errorLang[3] = "Unauthorized";
$lang->mr->errorLang[4] = 'Permission denied';
$lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch';
$lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->from = "from";
$lang->mr->to = "to";
@@ -177,7 +182,7 @@ $lang->mr->commandDocument = <<< EOD
git merge --no-ff "%s"</pre>
</p>
<p>
step 4. Push the result of the merge to GitLab
step 4. Push the result of the merge to Git
<pre> git push origin "%s" </pre>
</p>
</div>
+10 -5
View File
@@ -1,6 +1,7 @@
<?php
$lang->mr = new stdclass;
$lang->mr->common = "Merge Request";
$lang->mr->server = "Server";
$lang->mr->view = "Survey";
$lang->mr->create = "Create";
$lang->mr->apiCreate = "Interface: Create";
@@ -13,7 +14,7 @@ $lang->mr->source = 'source';
$lang->mr->target = 'target';
$lang->mr->viewDiff = 'View diff';
$lang->mr->diff = 'View diff';
$lang->mr->viewInGitlab = 'View in GitLab';
$lang->mr->viewInGit = 'View in APP';
$lang->mr->link = 'Link of stories,Bugs,tasks';
$lang->mr->createAction = '%s, <strong>%s</strong> submitted a <a href="%s">Merge Request</a>.';
@@ -38,8 +39,8 @@ $lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = 'Repo';
$lang->mr->jobID = 'Compile job';
$lang->mr->canMerge = "Can merge";
$lang->mr->cantMerge = "不可合并";
$lang->mr->canMerge = "Can be merged";
$lang->mr->cantMerge = "Can not be merged";
$lang->mr->approval = 'Approval';
$lang->mr->approve = 'Approve';
@@ -116,11 +117,15 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
$lang->mr->apiErrorMap[4] = "403 Forbidden";
$lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/";
$lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base";
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
$lang->mr->errorLang[3] = "Unauthorized";
$lang->mr->errorLang[4] = 'Permission denied';
$lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch';
$lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->from = "from";
$lang->mr->to = "to";
@@ -177,7 +182,7 @@ $lang->mr->commandDocument = <<< EOD
git merge --no-ff "%s"</pre>
</p>
<p>
step 4. Push the result of the merge to GitLab
step 4. Push the result of the merge to Git
<pre> git push origin "%s" </pre>
</p>
</div>
@@ -185,7 +190,7 @@ EOD;
$lang->mr->noChanges = "Currently there are no changes in this merge request's source branch. Please push new commits or use a different branch.";
$lang->mr->linkTask = 'Link Tasks';
$lang->mr->linkTask = "Link task";
$lang->mr->unlinkTask = "Remove task";
$lang->mr->linkedTasks = 'Task';
$lang->mr->unlinkedTasks = 'Task not linked';
+198
View File
@@ -0,0 +1,198 @@
<?php
$lang->mr = new stdclass;
$lang->mr->common = "Merge Request";
$lang->mr->server = "Server";
$lang->mr->view = "Survey";
$lang->mr->create = "Create";
$lang->mr->apiCreate = "Interface: Create";
$lang->mr->browse = "Browse";
$lang->mr->list = "List";
$lang->mr->edit = "Edit";
$lang->mr->delete = "Delete";
$lang->mr->accept = "Accept";
$lang->mr->source = 'source';
$lang->mr->target = 'target';
$lang->mr->viewDiff = 'View diff';
$lang->mr->diff = 'View diff';
$lang->mr->viewInGit = 'View in APP';
$lang->mr->link = 'Link of stories,Bugs,tasks';
$lang->mr->createAction = '%s, <strong>%s</strong> submitted a <a href="%s">Merge Request</a>.';
$lang->mr->linkList = 'Link List of stories,Bugs,tasks';
$lang->mr->linkStory = 'Link Stories';
$lang->mr->linkBug = 'Link Bugs';
$lang->mr->linkTask = 'Link Tasks';
$lang->mr->unlink = 'UnLink of stories,Bugs,tasks';
$lang->mr->addReview = 'Add Review';
$lang->mr->id = 'ID';
$lang->mr->mriid = "raw MR ID";
$lang->mr->title = 'Name';
$lang->mr->status = 'Status';
$lang->mr->author = 'Author';
$lang->mr->assignee = 'Assignee';
$lang->mr->reviewer = 'Reviewer';
$lang->mr->mergeStatus = 'Merge status';
$lang->mr->commits = 'commits';
$lang->mr->changes = 'changes';
$lang->mr->gitlabID = 'GitLab';
$lang->mr->repoID = 'Repo';
$lang->mr->jobID = 'Compile job';
$lang->mr->canMerge = "Can be merged";
$lang->mr->cantMerge = "Can not be merged";
$lang->mr->approval = 'Approval';
$lang->mr->approve = 'Approve';
$lang->mr->reject = 'Reject';
$lang->mr->close = 'Close';
$lang->mr->reopen = 'Reopen';
$lang->mr->reviewType = 'Review Type';
$lang->mr->reviewTypeList = array();
$lang->mr->reviewTypeList['bug'] = 'Bug';
$lang->mr->reviewTypeList['task'] = 'Task';
$lang->mr->approvalResult = 'Approval result';
$lang->mr->approvalResultList = array();
$lang->mr->approvalResultList['approve'] = 'Approve';
$lang->mr->approvalResultList['reject'] = 'Reject';
$lang->mr->needApproved = 'This MR should be approved before merge';
$lang->mr->needCI = 'Merge only after passing CI';
$lang->mr->removeSourceBranch = 'Delete source branch after merge';
$lang->mr->squash = 'Squash commits';
$lang->mr->repeatedOperation = 'Do not repeat operations';
$lang->mr->approvalStatus = 'Approve status';
$lang->mr->approvalStatusList = array();
$lang->mr->approvalStatusList['notReviewed'] = 'notReviewed';
$lang->mr->approvalStatusList['approved'] = 'Approved';
$lang->mr->approvalStatusList['rejected'] = 'Rejected';
$lang->mr->notApproved = 'Rejected';
$lang->mr->assignedToMe = 'AssignedToMe';
$lang->mr->createdByMe = 'CreatedByMe';
$lang->mr->statusList = array();
$lang->mr->statusList['all'] = 'all';
$lang->mr->statusList['opened'] = 'opened';
$lang->mr->statusList['merged'] = 'merged';
$lang->mr->statusList['closed'] = 'closed';
$lang->mr->mergeStatusList = array();
$lang->mr->mergeStatusList['unchecked'] = 'unchecked';
$lang->mr->mergeStatusList['checking'] = 'checking';
$lang->mr->mergeStatusList['can_be_merged'] = 'can be merged';
$lang->mr->mergeStatusList['cannot_be_merged'] = 'cannot be merged';
$lang->mr->mergeStatusList['cannot_merge_by_fail'] = 'Cannot be merged, check failed';
$lang->mr->description = 'Description';
$lang->mr->confirmDelete = 'Are you sure to delete this merge request?';
$lang->mr->sourceProject = 'Source project';
$lang->mr->sourceBranch = 'Source branch';
$lang->mr->targetProject = 'Target project';
$lang->mr->targetBranch = 'Target branch';
$lang->mr->noCompileJob = 'No Compile Job';
$lang->mr->compileUnexecuted = 'Compile Unexecuted';
$lang->mr->notFound = "Merge Request does not exist!";
$lang->mr->toCreatedMessage = "The merge request you submitted:<a href='%s'>%s</a>, the build task succeeded.";
$lang->mr->toReviewerMessage = "You have one merge request <a href='%s'>%s</a> waiting.";
$lang->mr->failMessage = "Your merge request <a href='%s'>%s</a> failed. Please check its execution result. ";
$lang->mr->storySummary = "Total <strong>%s</strong> {$lang->SRCommon} on this page.";
$lang->mr->apiError = new stdclass;
$lang->mr->apiError->createMR = "Failed to create a merge request through API. Reason: %s";
$lang->mr->apiError->sudo = "Unable to operate with the GitLab account bound to the current user. Reason: %s";
$lang->mr->createFailedFromAPI = "Failed to create Merge Request.";
$lang->mr->hasSameOpenedMR = "There are duplicate and unclosed merge requests: ID%u";
$lang->mr->accessGitlabFailed = "Unable to connect to the GitLab server.";
$lang->mr->reopenSuccess = "The merge request was reopened.";
$lang->mr->closeSuccess = "Merge request closed.";
$lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and target";
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
$lang->mr->apiErrorMap[4] = "403 Forbidden";
$lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/";
$lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base";
$lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u';
$lang->mr->errorLang[3] = "Unauthorized";
$lang->mr->errorLang[4] = 'Permission denied';
$lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch';
$lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->from = "from";
$lang->mr->to = "to";
$lang->mr->at = "at";
$lang->mr->pipeline = "Pipeline";
$lang->mr->pipelineSuccess = "Success";
$lang->mr->pipelineFailed = "Failed";
$lang->mr->pipelineCanceled = "Canceled";
$lang->mr->pipelineUnknown = "Unknown";
$lang->mr->pipelineStatus = array();
$lang->mr->pipelineStatus['success'] = "success";
$lang->mr->pipelineStatus['failed'] = "failed";
$lang->mr->pipelineStatus['canceled'] = "canceled";
$lang->mr->MRHasConflicts = "Merge Request has a conflict";
$lang->mr->hasConflicts = "There are merge conflicts or wait for push";
$lang->mr->hasNoConflict = "Can merge";
$lang->mr->acceptMR = "Accept Merge request ";
$lang->mr->mergeFailed = "Unable to merge request, please check the merge request status";
$lang->mr->mergeSuccess = "Merge Request Successfully";
$lang->mr->todomessage = "project was assigned to you";
/**
* Merge Command Document.
*
* %s source_project::http_url_to_repo
* %s mr::source_branch
* %s source_project::path_with_namespace . '-' . mr::source_branch
* %s mr::target_branch
* %s source_project::path_with_namespace . '-' . mr::source_branch
* %s mr::target_branch
*/
$lang->mr->commandDocument = <<< EOD
<div class='detail-title'>Check out, review and merge locally</div>
<div class='detail-content'>
<p><blockquote>Note: This merge request status will be changed automatically after you merged locally.</blockquote></p>
<p>
step 1. Change directory to target project. Fetch and check out the branch for this merge request
<pre>
git fetch "%s" %s
git checkout -b "%s" FETCH_HEAD</pre>
</p>
<p>
step 2. Review the changes locally. You can use <code>git log</code> to view the changes
</p>
<p>
step 3. Merge the branch and fix any conflicts that come up
<pre>
git fetch origin
git checkout "%s"
git merge --no-ff "%s"</pre>
</p>
<p>
step 4. Push the result of the merge to Git
<pre> git push origin "%s" </pre>
</p>
</div>
EOD;
$lang->mr->noChanges = "Currently there are no changes in this merge request's source branch. Please push new commits or use a different branch.";
$lang->mr->linkTask = "Link task";
$lang->mr->unlinkTask = "Remove task";
$lang->mr->linkedTasks = 'Task';
$lang->mr->unlinkedTasks = 'Task not linked';
$lang->mr->confirmUnlinkTask = "Are you sure to remove this task?";
$lang->mr->taskSummary = "There are <strong>%s</strong> tasks on this page";
+7 -2
View File
@@ -1,6 +1,7 @@
<?php
$lang->mr = new stdclass;
$lang->mr->common = "合并请求";
$lang->mr->server = "服务器";
$lang->mr->view = "概况";
$lang->mr->create = "创建{$lang->mr->common}";
$lang->mr->apiCreate = "接口:创建{$lang->mr->common}";
@@ -13,7 +14,7 @@ $lang->mr->source = '源项目分支';
$lang->mr->target = '目标项目分支';
$lang->mr->viewDiff = '比对代码';
$lang->mr->diff = '比对代码';
$lang->mr->viewInGitlab = '在GitLab查看';
$lang->mr->viewInGit = '在应用中查看';
$lang->mr->link = '关联需求、Bug、任务';
$lang->mr->createAction = '%s, 由 <strong>%s</strong> 提交了 <a href="%s">合并请求</a>。';
@@ -116,11 +117,15 @@ $lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and ta
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
$lang->mr->apiErrorMap[4] = "403 Forbidden";
$lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/";
$lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base";
$lang->mr->errorLang[1] = '源项目分支与目标项目分支不能相同';
$lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u';
$lang->mr->errorLang[3] = '权限不足';
$lang->mr->errorLang[4] = '权限不足';
$lang->mr->errorLang[5] = '存在另外一个同样的合并请求在源项目分支中';
$lang->mr->errorLang[6] = '源项目分支与目标项目分支不能相同';
$lang->mr->from = "从";
$lang->mr->to = "合并到";
@@ -177,7 +182,7 @@ $lang->mr->commandDocument = <<< EOD
git merge --no-ff "%s"</pre>
</p>
<p>
第 4 步. 将合并结果推送到GitLab
第 4 步. 将合并结果推送到Git
<pre> git push origin "%s" </pre>
</p>
</div>
+432 -192
View File
File diff suppressed because it is too large Load Diff
+21 -4
View File
@@ -58,8 +58,18 @@
</thead>
<tbody>
<?php foreach($MRList as $MR):?>
<?php $sourceProject = isset($projects[$MR->gitlabID][$MR->sourceProject]) ? $projects[$MR->gitlabID][$MR->sourceProject]->name_with_namespace . ':' . $MR->sourceBranch : $MR->sourceProject . ':' . $MR->sourceBranch; ?>
<?php $targetProject = isset($projects[$MR->gitlabID][$MR->targetProject]) ? $projects[$MR->gitlabID][$MR->targetProject]->name_with_namespace . ':' . $MR->targetBranch : $MR->targetProject . ':' . $MR->targetBranch; ?>
<?php
if($repo->SCM == 'Gitlab')
{
$sourceProject = isset($projects[$MR->hostID][$MR->sourceProject]) ? $projects[$MR->hostID][$MR->sourceProject]->name_with_namespace . ':' . $MR->sourceBranch : $MR->sourceProject . ':' . $MR->sourceBranch;
$targetProject = isset($projects[$MR->hostID][$MR->targetProject]) ? $projects[$MR->hostID][$MR->targetProject]->name_with_namespace . ':' . $MR->targetBranch : $MR->targetProject . ':' . $MR->targetBranch;
}
else
{
$sourceProject = isset($projects[$MR->hostID][$MR->sourceProject]) ? $projects[$MR->hostID][$MR->sourceProject]->full_name . ':' . $MR->sourceBranch : $MR->sourceProject . ':' . $MR->sourceBranch;
$targetProject = isset($projects[$MR->hostID][$MR->targetProject]) ? $projects[$MR->hostID][$MR->targetProject]->full_name . ':' . $MR->targetBranch : $MR->targetProject . ':' . $MR->targetBranch;
}
?>
<tr>
<td class='text'><?php echo $MR->id;?></td>
<td class='text'><?php echo html::a(inlink('view', "mr={$MR->id}"), $MR->title);?></td>
@@ -79,8 +89,15 @@
<td class='text' title='<?php echo zget($users, $MR->createdBy);?>'><?php echo zget($users, $MR->createdBy);?></td>
<td class='c-actions'>
<?php
$canDelete = ($app->user->admin or (isset($projects[$MR->gitlabID][$MR->sourceProject]->owner->id) and $projects[$MR->gitlabID][$MR->sourceProject]->owner->id == $openIDList[$MR->gitlabID])) ? '' : 'disabled';
$canEdit = (isset($projects[$MR->gitlabID][$MR->sourceProject]->isDeveloper) and $projects[$MR->gitlabID][$MR->sourceProject]->isDeveloper == true) ? '' : 'disabled';
$canDelete = ($app->user->admin or (isset($projects[$MR->hostID][$MR->sourceProject]->owner->id) and $projects[$MR->hostID][$MR->sourceProject]->owner->id == $openIDList[$MR->hostID])) ? '' : 'disabled';
if($repo->SCM == 'Gitlab')
{
$canEdit = (isset($projects[$MR->hostID][$MR->sourceProject]->isDeveloper) and $projects[$MR->hostID][$MR->sourceProject]->isDeveloper == true) ? '' : 'disabled';
}
else
{
$canEdit = (isset($projects[$MR->hostID][$MR->sourceProject]->allow_merge_commits) and $projects[$MR->hostID][$MR->sourceProject]->allow_merge_commits == true) ? '' : 'disabled';
}
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->view}' class='btn btn-info'");
common::printIcon('mr', 'edit', "mr={$MR->id}", $MR, 'list', '', '', '', false, "{$canEdit}");
common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-diff"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'");
+4 -2
View File
@@ -10,6 +10,8 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::import($jsRoot . 'misc/base64.js');?>
<?php js::set('hosts', $hosts);?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
@@ -19,8 +21,8 @@
<form id='mrForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->common;?></th>
<td class='required'><?php echo html::select('gitlabID', array('') + $gitlabHosts, '', "class='form-control chosen'");?></td>
<th><?php echo $lang->mr->server;?></th>
<td class='required'><?php echo html::select('hostID', array('') + $hostPairs, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th style="white-space: nowrap;"><?php echo $lang->mr->sourceProject;?></th>
+6 -6
View File
@@ -9,7 +9,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('gitlabID', $MR->gitlabID);?>
<?php js::set('hostID', $MR->hostID);?>
<?php js::set('projectID', $MR->sourceProject);?>
<!-- If this mr is deleted in GitLab, then show this part to user. -->
<?php if(empty($rawMR) or !isset($rawMR->id)): ?>
@@ -32,15 +32,15 @@
<form id='mrForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->common;?></th>
<td><?php echo $this->loadModel('gitlab')->getByID($MR->gitlabID)->name;?></td>
<th><?php echo $lang->mr->server;?></th>
<td><?php echo $this->loadModel('pipeline')->getByID($MR->hostID)->name;?></td>
</tr>
<tr>
<th style="white-space: nowrap;"><?php echo $lang->mr->sourceProject;?></th>
<td>
<div>
<span class='fix-border text-left'>
<?php echo $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->sourceProject)->name_with_namespace;?>:
<?php echo $host->type == 'gitlab' ? $this->loadModel('gitlab')->apiGetSingleProject($MR->hostID, $MR->sourceProject)->name_with_namespace : $MR->sourceProject;?>:
<?php echo $MR->sourceBranch;?>
</span>
</div>
@@ -52,12 +52,12 @@
<div class='input-group'>
<?php if($MR->status == 'merged' or $MR->status == 'closed'):?>
<span class='fix-border text-left'>
<?php echo $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->targetProject)->name_with_namespace;?>:
<?php echo $host->type == 'gitlab' ? $this->loadModel('gitlab')->apiGetSingleProject($MR->hostID, $MR->targetProject)->name_with_namespace : $MR->targetProject;?>:
<?php echo $MR->targetBranch;?>
</span>
<?php else:?>
<span class='input-group-addon fix-border'>
<?php echo $this->loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->targetProject)->name_with_namespace;?>
<?php echo $host->type == 'gitlab' ? $this->loadModel('gitlab')->apiGetSingleProject($MR->hostID, $MR->targetProject)->name_with_namespace : $MR->targetProject;?>:
</span>
<?php echo html::select('targetBranch', $targetBranchList, $MR->targetBranch, "class='form-control chosen'");?>
<?php endif;?>
+2 -2
View File
@@ -31,7 +31,7 @@
<span class="label label-id"><?php echo $MR->id ?></span>
<span class="text" title='<?php echo $MR->title; ?>'><?php echo $MR->title; ?></span>
<?php if($MR->synced):?>
<span class="text" title='<?php echo $MR->title; ?>' style='color: blue'><?php echo html::a($rawMR->web_url, $lang->mr->viewInGitlab, "_blank", "class='btn btn-link btn-active-text' style='color: blue'"); ?></span>
<span class="text" title='<?php echo $MR->title; ?>' style='color: blue'><?php echo html::a($rawMR->web_url, $lang->mr->viewInGit, "_blank", "class='btn btn-link btn-active-text' style='color: blue'"); ?></span>
<?php endif;?>
</div>
</div>
@@ -85,7 +85,7 @@
</tr>
<tr>
<th><?php echo $lang->mr->MRHasConflicts; ?></th>
<?php $hasNoConflict = $MR->synced === '1' ? $rawMR->has_conflicts : (bool)$MR->hasNoConflict; ?>
<?php $hasNoConflict = $MR->synced === '1' ? $rawMR->has_conflicts : (bool)$MR->hasNoConflict;?>
<td><?php echo ($hasNoConflict ? $lang->mr->hasConflicts : $lang->mr->hasNoConflict);?></td>
</tr>
<tr>
+3 -1
View File
@@ -1373,13 +1373,15 @@ EOF;
* Build contact lists.
*
* @param string $dropdownName
* @param string $attr
* @access public
* @return void
*/
public function buildContactLists($dropdownName = 'mailto')
public function buildContactLists($dropdownName = 'mailto', $attr = '')
{
$this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote');
$this->view->dropdownName = $dropdownName;
$this->view->attr = $attr;
$this->display();
}
+1 -1
View File
@@ -13,7 +13,7 @@
<?php
if($contactLists)
{
echo html::select('contactListMenu', $contactLists, '', "class='form-control chosen' onchange=\"setMailto('$dropdownName', this.value)\"");
echo html::select('contactListMenu', $contactLists, '', "class='form-control chosen' $attr onchange=\"setMailto('$dropdownName', this.value)\"");
}
else
{
+1 -1
View File
@@ -42,7 +42,7 @@ class pipelineModel extends model
{
return $this->dao->select('*')->from(TABLE_PIPELINE)
->where('deleted')->eq('0')
->AndWhere('type')->eq($type)
->AndWhere('type')->in($type)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
+1 -1
View File
@@ -93,7 +93,7 @@ $app->loadLang('product');
$config->product->all = new stdclass();
$config->product->all->search['module'] = 'product';
$config->product->all->search['fields']['name'] = $lang->product->name;
$config->product->all->search['fields']['code'] = $lang->product->code;
if(!isset($config->setCode) or $config->setCode == 1) $config->product->all->search['fields']['code'] = $lang->product->code;
$config->product->all->search['fields']['id'] = $lang->product->id;
if($config->systemMode == 'new') $config->product->all->search['fields']['program'] = $lang->product->program;
$config->product->all->search['fields']['line'] = $lang->product->line;
+2
View File
@@ -56,10 +56,12 @@
<th><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', '', "class='form-control input-product-title' required");?></td><td></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='form-control' required");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $poUsers, $this->app->user->account, "class='form-control chosen'");?></td>
+2
View File
@@ -51,10 +51,12 @@
<th class='w-140px'><?php echo $lang->product->name;?></th>
<td class='w-p40-f'><?php echo html::input('name', $product->name, "class='form-control' required");?></td><td></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='form-control' required");?></td><td></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $poUsers, $product->PO, "class='form-control chosen'");?></td><td></td>
+21 -1
View File
@@ -19,7 +19,8 @@
<div class="col-sm-12">
<div class="cell">
<div class="detail">
<h2 class="detail-title"><span class="label-id"><?php echo $product->id;?></span> <span class="label label-light label-outline"><?php echo $product->code;?></span> <?php echo $product->name;?></h2>
<?php $hiddenCode = (isset($config->setCode) and $config->setCode == 0) ? 'hidden' : '';?>
<h2 class="detail-title"><span class="label-id"><?php echo $product->id;?></span> <span class="label label-light label-outline <?php echo $hiddenCode;?>"><?php echo $product->code;?></span> <?php echo $product->name;?></h2>
<div class="detail-content article-content">
<p><?php echo $product->desc;?></p>
</div>
@@ -72,6 +73,7 @@
<div class="detail-content">
<table class="table table-data data-basic">
<tbody>
<?php if(!$hiddenCode):?>
<tr>
<th class="c-code"><?php echo $lang->product->code;?></th>
<td><strong><?php echo $product->code;?></strong></td>
@@ -90,6 +92,24 @@
<th class="c-acl"><?php echo $lang->product->acl;?></th>
<td <?php echo empty($product->code) ? "colspan='4'" : "colspan='2'";?>><strong><?php echo $lang->product->aclList[$product->acl];?></strong></td>
</tr>
<?php else:?>
<tr>
<th><?php echo $lang->product->type;?></th>
<td><strong><?php echo zget($lang->product->typeList, $product->type);?></strong></td>
<th class="c-openedBy"><?php echo $lang->story->openedBy?></th>
<td colspan="2"><strong><?php echo zget($users, $product->createdBy);?></strong></td>
</tr>
<tr>
<th class="c-type"><?php echo $lang->productCommon . $lang->product->status;?></th>
<td class="<?php echo $product->status;?>"><strong><?php echo zget($lang->product->statusList, $product->status);?></strong></td>
<th><?php echo $lang->story->openedDate?></th>
<td colspan="2"><strong><?php echo formatTime($product->createdDate, DT_DATE1);?></strong></td>
</tr>
<tr>
<th class="c-acl"><?php echo $lang->product->acl;?></th>
<td colspan='4'><strong><?php echo $lang->product->aclList[$product->acl];?></strong></td>
</tr>
<?php endif;?>
<?php if($product->acl == 'custom'):?>
<tr>
<th><?php echo $lang->product->whitelist;?></th>
+11 -8
View File
@@ -49,13 +49,16 @@ $config->project->datatable->fieldList['name']['required'] = 'yes';
$config->project->datatable->fieldList['name']['sort'] = 'no';
$config->project->datatable->fieldList['name']['pri'] = '1';
$config->project->datatable->fieldList['code']['title'] = 'code';
$config->project->datatable->fieldList['code']['fixed'] = 'left';
$config->project->datatable->fieldList['code']['width'] = '100';
$config->project->datatable->fieldList['code']['minWidth'] = '180';
$config->project->datatable->fieldList['code']['required'] = 'no';
$config->project->datatable->fieldList['code']['sort'] = 'no';
$config->project->datatable->fieldList['code']['pri'] = '1';
if(!isset($config->setCode) or $config->setCode == 1)
{
$config->project->datatable->fieldList['code']['title'] = 'code';
$config->project->datatable->fieldList['code']['fixed'] = 'left';
$config->project->datatable->fieldList['code']['width'] = '100';
$config->project->datatable->fieldList['code']['minWidth'] = '180';
$config->project->datatable->fieldList['code']['required'] = 'no';
$config->project->datatable->fieldList['code']['sort'] = 'no';
$config->project->datatable->fieldList['code']['pri'] = '1';
}
$config->project->datatable->fieldList['PM']['title'] = 'PM';
$config->project->datatable->fieldList['PM']['fixed'] = 'no';
@@ -134,7 +137,7 @@ $config->project->maxCheckList->waterfall = array('execution', 'design', 'doc',
$config->project->search['module'] = 'project';
$config->project->search['fields']['name'] = $lang->project->name;
$config->project->search['fields']['code'] = $lang->project->code;
if(!isset($config->setCode) or $config->setCode == 1) $config->project->search['fields']['code'] = $lang->project->code;
$config->project->search['fields']['id'] = $lang->project->id;
$config->project->search['fields']['model'] = $lang->project->model;
$config->project->search['fields']['parent'] = $lang->project->parent;
+3 -3
View File
@@ -1524,13 +1524,12 @@ class projectModel extends model
{
$projectID = (int)$projectID;
$projectName = $data->names[$projectID];
$projectCode = $data->codes[$projectID];
if(isset($data->codes)) $projectCode = $data->codes[$projectID];
$projects[$projectID] = new stdClass();
if(isset($data->parents[$projectID])) $projects[$projectID]->parent = $data->parents[$projectID];
$projects[$projectID]->id = $projectID;
$projects[$projectID]->name = $projectName;
$projects[$projectID]->code = $projectCode;
$projects[$projectID]->model = $oldProjects[$projectID]->model;
$projects[$projectID]->PM = $data->PMs[$projectID];
$projects[$projectID]->begin = $data->begins[$projectID];
@@ -1540,6 +1539,7 @@ class projectModel extends model
$projects[$projectID]->lastEditedBy = $this->app->user->account;
$projects[$projectID]->lastEditedDate = helper::now();
if(isset($data->codes)) $projects[$projectID]->code = $projectCode;
if($projects[$projectID]->parent)
{
$parentProject = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($projects[$projectID]->parent)->fetch();
@@ -1577,7 +1577,7 @@ class projectModel extends model
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchCheck($this->config->project->edit->requiredFields , 'notempty')
->batchCheck($this->config->project->edit->requiredFields, 'notempty')
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->checkIF($project->end != '', 'end', 'gt', $project->begin)
+4
View File
@@ -26,7 +26,9 @@
<th class='c-id'><?php echo $lang->idAB;?></th>
<th class='c-parent'><?php echo $lang->project->parent;?></th>
<th class='c-name required'><?php echo $lang->project->name;?></th>
<?php if(!isset($config->setCode) and $config->setCode == 1):?>
<th class='c-name required'><?php echo $lang->project->code;?></th>
<?php endif?>
<th class="c-user-box <?php echo strpos($requiredFields, 'PM') !== false ? 'required' : '';?>"> <?php echo $lang->project->PM;?></th>
<th class='c-date required'><?php echo $lang->project->begin;?></th>
<th class='c-date required'><?php echo $lang->project->end;?></th>
@@ -51,7 +53,9 @@
<td><?php echo html::select("parents[$projectID]", $programs, $project->parent, "class='form-control chosen' data-id='$projectID' data-name='{$project->name}' data-parent='{$project->parent}'");?></td>
<?php endif;?>
<td title='<?php echo $project->name;?>'><?php echo html::input("names[$projectID]", $project->name, "class='form-control'");?></td>
<?php if(!isset($config->setCode) and $config->setCode == 1):?>
<td title='<?php echo $project->code;?>'><?php echo html::input("codes[$projectID]", $project->code, "class='form-control'");?></td>
<?php endif;?>
<td><?php echo html::select("PMs[$projectID]", $PMUsers, $project->PM, "class='form-control chosen'");?></td>
<td>
<?php echo html::input("begins[$projectID]", $project->begin, "class='form-control form-date' onchange='computeWorkDays(this.id);' placeholder='" . $lang->project->begin . "'");?>
+2
View File
@@ -55,10 +55,12 @@
<th><?php echo $lang->project->name;?></th>
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $lang->project->code;?></th>
<td><?php echo html::input('code', $code, "class='form-control' required");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->project->PM;?></th>
<td><?php echo html::select('PM', $pmUsers, '', "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
+2
View File
@@ -61,10 +61,12 @@
<th><?php echo $lang->project->name;?></th>
<td class="col-main"><?php echo html::input('name', $project->name, "class='form-control' required");?></td>
</tr>
<?php if(!isset($config->setCode) or $config->setCode == 1):?>
<tr>
<th><?php echo $lang->project->code;?></th>
<td><?php echo html::input('code', $project->code, "class='form-control' required");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->project->PM;?></th>
<td><?php echo html::select('PM', $PMUsers, $project->PM, "class='form-control chosen'" . (strpos($requiredFields, 'PM') !== false ? ' required' : ''));?></td>
+2 -1
View File
@@ -107,7 +107,8 @@
<div class="col-sm-12">
<div class="cell">
<div class="detail">
<h2 class="detail-title"><span class="label-id"><?php echo $project->id;?></span> <span class="label label-light label-outline"><?php echo $project->code;?></span> <?php echo $project->name;?></h2>
<?php $hiddenCode = (isset($config->setCode) and $config->setCode == 0) ? 'hidden' : '';?>
<h2 class="detail-title"><span class="label-id"><?php echo $project->id;?></span> <span class="label label-light label-outline <?php echo $hiddenCode;?>"><?php echo $project->code;?></span> <?php echo $project->name;?></h2>
<div class="detail-content article-content">
<div><span class="text-limit hidden" data-limit-size="40"><?php echo $project->desc;?></span><a class="text-primary text-limit-toggle small" data-text-expand="<?php echo $lang->expand;?>" data-text-collapse="<?php echo $lang->collapse;?>"></a></div>
<p>
+1 -1
View File
@@ -1155,7 +1155,7 @@ class repo extends control
{
foreach($repoGroup as $type => $group)
{
if(strtolower($type) != 'gitlab') unset($repoGroup[$type]);
if(!in_array(strtolower($type), $this->config->repo->gitServiceList)) unset($repoGroup[$type]);
}
}
+2 -3
View File
@@ -57,7 +57,7 @@ class repoModel extends model
return print(js::locate('back'));
}
if($repo->SCM != 'Gitlab') unset($this->lang->devops->menu->mr);
if(!in_array(strtolower($repo->SCM), $this->config->repo->gitServiceList)) unset($this->lang->devops->menu->mr);
$this->lang->switcherMenu = $this->getSwitcher($repoID);
}
@@ -2052,10 +2052,9 @@ class repoModel extends model
* @param int $projectID
* @return array
*/
public function getGitLabRepoList($gitlabID, $projectID = 0)
public function getRepoListByClient($gitlabID, $projectID = 0)
{
return $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq('0')
->andWhere('SCM')->eq('Gitlab')
->andWhere('synced')->eq(1)
->andWhere('client')->eq($gitlabID)
->beginIF($projectID)->andWhere('path')->eq($projectID)->fi()
+6 -4
View File
@@ -500,7 +500,8 @@
$tab = $app->tab == 'product' ? 'project' : $app->tab;
foreach($builds as $build)
{
echo "<li title='$build->id $build->name'>" . html::a($this->createLink('build', 'view', "buildID=$build->id"), "#$build->id $build->name", '', "data-app='{$tab}'") . '</li>';
$link = common::hasPriv('build', 'view') ? html::a($this->createLink('build', 'view', "buildID=$build->id"), "#$build->id $build->name", '', "data-app='{$tab}'") : "#$build->id $build->name";
echo "<li title='$build->id $build->name'>$link</li>";
}
?>
</ul>
@@ -511,11 +512,12 @@
<td class='pd-0'>
<ul class='list-unstyled'>
<?php
$releaseModule = $app->tab == 'project' ? 'projectrelease' : 'release';
$tab = $app->tab == 'execution' ? 'product' : $app->tab;
$tab = $app->tab == 'execution' ? 'product' : $app->tab;
$releaseModule = $app->tab == 'project' ? 'projectrelease' : 'release';
foreach($releases as $release)
{
echo "<li title='$release->id $release->name'>" . html::a($this->createLink($releaseModule, 'view', "release=$release->id"), "#$release->id $release->name", '', "data-app='{$tab}'") . '</li>';
$link = common::hasPriv($releaseModule, 'view') ? html::a($this->createLink($releaseModule, 'view', "release=$release->id"), "#$release->id $release->name", '', "data-app='{$tab}'") : "#$release->id $release->name";
echo "<li title='$release->id $release->name'>$link</li>";
}
?>
</ul>
+1 -2
View File
@@ -359,8 +359,7 @@ class tree extends control
if($type == 'task')
{
$optionMenu = $this->tree->getTaskOptionMenu($module->root);
$this->view->optionMenu = $optionMenu;
$this->view->optionMenu = $this->tree->getTaskOptionMenu($module->root);
}
else
{