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);
|
||||
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 (
|
||||
$info[0]['url'], strlen($info[0]['repos']));
|
||||
$fileinfo['content'] = $str;
|
||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||
return $fileinfo;
|
||||
}
|
||||
else if ($info[0]['kind'] == SVN_NODE_DIR)
|
||||
@ -35,6 +42,12 @@ class SubversionModel extends Model
|
||||
$list = @svn_ls ($url, $rev, FALSE, TRUE);
|
||||
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 (
|
||||
$info[0]['url'], strlen($info[0]['repos']));
|
||||
$fileinfo['name'] = $info[0]['path'];
|
||||
@ -43,7 +56,7 @@ class SubversionModel extends Model
|
||||
$fileinfo['created_rev'] = $info[0]['revision'];
|
||||
$fileinfo['last_author'] = $info[0]['last_changed_rev'];
|
||||
$fileinfo['content'] = $list;
|
||||
|
||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||
return $fileinfo;
|
||||
}
|
||||
|
||||
@ -68,9 +81,16 @@ class SubversionModel extends Model
|
||||
$str = @svn_blame ($url, $rev);
|
||||
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 (
|
||||
$info[0]['url'], strlen($info[0]['repos']));
|
||||
$fileinfo['content'] = $str;
|
||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||
return $fileinfo;
|
||||
}
|
||||
|
||||
|
@ -104,30 +104,32 @@ print anchor ("source/history/{$project->id}/{$xpar}", $this->lang->line('Histor
|
||||
?>
|
||||
</div> <!-- project_source_blame_mainarea_menu -->
|
||||
|
||||
<div class="infostrip">
|
||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<<')?>
|
||||
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
|
||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['next_rev']}", '>>')?> |
|
||||
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
|
||||
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
|
||||
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
|
||||
<div class="infostrip" id="project_source_blame_mainarea_infostrip">
|
||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['prev_rev']}", '<<')?>
|
||||
<?=$this->lang->line('Revision')?>: <?=$file['created_rev']?>
|
||||
<?=anchor ("source/file/{$project->id}/${xpar}/{$file['next_rev']}", '>>')?> |
|
||||
<?=$this->lang->line('Author')?>: <?=htmlspecialchars($file['last_author'])?> |
|
||||
<?=$this->lang->line('Size')?>: <?=$file['size']?> |
|
||||
<?=$this->lang->line('Last updated on')?>: <?=$file['time']?>
|
||||
</div>
|
||||
|
||||
<div id="project_source_blame_mainarea_result">
|
||||
|
||||
<?php
|
||||
$fileext = substr(strrchr($file['name'], '.'), 1);
|
||||
if ($fileext == "") $fileext = "html"
|
||||
$fileext = substr(strrchr($file['name'], '.'), 1);
|
||||
if ($fileext == "") $fileext = "html"
|
||||
?>
|
||||
|
||||
<pre class="prettyprint lang-<?=$fileext?>">
|
||||
<?php
|
||||
|
||||
$content = $file['content'];
|
||||
$len = count($content);
|
||||
$rev = '';
|
||||
$author = '';
|
||||
$content = $file['content'];
|
||||
$len = count($content);
|
||||
$rev = '';
|
||||
$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);
|
||||
|
||||
@ -160,12 +162,31 @@ for ($i = 0; $i < $len; $i++)
|
||||
print "<span class='nocode'>{$lineno_padded}</span>";
|
||||
print htmlspecialchars ($line['line']);
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</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'));
|
||||
print ' | ';
|
||||
print anchor (
|
||||
"source/history/file/{$project->id}/{$xpar}",
|
||||
"source/history/{$project->id}/{$xpar}",
|
||||
$this->lang->line('History'));
|
||||
?>
|
||||
</div> <!-- project_source_diff_mainarea_menu -->
|
||||
|
@ -144,16 +144,24 @@ if ($fileext == '') $fileext = "html"
|
||||
?>
|
||||
</pre>
|
||||
|
||||
|
||||
<div id="project_source_file_mainarea_result_info">
|
||||
<pre>
|
||||
akdjflosjfkdsajflkdsj
|
||||
aslkfdjdsalkjfs
|
||||
alkjfdlkajf
|
||||
<script language='javascript'>
|
||||
function toggle_logmsg()
|
||||
{
|
||||
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>
|
||||
|
||||
|
||||
sadkfjsalfjskjdslkfsaj
|
||||
</pre>
|
||||
<div class="title">
|
||||
<a href='#' onClick='toggle_logmsg()'><?= $this->lang->line('Message') ?></a>
|
||||
</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 -->
|
||||
|
||||
|
@ -67,26 +67,6 @@ $this->load->view (
|
||||
</div>
|
||||
|
||||
<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 id="project_source_history_mainarea_result">
|
||||
@ -96,7 +76,7 @@ $this->load->view (
|
||||
<th><?=$this->lang->line('Author')?></th>
|
||||
<th><?=$this->lang->line('Date')?></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>
|
||||
<?php
|
||||
$rowclasses = array ('even', 'odd');
|
||||
@ -157,17 +137,9 @@ $this->load->view (
|
||||
// let's track the copy path.
|
||||
//
|
||||
$paths = $h['paths'];
|
||||
$colspan = ($file['type'] == 'file')? 5: 4;
|
||||
$colspan = ($file['type'] == 'file' || $file['type'] == 'dir')? 5: 4;
|
||||
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) &&
|
||||
$p['action'] == 'A')
|
||||
{
|
||||
|
@ -38,12 +38,70 @@
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 20em;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
#project_source_file_mainarea_result_info pre {
|
||||
overflow: auto;
|
||||
border: 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