Merge branch 'cyy_bug' into 'zenops_44'
Cyy bug See merge request easycorp/zentaopms!5187
This commit is contained in:
@@ -263,7 +263,7 @@ class repo extends control
|
||||
{
|
||||
$file = $entry;
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
$entry = $this->repo->decodePath($entry);
|
||||
$entry = urldecode($this->repo->decodePath($entry));
|
||||
$revision = str_replace('*', '-', $revision);
|
||||
|
||||
$this->scm->setEngine($repo);
|
||||
@@ -303,9 +303,10 @@ class repo extends control
|
||||
$this->view->entry = $entry;
|
||||
$this->view->path = $entry;
|
||||
$this->view->suffix = $suffix;
|
||||
$this->view->content = $content;
|
||||
$this->view->content = $content ? $content : '';
|
||||
$this->view->pathInfo = $pathInfo;
|
||||
$this->view->blames = $blames;
|
||||
$this->view->blames = $blames ? $blames : array();
|
||||
$this->view->showEditor = (strpos($this->config->repo->images, "|$suffix|") === false and $suffix != 'binary') ? true : false;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1786,8 +1787,9 @@ class repo extends control
|
||||
*/
|
||||
public function ajaxGetFileTree($repoID, $branch = '')
|
||||
{
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
$files = $this->repo->getFileTree($repo, $branch);
|
||||
$branch = base64_decode($branch);
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
$files = $this->repo->getFileTree($repo, $branch);
|
||||
return print($files);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,3 +16,7 @@
|
||||
#related .content, #related .btn {background-color: #F4F5F7; border: none;}
|
||||
#related .nav-tabs > li.active > a:before {background: none; height: 0;}
|
||||
#related .table-empty-tip {padding: 35px 10px;}
|
||||
.repoCode .binary a .icon-download {font-size: 50px;}
|
||||
.repoCode .binary, .repoCode .image {text-align: center;}
|
||||
.repoCode .binary a {margin: 100px 0px; display: block;}
|
||||
.repoCode .image {margin-top: 10px;}
|
||||
|
||||
@@ -74,6 +74,8 @@ var distance = 0;
|
||||
*/
|
||||
function arrowTabs(domID, shift, hideRightBtn)
|
||||
{
|
||||
if($('#' + domID).html() == '') return;
|
||||
|
||||
$('.btn-right, .btn-left').show();
|
||||
if(hideRightBtn) $('.btn-right').hide();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ $(function()
|
||||
*/
|
||||
function createTab(filename, filepath)
|
||||
{
|
||||
$('[data-path="' + filepath + '"]').closest('li').addClass('selected');
|
||||
$('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected');
|
||||
var tabID = Base64.encode(filepath).replaceAll('=', '-');
|
||||
return {
|
||||
title: filename,
|
||||
@@ -40,7 +40,7 @@ $(function()
|
||||
|
||||
$(document).on('click', '.repoFileName', function()
|
||||
{
|
||||
var path = $(this).data('path');
|
||||
var path = encodeURIComponent($(this).data('path'));
|
||||
var name = $(this).text();
|
||||
var $tabs = $('#fileTabs').data('zui.tabs');
|
||||
if(openedFiles.indexOf(path) == -1) openedFiles.push(path);
|
||||
@@ -52,7 +52,7 @@ $(function()
|
||||
|
||||
/* Remove file path for opened files. */
|
||||
$('#fileTabs').on('onClose', function(event, tab) {
|
||||
var filepath = Base64.decode(tab.id.replaceAll('-', '='));
|
||||
var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '=')));
|
||||
var index = openedFiles.indexOf(filepath);
|
||||
if(index > -1)
|
||||
{
|
||||
@@ -66,7 +66,7 @@ $(function()
|
||||
/* Append file path into the title. */
|
||||
$('#fileTabs').on('onLoad', function(event, tab) {
|
||||
var filepath = Base64.decode(tab.id.replaceAll('-', '='));
|
||||
$('#tab-nav-item-' + tab.id).attr('title', filepath);
|
||||
$('#tab-nav-item-' + tab.id).attr('title', decodeURIComponent(filepath));
|
||||
});
|
||||
|
||||
var link = createLink('repo', 'ajaxGetBranchesAndTags', 'repoID=' + repoID + '&oldRevision=' + branchID);
|
||||
@@ -87,7 +87,7 @@ $(function()
|
||||
*/
|
||||
function refreshFiles(branchOrTag)
|
||||
{
|
||||
var link = createLink('repo', 'ajaxGetFileTree', 'repoID=' + repoID + '&branch=' + branchOrTag);
|
||||
var link = createLink('repo', 'ajaxGetFileTree', 'repoID=' + repoID + '&branch=' + Base64.encode(branchOrTag));
|
||||
$.get(link, function(data)
|
||||
{
|
||||
$('#modules').remove();
|
||||
|
||||
@@ -26,7 +26,7 @@ $lang->repo->branch = '分支';
|
||||
$lang->repo->tag = '标签';
|
||||
$lang->repo->addWebHook = '添加Webhook';
|
||||
$lang->repo->apiGetRepoByUrl = '接口:通过URL获取代码库';
|
||||
$lang->repo->blamTmpl = '%time 由%name提交%version %comment';
|
||||
$lang->repo->blamTmpl = '%time 由 %name 提交 %version %comment';
|
||||
$lang->repo->notRelated = '暂时没有关联禅道对象';
|
||||
|
||||
$lang->repo->browseAction = '浏览代码库';
|
||||
|
||||
@@ -13,11 +13,15 @@ include '../../common/view/header.lite.html.php';
|
||||
js::set('jsRoot', $jsRoot);
|
||||
js::set('clientLang', $app->clientLang);
|
||||
js::set('fileExt', $this->config->repo->fileExt);
|
||||
js::set('codeContent', trim($content));
|
||||
js::set('file', $pathInfo);
|
||||
js::set('blames', $blames);
|
||||
js::set('blameTmpl', $lang->repo->blamTmpl);
|
||||
js::set('repoID', $repoID);
|
||||
js::set('showEditor', $showEditor);
|
||||
if($showEditor)
|
||||
{
|
||||
js::set('codeContent', trim($content));
|
||||
js::set('blames', $blames);
|
||||
}
|
||||
js::import($jsRoot . '/zui/tabs/tabs.min.js');
|
||||
js::import($jsRoot . 'monaco-editor/min/vs/loader.js');
|
||||
$canLinkStory = common::hasPriv('repo', 'linkStory');
|
||||
@@ -25,8 +29,14 @@ $canLinkBug = common::hasPriv('repo', 'linkBug');
|
||||
$canLinkTask = common::hasPriv('repo', 'linkTask');
|
||||
$canUnlinkObject = common::hasPriv('repo', 'unlinkObject');
|
||||
?>
|
||||
<div id="monacoEditor">
|
||||
<div id="monacoEditor" class='repoCode'>
|
||||
<?php if(strpos($config->repo->images, "|$suffix|") !== false):?>
|
||||
<div class='image'><img src='data:image/<?php echo $suffix?>;base64,<?php echo $content?>' /></div>
|
||||
<?php elseif($suffix == 'binary'):?>
|
||||
<div class='binary'><?php echo html::a($this->repo->createLink('download', "repoID=$repoID&path=" . $this->repo->encodePath($entry) . "&fromRevision=$revision"), "<i class='icon-download'></i>", 'hiddenwin', "title='{$lang->repo->download}'"); ?></div>
|
||||
<?php else:?>
|
||||
<div id="codeContainer"></div>
|
||||
<?php endif;?>
|
||||
<div id="log">
|
||||
<div class="tip"></div>
|
||||
<div class="history"></div>
|
||||
@@ -149,59 +159,62 @@ $(function()
|
||||
$('.btn-left').click(function() {arrowTabs('relationTabs', 1);});
|
||||
$('.btn-right').click(function() {arrowTabs('relationTabs', -2);});
|
||||
|
||||
require.config({
|
||||
paths: {vs: jsRoot + 'monaco-editor/min/vs'},
|
||||
'vs/nls': {
|
||||
availableLanguages: {
|
||||
'*': clientLang
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(['vs/editor/editor.main'], function ()
|
||||
if(showEditor)
|
||||
{
|
||||
var lang = 'php';
|
||||
$.each(fileExt, function(langName, ext)
|
||||
{
|
||||
if(ext.indexOf('.' + file.extension) !== -1) lang = langName;
|
||||
});
|
||||
|
||||
var editor = monaco.editor.create(document.getElementById('codeContainer'),
|
||||
{
|
||||
autoIndent: true,
|
||||
value: codeContent,
|
||||
language: lang,
|
||||
contextmenu: true,
|
||||
EditorMinimapOptions: {
|
||||
enabled: false
|
||||
},
|
||||
readOnly: true,
|
||||
automaticLayout: true
|
||||
});
|
||||
|
||||
editor.onMouseDown(function(obj)
|
||||
{
|
||||
var line = obj.target.position.lineNumber;
|
||||
|
||||
var blame = blames[line];
|
||||
var p_line = parseInt(line);
|
||||
while(!blame.revision)
|
||||
{
|
||||
p_line--;
|
||||
blame = blames[p_line];
|
||||
require.config({
|
||||
paths: {vs: jsRoot + 'monaco-editor/min/vs'},
|
||||
'vs/nls': {
|
||||
availableLanguages: {
|
||||
'*': clientLang
|
||||
}
|
||||
}
|
||||
if($('#log').data('line') == p_line) return;
|
||||
});
|
||||
|
||||
var time = blame.time != 'unknown' ? blame.time : '';
|
||||
var user = blame.committer != 'unknown' ? blame.committer : '';
|
||||
var version = blame.revision.toString().substring(0, 10);
|
||||
var content = blameTmpl.replace('%time', time).replace('%name', user).replace('%version', version).replace('%comment', blame.message);
|
||||
$('.history').text(content);
|
||||
$('#log').data('line', p_line);
|
||||
$('#log').css('display', 'flex');
|
||||
getRelation(blame.revision);
|
||||
})
|
||||
});
|
||||
require(['vs/editor/editor.main'], function ()
|
||||
{
|
||||
var lang = 'php';
|
||||
$.each(fileExt, function(langName, ext)
|
||||
{
|
||||
if(ext.indexOf('.' + file.extension) !== -1) lang = langName;
|
||||
});
|
||||
|
||||
var editor = monaco.editor.create(document.getElementById('codeContainer'),
|
||||
{
|
||||
autoIndent: true,
|
||||
value: codeContent,
|
||||
language: lang,
|
||||
contextmenu: true,
|
||||
EditorMinimapOptions: {
|
||||
enabled: false
|
||||
},
|
||||
readOnly: true,
|
||||
automaticLayout: true
|
||||
});
|
||||
|
||||
editor.onMouseDown(function(obj)
|
||||
{
|
||||
var line = obj.target.position.lineNumber;
|
||||
|
||||
var blame = blames[line];
|
||||
var p_line = parseInt(line);
|
||||
while(!blame.revision)
|
||||
{
|
||||
p_line--;
|
||||
blame = blames[p_line];
|
||||
}
|
||||
if($('#log').data('line') == p_line) return;
|
||||
|
||||
var time = blame.time != 'unknown' ? blame.time : '';
|
||||
var user = blame.committer != 'unknown' ? blame.committer : '';
|
||||
var version = blame.revision.toString().substring(0, 10);
|
||||
var content = blameTmpl.replace('%time', time).replace('%name', user).replace('%version', version).replace('%comment', blame.message);
|
||||
$('.history').text(content);
|
||||
$('#log').data('line', p_line);
|
||||
$('#log').css('display', 'flex');
|
||||
getRelation(blame.revision);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
$('#linkStory a, #linkBug a, #linkTask a').on('click', function()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user