Merge branch 'devops16'

This commit is contained in:
liyuchun
2021-12-13 12:12:37 +08:00
77 changed files with 2286 additions and 850 deletions
+9
View File
@@ -0,0 +1,9 @@
ALTER TABLE `zt_task` ADD `repo` mediumint unsigned NOT NULL AFTER `activatedDate`;
ALTER TABLE `zt_task` ADD `entry` varchar(255) NOT NULL AFTER `repo`;
ALTER TABLE `zt_task` ADD `lines` varchar(10) NOT NULL AFTER `entry`;
ALTER TABLE `zt_task` ADD `v1` varchar(40) NOT NULL AFTER `lines`;
ALTER TABLE `zt_task` ADD `v2` varchar(40) NOT NULL AFTER `v1`;
ALTER TABLE `zt_task` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`;
ALTER TABLE `zt_bug` ADD `mr` mediumint(8) unsigned NOT NULL AFTER `repo`;
UPDATE `zt_grouppriv` SET `method`='addReview' where `module`='mr' and `method`='addBug';
+7
View File
@@ -203,6 +203,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` (
`caseVersion` smallint(6) NOT NULL DEFAULT '1', `caseVersion` smallint(6) NOT NULL DEFAULT '1',
`result` mediumint(8) unsigned NOT NULL, `result` mediumint(8) unsigned NOT NULL,
`repo` mediumint(8) unsigned NOT NULL, `repo` mediumint(8) unsigned NOT NULL,
`mr` mediumint(8) unsigned NOT NULL,
`entry` varchar(255) NOT NULL, `entry` varchar(255) NOT NULL,
`lines` varchar(10) NOT NULL, `lines` varchar(10) NOT NULL,
`v1` varchar(40) NOT NULL, `v1` varchar(40) NOT NULL,
@@ -1250,6 +1251,12 @@ CREATE TABLE IF NOT EXISTS `zt_task` (
`lastEditedBy` varchar(30) NOT NULL, `lastEditedBy` varchar(30) NOT NULL,
`lastEditedDate` datetime NOT NULL, `lastEditedDate` datetime NOT NULL,
`activatedDate` date NOT NULL, `activatedDate` date NOT NULL,
`repo` mediumint(8) unsigned NOT NULL,
`mr` mediumint(8) unsigned NOT NULL,
`entry` varchar(255) NOT NULL,
`lines` varchar(10) NOT NULL,
`v1` varchar(40) NOT NULL,
`v2` varchar(40) NOT NULL,
`deleted` enum('0','1') NOT NULL default '0', `deleted` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `execution` (`execution`), KEY `execution` (`execution`),
+6 -1
View File
@@ -220,7 +220,10 @@ class gitlab
$count = $count == 0 ? '' : "-n $count"; $count = $count == 0 ? '' : "-n $count";
$list = $this->getCommitsByPath($path, $fromRevision, $toRevision); $list = $this->getCommitsByPath($path, $fromRevision, $toRevision);
foreach($list as $commit) $commit->diffs = $this->getFilesByCommit($commit->id); foreach($list as $commit)
{
if(isset($commit->id)) $commit->diffs = $this->getFilesByCommit($commit->id);
}
return $this->parseLog($list); return $this->parseLog($list);
} }
@@ -656,6 +659,7 @@ class gitlab
{ {
$results = $this->fetch($api, $params); $results = $this->fetch($api, $params);
$params->page ++; $params->page ++;
if(!is_array($results)) $results = array();
$allResults = $allResults + $results; $allResults = $allResults + $results;
if(count($results) < 100) break; if(count($results) < 100) break;
} }
@@ -751,6 +755,7 @@ class gitlab
$i = 0; $i = 0;
foreach($logs as $commit) foreach($logs as $commit)
{ {
if(!isset($commit->id)) continue;
$parsedLog = new stdclass(); $parsedLog = new stdclass();
$parsedLog->revision = $commit->id; $parsedLog->revision = $commit->id;
$parsedLog->committer = $commit->committer_name; $parsedLog->committer = $commit->committer_name;
+100 -92
View File
@@ -79,101 +79,104 @@ $lang->action->periods['lastweek'] = $lang->action->dynamic->lastWeek;
$lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth; $lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth;
$lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth; $lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth;
$lang->action->objectTypes['product'] = $lang->productCommon; $lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = 'Branch'; $lang->action->objectTypes['branch'] = 'Branch';
$lang->action->objectTypes['story'] = $lang->SRCommon; $lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = 'Design'; $lang->action->objectTypes['design'] = 'Design';
$lang->action->objectTypes['productplan'] = 'Plan'; $lang->action->objectTypes['productplan'] = 'Plan';
$lang->action->objectTypes['release'] = 'Release'; $lang->action->objectTypes['release'] = 'Release';
$lang->action->objectTypes['program'] = 'Program'; $lang->action->objectTypes['program'] = 'Program';
$lang->action->objectTypes['project'] = 'Project'; $lang->action->objectTypes['project'] = 'Project';
$lang->action->objectTypes['execution'] = $lang->executionCommon; $lang->action->objectTypes['execution'] = $lang->executionCommon;
$lang->action->objectTypes['task'] = 'Task'; $lang->action->objectTypes['task'] = 'Task';
$lang->action->objectTypes['build'] = 'Build'; $lang->action->objectTypes['build'] = 'Build';
$lang->action->objectTypes['job'] = 'Job'; $lang->action->objectTypes['job'] = 'Job';
$lang->action->objectTypes['bug'] = 'Bug'; $lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = 'Case'; $lang->action->objectTypes['case'] = 'Case';
$lang->action->objectTypes['caseresult'] = 'Case Result'; $lang->action->objectTypes['caseresult'] = 'Case Result';
$lang->action->objectTypes['stepresult'] = 'Case Steps'; $lang->action->objectTypes['stepresult'] = 'Case Steps';
$lang->action->objectTypes['caselib'] = 'Library'; $lang->action->objectTypes['caselib'] = 'Library';
$lang->action->objectTypes['testsuite'] = 'Suite'; $lang->action->objectTypes['testsuite'] = 'Suite';
$lang->action->objectTypes['testtask'] = 'Test Build'; $lang->action->objectTypes['testtask'] = 'Test Build';
$lang->action->objectTypes['testreport'] = 'Report'; $lang->action->objectTypes['testreport'] = 'Report';
$lang->action->objectTypes['doc'] = 'Document'; $lang->action->objectTypes['doc'] = 'Document';
$lang->action->objectTypes['api'] = 'Interface'; $lang->action->objectTypes['api'] = 'Interface';
$lang->action->objectTypes['doclib'] = 'Document Library'; $lang->action->objectTypes['doclib'] = 'Document Library';
$lang->action->objectTypes['apistruct'] = 'API struct'; $lang->action->objectTypes['apistruct'] = 'API struct';
$lang->action->objectTypes['todo'] = 'Todo'; $lang->action->objectTypes['todo'] = 'Todo';
$lang->action->objectTypes['risk'] = 'Risk'; $lang->action->objectTypes['risk'] = 'Risk';
$lang->action->objectTypes['issue'] = 'Issue'; $lang->action->objectTypes['issue'] = 'Issue';
$lang->action->objectTypes['module'] = 'Module'; $lang->action->objectTypes['module'] = 'Module';
$lang->action->objectTypes['user'] = 'User'; $lang->action->objectTypes['user'] = 'User';
$lang->action->objectTypes['stakeholder'] = 'Stakeholder'; $lang->action->objectTypes['stakeholder'] = 'Stakeholder';
$lang->action->objectTypes['budget'] = 'Cost Estimate'; $lang->action->objectTypes['budget'] = 'Cost Estimate';
$lang->action->objectTypes['entry'] = 'Entry'; $lang->action->objectTypes['entry'] = 'Entry';
$lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = 'Team'; $lang->action->objectTypes['team'] = 'Team';
$lang->action->objectTypes['whitelist'] = 'Whitelist'; $lang->action->objectTypes['whitelist'] = 'Whitelist';
$lang->action->objectTypes['pipeline'] = 'GitLab'; $lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab'; $lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins'; $lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = 'Merge Request'; $lang->action->objectTypes['mr'] = 'Merge Request';
$lang->action->objectTypes['gitlabproject'] = 'GitLab Project'; $lang->action->objectTypes['gitlabproject'] = 'GitLab Project';
$lang->action->objectTypes['gitlabuser'] = 'GitLab User'; $lang->action->objectTypes['gitlabuser'] = 'GitLab User';
$lang->action->objectTypes['gitlabgroup'] = 'GitLab Group'; $lang->action->objectTypes['gitlabgroup'] = 'GitLab Group';
$lang->action->objectTypes['gitlabbranch'] = 'GitLab Branch';
$lang->action->objectTypes['gitlabbranchpriv'] = 'GitLab Protected Branches';
/* Used to describe operation history. */ /* Used to describe operation history. */
$lang->action->desc = new stdclass(); $lang->action->desc = new stdclass();
$lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>.' . "\n"; $lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>.' . "\n";
$lang->action->desc->extra = '$date, <strong>$action</strong> as <strong>$extra</strong> by <strong>$actor</strong>.' . "\n"; $lang->action->desc->extra = '$date, <strong>$action</strong> as <strong>$extra</strong> by <strong>$actor</strong>.' . "\n";
$lang->action->desc->opened = '$date, created by <strong>$actor</strong> .' . "\n"; $lang->action->desc->opened = '$date, created by <strong>$actor</strong> .' . "\n";
$lang->action->desc->openedbysystem = '$date, opened by system.' . "\n"; $lang->action->desc->openedbysystem = '$date, opened by system.' . "\n";
$lang->action->desc->created = '$date, created by <strong>$actor</strong> .' . "\n"; $lang->action->desc->created = '$date, created by <strong>$actor</strong> .' . "\n";
$lang->action->desc->added = '$date, added by <strong>$actor</strong> .' . "\n"; $lang->action->desc->added = '$date, added by <strong>$actor</strong> .' . "\n";
$lang->action->desc->changed = '$date, changed by <strong>$actor</strong> .' . "\n"; $lang->action->desc->changed = '$date, changed by <strong>$actor</strong> .' . "\n";
$lang->action->desc->edited = '$date, edited by <strong>$actor</strong> .' . "\n"; $lang->action->desc->edited = '$date, edited by <strong>$actor</strong> .' . "\n";
$lang->action->desc->assigned = '$date, <strong>$actor</strong> assigned to <strong>$extra</strong>.' . "\n"; $lang->action->desc->assigned = '$date, <strong>$actor</strong> assigned to <strong>$extra</strong>.' . "\n";
$lang->action->desc->closed = '$date, closed by <strong>$actor</strong> .' . "\n"; $lang->action->desc->closed = '$date, closed by <strong>$actor</strong> .' . "\n";
$lang->action->desc->closedbysystem = '$date, closed by system.' . "\n"; $lang->action->desc->closedbysystem = '$date, closed by system.' . "\n";
$lang->action->desc->deleted = '$date, deleted by <strong>$actor</strong> .' . "\n"; $lang->action->desc->deleted = '$date, deleted by <strong>$actor</strong> .' . "\n";
$lang->action->desc->deletedfile = '$date, <strong>$actor</strong> deleted <strong><i>$extra</i></strong>.' . "\n"; $lang->action->desc->deletedfile = '$date, <strong>$actor</strong> deleted <strong><i>$extra</i></strong>.' . "\n";
$lang->action->desc->editfile = '$date, <strong>$actor</strong> edited <strong><i>$extra</i></strong>.' . "\n"; $lang->action->desc->editfile = '$date, <strong>$actor</strong> edited <strong><i>$extra</i></strong>.' . "\n";
$lang->action->desc->erased = '$date, deleted by <strong>$actor</strong> .' . "\n"; $lang->action->desc->erased = '$date, deleted by <strong>$actor</strong> .' . "\n";
$lang->action->desc->undeleted = '$date, restored by <strong>$actor</strong> .' . "\n"; $lang->action->desc->undeleted = '$date, restored by <strong>$actor</strong> .' . "\n";
$lang->action->desc->hidden = '$date, hidden by <strong>$actor</strong> .' . "\n"; $lang->action->desc->hidden = '$date, hidden by <strong>$actor</strong> .' . "\n";
$lang->action->desc->commented = '$date, added by <strong>$actor</strong>.' . "\n"; $lang->action->desc->commented = '$date, added by <strong>$actor</strong>.' . "\n";
$lang->action->desc->activated = '$date, activated by <strong>$actor</strong> .' . "\n"; $lang->action->desc->activated = '$date, activated by <strong>$actor</strong> .' . "\n";
$lang->action->desc->blocked = '$date, blocked by <strong>$actor</strong> .' . "\n"; $lang->action->desc->blocked = '$date, blocked by <strong>$actor</strong> .' . "\n";
$lang->action->desc->moved = '$date, moved by <strong>$actor</strong> , which was "$extra".' . "\n"; $lang->action->desc->moved = '$date, moved by <strong>$actor</strong> , which was "$extra".' . "\n";
$lang->action->desc->confirmed = '$date, <strong>$actor</strong> confirmed the story change. The latest build is <strong>#$extra</strong>.' . "\n"; $lang->action->desc->confirmed = '$date, <strong>$actor</strong> confirmed the story change. The latest build is <strong>#$extra</strong>.' . "\n";
$lang->action->desc->caseconfirmed = '$date, <strong>$actor</strong> confirmed the case change. The latest build is <strong>#$extra</strong>' . "\n"; $lang->action->desc->caseconfirmed = '$date, <strong>$actor</strong> confirmed the case change. The latest build is <strong>#$extra</strong>' . "\n";
$lang->action->desc->bugconfirmed = '$date, <strong>$actor</strong> confirmed Bug.' . "\n"; $lang->action->desc->bugconfirmed = '$date, <strong>$actor</strong> confirmed Bug.' . "\n";
$lang->action->desc->frombug = '$date, converted from <strong>$actor</strong>. Its ID was <strong>$extra</strong>.'; $lang->action->desc->frombug = '$date, converted from <strong>$actor</strong>. Its ID was <strong>$extra</strong>.';
$lang->action->desc->started = '$date, started by <strong>$actor</strong>.' . "\n"; $lang->action->desc->started = '$date, started by <strong>$actor</strong>.' . "\n";
$lang->action->desc->restarted = '$date, continued by <strong>$actor</strong>.' . "\n"; $lang->action->desc->restarted = '$date, continued by <strong>$actor</strong>.' . "\n";
$lang->action->desc->delayed = '$date, postponed by <strong>$actor</strong>.' . "\n"; $lang->action->desc->delayed = '$date, postponed by <strong>$actor</strong>.' . "\n";
$lang->action->desc->suspended = '$date, suspended by <strong>$actor</strong>.' . "\n"; $lang->action->desc->suspended = '$date, suspended by <strong>$actor</strong>.' . "\n";
$lang->action->desc->recordestimate = '$date, recorded by <strong>$actor</strong> and it cost <strong>$extra</strong> hours.'; $lang->action->desc->recordestimate = '$date, recorded by <strong>$actor</strong> and it cost <strong>$extra</strong> hours.';
$lang->action->desc->editestimate = '$date, <strong>$actor</strong> edited Hour.'; $lang->action->desc->editestimate = '$date, <strong>$actor</strong> edited Hour.';
$lang->action->desc->deleteestimate = '$date, <strong>$actor</strong> deleted Hour.'; $lang->action->desc->deleteestimate = '$date, <strong>$actor</strong> deleted Hour.';
$lang->action->desc->canceled = '$date, cancelled by <strong>$actor</strong>.' . "\n"; $lang->action->desc->canceled = '$date, cancelled by <strong>$actor</strong>.' . "\n";
$lang->action->desc->svncommited = '$date, <strong>$actor</strong> committed and the build is <strong>#$extra</strong>.' . "\n"; $lang->action->desc->svncommited = '$date, <strong>$actor</strong> committed and the build is <strong>#$extra</strong>.' . "\n";
$lang->action->desc->gitcommited = '$date, <strong>$actor</strong> committed and the build is <strong>#$extra</strong>.' . "\n"; $lang->action->desc->gitcommited = '$date, <strong>$actor</strong> committed and the build is <strong>#$extra</strong>.' . "\n";
$lang->action->desc->finished = '$date, finished by <strong>$actor</strong>.' . "\n"; $lang->action->desc->finished = '$date, finished by <strong>$actor</strong>.' . "\n";
$lang->action->desc->paused = '$date, paused by <strong>$actor</strong>.' . "\n"; $lang->action->desc->paused = '$date, paused by <strong>$actor</strong>.' . "\n";
$lang->action->desc->verified = '$date, verified by <strong>$actor</strong>.' . "\n"; $lang->action->desc->verified = '$date, verified by <strong>$actor</strong>.' . "\n";
$lang->action->desc->diff1 = '<strong><i>%s</i></strong> is changed. It was "%s" and it is "%s".<br />' . "\n"; $lang->action->desc->diff1 = '<strong><i>%s</i></strong> is changed. It was "%s" and it is "%s".<br />' . "\n";
$lang->action->desc->diff2 = '<strong><i>%s</i></strong> is changed. The difference is ' . "\n" . "<blockquote class='textdiff'>%s</blockquote>" . "\n<blockquote class='original'>%s</blockquote>"; $lang->action->desc->diff2 = '<strong><i>%s</i></strong> is changed. The difference is ' . "\n" . "<blockquote class='textdiff'>%s</blockquote>" . "\n<blockquote class='original'>%s</blockquote>";
$lang->action->desc->diff3 = 'File Name %s was changed to %s .' . "\n"; $lang->action->desc->diff3 = 'File Name %s was changed to %s .' . "\n";
$lang->action->desc->linked2bug = '$date, linked to <strong>$extra</strong> by <strong>$actor</strong>'; $lang->action->desc->linked2bug = '$date, linked to <strong>$extra</strong> by <strong>$actor</strong>';
$lang->action->desc->linked2testtask = '$date, linked to <strong>$extra</strong> by <strong>$actor</strong>'; $lang->action->desc->linked2testtask = '$date, linked to <strong>$extra</strong> by <strong>$actor</strong>';
$lang->action->desc->resolved = '$date, resolved by <strong>$actor</strong> ' . "\n"; $lang->action->desc->resolved = '$date, resolved by <strong>$actor</strong> ' . "\n";
$lang->action->desc->managed = '$date, by <strong>$actor</strong> managed.' . "\n"; $lang->action->desc->managed = '$date, by <strong>$actor</strong> managed.' . "\n";
$lang->action->desc->estimated = '$date, by <strong>$actor</strong> estimated.' . "\n"; $lang->action->desc->estimated = '$date, by <strong>$actor</strong> estimated.' . "\n";
$lang->action->desc->run = '$date, by <strong>$actor</strong> executed.' . "\n"; $lang->action->desc->run = '$date, by <strong>$actor</strong> executed.' . "\n";
$lang->action->desc->syncprogram = '$date, started by <strong>$actor</strong>(starting the project sets the program status as Ongoing).' . "\n"; $lang->action->desc->syncprogram = '$date, started by <strong>$actor</strong>(starting the project sets the program status as Ongoing).' . "\n";
$lang->action->desc->syncproject = '$date, starting the execution sets the project status as Ongoing.' . "\n"; $lang->action->desc->syncproject = '$date, starting the execution sets the project status as Ongoing.' . "\n";
$lang->action->desc->syncexecution = '$date, starting the task sets the execution status as Ongoing.' . "\n"; $lang->action->desc->syncexecution = '$date, starting the task sets the execution status as Ongoing.' . "\n";
$lang->action->desc->importfromgitlab = '$date, Issue associate created from gitlab by <strong>$actor</strong>.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */ /* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n"; $lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
@@ -303,6 +306,7 @@ $lang->action->label->compilefail = 'Compile Fail';
$lang->action->label->reopen = 'Reopen'; $lang->action->label->reopen = 'Reopen';
$lang->action->label->approve = 'Passed'; $lang->action->label->approve = 'Passed';
$lang->action->label->reject = 'Rejected'; $lang->action->label->reject = 'Rejected';
$lang->action->label->importfromgitlab = 'Issue associate created';
/* Dynamic information is grouped by object. */ /* Dynamic information is grouped by object. */
$lang->action->dynamicAction = new stdclass; $lang->action->dynamicAction = new stdclass;
@@ -353,6 +357,7 @@ $lang->action->dynamicAction->release['notified'] = 'Notify Release';
$lang->action->dynamicAction->release['hidden'] = 'Hide Release'; $lang->action->dynamicAction->release['hidden'] = 'Hide Release';
$lang->action->dynamicAction->story['opened'] = 'Create Story'; $lang->action->dynamicAction->story['opened'] = 'Create Story';
$lang->action->dynamicAction->story['importfromgitlab'] = "Issue associate create story";
$lang->action->dynamicAction->story['edited'] = 'Edit Story'; $lang->action->dynamicAction->story['edited'] = 'Edit Story';
$lang->action->dynamicAction->story['activated'] = 'Activate Story'; $lang->action->dynamicAction->story['activated'] = 'Activate Story';
$lang->action->dynamicAction->story['reviewed'] = 'Review Story'; $lang->action->dynamicAction->story['reviewed'] = 'Review Story';
@@ -393,6 +398,7 @@ $lang->action->dynamicAction->kanbanlane['moved'] = 'Move Swimlane';
$lang->action->dynamicAction->team['managedTeam'] = 'Manage Team'; $lang->action->dynamicAction->team['managedTeam'] = 'Manage Team';
$lang->action->dynamicAction->task['opened'] = 'Create Task'; $lang->action->dynamicAction->task['opened'] = 'Create Task';
$lang->action->dynamicAction->task['importfromgitlab'] = "Issue associate create task";
$lang->action->dynamicAction->task['edited'] = 'Edit Task'; $lang->action->dynamicAction->task['edited'] = 'Edit Task';
$lang->action->dynamicAction->task['commented'] = 'Task Comment'; $lang->action->dynamicAction->task['commented'] = 'Task Comment';
$lang->action->dynamicAction->task['assigned'] = 'Assign Task'; $lang->action->dynamicAction->task['assigned'] = 'Assign Task';
@@ -426,6 +432,7 @@ $lang->action->dynamicAction->build['edited'] = 'Edit Build';
$lang->action->dynamicAction->build['deleted'] = 'Delete Build'; $lang->action->dynamicAction->build['deleted'] = 'Delete Build';
$lang->action->dynamicAction->bug['opened'] = 'Report Bug'; $lang->action->dynamicAction->bug['opened'] = 'Report Bug';
$lang->action->dynamicAction->bug['importfromgitlab'] = "Issue associate create bug";
$lang->action->dynamicAction->bug['edited'] = 'Edit Bug'; $lang->action->dynamicAction->bug['edited'] = 'Edit Bug';
$lang->action->dynamicAction->bug['activated'] = 'Activate Bug'; $lang->action->dynamicAction->bug['activated'] = 'Activate Bug';
$lang->action->dynamicAction->bug['assigned'] = 'Assign Bug'; $lang->action->dynamicAction->bug['assigned'] = 'Assign Bug';
@@ -614,6 +621,7 @@ $lang->action->search->label['canceled'] = $lang->action->label->ca
$lang->action->search->label['finished'] = $lang->action->label->finished; $lang->action->search->label['finished'] = $lang->action->label->finished;
$lang->action->search->label['paused'] = $lang->action->label->paused; $lang->action->search->label['paused'] = $lang->action->label->paused;
$lang->action->search->label['verified'] = $lang->action->label->verified; $lang->action->search->label['verified'] = $lang->action->label->verified;
$lang->action->search->label['importfromgitlab'] = $lang->action->label->importfromgitlab;
$lang->action->search->label['login'] = $lang->action->label->login; $lang->action->search->label['login'] = $lang->action->label->login;
$lang->action->search->label['logout'] = $lang->action->label->logout; $lang->action->search->label['logout'] = $lang->action->label->logout;
+100 -92
View File
@@ -79,101 +79,104 @@ $lang->action->periods['lastweek'] = $lang->action->dynamic->lastWeek;
$lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth; $lang->action->periods['thismonth'] = $lang->action->dynamic->thisMonth;
$lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth; $lang->action->periods['lastmonth'] = $lang->action->dynamic->lastMonth;
$lang->action->objectTypes['product'] = $lang->productCommon; $lang->action->objectTypes['product'] = $lang->productCommon;
$lang->action->objectTypes['branch'] = '分支'; $lang->action->objectTypes['branch'] = '分支';
$lang->action->objectTypes['story'] = $lang->SRCommon; $lang->action->objectTypes['story'] = $lang->SRCommon;
$lang->action->objectTypes['design'] = '设计'; $lang->action->objectTypes['design'] = '设计';
$lang->action->objectTypes['productplan'] = '计划'; $lang->action->objectTypes['productplan'] = '计划';
$lang->action->objectTypes['release'] = '发布'; $lang->action->objectTypes['release'] = '发布';
$lang->action->objectTypes['program'] = '项目集'; $lang->action->objectTypes['program'] = '项目集';
$lang->action->objectTypes['project'] = '项目'; $lang->action->objectTypes['project'] = '项目';
$lang->action->objectTypes['execution'] = $config->systemMode == 'new' ? '执行' : $lang->executionCommon; $lang->action->objectTypes['execution'] = $config->systemMode == 'new' ? '执行' : $lang->executionCommon;
$lang->action->objectTypes['task'] = '任务'; $lang->action->objectTypes['task'] = '任务';
$lang->action->objectTypes['build'] = '版本'; $lang->action->objectTypes['build'] = '版本';
$lang->action->objectTypes['job'] = '构建'; $lang->action->objectTypes['job'] = '构建';
$lang->action->objectTypes['bug'] = 'Bug'; $lang->action->objectTypes['bug'] = 'Bug';
$lang->action->objectTypes['case'] = '用例'; $lang->action->objectTypes['case'] = '用例';
$lang->action->objectTypes['caseresult'] = '用例结果'; $lang->action->objectTypes['caseresult'] = '用例结果';
$lang->action->objectTypes['stepresult'] = '用例步骤'; $lang->action->objectTypes['stepresult'] = '用例步骤';
$lang->action->objectTypes['caselib'] = '用例库'; $lang->action->objectTypes['caselib'] = '用例库';
$lang->action->objectTypes['testsuite'] = '套件'; $lang->action->objectTypes['testsuite'] = '套件';
$lang->action->objectTypes['testtask'] = '测试单'; $lang->action->objectTypes['testtask'] = '测试单';
$lang->action->objectTypes['testreport'] = '报告'; $lang->action->objectTypes['testreport'] = '报告';
$lang->action->objectTypes['doc'] = '文档'; $lang->action->objectTypes['doc'] = '文档';
$lang->action->objectTypes['api'] = '接口'; $lang->action->objectTypes['api'] = '接口';
$lang->action->objectTypes['doclib'] = '文档库'; $lang->action->objectTypes['doclib'] = '文档库';
$lang->action->objectTypes['apistruct'] = '数据结构'; $lang->action->objectTypes['apistruct'] = '数据结构';
$lang->action->objectTypes['todo'] = '待办'; $lang->action->objectTypes['todo'] = '待办';
$lang->action->objectTypes['risk'] = '风险'; $lang->action->objectTypes['risk'] = '风险';
$lang->action->objectTypes['issue'] = '问题'; $lang->action->objectTypes['issue'] = '问题';
$lang->action->objectTypes['module'] = '模块'; $lang->action->objectTypes['module'] = '模块';
$lang->action->objectTypes['user'] = '用户'; $lang->action->objectTypes['user'] = '用户';
$lang->action->objectTypes['stakeholder'] = '干系人'; $lang->action->objectTypes['stakeholder'] = '干系人';
$lang->action->objectTypes['budget'] = '费用估算'; $lang->action->objectTypes['budget'] = '费用估算';
$lang->action->objectTypes['entry'] = '应用'; $lang->action->objectTypes['entry'] = '应用';
$lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['webhook'] = 'Webhook';
$lang->action->objectTypes['team'] = '团队'; $lang->action->objectTypes['team'] = '团队';
$lang->action->objectTypes['whitelist'] = '白名单'; $lang->action->objectTypes['whitelist'] = '白名单';
$lang->action->objectTypes['pipeline'] = 'GitLab'; $lang->action->objectTypes['pipeline'] = 'GitLab';
$lang->action->objectTypes['gitlab'] = 'GitLab'; $lang->action->objectTypes['gitlab'] = 'GitLab';
$lang->action->objectTypes['jenkins'] = 'Jenkins'; $lang->action->objectTypes['jenkins'] = 'Jenkins';
$lang->action->objectTypes['mr'] = '合并请求'; $lang->action->objectTypes['mr'] = '合并请求';
$lang->action->objectTypes['gitlabproject'] = 'GitLab项目'; $lang->action->objectTypes['gitlabproject'] = 'GitLab项目';
$lang->action->objectTypes['gitlabuser'] = 'GitLab用户'; $lang->action->objectTypes['gitlabuser'] = 'GitLab用户';
$lang->action->objectTypes['gitlabgroup'] = 'GitLab群组'; $lang->action->objectTypes['gitlabgroup'] = 'GitLab群组';
$lang->action->objectTypes['gitlabbranch'] = 'GitLab分支';
$lang->action->objectTypes['gitlabbranchpriv'] = 'GitLab保护分支';
/* 用来描述操作历史记录。*/ /* 用来描述操作历史记录。*/
$lang->action->desc = new stdclass(); $lang->action->desc = new stdclass();
$lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>。' . "\n"; $lang->action->desc->common = '$date, <strong>$action</strong> by <strong>$actor</strong>。' . "\n";
$lang->action->desc->extra = '$date, <strong>$action</strong> as <strong>$extra</strong> by <strong>$actor</strong>。' . "\n"; $lang->action->desc->extra = '$date, <strong>$action</strong> as <strong>$extra</strong> by <strong>$actor</strong>。' . "\n";
$lang->action->desc->opened = '$date, 由 <strong>$actor</strong> 创建。' . "\n"; $lang->action->desc->opened = '$date, 由 <strong>$actor</strong> 创建。' . "\n";
$lang->action->desc->openedbysystem = '$date, 由系统创建。' . "\n"; $lang->action->desc->openedbysystem = '$date, 由系统创建。' . "\n";
$lang->action->desc->created = '$date, 由 <strong>$actor</strong> 创建。' . "\n"; $lang->action->desc->created = '$date, 由 <strong>$actor</strong> 创建。' . "\n";
$lang->action->desc->added = '$date, 由 <strong>$actor</strong> 添加。' . "\n"; $lang->action->desc->added = '$date, 由 <strong>$actor</strong> 添加。' . "\n";
$lang->action->desc->changed = '$date, 由 <strong>$actor</strong> 变更。' . "\n"; $lang->action->desc->changed = '$date, 由 <strong>$actor</strong> 变更。' . "\n";
$lang->action->desc->edited = '$date, 由 <strong>$actor</strong> 编辑。' . "\n"; $lang->action->desc->edited = '$date, 由 <strong>$actor</strong> 编辑。' . "\n";
$lang->action->desc->assigned = '$date, 由 <strong>$actor</strong> 指派给 <strong>$extra</strong>。' . "\n"; $lang->action->desc->assigned = '$date, 由 <strong>$actor</strong> 指派给 <strong>$extra</strong>。' . "\n";
$lang->action->desc->closed = '$date, 由 <strong>$actor</strong> 关闭。' . "\n"; $lang->action->desc->closed = '$date, 由 <strong>$actor</strong> 关闭。' . "\n";
$lang->action->desc->closedbysystem = '$date, 由系统关闭。' . "\n"; $lang->action->desc->closedbysystem = '$date, 由系统关闭。' . "\n";
$lang->action->desc->deleted = '$date, 由 <strong>$actor</strong> 删除。' . "\n"; $lang->action->desc->deleted = '$date, 由 <strong>$actor</strong> 删除。' . "\n";
$lang->action->desc->deletedfile = '$date, 由 <strong>$actor</strong> 删除了附件:<strong><i>$extra</i></strong>。' . "\n"; $lang->action->desc->deletedfile = '$date, 由 <strong>$actor</strong> 删除了附件:<strong><i>$extra</i></strong>。' . "\n";
$lang->action->desc->editfile = '$date, 由 <strong>$actor</strong> 编辑了附件:<strong><i>$extra</i></strong>。' . "\n"; $lang->action->desc->editfile = '$date, 由 <strong>$actor</strong> 编辑了附件:<strong><i>$extra</i></strong>。' . "\n";
$lang->action->desc->erased = '$date, 由 <strong>$actor</strong> 删除。' . "\n"; $lang->action->desc->erased = '$date, 由 <strong>$actor</strong> 删除。' . "\n";
$lang->action->desc->undeleted = '$date, 由 <strong>$actor</strong> 还原。' . "\n"; $lang->action->desc->undeleted = '$date, 由 <strong>$actor</strong> 还原。' . "\n";
$lang->action->desc->hidden = '$date, 由 <strong>$actor</strong> 隐藏。' . "\n"; $lang->action->desc->hidden = '$date, 由 <strong>$actor</strong> 隐藏。' . "\n";
$lang->action->desc->commented = '$date, 由 <strong>$actor</strong> 添加备注。' . "\n"; $lang->action->desc->commented = '$date, 由 <strong>$actor</strong> 添加备注。' . "\n";
$lang->action->desc->activated = '$date, 由 <strong>$actor</strong> 激活。' . "\n"; $lang->action->desc->activated = '$date, 由 <strong>$actor</strong> 激活。' . "\n";
$lang->action->desc->blocked = '$date, 由 <strong>$actor</strong> 阻塞。' . "\n"; $lang->action->desc->blocked = '$date, 由 <strong>$actor</strong> 阻塞。' . "\n";
$lang->action->desc->moved = '$date, 由 <strong>$actor</strong> 移动,之前为 "$extra"。' . "\n"; $lang->action->desc->moved = '$date, 由 <strong>$actor</strong> 移动,之前为 "$extra"。' . "\n";
$lang->action->desc->confirmed = '$date, 由 <strong>$actor</strong> 确认' . $lang->SRCommon . '变动,最新版本为<strong>#$extra</strong>。' . "\n"; $lang->action->desc->confirmed = '$date, 由 <strong>$actor</strong> 确认' . $lang->SRCommon . '变动,最新版本为<strong>#$extra</strong>。' . "\n";
$lang->action->desc->caseconfirmed = '$date, 由 <strong>$actor</strong> 确认用例变动,最新版本为<strong>#$extra</strong>。' . "\n"; $lang->action->desc->caseconfirmed = '$date, 由 <strong>$actor</strong> 确认用例变动,最新版本为<strong>#$extra</strong>。' . "\n";
$lang->action->desc->bugconfirmed = '$date, 由 <strong>$actor</strong> 确认Bug。' . "\n"; $lang->action->desc->bugconfirmed = '$date, 由 <strong>$actor</strong> 确认Bug。' . "\n";
$lang->action->desc->frombug = '$date, 由 <strong>$actor</strong> Bug转化而来,Bug编号为 <strong>$extra</strong>。'; $lang->action->desc->frombug = '$date, 由 <strong>$actor</strong> Bug转化而来,Bug编号为 <strong>$extra</strong>。';
$lang->action->desc->started = '$date, 由 <strong>$actor</strong> 启动。' . "\n"; $lang->action->desc->started = '$date, 由 <strong>$actor</strong> 启动。' . "\n";
$lang->action->desc->restarted = '$date, 由 <strong>$actor</strong> 继续。' . "\n"; $lang->action->desc->restarted = '$date, 由 <strong>$actor</strong> 继续。' . "\n";
$lang->action->desc->delayed = '$date, 由 <strong>$actor</strong> 延期。' . "\n"; $lang->action->desc->delayed = '$date, 由 <strong>$actor</strong> 延期。' . "\n";
$lang->action->desc->suspended = '$date, 由 <strong>$actor</strong> 挂起。' . "\n"; $lang->action->desc->suspended = '$date, 由 <strong>$actor</strong> 挂起。' . "\n";
$lang->action->desc->recordestimate = '$date, 由 <strong>$actor</strong> 记录工时,消耗 <strong>$extra</strong> 小时。'; $lang->action->desc->recordestimate = '$date, 由 <strong>$actor</strong> 记录工时,消耗 <strong>$extra</strong> 小时。';
$lang->action->desc->editestimate = '$date, 由 <strong>$actor</strong> 编辑工时。'; $lang->action->desc->editestimate = '$date, 由 <strong>$actor</strong> 编辑工时。';
$lang->action->desc->deleteestimate = '$date, 由 <strong>$actor</strong> 删除工时。'; $lang->action->desc->deleteestimate = '$date, 由 <strong>$actor</strong> 删除工时。';
$lang->action->desc->canceled = '$date, 由 <strong>$actor</strong> 取消。' . "\n"; $lang->action->desc->canceled = '$date, 由 <strong>$actor</strong> 取消。' . "\n";
$lang->action->desc->svncommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n"; $lang->action->desc->svncommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n";
$lang->action->desc->gitcommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n"; $lang->action->desc->gitcommited = '$date, 由 <strong>$actor</strong> 提交代码,版本为<strong>#$extra</strong>。' . "\n";
$lang->action->desc->finished = '$date, 由 <strong>$actor</strong> 完成。' . "\n"; $lang->action->desc->finished = '$date, 由 <strong>$actor</strong> 完成。' . "\n";
$lang->action->desc->paused = '$date, 由 <strong>$actor</strong> 暂停。' . "\n"; $lang->action->desc->paused = '$date, 由 <strong>$actor</strong> 暂停。' . "\n";
$lang->action->desc->verified = '$date, 由 <strong>$actor</strong> 验收。' . "\n"; $lang->action->desc->verified = '$date, 由 <strong>$actor</strong> 验收。' . "\n";
$lang->action->desc->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />' . "\n"; $lang->action->desc->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />' . "\n";
$lang->action->desc->diff2 = '修改了 <strong><i>%s</i></strong>,区别为:' . "\n" . "<blockquote class='textdiff'>%s</blockquote>" . "\n<blockquote class='original'>%s</blockquote>"; $lang->action->desc->diff2 = '修改了 <strong><i>%s</i></strong>,区别为:' . "\n" . "<blockquote class='textdiff'>%s</blockquote>" . "\n<blockquote class='original'>%s</blockquote>";
$lang->action->desc->diff3 = '将文件名 %s 改为 %s 。' . "\n"; $lang->action->desc->diff3 = '将文件名 %s 改为 %s 。' . "\n";
$lang->action->desc->linked2bug = '$date 由 <strong>$actor</strong> 关联到版本 <strong>$extra</strong>'; $lang->action->desc->linked2bug = '$date 由 <strong>$actor</strong> 关联到版本 <strong>$extra</strong>';
$lang->action->desc->linked2testtask = '$date 由 <strong>$actor</strong> 关联到测试单 <strong>$extra</strong>'; $lang->action->desc->linked2testtask = '$date 由 <strong>$actor</strong> 关联到测试单 <strong>$extra</strong>';
$lang->action->desc->resolved = '$date, 由 <strong>$actor</strong> 解决。' . "\n"; $lang->action->desc->resolved = '$date, 由 <strong>$actor</strong> 解决。' . "\n";
$lang->action->desc->managed = '$date, 由 <strong>$actor</strong> 维护。' . "\n"; $lang->action->desc->managed = '$date, 由 <strong>$actor</strong> 维护。' . "\n";
$lang->action->desc->estimated = '$date, 由 <strong>$actor</strong> 估算。' . "\n"; $lang->action->desc->estimated = '$date, 由 <strong>$actor</strong> 估算。' . "\n";
$lang->action->desc->run = '$date, 由 <strong>$actor</strong> 执行。' . "\n"; $lang->action->desc->run = '$date, 由 <strong>$actor</strong> 执行。' . "\n";
$lang->action->desc->syncprogram = '$date, 由 <strong>$actor</strong> 启动(因项目开始而启动项目集)。' . "\n"; $lang->action->desc->syncprogram = '$date, 由 <strong>$actor</strong> 启动(因项目开始而启动项目集)。' . "\n";
$lang->action->desc->syncproject = '$date, 系统判断由于执行开始,将项目状态置为进行中。' . "\n"; $lang->action->desc->syncproject = '$date, 系统判断由于执行开始,将项目状态置为进行中。' . "\n";
$lang->action->desc->syncexecution = '$date, 系统判断由于任务开始,将执行状态置为进行中。' . "\n"; $lang->action->desc->syncexecution = '$date, 系统判断由于任务开始,将执行状态置为进行中。' . "\n";
$lang->action->desc->importfromgitlab = '$date, 由 <strong>$actor</strong> 从Gitlab的Issue关联创建。' . "\n";
/* 用来描述和父子任务相关的操作历史记录。*/ /* 用来描述和父子任务相关的操作历史记录。*/
$lang->action->desc->createchildren = '$date, 由 <strong>$actor</strong> 创建子任务 <strong>$extra</strong>。' . "\n"; $lang->action->desc->createchildren = '$date, 由 <strong>$actor</strong> 创建子任务 <strong>$extra</strong>。' . "\n";
@@ -303,6 +306,7 @@ $lang->action->label->compilefail = '构建失败';
$lang->action->label->reopen = '重新打开'; $lang->action->label->reopen = '重新打开';
$lang->action->label->approve = '通过了'; $lang->action->label->approve = '通过了';
$lang->action->label->reject = '拒绝了'; $lang->action->label->reject = '拒绝了';
$lang->action->label->importfromgitlab = '从Gitlab关联创建了';
/* 动态信息按照对象分组 */ /* 动态信息按照对象分组 */
$lang->action->dynamicAction = new stdclass(); $lang->action->dynamicAction = new stdclass();
@@ -353,6 +357,7 @@ $lang->action->dynamicAction->release['notified'] = '通知发布';
$lang->action->dynamicAction->release['hidden'] = '隐藏发布'; $lang->action->dynamicAction->release['hidden'] = '隐藏发布';
$lang->action->dynamicAction->story['opened'] = "创建{$lang->SRCommon}"; $lang->action->dynamicAction->story['opened'] = "创建{$lang->SRCommon}";
$lang->action->dynamicAction->story['importfromgitlab'] = "从Gitlab关联创建{$lang->SRCommon}";
$lang->action->dynamicAction->story['edited'] = "编辑{$lang->SRCommon}"; $lang->action->dynamicAction->story['edited'] = "编辑{$lang->SRCommon}";
$lang->action->dynamicAction->story['activated'] = "激活{$lang->SRCommon}"; $lang->action->dynamicAction->story['activated'] = "激活{$lang->SRCommon}";
$lang->action->dynamicAction->story['reviewed'] = "评审{$lang->SRCommon}"; $lang->action->dynamicAction->story['reviewed'] = "评审{$lang->SRCommon}";
@@ -393,6 +398,7 @@ $lang->action->dynamicAction->kanbanlane['moved'] = '移动泳道';
$lang->action->dynamicAction->team['managedTeam'] = '维护团队'; $lang->action->dynamicAction->team['managedTeam'] = '维护团队';
$lang->action->dynamicAction->task['opened'] = '创建任务'; $lang->action->dynamicAction->task['opened'] = '创建任务';
$lang->action->dynamicAction->task['importfromgitlab'] = "从Gitlab关联创建任务";
$lang->action->dynamicAction->task['edited'] = '编辑任务'; $lang->action->dynamicAction->task['edited'] = '编辑任务';
$lang->action->dynamicAction->task['commented'] = '备注任务'; $lang->action->dynamicAction->task['commented'] = '备注任务';
$lang->action->dynamicAction->task['assigned'] = '指派任务'; $lang->action->dynamicAction->task['assigned'] = '指派任务';
@@ -426,6 +432,7 @@ $lang->action->dynamicAction->build['edited'] = '编辑版本';
$lang->action->dynamicAction->build['deleted'] = '删除版本'; $lang->action->dynamicAction->build['deleted'] = '删除版本';
$lang->action->dynamicAction->bug['opened'] = '创建Bug'; $lang->action->dynamicAction->bug['opened'] = '创建Bug';
$lang->action->dynamicAction->bug['importfromgitlab'] = "从Gitlab关联创建Bug";
$lang->action->dynamicAction->bug['edited'] = '编辑Bug'; $lang->action->dynamicAction->bug['edited'] = '编辑Bug';
$lang->action->dynamicAction->bug['activated'] = '激活Bug'; $lang->action->dynamicAction->bug['activated'] = '激活Bug';
$lang->action->dynamicAction->bug['assigned'] = '指派Bug'; $lang->action->dynamicAction->bug['assigned'] = '指派Bug';
@@ -614,6 +621,7 @@ $lang->action->search->label['canceled'] = $lang->action->label->ca
$lang->action->search->label['finished'] = $lang->action->label->finished; $lang->action->search->label['finished'] = $lang->action->label->finished;
$lang->action->search->label['paused'] = $lang->action->label->paused; $lang->action->search->label['paused'] = $lang->action->label->paused;
$lang->action->search->label['verified'] = $lang->action->label->verified; $lang->action->search->label['verified'] = $lang->action->label->verified;
$lang->action->search->label['importfromgitlab'] = $lang->action->label->importfromgitlab;
$lang->action->search->label['login'] = $lang->action->label->login; $lang->action->search->label['login'] = $lang->action->label->login;
$lang->action->search->label['logout'] = $lang->action->label->logout; $lang->action->search->label['logout'] = $lang->action->label->logout;
+1
View File
@@ -91,6 +91,7 @@ $lang->block->refresh = 'Refresh';
$lang->block->nbsp = ' '; $lang->block->nbsp = ' ';
$lang->block->hidden = 'Hide'; $lang->block->hidden = 'Hide';
$lang->block->dynamicInfo = "<span class='timeline-tag'>%s</span> <span class='timeline-text'>%s <em>%s</em> %s <a href='%s' title='%s'>%s</a></span>"; $lang->block->dynamicInfo = "<span class='timeline-tag'>%s</span> <span class='timeline-text'>%s <em>%s</em> %s <a href='%s' title='%s'>%s</a></span>";
$lang->block->noLinkDynamic = "<span class='timeline-tag'>%s</span> <span class='timeline-text' title='%s'>%s <em>%s</em> %s %s</span>";
$lang->block->cannotPlaceInLeft = 'Cannot place the block at left side.'; $lang->block->cannotPlaceInLeft = 'Cannot place the block at left side.';
$lang->block->cannotPlaceInRight = 'Cannot place the block at right side.'; $lang->block->cannotPlaceInRight = 'Cannot place the block at right side.';
+1
View File
@@ -91,6 +91,7 @@ $lang->block->refresh = '刷新';
$lang->block->nbsp = ''; $lang->block->nbsp = '';
$lang->block->hidden = '隐藏'; $lang->block->hidden = '隐藏';
$lang->block->dynamicInfo = "<span class='timeline-tag'>%s</span> <span class='timeline-text'>%s <em>%s</em> %s <a href='%s' title='%s'>%s</a></span>"; $lang->block->dynamicInfo = "<span class='timeline-tag'>%s</span> <span class='timeline-text'>%s <em>%s</em> %s <a href='%s' title='%s'>%s</a></span>";
$lang->block->noLinkDynamic = "<span class='timeline-tag'>%s</span> <span class='timeline-text' title='%s'>%s <em>%s</em> %s %s</span>";
$lang->block->cannotPlaceInLeft = '此区块无法放置在左侧。'; $lang->block->cannotPlaceInLeft = '此区块无法放置在左侧。';
$lang->block->cannotPlaceInRight = '此区块无法放置在右侧。'; $lang->block->cannotPlaceInRight = '此区块无法放置在右侧。';
+2 -1
View File
@@ -15,7 +15,8 @@
if($action->action == 'login' or $action->action == 'logout') $action->objectName = $action->objectLabel = ''; if($action->action == 'login' or $action->action == 'logout') $action->objectName = $action->objectLabel = '';
$class = $action->major ? "class='active'" : ''; $class = $action->major ? "class='active'" : '';
echo "<li $class><div>"; echo "<li $class><div>";
printf($lang->block->dynamicInfo, $action->date, $user, $action->actionLabel, $action->objectLabel, $action->objectLink, $action->objectName, $action->objectName); if($action->objectLink) printf($lang->block->dynamicInfo, $action->date, $user, $action->actionLabel, $action->objectLabel, $action->objectLink, $action->objectName, $action->objectName);
if(!$action->objectLink) printf($lang->block->noLinkDynamic, $action->date, $action->objectName, $user, $action->actionLabel, $action->objectLabel, $action->objectName);
echo "</div></li>"; echo "</div></li>";
$i++; $i++;
} }
+6
View File
@@ -5,6 +5,12 @@ $config->gitlab->create->requiredFields = 'name,url,token';
$config->gitlab->edit = new stdclass; $config->gitlab->edit = new stdclass;
$config->gitlab->edit->requiredFields = 'name,url,token'; $config->gitlab->edit->requiredFields = 'name,url,token';
$config->gitlab->createbranch = new stdclass;
$config->gitlab->createbranch->requiredFields = 'branch,ref';
$config->gitlab->createbranchpriv = new stdclass;
$config->gitlab->createbranchpriv->requiredFields = 'name';
$config->gitlab->labelPattern = new stdclass; $config->gitlab->labelPattern = new stdclass;
$config->gitlab->labelPattern->task = '/^zentao_task\/\d+$/'; $config->gitlab->labelPattern->task = '/^zentao_task\/\d+$/';
$config->gitlab->labelPattern->bug = '/^zentao_bug\/\d+$/'; $config->gitlab->labelPattern->bug = '/^zentao_bug\/\d+$/';
+247 -28
View File
@@ -712,6 +712,224 @@ class gitlab extends control
die(js::alert($reponse->message)); die(js::alert($reponse->message));
} }
/**
* Browse gitlab branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browseBranch($gitlabID, $projectID, $orderBy = 'name_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->session->set('gitlabBranchList', $this->app->getURI(true));
$branchList = array();
$result = $this->gitlab->apiGetBranches($gitlabID, $projectID);
foreach($result as $gitlabBranch)
{
$branch = new stdClass();
$branch->name = $gitlabBranch->name;
$branch->lastCommitter = $gitlabBranch->commit->committer_name;
$branch->lastCommittedDate = date('Y-m-d H:i:s', strtotime($gitlabBranch->commit->committed_date));
$branchList[] = $branch;
}
/* Data sort. */
list($order, $sort) = explode('_', $orderBy);
$orderList = array();
foreach($branchList as $branch)
{
$orderList[] = $branch->$order;
}
array_multisort($orderList, $sort == 'desc' ? SORT_DESC : SORT_ASC, $branchList);
/* Pager. */
$this->app->loadClass('pager', $static = true);
$recTotal = count($branchList);
$pager = new pager($recTotal, $recPerPage, $pageID);
$branchList = array_chunk($branchList, $pager->recPerPage);
$this->view->gitlab = $this->gitlab->getByID($gitlabID);
$this->view->pager = $pager;
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseBranch;
$this->view->gitlabID = $gitlabID;
$this->view->projectID = $projectID;
$this->view->gitlabBranchList = empty($branchList) ? $branchList: $branchList[$pageID - 1];
$this->view->orderBy = $orderBy;
$this->display();
}
/**
* Creat a gitlab branch.
*
* @param int $gitlabID
* @param int $projectID
* @access public
* @return void
*/
public function createBranch($gitlabID, $projectID)
{
if($_POST)
{
$this->gitlab->createBranch($gitlabID, $projectID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$locate = $this->session->gitlabBranchList ? $this->session->gitlabBranchList : inlink('browseBranch', "gitlibID=$gitlabID&projectID=$projectID");
return $this->send(array('result' => 'success', 'message' => $this->lang->gitlab->createSuccess, 'locate' => $locate));
}
/* Get branches by api. */
$branches = $this->gitlab->apiGetBranches($gitlabID, $projectID);
if(!is_array($branches)) $branches= array();
$branchPairs = array();
foreach($branches as $branch) $branchPairs[$branch->name] = $branch->name;
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->createBranch;
$this->view->gitlabID = $gitlabID;
$this->view->projectID = $projectID;
$this->view->branchPairs = $branchPairs;
$this->display();
}
/**
* Browse gitlab protect branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function browseBranchPriv($gitlabID, $projectID, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
{
$keyword = fixer::input('post')->setDefault('keyword', '')->get('keyword');
$branches = $this->gitlab->apiGetBranchPrivs($gitlabID, $projectID, $keyword, $orderBy);
$project = $this->gitlab->apiGetSingleProject($gitlabID, $projectID);
/* Pager. */
$this->app->loadClass('pager', $static = true);
$recTotal = count($branches);
$pager = new pager($recTotal, $recPerPage, $pageID);
$branchList = array_chunk($branches, $pager->recPerPage);
$this->view->keyword = $keyword;
$this->view->pager = $pager;
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $this->lang->gitlab->browseBranchPriv;
$this->view->levelLang = $this->lang->gitlab->branch->branchCreationLevelList;
$this->view->gitlabID = $gitlabID;
$this->view->projectID = $projectID;
$this->view->project = $project;
$this->view->orderBy = $orderBy;
$this->view->branchList = empty($branchList) ? $branchList: $branchList[$pageID - 1];
$this->display();
}
/**
* Set a gitlab protect branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return void
*/
public function createBranchPriv($gitlabID, $projectID, $branch = '')
{
if($_POST)
{
$this->gitlab->createBranchPriv($gitlabID, $projectID, $branch);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseBranchPriv', "gitlabID=$gitlabID&projectID=$projectID")));
}
$branchPriv = new stdClass();
$branchPriv->name = '';
$branchPriv->mergeAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
$branchPriv->pushAccessLevel = 40; // Initialize data, and the operation authority is the maintainers by default.
$gitlab = $this->gitlab->getByID($gitlabID);
$title = $this->lang->gitlab->createBranchPriv;
if($branch)
{
$title = $this->lang->gitlab->editBranchPriv;
$branchPriv = $this->gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
$branchPriv->mergeAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->merge_access_levels);
$branchPriv->pushAccessLevel = $this->gitlab->checkAccessLevel($branchPriv->push_access_levels);
}
$gitlabBranches = $this->gitlab->apiGetBranches($gitlabID, $projectID);
$protectBranches = $this->gitlab->apiGetBranchPrivs($gitlabID, $projectID, '', 'name_asc');
$protectNames = array_keys($protectBranches);
$branches = array();
foreach($gitlabBranches as $oneBranch)
{
if(!in_array($oneBranch->name, $protectNames) || $oneBranch->name == $branch) $branches[$oneBranch->name] = $oneBranch->name;
}
$this->view->title = $this->lang->gitlab->common . $this->lang->colon . $title;
$this->view->pageTitle = $title;
$this->view->gitlab = $gitlab;
$this->view->gitlabID = $gitlabID;
$this->view->branch = $branch;
$this->view->projectID = $projectID;
$this->view->branches = $branches;
$this->view->branchPriv = $branchPriv;
$this->display();
}
/**
* Edit a gitlab branch protect.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return void
*/
public function editBranchPriv($gitlabID, $projectID, $branch)
{
echo $this->fetch('gitlab', 'createBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch");
}
/**
* Delete a gitlab protect branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @param string $confirm
* @access public
* @return void
*/
public function deleteBranchPriv($gitlabID, $projectID, $branch, $confirm = 'no')
{
if($confirm != 'yes') die(js::confirm($this->lang->gitlab->branch->confirmDelete , inlink('deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch&confirm=yes")));
$reponse = $this->gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
/* If the status code beginning with 20 is returned or empty is returned, it is successful. */
if(!$reponse or substr($reponse->message, 0, 2) == '20')
{
$this->loadModel('action')->create('gitlabbranchPriv', $branch, 'deleted', '', $branch);
die(js::reload('parent'));
}
die(js::alert($reponse->message));
}
/** /**
* Import gitlab issue to zentaopms. * Import gitlab issue to zentaopms.
* *
@@ -730,7 +948,6 @@ class gitlab extends control
if($gitlab) $user = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token); if($gitlab) $user = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token);
if(empty($user->is_admin)) die(js::alert($this->lang->gitlab->tokenLimit) . js::locate($this->createLink('gitlab', 'edit', array('gitlabID' => $gitlabID)))); if(empty($user->is_admin)) die(js::alert($this->lang->gitlab->tokenLimit) . js::locate($this->createLink('gitlab', 'edit', array('gitlabID' => $gitlabID))));
if($_POST) if($_POST)
{ {
$executionList = $this->post->executionList; $executionList = $this->post->executionList;
@@ -740,38 +957,40 @@ class gitlab extends control
$failedIssues = array(); $failedIssues = array();
foreach($executionList as $issueID => $executionID) foreach($executionList as $issueID => $executionID)
{ {
if($executionID) if(empty($executionID) and $productList[$issueID] != 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError, 'locate' => $this->server->http_referer));
}
foreach($executionList as $issueID => $executionID)
{
if(empty($executionID)) continue;
$objectType = $objectTypeList[$issueID];
$issue = $this->gitlab->apiGetSingleIssue($gitlabID, $projectID, $issueID);
$issue->objectType = $objectType;
$issue->objectID = 0; // Meet the required parameters for issueToZentaoObject.
if(isset($issue->assignee)) $issue->assignee_id = $issue->assignee->id;
$issue->updated_by_id = $issue->author->id; // Here can be replaced by current zentao user.
$object = $this->gitlab->issueToZentaoObject($issue, $gitlabID);
$object->product = $productList[$issueID];
$object->execution = $executionID;
$clonedObject = clone $object;
if($objectType == 'task') $objectID = $this->loadModel('task')->createTaskFromGitlabIssue($clonedObject, $executionID);
if($objectType == 'bug') $objectID = $this->loadModel('bug')->createBugFromGitlabIssue($clonedObject, $executionID);
if($objectType == 'story') $objectID = $this->loadModel('story')->createStoryFromGitlabIssue($clonedObject, $executionID);
if($objectID)
{ {
$objectType = $objectTypeList[$issueID]; $this->loadModel('action')->create($objectType, $objectID, 'ImportFromGitlab', '', $issueID);
$issue = $this->gitlab->apiGetSingleIssue($gitlabID, $projectID, $issueID); $object->id = $objectID;
$issue->objectType = $objectType; $this->gitlab->saveImportedIssue($gitlabID, $projectID, $objectType, $objectID, $issue, $object);
$issue->objectID = 0; // Meet the required parameters for issueToZentaoObject.
if(isset($issue->assignee)) $issue->assignee_id = $issue->assignee->id;
$issue->updated_by_id = $issue->author->id; // Here can be replaced by current zentao user.
$object = $this->gitlab->issueToZentaoObject($issue, $gitlabID);
$object->product = $productList[$issueID];
$object->execution = $executionID;
$clonedObject = clone $object;
if($objectType == 'task') $objectID = $this->loadModel('task')->createTaskFromGitlabIssue($clonedObject, $executionID);
if($objectType == 'bug') $objectID = $this->loadModel('bug')->createBugFromGitlabIssue($clonedObject, $executionID);
if($objectType == 'story') $objectID = $this->loadModel('story')->createStoryFromGitlabIssue($clonedObject, $executionID);
if($objectID)
{
$object->id = $objectID;
$this->gitlab->saveImportedIssue($gitlabID, $projectID, $objectType, $objectID, $issue, $object);
}
else
{
$failedIssues[] = $issue->iid;
}
} }
else else
{ {
if($productList[$issueID] != 0) return $this->send(array('result' => 'fail', 'message' => $this->lang->gitlab->importIssueError, 'locate' => $this->server->http_referer)); $failedIssues[] = $issue->iid;
} }
} }
+2
View File
@@ -0,0 +1,2 @@
.text-c-counts > span {margin-left: 5px;}
#mainMenu .pull-left {margin-right: 15px;}
+2
View File
@@ -0,0 +1,2 @@
.table-form>tbody>tr>th {width: 110px;}
.table-form {width: 50%;}
+3 -1
View File
@@ -1 +1,3 @@
.table-form {min-width: 600px;} .table-form {min-width: 700px;}
.c-levels {width: 150px;}
.c-names {width: 300px;}
+3 -1
View File
@@ -1 +1,3 @@
.table-form {min-width: 600px;} .table-form {min-width: 700px;}
.c-levels {width: 150px;}
.c-names {width: 300px;}
+23
View File
@@ -0,0 +1,23 @@
$(document).ready(function()
{
$('#branchSearch').click(function()
{
triggerSearch();
});
$('#keyword').keypress(function(event)
{
if(event.which == 13) triggerSearch();
})
});
/**
* Trigger filtering function.
*
* @access public
* @return void
*/
function triggerSearch()
{
$("#branchPrivForm").submit();
}
+1
View File
@@ -0,0 +1 @@
$("input[type='radio'][value='public']").parent().parent().css("margin-bottom", "0px");
+21 -2
View File
@@ -41,6 +41,25 @@ function addItem(obj)
*/ */
function deleteItem(obj) function deleteItem(obj)
{ {
if($('#teamForm .table tbody').children().length < 2) return false; if($('#teamForm .table-form tbody').children().length < 2) return false;
$(obj).closest('tr').remove(); $(obj).closest('tr').remove();
} }
$(document).on('change', '[id^="levels"]', function()
{
$tr = $(this).closest('tr');
$next = $(this).closest('td').next()
var ownerLevel = 50;
if($(this).val() == ownerLevel)
{
$next.prepend('<input type="text" value="" class="form-control disabled" disabled autocomplete="off" />');
$next.find('[id^="expires"]').addClass('hidden');
$tr.find('a[onclick^="deleteItem"]').addClass('disabled');
}
else
{
$next.find('[id^="expires"]').removeClass('hidden');
$next.find('input.disabled').remove();
$tr.find('a[onclick^="deleteItem"]').removeClass('disabled');
}
})
+2 -2
View File
@@ -41,6 +41,6 @@ function addItem(obj)
*/ */
function deleteItem(obj) function deleteItem(obj)
{ {
if($('#teamForm .table tbody').children().length < 2) return false; if($('#teamForm .table-form tbody').children().length < 2) return false;
$(obj).closest('tr').remove(); $(obj).closest('tr').remove();
} }
+36 -5
View File
@@ -30,6 +30,7 @@ $lang->gitlab->gitlabProject = "GitLab Project";
$lang->gitlab->browseProject = "GitLab Project List"; $lang->gitlab->browseProject = "GitLab Project List";
$lang->gitlab->browseUser = "User List"; $lang->gitlab->browseUser = "User List";
$lang->gitlab->browseGroup = "Group List"; $lang->gitlab->browseGroup = "Group List";
$lang->gitlab->browseBranch = "GitLab Branch List";
$lang->gitlab->gitlabIssue = "GitLab Issue"; $lang->gitlab->gitlabIssue = "GitLab Issue";
$lang->gitlab->zentaoProduct = 'Zentao Product'; $lang->gitlab->zentaoProduct = 'Zentao Product';
$lang->gitlab->objectType = 'Type'; // task, bug, story $lang->gitlab->objectType = 'Type'; // task, bug, story
@@ -43,8 +44,13 @@ $lang->gitlab->deleteGroup = 'Delete group';
$lang->gitlab->createUser = 'Create user'; $lang->gitlab->createUser = 'Create user';
$lang->gitlab->editUser = 'Edit user'; $lang->gitlab->editUser = 'Edit user';
$lang->gitlab->deleteUser = 'Delete user'; $lang->gitlab->deleteUser = 'Delete user';
$lang->gitlab->createBranch = 'Add branch';
$lang->gitlab->manageGroupMembers = 'Manage group member'; $lang->gitlab->manageGroupMembers = 'Manage group member';
$lang->gitlab->createWebhook = 'Create Webhook'; $lang->gitlab->createWebhook = 'Create Webhook';
$lang->gitlab->browseBranchPriv = 'Protect branch';
$lang->gitlab->createBranchPriv = 'Cerate branch protected';
$lang->gitlab->editBranchPriv = 'Edit branch protected';
$lang->gitlab->deleteBranchPriv = 'Delete branch protected';
$lang->gitlab->id = 'ID'; $lang->gitlab->id = 'ID';
$lang->gitlab->name = "GitLab Name"; $lang->gitlab->name = "GitLab Name";
@@ -53,10 +59,12 @@ $lang->gitlab->token = 'Token';
$lang->gitlab->defaultProject = 'Default Project'; $lang->gitlab->defaultProject = 'Default Project';
$lang->gitlab->private = 'MD5 Verify'; $lang->gitlab->private = 'MD5 Verify';
$lang->gitlab->lblCreate = 'Create GitLab Server'; $lang->gitlab->lblCreate = 'Create GitLab Server';
$lang->gitlab->desc = 'Description'; $lang->gitlab->desc = 'Description';
$lang->gitlab->tokenFirst = 'When the Token is not empty, the Token will be used first'; $lang->gitlab->tokenFirst = 'When the Token is not empty, the Token will be used first';
$lang->gitlab->tips = 'When using a password, please disable the "Prevent cross-site request forgery" option in the GitLab global security settings.'; $lang->gitlab->tips = 'When using a password, please disable the "Prevent cross-site request forgery" option in the GitLab global security settings.';
$lang->gitlab->emptyError = " cannot be empty";
$lang->gitlab->createSuccess = "Create success";
$lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder = new stdclass;
$lang->gitlab->placeholder->name = ''; $lang->gitlab->placeholder->name = '';
@@ -82,11 +90,15 @@ $lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.'; $lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)'; $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"; $lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
$lang->gitlab->apiError[4] = 'Branch already exists';
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
$lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.'; $lang->gitlab->errorLang[0] = 'You cannot set Internal as its Visibility Level, if it is private in GitLab.';
$lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.'; $lang->gitlab->errorLang[1] = 'You cannot set Public as its Visibility Level, if it is private in GitLab.';
$lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)'; $lang->gitlab->errorLang[2] = 'Password is too short (minimum is 8 characters)';
$lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.'; $lang->gitlab->errorLang[3] = 'It should contain only letters, digits, underscore, hyphen and period. It should not start with hypen, or end with .git or .atom.';
$lang->gitlab->errorLang[4] = 'Branch already exists.';
$lang->gitlab->errorLang[5] = 'Failed to save group, path has already been taken.';
$lang->gitlab->project = new stdclass; $lang->gitlab->project = new stdclass;
$lang->gitlab->project->id = "Project ID"; $lang->gitlab->project->id = "Project ID";
@@ -122,7 +134,7 @@ $lang->gitlab->user->projectsLimit = "Projects limit";
$lang->gitlab->user->canCreateGroup = "Can create group"; $lang->gitlab->user->canCreateGroup = "Can create group";
$lang->gitlab->user->external = "External"; $lang->gitlab->user->external = "External";
$lang->gitlab->user->externalTip = "External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets."; $lang->gitlab->user->externalTip = "External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.";
$lang->gitlab->user->bind = "Bind Zentao user"; $lang->gitlab->user->bind = "Zentao user";
$lang->gitlab->user->avatar = "Avatar"; $lang->gitlab->user->avatar = "Avatar";
$lang->gitlab->user->skype = "Skype"; $lang->gitlab->user->skype = "Skype";
$lang->gitlab->user->linkedin = "Linkedin"; $lang->gitlab->user->linkedin = "Linkedin";
@@ -150,6 +162,7 @@ $lang->gitlab->group->visibility = "Visibility leve
$lang->gitlab->group->visibilityList['private'] = "Private(The group and its projects can only be viewed by members)"; $lang->gitlab->group->visibilityList['private'] = "Private(The group and its projects can only be viewed by members)";
$lang->gitlab->group->visibilityList['internal'] = "Internal(The group and any internal projects can be viewed by any logged in user except external users)"; $lang->gitlab->group->visibilityList['internal'] = "Internal(The group and any internal projects can be viewed by any logged in user except external users)";
$lang->gitlab->group->visibilityList['public'] = "Public(The group and any public projects can be viewed without any authentication.)"; $lang->gitlab->group->visibilityList['public'] = "Public(The group and any public projects can be viewed without any authentication.)";
$lang->gitlab->group->permission = 'Permission';
$lang->gitlab->group->requestAccessEnabledTip = "Allow users to request access (if visibility is public or internal)"; $lang->gitlab->group->requestAccessEnabledTip = "Allow users to request access (if visibility is public or internal)";
$lang->gitlab->group->lfsEnabled = 'Large File Storage'; $lang->gitlab->group->lfsEnabled = 'Large File Storage';
$lang->gitlab->group->lfsEnabledTip = "Allow projects within this group to use Git LFS(This setting can be overridden in each project)"; $lang->gitlab->group->lfsEnabledTip = "Allow projects within this group to use Git LFS(This setting can be overridden in each project)";
@@ -171,3 +184,21 @@ $lang->gitlab->group->memberName = 'Account';
$lang->gitlab->group->memberAccessLevel = 'Access Level'; $lang->gitlab->group->memberAccessLevel = 'Access Level';
$lang->gitlab->group->memberExpiresAt = 'Expiration time'; $lang->gitlab->group->memberExpiresAt = 'Expiration time';
$lang->gitlab->group->repeatError = "Group members cannot be added repeatedly"; $lang->gitlab->group->repeatError = "Group members cannot be added repeatedly";
$lang->gitlab->branch = new stdclass();
$lang->gitlab->branch->name = 'Branch name';
$lang->gitlab->branch->from = 'Create from';
$lang->gitlab->branch->create = 'Create';
$lang->gitlab->branch->lastCommitter = 'Last Committer';
$lang->gitlab->branch->lastCommittedDate = 'Last Committed Date';
$lang->gitlab->branch->accessLevel = "Branch protection list";
$lang->gitlab->branch->mergeAllowed = "Merge Allowed";
$lang->gitlab->branch->pushAllowed = "Push Allowed";
$lang->gitlab->branch->placeholderSearch = "Branch name";
$lang->gitlab->branch->placeholderSelect = "Branch name";
$lang->gitlab->branch->confirmDelete = 'Branch will be writable for developers. Are you sure?';
$lang->gitlab->branch->branchCreationLevelList[40] = "Maintainers";
$lang->gitlab->branch->branchCreationLevelList[30] = "Developers + Maintainers";
$lang->gitlab->branch->branchCreationLevelList[0] = "No one";
$lang->gitlab->branch->emptyPrivNameError = "Branch cannot be empty.";
$lang->gitlab->branch->issetPrivNameError = "The protection branch already exists";
+36 -5
View File
@@ -30,6 +30,7 @@ $lang->gitlab->gitlabProject = "{$lang->gitlab->common}项目";
$lang->gitlab->browseProject = "{$lang->gitlab->common}项目列表"; $lang->gitlab->browseProject = "{$lang->gitlab->common}项目列表";
$lang->gitlab->browseUser = "用户列表"; $lang->gitlab->browseUser = "用户列表";
$lang->gitlab->browseGroup = "群组列表"; $lang->gitlab->browseGroup = "群组列表";
$lang->gitlab->browseBranch = "GitLab分支列表";
$lang->gitlab->gitlabIssue = "{$lang->gitlab->common} issue"; $lang->gitlab->gitlabIssue = "{$lang->gitlab->common} issue";
$lang->gitlab->zentaoProduct = '禅道产品'; $lang->gitlab->zentaoProduct = '禅道产品';
$lang->gitlab->objectType = '类型'; // task, bug, story $lang->gitlab->objectType = '类型'; // task, bug, story
@@ -43,8 +44,13 @@ $lang->gitlab->deleteGroup = '删除群组';
$lang->gitlab->createUser = '添加用户'; $lang->gitlab->createUser = '添加用户';
$lang->gitlab->editUser = '编辑用户'; $lang->gitlab->editUser = '编辑用户';
$lang->gitlab->deleteUser = '删除用户'; $lang->gitlab->deleteUser = '删除用户';
$lang->gitlab->createBranch = '添加分支';
$lang->gitlab->manageGroupMembers = '群组成员管理'; $lang->gitlab->manageGroupMembers = '群组成员管理';
$lang->gitlab->createWebhook = '创建Webhook'; $lang->gitlab->createWebhook = '创建Webhook';
$lang->gitlab->browseBranchPriv = '分支保护管理';
$lang->gitlab->createBranchPriv = '创建分支保护';
$lang->gitlab->editBranchPriv = '编辑分支保护';
$lang->gitlab->deleteBranchPriv = '删除分支保护';
$lang->gitlab->id = 'ID'; $lang->gitlab->id = 'ID';
$lang->gitlab->name = "{$lang->gitlab->common}名称"; $lang->gitlab->name = "{$lang->gitlab->common}名称";
@@ -53,10 +59,12 @@ $lang->gitlab->token = 'Token';
$lang->gitlab->defaultProject = '默认项目'; $lang->gitlab->defaultProject = '默认项目';
$lang->gitlab->private = 'MD5验证'; $lang->gitlab->private = 'MD5验证';
$lang->gitlab->lblCreate = '添加GitLab服务器'; $lang->gitlab->lblCreate = '添加GitLab服务器';
$lang->gitlab->desc = '描述'; $lang->gitlab->desc = '描述';
$lang->gitlab->tokenFirst = 'Token不为空时,优先使用Token。'; $lang->gitlab->tokenFirst = 'Token不为空时,优先使用Token。';
$lang->gitlab->tips = '使用密码时,请在GitLab全局安全设置中禁用"防止跨站点请求伪造"选项。'; $lang->gitlab->tips = '使用密码时,请在GitLab全局安全设置中禁用"防止跨站点请求伪造"选项。';
$lang->gitlab->emptyError = "不能为空";
$lang->gitlab->createSuccess = "创建成功";
$lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder = new stdclass;
$lang->gitlab->placeholder->name = ''; $lang->gitlab->placeholder->name = '';
@@ -82,11 +90,15 @@ $lang->gitlab->apiError[0] = 'internal is not allowed in a private group.';
$lang->gitlab->apiError[1] = 'public is not allowed in a private group.'; $lang->gitlab->apiError[1] = 'public is not allowed in a private group.';
$lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)'; $lang->gitlab->apiError[2] = 'is too short (minimum is 8 characters)';
$lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"; $lang->gitlab->apiError[3] = "can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'";
$lang->gitlab->apiError[4] = 'Branch already exists';
$lang->gitlab->apiError[5] = 'Failed to save group {:path=>["has already been taken"]}';
$lang->gitlab->errorLang[0] = '私有分组的项目,可见性级别不能设为内部。'; $lang->gitlab->errorLang[0] = '私有分组的项目,可见性级别不能设为内部。';
$lang->gitlab->errorLang[1] = '私有分组的项目,可见性级别不能设为公开。'; $lang->gitlab->errorLang[1] = '私有分组的项目,可见性级别不能设为公开。';
$lang->gitlab->errorLang[2] = '密码太短(最少8个字符)'; $lang->gitlab->errorLang[2] = '密码太短(最少8个字符)';
$lang->gitlab->errorLang[3] = "只能包含字母、数字、'.'-'和'.'。不能以'-'开头、以'.git'结尾或以'.atom'结尾。"; $lang->gitlab->errorLang[3] = "只能包含字母、数字、'.'-'和'.'。不能以'-'开头、以'.git'结尾或以'.atom'结尾。";
$lang->gitlab->errorLang[4] = '分支名已存在。';
$lang->gitlab->errorLang[5] = '保存失败,群组URL路径已经被使用。';
$lang->gitlab->project = new stdclass; $lang->gitlab->project = new stdclass;
$lang->gitlab->project->id = "项目ID"; $lang->gitlab->project->id = "项目ID";
@@ -122,7 +134,7 @@ $lang->gitlab->user->projectsLimit = "限制项目";
$lang->gitlab->user->canCreateGroup = "可创建组"; $lang->gitlab->user->canCreateGroup = "可创建组";
$lang->gitlab->user->external = "外部人员"; $lang->gitlab->user->external = "外部人员";
$lang->gitlab->user->externalTip = "除非明确授予访问权限,否则外部用户无法查看内部或私有项目。另外,外部用户无法创建项目,群组或个人代码片段。"; $lang->gitlab->user->externalTip = "除非明确授予访问权限,否则外部用户无法查看内部或私有项目。另外,外部用户无法创建项目,群组或个人代码片段。";
$lang->gitlab->user->bind = "绑定禅道用户"; $lang->gitlab->user->bind = "禅道用户";
$lang->gitlab->user->avatar = "头像"; $lang->gitlab->user->avatar = "头像";
$lang->gitlab->user->skype = "Skype"; $lang->gitlab->user->skype = "Skype";
$lang->gitlab->user->linkedin = "Linkedin"; $lang->gitlab->user->linkedin = "Linkedin";
@@ -150,6 +162,7 @@ $lang->gitlab->group->visibility = "可见性级别
$lang->gitlab->group->visibilityList['private'] = "私有(群组及其项目只能由成员查看)"; $lang->gitlab->group->visibilityList['private'] = "私有(群组及其项目只能由成员查看)";
$lang->gitlab->group->visibilityList['internal'] = "内部(除外部用户外,任何登录用户均可查看该组和任何内部项目)"; $lang->gitlab->group->visibilityList['internal'] = "内部(除外部用户外,任何登录用户均可查看该组和任何内部项目)";
$lang->gitlab->group->visibilityList['public'] = "公开(群组和任何公共项目可以在没有任何身份验证的情况下查看)"; $lang->gitlab->group->visibilityList['public'] = "公开(群组和任何公共项目可以在没有任何身份验证的情况下查看)";
$lang->gitlab->group->permission = '许可';
$lang->gitlab->group->requestAccessEnabledTip = "允许用户请求访问(如果可见性是公开或内部的)"; $lang->gitlab->group->requestAccessEnabledTip = "允许用户请求访问(如果可见性是公开或内部的)";
$lang->gitlab->group->lfsEnabled = '大文件存储'; $lang->gitlab->group->lfsEnabled = '大文件存储';
$lang->gitlab->group->lfsEnabledTip = "允许该组内的项目使用 Git LFS(可以在每个项目中覆盖此设置)"; $lang->gitlab->group->lfsEnabledTip = "允许该组内的项目使用 Git LFS(可以在每个项目中覆盖此设置)";
@@ -171,3 +184,21 @@ $lang->gitlab->group->memberName = '账号';
$lang->gitlab->group->memberAccessLevel = '角色权限'; $lang->gitlab->group->memberAccessLevel = '角色权限';
$lang->gitlab->group->memberExpiresAt = '过期时间'; $lang->gitlab->group->memberExpiresAt = '过期时间';
$lang->gitlab->group->repeatError = "群组成员不能重复添加"; $lang->gitlab->group->repeatError = "群组成员不能重复添加";
$lang->gitlab->branch = new stdclass();
$lang->gitlab->branch->name = '分支名';
$lang->gitlab->branch->from = '创建自';
$lang->gitlab->branch->create = '创建';
$lang->gitlab->branch->lastCommitter = '最后提交';
$lang->gitlab->branch->lastCommittedDate = '最后修改时间';
$lang->gitlab->branch->accessLevel = "分支保护列表";
$lang->gitlab->branch->mergeAllowed = "允许合并到";
$lang->gitlab->branch->pushAllowed = "允许推送到";
$lang->gitlab->branch->placeholderSearch = "请输入分支名称";
$lang->gitlab->branch->placeholderSelect = "请选择分支";
$lang->gitlab->branch->confirmDelete = '确定删除分支保护?';
$lang->gitlab->branch->branchCreationLevelList[40] = "维护者";
$lang->gitlab->branch->branchCreationLevelList[30] = "开发者 + 维护者";
$lang->gitlab->branch->branchCreationLevelList[0] = "禁止";
$lang->gitlab->branch->emptyPrivNameError = "分支不能为空";
$lang->gitlab->branch->issetPrivNameError = "已存在该保护分支";
+220 -37
View File
@@ -620,7 +620,7 @@ class gitlabModel extends model
$order = explode('_', $orderBy); $order = explode('_', $orderBy);
$keyword = urlencode($keyword); $keyword = urlencode($keyword);
$result = commonModel::httpWithHeader($host . "?private_token={$gitlab->token}&simple=true&&per_page={$pager->recPerPage}&order_by={$order[0]}&sort={$order[1]}&page={$pager->pageID}&search={$keyword}"); $result = commonModel::httpWithHeader($host . "?private_token={$gitlab->token}&simple=true&&per_page={$pager->recPerPage}&order_by={$order[0]}&sort={$order[1]}&page={$pager->pageID}&search={$keyword}&search_namespaces=true");
$header = $result['header']; $header = $result['header'];
$recTotal = $header['X-Total']; $recTotal = $header['X-Total'];
@@ -896,6 +896,24 @@ class gitlabModel extends model
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE'))); return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
} }
/**
* Create a gitab user by api.
*
* @param int $gitlabID
* @param int $projectID
* @param object $branch
* @access public
* @return object
*/
public function apiCreateBranch($gitlabID, $projectID, $branch)
{
if(empty($branch->branch) or empty($branch->ref)) return false;
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/repository/branches");
return json_decode(commonModel::http($url, $branch));
}
/** /**
* Get single project by API. * Get single project by API.
* *
@@ -2032,15 +2050,15 @@ class gitlabModel extends model
if(empty($project->path)) dao::$errors['path'][] = $this->lang->gitlab->project->emptyPathError; if(empty($project->path)) dao::$errors['path'][] = $this->lang->gitlab->project->emptyPathError;
if(dao::isError()) return false; if(dao::isError()) return false;
$reponse = $this->apiCreateProject($gitlabID, $project); $response = $this->apiCreateProject($gitlabID, $project);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabproject', $reponse->id, 'created', '', $reponse->name); $this->loadModel('action')->create('gitlabproject', $response->id, 'created', '', $response->name);
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
} }
/** /**
@@ -2056,15 +2074,15 @@ class gitlabModel extends model
if(empty($project->name)) dao::$errors['name'][] = $this->lang->gitlab->project->emptyNameError; if(empty($project->name)) dao::$errors['name'][] = $this->lang->gitlab->project->emptyNameError;
if(dao::isError()) return false; if(dao::isError()) return false;
$reponse = $this->apiUpdateProject($gitlabID, $project); $response = $this->apiUpdateProject($gitlabID, $project);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabproject', $project->id, 'edited', '', $project->name); $this->loadModel('action')->create('gitlabproject', $project->id, 'edited', '', $project->name);
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
} }
/** /**
@@ -2101,11 +2119,11 @@ class gitlabModel extends model
} }
} }
$reponse = $this->apiCreateUser($gitlabID, $user); $response = $this->apiCreateUser($gitlabID, $user);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabuser', $reponse->id, 'created', '', $reponse->name); $this->loadModel('action')->create('gitlabuser', $response->id, 'created', '', $response->name);
/* Bind user. */ /* Bind user. */
if($user->account) if($user->account)
@@ -2114,13 +2132,13 @@ class gitlabModel extends model
$userBind->providerID = $gitlabID; $userBind->providerID = $gitlabID;
$userBind->providerType = 'gitlab'; $userBind->providerType = 'gitlab';
$userBind->account = $user->account; $userBind->account = $user->account;
$userBind->openID = $reponse->id; $userBind->openID = $response->id;
$this->dao->insert(TABLE_OAUTH)->data($userBind)->exec(); $this->dao->insert(TABLE_OAUTH)->data($userBind)->exec();
} }
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
} }
/** /**
@@ -2161,14 +2179,14 @@ class gitlabModel extends model
} }
} }
$reponse = $this->apiUpdateUser($gitlabID, $user); $response = $this->apiUpdateUser($gitlabID, $user);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabuser', $reponse->id, 'edited', '', $reponse->name); $this->loadModel('action')->create('gitlabuser', $response->id, 'edited', '', $response->name);
/* Delete old bind. */ /* Delete old bind. */
$this->dao->delete()->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlabID)->andWhere('openID')->eq($reponse->id)->andWhere('account')->ne($user->account)->exec(); $this->dao->delete()->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlabID)->andWhere('openID')->eq($response->id)->andWhere('account')->ne($user->account)->exec();
/* Bind user. */ /* Bind user. */
if($user->account && $changeBind) if($user->account && $changeBind)
{ {
@@ -2176,13 +2194,13 @@ class gitlabModel extends model
$userBind->providerID = $gitlabID; $userBind->providerID = $gitlabID;
$userBind->providerType = 'gitlab'; $userBind->providerType = 'gitlab';
$userBind->account = $user->account; $userBind->account = $user->account;
$userBind->openID = $reponse->id; $userBind->openID = $response->id;
$this->dao->replace(TABLE_OAUTH)->data($userBind)->exec(); $this->dao->replace(TABLE_OAUTH)->data($userBind)->exec();
} }
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
} }
/** /**
@@ -2200,15 +2218,15 @@ class gitlabModel extends model
if(empty($group->path)) dao::$errors['path'][] = $this->lang->gitlab->group->path . $this->lang->gitlab->group->emptyError; if(empty($group->path)) dao::$errors['path'][] = $this->lang->gitlab->group->path . $this->lang->gitlab->group->emptyError;
if(dao::isError()) return false; if(dao::isError()) return false;
$reponse = $this->apiCreateGroup($gitlabID, $group); $response = $this->apiCreateGroup($gitlabID, $group);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabgroup', $reponse->id, 'created', '', $reponse->name); $this->loadModel('action')->create('gitlabgroup', $response->id, 'created', '', $response->name);
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
} }
/** /**
@@ -2225,41 +2243,68 @@ class gitlabModel extends model
if(empty($group->name)) dao::$errors['name'][] = $this->lang->gitlab->group->name . $this->lang->gitlab->group->emptyError; if(empty($group->name)) dao::$errors['name'][] = $this->lang->gitlab->group->name . $this->lang->gitlab->group->emptyError;
if(dao::isError()) return false; if(dao::isError()) return false;
$reponse = $this->apiUpdateGroup($gitlabID, $group); $response = $this->apiUpdateGroup($gitlabID, $group);
if(!empty($reponse->id)) if(!empty($response->id))
{ {
$this->loadModel('action')->create('gitlabgroup', $reponse->id, 'edited', '', $reponse->name); $this->loadModel('action')->create('gitlabgroup', $response->id, 'edited', '', $response->name);
return true; return true;
} }
return $this->apiErrorHandling($reponse); return $this->apiErrorHandling($response);
}
/**
* Create a gitlab branch.
*
* @param int $gitlabID
* @param int $projectID
* @access public
* @return bool
*/
public function createBranch($gitlabID, $projectID)
{
$branch = fixer::input('post')->get();
if(empty($branch->branch)) dao::$errors['branch'][] = $this->lang->gitlab->branch->name . $this->lang->gitlab->emptyError;
if(empty($branch->ref)) dao::$errors['ref'][] = $this->lang->gitlab->branch->from . $this->lang->gitlab->emptyError;
if(dao::isError()) return false;
$response = $this->apiCreateBranch($gitlabID, $projectID, $branch);
if(!empty($response->name))
{
$this->loadModel('action')->create('gitlabbranch', 0, 'created', '', $response->name);
return true;
}
return $this->apiErrorHandling($response);
} }
/** /**
* Api error handling. * Api error handling.
* *
* @param object $reponse * @param object $response
* @access public * @access public
* @return bool * @return bool
*/ */
public function apiErrorHandling($reponse) public function apiErrorHandling($response)
{ {
if(!empty($reponse->error)) if(!empty($response->error))
{ {
dao::$errors[] = $reponse->error; dao::$errors[] = $response->error;
return false; return false;
} }
if(!empty($reponse->message)) if(!empty($response->message))
{ {
if(is_string($reponse->message)) if(is_string($response->message))
{ {
$errorKey = array_search($reponse->message, $this->lang->gitlab->apiError); $errorKey = array_search($response->message, $this->lang->gitlab->apiError);
dao::$errors[] = $errorKey === false ? $reponse->message : zget($this->lang->gitlab->errorLang, $errorKey); dao::$errors[] = $errorKey === false ? $response->message : zget($this->lang->gitlab->errorLang, $errorKey);
} }
else else
{ {
foreach($reponse->message as $field => $fieldErrors) foreach($response->message as $field => $fieldErrors)
{ {
foreach($fieldErrors as $error) foreach($fieldErrors as $error)
{ {
@@ -2270,7 +2315,7 @@ class gitlabModel extends model
} }
} }
if(!$reponse) dao::$errors[] = false; if(!$response) dao::$errors[] = false;
return false; return false;
} }
@@ -2287,4 +2332,142 @@ class gitlabModel extends model
->andWhere('path')->in($projectIDs) ->andWhere('path')->in($projectIDs)
->fetchPairs('path', 'product'); ->fetchPairs('path', 'product');
} }
/**
* Get protect branches of one project.
*
* @param int $gitlabID
* @param int $projectID
* @param string $keyword
* @param string $orderBy
* @access public
* @return array
*/
public function apiGetBranchPrivs($gitlabID, $projectID, $keyword = '', $orderBy = 'id_desc')
{
$keyword = urlencode($keyword);
$url = sprintf($this->getApiRoot($gitlabID), "/projects/$projectID/protected_branches");
$branches = json_decode(commonModel::http($url));
if(!is_array($branches)) return $branches;
/* Parse order string. */
$order = explode('_', $orderBy);
$newBranches = array();
foreach($branches as $branch)
{
if(empty($keyword) || stristr($branch->name, $keyword)) $newBranches[$branch->{$order[0]}] = $branch;
}
if($order[1] == 'asc') ksort($newBranches);
if($order[1] == 'desc') krsort($newBranches);
return $newBranches;
}
/**
* Get single protct branch by API.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return object
*/
public function apiGetSingleBranchPriv($gitlabID, $projectID, $branch)
{
if(empty($gitlabID)) return false;
$url = sprintf($this->getApiRoot($gitlabID), "/projects/$projectID/protected_branches/$branch");
return json_decode(commonModel::http($url));
}
/**
* Create gitlab potect branch.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return bool
*/
public function createBranchPriv($gitlabID, $projectID, $branch = '')
{
$priv = fixer::input('post')->get();
if(empty($priv->name)) dao::$errors['name'][] = $this->lang->gitlab->branch->emptyPrivNameError;
$singleBranch = $this->apiGetSingleBranchPriv($gitlabID, $projectID, $priv->name);
if(empty($branch) && !empty($singleBranch->id)) dao::$errors['name'][] = $this->lang->gitlab->branch->issetPrivNameError;
if(dao::isError()) return false;
if(!empty($branch) && !empty($singleBranch->id)) $this->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
$response = $this->apiCreateBranchPriv($gitlabID, $projectID, $priv);
if(!empty($response->id))
{
$action = empty($branch) ? 'created' : 'edited';
$this->loadModel('action')->create('gitlabbranchpriv', $response->id, $action, '', $response->name);
return true;
}
return $this->apiErrorHandling($response);
}
/**
* Create a gitab protect branch by api.
*
* @param int $gitlabID
* @param int $projectID
* @param object $priv
* @access public
* @return object
*/
public function apiCreateBranchPriv($gitlabID, $projectID, $priv)
{
if(empty($gitlabID)) return false;
if(empty($priv->name)) return false;
$url = sprintf($this->getApiRoot($gitlabID), "/projects/" . $projectID . '/protected_branches');
return json_decode(commonModel::http($url, $priv));
}
/**
* Delete a gitab protect branch by api.
*
* @param int $gitlabID
* @param int $projectID
* @param string $branch
* @access public
* @return object
*/
public function apiDeleteBranchPriv($gitlabID, $projectID, $branch)
{
if(empty($gitlabID)) return false;
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/protected_branches/{$branch}");
return json_decode(commonModel::http($url, array(), $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
}
/**
* Check access level.
*
* @param array $accessLevels
* @access public
* @return int
*/
public function checkAccessLevel($accessLevels)
{
$noAccess = 0;
$developerAccess = 30;
$maintainerAccess = 40;
if(is_array($accessLevels))
{
$levels = array();
foreach($accessLevels as $level)
{
if(is_array($level)) $level = (object)$level;
$levels[] = isset($level->access_level) ? (int)$level->access_level : $maintainerAccess;
}
if(in_array($noAccess, $levels)) return $noAccess;
if(in_array($developerAccess, $levels)) return $developerAccess;
}
return $maintainerAccess;
}
} }
+3 -2
View File
@@ -21,7 +21,7 @@
<thead> <thead>
<tr> <tr>
<th colspan='2'><?php echo $lang->gitlab->gitlabAccount;?></th> <th colspan='2'><?php echo $lang->gitlab->gitlabAccount;?></th>
<th><?php echo $lang->gitlab->zentaoAccount;?></th> <th class='w-150px'><?php echo $lang->gitlab->zentaoAccount;?></th>
<th class='w-150px'><?php echo $lang->gitlab->bindingStatus;?></th> <th class='w-150px'><?php echo $lang->gitlab->bindingStatus;?></th>
</tr> </tr>
</thead> </thead>
@@ -51,7 +51,8 @@
<td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen'" );?></td> <td><?php echo html::select("zentaoUsers[$gitlabUser->id]", $userPairs, $gitlabUser->zentaoAccount, "class='form-control select chosen'" );?></td>
<td> <td>
<?php if(isset($bindedUsers[$gitlabUser->zentaoAccount])):?> <?php if(isset($bindedUsers[$gitlabUser->zentaoAccount])):?>
<?php if(!empty(zget($userPairs, $gitlabUser->zentaoAccount, ''))):?> <?php $zentaoAccount = zget($userPairs, $gitlabUser->zentaoAccount, '');?>
<?php if(!empty($zentaoAccount)):?>
<?php echo $lang->gitlab->binded;?> <?php echo $lang->gitlab->binded;?>
<?php else:?> <?php else:?>
<?php echo '<span class="text-red">' . $lang->gitlab->bindedError . '</span>';?> <?php echo '<span class="text-red">' . $lang->gitlab->bindedError . '</span>';?>
+6 -6
View File
@@ -42,16 +42,16 @@
<?php foreach ($gitlabList as $id => $gitlab): ?> <?php foreach ($gitlabList as $id => $gitlab): ?>
<tr class='text' title='<?php if(!$gitlab->isAdminToken) echo $lang->gitlab->tokenLimit;?>'> <tr class='text' title='<?php if(!$gitlab->isAdminToken) echo $lang->gitlab->tokenLimit;?>'>
<td class='text-center'><?php echo $id;?></td> <td class='text-center'><?php echo $id;?></td>
<td class='text-c-name' title='<?php echo $gitlab->name;?>'><a class="iframe" data-width="90%" href="<?php echo $this->createLink('gitlab', 'view', "id=$id", '', true); ?>"><?php echo $gitlab->name;?></a></td> <td class='text-c-name' title='<?php echo $gitlab->name;?>'><a class="iframe" href="<?php echo $this->createLink('gitlab', 'view', "id=$id", '', true); ?>"><?php echo $gitlab->name;?></a></td>
<td class='text' title='<?php echo $gitlab->url;?>'><?php echo $gitlab->url;?></td> <td class='text' title='<?php echo $gitlab->url;?>'><?php echo $gitlab->url;?></td>
<td class='c-actions text-left'> <td class='c-actions text-left'>
<?php <?php
$disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled'; $disabled = !empty($gitlab->isAdminToken) ? '' : 'disabled';
common::printLink('gitlab', 'browseProject', "gitlabID=$id", "<i class='icon icon-list-box'></i> ", '',"title={$lang->gitlab->browseProject} class='btn btn-primary'"); common::printLink('gitlab', 'browseProject', "gitlabID=$id", "<i class='icon icon-list-box'></i> ", '',"title='{$lang->gitlab->browseProject}' class='btn btn-primary'");
common::printLink('gitlab', 'browseGroup', "gitlabID=$id", "<i class='icon icon-groups'></i> ", '', "title={$lang->gitlab->browseGroup} class='btn btn-primary'"); common::printLink('gitlab', 'browseGroup', "gitlabID=$id", "<i class='icon icon-groups'></i> ", '', "title='{$lang->gitlab->browseGroup}' class='btn btn-primary'");
common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title={$lang->gitlab->edit} class='btn btn-primary'"); common::printLink('gitlab', 'edit', "gitlabID=$id", "<i class='icon icon-edit'></i> ", '',"title='{$lang->gitlab->edit}' class='btn btn-primary'");
common::printLink('gitlab', 'browseUser', "gitlabID=$id", "<i class='icon icon-persons'></i> ", '', "title={$lang->gitlab->browseUser} class='btn {$disabled}' ,'disabled'"); common::printLink('gitlab', 'browseUser', "gitlabID=$id", "<i class='icon icon-person'></i> ", '', "title='{$lang->gitlab->browseUser}' class='btn {$disabled}' ,'disabled'");
common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-link'></i> ", '', "title={$lang->gitlab->bindUser} class='btn {$disabled}' ,'disabled'"); common::printLink('gitlab', 'bindUser', "id=$id", "<i class='icon icon-link'></i> ", '', "title='{$lang->gitlab->bindUser}' class='btn {$disabled}' ,'disabled'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn'"); if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'delete', "gitlabID=$id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->delete}' class='btn'");
?> ?>
</td> </td>
+61
View File
@@ -0,0 +1,61 @@
<?php
/**
* The browse view file of gitlab module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Gang Zeng <zenggang@easycorp.ltd>
* @package gitlab
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('vars', "keyword=%s&orderBy=id_desc&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID=1")?>
<?php js::set('gitlabID', $gitlabID)?>
<div id="mainMenu" class="clearfix">
<div class='pull-left'>
<?php echo html::linkButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, $this->createLink('gitlab', 'browseProject', "gitlabID=$gitlabID"), 'self', '','btn btn-secondary');?>
</div>
<div class="btn-toolbar pull-right">
<?php if(common::hasPriv('gitlab', 'createBranch')) common::printLink('gitlab', 'createBranch', "gitlabID=$gitlabID&projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->gitlab->createBranch, '', "class='btn btn-primary'");?>
</div>
</div>
<?php if(empty($gitlabBranchList)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->noData;?></span>
<?php if(empty($keyword) and common::hasPriv('gitlab', 'createBranch')):?>
<?php echo html::a($this->createLink('gitlab', 'createBranch', "gitlabID=$gitlabID&projectID=$projectID"), "<i class='icon icon-plus'></i> " . $lang->gitlab->createBranch, '', "class='btn btn-info'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<div id='mainContent' class='main-row'>
<form class='main-table' id='ajaxForm' method='post'>
<table id='gitlabBranchList' class='table has-sort-head table-fixed'>
<?php $vars = "gitlabID={$gitlabID}&projectID={$projectID}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='c-name text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitlab->branch->name);?></th>
<th class='text-left'><?php echo $lang->gitlab->branch->lastCommitter;?></th>
<th class='text-left'><?php common::printOrderLink('lastCommittedDate', $orderBy, $vars, $lang->gitlab->branch->lastCommittedDate);?></th>
</tr>
</thead>
<tbody>
<?php foreach ($gitlabBranchList as $id => $gitlabBranch): ?>
<tr class='text'>
<td class='text-c-name' title='<?php echo $gitlabBranch->name;?>'><?php echo $gitlabBranch->name;?></td>
<td class='text'><?php echo $gitlabBranch->lastCommitter;?></td>
<td class='text'><?php echo $gitlabBranch->lastCommittedDate?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if($gitlabBranchList):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</form>
</div>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
@@ -0,0 +1,79 @@
<?php
/**
* The browse view file of gitlab protext branch of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
* @package gitlab
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id="mainMenu" class="clearfix">
<div class='pull-left'>
<?php echo html::a($this->createLink('gitlab', 'browseProject', "gitlabID=$gitlabID"), "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-secondary'");?>
</div>
<div id="sidebarHeader">
<div class="title" title="<?php echo $project->name_with_namespace; ?>"><?php echo $project->name_with_namespace; ?></div>
</div>
<div class="btn-toolbar pull-left">
<div>
<form id='branchPrivForm' method='post'>
<?php echo html::input('keyword', $keyword, "class='form-control' placeholder='{$lang->gitlab->branch->placeholderSearch}' style='display: inline-block;width:auto;margin:0 10px'");?>
<a id="branchSearch" class="btn btn-primary"><?php echo $lang->gitlab->search?></a>
</form>
</div>
</div>
<div class="btn-toolbar pull-right">
<?php if(common::hasPriv('gitlab', 'createBranchPriv')) common::printLink('gitlab', 'createBranchPriv', "gitlabID=$gitlabID&projectID=$projectID", "<i class='icon icon-plus'></i> " . $lang->gitlab->createBranchPriv, '', "class='btn btn-primary'");?>
</div>
</div>
<?php if(empty($branchList)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->noData;?></span>
<?php if(empty($keyword) and common::hasPriv('gitlab', 'createBranchPriv')):?>
<?php echo html::a($this->createLink('gitlab', 'createBranchPriv', "gitlabID=$gitlabID&projectID=$projectID"), "<i class='icon icon-plus'></i> " . $lang->gitlab->createBranchPriv, '', "class='btn btn-info'");?>
<?php endif;?>
</p>
</div>
<?php else:?>
<div id='mainContent' class='main-row'>
<form class='main-table' id='ajaxForm' method='post'>
<table id='branchList' class='table has-sort-head table-fixed'>
<?php $vars = "gitlabID={$gitlabID}&projectID={$projectID}&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='c-name text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->gitlab->branch->name);?></th>
<th class='text-left'><?php echo $lang->gitlab->branch->mergeAllowed;?></th>
<th class='text-left'><?php echo $lang->gitlab->branch->pushAllowed;?></th>
<th class='c-actions-4'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach ($branchList as $id => $branch): ?>
<?php $branch->merge_access_level = $this->gitlab->checkAccessLevel($branch->merge_access_levels); ?>
<?php $branch->push_access_level = $this->gitlab->checkAccessLevel($branch->push_access_levels); ?>
<tr class='text'>
<td class='text-c-name' title='<?php echo $branch->name;?>'><?php echo $branch->name;?></td>
<td class-'text' title="<?php echo $levelLang[$branch->merge_access_level];?>"><?php echo $levelLang[$branch->merge_access_level];?></td>
<td class='text' title="<?php echo $levelLang[$branch->push_access_level];?>"><?php echo $levelLang[$branch->push_access_level];?></td>
<td class='c-actions text-left'>
<?php
if(common::hasPriv('gitlab', 'editBranchPriv')) common::printLink('gitlab', 'editBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch->name", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->editBranchPriv} class='btn btn-primary'");
if(common::hasPriv('gitlab', 'deleteBranchPriv')) echo html::a($this->createLink('gitlab', 'deleteBranchPriv', "gitlabID=$gitlabID&projectID=$projectID&branch=$branch->name"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteBranchPriv}' class='btn'");
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php if($branchList):?>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<?php endif;?>
</form>
</div>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -54,8 +54,8 @@
<td class='text' title='<?php echo substr($gitlabGroup->created_at, 0, 10);?>'><?php echo substr($gitlabGroup->created_at, 0, 10);?></td> <td class='text' title='<?php echo substr($gitlabGroup->created_at, 0, 10);?>'><?php echo substr($gitlabGroup->created_at, 0, 10);?></td>
<td class='c-actions text-left'> <td class='c-actions text-left'>
<?php <?php
common::printLink('gitlab', 'manageGroupMembers', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-team'></i> ", '',"title={$lang->gitlab->group->manageMembers} class='btn btn-primary'"); common::printLink('gitlab', 'manageGroupMembers', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-team'></i> ", '',"title='{$lang->gitlab->group->manageMembers}' class='btn btn-primary'");
common::printLink('gitlab', 'editGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->group->edit} class='btn btn-primary'"); common::printLink('gitlab', 'editGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id", "<i class='icon icon-edit'></i> ", '', "title='{$lang->gitlab->group->edit}' class='btn btn-primary'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteGroup}' class='btn'"); if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteGroup', "gitlabID=$gitlabID&groupID=$gitlabGroup->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteGroup}' class='btn'");
?> ?>
</td> </td>
+6 -3
View File
@@ -15,7 +15,7 @@
<?php js::set('gitlabID', $gitlabID)?> <?php js::set('gitlabID', $gitlabID)?>
<div id="mainMenu" class="clearfix"> <div id="mainMenu" class="clearfix">
<div class='pull-left'> <div class='pull-left'>
<?php echo html::backButton('<i class="icon icon-back icon-sm"></i> ' . $lang->goback, '', 'btn btn-secondary');?> <?php echo html::a($this->createLink('gitlab', 'browse'), "<i class='icon icon-back icon-sm'></i> " . $lang->goback, '', "class='btn btn-secondary'");?>
</div> </div>
<div id="sidebarHeader"> <div id="sidebarHeader">
<div class="title"><?php echo $this->lang->gitlab->common . ':' . $gitlab->name; ?></div> <div class="title"><?php echo $this->lang->gitlab->common . ':' . $gitlab->name; ?></div>
@@ -62,12 +62,15 @@
<td class='text-c-name' title='<?php echo $gitlabProject->name;?>'><?php echo $gitlabProject->name_with_namespace;?></td> <td class='text-c-name' title='<?php echo $gitlabProject->name;?>'><?php echo $gitlabProject->name_with_namespace;?></td>
<td class='text text-c-counts'> <td class='text text-c-counts'>
<span title="<?php echo $lang->gitlab->project->star;?>"><i class="icon icon-star"></i> <?php echo $gitlabProject->star_count;?></span> <span title="<?php echo $lang->gitlab->project->star;?>"><i class="icon icon-star"></i> <?php echo $gitlabProject->star_count;?></span>
<span title="<?php echo $lang->gitlab->project->fork;?>"><i class="icon icon-treemap"></i> <?php echo $gitlabProject->forks_count;?></span> <span title="<?php echo $lang->gitlab->project->fork;?>"><i class="icon icon-code-fork"></i> <?php echo $gitlabProject->forks_count;?></span>
</td> </td>
<td class='text' title='<?php echo substr($gitlabProject->last_activity_at, 0, 10);?>'><?php echo substr($gitlabProject->last_activity_at, 0, 10);?></td> <td class='text' title='<?php echo substr($gitlabProject->last_activity_at, 0, 10);?>'><?php echo substr($gitlabProject->last_activity_at, 0, 10);?></td>
<td class='c-actions text-left'> <td class='c-actions text-left'>
<?php <?php
common::printLink('gitlab', 'editProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->project->edit} class='btn btn-primary'");
common::printLink('gitlab', 'browseBranch', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-treemap'></i> ", '', "title='{$lang->gitlab->browseBranch}' class='btn btn-primary'");
common::printLink('gitlab', 'browseBranchPriv', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-branch-lock'></i> ", '', "title='{$lang->gitlab->branch->accessLevel}' class='btn btn-primary'");
common::printLink('gitlab', 'editProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id", "<i class='icon icon-edit'></i> ", '', "title='{$lang->gitlab->project->edit}' class='btn btn-primary'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteProject}' class='btn'"); if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteProject', "gitlabID=$gitlabID&projectID=$gitlabProject->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteProject}' class='btn'");
?> ?>
</td> </td>
+1 -1
View File
@@ -54,7 +54,7 @@
<td class='text' title='<?php echo substr($gitlabUser->lastActivityOn, 0, 10);?>'><?php echo substr($gitlabUser->lastActivityOn, 0, 10);?></td> <td class='text' title='<?php echo substr($gitlabUser->lastActivityOn, 0, 10);?>'><?php echo substr($gitlabUser->lastActivityOn, 0, 10);?></td>
<td class='c-actions text-left'> <td class='c-actions text-left'>
<?php <?php
common::printLink('gitlab', 'editUser', "gitlabID=$gitlabID&userID=$gitlabUser->id", "<i class='icon icon-edit'></i> ", '', "title={$lang->gitlab->user->edit} class='btn btn-primary'"); common::printLink('gitlab', 'editUser', "gitlabID=$gitlabID&userID=$gitlabUser->id", "<i class='icon icon-edit'></i> ", '', "title='{$lang->gitlab->user->edit}' class='btn btn-primary'");
if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteUser', "gitlabID=$gitlabID&userID=$gitlabUser->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteUser}' class='btn'"); if(common::hasPriv('gitlab', 'delete')) echo html::a($this->createLink('gitlab', 'deleteUser', "gitlabID=$gitlabID&userID=$gitlabUser->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->gitlab->deleteUser}' class='btn'");
?> ?>
</td> </td>
+44
View File
@@ -0,0 +1,44 @@
<?php
/**
* The create branch view file of gitlab module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yuchun Li <liyuchun@zcorp.ltd>
* @package gitlab
* @version $Id$
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->gitlab->createBranch;?></h2>
</div>
<form id='gitlabForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->branch->name;?></th>
<td><?php echo html::input('branch', '', "class='form-control' placeholder='{$lang->gitlab->branch->name}'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->branch->from;?></th>
<td><?php echo html::select('ref', $branchPairs, '', "class='form-control chosen'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton($lang->gitlab->branch->create);?>
<?php $backLink = $this->session->gitlabBranchList ? $this->session->gitlabBranchList : inlink('browseBranch', "gitlibID=$gitlabID&projectID=$projectID");?>
<?php if(!isonlybody()) echo html::a($backLink, $lang->goback, '', 'class="btn btn-wide"');?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
@@ -0,0 +1,47 @@
<?php
/**
* The create view file of protext branch of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yanyi Cao <caoyanyi@easycorp.ltd>
* @package gitlab
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $pageTitle;?></h2>
</div>
<form id='branchForm' method='post' class='form-ajax' enctype="multipart/form-data">
<?php if($branch) echo html::hidden('name', $branch);?>
<table class='table table-form'>
<tr>
<th><?php echo $lang->gitlab->branch->name;?></th>
<td><?php echo html::select('name', $branches, $branchPriv->name, "class='form-control chosen' data-placeholder='{$lang->gitlab->branch->placeholderSelect}' " . ($branch ? 'disabled' : ''));?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->branch->mergeAllowed;?></th>
<td><?php echo html::select('merge_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->mergeAccessLevel, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->gitlab->branch->pushAllowed;?></th>
<td><?php echo html::select('push_access_level', $lang->gitlab->branch->branchCreationLevelList, $branchPriv->pushAccessLevel, "class='form-control'");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton();?>
<?php if(!isonlybody()) echo html::a(inlink('browseBranchPriv', "gitlabID=$gitlabID&projectID=$projectID"), $lang->goback, '', 'class="btn btn-wide"');?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -43,7 +43,7 @@
<td colspan='2'><?php echo nl2br(html::radio('visibility', $lang->gitlab->group->visibilityList, 'private', "", 'block'));?></td> <td colspan='2'><?php echo nl2br(html::radio('visibility', $lang->gitlab->group->visibilityList, 'private', "", 'block'));?></td>
</tr> </tr>
<tr> <tr>
<th></th> <th><?php echo $lang->gitlab->group->permission;?></th>
<td> <td>
<div class="checkbox-primary"> <div class="checkbox-primary">
<input type="checkbox" name='request_access_enabled' id="requestAccessEnabled" value='1' checked /><label for="external" class="no-margin"><?php echo $lang->gitlab->group->requestAccessEnabledTip; ?></label> <input type="checkbox" name='request_access_enabled' id="requestAccessEnabled" value='1' checked /><label for="external" class="no-margin"><?php echo $lang->gitlab->group->requestAccessEnabledTip; ?></label>
@@ -56,7 +56,7 @@
<div class="checkbox-primary"> <div class="checkbox-primary">
<input type="checkbox" name='lfs_enabled' id="lfsEnabled" value='1' checked /><label for="external" class="no-margin"><?php echo $lang->gitlab->group->lfsEnabledTip; ?></label> <input type="checkbox" name='lfs_enabled' id="lfsEnabled" value='1' checked /><label for="external" class="no-margin"><?php echo $lang->gitlab->group->lfsEnabledTip; ?></label>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<th><?php echo $lang->gitlab->group->projectCreationLevel;?></th> <th><?php echo $lang->gitlab->group->projectCreationLevel;?></th>
+2 -2
View File
@@ -20,9 +20,9 @@
<form id='gitlabForm' method='post' class='form-ajax'> <form id='gitlabForm' method='post' class='form-ajax'>
<table class='table table-form'> <table class='table table-form'>
<tr> <tr>
<th><?php echo $lang->gitlab->project->name;?></th> <th class='w-150px'><?php echo $lang->gitlab->project->name;?></th>
<td class='required'><?php echo html::input('name', '', "class='form-control' placeholder='{$lang->gitlab->project->name}'");?></td> <td class='required'><?php echo html::input('name', '', "class='form-control' placeholder='{$lang->gitlab->project->name}'");?></td>
<td class="tips-git"></td> <td class="tips-git w-p20"></td>
</tr> </tr>
<tr> <tr>
<th><?php echo $lang->gitlab->project->url;?></th> <th><?php echo $lang->gitlab->project->url;?></th>
+2 -1
View File
@@ -20,8 +20,9 @@
<form id='gitlabForm' method='post' class='form-ajax'> <form id='gitlabForm' method='post' class='form-ajax'>
<table class='table table-form'> <table class='table table-form'>
<tr> <tr>
<th><?php echo $lang->gitlab->project->id;?></th> <th class='w-150px'><?php echo $lang->gitlab->project->id;?></th>
<td><?php echo html::input('id', $project->id, "class='form-control' readonly placeholder='{$lang->gitlab->project->id}'");?></td> <td><?php echo html::input('id', $project->id, "class='form-control' readonly placeholder='{$lang->gitlab->project->id}'");?></td>
<td class="tips-git w-p20"></td>
</tr> </tr>
<tr> <tr>
<th><?php echo $lang->gitlab->project->name;?></th> <th><?php echo $lang->gitlab->project->name;?></th>
@@ -12,25 +12,31 @@
<table class='table-form'> <table class='table-form'>
<thead> <thead>
<tr class='text-center'> <tr class='text-center'>
<th><?php echo $lang->gitlab->group->memberName;?></th> <th class='c-names'><?php echo $lang->gitlab->group->memberName;?></th>
<th><?php echo $lang->gitlab->group->memberAccessLevel;?></th> <th class='c-levels'><?php echo $lang->gitlab->group->memberAccessLevel;?></th>
<th class='c-date'><?php echo $lang->gitlab->group->memberExpiresAt;?></th> <th class='c-date'><?php echo $lang->gitlab->group->memberExpiresAt;?></th>
<th class="c-actions"><?php echo $lang->actions;?></th> <th class="c-actions"><?php echo $lang->actions;?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $ownerLevel = 50;?>
<?php $i = 0;?> <?php $i = 0;?>
<?php foreach($currentMembers as $member):?> <?php foreach($currentMembers as $member):?>
<tr> <tr>
<td><?php echo html::input("names[$i]", $member->name, "class='form-control' readonly");?></td> <td><?php echo html::input("names[$i]", $member->name, "class='form-control' readonly");?></td>
<td><?php echo html::select("levels[$i]", array(''=>'') + $this->lang->gitlab->accessLevels, $member->access_level, "class='form-control chosen'");?></td> <td><?php echo html::select("levels[$i]", array(''=>'') + $this->lang->gitlab->accessLevels, $member->access_level, "class='form-control chosen'");?></td>
<td> <td>
<?php if($member->access_level == $ownerLevel):?>
<input type="text" value="" class="form-control disabled" disabled autocomplete="off" />
<?php echo html::input("expires[$i]", $member->expires_at, "class='form-control form-date hidden'");?>
<?php else:?>
<?php echo html::input("expires[$i]", $member->expires_at, "class='form-control form-date'");?> <?php echo html::input("expires[$i]", $member->expires_at, "class='form-control form-date'");?>
<?php endif;?>
<?php echo html::hidden("ids[$i]", $member->id);?> <?php echo html::hidden("ids[$i]", $member->id);?>
</td> </td>
<td class='c-actions text-center'> <td class='c-actions text-center'>
<?php echo html::a('javascript:;', "<i class='icon-plus'></i>", '', "onclick='addItem(this)' class='btn btn-link'");?> <?php echo html::a('javascript:;', "<i class='icon-plus'></i>", '', "onclick='addItem(this)' class='btn btn-link'");?>
<?php echo html::a('javascript:;', "<i class='icon icon-close'></i>", '', "onclick='deleteItem(this)' class='btn btn-link'");?> <?php echo html::a('javascript:;', "<i class='icon icon-close'></i>", '', "onclick='deleteItem(this)' class='btn btn-link" . ($member->access_level == $ownerLevel ? ' disabled' : '') . "'");?>
</td> </td>
</tr> </tr>
<?php $i ++;?> <?php $i ++;?>
@@ -11,8 +11,8 @@
<table class='table-form'> <table class='table-form'>
<thead> <thead>
<tr class='text-center'> <tr class='text-center'>
<th><?php echo $lang->gitlab->group->memberName;?></th> <th class='c-names'><?php echo $lang->gitlab->group->memberName;?></th>
<th><?php echo $lang->gitlab->group->memberAccessLevel;?></th> <th class='c-levels'><?php echo $lang->gitlab->group->memberAccessLevel;?></th>
<th class='c-date'><?php echo $lang->gitlab->group->memberExpiresAt;?></th> <th class='c-date'><?php echo $lang->gitlab->group->memberExpiresAt;?></th>
<th class="c-actions"><?php echo $lang->actions;?></th> <th class="c-actions"><?php echo $lang->actions;?></th>
<th></th> <th></th>
+8 -2
View File
@@ -12,6 +12,7 @@
?> ?>
<?php include '../../common/view/header.html.php';?> <?php include '../../common/view/header.html.php';?>
<?php js::set('sysurl', common::getSysUrl());?> <?php js::set('sysurl', common::getSysUrl());?>
<style>.action-cell {margin-bottom: 10px;}</style>
<div id="mainMenu" class="clearfix"> <div id="mainMenu" class="clearfix">
<div class="btn-toolbar pull-left"> <div class="btn-toolbar pull-left">
<div class="page-title"> <div class="page-title">
@@ -22,8 +23,13 @@
</div> </div>
<div id="mainContent" class="main-row"> <div id="mainContent" class="main-row">
<div class="main-col col-8"> <div class="main-col col-8">
<div class='cell'><?php include '../../common/view/action.html.php';?></div> <div class="cell">
<div class="detail">
<div class="detail-title"><?php echo $lang->gitlab->url;?></div>
<div class="detail-content article-content"><?php echo $gitlab->url;?></div>
</div>
</div>
<div class='cell action-cell'><?php include '../../common/view/action.html.php';?></div>
</div> </div>
</div> </div>
<?php include '../../common/view/footer.html.php';?> <?php include '../../common/view/footer.html.php';?>
+13 -5
View File
@@ -1245,9 +1245,15 @@ $lang->resource->gitlab->browseUser = 'browseUser';
$lang->resource->gitlab->createUser = 'createUser'; $lang->resource->gitlab->createUser = 'createUser';
$lang->resource->gitlab->editUser = 'editUser'; $lang->resource->gitlab->editUser = 'editUser';
$lang->resource->gitlab->deleteUser = 'deleteUser'; $lang->resource->gitlab->deleteUser = 'deleteUser';
$lang->resource->gitlab->createBranch = 'createBranch';
$lang->resource->gitlab->browseBranch = 'browseBranch';
$lang->resource->gitlab->webhook = 'webhook'; $lang->resource->gitlab->webhook = 'webhook';
$lang->resource->gitlab->createWebhook = 'createWebhook'; $lang->resource->gitlab->createWebhook = 'createWebhook';
$lang->resource->gitlab->manageProjectMembers = 'manageProjectMembers'; $lang->resource->gitlab->manageProjectMembers = 'manageProjectMembers';
$lang->resource->gitlab->browseBranchPriv = 'browseBranchPriv';
$lang->resource->gitlab->createBranchPriv = 'createBranchPriv';
$lang->resource->gitlab->editBranchPriv = 'editBranchPriv';
$lang->resource->gitlab->deleteBranchPriv = 'deleteBranchPriv';
$lang->gitlab->methodOrder[5] = 'browse'; $lang->gitlab->methodOrder[5] = 'browse';
$lang->gitlab->methodOrder[10] = 'create'; $lang->gitlab->methodOrder[10] = 'create';
@@ -1269,9 +1275,11 @@ $lang->gitlab->methodOrder[90] = 'browseUser';
$lang->gitlab->methodOrder[95] = 'createUser'; $lang->gitlab->methodOrder[95] = 'createUser';
$lang->gitlab->methodOrder[100] = 'editUser'; $lang->gitlab->methodOrder[100] = 'editUser';
$lang->gitlab->methodOrder[105] = 'deleteUser'; $lang->gitlab->methodOrder[105] = 'deleteUser';
$lang->gitlab->methodOrder[110] = 'webhook'; $lang->gitlab->methodOrder[110] = 'createBranch';
$lang->gitlab->methodOrder[115] = 'createWebhook'; $lang->gitlab->methodOrder[115] = 'browseBranch';
$lang->gitlab->methodOrder[120] = 'manageProjectMembers'; $lang->gitlab->methodOrder[120] = 'webhook';
$lang->gitlab->methodOrder[125] = 'createWebhook';
$lang->gitlab->methodOrder[130] = 'manageProjectMembers';
/* merge request. */ /* merge request. */
$lang->resource->mr = new stdclass(); $lang->resource->mr = new stdclass();
@@ -1290,7 +1298,7 @@ $lang->resource->mr->unlink = 'unlink';
$lang->resource->mr->approval = 'approval'; $lang->resource->mr->approval = 'approval';
$lang->resource->mr->close = 'close'; $lang->resource->mr->close = 'close';
$lang->resource->mr->reopen = 'reopen'; $lang->resource->mr->reopen = 'reopen';
$lang->resource->mr->addBug = 'addBug'; $lang->resource->mr->addReview = 'addReview';
$lang->mr->methodOrder[10] = 'create'; $lang->mr->methodOrder[10] = 'create';
$lang->mr->methodOrder[15] = 'browse'; $lang->mr->methodOrder[15] = 'browse';
@@ -1307,7 +1315,7 @@ $lang->mr->methodOrder[75] = 'unlink';
$lang->mr->methodOrder[80] = 'approval'; $lang->mr->methodOrder[80] = 'approval';
$lang->mr->methodOrder[85] = 'close'; $lang->mr->methodOrder[85] = 'close';
$lang->mr->methodOrder[90] = 'reopen'; $lang->mr->methodOrder[90] = 'reopen';
$lang->mr->methodOrder[95] = 'addBug'; $lang->mr->methodOrder[95] = 'addReview';
/* Git. */ /* Git. */
$lang->resource->git = new stdclass(); $lang->resource->git = new stdclass();
+14 -27
View File
@@ -300,7 +300,7 @@ class mr extends control
* @access public * @access public
* @return void * @return void
*/ */
public function diff($MRID, $encoding= '') public function diff($MRID, $encoding = '')
{ {
$this->app->loadLang('productplan'); $this->app->loadLang('productplan');
$this->app->loadLang('bug'); $this->app->loadLang('bug');
@@ -316,7 +316,7 @@ class mr extends control
$this->view->rawMR = $rawMR; $this->view->rawMR = $rawMR;
if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display(); if(!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR)) return $this->display();
$diffs = $this->mr->getDiffs($MR, $encoding = ''); $diffs = $this->mr->getDiffs($MR, $encoding);
$arrange = $this->cookie->arrange ? $this->cookie->arrange : 'inline'; $arrange = $this->cookie->arrange ? $this->cookie->arrange : 'inline';
if($this->server->request_method == 'POST') if($this->server->request_method == 'POST')
@@ -455,7 +455,6 @@ class mr extends control
$this->view->modulePairs = $this->loadModel('tree')->getOptionMenu($product->id, 'story'); $this->view->modulePairs = $this->loadModel('tree')->getOptionMenu($product->id, 'story');
$this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->stories = $stories; $this->view->stories = $stories;
$this->view->summary = $this->loadModel('product')->summary($stories);
$this->view->bugs = $bugs; $this->view->bugs = $bugs;
$this->view->tasks = $tasks; $this->view->tasks = $tasks;
$this->view->product = $product; $this->view->product = $product;
@@ -782,49 +781,37 @@ class mr extends control
} }
/** /**
* Add a Bug for this review. * Add a review for this review.
* *
* @param int $repoID * @param int $repoID
* @param string $file * @param int $mr
* @param int $v1 * @param int $v1
* @param int $v2 * @param int $v2
* @access public * @access public
* @return void * @return void
*/ */
public function addBug($repoID, $file, $v1, $v2) public function addReview($repoID, $mr, $v1, $v2)
{ {
/* Handle the exception that when $repoID is empty. */ /* Handle the exception that when $repoID is empty. */
if($repoID == "0") $this->send(array()); if($repoID == "0") $this->send(array());
$this->loadModel('repo'); $this->loadModel('repo');
if($this->get->repoPath) $file = $this->get->repoPath;
if(!empty($_POST)) if(!empty($_POST))
{ {
$result = $this->mr->saveBug($repoID, $file, $v1, $v2); if($this->post->reviewType == 'bug') $result = $this->mr->saveBug($repoID, $mr, $v1, $v2);
if(dao::isError()) die(json_encode($result)); if($this->post->reviewType == 'task') $result = $this->mr->saveTask($repoID, $mr, $v1, $v2);
if($result['result'] == 'fail') die(json_encode($result));
$bugID = $result['id']; $objectID = $result['id'];
$repo = $this->repo->getRepoById($repoID); $repo = $this->repo->getRepoById($repoID);
/* Handle the exception that when $repo is empty. */ /* Handle the exception that when $repo is empty. */
if(empty($repo)) $this->send(array()); if(empty($repo) or empty($result)) $this->send(json_encode(array()));
$entry = isset($repo->name) ? $repo->name . '/' . $this->repo->decodePath($file) : ''; $location = sprintf($this->lang->repo->reviewLocation, $this->post->entry ? base64_decode($this->post->entry) : '', $repo->SCM != 'Subversion' ? substr($v2, 0, 10) : $v2, $this->post->begin, $this->post->end);
$location = sprintf($this->lang->repo->reviewLocation, $entry, $repo->SCM != 'Subversion' ? substr($v2, 0, 10) : $v2, $this->post->begin, $this->post->end); $link = $this->createLink('mr', 'diff', "mr=$mr") . '#L' . $this->post->begin;
if(empty($v1))
{
$revision = $repo->SCM != 'Subversion' ? substr($v2, 0, 10) : $v2;
$link = $this->repo->createLink('view', "repoID=$repoID&objectID=0&entry={$file}&revision=$v2&showBug=true") . '#L' . $this->post->begin;
}
else
{
$revision = $repo->SCM != 'Subversion' ? substr($v1, 0, 10) : $v1;
$revision .= ' : ';
$revision .= $repo->SCM != 'Subversion' ? substr($v2, 0, 10) : $v2;
$link = $this->repo->createLink('diff', "repoID=$repoID&objectID=0&entry={$file}&oldRevision=$v1&newRevision=$v2&showBug=true") . '#L' . $this->post->begin;
}
$actionID = $this->loadModel('action')->create('bug', $bugID, 'repoCreated', '', html::a($link, $location)); $actionID = $this->loadModel('action')->create($this->post->reviewType, $objectID, 'repoCreated', '', html::a($link, $location));
$this->loadModel('mail')->sendmail($bugID, $actionID); $this->loadModel('mail')->sendmail($objectID, $actionID);
echo json_encode($result); echo json_encode($result);
} }
+20 -20
View File
@@ -88,8 +88,8 @@ h3 {font-size: 16px;}
/* repo action form */ /* repo action form */
.repoCode .comment-list, .repoCode .comment-actions {max-width: 900px;} .repoCode .comment-list, .repoCode .comment-actions {max-width: 900px;}
.repoCode .bugFormContainer {border: 1px solid #bbb; margin: 0 0 0 15px; padding: 10px 20px 10px 10px; max-width: 880px; background: #fff;} .repoCode .reviewFormContainer {border: 1px solid #bbb; margin: 0 0 0 15px; padding: 10px 20px 10px 10px; max-width: 880px; background: #fff;}
.repoCode .bugFormContainer th {width: 70px;} .repoCode .reviewFormContainer th {width: 70px;}
.repoCode .action-row {display: none;} .repoCode .action-row {display: none;}
.repoCode .with-action-row .action-row {display: table-row;} .repoCode .with-action-row .action-row {display: table-row;}
@@ -106,26 +106,26 @@ h3 {font-size: 16px;}
.repoCode .comment-cell .panel-body {padding: 6px 10px;} .repoCode .comment-cell .panel-body {padding: 6px 10px;}
.repoCode .comment-cell .panel-actions.pull-right {margin-right: 0; margin-top: 0;} .repoCode .comment-cell .panel-actions.pull-right {margin-right: 0; margin-top: 0;}
.repoCode .comment-cell .editing .panel-body, .repoCode .comment-cell .commentContainer.show-form .panel-body {display: none;} .repoCode .comment-cell .editing .panel-body, .repoCode .comment-cell .commentContainer.show-form .panel-body {display: none;}
.repoCode .comment-cell .bug-edit-form, {padding: 10px; display: none;} .repoCode .comment-cell .review-edit-form, {padding: 10px; display: none;}
.repoCode .comment-cell .editing .bug-edit-form, .repoCode .comment-cell .commentContainer.show-form .comment-edit-form {display: block;} .repoCode .comment-cell .editing .review-edit-form, .repoCode .comment-cell .commentContainer.show-form .comment-edit-form {display: block;}
.repoCode .comment {border: 1px solid #e5e5e5; background: #fafafa; padding: 5px 10px; margin-bottom: 10px;} .repoCode .comment {border: 1px solid #e5e5e5; background: #fafafa; padding: 5px 10px; margin-bottom: 10px;}
.repoCode .comment .comment-edit-form {margin-top: 10px;} .repoCode .comment .comment-edit-form {margin-top: 10px;}
.repoCode .panel-bug .steps {background: #f1f1f1; padding: 5px 10px;} .repoCode .panel-review .steps {background: #f1f1f1; padding: 5px 10px;}
.repoCode .panel-bug .bug-edit-form {margin-bottom: 10px;} .repoCode .panel-review .review-edit-form {margin-bottom: 10px;}
.repoCode .panel-bug .panel-body {display: none;} .repoCode .panel-review .panel-body {display: none;}
.repoCode .panel-bug .panel-heading {cursor: pointer;} .repoCode .panel-review .panel-heading {cursor: pointer;}
.repoCode .panel-bug.show .panel-body {display: block;} .repoCode .panel-review.show .panel-body {display: block;}
.repoCode .panel-bug.show .icon-chevron-sign-down:before {content: '\e711';} .repoCode .panel-review.show .icon-chevron-sign-down:before {content: '\e711';}
.repoCode .panel-bug.show-edit-form .bug-edit-form, .repoCode .panel-review.show-edit-form .review-edit-form,
.repoCode .panel-bug.show-form .commentForm, .repoCode .panel-review.show-form .commentForm,
.repoCode .comment.show-form .comment-edit-form {display: block;} .repoCode .comment.show-form .comment-edit-form {display: block;}
.repoCode .panel-bug .bug-edit-form, .repoCode .panel-review .review-edit-form,
.repoCode .panel-bug.show-form .addComment, .repoCode .panel-review.show-form .addComment,
.repoCode .panel-bug .commentForm, .repoCode .panel-review .commentForm,
.repoCode .comment .comment-edit-form, .repoCode .comment .comment-edit-form,
.repoCode .panel-bug.show-edit-form .panel-body .title, .repoCode .panel-review.show-edit-form .panel-body .title,
.repoCode .panel-bug.show-edit-form .bug-date, .repoCode .panel-review.show-edit-form .bug-date,
.repoCode .comment.show-form .comment-content, .repoCode .comment.show-form .comment-date {display: none;} .repoCode .comment.show-form .comment-content, .repoCode .comment.show-form .comment-date {display: none;}
.repoCode .text-content {white-space: normal; white-space: pre-line;} .repoCode .text-content {white-space: normal; white-space: pre-line;}
@@ -154,8 +154,8 @@ h3 {font-size: 16px;}
.repoCode #diff tr.commented .row-tip {right: 0;} .repoCode #diff tr.commented .row-tip {right: 0;}
.repoCode #diff tr.commented .icon-chat-dot {left: 0;} .repoCode #diff tr.commented .icon-chat-dot {left: 0;}
.repoCode .panel, .bugFormContainer {transition: border 0.4s;} .repoCode .panel, .reviewFormContainer {transition: border 0.4s;}
.repoCode .panel.highlight, #bugForm.highlight .bugFormContainer {border-color: #e48600;} .repoCode .panel.highlight, #reviewForm.highlight .reviewFormContainer {border-color: #e48600;}
#bugsPreview {white-space: normal;} #bugsPreview {white-space: normal;}
#bugsPreview .dropdown-menu {top: -100%; left: 30%; padding-top: 0; min-width: 300px; max-width: 500px;} #bugsPreview .dropdown-menu {top: -100%; left: 30%; padding-top: 0; min-width: 300px; max-width: 500px;}
@@ -166,7 +166,7 @@ h3 {font-size: 16px;}
.icon-comments {position: relative; left: -50px;} .icon-comments {position: relative; left: -50px;}
/* bug form */ /* bug form */
#bugForm, #bugForm table {margin: 0; padding: 0;} #reviewForm, #reviewForm table {margin: 0; padding: 0;}
.panel .table + .panel-footer {border-top: 0; background: #fff;} .panel .table + .panel-footer {border-top: 0; background: #fff;}
+118 -311
View File
File diff suppressed because it is too large Load Diff
+13 -3
View File
@@ -21,11 +21,11 @@ $lang->mr->linkStory = 'Link Stories';
$lang->mr->linkBug = 'Link Bugs'; $lang->mr->linkBug = 'Link Bugs';
$lang->mr->linkTask = 'Link Tasks'; $lang->mr->linkTask = 'Link Tasks';
$lang->mr->unlink = 'UnLink of stories,Bugs,tasks'; $lang->mr->unlink = 'UnLink of stories,Bugs,tasks';
$lang->mr->addBug = 'Add Review'; $lang->mr->addReview = 'Add Review';
$lang->mr->id = 'ID'; $lang->mr->id = 'ID';
$lang->mr->mriid = "raw MR ID"; $lang->mr->mriid = "raw MR ID";
$lang->mr->title = 'Name'; $lang->mr->title = 'Name';
$lang->mr->status = 'Status'; $lang->mr->status = 'Status';
$lang->mr->author = 'Author'; $lang->mr->author = 'Author';
$lang->mr->assignee = 'Assignee'; $lang->mr->assignee = 'Assignee';
@@ -46,7 +46,12 @@ $lang->mr->reject = 'Reject';
$lang->mr->close = 'Close'; $lang->mr->close = 'Close';
$lang->mr->reopen = 'Reopen'; $lang->mr->reopen = 'Reopen';
$lang->mr->approvalResult = 'Approval result'; $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 = array();
$lang->mr->approvalResultList['approve'] = 'Approve'; $lang->mr->approvalResultList['approve'] = 'Approve';
$lang->mr->approvalResultList['reject'] = 'Reject'; $lang->mr->approvalResultList['reject'] = 'Reject';
@@ -90,6 +95,7 @@ $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->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->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->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 = new stdclass;
$lang->mr->apiError->createMR = "Failed to create a merge request through API. Reason: %s"; $lang->mr->apiError->createMR = "Failed to create a merge request through API. Reason: %s";
@@ -100,6 +106,10 @@ $lang->mr->accessGitlabFailed = "Unable to connect to the GitLab server.";
$lang->mr->reopenSuccess = "The merge request was reopened."; $lang->mr->reopenSuccess = "The merge request was reopened.";
$lang->mr->closeSuccess = "Merge request closed."; $lang->mr->closeSuccess = "Merge request closed.";
$lang->mr->apiErrorMap[0] = "You can't use same project/branch for source and target";
$lang->mr->errorLang[0] = 'The source project branch cannot be the same as the target project branch';
$lang->mr->from = "from"; $lang->mr->from = "from";
$lang->mr->to = "to"; $lang->mr->to = "to";
$lang->mr->at = "at"; $lang->mr->at = "at";
+12 -2
View File
@@ -21,7 +21,7 @@ $lang->mr->linkStory = '关联需求';
$lang->mr->linkBug = '关联Bug'; $lang->mr->linkBug = '关联Bug';
$lang->mr->linkTask = '关联任务'; $lang->mr->linkTask = '关联任务';
$lang->mr->unlink = '取消关联需求、Bug、任务'; $lang->mr->unlink = '取消关联需求、Bug、任务';
$lang->mr->addBug = '添加评审'; $lang->mr->addReview = '添加评审';
$lang->mr->id = 'ID'; $lang->mr->id = 'ID';
$lang->mr->mriid = "MR原始ID"; $lang->mr->mriid = "MR原始ID";
@@ -46,7 +46,12 @@ $lang->mr->reject = '拒绝';
$lang->mr->close = '关闭'; $lang->mr->close = '关闭';
$lang->mr->reopen = '重新打开'; $lang->mr->reopen = '重新打开';
$lang->mr->approvalResult = '评审意见'; $lang->mr->reviewType = '评审类型';
$lang->mr->reviewTypeList = array();
$lang->mr->reviewTypeList['bug'] = 'Bug';
$lang->mr->reviewTypeList['task'] = '任务';
$lang->mr->approvalResult = '评审意见';
$lang->mr->approvalResultList = array(); $lang->mr->approvalResultList = array();
$lang->mr->approvalResultList['approve'] = '通过'; $lang->mr->approvalResultList['approve'] = '通过';
$lang->mr->approvalResultList['reject'] = '拒绝'; $lang->mr->approvalResultList['reject'] = '拒绝';
@@ -90,6 +95,7 @@ $lang->mr->notFound = "此{$lang->mr->common}不存在。";
$lang->mr->toCreatedMessage = "您提交的合并请求:<a href='%s'>%s</a> 构建任务执行通过。"; $lang->mr->toCreatedMessage = "您提交的合并请求:<a href='%s'>%s</a> 构建任务执行通过。";
$lang->mr->toReviewerMessage = "有一个合并请求:<a href='%s'>%s</a> 待审核。"; $lang->mr->toReviewerMessage = "有一个合并请求:<a href='%s'>%s</a> 待审核。";
$lang->mr->failMessage = "您提交的合并请求:<a href='%s'>%s</a> 构建任务执行失败,查看执行结果。"; $lang->mr->failMessage = "您提交的合并请求:<a href='%s'>%s</a> 构建任务执行失败,查看执行结果。";
$lang->mr->storySummary = "本页共 <strong>%s</strong> 个" . $lang->SRCommon;
$lang->mr->apiError = new stdclass; $lang->mr->apiError = new stdclass;
$lang->mr->apiError->createMR = "通过API创建合并请求失败,失败原因:%s"; $lang->mr->apiError->createMR = "通过API创建合并请求失败,失败原因:%s";
@@ -100,6 +106,10 @@ $lang->mr->accessGitlabFailed = "当前无法连接到GitLab服务器。";
$lang->mr->reopenSuccess = "已重新打开合并请求。"; $lang->mr->reopenSuccess = "已重新打开合并请求。";
$lang->mr->closeSuccess = "已关闭合并请求。"; $lang->mr->closeSuccess = "已关闭合并请求。";
$lang->mr->apiErrorMap[0] = "You can't use same project/branch for source and target";
$lang->mr->errorLang[0] = '源项目分支与目标项目分支不能相同';
$lang->mr->from = "从"; $lang->mr->from = "从";
$lang->mr->to = "合并到"; $lang->mr->to = "合并到";
$lang->mr->at = "于"; $lang->mr->at = "于";
+166 -43
View File
@@ -134,7 +134,10 @@ class mrModel extends model
if(isset($rawMR->message) and !isset($rawMR->iid)) if(isset($rawMR->message) and !isset($rawMR->iid))
{ {
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($MRID)->exec(); $this->dao->delete()->from(TABLE_MR)->where('id')->eq($MRID)->exec();
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, $rawMR->message[0]));
$errorKey = array_search($rawMR->message[0], $this->lang->mr->apiErrorMap);
$errorMessage = zget($this->lang->mr->errorLang, $errorKey);
return array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->createMR, $errorMessage));
} }
/* Create MR failed. */ /* Create MR failed. */
@@ -549,7 +552,7 @@ class mrModel extends model
public function getDiffs($MR, $encoding = '') public function getDiffs($MR, $encoding = '')
{ {
$diffVersions = $this->apiGetDiffVersions($MR->gitlabID, $MR->targetProject, $MR->mriid); $diffVersions = $this->apiGetDiffVersions($MR->gitlabID, $MR->targetProject, $MR->mriid);
$gitlab = $this->gitlab->getByID($MR->gitlabID); $gitlab = $this->gitlab->getByID($MR->gitlabID);
$this->loadModel('repo'); $this->loadModel('repo');
$repo = new stdclass; $repo = new stdclass;
@@ -567,10 +570,10 @@ class mrModel extends model
foreach ($diffVersions as $diffVersion) foreach ($diffVersions as $diffVersion)
{ {
$singleDiff = $this->apiGetSingleDiffVersion($MR->gitlabID, $MR->targetProject, $MR->mriid, $diffVersion->id); $singleDiff = $this->apiGetSingleDiffVersion($MR->gitlabID, $MR->targetProject, $MR->mriid, $diffVersion->id);
if ($singleDiff->state == 'empty') continue; if($singleDiff->state == 'empty') continue;
$commits = $singleDiff->commits; $commits = $singleDiff->commits;
$diffs = $singleDiff->diffs; $diffs = $singleDiff->diffs;
foreach ($diffs as $index => $diff) foreach($diffs as $index => $diff)
{ {
if(empty($commits[$index])) continue; if(empty($commits[$index])) continue;
/* Make sure every file with same commitID is unique in $lines. */ /* Make sure every file with same commitID is unique in $lines. */
@@ -583,9 +586,10 @@ class mrModel extends model
$lines[] = sprintf("--a/%s", $diff->old_path); $lines[] = sprintf("--a/%s", $diff->old_path);
$lines[] = sprintf("--b/%s", $diff->new_path); $lines[] = sprintf("--b/%s", $diff->new_path);
$diffLines = explode("\n", $diff->diff); $diffLines = explode("\n", $diff->diff);
foreach ($diffLines as $diffLine) $lines[] = $diffLine; foreach($diffLines as $diffLine) $lines[] = $diffLine;
} }
} }
$scm = $this->app->loadClass('scm'); $scm = $this->app->loadClass('scm');
$scm->setEngine($repo); $scm->setEngine($repo);
$diff = $scm->engine->parseDiff($lines); $diff = $scm->engine->parseDiff($lines);
@@ -782,45 +786,48 @@ class mrModel extends model
* Get review. * Get review.
* *
* @param int $repoID * @param int $repoID
* @param string $entry * @param int $MRID
* @param string $revision * @param string $revision
* @access public * @access public
* @return array * @return array
*/ */
public function getReview($repoID, $entry, $revision) public function getReview($repoID, $MRID, $revision = '')
{ {
if(empty($repoID) or empty($MRID)) return array();
$reviews = array(); $reviews = array();
$bugs = $this->dao->select('t1.*, t2.realname')->from(TABLE_BUG)->alias('t1') $bugs = $this->dao->select('t1.*, t2.realname')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2') ->leftJoin(TABLE_USER)->alias('t2')->on('t1.openedBy = t2.account')
->on('t1.openedBy = t2.account') ->where('t1.repo')->eq((int)$repoID)
->where('t1.repo')->eq($repoID) ->andWhere('t1.mr')->eq((int)$MRID)
->andWhere('t1.entry')->eq($entry) ->beginIF($revision)->andWhere('t1.v2')->eq($revision)->fi()
->andWhere('t1.v2')->eq($revision)
->andWhere('t1.deleted')->eq(0) ->andWhere('t1.deleted')->eq(0)
->fetchAll('id'); ->fetchAll('id');
$comments = $this->dao->select('t1.*, t2.realname')->from(TABLE_ACTION)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.actor = t2.account')
->where('t1.objectType')->eq('bug')
->andWhere('t1.objectID')->in(array_keys($bugs))
->andWhere('t1.action')->eq('commented')
->fetchGroup('objectID', 'id');
foreach($bugs as $bug) foreach($bugs as $bug)
{ {
if(common::hasPriv('bug', 'edit')) $bug->edit = true; if(common::hasPriv('bug', 'edit')) $bug->edit = true;
if(common::hasPriv('bug', 'delete')) $bug->delete = true; if(common::hasPriv('bug', 'delete')) $bug->delete = true;
if(common::hasPriv('bug', 'view')) $bug->view = true;
$lines = explode(',', trim($bug->lines, ',')); $lines = explode(',', trim($bug->lines, ','));
$line = $lines[0]; $line = $lines[0];
$reviews[$line]['bugs'][$bug->id] = $bug; $reviews[$line]['bug'][$bug->id] = $bug;
}
if(isset($comments[$bug->id])) $tasks = $this->dao->select('t1.*, t2.realname')->from(TABLE_TASK)->alias('t1')
{ ->leftJoin(TABLE_USER)->alias('t2')->on('t1.openedBy = t2.account')
foreach($comments[$bug->id] as $key => $comment) ->where('t1.repo')->eq((int)$repoID)
{ ->andWhere('t1.mr')->eq((int)$MRID)
if($comment->actor == $this->app->user->account) $comment->edit = true; ->beginIF($revision)->andWhere('t1.v2')->eq($revision)->fi()
} ->andWhere('t1.deleted')->eq(0)
$reviews[$line]['comments'] = $comments; ->fetchAll('id');
} foreach($tasks as $task)
{
if(common::hasPriv('task', 'edit')) $task->edit = true;
if(common::hasPriv('task', 'delete')) $task->delete = true;
if(common::hasPriv('task', 'view')) $task->view = true;
$lines = explode(',', trim($task->lines, ','));
$line = $lines[0];
$reviews[$line]['task'][$task->id] = $task;
} }
return $reviews; return $reviews;
@@ -878,43 +885,154 @@ class mrModel extends model
* Save bug. * Save bug.
* *
* @param int $repoID * @param int $repoID
* @param string $file * @param int $mr
* @param int $v1 * @param int $v1
* @param int $v2 * @param int $v2
* @access public * @access public
* @return array * @return array
*/ */
public function saveBug($repoID, $file, $v1, $v2) public function saveBug($repoID, $mr, $v1, $v2)
{ {
$now = helper::now(); $now = helper::now();
$data = fixer::input('post') $data = fixer::input('post')
->add('severity', 3) ->stripTags('commentText', $this->config->allowedTags)
->add('pri', 2)
->add('severity', 2)
->add('openedBy', $this->app->user->account) ->add('openedBy', $this->app->user->account)
->add('openedDate', $now) ->add('openedDate', $now)
->add('openedBuild', 'trunk') ->add('openedBuild', 'trunk')
->add('assignedDate', $now) ->add('type', 'codeerror')
->add('type', 'codeimprovement')
->add('repo', $repoID) ->add('repo', $repoID)
->add('entry', $file) ->add('mr', $mr)
->add('lines', $this->post->begin . ',' . $this->post->end) ->add('lines', $this->post->begin . ',' . $this->post->end)
->add('v1', $v1) ->add('v1', $v1)
->add('v2', $v2) ->add('v2', $v2)
->remove('commentText,begin,end,uid') ->cleanInt('module,execution,mr,repo')
->remove('begin,end,uid,reviewType,taskExecution,taskModule,taskAssignedTo')
->get(); ->get();
$data->steps = $this->loadModel('file')->pasteImage($this->post->commentText, $this->post->uid); $data->steps = $this->loadModel('file')->pasteImage($data->commentText, $this->post->uid);
$this->dao->insert(TABLE_BUG)->data($data)->exec(); if($data->assignedTo) $data->assignedDate = $now;
unset($data->commentText);
$this->loadModel('bug');
foreach(explode(',', $this->config->bug->create->requiredFields . ',repo,mr') as $requiredField)
{
$requiredField = trim($requiredField);
if(empty($requiredField)) continue;
if(!isset($data->$requiredField)) continue;
if(empty($data->$requiredField))
{
$fieldName = $requiredField;
if(isset($this->lang->bug->$requiredField)) $fieldName = $this->lang->bug->$requiredField;
dao::$errors[$requiredField][] = sprintf($this->lang->error->notempty, $fieldName);
}
}
if(dao::isError()) return array('result' => 'fail', 'message' => dao::getError());
$this->dao->insert(TABLE_BUG)->data($data)->autocheck()->exec();
if(!dao::isError()) if(!dao::isError())
{ {
$bugID = $this->dao->lastInsertID(); $bugID = $this->dao->lastInsertID();
$this->file->updateObjectID($this->post->uid, $bugID, 'bug'); $this->loadModel('file')->updateObjectID($this->post->uid, $bugID, 'bug');
setcookie("repoPairs[$repoID]", $data->product); setcookie("repoPairs[$repoID]", $data->product);
return array('result' => 'success', 'id' => $bugID, 'realname' => $this->app->user->realname, 'openedDate' => substr($now, 5, 11), 'edit' => true, 'delete' => true, 'lines' => $data->lines, 'line' => $this->post->begin, 'steps' => $data->steps, 'title' => $data->title); $bugInfo = array();
$bugInfo['result'] = 'success';
$bugInfo['id'] = $bugID;
$bugInfo['realname'] = $this->app->user->realname;
$bugInfo['openedDate'] = substr($now, 5, 11);
$bugInfo['edit'] = common::hasPriv('bug', 'edit');
$bugInfo['view'] = common::hasPriv('bug', 'view');
$bugInfo['delete'] = common::hasPriv('bug', 'delete');
$bugInfo['lines'] = $data->lines;
$bugInfo['line'] = $this->post->begin;
$bugInfo['content'] = $data->steps;
$bugInfo['title'] = $data->title;
$bugInfo['objectType'] = 'bug';
$bugInfo['entry'] = $data->entry;
return $bugInfo;
} }
return array('result' => 'fail', 'message' => join("\n", dao::getError())); return array('result' => 'fail', 'message' => dao::getError());
}
/**
* Save task.
*
* @param int $repoID
* @param int $mr
* @param int $v1
* @param int $v2
* @access public
* @return array
*/
public function saveTask($repoID, $mr, $v1, $v2)
{
$now = helper::now();
$data = fixer::input('post')->stripTags('commentText', $this->config->allowedTags)->get();
$task = new stdclass();
$task->execution = (int)$data->taskExecution;
$task->project = (int)$this->dao->select('project')->from(TABLE_PROJECT)->where('id')->eq($task->execution)->fetch('project');
$task->module = (int)$data->taskModule;
$task->name = $data->title;
$task->type = 'devel';
$task->pri = '2';
$task->status = 'wait';
$task->version = '1';
$task->openedBy = $this->app->user->account;
$task->assignedTo = $data->taskAssignedTo;
$task->repo = (int)$repoID;
$task->mr = (int)$mr;
$task->lines = $this->post->begin . ',' . $this->post->end;
$task->entry = $data->entry;
$task->v1 = $v1;
$task->v2 = $v2;
$task->desc = $this->loadModel('file')->pasteImage($data->commentText, $this->post->uid);
if($task->assignedTo) $task->assignedDate = $now;
$this->loadModel('task');
foreach(explode(',', $this->config->task->create->requiredFields . ',repo,mr') as $requiredField)
{
$requiredField = trim($requiredField);
if(empty($requiredField)) continue;
if(!isset($task->$requiredField)) continue;
if(empty($task->$requiredField))
{
$fieldName = $requiredField;
if(isset($this->lang->task->$requiredField)) $fieldName = $this->lang->task->$requiredField;
dao::$errors[$requiredField][] = sprintf($this->lang->error->notempty, $fieldName);
}
}
if(dao::isError()) return array('result' => 'fail', 'message' => dao::getError());
$this->dao->insert(TABLE_TASK)->data($task)->autocheck()->exec();
if(!dao::isError())
{
$taskID = $this->dao->lastInsertID();
$this->file->updateObjectID($this->post->uid, $taskID, 'task');
$taskInfo = array();
$taskInfo['result'] = 'success';
$taskInfo['id'] = $taskID;
$taskInfo['realname'] = $this->app->user->realname;
$taskInfo['openedDate'] = substr($now, 5, 11);
$taskInfo['edit'] = common::hasPriv('task', 'edit');
$taskInfo['view'] = common::hasPriv('task', 'view');
$taskInfo['delete'] = common::hasPriv('task', 'delete');
$taskInfo['lines'] = $task->lines;
$taskInfo['line'] = $this->post->begin;
$taskInfo['content'] = $task->desc;
$taskInfo['title'] = $data->title;
$taskInfo['objectType'] = 'task';
$taskInfo['entry'] = $task->entry;
return $taskInfo;
}
return array('result' => 'fail', 'message' => dao::getError());
} }
/** /**
@@ -960,13 +1078,18 @@ class mrModel extends model
/** /**
* Get last review info. * Get last review info.
* *
* @param string $entry * @param int $repoID
* @access public * @access public
* @return object * @return object
*/ */
public function getLastReviewInfo($entry) public function getLastReviewInfo($repoID)
{ {
return $this->dao->select('*')->from(TABLE_BUG)->where('entry')->eq($entry)->orderby('id_desc')->fetch(); if(empty($repoID)) return null;
$lastReview = new stdclass();
$lastReview->bug = $this->dao->select('*')->from(TABLE_BUG)->where('repo')->eq((int)$repoID)->orderby('id_desc')->fetch();
$lastReview->task = $this->dao->select('*')->from(TABLE_TASK)->where('repo')->eq((int)$repoID)->orderby('id_desc')->fetch();
return $lastReview;
} }
/** /**
+1 -1
View File
@@ -86,7 +86,7 @@
<?php <?php
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->overview}' class='btn btn-info'"); common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->overview}' class='btn btn-info'");
common::printLink('mr', 'edit', "mr={$MR->id}", '<i class="icon icon-edit"></i>', '', "title='{$lang->mr->edit}' class='btn btn-info'"); common::printLink('mr', 'edit', "mr={$MR->id}", '<i class="icon icon-edit"></i>', '', "title='{$lang->mr->edit}' class='btn btn-info'");
common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-review"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'"); common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-diff"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'");
common::printLink('mr', 'link', "mr={$MR->id}", '<i class="icon icon-link"></i>', '', "title='{$lang->mr->link}' class='btn btn-info'" . ($MR->linkButton == false ? 'disabled' : '')); common::printLink('mr', 'link', "mr={$MR->id}", '<i class="icon icon-link"></i>', '', "title='{$lang->mr->link}' class='btn btn-info'" . ($MR->linkButton == false ? 'disabled' : ''));
common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info'"); common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info'");
?> ?>
+6 -3
View File
@@ -55,10 +55,13 @@
<div class='btn-toolbar'> <div class='btn-toolbar'>
<div class='btn-group'> <div class='btn-group'>
<div class='btn-group'> <div class='btn-group'>
<?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encoding) . "<span class='caret'></span>", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?> <?php $encoding = str_replace('-', '_', $encoding);?>
<?php echo html::commonButton(zget($lang->repo->encodingList, $encoding, $lang->repo->encodingList['utf_8']) . "<span class='caret'></span>", "data-toggle='dropdown'", 'btn dropdown-toggle btn-sm')?>
<ul class='dropdown-menu' role='menu'> <ul class='dropdown-menu' role='menu'>
<?php foreach($lang->repo->encodingList as $key => $val):?> <?php foreach($lang->repo->encodingList as $key => $val):?>
<li><?php echo html::a('javascript:changeEncoding("'. $key . '")', $val)?></li> <li <?php echo $key == $encoding ? "class='active'" : '';?>>
<?php echo html::a('javascript:changeEncoding("'. $key . '")', $val)?>
</li>
<?php endforeach;?> <?php endforeach;?>
</ul> </ul>
</div> </div>
@@ -69,7 +72,7 @@
</div> </div>
<?php foreach($diffs as $diffFile):?> <?php foreach($diffs as $diffFile):?>
<div class='repoCode'> <div class='repoCode'>
<table class='table diff' id='diff'> <table class='table diff' id='diff' data-entry='<?php echo base64_encode($diffFile->fileName);?>'>
<caption><?php echo $diffFile->fileName;?></caption> <caption><?php echo $diffFile->fileName;?></caption>
<?php if(empty($diffFile->contents)) continue;?> <?php if(empty($diffFile->contents)) continue;?>
<?php foreach($diffFile->contents as $content):?> <?php foreach($diffFile->contents as $content):?>
+136 -129
View File
@@ -1,9 +1,6 @@
<?php <?php
$file= '';
$suffix = '';
/* get last review info in this file. */ /* get last review info in this file. */
$lastReview = $this->mr->getLastReviewInfo($file); $lastReview = $this->mr->getLastReviewInfo($repo->id);
$repoModule = isset($lastReview) && isset($lastReview->module) ? $lastReview->module : '';
/* Get product pairs. */ /* Get product pairs. */
if(isset($repo->product) and $repo->product) if(isset($repo->product) and $repo->product)
@@ -16,111 +13,97 @@ else
} }
/* get product by cookie or last review in this file. */ /* get product by cookie or last review in this file. */
$repoProduct = isset($_COOKIE['repoPairs'][$repoID]) ? $_COOKIE['repoPairs'][$repoID] : ''; $repoProduct = isset($_COOKIE['repoPairs'][$repoID]) ? $_COOKIE['repoPairs'][$repoID] : '';
$repoProduct = isset($lastReview) && isset($lastReview->product) ? $lastReview->product : $repoProduct; $repoProduct = (!empty($lastReview->bug) && isset($lastReview->bug->product)) ? $lastReview->bug->product : $repoProduct;
$repoProduct = isset($products[$repoProduct]) ? $repoProduct : key($products); $repoProduct = isset($products[$repoProduct]) ? $repoProduct : key($products);
$executions = $this->mr->getExecutionPairs($repoProduct); $bugRepoModule = (!empty($lastReview->bug) && $lastReview->bug->product == $repoProduct) ? $lastReview->bug->module : '';
$modules = $this->loadModel('tree')->getOptionMenu($repoProduct, $viewType = 'bug', $startModuleID = 0); $executions = $this->mr->getExecutionPairs($repoProduct);
$users = $this->loadModel('user')->getPairs('devfirst|nodeleted|noclosed'); $modules = $this->loadModel('tree')->getOptionMenu($repoProduct, $viewType = 'bug', $startModuleID = 0);
$products = array('' => '') + $products; $users = $this->loadModel('user')->getPairs('devfirst|nodeleted|noclosed');
$executions = array('' => '') + $executions; $products = array('' => '') + $products;
$executions = array('' => '') + $executions;
$cwd = getcwd(); $taskExecutions = $executions;
$commiters = $this->user->getCommiters(); if(empty($repo->product)) $taskExecutions = array('' => '') + $this->loadModel('execution')->getPairs();
$blamePairs = array(); $repoExecution = (!empty($lastReview->task) && isset($lastReview->task->execution)) ? $lastReview->task->execution : $this->session->execution;
if($suffix and $suffix != 'binary' and strpos($this->config->repo->images, "|$suffix|") === false) $repoExecution = isset($taskExecutions[$repoExecution]) ? $repoExecution : key($taskExecutions);
$taskModules = array('' => '');
$taskRepoModule = 0;
$taskMembers = array('' => '');
if($repoExecution)
{ {
$blames = $this->scm->blame($entry, $info->revision); $taskModules = $this->loadModel('tree')->getTaskOptionMenu($repoExecution, 0, 0, 'allModule');
foreach($blames as $line => $blame) $taskRepoModule = (!empty($lastReview->task) && $lastReview->task->execution == $repoExecution) ? $lastReview->task->module : '';
{ $taskMembers = $this->loadModel('user')->getTeamMemberPairs($repoExecution, 'execution', 'nodeleted');
if(!isset($blame['committer']))
{
if(isset($blamePairs[$line - 1])) $blamePairs[$line] = $blamePairs[$line - 1];
continue;
}
$blamePairs[$line] = zget($commiters, $blame['committer'], $blame['committer']);
}
} }
chdir($cwd);
//$reviews = $this->mr->getReview($repoID, $file, $info->revision); $reviews = $this->mr->getReview($repoID, $MR->id);
$reviews = $this->mr->getReview($repoID, $file, ''); $v1 = isset($oldRevision) ? $oldRevision : 0;
$v1 = isset($oldRevision) ? $oldRevision : 0;
$this->loadModel('repo'); $this->loadModel('repo');
// $bugUrl = $this->repo->createLink('addBug', "repoID=$repoID&file=$file&v1=$v1&v2={$info->revision}");
$bugUrl = $this->createLink('mr', 'addBug', "repoID=$repoID&file=$file&v1=$v1&v2="); $taskModuleSelect = html::select('taskModule', $taskModules, $taskRepoModule, 'class="form-control chosen"');
$commentUrl = $this->createLink('mr', 'addComment'); $taskUserSelect = html::select('taskAssignedTo', $taskMembers, '', 'class="form-control chosen"');
$taskExecutionSelect = html::select('taskExecution', $taskExecutions, $repoExecution, 'class="form-control chosen" onchange="changeExecution(this)"');
$reviewUrl = $this->createLink('mr', 'addReview', "repoID=$repoID&mr={$MR->id}&v1=$v1&v2=");
$productSelect = html::select('product', $products, $repoProduct, 'class="product form-control chosen" onchange="changeProduct(this)"'); $productSelect = html::select('product', $products, $repoProduct, 'class="product form-control chosen" onchange="changeProduct(this)"');
$branches = $this->loadModel('branch')->getPairs($repoProduct); $branches = $this->loadModel('branch')->getPairs($repoProduct);
$moduleSelect = html::select('module', $modules, $repoModule, 'class="form-control chosen"'); $moduleSelect = html::select('module', $modules, $bugRepoModule, 'class="form-control chosen"');
$executionSelect = html::select('execution', $executions, '', 'class="form-control chosen"'); $executionSelect = html::select('execution', $executions, '', 'class="form-control chosen"');
$typeSelect = html::select('repoType', $lang->repo->typeList, '', 'class="form-control chosen"'); $typeSelect = html::select('repoType', $lang->repo->typeList, '', 'class="form-control chosen"');
$userSelect = html::select('assignedTo', $users, '', 'class="form-control chosen assignedTo"'); $userSelect = html::select('assignedTo', $users, '', 'class="form-control chosen assignedTo"');
$bugs = array();
$lineReviews = array();
foreach($reviews as $line => $lineReview) foreach($reviews as $line => $lineReview)
{ {
$lineBugs = array(); foreach($lineReview as $objectType => $objects)
foreach ($lineReview['bugs'] as $bugID => $bug)
{ {
$lineBug = array(); foreach($objects as $objectID => $object)
$lineBug['id'] = $bugID;
$lineBug['line'] = $line;
$lineBug['title'] = $bug->title;
$lineBug['steps'] = $bug->steps;
$lineBug['realname'] = $bug->realname;
$lineBug['openedDate'] = substr($bug->openedDate, 5, 11);
$lineBug['lines'] = $bug->lines;
if($bug->edit) $lineBug['edit'] = true;
if($bug->delete) $lineBug['delete'] = true;
if(isset($lineReview['comments']))
{ {
if(isset($lineReview['comments'][$bugID])) $lineReview = array();
{ $lineReview['id'] = $objectID;
$comments = $lineReview['comments'][$bugID]; $lineReview['line'] = $line;
$bugComments = array(); $lineReview['title'] = $objectType == 'bug' ? $object->title : $object->name;
foreach ($comments as $commentID => $comment) $lineReview['content'] = $objectType == 'bug' ? $object->steps : $object->desc;
{ $lineReview['realname'] = $object->realname;
$bugComment = array( $lineReview['openedDate'] = substr($object->openedDate, 5, 11);
'id' => $comment->id, $lineReview['lines'] = $object->lines;
'edit' => $comment->edit, $lineReview['objectType'] = $objectType;
'realname' => $comment->realname, $lineReview['entry'] = $object->entry;
'date' => substr($comment->date, 5, 11), $lineReview['edit'] = common::hasPriv($objectType, 'edit');
'comment' => $comment->comment, $lineReview['delete'] = common::hasPriv($objectType, 'delete');
); $lineReview['view'] = common::hasPriv($objectType, 'view');
$bugComments[] = $bugComment; $lineReviews[$line][] = $lineReview;
}
$lineBug['comments'] = $bugComments;
}
} }
$lineBugs[] = $lineBug;
} }
$bugs[$line] = $lineBugs;
} }
js::set('bugs', $bugs); js::set('reviews', $lineReviews);
js::set('productError', $lang->repo->error->product); js::set('productError', $lang->repo->error->product);
js::set('contentError', $lang->repo->error->commentText); js::set('contentError', $lang->repo->error->commentText);
js::set('titleError', $lang->repo->error->title); js::set('titleError', $lang->repo->error->title);
js::set('commentError', $lang->repo->error->comment); js::set('commentError', $lang->repo->error->comment);
js::set('submit', $lang->repo->submit); js::set('submit', $lang->repo->submit);
js::set('cancel', $lang->repo->cancel); js::set('cancel', $lang->repo->cancel);
js::set('confirmDelete', $lang->repo->notice->deleteBug); js::set('confirmDelete', $lang->repo->notice->deleteReview);
js::set('confirmDeleteComment', $lang->repo->notice->deleteComment);
js::set('repoID', $repoID); js::set('repoID', $repoID);
// js::set('revision', $info->revision); js::set('MRID', $MR->id);
js::set('revision', ''); js::set('revision', '');
js::set('file', $file);
js::set('blamePairs', $blamePairs);
?> ?>
<?php if(common::hasPriv('mr', 'addBug')):?> <?php if(common::hasPriv('mr', 'addReview')):?>
<form id="bugForm" class="bugForm main-form hide" method="post" action="<?php echo $bugUrl?>"> <form id="reviewForm" class="reviewForm main-form hide" method="post" action="<?php echo $reviewUrl?>">
<div class="bugFormContainer"> <div class="reviewFormContainer">
<table class='table table-form'> <table class='table table-form'>
<tr>
<th class='w-100px'><?php echo $lang->mr->reviewType;?></th>
<td class='w-p45'><?php echo html::select('reviewType', $lang->mr->reviewTypeList, 'bug', "class='form-control' onchange=changeReviewType(this)")?></td>
<th class='w-100px'></th>
<td class='w-p45'></td>
</tr>
<tr> <tr>
<th><?php echo $lang->repo->product?></th> <th><?php echo $lang->repo->product?></th>
<td class='w-p45'> <td>
<div class='input-group'> <div class='input-group'>
<?php echo $productSelect?> <?php echo $productSelect?>
<?php if($branches) echo html::select('branch', $branches, '', "class='form-control' style='width:95px'");?> <?php if($branches) echo html::select('branch', $branches, '', "class='form-control' style='width:95px'");?>
@@ -131,13 +114,22 @@ js::set('blamePairs', $blamePairs);
</tr> </tr>
<tr> <tr>
<th><?php echo $lang->repo->execution?></th> <th><?php echo $lang->repo->execution?></th>
<td><?php echo $executionSelect?></td> <td>
<div class='bugExecutionBox'><?php echo $executionSelect?></div>
<div class='taskExecutionBox hide required'><?php echo $taskExecutionSelect?></div>
</td>
<th><?php echo $lang->repo->type?></th> <th><?php echo $lang->repo->type?></th>
<td><?php echo $typeSelect?></td> <td><?php echo $typeSelect?></td>
</tr> </tr>
<tr class='taskModuleBox hide'>
<th><?php echo $lang->repo->module?></th>
<td><?php echo $taskModuleSelect?></td>
<tr> <tr>
<th><?php echo $lang->repo->assign?></th> <th><?php echo $lang->repo->assign?></th>
<td><?php echo $userSelect?></td> <td>
<div class='bugAssignedToBox'><?php echo $userSelect?></div>
<div class='taskAssignedToBox hide'><?php echo $taskUserSelect?></div>
</td>
<th><?php echo $lang->repo->lines?></th> <th><?php echo $lang->repo->lines?></th>
<td class='lines'> <td class='lines'>
<div class="input-group"> <div class="input-group">
@@ -149,7 +141,7 @@ js::set('blamePairs', $blamePairs);
</tr> </tr>
<tr> <tr>
<th><?php echo $lang->repo->title?></th> <th><?php echo $lang->repo->title?></th>
<td colspan='3'> <td colspan='3' class='required'>
<?php echo html::input('title', '', "class='form-control'");?> <?php echo html::input('title', '', "class='form-control'");?>
</td> </td>
</tr> </tr>
@@ -160,8 +152,9 @@ js::set('blamePairs', $blamePairs);
<tr> <tr>
<th></th> <th></th>
<td colspan="3" class='form-actions'> <td colspan="3" class='form-actions'>
<?php echo html::submitButton($lang->repo->submit, '', 'btn btn-wide btn-primary bugSubmit');?> <?php echo html::submitButton($lang->repo->submit, '', 'btn btn-wide btn-primary reviewSubmit');?>
<?php echo html::commonButton($lang->cancel, "onclick='hiddenForm()'", 'btn btn-wide');?> <?php echo html::commonButton($lang->cancel, "onclick='hiddenForm()'", 'btn btn-wide');?>
<input type="hidden" id='entry' name="entry" value=""/>
</td> </td>
</tr> </tr>
</table> </table>
@@ -169,73 +162,87 @@ js::set('blamePairs', $blamePairs);
</div> </div>
</form> </form>
<?php else:?> <?php else:?>
<form id='bugForm' class='bugForm hide'> <form id='reviewForm' class='reviewForm hide'>
<?php printf($lang->user->errorDeny, $lang->repo->common, $lang->repo->addBug);?> <?php printf($lang->user->errorDeny, $lang->mr->common, $lang->mr->addReview);?>
</form> </form>
<?php endif;?> <?php endif;?>
<div class='panel panel-sm hide panel-bug' id='bugPanel'> <div class='panel panel-sm hide panel-review' id='reviewPanel'>
<div class='panel-heading'> <div class='panel-heading'>
<div class='panel-actions pull-right'> <div class='panel-actions pull-right'>
<?php if(common::hasPriv('bug', 'view')):?> <a href='javascript:;' class='delete reviewDelete'><i class='icon-remove'></i></a>
<a href='javascript:;' class='view-bug'>Bug#<span class='bugid'></span></a>
<?php else:?>
Bug#<span class='bugid'></span>
<?php endif;?>
<?php if(common::hasPriv('bug', 'edit')):?>
<a href='javascript:;' class='edit bugEdit'><i class='icon-pencil'></i></a>
<?php endif;?>
<?php if(common::hasPriv('bug', 'delete')):?>
<a href='javascript:;' class='delete bugDelete'><i class='icon-remove'></i></a>
<?php endif;?>
<a href="javascript:;"><i class='icon-chevron-down'></i></a> <a href="javascript:;"><i class='icon-chevron-down'></i></a>
</div> </div>
<i class='icon-bug text-muted'></i> <strong class='title'></strong> <i class='text-muted'></i> <strong class='title'></strong>
</div> </div>
<div class='panel-body'> <div class='panel-body'>
<p><?php echo $lang->repo->lines?> <strong class='code-lines'></strong> &nbsp; <i class='icon-user text-muted'></i> <strong class='realname'></strong> &nbsp;<span class='text-muted bug-date'><i class='icon-time'></i> <span class='openedDate'></span></span></p> <p><?php echo $lang->repo->lines?> <strong class='code-lines'></strong> &nbsp; <i class='icon-user text-muted'></i> <strong class='realname'></strong> &nbsp;<span class='text-muted bug-date'><i class='icon-time'></i> <span class='openedDate'></span></span></p>
<form method='post' class='bug-edit-form' action> <p class='content text-content'></p>
<input type='text' name='commentText' class='commentInput form-control mgb-10'>
<button type='submit' class='btn btn-sm btn-primary bugEditSubmit'><?php echo $lang->repo->submit?></button>
<button type='button' class='btn btn-sm bugEditCancel'><?php echo $lang->repo->cancel?></button>
</form>
<p class='steps text-content'></p>
<div class='comments'></div>
<?php if(common::hasPriv('repo', 'addComment')):?>
<button class='btn btn-sm addComment' type='button'><?php echo $lang->repo->addComment?></button>
<form class='commentForm' method='post' action='<?php echo $commentUrl?>' id='commentForm'>
<textarea name='comment' class='commentText form-control mgb-10' spellcheck='false' placeholder='<?php echo $lang->repo->notice->commentContent?>'></textarea>
<input class='commentSubmit btn btn-sm btn-primary' type='submit' value='<?php echo $lang->repo->submit?>'>
<input class='commentCancel btn btn-sm' type='button' value='<?php echo $lang->repo->cancel?>'>
<input type='hidden' name='objectID' value=''>
<div class='optional'></div>
</form>
<?php endif;?>
</div> </div>
</div> </div>
<div class='comment hide' id='commentCell'> <div class='dropdown' id="reviewsPreview">
<i class='icon-user text-muted'></i> <strong class='realname'></strong>: <span class='comment-content text-content'></span> <span class='text-muted comment-date'>&nbsp;<i class='icon-time'></i> <span class='date'></span></span> &nbsp;<a href='javascript:;' class='edit commentEdit pull-right'><i class='icon-pencil'></i></a>
<form method='post' class='comment-edit-form' action=''>
<textarea name='commentText' class='commentInput form-control mgb-10'></textarea>
<button type='submit' class='btn btn-sm btn-primary commentEditSubmit'><?php echo $lang->repo->submit?></button>
<button type='button' class='btn btn-sm commentEditCancel'><?php echo $lang->repo->cancel?></button>
</form>
</div>
<div class='dropdown' id="bugsPreview">
<ul class='dropdown-menu fade'> <ul class='dropdown-menu fade'>
<li class='dropdown-header'><?php echo $lang->repo->line?><strong class='code-line'></strong> &nbsp; <i class='icon-bug'></i> <strong class='bug-count'>0</strong> &nbsp; <i class='icon-comments-alt'></i> <strong class='comment-count'>0</strong></li> <li class='dropdown-header'><?php echo $lang->repo->line?><strong class='code-line'></strong> &nbsp; <i class='icon-bug'></i> <strong class='bug-count'>0</strong> &nbsp; <i class='icon-comments-alt'></i> <strong class='comment-count'>0</strong></li>
</ul> </ul>
</div> </div>
<div id='rowTip' class='hide'><div class='row-tip'><i class='icon-chat-dot preview-icon'></i><div class='on-expand tip'><span><?php echo $lang->repo->expand?> </span><i class='icon-chevron-down'></i></div><div class='on-collapse tip'><span><?php echo $lang->repo->collapse?> </span><i class='icon-chevron-up'></i></div></div></div> <div id='rowTip' class='hide'><div class='row-tip'><div class='on-expand tip'><span><?php echo $lang->repo->expand?> </span><i class='icon-chevron-down'></i></div><div class='on-collapse tip'><span><?php echo $lang->repo->collapse?> </span><i class='icon-chevron-up'></i></div></div></div>
<script> <script>
function changeReviewType(select)
{
var reviewType = $(select).val();
if(reviewType == 'bug')
{
$('#product').closest('td').show();
$('#product').closest('td').prev().show();
$('#module').closest('td').show();
$('#module').closest('td').prev().show();
$('#repoType').closest('td').show();
$('#repoType').closest('td').prev().show();
$('.taskModuleBox').addClass('hide');
$('.bugAssignedToBox').removeClass('hide');
$('.taskAssignedToBox').addClass('hide');
$('.bugExecutionBox').removeClass('hide');
$('.taskExecutionBox').addClass('hide');
}
else
{
$('#product').closest('td').hide();
$('#product').closest('td').prev().hide();
$('#module').closest('td').hide();
$('#module').closest('td').prev().hide();
$('#repoType').closest('td').hide();
$('#repoType').closest('td').prev().hide();
$('.taskModuleBox').removeClass('hide');
$('.bugAssignedToBox').addClass('hide');
$('.taskAssignedToBox').removeClass('hide');
$('.bugExecutionBox').addClass('hide');
$('.taskExecutionBox').removeClass('hide');
}
}
function changeProduct(select) function changeProduct(select)
{ {
loadProductBranches(select); loadProductBranches(select);
productID = $(select).children('option:selected').val(); productID = $(select).children('option:selected').val();
link = createLink('repo', 'ajaxGetExecutions', 'productID=' + productID); link = createLink('repo', 'ajaxGetExecutions', 'productID=' + productID);
$(select).closest('.bugFormContainer').find('select[name=execution]').parent().load(link, '', function(){$('#execution').chosen();}); $(select).closest('.reviewFormContainer').find('select[name=execution]').parent().load(link, '', function(){$('#execution').chosen();});
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=0&rootModuleID=0&returnType=html'); moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=0&rootModuleID=0&returnType=html');
$(select).closest('.bugFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();}); $(select).closest('.reviewFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();});
}
function changeExecution(select)
{
if($('#reviewType').val() == 'bug') return false;
var executionID = $(select).val();
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'execution=' + executionID + '&viewtype=task&branch=0&rootModuleID=0&returnType=html');
$('.taskModuleBox').find('td:first').load(moduleLink, '', function(){$('.taskModuleBox #module').attr('id', 'taskModule').attr('name', 'taskModule').chosen();});
assignLink = createLink('execution', 'ajaxGetMembers', 'executionID=' + executionID);
$('.taskAssignedToBox').load(assignLink, '', function(){$('.taskAssignedToBox #assignedTo').attr('id', 'taskAssignedTo').attr('name', 'taskAssignedTo').chosen();});
} }
function loadProductBranches(select) function loadProductBranches(select)
@@ -257,9 +264,9 @@ function loadBranch(select)
branch = $(select).val(); branch = $(select).val();
productID = $(select).closest('.input-group').find('#product').val(); productID = $(select).closest('.input-group').find('#product').val();
link = createLink('repo', 'ajaxGetExecutions', 'productID=' + productID + '&branch=' + branch); link = createLink('repo', 'ajaxGetExecutions', 'productID=' + productID + '&branch=' + branch);
$(select).closest('.bugFormContainer').find('select[name=execution]').parent().load(link, '', function(){$('#execution').chosen();}); $(select).closest('.reviewFormContainer').find('select[name=execution]').parent().load(link, '', function(){$('#execution').chosen();});
moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html'); moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html');
$(select).closest('.bugFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();}); $(select).closest('.reviewFormContainer').find('select[name=module]').parent().load(moduleLink, '', function(){$('#module').chosen();});
} }
function hiddenForm() function hiddenForm()
+1 -1
View File
@@ -129,7 +129,7 @@
</table> </table>
<?php if($stories):?> <?php if($stories):?>
<div class='table-footer'> <div class='table-footer'>
<div class='table-statistic'><?php echo $summary;?></div> <div class='table-statistic'><?php echo sprintf($lang->mr->storySummary, count($stories));?></div>
<?php <?php
$this->app->rawParams['type'] = 'story'; $this->app->rawParams['type'] = 'story';
$storyPager->show('right', 'pagerjs'); $storyPager->show('right', 'pagerjs');
-6
View File
@@ -61,12 +61,6 @@
<th class="w-100px"><?php echo $lang->mr->status;?></th> <th class="w-100px"><?php echo $lang->mr->status;?></th>
<td><?php echo zget($lang->mr->statusList, $MR->status);?></td> <td><?php echo zget($lang->mr->statusList, $MR->status);?></td>
</tr> </tr>
<?php if(isset($rawMR->head_pipeline->status)): ?>
<tr>
<th><?php echo "{$lang->mr->pipeline}{$lang->mr->status}";?></th>
<td><?php echo zget($lang->mr->pipelineStatus, $rawMR->head_pipeline->status, $lang->mr->pipelineUnknown); ?></td>
</tr>
<?php endif; ?>
<tr> <tr>
<th><?php echo $lang->mr->mergeStatus; ?></th> <th><?php echo $lang->mr->mergeStatus; ?></th>
<?php if(empty($rawMR->changes_count)):?> <?php if(empty($rawMR->changes_count)):?>
+1
View File
@@ -357,6 +357,7 @@ class repo extends control
session_start(); session_start();
$this->session->set('revisionList', $this->app->getURI(true)); $this->session->set('revisionList', $this->app->getURI(true));
$this->session->set('gitlabBranchList', $this->app->getURI(true));
session_write_close(); session_write_close();
/* Get repo and synchronous commit. */ /* Get repo and synchronous commit. */
+1
View File
@@ -1,4 +1,5 @@
#mainMenu > .btn-toolbar {height: 35px; line-height: 35px;} #mainMenu > .btn-toolbar {height: 35px; line-height: 35px;}
#mainMenu > .pull-right {padding-right: 1%;}
#sidebar>.sidebar-toggle>.icon {right: -2px; left: auto;} #sidebar>.sidebar-toggle>.icon {right: -2px; left: auto;}
.main-row {width: 99%;} .main-row {width: 99%;}
.btn-toolbar > .last-sync-time {display: inline-block; float: left; margin-right: 10px;} .btn-toolbar > .last-sync-time {display: inline-block; float: left; margin-right: 10px;}
+1
View File
@@ -146,6 +146,7 @@ $lang->repo->notice->syncedCount = 'The number of records synchronized is ';
$lang->repo->notice->delete = 'Do you want to delete this repo?'; $lang->repo->notice->delete = 'Do you want to delete this repo?';
$lang->repo->notice->successDelete = 'Repository is removed.'; $lang->repo->notice->successDelete = 'Repository is removed.';
$lang->repo->notice->commentContent = 'Comment'; $lang->repo->notice->commentContent = 'Comment';
$lang->repo->notice->deleteReview = 'Do you want to delete this review?';
$lang->repo->notice->deleteBug = 'Do you want to delete this bug?'; $lang->repo->notice->deleteBug = 'Do you want to delete this bug?';
$lang->repo->notice->deleteComment = 'Do you want to delete this comment?'; $lang->repo->notice->deleteComment = 'Do you want to delete this comment?';
$lang->repo->notice->lastSyncTime = 'Last Sync:'; $lang->repo->notice->lastSyncTime = 'Last Sync:';
+1
View File
@@ -146,6 +146,7 @@ $lang->repo->notice->syncedCount = '已经同步记录条数';
$lang->repo->notice->delete = '是否要删除该版本库?'; $lang->repo->notice->delete = '是否要删除该版本库?';
$lang->repo->notice->successDelete = '已经成功删除版本库。'; $lang->repo->notice->successDelete = '已经成功删除版本库。';
$lang->repo->notice->commentContent = '输入回复内容'; $lang->repo->notice->commentContent = '输入回复内容';
$lang->repo->notice->deleteReview = '确认删除该评审?';
$lang->repo->notice->deleteBug = '确认删除该Bug?'; $lang->repo->notice->deleteBug = '确认删除该Bug?';
$lang->repo->notice->deleteComment = '确认删除该回复?'; $lang->repo->notice->deleteComment = '确认删除该回复?';
$lang->repo->notice->lastSyncTime = '最后更新于:'; $lang->repo->notice->lastSyncTime = '最后更新于:';
+1
View File
@@ -59,6 +59,7 @@
<div class="btn-toolbar pull-right"> <div class="btn-toolbar pull-right">
<span class='last-sync-time'><?php echo $lang->repo->notice->lastSyncTime . $cacheTime?></span> <span class='last-sync-time'><?php echo $lang->repo->notice->lastSyncTime . $cacheTime?></span>
<?php echo html::a($this->repo->createLink('browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID&path=" . $this->repo->encodePath($path) . "&revision=$revision&refresh=1"), "<i class='icon icon-refresh'></i> " . $lang->refresh, '', "class='btn btn-primary' data-app={$app->tab}");?> <?php echo html::a($this->repo->createLink('browse', "repoID=$repoID&branchID=$base64BranchID&objectID=$objectID&path=" . $this->repo->encodePath($path) . "&revision=$revision&refresh=1"), "<i class='icon icon-refresh'></i> " . $lang->refresh, '', "class='btn btn-primary' data-app={$app->tab}");?>
<?php if($repo->SCM == 'Gitlab' and common::hasPriv('gitlab', 'createBranch')) echo html::a($this->createLink('gitlab', 'createBranch', "gitlabID={$repo->gitlab}&projectID={$repo->project}"), "<i class='icon icon-sm icon-plus'></i> " . $lang->gitlab->createBranch, '', "class='btn btn-primary'");?>
</div> </div>
</div> </div>
<div id="mainContent" class="main-row fade"> <div id="mainContent" class="main-row fade">
+1 -1
View File
@@ -55,9 +55,9 @@
common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit'); common::printIcon('repo', 'edit', "repoID=$repo->id&objectID=$objectID", '', 'list', 'edit');
if(strtolower($repo->SCM) == "gitlab") if(strtolower($repo->SCM) == "gitlab")
{ {
common::printIcon('gitlab', 'manageProjectMembers', "repo={$repo->id}", '', 'list', 'team');
common::printIcon('gitlab', 'createWebhook', "repoID=$repo->id", '', 'list', 'change', 'hiddenwin'); common::printIcon('gitlab', 'createWebhook', "repoID=$repo->id", '', 'list', 'change', 'hiddenwin');
common::printIcon('gitlab', 'importIssue', "repo={$repo->id}", '', 'list', 'link'); common::printIcon('gitlab', 'importIssue', "repo={$repo->id}", '', 'list', 'link');
common::printIcon('gitlab', 'manageProjectMembers', "repo={$repo->id}", '', 'list', 'team');
} }
common::printIcon('repo', 'delete', "repoID=$repo->id&objectID=$objectID", '', 'list', 'trash', 'hiddenwin'); common::printIcon('repo', 'delete', "repoID=$repo->id&objectID=$objectID", '', 'list', 'trash', 'hiddenwin');
?> ?>
+32
View File
@@ -0,0 +1,32 @@
title: zt_mr
author: Yidong Wang
version: "1.0"
fields:
- field: id
range: 1
- field: gitlabID
range: 1
- field: sourceProject
range: 42
- field: sourceBranch
range: branch-08
- field: targetProject
range: 42
- field: targetBranch
range: master
- field: mriid
range: 19
- field: title
range: Test MR
- field: status
range: opened
- field: mergeStatus
range: can_be_merged
- field: repoID
range: 1
- field: jobID
range: 0
- field: compileID
range: 0
- field: deleted
range: 0
+26
View File
@@ -0,0 +1,26 @@
title: zt_pipeline
author: Zeng gang
version: "1.0"
fields:
- field: id
range: 1
- field: type
range: gitlab
- field: name
range: gitlab服务器
- field: url
range: [http://192.168.1.161:51080]
- field: account
range: []
- field: password
range: []
- field: token
range: x88fZokrp5hShia2jyBN
- field: private
range: 08bcc98f75d7d40053dc80722bdc117b
- field: createdBy
range: admin
- field: createdDate
range: [2021-12-09 11:23:35]
- field: deleted
range: 0
+20
View File
@@ -0,0 +1,20 @@
title: zt_repo
author: Yidong Wang
version: "1.0"
fields:
- field: id
range: 1
- field: product
range: 1
- field: name
range: 723test
- field: path
range: 42
- field: SCM
range: Gitlab
- field: client
range: 1
- field: extra
range: 42
- field: deleted
range: 0
+4
View File
@@ -29,3 +29,7 @@ $builder->projectProduct = array('rows' => 21, 'data' => array('projectproduct'
$builder->case = array('rows' => 10000, 'data' => array('case')); $builder->case = array('rows' => 10000, 'data' => array('case'));
$builder->bug = array('rows' => 100, 'data' => array('bug')); $builder->bug = array('rows' => 100, 'data' => array('bug'));
$builder->pipeline = array('rows' => 1, 'data' => array('pipeline'));
$builder->repo = array('rows' => 1, 'data' => array('repo'));
$builder->mr = array('rows' => 1, 'data' => array('mr'));
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiCreateBranch();
cid=1
pid=1
使用空的gitlabID、projectID、分支对象创建GitLab分支 >> return false
使用空的gitlabID、projectID,正确的分支对象创建GitLab分支 >> return null
使用正确的gitlabID、分支信息,错误的projectID创建分支 >> 404 Project Not Found
使用正确的gitlabID,projectID,分支对象创建GitLab分支 >> test_branch17
使用重复的分支信息创建分支 >> Branch already exists
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$branch = new stdclass();
$result = $gitlab->apiCreateBranch($gitlabID, $projectID, $branch);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,分支对象创建GitLab分支
$branch->branch = 'test_branch17';
$branch->ref = 'master';
$result = $gitlab->apiCreateBranch($gitlabID, $projectID, $branch);
if($result === null) $result = 'return null';
r($result) && p() && e('return false'); //使用空的gitlabID、projectID,正确的分支对象创建GitLab分支
$gitlabID = 1;
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、分支信息,错误的projectID创建分支
$projectID = 1555;
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('name') && e($branch->branch); //通过gitlabID,projectID,分支对象正确创建GitLab分支
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('message') && e('Branch already exists'); //使用重复的分支信息创建分支
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiCreateBranchPriv();
cid=1
pid=1
使用空的gitlabID、projectID、保护分支对象创建GitLab保护分支 >> return false
使用空的gitlabID、projectID,正确的保护分支对象创建GitLab保护分支 >> return null
使用正确的gitlabID、保护分支信息,错误的projectID创建保护分支 >> 404 Project Not Found
使用正确的gitlabID,projectID,保护分支对象创建GitLab保护分支 >> master
使用重复的保护分支信息创建保护分支 >> Protected branch 'master' already exists
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$branch = new stdclass();
$result = $gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,保护分支对象创建GitLab保护分支
$branch->name = 'master';
$branch->merge_access_level = '40';
$branch->push_access_level = '40';
$result = $gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch);
if($result === null) $result = 'return null';
r($result) && p() && e('return false'); //使用空的gitlabID、projectID,正确的保护分支对象创建GitLab保护分支
$gitlabID = 1;
r($gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch)) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、保护分支信息,错误的projectID创建保护分支
$projectID = 966;
r($gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch)) && p('name') && e($branch->name); //通过gitlabID,projectID,保护分支对象正确创建GitLab保护分支
r($gitlab->apiCreateBranchPriv($gitlabID, $projectID, $branch)) && p('message') && e("Protected branch 'master' already exists"); //使用重复的保护分支信息创建保护分支
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiDeleteBranchPriv();
cid=1
pid=1
使用空的gitlabID、projectID、保护分支删除保护分支 >> return false
使用正确的gitlabID、保护分支信息,错误的projectID删除保护分支 >> 404 Project Not Found
使用正确的gitlabID,projectID,保护分支删除保护分支 >> return true
使用错误的保护分支信息删除保护分支 >> 404 Not found
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$branch = '';
$result = $gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,分支名称删除保护分支
$gitlabID = 1;
$branch = 'master';
$result = $gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
r($result) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、保护分支信息,错误的projectID删除保护分支
$projectID = 1565;
$result = $gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
if(!$result or substr($result->message, 0, 2) == '20') $result = 'return true';
r($result) && p() && e('return true'); //通过gitlabID,projectID,分支名称正确删除保护分支
$branch = 'masters';
$result = $gitlab->apiDeleteBranchPriv($gitlabID, $projectID, $branch);
r($result) && p('message') && e('404 Not found'); //使用错误的保护分支信息删除保护分支
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiGetBranches();
cid=1
pid=1
通过gitlabID,projectID,获取GitLab分支列表 >> branch1
通过gitlabID,projectID,获取GitLab分支数量 >> 3
当前项目没有分支时,获取GitLab分支列表 >> 0
当gitlabID存在,projectID不存在时,获取GitLab分支列表 >> 404 Project Not Found
当gitlabID,projectID都为0时,获取GitLab分支列表 >> return empty
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 1;
$projectID = 1552;
$result = $gitlab->apiGetBranches($gitlabID, $projectID);
r($result) && p('0:name') && e('branch1'); //通过gitlabID,projectID,获取GitLab分支列表
r(count($result)) && p() && e(3); //通过gitlabID,projectID,获取GitLab分支数量
$gitlabID = 1;
$projectID = 1570;
r(count($gitlab->apiGetBranches($gitlabID, $projectID))) && p() && e(0); //当前项目没有分支时,获取GitLab分支列表
$gitlabID = 1;
$projectID = 0;
r($gitlab->apiGetBranches($gitlabID, $projectID)) && p('message') && e('404 Project Not Found'); //通过gitlabID,projectID,获取GitLab分支列表
$gitlabID = 0;
$projectID = 0;
$result = $gitlab->apiGetBranches($gitlabID, $projectID);
if(empty($result)) $result = 'return empty';
r($result) && p() && e('return empty'); //当gitlabID,projectID都为0时,获取GitLab分支列表
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiGetBranchPrivs();
cid=1
pid=1
获取指定项目下受保护分支列表 >> master
获取指定项目下受保护分支数量 >> 3
获取无保护分支的项目下受保护分支数量 >> 0
通过不存在projectID,获取受保护分支列表 >> 404 Project Not Found
当gitlabID,projectID都为0时,获取受保护分支列表 >> return empty
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 1;
$projectID = 961;
$keyword = '';
$orderBy = 'name_desc';
$result = $gitlab->apiGetBranchPrivs($gitlabID, $projectID, $keyword, $orderBy);
r($result) && p('master:name') && e('master'); //获取指定项目下受保护分支列表
r(count($result)) && p() && e(3); //获取指定项目下受保护分支数量
$projectID = 1572;
r(count($gitlab->apiGetBranchPrivs($gitlabID, $projectID))) && p() && e(0); //获取无保护分支的项目下受保护分支数量
$projectID = 0;
r($gitlab->apiGetBranchPrivs($gitlabID, $projectID)) && p('message') && e('404 Project Not Found'); //通过不存在projectID,获取受保护分支列表
$gitlabID = 0;
$projectID = 0;
$result = $gitlab->apiGetBranchPrivs($gitlabID, $projectID);
if(empty($result)) $result = 'return empty';
r($result) && p() && e('return empty'); //当gitlabID,projectID都为0时,获取受保护分支列表
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::apiGetSingleBranchPriv();
cid=1
pid=1
使用空的gitlabID、projectID、保护分支获取保护分支 >> return false
使用正确的gitlabID、保护分支信息,错误的projectID获取保护分支 >> 404 Project Not Found
使用正确的gitlabID,projectID,保护分支获取保护分支 >> master
使用错误的保护分支信息获取保护分支 >> 404 Not found
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$branch = '';
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,分支名称获取保护分支
$gitlabID = 1;
$branch = 'master';
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
r($result) && p('message') && e('404 Project Not Found'); //使用正确的gitlabID、保护分支信息,错误的projectID获取保护分支
$projectID = 1565;
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
r($result) && p('name') && e('master'); //通过gitlabID,projectID,分支名称正确获取保护分支
$branch = 'masters';
$result = $gitlab->apiGetSingleBranchPriv($gitlabID, $projectID, $branch);
r($result) && p('message') && e('404 Not found'); //使用错误的保护分支信息获取保护分支
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::checkAccessLevel();
cid=1
pid=1
使用空的权限信息查询 >> 40
使用只有维护者权限信息查询 >> 40
使用包含维护者和开发者权限信息查询 >> 30
使用包含禁止权限信息查询 >> 0
使用包含禁止权限信息的二维数组查询 >> 0
*/
$gitlab = $tester->loadModel('gitlab');
$accessLevels = array();
$result = $gitlab->checkAccessLevel($accessLevels);
r($result) && p() && e(40); //使用空的权限信息查询
$accessLevels[0] = new stdClass();
$accessLevels[0]->access_level = 40;
$accessLevels[0]->access_level_description = 'Maintainers';
r($gitlab->checkAccessLevel($accessLevels)) && p() && e(40); //使用只有维护者权限信息查询
$accessLevels[1] = new stdClass();
$accessLevels[1]->access_level = 30;
$accessLevels[1]->access_level_description = 'Developers + Maintainers';
r($gitlab->checkAccessLevel($accessLevels)) && p() && e(30); //使用包含维护者和开发者权限信息查询
$accessLevels[2] = new stdClass();
$accessLevels[2]->access_level = 0;
$accessLevels[2]->access_level_description = 'No one';
r($gitlab->checkAccessLevel($accessLevels)) && p() && e(0); //使用包含禁止权限信息查询
$accessLevelArray = array(
array(
'access_level' => 40,
'access_level_description' => 'Maintainers'
),
array(
'access_level' => 0,
'access_level_description' => 'No one'
)
);
r($gitlab->checkAccessLevel($accessLevelArray)) && p() && e(0); //使用包含禁止权限信息的二维数组查询
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::createBranch();
cid=1
pid=1
使用空的gitlabID、projectID、分支创建GitLab分支 >> return false
使用空的gitlabID、projectID,正确的分支创建GitLab分支 >> return false
使用正确的gitlabID、分支信息,错误的projectID创建分支 >> return false
使用正确的gitlabID,projectID,分支创建GitLab分支 >> return true
使用重复的分支信息创建分支 >> return false
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$result = $gitlab->createBranch($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,分支对象创建GitLab分支
dao::$errors = array();
$_POST['branch'] = 'test_branch17';
$_POST['ref'] = 'master';
$result = $gitlab->createBranch($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID、projectID,正确的分支对象创建GitLab分支
dao::$errors = array();
$gitlabID = 1;
$result = $gitlab->createBranch($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用正确的gitlabID、分支信息,错误的projectID创建分支
dao::$errors = array();
$projectID = 1555;
$result = $gitlab->createBranch($gitlabID, $projectID);
if($result === true) $result = 'return true';
r($result) && p() && e('return true'); //通过gitlabID,projectID,分支对象正确创建GitLab分支
$result = $gitlab->createBranch($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用重复的分支信息创建分支
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 gitlabModel::createBranchPriv();
cid=1
pid=1
使用空的gitlabID、projectID、保护分支创建GitLab保护分支 >> return false
使用空的gitlabID、projectID,正确的保护分支创建GitLab保护分支 >> return false
使用正确的gitlabID、保护分支信息,错误的projectID创建保护分支 >> return false
使用正确的gitlabID,projectID,保护分支创建GitLab保护分支 >> return true
使用重复的保护分支信息创建保护分支 >> return false
使用保护分支信息更新保护分支 >> return true
*/
$gitlab = $tester->loadModel('gitlab');
$gitlabID = 0;
$projectID = 0;
$result = $gitlab->createBranchPriv($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID,projectID,保护分支对象创建GitLab保护分支
dao::$errors = array();
$_POST['name'] = 'master';
$_POST['merge_access_level'] = '40';
$_POST['push_access_level'] = '40';
$result = $gitlab->createBranchPriv($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用空的gitlabID、projectID,正确的保护分支对象创建GitLab保护分支
dao::$errors = array();
$gitlabID = 1;
$result = $gitlab->createBranchPriv($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用正确的gitlabID、保护分支信息,错误的projectID创建保护分支
dao::$errors = array();
$projectID = 1565;
$result = $gitlab->createBranchPriv($gitlabID, $projectID);
if($result === true) $result = 'return true';
r($result) && p() && e('return true'); //通过gitlabID,projectID,保护分支对象正确创建GitLab保护分支
$result = $gitlab->createBranchPriv($gitlabID, $projectID);
if($result === false) $result = 'return false';
r($result) && p() && e('return false'); //使用重复的保护分支信息创建保护分支
dao::$errors = array();
$_POST['merge_access_level'] = '0';
$result = $gitlab->createBranchPriv($gitlabID, $projectID, $branch = 'master');
if($result === true) $result = 'return true';
r($result) && p() && e('return true'); //使用保护分支信息更新保护分支
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 mrModel::getDiffs();
cid=1
pid=1
使用空的MR >> return null
使用正确的MR >> return normal
*/
$mrModel = $tester->loadModel('mr');
$MR = '';
$result = $mrModel->getDiffs($MR);
if(empty($result)) $result = 'return null';
r($result) && p() && e('return null'); //使用空的MR
$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
$result = $mrModel->getDiffs($MR);
if(!empty($result))
{
$first = reset($result);
if(isset($first->fileName) and is_array($first->contents)) $result = 'return normal';
}
r($result) && p() && e('return normal'); //使用正确的MR
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 mrModel::getLastReviewInfo();
cid=1
pid=1
使用空的repoID >> return null
使用正确的repoID >> return normal
*/
$mrModel = $tester->loadModel('mr');
$repoID = 0;
$result = $mrModel->getLastReviewInfo($repoID);
if(empty($result)) $result = 'return null';
r($result) && p() && e('return null'); //使用空的repoID
$repo = $tester->dao->select('*')->from(TABLE_REPO)->orderBy('id_desc')->limit(1)->fetch();
$result = $mrModel->getLastReviewInfo($repo->id);
if(isset($result->bug) and isset($result->task)) $result = 'return normal';
r($result) && p() && e('return normal'); //使用正确的repoID
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 mrModel::getReview();
cid=1
pid=1
使用空的repoID, MRID, revision >> return null
使用正确的repoID, MRID >> return normal
使用正确的repoID, MRID, 错误的revision >> return null
*/
$mrModel = $tester->loadModel('mr');
$repoID = 0;
$MRID = 0;
$revision = '';
$result = $mrModel->getReview($repoID, $MRID, $revision);
if(empty($result)) $result = 'return null';
r($result) && p() && e('return null'); //使用空的repoID, MRID, revision
$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
$repoID = $MR->repoID;
$MRID = $MR->id;
$result = $mrModel->getReview($repoID, $MRID, $revision);
if(!empty($result))
{
$first = reset($result);
if(isset($first['bug']) or isset($first['task'])) $result = 'return normal';
}
r($result) && p() && e('return normal'); //使用正确的repoID, MRID
$revision = '123qwe';
$result = $mrModel->getReview($repoID, $MRID, $revision);
if(empty($result)) $result = 'return null';
r($result) && p() && e('return null'); //使用正确的repoID, MRID, 错误的revision
+44
View File
@@ -0,0 +1,44 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 mrModel::saveBug();
cid=1
pid=1
使用空的repoID, MRID >> return false
使用正确的repoID, MRID。空的title。 >> return false
使用正确的repoID, MRID。POST数据正确。 >> Test Bug Review
*/
$mrModel = $tester->loadModel('mr');
$_POST = array();
$_POST['title'] = 'Test Bug Review';
$_POST['commentText'] = 'Test Bug Review';
$_POST['module'] = '1';
$_POST['begin'] = '8';
$_POST['end'] = '8';
$_POST['product'] = '1';
$_POST['assignedTo'] = '';
$repoID = 0;
$MRID = 0;
$v1 = 0;
$v2 = '';
$result = $mrModel->saveBug($repoID, $MRID, $v1, $v2);
if($result['result'] == 'fail' and isset($result['message']['mr']) and isset($result['message']['repo'])) $result = 'return false';
r($result) && p() && e('return false'); //使用空的repoID, MRID
$_POST['title'] = '';
$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
$result = $mrModel->saveBug($MR->repoID, $MR->id, $v1, $v2);
if($result['result'] == 'fail' and isset($result['message']['title'])) $result = 'return false';
r($result) && p() && e('return false'); //使用正确的repoID, MRID。空的title。
$_POST['title'] = 'Test Bug Review';
$result = $mrModel->saveBug($MR->repoID, $MR->id, $v1, $v2);
r($result) && p('title') && e('Test Bug Review'); //使用正确的repoID, MRID。POST数据正确。
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
/**
title=测试 mrModel::saveTask();
cid=1
pid=1
使用空的repoID, MRID >> return false
使用正确的repoID, MRID。空的title。 >> return false
使用正确的repoID, MRID。POST数据正确。 >> Test Task Review
*/
$mrModel = $tester->loadModel('mr');
$_POST = array();
$_POST['title'] = 'Test Task Review';
$_POST['commentText'] = 'Test Task Review';
$_POST['taskModule'] = '1';
$_POST['taskExecution'] = '1';
$_POST['begin'] = '8';
$_POST['end'] = '8';
$_POST['taskAssignedTo'] = '';
$_POST['entry'] = '';
$repoID = 0;
$MRID = 0;
$v1 = 0;
$v2 = '';
$result = $mrModel->saveTask($repoID, $MRID, $v1, $v2);
if($result['result'] == 'fail' and isset($result['message']['mr']) and isset($result['message']['repo'])) $result = 'return false';
r($result) && p() && e('return false'); //使用空的repoID, MRID
$_POST['title'] = '';
$MR = $tester->dao->select('*')->from(TABLE_MR)->orderBy('id_desc')->limit(1)->fetch();
$result = $mrModel->saveTask($MR->repoID, $MR->id, $v1, $v2);
if($result['result'] == 'fail' and isset($result['message']['name'])) $result = 'return false';
r($result) && p() && e('return false'); //使用正确的repoID, MRID。空的title。
$_POST['title'] = 'Test Task Review';
$result = $mrModel->saveTask($MR->repoID, $MR->id, $v1, $v2);
r($result) && p('title') && e('Test Task Review'); //使用正确的repoID, MRID。POST数据正确。
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.
Binary file not shown.