* finish task #6918.
This commit is contained in:
@@ -77,8 +77,8 @@ $lang->testsuite->menuOrder = $lang->testcase->menuOrder;
|
||||
$lang->caselib->menuOrder = $lang->testcase->menuOrder;
|
||||
$lang->testreport->menuOrder = $lang->testcase->menuOrder;
|
||||
|
||||
$lang->ci->menuOrder[5] = 'browse';
|
||||
$lang->ci->menuOrder[10] = 'job';
|
||||
$lang->ci->menuOrder[5] = 'code';
|
||||
$lang->ci->menuOrder[10] = 'build';
|
||||
$lang->ci->menuOrder[20] = 'jenkins';
|
||||
$lang->ci->menuOrder[15] = 'maintain';
|
||||
$lang->ci->menuOrder[25] = 'match';
|
||||
|
||||
@@ -334,11 +334,11 @@ $lang->caselib->menu->caselib = array('link' => '用例库|caselib|browse|libI
|
||||
|
||||
$lang->ci = new stdclass();
|
||||
$lang->ci->menu = new stdclass();
|
||||
$lang->ci->menu->browse = array('link' =>'代码|repo|browse|repoID=%s', 'alias' => 'diff,view,revision,log,blame,showsynccomment');
|
||||
$lang->ci->menu->job = array('link' =>'构建|integration|browse', 'subModule' => 'compile,integration');
|
||||
$lang->ci->menu->jenkins = array('link' =>'Jenkins|jenkins|browse', 'alias' => 'create,edit');
|
||||
$lang->ci->menu->maintain = array('link' =>'版本库|repo|maintain', 'alias' => 'create,edit');
|
||||
$lang->ci->menu->match = array('link' =>'匹配设置|repo|setmatchcomment');
|
||||
$lang->ci->menu->code = array('link' => '代码|repo|browse|repoID=%s', 'alias' => 'diff,view,revision,log,blame,showsynccomment');
|
||||
$lang->ci->menu->build = array('link' => '构建|integration|browse', 'subModule' => 'compile,integration');
|
||||
$lang->ci->menu->jenkins = array('link' => 'Jenkins|jenkins|browse', 'alias' => 'create,edit');
|
||||
$lang->ci->menu->maintain = array('link' => '版本库|repo|maintain', 'alias' => 'create,edit');
|
||||
$lang->ci->menu->match = array('link' => '指令|repo|setmatchcomment');
|
||||
|
||||
$lang->repo = new stdclass();
|
||||
$lang->jenkins = new stdclass();
|
||||
|
||||
+70
-1
@@ -263,7 +263,76 @@ class repo extends control
|
||||
public function browse($repoID = 0, $path = '', $revision = 'HEAD', $refresh = 0)
|
||||
{
|
||||
if($this->get->path) $path = $this->get->path;
|
||||
$this->locate($this->repo->createLink('log', "repoID=$repoID&entry=&revision=$revision", empty($path) ? '' : "entry=$path"));
|
||||
if(empty($refresh) and $this->cookie->repoRefresh) $refresh = $this->cookie->repoRefresh;
|
||||
$this->repo->setMenu($this->repos, $repoID);
|
||||
$this->repo->setBackSession('list', $withOtherModule = true);
|
||||
if($repoID == 0) $repoID = $this->session->repoID;
|
||||
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
if(!$repo->synced) $this->locate($this->repo->createLink('showSyncComment', "repoID=$repoID"));
|
||||
|
||||
$path = $this->repo->decodePath($path);
|
||||
$cacheFile = $this->repo->getCacheFile($repoID, $path, $revision);
|
||||
$this->scm->setEngine($repo);
|
||||
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 8, 1);
|
||||
|
||||
/* Cache infos. */
|
||||
if($refresh or !$cacheFile or !file_exists($cacheFile) or (time() - filemtime($cacheFile)) / 60 > $this->config->repo->cacheTime)
|
||||
{
|
||||
$infos = $this->scm->ls($path, $revision);
|
||||
|
||||
if($infos and $repo->SCM == 'Subversion')
|
||||
{
|
||||
$revisionList = array();
|
||||
foreach($infos as $info) $revisionList[$info->revision] = $info->revision;
|
||||
$comments = $this->repo->getHistory($repoID, $revisionList);
|
||||
foreach($infos as $info)
|
||||
{
|
||||
if(isset($comments[$info->revision]))
|
||||
{
|
||||
$comment = $comments[$info->revision];
|
||||
$info->comment = $comment->comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($cacheFile)
|
||||
{
|
||||
if(!file_exists($cacheFile . '.lock'))
|
||||
{
|
||||
touch($cacheFile . '.lock');
|
||||
file_put_contents($cacheFile, serialize($infos));
|
||||
unlink($cacheFile . '.lock');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$infos = unserialize(file_get_contents($cacheFile));
|
||||
}
|
||||
if($refresh) $this->repo->updateLatestCommit($repo);
|
||||
if($this->cookie->repoRefresh) setcookie('repoRefresh', 0, 0, $this->config->webRoot);
|
||||
|
||||
$logType = 'dir';
|
||||
$revisions = $this->repo->getLogs($repo, $path, $revision, $logType, $pager);
|
||||
$commiters = $this->loadModel('user')->getCommiters();
|
||||
foreach($infos as $info) $info->committer = zget($commiters, $info->account, $info->account);
|
||||
foreach($revisions as $log) $log->committer = zget($commiters, $log->committer, $log->committer);
|
||||
|
||||
$this->view->title = $this->lang->repo->common;
|
||||
$this->view->repo = $repo;
|
||||
$this->view->revisions = $revisions;
|
||||
$this->view->revision = $revision;
|
||||
$this->view->infos = $infos;
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->path = urldecode($path);
|
||||
$this->view->logType = $logType;
|
||||
$this->view->cacheTime = date('m-d H:i', filemtime($cacheFile));
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
.panel.code > .content{border: 1px solid #ccc;}
|
||||
.blame{font-size:13px;}
|
||||
.blame thead{font-weight:bold; background:#ddd;}
|
||||
.blame td{border-left:1px solid #ccc;}
|
||||
.blame tr.topLine > td:first-child{border-left:none;}
|
||||
.blame .info{ background-color:#f7f7f7; vertical-align:top; padding:0px 4px}
|
||||
.topLine{border-top: 1px solid #ccc;}
|
||||
.topLine td.info{padding:8px 4px;}
|
||||
pre {margin-bottom:0px;display:block; white-space: pre-wrap; padding:0px 3px; border:0px; background:none;}
|
||||
.line{ font-weight: bold; border: 1px solid #E4E4E4; background-color: #ECECEC; text-align: right;}
|
||||
.panel-actions.pull-right{margin-top:-5px; }
|
||||
@@ -0,0 +1,2 @@
|
||||
#mainMenu > .btn-toolbar{height: 35px; line-height: 35px;}
|
||||
.btn-toolbar > .last-sync-time{display:inline-block; float:left; margin-right: 10px;}
|
||||
@@ -1 +0,0 @@
|
||||
#contentNav{display:none;}
|
||||
|
||||
@@ -455,6 +455,24 @@ class repoModel extends model
|
||||
return $revisions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get history.
|
||||
*
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getHistory($repoID, $revisions)
|
||||
{
|
||||
return $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
|
||||
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
|
||||
->where('t1.repo')->eq($repoID)
|
||||
->andWhere('t1.revision')->in($revisions)
|
||||
->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
|
||||
->fetchAll('revision');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get git revisionName.
|
||||
*
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<?php js::set('repoID', $repoID);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php
|
||||
echo html::backButton("<i class='icon icon-back icon-sm'></i>" . $lang->goback, '', 'btn btn-link');
|
||||
echo '<div class="divider"></div>';
|
||||
?>
|
||||
<div class="page-title">
|
||||
<strong>
|
||||
<?php
|
||||
@@ -36,7 +40,11 @@
|
||||
<ul class="nav nav-default">
|
||||
<?php $encodeEntry = $this->repo->encodePath($entry);?>
|
||||
<li><a><?php echo $lang->repo->log;?></a></li>
|
||||
<?php if($info->kind == 'file') echo '<li>' . html::a($this->repo->createLink('download', "repoID=$repoID&path=&fromRevision=$revision", "path=$encodeEntry"), $lang->repo->download, 'hiddenwin') . '</li>';?>
|
||||
<li><?php echo html::a($this->repo->createLink('view', "repoID=$repoID&entry=&revision=$revision", "entry=$encodeEntry"), $lang->repo->view);?></li>
|
||||
<?php if($info->kind == 'file'):?>
|
||||
<li><?php echo html::a($this->repo->createLink('blame', "repoID=$repoID&entry=&revision=$revision", "entry=$encodeEntry"), $lang->repo->blame);?></li>
|
||||
<li><?php echo html::a($this->repo->createLink('download', "repoID=$repoID&path=&fromRevision=$revision", "path=$encodeEntry"), $lang->repo->download, 'hiddenwin');?></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
</nav>
|
||||
<form id='logForm' class='main-table' data-ride='table' action='<?php echo $this->repo->createLink('diff', "repoID=$repoID", "entry=" . $this->repo->encodePath($entry))?>' method='post'>
|
||||
|
||||
Reference in New Issue
Block a user