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

This commit is contained in:
hufangzhou
2021-04-14 13:51:11 +08:00
52 changed files with 915 additions and 137 deletions
+1 -1
View File
@@ -1 +1 @@
15.0.rc2
15.0.rc3
+1 -1
View File
@@ -16,7 +16,7 @@ if(!class_exists('config')){class config{}}
if(!function_exists('getWebRoot')){function getWebRoot(){}}
/* 基本设置。Basic settings. */
$config->version = '15.0.rc2'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
$config->version = '15.0.rc3'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP.
$config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time.
$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php.
-16
View File
@@ -886,22 +886,6 @@ class baseRouter
}
}
/**
* 保存openApp到cookie,下次请求使用,常用在locate, reload方法。
* Save openApp to cookie, use it next visit, when locate, reload page.
*
* @access public
* @return void
*/
public function saveOpenApp()
{
$module = $this->rawModule;
if(isset($this->lang->navGroup->$module) and $this->lang->navGroup->$module != $this->openApp)
{
setCookie('openApp', $this->openApp);
}
}
/**
* 根据用户浏览器的语言设置和服务器配置,选择显示的语言。
* 优先级:$lang参数 > session > cookie > 浏览器 > 配置文件。
+655
View File
@@ -0,0 +1,655 @@
<?php
class gitlab
{
public $client;
public $projectID;
/**
* Construct
*
* @param string $client gitlab api url.
* @param string $root id of gitlab project.
* @param string $username null
* @param string $password token of gitlab api.
* @param string $encoding
* @access public
* @return void
*/
public function __construct($client, $root, $username, $password, $encoding = 'UTF-8')
{
$this->client = $client;
$this->root = rtrim($root, '/') . '/';
$this->token = $password;
$this->branch = isset($_COOKIE['repoBranch']) ? $_COOKIE['repoBranch'] : '';
}
/**
* List files.
*
* @param string $path
* @param string $revision
* @access public
* @return array
*/
public function ls($path, $revision = 'HEAD')
{
if(!scm::checkRevision($revision)) return array();
$api = "tree";
$param = new stdclass();
$param->path = urlencode(ltrim($path, '/'));
$param->ref = $revision;
$param->recursive = 0;
$list = $this->fetch($api, $param);
if(empty($list)) return array();
$infos = array();
foreach($list as $file)
{
$info = new stdClass();
if($file->type == 'blob')
{
$path = $file->path;
$file = $this->files($file->path);
$info->name = $file->file_name;
$info->kind = 'file';
$info->account = $file->committer;
$info->date = $file->date;
$info->size = $file->size;
$info->comment = $file->comment;
$info->revision = $file->revision;
}
else
{
$commits = $this->getCommitsByPath($file->path);
if(empty($commits)) continue;
$commit = $commits[0];
$info->name = $file->path;
$info->kind = 'dir';
$info->revision = $commit->id;
$info->account = $commit->committer_name;
$info->date = date('Y-m-d H:i:s', strtotime($commit->committed_date));
$info->size = 0;
$info->comment = $commit->message;
}
$infos[] = $info;
unset($info);
}
/* Sort by kind */
foreach($infos as $key => $info) $kinds[$key] = $info->kind;
if($infos) array_multisort($kinds, SORT_ASC, $infos);
return $infos;
}
/**
* Get files info.
*
* @param string $path
* @param string $ref
* @access public
* @return array
*/
public function files($path, $ref = 'master')
{
$path = urlencode($path);
$api = "files/$path";
$param = new stdclass();
$param->ref = $ref;
$file = $this->fetch($api, $param);
$commits = $this->getCommitsByPath($path);
$file->revision = $file->commit_id;
$file->size = $this->formatBytes($file->size);
if(!empty($commits))
{
$commit = $commits[0];
$file->committer = $commit->committer_name;
$file->comment = $commit->message;
$file->date = date('Y-m-d H:i:s', strtotime($commit->committed_date));
}
return $file;
}
/**
* Get tags
*
* @param string $path
* @param string $revision
* @access public
* @return array
*/
public function tags($path, $revision = 'HEAD')
{
$api = "tags";
$list = $this->fetch($api);
$tags = array();
foreach($list as $tag) $tags[] = $tag->name;
return $tags;
}
/**
* Get branch
*
* @access public
* @return array
*/
public function branch()
{
$api = "branches";
$list = $this->fetch($api);
$branches = array();
foreach($list as $branch) $branches[$branch->name] = $branch->name;
asort($branches);
return $branches;
}
/**
* Get last log.
*
* @param string $path
* @param int $count
* @access public
* @return array
*/
public function getLastLog($path, $count = 10)
{
return $this->log($path);
}
/**
* Get logs.
*
* @param string $path
* @param string $fromRevision
* @param string $toRevision
* @param int $count
* @access public
* @return array
*/
public function log($path, $fromRevision = 0, $toRevision = 'HEAD', $count = 0)
{
if(!scm::checkRevision($fromRevision)) return array();
if(!scm::checkRevision($toRevision)) return array();
$path = ltrim($path, DIRECTORY_SEPARATOR);
$count = $count == 0 ? '' : "-n $count";
$list = $this->getCommitsByPath($path, $fromRevision, $toRevision);
foreach($list as $commit) $commit->diffs = $this->getFilesByCommit($commit->id);
return $this->parseLog($list);
}
/**
* Blame file
*
* @param string $path
* @param string $revision
* @access public
* @return array
*/
public function blame($path, $revision)
{
if(!scm::checkRevision($revision)) return array();
$path = ltrim($path, DIRECTORY_SEPARATOR);
$path = urlencode($path);
$api = "files/$path/blame";
$param = new stdclass;
$param->ref = $this->branch;
$results = $this->fetch($api, $param);
$blames = array();
$revLine = 0;
$revision = '';
$lineNumber = 1;
foreach($results as $blame)
{
$line = array();
$line['revision'] = $blame->commit->id;
$line['committer'] = $blame->commit->committer_name;
$line['time'] = $blame->commit->committer_name;
$line['line'] = $lineNumber;
$line['lines'] = count($blame->lines);
$line['content'] = array_shift($blame->lines);
$blames[] = $line;
$lineNumber ++;
foreach($blame->lines as $line)
{
$blames[] = array('line' => $lineNumber, 'content' => $line);
$lineNumber ++;
}
}
return $blames;
}
/**
* Diff file.
*
* @param string $path
* @param string $fromRevision
* @param string $toRevision
* @access public
* @return array
*/
public function diff($path, $fromRevision, $toRevision)
{
if(!scm::checkRevision($fromRevision)) return array();
if(!scm::checkRevision($toRevision)) return array();
$api = "compare";
$params = array('from' => $fromRevision, 'to' => $toRevision, 'straight' => 1);
$results = $this->fetch($api, $params);
foreach($results->diffs as $key => $diff)
{
if($path != '' and strpos($diff->new_path, $path) === false) unset($results->diffs[$key]);
}
return $results->diffs;
}
/**
* Cat file.
*
* @param string $entry
* @param string $revision
* @access public
* @return string
*/
public function cat($entry, $revision = 'HEAD')
{
if(!scm::checkRevision($revision)) return false;
$file = $this->files($entry, $revision);
return base64_decode($file->content);
}
/**
* Get info.
*
* @param string $entry
* @param string $revision
* @access public
* @return object
*/
public function info($entry, $revision = 'HEAD')
{
if(!scm::checkRevision($revision)) return false;
$info = new stdclass();
$info->kind = 'dir';
$info->path = $entry;
$info->root = '';
if($entry)
{
$parent = dirname($entry);
if($parent == '.') $parent = '/';
if($parent == '') $parent = '/';
$list = $this->tree($parent, 0);
foreach($list as $node) if($node->path == $entry) $file = $node;
$commits = $this->getCommitsByPath($entry);
if(!empty($commits)) $file->revision = zget($commits[0], 'id', '');
$info->kind = $file->type == 'tree' ? 'dir' : 'file';
}
return $info;
}
/**
* Exec git cmd.
*
* @param string $cmd
* @access public
* @todo Exec commads by gitlab api.
* @return array
*/
public function exec($cmd)
{
chdir($this->root);
return execCmd(escapeCmd("$this->client $cmd"), 'array');
}
/**
* Parse diff.
*
* @param array $lines
* @access public
* @return array
*/
public function parseDiff($results)
{
if(empty($results)) return array();
foreach($results as $file)
{
$diffFile = new stdclass();
$diffFile->fileName = $file->new_path;
$diff = new stdclass;
$diff->fileName = $file->new_path;
preg_match('/^@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@/A', $file->diff, $matches);
if(empty($matches)) continue;
$diff->oldStartLine = $matches[1];
$diff->newStartLine = $matches[4];
$oldCurrentLine = $diff->oldStartLine;
$newCurrentLine = $diff->newStartLine;
if($file->new_file)
{
$oldCurrentLine = $diff->newStartLine;
$newCurrentLine = $diff->oldStartLine;
}
$lines = explode("\n", $file->diff);
$newLines = array();
foreach($lines as $line)
{
if(strpos($line, '@@') === 0) continue;
if(strpos($line, '\ No newline at end of file') === 0) continue;
$sign = empty($line) ? '' : $line[0];
if($sign == '-' and $file->new_file) $sign = '+';
$type = $sign != '-' ? $sign == '+' ? 'new' : 'all' : 'old';
if($sign == '+' or $sign == '-')
{
$line = substr_replace($line, ' ', 1, 0);
if($file->new_file) $line = preg_replace('/^\-/', '+', $line);
}
$newLine = new stdclass();
$newLine->type = $type;
$newLine->oldlc = $type != 'new' ? $oldCurrentLine : '';
$newLine->newlc = $type != 'old' ? $newCurrentLine : '';
$newLine->line = htmlspecialchars($line);
if($type != 'new') $oldCurrentLine++;
if($type != 'old') $newCurrentLine++;
$newLines[] = $newLine;
}
$diffFile->contents[] = $diff;
$diff->lines = $newLines;
$diffs[] = $diffFile;
}
return $diffs;
}
/**
* Get commit count.
*
* @param int $commits
* @param string $lastVersion
* @access public
* @return int
*/
public function getCommitCount($commits = 0, $lastVersion = '')
{
if(!scm::checkRevision($lastVersion)) return false;
chdir($this->root);
$revision = $this->branch ? $this->branch : 'HEAD';
return execCmd(escapeCmd("$this->client rev-list --count $revision -- ./"), 'string');
}
/**
* Get first revision.
*
* @access public
* @return string
*/
public function getFirstRevision()
{
chdir($this->root);
$list = execCmd(escapeCmd("$this->client rev-list --reverse HEAD -- ./"), 'array');
return $list[0];
}
/**
* Get latest revision
*
* @access public
* @return string
*/
public function getLatestRevision()
{
chdir($this->root);
$revision = $this->branch ? $this->branch : 'HEAD';
$list = execCmd(escapeCmd("$this->client rev-list -1 $revision -- ./"), 'array');
return $list[0];
}
/**
* Get commits.
*
* @param string $version
* @param int $count
* @param string $branch
* @access public
* @return array
*/
public function getCommits($version = '', $count = 0, $branch = '')
{
if(!scm::checkRevision($version)) return array();
$api = "commits";
$count = 500;
$params = array();
$params['ref_name'] = $branch;
$params['per_page'] = $count;
$params['all'] = 1;
if($version)
{
$lastCommit = $this->getSingleCommit($version);
$params['until'] = $lastCommit->committed_date;
}
$list = $this->fetch($api, $params);
$commits = array();
foreach($list as $commit)
{
$log = new stdclass;
$log->committer = $commit->committer_name;
$log->revision = $commit->id;
$log->comment = $commit->message;
$log->time = date('Y-m-d H:i:s', strtotime($commit->created_at));
$commits[$commit->id] = $log;
$files[$commit->id] = $this->getFilesByCommit($log->revision);
}
return array('commits' => $commits, 'files' => $files);
}
/**
* getCommit
*
* @param int $sha
* @access public
* @return void
*/
public function getSingleCommit($sha)
{
if(!scm::checkRevision($sha)) return null;
$api = "commits/$sha";
return $this->fetch($api);
}
/**
* Get commits by path.
*
* @param string $path
* @access public
* @return array
*/
public function getCommitsByPath($path, $fromRevision = '', $toRevision = '')
{
$path = ltrim($path, DIRECTORY_SEPARATOR);
$api = "commits";
$param = new stdclass();
$param->path = urldecode($path);
$param->ref_name = $this->branch;
if($fromRevision) $fromRevision = $this->getSingleCommit($fromRevision);
if($toRevision) $toRevision = $this->getSingleCommit($toRevision);
if(!$fromRevision) $since = '';
if(!$toRevision) $until = '';
if($fromRevision and $toRevision)
{
$since = min($fromRevision->committed_date, $toRevision->committed_date);
$until = max($fromRevision->committed_date, $toRevision->committed_date);
}
$param->since = $since;
$param->until = $until;
return $this->fetch($api, $param);
}
/**
* Get files by commit.
*
* @param string $commit
* @access public
* @return void
*/
public function getFilesByCommit($revision)
{
if(!scm::checkRevision($revision)) return array();
$api = "commits/{$revision}/diff";
$params = new stdclass;
$params->page = 1;
$params->per_page = 200;
$allResults = array();
while($results = $this->fetch($api, $params))
{
$params->page ++;
$allResults = $allResults + $results;
}
$files = array();
foreach($allResults as $row)
{
$file = new stdclass();
$file->revision = $revision;
$file->path = '/' . $row->new_path;
$file->type = 'file';
$file->action = 'M';
if($row->new_file) $file->action = 'A';
if($row->renamed_file) $file->action = 'R';
if($row->deleted_file) $file->action = 'D';
$files[] = $file;
}
return $files;
}
/**
* Repository/tree api.
*
* @param string $path
* @param bool $recursive
* @access public
* @return void
*/
public function tree($path, $recursive = 1)
{
$api = "tree";
$params = array();
$params['path'] = ltrim($path, '/');
$params['ref'] = $this->branch;
$params['recursive'] = (int) $recursive;
return $this->fetch($api, $params);
}
/**
* Fetch data from gitlab api.
*
* @param string $api
* @access public
* @return void
*/
public function fetch($api, $params = array())
{
$params = (array) $params;
$params['private_token'] = $this->token;
$api = ltrim($api, '/');
$api = $this->root . $api . '?' . http_build_query($params);
$response = file_get_contents($api);
return json_decode($response);
}
/**
* Format bytes shown.
*
* @param int $size
* @static
* @access public
* @return string
*/
public static function formatBytes($size)
{
if($size < 1024) return $size . 'Bytes';
if(round($size / (1024 * 1024), 2) > 1) return round($size / (1024 * 1024), 2) . 'G';
if(round($size / 1024, 2) > 1) return round($size / 1024, 2) . 'M';
return round($size, 2) . 'KB';
}
/**
* Parse log.
*
* @param array $logs
* @access public
* @return array
*/
public function parseLog($logs)
{
$parsedLogs = array();
$i = 0;
foreach($logs as $commit)
{
$parsedLog = new stdclass();
$parsedLog->revision = $commit->id;
$parsedLog->committer = $commit->committer_name;
$parsedLog->time = date('Y-m-d H:i:s', strtotime($commit->committed_date));
$parsedLog->comment = $commit->message;
$parsedLog->change = array();
foreach($commit->diffs as $diff)
{
$parsedLog->change[$diff->path] = array();
$parsedLog->change[$diff->path]['action'] = $diff->action;
$parsedLog->change[$diff->path]['kind'] = $diff->type;
}
$parsedLogs[] = $parsedLog;
}
return $parsedLogs;
}
}
-1
View File
@@ -431,7 +431,6 @@ $lang->action->dynamicAction->entry['created'] = '添加应用';
$lang->action->dynamicAction->entry['edited'] = '编辑应用';
/* 用来生成相应对象的链接。*/
global $config;
$lang->action->label->product = $lang->productCommon . '|product|view|productID=%s';
$lang->action->label->productplan = "计划|productplan|view|productID=%s";
$lang->action->label->release = '发布|release|view|productID=%s';
-5
View File
@@ -11,11 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<div class='btn-toolbar pull-left'><?php //common::printAdminSubMenu('system');?></div>
</div>
</div>
<div class="main-row">
<div class='side-col' id='sidebar'>
<div class='cell'>
-3
View File
@@ -11,9 +11,6 @@
*/
?>
<?php include '../../common/view/header.html.php'; ?>
<div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left"><?php //common::printAdminSubMenu('sso');?></div>
</div>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
-8
View File
@@ -11,14 +11,6 @@
*/
class automation extends control
{
/**
* Project id.
*
* @var int
* @access public
*/
public $projectID = 0;
/**
* Products.
*
-30
View File
@@ -975,34 +975,6 @@ class block extends control
$plans[$product] = $plan;
}
/* Get projects. */
$projects = $this->dao->select('t1.product, t2.status, t2.end')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->in($productIdList)
->andWhere('t2.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->fetchGroup('product');
foreach($projects as $product => $productProjects)
{
$undone= 0;
$done = 0;
$delay = 0;
foreach($productProjects as $project)
{
($project->status == 'done' or $project->status == 'closed') ? $done++ : $undone++;
if($project->status != 'done' && $project->status != 'closed' && $project->status != 'suspended' && $project->end < helper::today()) $delay++;
}
$project = array();
$project['undone'] = $undone;
$project['done'] = $done;
$project['delay'] = $delay;
$project['all'] = count($productProjects);
$projects[$product] = $project;
}
/* Get releases. */
$releases = $this->dao->select('product, status, COUNT(*) AS count')->from(TABLE_RELEASE)
->where('deleted')->eq(0)
@@ -1028,14 +1000,12 @@ class block extends control
{
$product->stories = isset($stories[$productID]) ? $stories[$productID] : 0;
$product->plans = isset($plans[$productID]) ? $plans[$productID] : 0;
$product->projects = isset($projects[$productID]) ? $projects[$productID] : 0;
$product->releases = isset($releases[$productID]) ? $releases[$productID] : 0;
$product->lastRelease = isset($lastReleases[$productID]) ? $lastReleases[$productID] : 0;
}
$this->app->loadLang('story');
$this->app->loadLang('productplan');
$this->app->loadLang('project');
$this->app->loadLang('release');
$this->view->products = $products;
-3
View File
@@ -11,7 +11,6 @@ $(function()
if($blocksList.find('#moduleBlock').val() == 'scrumtest' && $('#paramstype').val() != 'all')
{
console.log($('#paramstype').val());
$titleInput.val(value);
}
else
@@ -19,8 +18,6 @@ $(function()
var lang = config.clientLang;
if(lang.indexOf('zh') >= 0)
{
console.log(preValue, blockTitle);
console.log(blockTitle.indexOf(preValue));
if(blockTitle.indexOf(preValue) >= 0)
{
blockTitle = blockTitle.replace(preValue, value);
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Testaufgaben';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Requests';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Recettes';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
-1
View File
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = 'Yêu cầu';
$lang->block->availableBlocks->risk = 'My Risks';
$lang->block->availableBlocks->issue = 'My Issues';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = 'Project';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
+5 -6
View File
@@ -291,11 +291,11 @@ $lang->block->default['full']['my']['3']['params']['count'] = '20';
if($config->systemMode == 'new')
{
$lang->block->default['full']['my']['4']['title'] = '项目统计';
$lang->block->default['full']['my']['4']['block'] = 'statistic';
$lang->block->default['full']['my']['4']['source'] = 'project';
$lang->block->default['full']['my']['4']['grid'] = 8;
$lang->block->default['full']['my']['4']['params']['count'] = '20';
$lang->block->default['full']['my']['4']['title'] = '项目统计';
$lang->block->default['full']['my']['4']['block'] = 'statistic';
$lang->block->default['full']['my']['4']['source'] = 'project';
$lang->block->default['full']['my']['4']['grid'] = 8;
$lang->block->default['full']['my']['4']['params']['count'] = '20';
}
$lang->block->default['full']['my']['5']['title'] = '我的贡献';
@@ -355,7 +355,6 @@ $lang->block->availableBlocks->testtask = '测试版本列表';
$lang->block->availableBlocks->risk = '我的风险';
$lang->block->availableBlocks->issue = '我的问题';
global $config;
if($config->systemMode == 'new') $lang->block->moduleList['project'] = '项目';
$lang->block->moduleList['product'] = $lang->productCommon;
$lang->block->moduleList['execution'] = $lang->execution->common;
@@ -175,10 +175,6 @@ $(function()
</div>
</div>
</div>
<?php $totalProject = $product->projects ? zget($product->projects, 'all', 0) : 0;?>
<?php $undoneProject = $product->projects ? zget($product->projects, 'undone', 0) : 0;?>
<?php $delayProject = $product->projects ? zget($product->projects, 'delay', 0) : 0;?>
<?php $undoneRate = $totalProject ? round($undoneProject / $totalProject * 100, 2) : 0;?>
<div class="product-info">
<?php $totalRelease = $product->releases ? array_sum($product->releases) : 0;?>
<?php $normalRelease = $product->releases ? zget($product->releases, 'normal', 0) : 0;?>
+6 -1
View File
@@ -509,7 +509,7 @@ class bug extends control
if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story")));
/* Get products and projects. */
$products = $this->products;
$products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
$projects = array(0 => '');
if($projectID)
{
@@ -817,6 +817,11 @@ class bug extends control
if($bug->type != $type) unset($this->lang->bug->typeList[$type]);
}
if($this->app->openApp == 'qa')
{
$this->view->products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed');
}
/* Set header and position. */
$this->view->title = $this->lang->bug->edit . "BUG #$bug->id $bug->title - " . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
+1 -1
View File
@@ -49,7 +49,7 @@
<tr>
<th class='w-50px'><?php echo $lang->idAB;?></th>
<th class='w-110px<?php echo zget($visibleFields, 'type', ' hidden') . zget($requiredFields, 'type', '', ' required');?>'><?php echo $lang->bug->type;?></th>
<th class='w-80px<?php echo zget($visibleFields, 'severity', ' hidden') . zget($requiredFields, 'severity', '', ' required');?>'><?php echo $lang->bug->severityAB;?></th>
<th class='w-80px<?php echo zget($visibleFields, 'severity', ' hidden') . zget($requiredFields, 'severity', '', ' required');?>'><?php echo $lang->bug->severity;?></th>
<th class='w-70px<?php echo zget($visibleFields, 'pri', ' hidden') . zget($requiredFields, 'pri', '', ' required');?>'><?php echo $lang->bug->pri;?></th>
<th class="required <?php if(count($visibleFields) >= 10) echo ' w-150px';?>"><?php echo $lang->bug->title;?></th>
<?php if($branchProduct):?>
+1 -2
View File
@@ -1,9 +1,8 @@
var executionID = $('#execution').val();
function loadExecutions()
{
var productID = $('#product').val();
var branchID = $('#branch').length > 0 ? $('#branch').val() : 0;
$('#executionsBox').load(createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&executionID=' + executionID + '&branch=' + branchID), function()
$('#executionsBox').load(createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&executionID=0&branch=' + branchID), function()
{
$('#executionsBox #execution').chosen().removeAttr('onchange');
});
-1
View File
@@ -394,7 +394,6 @@ class buildModel extends model
$oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch();
$build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags)
->setDefault('product', $oldBuild->product)
->setDefault('branch', $oldBuild->branch)
->cleanInt('product,branch,execution')
->remove('allchecker,resolvedBy,files,labels,uid')
->get();
+1 -1
View File
@@ -84,7 +84,7 @@ $(function()
<?php if($app->moduleName == 'execution' && $app->methodName == 'task'):?>
<tr>
<td><?php echo $lang->datatable->showAllModule;?></td>
<td><?php echo html::radio('showAllModule', $lang->datatable->showAllModuleList, isset($config->project->task->allModule) ? $config->project->task->allModule : 0);?></td>
<td><?php echo html::radio('showAllModule', $lang->datatable->showAllModuleList, isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0);?></td>
</tr>
<?php endif;?>
<tr>
+1 -1
View File
@@ -310,7 +310,7 @@ class doc extends control
$unclosed = strpos($this->config->doc->custom->showLibs, 'unclosed') !== false ? 'unclosedProject' : '';
$this->view->libID = $libID;
$this->view->libs = $this->doc->getLibs($type = 'all', $extra = "withObject,$unclosed", $libID, $objectID);
$this->view->libs = $this->doc->getLibs($objectType, $extra = "withObject,$unclosed", $libID, $objectID);
$this->view->libName = $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch('name');
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
$this->view->moduleID = $moduleID ? (int)$moduleID : (int)$this->cookie->lastDocModule;
+2 -9
View File
@@ -37,14 +37,7 @@ class docModel extends model
*/
public function getLibs($type = '', $extra = '', $appendLibs = '', $objectID = 0)
{
if($type == 'product' or $type == 'project' or $type == 'execution')
{
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
->where($type)->eq($objectID)
->andWhere('deleted')->eq('0')
->query();
}
elseif($type == 'all')
if($type == 'all')
{
$stmt = $this->dao->select('*')->from(TABLE_DOCLIB)
->where('deleted')->eq(0)
@@ -1659,7 +1652,7 @@ class docModel extends model
$actions .= "<ul class='dropdown-menu'>";
foreach($this->lang->doc->fastMenuList as $key => $fastMenu)
{
$link = helper::createLink('doc', 'browse', "libID=0&browseTyp={$key}");
$link = helper::createLink('doc', 'browse', "libID=0&browseType={$key}");
$actions .= '<li>' . html::a($link, "<i class='icon {$this->lang->doc->fastMenuIconList[$key]}'></i> {$fastMenu}") . '</li>';
}
$actions .='</ul>';
+3 -3
View File
@@ -21,7 +21,7 @@
<div class="panel-heading">
<div class="panel-title"><?php echo $lang->doc->orderByEdit;?></div>
<nav class="panel-actions nav nav-default">
<li><?php echo html::a($this->createLink('doc', 'browse', "libID=0&browseTyp=byediteddate"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
<li><?php echo html::a($this->createLink('doc', 'browse', "browseType=byediteddate"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
</nav>
</div>
<div class="panel-body has-table">
@@ -127,7 +127,7 @@
<div class="panel-heading">
<div class="panel-title"><?php echo $lang->doc->myDoc;?></div>
<nav class="panel-actions nav nav-default">
<li><?php echo html::a($this->createLink('doc', 'browse', "libID=0&browseTyp=openedbyme"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
<li><?php echo html::a($this->createLink('doc', 'browse', "browseType=openedbyme"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
</nav>
</div>
<div class="panel-body has-table">
@@ -159,7 +159,7 @@
<div class="panel-heading">
<div class="panel-title"><?php echo $lang->doc->myCollection;?></div>
<nav class="panel-actions nav nav-default">
<li><?php echo html::a($this->createLink('doc', 'browse', "libID=0&browseTyp=collectedbyme"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
<li><?php echo html::a($this->createLink('doc', 'browse', "browseType=collectedbyme"), '<i class="icon icon-more icon-sm"></i>', '', "title='{$lang->more}'");?></li>
</nav>
</div>
<div class="panel-body has-table">
+1 -1
View File
@@ -15,7 +15,7 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php echo css::internal($keTableCSS);?>
<style>.detail-content .file-image {padding: 0 50px 0 10px;}</style>
<?php $browseLink = $this->session->docList ? $this->session->docList : inlink('browse', 'libID=0&browseTyp=byediteddate');?>
<?php $browseLink = $this->session->docList ? $this->session->docList : inlink('browse', 'libID=0&browseType=byediteddate');?>
<?php
$sessionString = $config->requestType == 'PATH_INFO' ? '?' : '&';
$sessionString .= session_name() . '=' . session_id();
+5 -7
View File
@@ -69,16 +69,12 @@ class executionModel extends model
/* Unset story, bug, build and testtask if type is ops. */
$execution = $this->getByID($executionID);
/*
if($execution and $execution->lifetime == 'ops')
{
unset($this->lang->execution->menu->story);
unset($this->lang->execution->menu->qa);
unset($this->lang->execution->subMenu->qa->bug);
unset($this->lang->execution->subMenu->qa->build);
unset($this->lang->execution->subMenu->qa->testtask);
unset($this->lang->execution->menu->build);
}
*/
/* Hide story and qa menu when execution is story or design type. */
/*
@@ -1482,7 +1478,8 @@ class executionModel extends model
->leftJoin(TABLE_PRODUCT)->alias('t2')
->on('t1.product = t2.id')
->where('t1.project')->eq((int)$executionID)
->andWhere('t2.deleted')->eq(0);
->andWhere('t2.deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi();
if(!$withBranch) return $query->fetchPairs('id', 'name');
return $query->fetchAll('id');
}
@@ -2058,12 +2055,13 @@ class executionModel extends model
$planStories = array();
$planProducts = array();
$count = 0;
$this->loadModel('story');
if(!empty($plans))
{
foreach($plans as $planID => $productID)
{
if(empty($planID)) continue;
$planStory = $this->loadModel('story')->getPlanStories($planID);
$planStory = $this->story->getPlanStories($planID);
if(!empty($planStory))
{
foreach($planStory as $id => $story)
+1 -1
View File
@@ -89,7 +89,7 @@ class extension extends control
{
/* Init vars. */
$type = strtolower($type);
$moduleID = $type == 'bymodule' ? (int)$param : 0;
$moduleID = $type == 'bymodule' ? (int)base64_decode($param) : 0;
$extensions = array();
$pager = null;
+2
View File
@@ -1 +1,3 @@
.pager {margin-top: 0;}
.tree li>a:hover {color: #fff; background-color: #0c64eb;}
.tree li>a.active {color: #fff; background-color: #0c64eb;}
+2
View File
@@ -84,6 +84,7 @@ $lang->misc->feature = new stdclass();
$lang->misc->feature->lastest = 'Letzte Version';
$lang->misc->feature->detailed = 'Details';
$lang->misc->releaseDate['15.0.rc3'] = '2021-04-16';
$lang->misc->releaseDate['15.0.rc2'] = '2021-04-09';
$lang->misc->releaseDate['15.0.rc1'] = '2021-04-05';
$lang->misc->releaseDate['12.5.3'] = '2021-01-06';
@@ -140,6 +141,7 @@ $lang->misc->releaseDate['7.2.stable'] = '2015-05-22';
$lang->misc->releaseDate['7.1.stable'] = '2015-03-07';
$lang->misc->releaseDate['6.3.stable'] = '2014-11-07';
$lang->misc->feature->all['15.0.rc3'][] = array('title' => 'Adjust details,Fix bug', 'desc' => '');
$lang->misc->feature->all['15.0.rc2'][] = array('title' => 'Fix Bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc1'][] = array('title' => 'Upgrade to 15,reframe menu, add program.', 'desc' => '');
$lang->misc->feature->all['12.5.3'][] = array('title' => 'Adjust annual data.', 'desc' => '');
+2
View File
@@ -84,6 +84,7 @@ $lang->misc->feature = new stdclass();
$lang->misc->feature->lastest = 'Latest Version';
$lang->misc->feature->detailed = 'Detail';
$lang->misc->releaseDate['15.0.rc3'] = '2021-04-16';
$lang->misc->releaseDate['15.0.rc2'] = '2021-04-09';
$lang->misc->releaseDate['15.0.rc1'] = '2021-04-05';
$lang->misc->releaseDate['12.5.3'] = '2021-01-06';
@@ -140,6 +141,7 @@ $lang->misc->releaseDate['7.2.stable'] = '2015-05-22';
$lang->misc->releaseDate['7.1.stable'] = '2015-03-07';
$lang->misc->releaseDate['6.3.stable'] = '2014-11-07';
$lang->misc->feature->all['15.0.rc3'][] = array('title' => 'Adjust details,Fix bug', 'desc' => '');
$lang->misc->feature->all['15.0.rc2'][] = array('title' => 'Fix Bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc1'][] = array('title' => 'Upgrade to 15,reframe menu, add program.', 'desc' => '');
$lang->misc->feature->all['12.5.3'][] = array('title' => 'Adjust annual data.', 'desc' => '');
+2
View File
@@ -84,6 +84,7 @@ $lang->misc->feature = new stdclass();
$lang->misc->feature->lastest = 'Dernière Version';
$lang->misc->feature->detailed = 'Détail';
$lang->misc->releaseDate['15.0.rc3'] = '2021-04-16';
$lang->misc->releaseDate['15.0.rc2'] = '2021-04-09';
$lang->misc->releaseDate['15.0.rc1'] = '2021-04-05';
$lang->misc->releaseDate['12.5.3'] = '2021-01-06';
@@ -140,6 +141,7 @@ $lang->misc->releaseDate['7.2.stable'] = '2015-05-22';
$lang->misc->releaseDate['7.1.stable'] = '2015-03-07';
$lang->misc->releaseDate['6.3.stable'] = '2014-11-07';
$lang->misc->feature->all['15.0.rc3'][] = array('title' => 'Adjust details, fix bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc2'][] = array('title' => 'Fix Bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc1'][] = array('title' => 'Upgrade to 15,reframe menu, add program.', 'desc' => '');
$lang->misc->feature->all['12.5.3'][] = array('title' => 'Adjust annual data.', 'desc' => '');
+2
View File
@@ -84,6 +84,7 @@ $lang->misc->feature = new stdclass();
$lang->misc->feature->lastest = 'Latest Version';
$lang->misc->feature->detailed = 'Chi tiết';
$lang->misc->releaseDate['15.0.rc3'] = '2021-04-16';
$lang->misc->releaseDate['15.0.rc2'] = '2021-04-09';
$lang->misc->releaseDate['15.0.rc1'] = '2021-04-05';
$lang->misc->releaseDate['12.5.3'] = '2021-01-06';
@@ -140,6 +141,7 @@ $lang->misc->releaseDate['7.2.stable'] = '2015-05-22';
$lang->misc->releaseDate['7.1.stable'] = '2015-03-07';
$lang->misc->releaseDate['6.3.stable'] = '2014-11-07';
$lang->misc->feature->all['15.0.rc3'][] = array('title' => 'Adjust detail, fix bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc2'][] = array('title' => 'Fix Bug.', 'desc' => '');
$lang->misc->feature->all['15.0.rc1'][] = array('title' => 'Upgrade to 15,reframe menu, add program.', 'desc' => '');
$lang->misc->feature->all['12.5.3'][] = array('title' => 'Adjust annual data.', 'desc' => '');
+2
View File
@@ -84,6 +84,7 @@ $lang->misc->feature = new stdclass();
$lang->misc->feature->lastest = '最新版本';
$lang->misc->feature->detailed = '详情';
$lang->misc->releaseDate['15.0.rc3'] = '2021-04-16';
$lang->misc->releaseDate['15.0.rc2'] = '2021-04-09';
$lang->misc->releaseDate['15.0.rc1'] = '2021-04-05';
$lang->misc->releaseDate['12.5.3'] = '2021-01-06';
@@ -140,6 +141,7 @@ $lang->misc->releaseDate['7.2.stable'] = '2015-05-22';
$lang->misc->releaseDate['7.1.stable'] = '2015-03-07';
$lang->misc->releaseDate['6.3.stable'] = '2014-11-07';
$lang->misc->feature->all['15.0.rc3'][] = array('title' => '完善细节,修复Bug', 'desc' => '');
$lang->misc->feature->all['15.0.rc2'][] = array('title' => '修复Bug,优化界面交互', 'desc' => '');
$lang->misc->feature->all['15.0.rc1'][] = array('title' => '升级到15版本,重构导航、文档库,增加项目集管理', 'desc' => '');
$lang->misc->feature->all['12.5.3'][] = array('title' => '优化年度总结', 'desc' => '');
+5 -8
View File
@@ -125,14 +125,11 @@ class my extends control
{
/* Save session. */
$uri = $this->app->getURI(true);
if($this->app->viewType != 'json')
{
$this->session->set('todoList', $uri, 'my');
$this->session->set('bugList', $uri, 'qa');
$this->session->set('taskList', $uri, 'execution');
$this->session->set('storyList', $uri, 'product');
$this->session->set('testtaskList', $uri, 'qa');
}
$this->session->set('todoList', $uri, 'my');
$this->session->set('bugList', $uri, 'qa');
$this->session->set('taskList', $uri, 'execution');
$this->session->set('storyList', $uri, 'product');
$this->session->set('testtaskList', $uri, 'qa');
/* Load pager. */
$this->app->loadClass('pager', $static = true);
+5 -1
View File
@@ -340,6 +340,10 @@ class product extends control
$rdUsers = $this->user->getPairs('nodeleted|devfirst|noclosed', '', $this->config->maxCount);
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
$lines = array();
if($programID) $lines = array('') + $this->product->getLinePairs($programID);
if($this->config->systemMode == 'classic') $lines = array('') + $this->product->getLinePairs();
$this->view->title = $this->lang->product->create;
$this->view->position[] = $this->view->title;
$this->view->groups = $this->loadModel('group')->getPairs();
@@ -349,7 +353,7 @@ class product extends control
$this->view->rdUsers = $rdUsers;
$this->view->users = $this->user->getPairs('nodeleted|noclosed');
$this->view->programs = array('') + $this->loadModel('program')->getTopPairs('', 'noclosed');
$this->view->lines = $this->config->systemMode == 'new' ? array() : array('' => '') + $this->product->getLinePairs();
$this->view->lines = $lines;
$this->view->URSRPairs = $this->loadModel('custom')->getURSRPairs();
unset($this->lang->product->typeList['']);
+1 -1
View File
@@ -612,7 +612,7 @@ class project extends control
$this->session->set('caseList', $uri, 'qa');
$this->session->set('testtaskList', $uri, 'qa');
if($this->config->maxVersion)
if(isset($this->config->maxVersion))
{
$this->session->set('riskList', $uri, 'project');
$this->session->set('issueList', $uri, 'project');
+4
View File
@@ -42,6 +42,10 @@ $config->repo->edit->requiredFields = 'product,SCM,name,path,encoding,client';
$config->repo->svn = new stdclass();
$config->repo->svn->requiredFields = 'account,password';
$config->repo->gitlab = new stdclass;
$config->repo->gitlab->perPage = 300;
$config->repo->gitlab->apiPath = "%s/api/v4/projects/%s/repository/";
$config->repo->rules['module']['task'] = 'Task';
$config->repo->rules['module']['bug'] = 'Bug';
$config->repo->rules['module']['story'] = 'Story';
+31
View File
@@ -165,6 +165,14 @@ class repo extends control
$this->app->loadLang('action');
if($repo->SCM == 'Gitlab')
{
$projects = $this->repo->getGitlabProjects($repo->client, $repo->password);
$options = array();
foreach($projects as $project) $options[$project->id] = $project->name . ':' . $project->http_url_to_repo;
$this->view->projects = $options;
}
$repo->repoType = $repo->id . '-' . $repo->SCM;
$this->view->repo = $repo;
$this->view->repoID = $repoID;
@@ -1072,6 +1080,29 @@ class repo extends control
die($reposHtml);
}
/**
* Ajax get gitlab projects.
*
* @param string $host
* @param string $token
* @access public
* @return void
*/
public function ajaxGetGitlabProjects($host, $token)
{
$host = helper::safe64Decode($host);
$projects = $this->repo->getGitlabProjects($host, $token);
if(!$projects) $this->send(array('message' => array()));
$options = '';
foreach($projects as $project)
{
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name}:{$project->http_url_to_repo}</option>";
}
die($options);
}
/**
* Ajax get branch drop menu.
*
+27 -2
View File
@@ -6,16 +6,38 @@ $(function()
$form = $(this).closest('form');
$form.css('min-height', $form.height());
})
$('#gitlabHost, #gitlabToken').change(function()
{
host = Base64.encode($('#gitlabHost').val());
token = $('#gitlabToken').val();
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + '&token=' + token);
if(host == '' || token == '') return false;
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
$('#gitlabProject').change(function()
{
$option = $(this).find('option:selected');
$('#name').val($option.data('name'));
});
});
function scmChanged(scm) {
function scmChanged(scm)
{
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
$('.tips-git').removeClass('hidden');
$('.tips-svn').addClass('hidden');
}
}
else
{
$('.account-fields').removeClass('hidden');
@@ -23,4 +45,7 @@ function scmChanged(scm) {
$('.tips-git').addClass('hidden');
$('.tips-svn').removeClass('hidden');
}
$('tr.gitlab').toggle(scm == 'Gitlab');
$('tr.hide-gitlab').toggle(scm != 'Gitlab');
}
+28 -1
View File
@@ -6,9 +6,33 @@ $(function()
$form = $(this).closest('form');
$form.css('min-height', $form.height());
})
$('#gitlabHost, #gitlabToken').change(function()
{
host = Base64.encode($('#gitlabHost').val());
token = $('#gitlabToken').val();
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + '&token=' + token);
if(host == '' || token == '') return false;
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
});
});
$('#gitlabProject').change(function()
{
$option = $(this).find('option:selected');
if(!$option.data('name')) return false;
$('#name').val($option.data('name'));
$(this).chosen().trigger("chosen:updated");
});
});
function scmChanged(scm) {
function scmChanged(scm)
{
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
@@ -23,4 +47,7 @@ function scmChanged(scm) {
$('.tips-git').addClass('hidden');
$('.tips-svn').removeClass('hidden');
}
$('tr.gitlab').toggle(scm == 'Gitlab');
$('tr.hide-gitlab').toggle(scm != 'Gitlab');
}
+8
View File
@@ -124,6 +124,14 @@ $lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->scmList['Subversion'] = 'SVN';
$lang->repo->scmList['Gitlab'] = 'Gitlab';
$lang->repo->gitlabHost = 'Gitlab Host';
$lang->repo->gitlabToken = 'Gitlab Token';
$lang->repo->gitlabProject = 'Projects';
$lang->repo->placeholder = new stdclass;
$lang->repo->placeholder->gitlabHost = 'Input url of gitlab';
$lang->repo->notice = new stdclass();
$lang->repo->notice->syncing = 'Synchronizing. Please wait ...';
+8
View File
@@ -124,6 +124,14 @@ $lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Git'] = 'Git';
$lang->repo->scmList['Subversion'] = 'Subversion';
$lang->repo->scmList['Gitlab'] = 'Gitlab';
$lang->repo->gitlabHost = 'Gitlab 地址';
$lang->repo->gitlabToken = 'Gitlab Token';
$lang->repo->gitlabProject = '项目';
$lang->repo->placeholder = new stdclass;
$lang->repo->placeholder->gitlabHost = '请填写gitlab访问地址';
$lang->repo->notice = new stdclass();
$lang->repo->notice->syncing = '正在同步中, 请稍等...';
+41 -2
View File
@@ -235,11 +235,21 @@ class repoModel extends model
if(!$this->checkConnection()) return false;
$data = fixer::input('post')
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
->skipSpecial('path,client,account,password')
->setDefault('product', '')
->join('product', ',')
->get();
if($this->post->SCM == 'Gitlab')
{
$data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
unset($data->gitlabHost);
unset($data->gitlabToken);
}
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
if($data->SCM == 'Subversion')
@@ -252,8 +262,9 @@ class repoModel extends model
}
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
$this->dao->insert(TABLE_REPO)->data($data)
$this->dao->insert(TABLE_REPO)->data($data, $skip = 'gitlabProject')
->batchCheck($this->config->repo->create->requiredFields, 'notempty')
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->autoCheck()
->exec();
@@ -282,6 +293,16 @@ class repoModel extends model
->skipSpecial('path,client,account,password')
->join('product', ',')
->get();
if($this->post->SCM == 'Gitlab')
{
$data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
unset($data->gitlabHost);
unset($data->gitlabToken);
unset($data->gitlabProject);
}
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
if($data->SCM == 'Subversion' and $data->path != $repo->path)
@@ -301,9 +322,10 @@ class repoModel extends model
if(!$this->checkConnection()) return false;
if($data->encrypt == 'base64') $data->password = base64_encode($data->password);
$this->dao->update(TABLE_REPO)->data($data)
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabProject')
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
->autoCheck()
->where('id')->eq($id)->exec();
@@ -1754,4 +1776,21 @@ class repoModel extends model
return $buildedURL;
}
/**
* Get gitlab projects.
*
* @param string $host
* @param string $token
* @access public
* @return array
*/
public function getGitlabProjects($host, $token)
{
$host = rtrim($host, '/');
$host .= '/api/v4/projects';
$projects = file_get_contents($host . "?private_token=$token");
return json_decode($projects);
}
}
+17 -4
View File
@@ -10,6 +10,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/base64.js');?>
<?php if(common::checkNotCN()):?>
<style>.user-addon {padding-right: 16px; padding-left: 16px;}</style>
<?php endif;?>
@@ -31,12 +32,24 @@
<td style="width:550px"><?php echo html::select('SCM', $lang->repo->scmList, 'Git', "onchange='scmChanged(this.value)' class='form-control'"); ?></td>
<td class="tips-git"><?php echo $lang->repo->syncTips; ?></td>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabHost;?></th>
<td><?php echo html::input('gitlabHost', '', "class='form-control' placeholder='{$lang->repo->placeholder}'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabToken;?></th>
<td><?php echo html::input('gitlabToken', '', "class='form-control'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabProject;?></th>
<td><?php echo html::select('gitlabProject', array(''), '', "class='form-control chosen'");?>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', '', "class='form-control'"); ?></td>
<td class='muted'>
@@ -49,7 +62,7 @@
<td class='required'><?php echo html::input('encoding', 'utf-8', "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', '', "class='form-control'")?></td>
<td class='muted'>
@@ -57,11 +70,11 @@
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
</td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', '', "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
+17 -4
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/base64.js');?>
<?php if(common::checkNotCN()):?>
<style>
.user-addon{padding-right: 16px; padding-left: 16px;}
@@ -37,12 +38,24 @@
<span class="tips-git"><?php echo $lang->repo->syncTips; ?></span>
</td>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabHost;?></th>
<td><?php echo html::input('gitlabHost', $repo->client, "class='form-control' placeholder='{$lang->repo->placeholder}'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabToken;?></th>
<td><?php echo html::input('gitlabToken', $repo->password, "class='form-control'");?>
</tr>
<tr class='gitlab hide'>
<th><?php echo $lang->repo->gitlabProject;?></th>
<td><?php echo html::select('gitlabProject', $projects, '', "class='form-control chosen'");?>
</tr>
<tr>
<th><?php echo $lang->repo->name; ?></th>
<td class='required'><?php echo html::input('name', $repo->name, "class='form-control'"); ?></td>
<td></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->path; ?></th>
<td class='required'><?php echo html::input('path', $repo->path, "class='form-control'"); ?></td>
<td class='muted'>
@@ -55,7 +68,7 @@
<td class='required'><?php echo html::input('encoding', $repo->encoding, "class='form-control'"); ?></td>
<td class='muted'><?php echo $lang->repo->encodingsTips; ?></td>
</tr>
<tr>
<tr class='hide-gitlab'>
<th><?php echo $lang->repo->client;?></th>
<td class='required'><?php echo html::input('client', $repo->client, "class='form-control'")?></td>
<td class='muted'>
@@ -63,11 +76,11 @@
<span class="tips-svn"><?php echo $lang->repo->example->client->svn;?></span>
</td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->account;?></th>
<td><?php echo html::input('account', $repo->account, "class='form-control'");?></td>
</tr>
<tr class="account-fields">
<tr class="account-fields hide-gitlab">
<th><?php echo $lang->repo->password;?></th>
<td>
<div class='input-group'>
+2 -2
View File
@@ -526,7 +526,7 @@ class storyModel extends model
$story = fixer::input('post')
->callFunc('title', 'trim')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->add('lastEditedDate', $now)
->setIF($this->post->assignedTo == '', 'assignedTo', $oldStory->assignedTo)
->setIF($this->post->assignedTo != '' and $this->post->assignedTo != $oldStory->assignedTo, 'assignedDate', $now)
->setIF($specChanged, 'version', $oldStory->version + 1)
@@ -2743,7 +2743,7 @@ class storyModel extends model
}
elseif($type == 'full')
{
$property = '(' . $this->lang->story->pri . ':' . (!empty($this->lang->story->priList[$story->pri]) ? $this->lang->story->priList[$story->pri] : 0) . ',' . $this->lang->story->estimate . ':' . $this->lang->hourCommon . ')';
$property = '(' . $this->lang->story->pri . ':' . (!empty($this->lang->story->priList[$story->pri]) ? $this->lang->story->priList[$story->pri] : 0) . ',' . $this->lang->story->estimate . ':' . $story->estimate . ')';
}
else
{
+19
View File
@@ -1228,6 +1228,13 @@ class task extends control
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
if(!empty($this->view->task->team))
{
$members = array();
foreach($this->view->task->team as $account => $member) $members[$account] = zget($this->view->members, $account);
$this->view->members = $members;
}
if(!isset($this->view->members[$this->view->task->finishedBy])) $this->view->members[$this->view->task->finishedBy] = $this->view->task->finishedBy;
$this->view->title = $this->view->execution->name . $this->lang->colon . $this->lang->task->activate;
$this->view->position[] = $this->lang->task->activate;
@@ -1560,6 +1567,18 @@ class task extends control
if(isset($users[$task->closedBy])) $task->closedBy = $users[$task->closedBy];
if(isset($users[$task->lastEditedBy])) $task->lastEditedBy = $users[$task->lastEditedBy];
/* Convert username to real name. */
if(!empty($task->mailto))
{
$mailtoList = explode(',', $task->mailto);
$task->mailto = '';
foreach($mailtoList as $mailto)
{
if(!empty($mailto)) $task->mailto .= ',' . zget($users, $mailto);
}
}
if($task->parent > 0 && strpos($task->name, htmlentities('>')) !== 0) $task->name = '>' . $task->name;
if(!empty($task->team)) $task->name = '[' . $taskLang->multipleAB . '] ' . $task->name;
-1
View File
@@ -335,7 +335,6 @@ function markTestStory()
var $tr = $(this);
storiesHasTest[$tr.find('select[name^="testStory"]').val()] = true;
});
console.log(storiesHasTest);
return storiesHasTest;
};
+1
View File
@@ -1490,6 +1490,7 @@ class taskModel extends model
$data->status = $task->status;
$data->lastEditedBy = $this->app->user->account;
$data->lastEditedDate = $now;
if(helper::isZeroDate($task->realStarted)) $data->realStarted = $now;
if($left == 0)
{
+1 -1
View File
@@ -160,7 +160,7 @@ $config->testcase->datatable->fieldList['lastRunResult']['required'] = 'no';
$config->testcase->datatable->fieldList['status']['title'] = 'statusAB';
$config->testcase->datatable->fieldList['status']['fixed'] = 'no';
$config->testcase->datatable->fieldList['status']['width'] = '60';
$config->testcase->datatable->fieldList['status']['width'] = '70';
$config->testcase->datatable->fieldList['status']['required'] = 'no';
$config->testcase->datatable->fieldList['lastEditedBy']['title'] = 'lastEditedBy';
+1
View File
@@ -134,3 +134,4 @@ $lang->upgrade->fromVersions['12_5_1'] = '12.5.1';
$lang->upgrade->fromVersions['12_5_2'] = '12.5.2';
$lang->upgrade->fromVersions['12_5_3'] = '12.5.3';
$lang->upgrade->fromVersions['15_0_rc1'] = '15.0.rc1';
$lang->upgrade->fromVersions['15_0_rc2'] = '15.0.rc2';
+3
View File
@@ -643,6 +643,9 @@ class upgradeModel extends model
$this->saveLogs('Execute 15_0_rc1');
$this->adjustUserView();
$this->appendExec('15_0_rc1');
case '15_0_rc2':
$this->saveLogs('Execute 15_0_rc2');
$this->appendExec('15_0_rc2');
}
$this->deletePatch();