enhanced the revision view

This commit is contained in:
hyung-hwan 2010-02-10 13:07:39 +00:00
parent ba54c57e34
commit 2d6aa1c4bc
10 changed files with 140 additions and 38 deletions

View File

@ -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 ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
@ -88,6 +88,7 @@ class Source extends Controller
$data['login'] = $login; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
if ($path == '.') $path = ''; /* treat a period specially */
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
@ -163,6 +164,7 @@ class Source extends Controller
$data['login'] = $login; $data['login'] = $login;
$path = $this->converter->HexToAscii ($path); $path = $this->converter->HexToAscii ($path);
if ($path == '.') $path = ''; /* treat a period specially */
$project = $this->projects->get ($projectid); $project = $this->projects->get ($projectid);
if ($project === FALSE) if ($project === FALSE)
@ -248,13 +250,19 @@ class Source extends Controller
//$data['folder'] = substr ($path, 0, strrpos($path, '/')); //$data['folder'] = substr ($path, 0, strrpos($path, '/'));
$data['folder'] = $path; $data['folder'] = $path;
$data['file'] = $file; $data['file'] = $file;
$data['revision'] = $rev; $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); $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 ('ProjectModel', 'projects');
$this->load->model ('SubversionModel', 'subversion'); $this->load->model ('SubversionModel', 'subversion');
@ -280,7 +288,7 @@ class Source extends Controller
} }
else else
{ {
$file = $this->subversion->getRevisionHistory ($projectid, $path, $rev); $file = $this->subversion->getRevHistory ($projectid, $path, $rev);
if ($file === FALSE) if ($file === FALSE)
{ {
$data['message'] = 'Failed to get log content'; $data['message'] = 'Failed to get log content';
@ -288,11 +296,18 @@ class Source extends Controller
} }
else else
{ {
$data['type'] = $type;
$data['project'] = $project; $data['project'] = $project;
//$data['folder'] = substr ($path, 0, strrpos($path, '/')); //$data['folder'] = substr ($path, 0, strrpos($path, '/'));
$data['folder'] = $path; $data['folder'] = $path;
$data['file'] = $file; $data['file'] = $file;
$data['revision'] = $rev; $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); $this->load->view ($this->VIEW_REVISION, $data);
} }
} }

View File

@ -31,6 +31,7 @@ $lang['Latest projects'] = 'Latest projects';
$lang['Other projects'] = 'Other projects'; $lang['Other projects'] = 'Other projects';
$lang['Overview'] = 'Overview'; $lang['Overview'] = 'Overview';
$lang['Password'] = 'Password'; $lang['Password'] = 'Password';
$lang['Path'] = 'Path';
$lang['Project'] = 'Project'; $lang['Project'] = 'Project';
$lang['Projects'] = 'Projects'; $lang['Projects'] = 'Projects';
$lang['Repository'] = 'Repository'; $lang['Repository'] = 'Repository';

View File

@ -31,6 +31,7 @@ $lang['Latest projects'] = 'Proyek terakhir';
$lang['Other projects'] = 'Proyek lain'; $lang['Other projects'] = 'Proyek lain';
$lang['Overview'] = 'Ringkasan'; $lang['Overview'] = 'Ringkasan';
$lang['Password'] = 'Kata sandi'; $lang['Password'] = 'Kata sandi';
$lang['Path'] = 'Path';
$lang['Project'] = 'Proyek'; $lang['Project'] = 'Proyek';
$lang['Projects'] = 'Proyek'; $lang['Projects'] = 'Proyek';
$lang['Repository'] = 'Repository'; $lang['Repository'] = 'Repository';

View File

@ -8,7 +8,7 @@ $lang['Delete'] = '삭제';
$lang['Description'] = '설명'; $lang['Description'] = '설명';
$lang['Details'] = '상세내역'; $lang['Details'] = '상세내역';
$lang['Difference'] = '차이점'; $lang['Difference'] = '차이점';
$lang['Directory'] = '파일목록'; $lang['Directory'] = '디렉토리';
$lang['Download'] = '내려받기'; $lang['Download'] = '내려받기';
$lang['Edit'] = '수정'; $lang['Edit'] = '수정';
$lang['Head revision'] = '최신리비전'; $lang['Head revision'] = '최신리비전';
@ -31,6 +31,7 @@ $lang['Latest projects'] = '최근 프로젝트';
$lang['Other projects'] = '다른 프로젝트'; $lang['Other projects'] = '다른 프로젝트';
$lang['Overview'] = '개요'; $lang['Overview'] = '개요';
$lang['Password'] = '패스워드'; $lang['Password'] = '패스워드';
$lang['Path'] = '경로';
$lang['Project'] = '프로젝트'; $lang['Project'] = '프로젝트';
$lang['Projects'] = '프로젝트'; $lang['Projects'] = '프로젝트';
$lang['Repository'] = '저장소'; $lang['Repository'] = '저장소';

