enhanced the revision view
This commit is contained in:
parent
ba54c57e34
commit
2d6aa1c4bc
@ -77,7 +77,7 @@ class Source extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
function file ($projectid, $path, $rev = SVN_REVISION_HEAD)
|
||||
function file ($projectid, $path = '', $rev = SVN_REVISION_HEAD)
|
||||
{
|
||||
$this->load->model ('ProjectModel', 'projects');
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
@ -88,6 +88,7 @@ class Source extends Controller
|
||||
$data['login'] = $login;
|
||||
|
||||
$path = $this->converter->HexToAscii ($path);
|
||||
if ($path == '.') $path = ''; /* treat a period specially */
|
||||
|
||||
$project = $this->projects->get ($projectid);
|
||||
if ($project === FALSE)
|
||||
@ -163,6 +164,7 @@ class Source extends Controller
|
||||
$data['login'] = $login;
|
||||
|
||||
$path = $this->converter->HexToAscii ($path);
|
||||
if ($path == '.') $path = ''; /* treat a period specially */
|
||||
|
||||
$project = $this->projects->get ($projectid);
|
||||
if ($project === FALSE)
|
||||
@ -248,13 +250,19 @@ class Source extends Controller
|
||||
//$data['folder'] = substr ($path, 0, strrpos($path, '/'));
|
||||
$data['folder'] = $path;
|
||||
$data['file'] = $file;
|
||||
|
||||
$data['revision'] = $rev;
|
||||
$data['prev_revision'] =
|
||||
$this->subversion->getPrevRev ($projectid, $path, $rev);
|
||||
$data['next_revision'] =
|
||||
$this->subversion->getNextRev ($projectid, $path, $rev);
|
||||
|
||||
$this->load->view ($this->VIEW_HISTORY, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function revision ($projectid, $path, $rev)
|
||||
function revision ($type, $projectid, $path, $rev = SVN_REVISION_HEAD)
|
||||
{
|
||||
$this->load->model ('ProjectModel', 'projects');
|
||||
$this->load->model ('SubversionModel', 'subversion');
|
||||
@ -280,7 +288,7 @@ class Source extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = $this->subversion->getRevisionHistory ($projectid, $path, $rev);
|
||||
$file = $this->subversion->getRevHistory ($projectid, $path, $rev);
|
||||
if ($file === FALSE)
|
||||
{
|
||||
$data['message'] = 'Failed to get log content';
|
||||
@ -288,11 +296,18 @@ class Source extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['type'] = $type;
|
||||
$data['project'] = $project;
|
||||
//$data['folder'] = substr ($path, 0, strrpos($path, '/'));
|
||||
$data['folder'] = $path;
|
||||
$data['file'] = $file;
|
||||
|
||||
$data['revision'] = $rev;
|
||||
$data['prev_revision'] =
|
||||
$this->subversion->getPrevRev ($projectid, $path, $rev);
|
||||
$data['next_revision'] =
|
||||
$this->subversion->getNextRev ($projectid, $path, $rev);
|
||||
|
||||
$this->load->view ($this->VIEW_REVISION, $data);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ $lang['Latest projects'] = 'Latest projects';
|
||||
$lang['Other projects'] = 'Other projects';
|
||||
$lang['Overview'] = 'Overview';
|
||||
$lang['Password'] = 'Password';
|
||||
$lang['Path'] = 'Path';
|
||||
$lang['Project'] = 'Project';
|
||||
$lang['Projects'] = 'Projects';
|
||||
$lang['Repository'] = 'Repository';
|
||||
|
@ -31,6 +31,7 @@ $lang['Latest projects'] = 'Proyek terakhir';
|
||||
$lang['Other projects'] = 'Proyek lain';
|
||||
$lang['Overview'] = 'Ringkasan';
|
||||
$lang['Password'] = 'Kata sandi';
|
||||
$lang['Path'] = 'Path';
|
||||
$lang['Project'] = 'Proyek';
|
||||
$lang['Projects'] = 'Proyek';
|
||||
$lang['Repository'] = 'Repository';
|
||||
|
@ -8,7 +8,7 @@ $lang['Delete'] = '삭제';
|
||||
$lang['Description'] = '설명';
|
||||
$lang['Details'] = '상세내역';
|
||||
$lang['Difference'] = '차이점';
|
||||
$lang['Directory'] = '파일목록';
|
||||
$lang['Directory'] = '디렉토리';
|
||||
$lang['Download'] = '내려받기';
|
||||
$lang['Edit'] = '수정';
|
||||
$lang['Head revision'] = '최신리비전';
|
||||
@ -31,6 +31,7 @@ $lang['Latest projects'] = '최근 프로젝트';
|
||||
$lang['Other projects'] = '다른 프로젝트';
|
||||
$lang['Overview'] = '개요';
|
||||
$lang['Password'] = '패스워드';
|
||||
$lang['Path'] = '경로';
|
||||
$lang['Project'] = '프로젝트';
|
||||
$lang['Projects'] = '프로젝트';
|
||||
$lang['Repository'] = '저장소';
|
||||
|
@ -10,7 +10,7 @@ class SubversionModel extends Model
|
||||
function getList ($projectid, $subdir = '', $rev = SVN_REVISION_HEAD, $recurse = FALSE)
|
||||
{
|
||||
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid;
|
||||
if ($subdir != '') $path .= '/' . $subdir;
|
||||
if ($subdir != '') $path .= "/{$subdir}";
|
||||
|
||||
$list = @svn_ls ($path, $rev, $recurse);
|
||||
if ($list === FALSE) return FALSE;
|
||||
@ -26,6 +26,8 @@ class SubversionModel extends Model
|
||||
if ($info === FALSE) return FALSE;
|
||||
|
||||
$last = substr(strrchr($path, '/'), 1);
|
||||
if ($last === FALSE) $last = '';
|
||||
|
||||
if (array_key_exists ($last, $info) === FALSE) return FALSE;
|
||||
$fileinfo = $info[$last];
|
||||
|
||||
@ -44,6 +46,8 @@ class SubversionModel extends Model
|
||||
if ($info === FALSE) return FALSE;
|
||||
|
||||
$last = substr(strrchr($path, '/'), 1);
|
||||
if ($last === FALSE) $last = '';
|
||||
|
||||
if (array_key_exists ($last, $info) === FALSE) return FALSE;
|
||||
$fileinfo = $info[$last];
|
||||
|
||||
@ -59,6 +63,8 @@ class SubversionModel extends Model
|
||||
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
|
||||
|
||||
$last = substr(strrchr($path, '/'), 1);
|
||||
if ($last === FALSE) $last = '';
|
||||
|
||||
$info['name'] = $last;
|
||||
$fileinfo = $info;
|
||||
|
||||
@ -69,11 +75,13 @@ class SubversionModel extends Model
|
||||
return $fileinfo;
|
||||
}
|
||||
|
||||
function getRevisionHistory ($projectid, $file, $rev)
|
||||
function getRevHistory ($projectid, $file, $rev)
|
||||
{
|
||||
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
|
||||
|
||||
$last = substr(strrchr($path, '/'), 1);
|
||||
if ($last === FALSE) $last = '';
|
||||
|
||||
$info['name'] = $last;
|
||||
$fileinfo = $info;
|
||||
|
||||
@ -334,6 +342,8 @@ class SubversionModel extends Model
|
||||
if ($info === FALSE) return FALSE;
|
||||
|
||||
$last = substr(strrchr($path, '/'), 1);
|
||||
if ($last === FALSE) $last = '';
|
||||
|
||||
if (array_key_exists ($last, $info) === FALSE) return FALSE;
|
||||
$fileinfo = $info[$last];
|
||||
|
||||
|
@ -134,9 +134,8 @@ for ($i = 0; $i < $len; $i++)
|
||||
$rev = $line['rev'];
|
||||
$rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT);
|
||||
|
||||
$par = $folder . '/' . $file['name'];
|
||||
$par = $this->converter->AsciiTohex ($par);
|
||||
$rev_padded = anchor ('/source/blame/' . $project->id . '/' . $par . '/' . $rev, $rev_padded);
|
||||
$par = $this->converter->AsciiTohex ("{$folder}/{$file['name']}");
|
||||
$rev_padded = anchor ("/source/blame/{$project->id}/{$par}/{$rev}", $rev_padded);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -154,9 +153,9 @@ for ($i = 0; $i < $len; $i++)
|
||||
$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
|
||||
}
|
||||
|
||||
print '<span class="nocode">' . $rev_padded . ' </span> ';
|
||||
print '<span class="nocode">' . $author_padded . ' </span> ';
|
||||
print '<span class="nocode">' . $lineno_padded . ' </span> ';
|
||||
print "<span class='nocode'>{$rev_padded}</span>";
|
||||
print "<span class='nocode' title='{$author}'>{$author_padded}</span>";
|
||||
print "<span class='nocode'>{$lineno_padded}</span>";
|
||||
print htmlspecialchars ($line['line']);
|
||||
print "\n";
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ if ($type == 'folder')
|
||||
{
|
||||
$par = $this->converter->AsciiTohex ($folder);
|
||||
$xpar = "source/folder/{$project->id}/{$par}";
|
||||
print anchor ($xpar, $this->lang->line('Directory'));
|
||||
print anchor ($xpar, $this->lang->line('Folder'));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -107,10 +107,13 @@ else
|
||||
|
||||
print '<td>';
|
||||
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
|
||||
/*
|
||||
if ($type == 'folder')
|
||||
print anchor ("/source/revision/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||
print anchor ("/source/revision/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||
else
|
||||
print anchor ("/source/$type/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||
print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||
*/
|
||||
print $h['rev'];
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
@ -129,14 +132,20 @@ else
|
||||
print '<td>';
|
||||
if ($type == 'folder')
|
||||
{
|
||||
print anchor ("/source/revision/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||
$this->lang->line('Details'));
|
||||
print ' ';
|
||||
print anchor ("/source/folder/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||
$this->lang->line('Directory'));
|
||||
$this->lang->line('Folder'));
|
||||
}
|
||||
else
|
||||
{
|
||||
print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||
$this->lang->line('Details'));
|
||||
print ' ';
|
||||
print anchor ("/source/blame/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||
$this->lang->line('Blame'));
|
||||
print ' | ';
|
||||
print ' ';
|
||||
print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||
$this->lang->line('Difference'));
|
||||
}
|
||||
|
@ -29,18 +29,13 @@ $this->load->view (
|
||||
|
||||
<!---------------------------------------------------------------------------->
|
||||
|
||||
<div class="sidebar" id="project_source_revision_sidebar">
|
||||
</div> <!-- project_source_revision_sidebar -->
|
||||
|
||||
<!---------------------------------------------------------------------------->
|
||||
|
||||
|
||||
<div class="mainarea" id="project_source_revision_mainarea">
|
||||
|
||||
<?php
|
||||
$history = $file['history'];
|
||||
?>
|
||||
|
||||
<!--
|
||||
<div class="sidebar" id="project_source_revision_mainarea_sidebar">
|
||||
<div class="box">
|
||||
<ul>
|
||||
@ -51,6 +46,7 @@ $history = $file['history'];
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="title" id="project_source_revision_mainarea_title">
|
||||
<?php
|
||||
@ -64,14 +60,14 @@ function print_path ($project, $path, $rev, $converter)
|
||||
$par .= '/' . $exps[$i];
|
||||
$hexpar = $converter->AsciiToHex ($par);
|
||||
print '/';
|
||||
$xpar = "source/revision/{$project->id}/{$hexpar}";
|
||||
$xpar = "source/revision/folder/{$project->id}/{$hexpar}";
|
||||
if ($rev != '') $xpar .= "/{$rev}";
|
||||
print anchor ($xpar, htmlspecialchars($exps[$i]));
|
||||
}
|
||||
}
|
||||
|
||||
$hexfolder = $this->converter->AsciiToHex('.');
|
||||
print anchor ("/source/revision/{$project->id}/{$hexfolder}/{$revision}", htmlspecialchars($project->name));
|
||||
print anchor ("/source/revision/folder/{$project->id}/{$hexfolder}/{$revision}", htmlspecialchars($project->name));
|
||||
if ($folder != '') print_path ($project, $folder, $revision, $this->converter);
|
||||
?>
|
||||
</div>
|
||||
@ -79,25 +75,65 @@ if ($folder != '') print_path ($project, $folder, $revision, $this->converter);
|
||||
<div class="menu" id="project_source_revision_mainarea_menu">
|
||||
<?php
|
||||
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
|
||||
$xpar = "source/history/file/{$project->id}/{$hexfolder}";
|
||||
print anchor ($xpar, $this->lang->line('History'));
|
||||
if ($revision > 0 && $revision < $next_revision)
|
||||
{
|
||||
print anchor ("source/revision/{$type}/{$project->id}/{$hexfolder}", $this->lang->line('Head revision'));
|
||||
print ' | ';
|
||||
}
|
||||
print anchor ("source/history/{$type}/{$project->id}/{$hexfolder}", $this->lang->line('History'));
|
||||
?>
|
||||
</div> <!-- project_source_revision_mainarea_menu -->
|
||||
|
||||
<div class="infostrip" id="project_source_revision_mainarea_infostrip">
|
||||
<?=anchor ("source/revision/{$type}/{$project->id}/${hexfolder}/{$prev_revision}", '<<')?>
|
||||
<?=$this->lang->line('Revision')?>: <?=$history['rev']?>
|
||||
<?=anchor ("source/revision/{$type}/{$project->id}/${hexfolder}/{$next_revision}", '>>')?> |
|
||||
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($history['author'])?> |
|
||||
<?=$this->lang->line('Last updated on')?>: <?=date('r', strtotime($history['date']))?>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="project_source_revision_mainarea_result">
|
||||
<table id="project_source_revision_mainarea_result_table">
|
||||
<?php
|
||||
print '<ul id="project_source_revision_mainarea_result_table_path_list">';
|
||||
print '<tr class="heading">';
|
||||
print '<th>' . $this->lang->line('Path') . '</th>';
|
||||
print '<th></th>';
|
||||
print '</tr>';
|
||||
|
||||
$rowclasses = array ('even', 'odd');
|
||||
$rowcount = 0;
|
||||
foreach ($history['paths'] as $p)
|
||||
{
|
||||
print '<li>';
|
||||
print '[';
|
||||
print $p['action'];
|
||||
print '] ';
|
||||
$rowclass = $rowclasses[++$rowcount % 2];
|
||||
print "<tr class='{$rowclass}'>";
|
||||
|
||||
$hexpar = $this->converter->AsciiToHex ($p['path']);
|
||||
print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", htmlspecialchars($p['path']));
|
||||
print '</li>';
|
||||
|
||||
print "<td class='{$p['action']}'>";
|
||||
print htmlspecialchars($p['path']);
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
/*
|
||||
if ($type == 'folder')
|
||||
{
|
||||
print anchor ("source/folder/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Folder'));
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Details'));
|
||||
print ' ';
|
||||
print anchor ("source/blame/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Blame'));
|
||||
print ' ';
|
||||
print anchor ("source/diff/{$project->id}/{$hexpar}/{$history['rev']}", $this->lang->line('Difference'));
|
||||
/*
|
||||
}
|
||||
*/
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</ul>';
|
||||
?>
|
||||
</table>
|
||||
</div> <!-- project_source_revision_mainarea_body -->
|
||||
|
@ -53,8 +53,36 @@
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#project_source_revision_mainarea_result ul li {
|
||||
list-style: square;
|
||||
#project_source_revision_mainarea_result_table td.M {
|
||||
white-space: nowrap;
|
||||
background-image:url(images/page_white_edit.png);
|
||||
background-position:2px 50%;
|
||||
background-repeat:no-repeat;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
#project_source_revision_mainarea_result_table td.D {
|
||||
white-space: nowrap;
|
||||
background-image:url(images/page_white_delete.png);
|
||||
background-position:2px 50%;
|
||||
background-repeat:no-repeat;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
#project_source_revision_mainarea_result_table td.A {
|
||||
white-space: nowrap;
|
||||
background-image:url(images/page_white_add.png);
|
||||
background-position:2px 50%;
|
||||
background-repeat:no-repeat;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
#project_source_revision_mainarea_result_table td.R {
|
||||
white-space: nowrap;
|
||||
background-image:url(images/page_white_add.png);
|
||||
background-position:2px 50%;
|
||||
background-repeat:no-repeat;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------
|
||||
|
@ -41,6 +41,8 @@ $lang["LINE"] = "행";
|
||||
$lang["SHOWENTIREFILE"] = "모두 보기";
|
||||
$lang["SHOWCOMPACT"] = "바뀐 부분만 보기";
|
||||
|
||||
$lang["LISTING"] = "디렉토리열람";
|
||||
$lang["FILEDETAIL"] = "자세히 보기";
|
||||
$lang["DIFFPREV"] = "이전 리비전과 비교";
|
||||
$lang["BLAME"] = "수정한 사람 보기";
|
||||
|
||||
@ -54,7 +56,7 @@ $lang["HIDECHANGED"] = "변경된 파일 숨기기";
|
||||
$lang["NEWFILES"] = "새 파일";
|
||||
$lang["CHANGEDFILES"] = "수정된 파일";
|
||||
$lang["DELETEDFILES"] = "삭제된 파일";
|
||||
$lang["VIEWLOG"] = "로그 보기";
|
||||
$lang["VIEWLOG"] = "로그보기";
|
||||
$lang["PATH"] = "경로";
|
||||
$lang["AUTHOR"] = "작성자";
|
||||
$lang["AGE"] = "기간";
|
||||
|
Loading…
Reference in New Issue
Block a user