* finish task #3383.

This commit is contained in:
wangyidong
2017-12-13 13:38:46 +08:00
parent 391ac047d9
commit 22f4518437
6 changed files with 50 additions and 8 deletions
+20 -3
View File
@@ -643,9 +643,8 @@ class gitModel extends model
{
foreach($actionFiles as $file)
{
$param = array('url' => helper::safe64Encode($repoRoot . $file), 'revision' => $log->revision);
$catLink = trim(html::a(helper::createLink('git', 'cat', $param, 'html'), 'view', '', "class='repolink'"));
$diffLink = trim(html::a(helper::createLink('git', 'diff', $param, 'html'), 'diff', '', "class='repolink'"));
$catLink = trim(html::a($this->buildURL('cat', $repoRoot . $file, $log->revision), 'view', '', "class='repolink'"));
$diffLink = trim(html::a($this->buildURL('diff', $repoRoot . $file, $log->revision), 'diff', '', "class='repolink'"));
$diff .= $action . " " . $file . " $catLink ";
$diff .= $action == 'M' ? "$diffLink\n" : "\n" ;
}
@@ -747,4 +746,22 @@ class gitModel extends model
{
echo helper::now() . " $log\n";
}
/**
* Build URL.
*
* @param string $methodName
* @param string $url
* @param int $revision
* @access public
* @return string
*/
public function buildURL($methodName, $url, $revision)
{
$buildedURL = helper::createLink('git', $methodName, "path=&revision=$revision", 'html');
$buildedURL .= strpos($buildURL, '?') === false ? '?' : '&';
$buildedURL .= 'repoUrl=' . helper::safe64Encode($url);
return $buildedURL;
}
}