enhanced the history view to display changed paths. yet more to improve

This commit is contained in:
hyung-hwan 2010-02-12 14:53:34 +00:00
parent 2d6aa1c4bc
commit 0a15131296
9 changed files with 211 additions and 124 deletions

View File

@ -4,6 +4,7 @@ $lang['Blame'] = 'Blame';
$lang['Create'] = 'Create';
$lang['Created by'] = 'Created by';
$lang['Created on'] = 'Created on';
$lang['Date'] = 'Date';
$lang['Delete'] = 'Delete';
$lang['Description'] = 'Description';
$lang['Details'] = 'Details';

View File

@ -4,6 +4,7 @@ $lang['Blame'] = 'Menyalahkan';
$lang['Create'] = 'Dibuat';
$lang['Created by'] = 'Dibuat oleh';
$lang['Created on'] = 'Waktu dibuat';
$lang['Date'] = 'Date';
$lang['Delete'] = 'Hapus';
$lang['Description'] = 'Penjelasan';
$lang['Details'] = 'Detail';

View File

@ -4,6 +4,7 @@ $lang['Blame'] = '책임전가';
$lang['Create'] = '생성';
$lang['Created by'] = '최초생성인';
$lang['Created on'] = '최초생성시간';
$lang['Date'] = '날짜';
$lang['Delete'] = '삭제';
$lang['Description'] = '설명';
$lang['Details'] = '상세내역';

View File

@ -65,13 +65,13 @@ class SubversionModel extends Model
$last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
$info['name'] = $last;
$fileinfo = $info;
/* set the file name to the information array */
$fileinfo['name'] = $last;
$str = @svn_log ($path, 1, $rev);
if ($str === FALSE) return FALSE;
$log = @svn_log ($path, 1, $rev, 0, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) return FALSE;
$fileinfo['history'] = $str;
$fileinfo['history'] = $log;
return $fileinfo;
}
@ -82,15 +82,15 @@ class SubversionModel extends Model
$last = substr(strrchr($path, '/'), 1);
if ($last === FALSE) $last = '';
$info['name'] = $last;
$fileinfo = $info;
/* set the file name to the information array */
$fileinfo['name'] = $last;
$str = @svn_log ($path, $rev, $rev);
if ($str === FALSE) return FALSE;
$log = @svn_log ($path, $rev, $rev, 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) return FALSE;
if (count($str) != 1) return FALSE;
if (count($log) != 1) return FALSE;
$fileinfo['history'] = $str[0];
$fileinfo['history'] = $log[0];
return $fileinfo;
}

View File

