added the revision view. not completed yet
This commit is contained in:
parent
c4c7f3a66d
commit
ba54c57e34
@ -7,6 +7,7 @@ class Source extends Controller
|
|||||||
var $VIEW_FILE = 'source_file';
|
var $VIEW_FILE = 'source_file';
|
||||||
var $VIEW_BLAME = 'source_blame';
|
var $VIEW_BLAME = 'source_blame';
|
||||||
var $VIEW_HISTORY = 'source_history';
|
var $VIEW_HISTORY = 'source_history';
|
||||||
|
var $VIEW_REVISION = 'source_revision';
|
||||||
var $VIEW_DIFF = 'source_diff';
|
var $VIEW_DIFF = 'source_diff';
|
||||||
|
|
||||||
function Source ()
|
function Source ()
|
||||||
@ -115,7 +116,13 @@ class Source extends Controller
|
|||||||
$data['project'] = $project;
|
$data['project'] = $project;
|
||||||
$data['folder'] = $path;
|
$data['folder'] = $path;
|
||||||
$data['files'] = $files;
|
$data['files'] = $files;
|
||||||
|
|
||||||
$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_FOLDER, $data);
|
$this->load->view ($this->VIEW_FOLDER, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,6 +220,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)
|
||||||
@ -246,6 +254,50 @@ class Source extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function revision ($projectid, $path, $rev)
|
||||||
|
{
|
||||||
|
$this->load->model ('ProjectModel', 'projects');
|
||||||
|
$this->load->model ('SubversionModel', 'subversion');
|
||||||
|
|
||||||
|
$login = $this->login->getUser ();
|
||||||
|
if (CODEPOT_ALWAYS_REQUIRE_SIGNIN && $login['id'] == '')
|
||||||
|
redirect ('main/signin');
|
||||||
|
$data['login'] = $login;
|
||||||
|
|
||||||
|
$path = $this->converter->HexToAscii ($path);
|
||||||
|
if ($path == '.') $path = ''; /* treat a period specially */
|
||||||
|
|
||||||
|
$project = $this->projects->get ($projectid);
|
||||||
|
if ($project === FALSE)
|
||||||
|
{
|
||||||
|
$data['message'] = 'DATABASE ERROR';
|
||||||
|
$this->load->view ($this->VIEW_ERROR, $data);
|
||||||
|
}
|
||||||
|
else if ($project === NULL)
|
||||||
|
{
|
||||||
|
$data['message'] = "NO SUCH PROJECT - $projectid";
|
||||||
|
$this->load->view ($this->VIEW_ERROR, $data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$file = $this->subversion->getRevisionHistory ($projectid, $path, $rev);
|
||||||
|
if ($file === FALSE)
|
||||||
|
{
|
||||||
|
$data['message'] = 'Failed to get log content';
|
||||||
|
$this->load->view ($this->VIEW_ERROR, $data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['project'] = $project;
|
||||||
|
//$data['folder'] = substr ($path, 0, strrpos($path, '/'));
|
||||||
|
$data['folder'] = $path;
|
||||||
|
$data['file'] = $file;
|
||||||
|
$data['revision'] = $rev;
|
||||||
|
$this->load->view ($this->VIEW_REVISION, $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function diff ($projectid, $path, $rev1 = SVN_REVISION_HEAD, $rev2 = SVN_REVISION_PREV)
|
function diff ($projectid, $path, $rev1 = SVN_REVISION_HEAD, $rev2 = SVN_REVISION_PREV)
|
||||||
{
|
{
|
||||||
$this->load->model ('ProjectModel', 'projects');
|
$this->load->model ('ProjectModel', 'projects');
|
||||||
|
@ -8,6 +8,7 @@ $lang['Delete'] = 'Delete';
|
|||||||
$lang['Description'] = 'Description';
|
$lang['Description'] = 'Description';
|
||||||
$lang['Details'] = 'Details';
|
$lang['Details'] = 'Details';
|
||||||
$lang['Difference'] = 'Diff';
|
$lang['Difference'] = 'Diff';
|
||||||
|
$lang['Directory'] = 'Directory';
|
||||||
$lang['Download'] = 'Download';
|
$lang['Download'] = 'Download';
|
||||||
$lang['Edit'] = 'Edit';
|
$lang['Edit'] = 'Edit';
|
||||||
$lang['Head revision'] = 'Head revision';
|
$lang['Head revision'] = 'Head revision';
|
||||||
|
@ -8,6 +8,7 @@ $lang['Delete'] = 'Hapus';
|
|||||||
$lang['Description'] = 'Penjelasan';
|
$lang['Description'] = 'Penjelasan';
|
||||||
$lang['Details'] = 'Detail';
|
$lang['Details'] = 'Detail';
|
||||||
$lang['Difference'] = 'Beda';
|
$lang['Difference'] = 'Beda';
|
||||||
|
ng['Directory'] = 'Direktori';
|
||||||
$lang['Download'] = 'Download';
|
$lang['Download'] = 'Download';
|
||||||
$lang['Edit'] = 'Rubah';
|
$lang['Edit'] = 'Rubah';
|
||||||
$lang['Head revision'] = 'Kepala Revisi';
|
$lang['Head revision'] = 'Kepala Revisi';
|
||||||
|
@ -8,6 +8,7 @@ $lang['Delete'] = '삭제';
|
|||||||
$lang['Description'] = '설명';
|
$lang['Description'] = '설명';
|
||||||
$lang['Details'] = '상세내역';
|
$lang['Details'] = '상세내역';
|
||||||
$lang['Difference'] = '차이점';
|
$lang['Difference'] = '차이점';
|
||||||
|
$lang['Directory'] = '파일목록';
|
||||||
$lang['Download'] = '내려받기';
|
$lang['Download'] = '내려받기';
|
||||||
$lang['Edit'] = '수정';
|
$lang['Edit'] = '수정';
|
||||||
$lang['Head revision'] = '최신리비전';
|
$lang['Head revision'] = '최신리비전';
|
||||||
|
@ -69,6 +69,23 @@ class SubversionModel extends Model
|
|||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRevisionHistory ($projectid, $file, $rev)
|
||||||
|
{
|
||||||
|
$path = 'file:///' . CODEPOT_SVNREPO_DIR . '/' . $projectid . '/' . $file;
|
||||||
|
|
||||||
|
$last = substr(strrchr($path, '/'), 1);
|
||||||
|
$info['name'] = $last;
|
||||||
|
$fileinfo = $info;
|
||||||
|
|
||||||
|
$str = @svn_log ($path, $rev, $rev);
|
||||||
|
if ($str === FALSE) return FALSE;
|
||||||
|
|
||||||
|
if (count($str) != 1) return FALSE;
|
||||||
|
|
||||||
|
$fileinfo['history'] = $str[0];
|
||||||
|
return $fileinfo;
|
||||||
|
}
|
||||||
|
|
||||||
function _get_diff ($diff, $all, $ent)
|
function _get_diff ($diff, $all, $ent)
|
||||||
{
|
{
|
||||||
/* copied from websvn */
|
/* copied from websvn */
|
||||||
|
@ -18,6 +18,7 @@ www_DATA = \
|
|||||||
source_file.php \
|
source_file.php \
|
||||||
source_folder.php \
|
source_folder.php \
|
||||||
source_history.php \
|
source_history.php \
|
||||||
|
source_revision.php \
|
||||||
taskbar.php \
|
taskbar.php \
|
||||||
user_home.php \
|
user_home.php \
|
||||||
wiki_delete.php \
|
wiki_delete.php \
|
||||||
|
@ -181,6 +181,7 @@ www_DATA = \
|
|||||||
source_file.php \
|
source_file.php \
|
||||||
source_folder.php \
|
source_folder.php \
|
||||||
source_history.php \
|
source_history.php \
|
||||||
|
source_revision.php \
|
||||||
taskbar.php \
|
taskbar.php \
|
||||||
user_home.php \
|
user_home.php \
|
||||||
wiki_delete.php \
|
wiki_delete.php \
|
||||||
|
@ -49,23 +49,29 @@ function print_path ($project, $path, $type, $converter, $rev = SVN_REVISION_HEA
|
|||||||
$par .= '/' . $exps[$i];
|
$par .= '/' . $exps[$i];
|
||||||
$hexpar = $converter->AsciiToHex ($par);
|
$hexpar = $converter->AsciiToHex ($par);
|
||||||
print '/';
|
print '/';
|
||||||
$xpar = "source/$type/" . $project->id . '/' . $hexpar;
|
$xpar = "source/history/$type/{$project->id}/{$hexpar}";
|
||||||
if ($rev != '') $xpar .= '/' . $rev;
|
if ($rev != '') $xpar .= "/{$rev}";
|
||||||
print anchor ($xpar, htmlspecialchars($exps[$i]));
|
print anchor ($xpar, htmlspecialchars($exps[$i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print anchor ('/source/folder/' . $project->id, htmlspecialchars($project->name));
|
print anchor ("/source/history/folder/{$project->id}", htmlspecialchars($project->name));
|
||||||
if ($folder != '') print_path ($project, $folder, 'folder', $this->converter);
|
if ($folder != '') print_path ($project, $folder, 'folder', $this->converter);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu" id="project_source_history_mainarea_menu">
|
<div class="menu" id="project_source_history_mainarea_menu">
|
||||||
<?php
|
<?php
|
||||||
if ($type == 'file')
|
/* the menu here prints links to the lastest revision */
|
||||||
|
if ($type == 'folder')
|
||||||
{
|
{
|
||||||
$par = $folder;
|
$par = $this->converter->AsciiTohex ($folder);
|
||||||
$par = $this->converter->AsciiTohex ($par);
|
$xpar = "source/folder/{$project->id}/{$par}";
|
||||||
|
print anchor ($xpar, $this->lang->line('Directory'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$par = $this->converter->AsciiTohex ($folder);
|
||||||
$xpar = "source/file/{$project->id}/{$par}";
|
$xpar = "source/file/{$project->id}/{$par}";
|
||||||
print anchor ($xpar, $this->lang->line('Details'));
|
print anchor ($xpar, $this->lang->line('Details'));
|
||||||
print ' | ';
|
print ' | ';
|
||||||
@ -86,7 +92,7 @@ if ($type == 'file')
|
|||||||
<th><?=$this->lang->line('Author')?></th>
|
<th><?=$this->lang->line('Author')?></th>
|
||||||
<th><?=$this->lang->line('Time')?></th>
|
<th><?=$this->lang->line('Time')?></th>
|
||||||
<th><?=$this->lang->line('Message')?></th>
|
<th><?=$this->lang->line('Message')?></th>
|
||||||
<th><?=$this->lang->line('Files')?></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$rowclasses = array ('even', 'odd');
|
$rowclasses = array ('even', 'odd');
|
||||||
@ -101,7 +107,10 @@ if ($type == 'file')
|
|||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
|
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
|
||||||
print anchor ("/source/$type/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
if ($type == 'folder')
|
||||||
|
print anchor ("/source/revision/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||||
|
else
|
||||||
|
print anchor ("/source/$type/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -109,32 +118,29 @@ if ($type == 'file')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td><code>';
|
print '<td><code>';
|
||||||
print date('r', strtotime($h['date']));
|
//print date('r', strtotime($h['date']));
|
||||||
|
print date('Y-m-d', strtotime($h['date']));
|
||||||
print '</code></td>';
|
print '</code></td>';
|
||||||
|
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print htmlspecialchars($h['msg']);
|
print htmlspecialchars($h['msg']);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$paths = $h['paths'];
|
print '<td>';
|
||||||
if (count($paths) > 0)
|
if ($type == 'folder')
|
||||||
{
|
{
|
||||||
print '<td>';
|
print anchor ("/source/folder/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||||
print '<ul id="project_source_history_mainarea_result_table_path_list">';
|
$this->lang->line('Directory'));
|
||||||
foreach ($paths as $p)
|
|
||||||
{
|
|
||||||
print '<li>';
|
|
||||||
print '<code>';
|
|
||||||
print '[';
|
|
||||||
print $p['action'];
|
|
||||||
print '] ';
|
|
||||||
print_path ($project, $p['path'], 'file', $this->converter, $h['rev']);
|
|
||||||
print '</code>';
|
|
||||||
print '</li>';
|
|
||||||
}
|
|
||||||
print '</ul>';
|
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print anchor ("/source/blame/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||||
|
$this->lang->line('Blame'));
|
||||||
|
print ' | ';
|
||||||
|
print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}",
|
||||||
|
$this->lang->line('Difference'));
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
120
codepot/src/codepot/views/source_revision.php
Normal file
120
codepot/src/codepot/views/source_revision.php
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/common.css" />
|
||||||
|
<link type="text/css" rel="stylesheet" href="<?=base_url()?>/css/project.css" />
|
||||||
|
<title><?=htmlspecialchars($project->name)?></title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="content" id="project_source_revision_content">
|
||||||
|
|
||||||
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
<?php $this->load->view ('taskbar'); ?>
|
||||||
|
|
||||||
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->load->view (
|
||||||
|
'projectbar',
|
||||||
|
array (
|
||||||
|
'pageid' => 'source',
|
||||||
|
'ctxmenuitems' => array ()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<li><?=$this->lang->line('Revision')?>: <?=htmlspecialchars($history['rev'])?></li>
|
||||||
|
<li><?=$this->lang->line('Author')?>: <?=htmlspecialchars($history['author'])?></li>
|
||||||
|
<li><?=$this->lang->line('Last updated on')?>: <?=date('r', strtotime($history['date']))?></li>
|
||||||
|
<li><?=$this->lang->line('Message')?>: <?=htmlspecialchars($history['msg'])?></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="title" id="project_source_revision_mainarea_title">
|
||||||
|
<?php
|
||||||
|
function print_path ($project, $path, $rev, $converter)
|
||||||
|
{
|
||||||
|
$exps = explode ('/', $path);
|
||||||
|
$expsize = count($exps);
|
||||||
|
$par = '';
|
||||||
|
for ($i = 1; $i < $expsize; $i++)
|
||||||
|
{
|
||||||
|
$par .= '/' . $exps[$i];
|
||||||
|
$hexpar = $converter->AsciiToHex ($par);
|
||||||
|
print '/';
|
||||||
|
$xpar = "source/revision/{$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));
|
||||||
|
if ($folder != '') print_path ($project, $folder, $revision, $this->converter);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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'));
|
||||||
|
?>
|
||||||
|
</div> <!-- project_source_revision_mainarea_menu -->
|
||||||
|
|
||||||
|
<div id="project_source_revision_mainarea_result">
|
||||||
|
<?php
|
||||||
|
print '<ul id="project_source_revision_mainarea_result_table_path_list">';
|
||||||
|
foreach ($history['paths'] as $p)
|
||||||
|
{
|
||||||
|
print '<li>';
|
||||||
|
print '[';
|
||||||
|
print $p['action'];
|
||||||
|
print '] ';
|
||||||
|
$hexpar = $this->converter->AsciiToHex ($p['path']);
|
||||||
|
print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", htmlspecialchars($p['path']));
|
||||||
|
print '</li>';
|
||||||
|
}
|
||||||
|
print '</ul>';
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div> <!-- project_source_revision_mainarea_body -->
|
||||||
|
|
||||||
|
</div> <!-- project_source_revision_mainarea -->
|
||||||
|
|
||||||
|
|
||||||
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
|
||||||
|
<?php $this->load->view ('footer'); ?>
|
||||||
|
|
||||||
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
</div> <!-- project_source_revision_content -->
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -46,6 +46,17 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------
|
||||||
|
* project source revision view
|
||||||
|
*-----------------------------------------------*/
|
||||||
|
#project_source_revision_mainarea_result {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_revision_mainarea_result ul li {
|
||||||
|
list-style: square;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------
|
/*-----------------------------------------------
|
||||||
* project source diff view
|
* project source diff view
|
||||||
*-----------------------------------------------*/
|
*-----------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user