* Modify clone url.

This commit is contained in:
caoyanyi
2022-07-06 13:25:28 +08:00
parent a73673b993
commit 955b2f0d4c
9 changed files with 53 additions and 48 deletions
+15 -32
View File
@@ -497,7 +497,7 @@ class repo extends control
$this->view->pager = $pager;
$this->view->path = urldecode($path);
$this->view->logType = $logType;
$this->view->downloadUrl = $this->repo->getDownloadUrl($repoID);
$this->view->cloneUrl = $this->repo->getCloneUrl($repo);
$this->view->cacheTime = date('m-d H:i', filemtime($cacheFile));
$this->view->branchOrTag = $branchOrTag;
@@ -1295,37 +1295,20 @@ class repo extends control
echo html::select('execution', array('' => '') + $executions, '', 'class="form-control chosen"');
}
public function ajaxGetCodeUrl($repoID = 0, $branch = '')
/**
* Download zip code.
*
* @param int $repoID
* @param string $branch
* @access public
* @return void
*/
public function downloadCode($repoID = 0, $branch = '')
{
return <<<EOF
<div id='mainContent' class='main-row'>
<div class='main-col main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>下载代码</h2>
</div>
<form id='gitlabForm' method='post' class='form-ajax'>
<table class='table table-form'>
<tr>
<th>使用SSH克隆</th>
<td class='required'><?php echo html::input('name', '', "class='form-control' readonly");?></td>
</tr>
<tr>
<th>使用HTTPS克隆</th>
<td class='required'><?php echo html::input('url', '', "class='form-control' readonly");?></td>
</tr>
<tr>
<th></th>
<td class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
EOF;
$repo = $this->repo->getRepoByID($repoID);
if($repo->SCM == 'Gitlab')
{
return $this->loadModel('gitlab')->downloadCode($repo->gitlab, $repo->project);
}
}
}