enhanced the file and blame view to display a log message
This commit is contained in:
parent
41c025c009
commit
889803afea
@ -25,9 +25,16 @@ class SubversionModel extends Model
|
|||||||
$str = @svn_cat ($url, $rev);
|
$str = @svn_cat ($url, $rev);
|
||||||
if ($str === FALSE) return FALSE;
|
if ($str === FALSE) return FALSE;
|
||||||
|
|
||||||
|
$log = @svn_log ($url,
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
1, SVN_DISCOVER_CHANGED_PATHS);
|
||||||
|
if ($log === FALSE) return FALSE;
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr (
|
$fileinfo['fullpath'] = substr (
|
||||||
$info[0]['url'], strlen($info[0]['repos']));
|
$info[0]['url'], strlen($info[0]['repos']));
|
||||||
$fileinfo['content'] = $str;
|
$fileinfo['content'] = $str;
|
||||||
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
else if ($info[0]['kind'] == SVN_NODE_DIR)
|
else if ($info[0]['kind'] == SVN_NODE_DIR)
|
||||||
@ -35,6 +42,12 @@ class SubversionModel extends Model
|
|||||||
$list = @svn_ls ($url, $rev, FALSE, TRUE);
|
$list = @svn_ls ($url, $rev, FALSE, TRUE);
|
||||||
if ($list === FALSE) return FALSE;
|
if ($list === FALSE) return FALSE;
|
||||||
|
|
||||||
|
$log = @svn_log ($url,
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
1, SVN_DISCOVER_CHANGED_PATHS);
|
||||||
|
if ($log === FALSE) return FALSE;
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr (
|
$fileinfo['fullpath'] = substr (
|
||||||
$info[0]['url'], strlen($info[0]['repos']));
|
$info[0]['url'], strlen($info[0]['repos']));
|
||||||
$fileinfo['name'] = $info[0]['path'];
|
$fileinfo['name'] = $info[0]['path'];
|
||||||
@ -43,7 +56,7 @@ class SubversionModel extends Model
|
|||||||
$fileinfo['created_rev'] = $info[0]['revision'];
|
$fileinfo['created_rev'] = $info[0]['revision'];
|
||||||
$fileinfo['last_author'] = $info[0]['last_changed_rev'];
|
$fileinfo['last_author'] = $info[0]['last_changed_rev'];
|
||||||
$fileinfo['content'] = $list;
|
$fileinfo['content'] = $list;
|
||||||
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +81,16 @@ class SubversionModel extends Model
|
|||||||
$str = @svn_blame ($url, $rev);
|
$str = @svn_blame ($url, $rev);
|
||||||
if ($str === FALSE) return FALSE;
|
if ($str === FALSE) return FALSE;
|
||||||
|
|
||||||
|
$log = @svn_log ($url,
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
$fileinfo['created_rev'],
|
||||||
|
1, SVN_DISCOVER_CHANGED_PATHS);
|
||||||
|
if ($log === FALSE) return FALSE;
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr (
|
$fileinfo['fullpath'] = substr (
|
||||||
$info[0]['url'], strlen($info[0]['repos']));
|
$info[0]['url'], strlen($info[0]['repos']));
|
||||||
$fileinfo['content'] = $str;
|
$fileinfo['content'] = $str;
|
||||||
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
return $fileinfo;
|
return $fileinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,68 +104,89 @@ print anchor ("source/history/{$project->id}/{$xpar}", $this->lang->line('Histor
|
|||||||
?>
|
?>
|
||||||
</div> <!-- project_source_blame_mainarea_menu -->
|
</div> <!-- project_source_blame_mainarea_menu -->
|
||||||
|
|
||||||
<div class="infostrip">
|
<div class="infostrip" id="project_source_blame_mainarea_infostrip">
|
||||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<<')?>
|
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<<')?>
|
||||||
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
|
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
|
||||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['next_rev']}", '>>')?> |
|
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['next_rev']}", '>>')?> |
|
||||||
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
|
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
|
||||||
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
|
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
|
||||||
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
|
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="project_source_blame_mainarea_result">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$fileext = substr(strrchr($file['name'], '.'), 1);
|
$fileext = substr(strrchr($file['name'], '.'), 1);
|
||||||
if ($fileext == "") $fileext = "html"
|
if ($fileext == "") $fileext = "html"
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<pre class="prettyprint lang-<?=$fileext?>">
|
<pre class="prettyprint lang-<?=$fileext?>">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$content = $file['content'];
|
$content = $file['content'];
|
||||||
$len = count($content);
|
$len = count($content);
|
||||||
$rev = '';
|
$rev = '';
|
||||||
$author = '';
|
$author = '';
|
||||||
|
|
||||||
for ($i = 0; $i < $len; $i++)
|
for ($i = 0; $i < $len; $i++)
|
||||||
{
|
|
||||||
$line = $content[$i];
|
|
||||||
$lineno_padded = str_pad ($line['line_no'], 6, ' ', STR_PAD_LEFT);
|
|
||||||
|
|
||||||
if ($line['rev'] != $rev)
|
|
||||||
{
|
{
|
||||||
$rev = $line['rev'];
|
$line = $content[$i];
|
||||||
$rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT);
|
$lineno_padded = str_pad ($line['line_no'], 6, ' ', STR_PAD_LEFT);
|
||||||
|
|
||||||
$xpar = $this->converter->AsciiTohex ($headpath);
|
if ($line['rev'] != $rev)
|
||||||
$rev_padded = anchor ("/source/blame/{$project->id}/{$xpar}/{$rev}", $rev_padded);
|
{
|
||||||
|
$rev = $line['rev'];
|
||||||
|
$rev_padded = str_pad ($rev, 6, ' ', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
$xpar = $this->converter->AsciiTohex ($headpath);
|
||||||
|
$rev_padded = anchor ("/source/blame/{$project->id}/{$xpar}/{$rev}", $rev_padded);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rev_padded = str_pad (' ', 6, ' ', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($line['author'] != $author)
|
||||||
|
{
|
||||||
|
$author = $line['author'];
|
||||||
|
$author_padded = str_pad ($author, 8, ' ', STR_PAD_RIGHT);
|
||||||
|
$author_padded = substr($author_padded, 0, 8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
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";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$rev_padded = str_pad (' ', 6, ' ', STR_PAD_LEFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($line['author'] != $author)
|
|
||||||
{
|
|
||||||
$author = $line['author'];
|
|
||||||
$author_padded = str_pad ($author, 8, ' ', STR_PAD_RIGHT);
|
|
||||||
$author_padded = substr($author_padded, 0, 8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$author_padded = str_pad (' ', 8, ' ', STR_PAD_RIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
</div> <!-- project_source_blame_mainarea -->
|
<div id="project_source_blame_mainarea_result_info">
|
||||||
|
<script language='javascript'>
|
||||||
|
function toggle_logmsg()
|
||||||
|
{
|
||||||
|
var x = document.getElementById ('project_source_blame_mainarea_result_info_logmsg');
|
||||||
|
if (x) x.style.visibility = (x.style.visibility == 'visible')? 'hidden': 'visible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
|
<a href='#' onClick='toggle_logmsg()'><?= $this->lang->line('Message') ?></a>
|
||||||
|
</div>
|
||||||
|
<pre id="project_source_blame_mainarea_result_info_logmsg" style="visibility: visible">
|
||||||
|
<?= $file['logmsg'] ?>
|
||||||
|
</pre>
|
||||||
|
</div> <!-- project_source_blame_mainarea_result_info -->
|
||||||
|
|
||||||
|
</div> <!-- project_source_blame_mainarea_result -->
|
||||||
|
|
||||||
|
</div> <!-- project_source_blame_mainarea -->
|
||||||
|
|
||||||
<!---------------------------------------------------------------------------->
|
<!---------------------------------------------------------------------------->
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ $this->load->view (
|
|||||||
$this->lang->line('Blame'));
|
$this->lang->line('Blame'));
|
||||||
print ' | ';
|
print ' | ';
|
||||||
print anchor (
|
print anchor (
|
||||||
"source/history/file/{$project->id}/{$xpar}",
|
"source/history/{$project->id}/{$xpar}",
|
||||||
$this->lang->line('History'));
|
$this->lang->line('History'));
|
||||||
?>
|
?>
|
||||||
</div> <!-- project_source_diff_mainarea_menu -->
|
</div> <!-- project_source_diff_mainarea_menu -->
|
||||||
|
@ -144,16 +144,24 @@ if ($fileext == '') $fileext = "html"
|
|||||||
?>
|
?>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
<div id="project_source_file_mainarea_result_info">
|
<div id="project_source_file_mainarea_result_info">
|
||||||
<pre>
|
<script language='javascript'>
|
||||||
akdjflosjfkdsajflkdsj
|
function toggle_logmsg()
|
||||||
aslkfdjdsalkjfs
|
{
|
||||||
alkjfdlkajf
|
var x = document.getElementById ('project_source_file_mainarea_result_info_logmsg');
|
||||||
|
if (x) x.style.visibility = (x.style.visibility == 'visible')? 'hidden': 'visible';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="title">
|
||||||
sadkfjsalfjskjdslkfsaj
|
<a href='#' onClick='toggle_logmsg()'><?= $this->lang->line('Message') ?></a>
|
||||||
</pre>
|
|
||||||
</div>
|
</div>
|
||||||
|
<pre id="project_source_file_mainarea_result_info_logmsg" style="visibility: visible">
|
||||||
|
<?= $file['logmsg'] ?>
|
||||||
|
</pre>
|
||||||
|
</div> <!-- project_source_file_mainarea_result_info -->
|
||||||
|
|
||||||
</div> <!-- project_source_file_mainarea_result -->
|
</div> <!-- project_source_file_mainarea_result -->
|
||||||
|
|
||||||
|
@ -67,26 +67,6 @@ $this->load->view (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menu" id="project_source_history_mainarea_menu">
|
<div class="menu" id="project_source_history_mainarea_menu">
|
||||||
<!--
|
|
||||||
<?php
|
|
||||||
/* the menu here prints links to the lastest revision */
|
|
||||||
$par = $this->converter->AsciiTohex ($fullpath);
|
|
||||||
print anchor (
|
|
||||||
"source/file/{$project->id}/{$par}",
|
|
||||||
$this->lang->line('Details'));
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (...)
|
|
||||||
{
|
|
||||||
print ' | ';
|
|
||||||
$xpar = "source/blame/{$project->id}/{$par}";
|
|
||||||
print anchor ($xpar, $this->lang->line('Blame'));
|
|
||||||
print ' | ';
|
|
||||||
$xpar = "source/diff/{$project->id}/{$par}";
|
|
||||||
print anchor ($xpar, $this->lang->line('Difference'));
|
|
||||||
} */
|
|
||||||
?>
|
|
||||||
-->
|
|
||||||
</div> <!-- project_source_history_mainarea_menu -->
|
</div> <!-- project_source_history_mainarea_menu -->
|
||||||
|
|
||||||
<div id="project_source_history_mainarea_result">
|
<div id="project_source_history_mainarea_result">
|
||||||
@ -96,7 +76,7 @@ $this->load->view (
|
|||||||
<th><?=$this->lang->line('Author')?></th>
|
<th><?=$this->lang->line('Author')?></th>
|
||||||
<th><?=$this->lang->line('Date')?></th>
|
<th><?=$this->lang->line('Date')?></th>
|
||||||
<th><?=$this->lang->line('Message')?></th>
|
<th><?=$this->lang->line('Message')?></th>
|
||||||
<?php if ($file['type'] == 'file') print '<th></th>'; ?>
|
<?php if ($file['type'] == 'file' || $file['type'] == 'dir') print '<th></th>'; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$rowclasses = array ('even', 'odd');
|
$rowclasses = array ('even', 'odd');
|
||||||
@ -157,17 +137,9 @@ $this->load->view (
|
|||||||
// let's track the copy path.
|
// let's track the copy path.
|
||||||
//
|
//
|
||||||
$paths = $h['paths'];
|
$paths = $h['paths'];
|
||||||
$colspan = ($file['type'] == 'file')? 5: 4;
|
$colspan = ($file['type'] == 'file' || $file['type'] == 'dir')? 5: 4;
|
||||||
foreach ($paths as $p)
|
foreach ($paths as $p)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (array_key_exists ('copyfrom', $p) &&
|
|
||||||
$p['path'] == $curfullpath && $p['action'] == 'A')
|
|
||||||
{
|
|
||||||
$curfullpath = $p['copyfrom'];
|
|
||||||
print "<tr class='title'><td colspan='{$colspan}'>{$curfullpath}</td></tr>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (array_key_exists ('copyfrom', $p) &&
|
if (array_key_exists ('copyfrom', $p) &&
|
||||||
$p['action'] == 'A')
|
$p['action'] == 'A')
|
||||||
{
|
{
|
||||||
|
@ -38,12 +38,70 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 20em;
|
width: 20em;
|
||||||
background-color: red;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#project_source_file_mainarea_result_info pre {
|
#project_source_file_mainarea_result_info pre {
|
||||||
|
overflow: auto;
|
||||||
border: 0;
|
border: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_file_mainarea_result_info .title {
|
||||||
|
background-color: #7777FF;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.8em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_file_mainarea_result_info .title a {
|
||||||
|
color: white;
|
||||||
|
font-size: inherit;
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_file_mainarea_result_info .title a:hover {
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------
|
||||||
|
* project source blame view
|
||||||
|
*-----------------------------------------------*/
|
||||||
|
#project_source_blame_mainarea_result {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_blame_mainarea_result_info {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 20em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_blame_mainarea_result_info pre {
|
||||||
|
overflow: auto;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_blame_mainarea_result_info .title {
|
||||||
|
background-color: #7777FF;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-size: 0.8em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_blame_mainarea_result_info .title a {
|
||||||
|
color: white;
|
||||||
|
font-size: inherit;
|
||||||
|
background-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
#project_source_blame_mainarea_result_info .title a:hover {
|
||||||
|
background-color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------
|
/*-----------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user