View File

@ -10,7 +10,7 @@ class SubversionModel extends Model
function getList ($projectid, $subdir = '', $rev = SVN_REVISION_HEAD, $recurse = FALSE) function getList ($projectid, $subdir = '', $rev = SVN_REVISION_HEAD, $recurse = FALSE)
{ {
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid; $path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid;
if ($subdir != '') $path .= '/' . $subdir; if ($subdir != '') $path .= "/{$subdir}";
$list = @svn_ls ($path, $rev, $recurse); $list = @svn_ls ($path, $rev, $recurse);
if ($list === FALSE) return FALSE; if ($list === FALSE) return FALSE;
@ -26,6 +26,8 @@ class SubversionModel extends Model
if ($info === FALSE) return FALSE; if ($info === FALSE) return FALSE;
$last = substr(strrchr($path, '/'), 1); $last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
if (array_key_exists ($last, $info) === FALSE) return FALSE; if (array_key_exists ($last, $info) === FALSE) return FALSE;
$fileinfo = $info[$last]; $fileinfo = $info[$last];
@ -44,6 +46,8 @@ class SubversionModel extends Model
if ($info === FALSE) return FALSE; if ($info === FALSE) return FALSE;
$last = substr(strrchr($path, '/'), 1); $last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
if (array_key_exists ($last, $info) === FALSE) return FALSE; if (array_key_exists ($last, $info) === FALSE) return FALSE;
$fileinfo = $info[$last]; $fileinfo = $info[$last];
@ -59,6 +63,8 @@ class SubversionModel extends Model
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file; $path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$last = substr(strrchr($path, '/'), 1); $last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
$info['name'] = $last; $info['name'] = $last;
$fileinfo = $info; $fileinfo = $info;
@ -69,11 +75,13 @@ class SubversionModel extends Model
return $fileinfo; return $fileinfo;
} }
function getRevisionHistory ($projectid, $file, $rev) function getRevHistory ($projectid, $file, $rev)
{ {
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file; $path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
$last = substr(strrchr($path, '/'), 1); $last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
$info['name'] = $last; $info['name'] = $last;
$fileinfo = $info; $fileinfo = $info;
@ -334,6 +342,8 @@ class SubversionModel extends Model
if ($info === FALSE) return FALSE; if ($info === FALSE) return FALSE;
$last = substr(strrchr($path, '/'), 1); $last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
if (array_key_exists ($last, $info) === FALSE) return FALSE; if (array_key_exists ($last, $info) === FALSE) return FALSE;
$fileinfo = $info[$last]; $fileinfo = $info[$last];

View File

@ -134,9 +134,8 @@ for ($i = 0; $i < $len; $i++)
$rev = $line['rev']; $rev = $line['rev'];
$rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT); $rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT);
$par = $folder . '/' . $file['name']; $par = $this->converter->AsciiTohex ("{$folder}/{$file['name']}");
$par = $this->converter->AsciiTohex ($par); $rev_padded = anchor ("/source/blame/{$project->id}/{$par}/{$rev}", $rev_padded);
$rev_padded = anchor ('/source/blame/' . $project->id . '/' . $par . '/' . $rev, $rev_padded);
} }
else else
{ {
@ -154,9 +153,9 @@ for ($i = 0; $i < $len; $i++)
$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT); $author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
} }
print '<span class="nocode">' . $rev_padded . ' </span> '; print "<span class='nocode'>{$rev_padded}</span>";
print '<span class="nocode">' . $author_padded . ' </span> '; print "<span class='nocode' title='{$author}'>{$author_padded}</span>";
print '<span class="nocode">' . $lineno_padded . ' </span> '; print "<span class='nocode'>{$lineno_padded}</span>";
print htmlspecialchars ($line['line']); print htmlspecialchars ($line['line']);
print "\n"; print "\n";
} }

View File