@ -100,7 +100,7 @@ print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('Hi
?>
</div> <!-- project_source_file_mainarea_menu -->
<div class="infostrip">
<div class="infostrip" id="project_source_file_mainarea_infostrip">
<?=anchor ("source/file/{$project->id}/${par}/{$file['prev_rev']}", '<<')?>
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
<?=anchor ("source/file/{$project->id}/${par}/{$file['next_rev']}", '>>')?> |
@ -109,12 +109,14 @@ print anchor ("source/history/file/{$project->id}/{$par}", $this->lang->line('Hi
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
</div>
<div id="project_source_file_mainarea_result">
<?php
$fileext = substr(strrchr($file['name'], '.'), 1);
if ($fileext == "") $fileext = "html"
if ($fileext == '') $fileext = "html"
?>
<pre class="prettyprint lang-<?=$fileext?>">
<pre class="prettyprint lang-<?=$fileext?>" id="project_source_file_mainarea_result_pre">
<?php
// print htmlspecialchars($file['content']);
@ -140,12 +142,24 @@ if ($fileext == "") $fileext = "html"
?>
</pre>
<div id="project_source_file_mainarea_result_info">
<pre>
akdjflosjfkdsajflkdsj
aslkfdjdsalkjfs
alkjfdlkajf
sadkfjsalfjskjdslkfsaj
</pre>
</div>
</div> <!-- project_source_file_mainarea_result -->
</div> <!-- project_source_file_mainarea -->
<!---------------------------------------------------------------------------->
<?php $this->load->view ('footer'); ?>
<!---------------------------------------------------------------------------->

View File

@ -58,20 +58,24 @@ else
$revreqroot = '/' . $this->converter->AsciiToHex('.') . $revreq;
}
print anchor ("/source/folder/{$project->id}{$revreqroot}", htmlspecialchars($project->name));
if ($folder != '')
{
// print the main anchor for the root folder.
// let the anchor text be the project name.
print anchor (
"/source/folder/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
// explode non-root folder parts to anchors
$exps = explode ('/', $folder);
$expsize = count($exps);
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
print '/';
$par .= '/' . $exps[$i];
$hexpar = $this->converter->AsciiToHex ($par);
print anchor ("source/folder/{$project->id}/{$hexpar}{$revreq}", htmlspecialchars($exps[$i]));
}
$xpar = $this->converter->AsciiToHex ($par);
print anchor (
"source/folder/{$project->id}/{$xpar}{$revreq}",
htmlspecialchars($exps[$i]));
}
?>
</div>
@ -95,13 +99,13 @@ if ($folder != '')
else
{
print '<div class="menu" id="project_source_folder_mainarea_menu">';
$hexpar = $this->converter->AsciiTohex ($folder);
$xpar = $this->converter->AsciiTohex ($folder);
if ($revision > 0 && $revision < $next_revision)
{
print anchor ("source/folder/{$project->id}", $this->lang->line('Head revision'));
print ' | ';
}
print anchor ("source/history/folder/{$project->id}/{$hexpar}", $this->lang->line('History'));
print anchor ("source/history/folder/{$project->id}/{$xpar}", $this->lang->line('History'));
print '</div>';
usort ($files, 'comp_files');
@ -113,7 +117,7 @@ if ($folder != '')
print '<th>' . $this->lang->line('Revision') . '</th>';
print '<th>' . $this->lang->line('Size') . '</th>';
print '<th>' . $this->lang->line('Author') . '</th>';
print '<th>' . $this->lang->line('Time') . '</th>';
print '<th>' . $this->lang->line('Date') . '</th>';
print '<th>' . $this->lang->line('Blame') . '</th>';
print '<th>' . $this->lang->line('Difference') . '</th>';
print '</tr>';
@ -143,7 +147,8 @@ if ($folder != '')
print htmlspecialchars($f['last_author']);
print '</td>';
print '<td><code>';
print date('r', $f['time_t']);
//print date('r', $f['time_t']);
print date('Y-m-d', $f['time_t']);
print '</code></td>';
print '<td></td>';
print '<td></td>';
@ -169,7 +174,8 @@ if ($folder != '')
print htmlspecialchars($f['last_author']);
print '</td>';
print '<td><code>';
print date('r', $f['time_t']);
//print date('r', $f['time_t']);
print date('Y-m-d', $f['time_t']);
print '</code></td>';
print '<td>';

View File

@ -39,24 +39,36 @@ $this->load->view (
<div class="title" id="project_source_history_mainarea_title">
<?php
function print_path ($project, $path, $type, $converter, $rev = SVN_REVISION_HEAD)
if ($revision <= 0)
{
$exps = explode ('/', $path);
$expsize = count($exps);
$par = '';
for ($i = 1; $i < $expsize; $i++)
{
$par .= '/' . $exps[$i];
$hexpar = $converter->AsciiToHex ($par);
print '/';
$xpar = "source/history/$type/{$project->id}/{$hexpar}";
if ($rev != '') $xpar .= "/{$rev}";
print anchor ($xpar, htmlspecialchars($exps[$i]));
$revreq = '';
$revreqroot = '';
}
else
{
$revreq = "/{$revision}";
$revreqroot = '/' . $this->converter->AsciiToHex('.') . $revreq;
}
print anchor ("/source/history/folder/{$project->id}", htmlspecialchars($project->name));
if ($folder != '') print_path ($project, $folder, 'folder', $this->converter);
// print the anchor for the root folder with a project name
print anchor (
"/source/history/folder/{$project->id}{$revreqroot}",
htmlspecialchars($project->name));
// explodes part of the folder name into an array
$exps = explode ('/', $folder);
$expsize = count($exps);
$par = '';
// print anchors pointing to each part
for ($i = 1; $i < $expsize; $i++)
{
print '/';
$par .= '/' . $exps[$i];
$xpar = $this->converter->AsciiToHex ($par);
print anchor (
"source/history/folder/{$project->id}/{$xpar}{$revreq}",
htmlspecialchars($exps[$i]));
}
?>
</div>
@ -84,13 +96,12 @@ else
?>
</div> <!-- project_source_history_mainarea_menu -->
<div id="project_source_history_mainarea_result">
<table id="project_source_history_mainarea_result_table">
<tr class='heading'>
<th><?=$this->lang->line('Revision')?></th>
<th><?=$this->lang->line('Author')?></th>
<th><?=$this->lang->line('Time')?></th>
<th><?=$this->lang->line('Date')?></th>
<th><?=$this->lang->line('Message')?></th>
<th></th>
</tr>
@ -98,6 +109,7 @@ else
$rowclasses = array ('even', 'odd');
$history = $file['history'];
$history_count = count($history);
$curfolder = $folder;
for ($i = $history_count; $i > 0; )
{
$h = $history[--$i];
@ -106,14 +118,14 @@ else
print "<tr class='{$rowclass}'>";
print '<td>';
$hexfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
/*
//
// it seems the history can be retrieved only from the latest name */
//
$xfolder = $this->converter->AsciiToHex(($folder == '')? '.': $folder);
if ($type == 'folder')
print anchor ("/source/revision/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
print anchor ("/source/revision/{$type}/{$project->id}/{$xfolder}/{$h['rev']}", $h['rev']);
else
print anchor ("/source/{$type}/{$project->id}/{$hexfolder}/{$h['rev']}", $h['rev']);
*/
print $h['rev'];
print anchor ("/source/{$type}/{$project->id}/{$xfolder}/{$h['rev']}", $h['rev']);
print '</td>';
print '<td>';
@ -126,32 +138,48 @@ else
print '</code></td>';
print '<td>';
print '<pre>';
print htmlspecialchars($h['msg']);
print '</pre>';
print '</td>';
print '<td>';
//
// the actual folder or file contents must be accessed with the name
// at a particular revision.
//
$xfolder = $this->converter->AsciiToHex(($curfolder == '')? '.': $curfolder);
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}/{$xfolder}/{$h['rev']}",
$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']}",
print anchor ("/source/blame/{$project->id}/{$xfolder}/{$h['rev']}",
$this->lang->line('Blame'));
print ' ';
print anchor ("/source/diff/{$project->id}/{$hexfolder}/{$h['rev']}",
print anchor ("/source/diff/{$project->id}/{$xfolder}/{$h['rev']}",
$this->lang->line('Difference'));
}
print '</td>';
print '</tr>';
//
// let's track the copy path.
//
$paths = $h['paths'];
foreach ($paths as $p)
{
if (array_key_exists ('copyfrom', $p) &&
$p['path'] == $curfolder && $p['action'] == 'A')
{
$curfolder = $p['copyfrom'];
print "<tr class='title'><td colspan=5>{$curfolder}</td></tr>";
}
}
}
?>
</table>

View File

@ -35,19 +35,6 @@ $this->load->view (
$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)
@ -94,6 +81,13 @@ print anchor ("source/history/{$type}/{$project->id}/{$hexfolder}", $this->lang-
<div id="project_source_revision_mainarea_result">
<div class="title">Message</div>
<pre id="project_source_revision_mainarea_result_msg">
<?=htmlspecialchars($history['msg'])?>
</pre>
<div class="title">Files updated</div>
<table id="project_source_revision_mainarea_result_table">
<?php
print '<tr class="heading">';
@ -111,27 +105,15 @@ print anchor ("source/history/{$type}/{$project->id}/{$hexfolder}", $this->lang-
$hexpar = $this->converter->AsciiToHex ($p['path']);
print "<td class='{$p['action']}'>";
print htmlspecialchars($p['path']);
print anchor ("source/file/{$project->id}/{$hexpar}/{$history['rev']}", 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>';
}
?>

View File

@ -2,6 +2,18 @@
* This file contains specific IDs for furthur customization.
*/
/*-----------------------------------------------
* project file home view
*-----------------------------------------------*/
#project_file_home_mainarea_result {
overflow: auto;
}
#project_file_home_mainarea_result_table tr {
vertical-align: top;
white-space: nowrap;
}
/*-----------------------------------------------
* project source folder view
*-----------------------------------------------*/
@ -15,15 +27,23 @@
}
/*-----------------------------------------------
* project source folder view
* project source file view
*-----------------------------------------------*/
#project_file_home_mainarea_result {
overflow: auto;
#project_source_file_mainarea_result {
position: relative;
}
#project_file_home_mainarea_result_table tr {
vertical-align: top;
white-space: nowrap;
#project_source_file_mainarea_result_info {
position: absolute;
top: 0;
right: 0;
width: 20em;
background-color: red;
}
#project_source_file_mainarea_result_info pre {
border: 0;
margin: 0;
}
/*-----------------------------------------------
@ -46,13 +66,37 @@
white-space: nowrap;
}
#project_source_history_mainarea_result_table pre {
border: 0;
background-color: inherit;
padding: 0;
margin: 0;
}
#project_source_history_mainarea_result_table .title {
font-size: inherit;
font-weight: inherit;
font-style: italic;
text-align: center;
background-color: #AABBFF;
}
/*-----------------------------------------------
* project source revision view
*-----------------------------------------------*/
#project_source_revision_mainarea_result {
overflow: auto;
}
#project_source_revision_mainarea_result_msg {
border: 0;
padding: 0;
background-color: inherit;
margin: 0;
margin-bottom: 1em;
}
#project_source_revision_mainarea_result_table td.M {
white-space: nowrap;
background-image:url(images/page_white_edit.png);
@ -85,6 +129,16 @@
padding-left: 22px;
}
#project_source_revision_mainarea_result_sidebar {
/*overflow: auto;*/
}
#project_source_revision_mainarea_result_sidebar pre {
overflow: auto;
border: 0;
padding: 0;
}
/*-----------------------------------------------
* project source diff view
*-----------------------------------------------*/