@ -67,7 +67,7 @@ if ($type == 'folder')
{ {
$par = $this->converter->AsciiTohex ($folder); $par = $this->converter->AsciiTohex ($folder);
$xpar = "source/folder/{$project->id}/{$par}"; $xpar = "source/folder/{$project->id}/{$par}";
print anchor ($xpar, $this->lang->line('Directory')); print anchor ($xpar, $this->lang->line('Folder'));
} }
else else
{ {
@ -107,10 +107,13 @@ else
print '<td>'; print '<td>';
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder); $hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
/*
if ($type == '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 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>';
print '<td>'; print '<td>';
@ -129,14 +132,20 @@ else
print '<td>'; print '<td>';
if ($type == 'folder') 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']}", print anchor ("/source/folder/{$project->id}/{$hexfolder}/{$h['rev']}",
$this->lang->line('Directory')); $this->lang->line('Folder'));
} }
else else
{ {
print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}",
$this->lang->line('Details'));
print ' ';
print anchor ("/source/blame/{$project->id}/{$hexfolder}/{$h['rev']}", print anchor ("/source/blame/{$project->id}/{$hexfolder}/{$h['rev']}",
$this->lang->line('Blame')); $this->lang->line('Blame'));
print ' | '; print ' ';
print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}", print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}",
$this->lang->line('Difference')); $this->lang->line('Difference'));
} }

View File

@ -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"> <div class="mainarea" id="project_source_revision_mainarea">
<?php <?php
$history = $file['history']; $history = $file['history'];
?> ?>
<!--
<div class="sidebar" id="project_source_revision_mainarea_sidebar"> <div class="sidebar" id="project_source_revision_mainarea_sidebar">
<div class="box"> <div class="box">
<ul> <ul>
@ -51,6 +46,7 @@ $history = $file['history'];
</ul> </ul>
</div> </div>
</div> </div>
-->
<div class="title" id="project_source_revision_mainarea_title"> <div class="title" id="project_source_revision_mainarea_title">
<?php <?php
@ -64,14 +60,14 @@ function print_path ($project, $path, $rev, $converter)
$par .= '/' . $exps[$i]; $par .= '/' . $exps[$i];
$hexpar = $converter->AsciiToHex ($par); $hexpar = $converter->AsciiToHex ($par);
print '/'; print '/';
$xpar = "source/revision/{$project->id}/{$hexpar}"; $xpar = "source/revision/folder/{$project->id}/{$hexpar}";
if ($rev != '') $xpar .= "/{$rev}"; if ($rev != '') $xpar .= "/{$rev}";
print anchor ($xpar, htmlspecialchars($exps[$i])); print anchor ($xpar, htmlspecialchars($exps[$i]));
} }
} }
$hexfolder = $this->converter->AsciiToHex('.'); $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); if ($folder != '') print_path ($project, $folder, $revision, $this->converter);
?> ?>
</div> </div>
@ -79,25 +75,65 @@ if ($folder != '') print_path ($project, $folder, $revision, $this->converter);
<div class="menu" id="project_source_revision_mainarea_menu"> <div class="menu" id="project_source_revision_mainarea_menu">
<?php <?php
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder); $hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
$xpar = "source/history/file/{$project->id}/{$hexfolder}"; if ($revision > 0 && $revision < $next_revision)
print anchor ($xpar, $this->lang->line('History')); {
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> <!-- 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"> <div id="project_source_revision_mainarea_result">
<table id="project_source_revision_mainarea_result_table">
<?php <?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) foreach ($history['paths'] as $p)
{ {
print '<li>'; $rowclass = $rowclasses[++$rowcount % 2];
print '['; print "<tr class='{$rowclass}'>";
print $p['action'];
print '] ';
$hexpar = $this->converter->AsciiToHex ($p['path']); $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> </table>
</div> <!-- project_source_revision_mainarea_body --> </div> <!-- project_source_revision_mainarea_body -->

View File

@ -53,8 +53,36 @@
overflow: auto; overflow: auto;
} }
#project_source_revision_mainarea_result ul li { #project_source_revision_mainarea_result_table td.M {
list-style: square; 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;
} }
/*----------------------------------------------- /*-----------------------------------------------

View File

@ -41,6 +41,8 @@ $lang["LINE"] = "행";
$lang["SHOWENTIREFILE"] = "모두 보기"; $lang["SHOWENTIREFILE"] = "모두 보기";
$lang["SHOWCOMPACT"] = "바뀐 부분만 보기"; $lang["SHOWCOMPACT"] = "바뀐 부분만 보기";
$lang["LISTING"] = "디렉토리열람";
$lang["FILEDETAIL"] = "자세히 보기";
$lang["DIFFPREV"] = "이전 리비전과 비교"; $lang["DIFFPREV"] = "이전 리비전과 비교";
$lang["BLAME"] = "수정한 사람 보기"; $lang["BLAME"] = "수정한 사람 보기";
@ -54,7 +56,7 @@ $lang["HIDECHANGED"] = "변경된 파일 숨기기";
$lang["NEWFILES"] = "새 파일"; $lang["NEWFILES"] = "새 파일";
$lang["CHANGEDFILES"] = "수정된 파일"; $lang["CHANGEDFILES"] = "수정된 파일";
$lang["DELETEDFILES"] = "삭제된 파일"; $lang["DELETEDFILES"] = "삭제된 파일";
$lang["VIEWLOG"] = "로그&nbsp;보기"; $lang["VIEWLOG"] = "로그보기";
$lang["PATH"] = "경로"; $lang["PATH"] = "경로";
$lang["AUTHOR"] = "작성자"; $lang["AUTHOR"] = "작성자";
$lang["AGE"] = "기간"; $lang["AGE"] = "기간";