# changed SubversionModel->getRevProp() to allow operations on a file

# added icons to some text labels
This commit is contained in:
hyung-hwan 2015-04-22 15:54:24 +00:00
parent 252508fa85
commit 5ea48cee2d
10 changed files with 88 additions and 67 deletions

View File

@ -370,10 +370,12 @@ if (!function_exists ('codepot_get_fa_file_type'))
'png' => 'image', 'png' => 'image',
'pdf' => 'pdf', 'pdf' => 'pdf',
'htm' => 'text',
'html' => 'text',
'txt' => 'text', 'txt' => 'text',
'wiki' => 'text', 'wiki' => 'text',
'htm' => 'html', 'xml' => 'text',
'html' => 'html',
'doc' => 'word', 'doc' => 'word',
'docx' => 'word', 'docx' => 'word',

View File

@ -192,6 +192,7 @@ class SubversionModel extends Model
// //
// Try to get the history from the head revision down. // Try to get the history from the head revision down.
// regardless of the given revision.
// //
$info = @svn_info ($url, FALSE, $rev); $info = @svn_info ($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1) if ($info === FALSE || count($info) != 1)
@ -233,8 +234,11 @@ class SubversionModel extends Model
$fileinfo['name'] = $info[0]['path']; $fileinfo['name'] = $info[0]['path'];
$fileinfo['type'] = 'dir'; $fileinfo['type'] = 'dir';
$fileinfo['size'] = 0; $fileinfo['size'] = 0;
if (array_key_exists('last_changed_rev', $info[0]))
$fileinfo['created_rev'] = $info[0]['last_changed_rev'];
else
$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_author'];
} }
else return FALSE; else return FALSE;
@ -259,11 +263,9 @@ class SubversionModel extends Model
$info = @svn_info ($url, FALSE, $rev); $info = @svn_info ($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE; if ($info === FALSE || count($info) != 1) return FALSE;
$actual_rev = $rev;
if ($info[0]['kind'] == SVN_NODE_FILE) if ($info[0]['kind'] == SVN_NODE_FILE)
{ {
// do not revision history this for a file.
return FALSE;
/*
$lsinfo = @svn_ls ($url, $rev, FALSE, TRUE); $lsinfo = @svn_ls ($url, $rev, FALSE, TRUE);
if ($lsinfo === FALSE) return FALSE; if ($lsinfo === FALSE) return FALSE;
@ -271,7 +273,8 @@ class SubversionModel extends Model
$fileinfo = $lsinfo[$info[0]['path']]; $fileinfo = $lsinfo[$info[0]['path']];
if (!array_key_exists ('fullpath', $fileinfo)) if (!array_key_exists ('fullpath', $fileinfo))
$fileinfo['fullpath'] = $info[0]['path']; $fileinfo['fullpath'] = $info[0]['path'];
*/
$actual_rev = $fileinfo['created_rev'];
} }
else if ($info[0]['kind'] == SVN_NODE_DIR) else if ($info[0]['kind'] == SVN_NODE_DIR)
@ -281,12 +284,17 @@ class SubversionModel extends Model
$fileinfo['name'] = $info[0]['path']; $fileinfo['name'] = $info[0]['path'];
$fileinfo['type'] = 'dir'; $fileinfo['type'] = 'dir';
$fileinfo['size'] = 0; $fileinfo['size'] = 0;
if (array_key_exists('last_changed_rev', $info[0]))
$fileinfo['created_rev'] = $info[0]['last_changed_rev'];
else
$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_author'];
$actual_rev = $fileinfo['created_rev'];
} }
else return FALSE; else return FALSE;
$log = @svn_log ($url, $rev, $rev, 1, SVN_DISCOVER_CHANGED_PATHS); $log = @svn_log ($url, $actual_rev, $actual_rev, 1, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE) return FALSE; if ($log === FALSE) return FALSE;
if (count($log) != 1) return FALSE; if (count($log) != 1) return FALSE;

View File

@ -144,6 +144,10 @@ $this->load->view (
<div class="menu" id="code_blame_mainarea_menu"> <div class="menu" id="code_blame_mainarea_menu">
<?php <?php
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
$xpar = $this->converter->AsciiToHex ($headpath); $xpar = $this->converter->AsciiToHex ($headpath);
if ($file['created_rev'] != $file['head_rev']) if ($file['created_rev'] != $file['head_rev'])
@ -161,15 +165,15 @@ if ($revision > 0)
{ {
if ($xpar == '') $revtrailer = $revreqroot; if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}"; else $revtrailer = "/{$xpar}{$revreq}";
print anchor ("code/history/{$project->id}{$revtrailer}", $this->lang->line('History')); print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
} }
else else
{ {
print anchor ("code/history/{$project->id}/{$xpar}", $this->lang->line('History')); print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
} }
print ' | '; print ' | ';
print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $this->lang->line('Download')); print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_text);
?> ?>
</div> <!-- code_blame_mainarea_menu --> </div> <!-- code_blame_mainarea_menu -->

View File

@ -106,7 +106,7 @@ $this->load->view (
print ' | '; print ' | ';
print anchor ( print anchor (
"code/blame/{$project->id}/{$xpar}{$revreq}", "code/blame/{$project->id}/{$xpar}{$revreq}",
$this->lang->line('Blame')); '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame'));
print ' | '; print ' | ';
if (!$fullview) if (!$fullview)
@ -125,19 +125,16 @@ $this->load->view (
print ' | '; print ' | ';
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
if ($revision1 > 0) if ($revision1 > 0)
{ {
if ($xpar == '') $revtrailer = $revreqroot; if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}"; else $revtrailer = "/{$xpar}{$revreq}";
print anchor ( print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
"code/history/{$project->id}{$revtrailer}",
$this->lang->line('History'));
} }
else else
{ {
print anchor ( print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
"code/history/{$project->id}/{$xpar}",
$this->lang->line('History'));
} }
?> ?>
</div> <!-- code_diff_mainarea_menu --> </div> <!-- code_diff_mainarea_menu -->

View File

@ -158,6 +158,10 @@ $this->load->view (
<?php <?php
$xpar = $this->converter->AsciiToHex ($headpath); $xpar = $this->converter->AsciiToHex ($headpath);
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
if ($file['created_rev'] != $file['head_rev']) if ($file['created_rev'] != $file['head_rev'])
{ {
print anchor ( print anchor (
@ -166,39 +170,26 @@ $this->load->view (
print ' | '; print ' | ';
} }
print anchor ( print anchor ("code/blame/{$project->id}/${xpar}{$revreq}", $blame_anchor_text);
"code/blame/{$project->id}/${xpar}{$revreq}",
$this->lang->line('Blame'));
print ' | '; print ' | ';
print anchor ( print anchor ("code/diff/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Difference'));
"code/diff/{$project->id}/{$xpar}{$revreq}",
$this->lang->line('Difference'));
print ' | '; print ' | ';
print anchor ( print anchor ("code/fulldiff/{$project->id}/{$xpar}{$revreq}", $this->lang->line('Full Difference'));
"code/fulldiff/{$project->id}/{$xpar}{$revreq}",
$this->lang->line('Full Difference'));
print ' | '; print ' | ';
if ($revision > 0) if ($revision > 0)
{ {
if ($xpar == '') $revtrailer = $revreqroot; if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}"; else $revtrailer = "/{$xpar}{$revreq}";
print anchor ( print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
"code/history/{$project->id}{$revtrailer}",
$this->lang->line('History'));
} }
else else
{ {
print anchor ( print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
"code/history/{$project->id}/{$xpar}",
$this->lang->line('History'));
} }
print ' | '; print ' | ';
print anchor ( print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_text);
"code/fetch/{$project->id}/${xpar}{$revreq}",
$this->lang->line('Download'));
print ' | '; print ' | ';
print anchor ( print anchor (

View File

@ -455,24 +455,29 @@ $this->load->view (
print ' | '; print ' | ';
} }
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
if ($revision > 0) if ($revision > 0)
{ {
if ($xpar == '') $revtrailer = $revreqroot; if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}"; else $revtrailer = "/{$xpar}{$revreq}";
print anchor ("code/history/{$project->id}{$revtrailer}", $this->lang->line('History')); print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
} }
else else
print anchor ("code/history/{$project->id}/{$xpar}", $this->lang->line('History')); {
print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
}
print ' | '; print ' | ';
print anchor ( print anchor ("code/fetch/{$project->id}/${xpar}{$revreq}", $download_anchor_text);
"code/fetch/{$project->id}/${xpar}{$revreq}",
$this->lang->line('Download'));
print '</div>'; print '</div>';
usort ($file['content'], 'comp_files'); usort ($file['content'], 'comp_files');
$blame_anchor_text = '<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame');
print '<table id="code_folder_mainarea_result_table">'; print '<table id="code_folder_mainarea_result_table">';
print '<tr class="heading">'; print '<tr class="heading">';
print '<th>' . $this->lang->line('Name') . '</th>'; print '<th>' . $this->lang->line('Name') . '</th>';
@ -517,6 +522,7 @@ $this->load->view (
print '</code></td>'; print '</code></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>';
print '</tr>'; print '</tr>';
} }
else else
@ -546,9 +552,7 @@ $this->load->view (
print '</code></td>'; print '</code></td>';
print '<td>'; print '<td>';
print anchor ( print anchor ("code/blame/{$project->id}/{$hexpath}{$revreq}", $blame_anchor_text);
"code/blame/{$project->id}/{$hexpath}{$revreq}",
$this->lang->line('Blame'));
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print anchor ( print anchor (

View File

@ -6,6 +6,7 @@
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/code.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/code.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
@ -152,23 +153,19 @@ $this->load->view (
print '</pre>'; print '</pre>';
print '</td>'; print '</td>';
if ($file['type'] == 'file')
{
print '<td>';
print anchor ("code/blame/{$project->id}/{$xfullpath}/{$h['rev']}",
$this->lang->line('Blame'));
print ' ';
print anchor ("code/diff/{$project->id}/{$xfullpath}/{$h['rev']}",
$this->lang->line('Difference'));
print '</td>';
}
else if ($file['type'] == 'dir')
{
print '<td>'; print '<td>';
print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}", print anchor ("code/revision/{$project->id}/{$xfullpath}/{$h['rev']}",
$this->lang->line('Details')); $this->lang->line('Details'));
print '</td>'; if ($file['type'] == 'file')
{
print ' | ';
print anchor ("code/blame/{$project->id}/{$xfullpath}/{$h['rev']}",
'<i class="fa fa-bomb"></i> ' . $this->lang->line('Blame'));
print ' | ';
print anchor ("code/diff/{$project->id}/{$xfullpath}/{$h['rev']}",
$this->lang->line('Difference'));
} }
print '</td>';
print '</tr>'; print '</tr>';

View File

@ -6,6 +6,7 @@
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/code.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/code.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/creole.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/creole.js')?>"></script>
@ -309,6 +310,15 @@ $history = $file['history'];
if ($headpath != $file['fullpath']) if ($headpath != $file['fullpath'])
{ {
// this comparsion doesn't work well for a file.
// $file['fullpath'] for a file doesn't include the directory.
// is this a bug of peclsvn? never mind. it's ok to show the file name again.
//
// [created_rev] => 322
// [name] => subversionmodel.php
// [type] => file
// [fullpath] => subversionmodel.php
print ' - '; print ' - ';
print htmlspecialchars($file['fullpath']); print htmlspecialchars($file['fullpath']);
} }
@ -317,6 +327,8 @@ $history = $file['history'];
<div class="menu" id="code_revision_mainarea_menu"> <div class="menu" id="code_revision_mainarea_menu">
<?php <?php
$history_anchor_text = '<i class="fa fa-history"></i> ' . $this->lang->line('History');
$xpar = $this->converter->AsciiToHex(($headpath == '')? '.': $headpath); $xpar = $this->converter->AsciiToHex(($headpath == '')? '.': $headpath);
if ($revision > 0 && $revision < $next_revision) if ($revision > 0 && $revision < $next_revision)
{ {
@ -328,20 +340,18 @@ $history = $file['history'];
{ {
if ($xpar == '') $revtrailer = $revreqroot; if ($xpar == '') $revtrailer = $revreqroot;
else $revtrailer = "/{$xpar}{$revreq}"; else $revtrailer = "/{$xpar}{$revreq}";
print anchor ( print anchor ("code/history/{$project->id}{$revtrailer}", $history_anchor_text);
"code/history/{$project->id}{$revtrailer}",
$this->lang->line('History'));
} }
else else
{ {
print anchor ("code/history/{$project->id}/{$xpar}", $this->lang->line('History')); print anchor ("code/history/{$project->id}/{$xpar}", $history_anchor_text);
} }
?> ?>
</div> <!-- code_revision_mainarea_menu --> </div> <!-- code_revision_mainarea_menu -->
<div class="infostrip" id="code_revision_mainarea_infostrip"> <div class="infostrip" id="code_revision_mainarea_infostrip">
<?php <?php
print anchor ("code/revision/{$project->id}/${xpar}/{$prev_revision}", '<<'); print anchor ("code/revision/{$project->id}/${xpar}/{$prev_revision}", '<i class="fa fa-arrow-circle-left"></i>');
print ' '; print ' ';
printf ('%s %s', $this->lang->line('Revision'), $history['rev']); printf ('%s %s', $this->lang->line('Revision'), $history['rev']);
@ -354,10 +364,11 @@ $history = $file['history'];
} }
print ' '; print ' ';
print anchor ("code/revision/{$project->id}/${xpar}/{$next_revision}", '>>'); print anchor ("code/revision/{$project->id}/${xpar}/{$next_revision}", '<i class="fa fa-arrow-circle-right"></i>');
if ($can_edit) if ($can_edit)
{ {
print ' ';
print '<span class="anchor">'; print '<span class="anchor">';
print anchor ("#", $this->lang->line('Tag'), array ('id' => 'code_revision_tag_button')); print anchor ("#", $this->lang->line('Tag'), array ('id' => 'code_revision_tag_button'));
print '</span>'; print '</span>';

View File

@ -8,6 +8,7 @@
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/file.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/file.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
@ -98,6 +99,8 @@ else
usort ($files, 'comp_files'); usort ($files, 'comp_files');
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
print '<table id="file_home_mainarea_result_table">'; print '<table id="file_home_mainarea_result_table">';
print '<tr class="heading">'; print '<tr class="heading">';
print '<th>' . $this->lang->line('Tag') . '</th>'; print '<th>' . $this->lang->line('Tag') . '</th>';
@ -132,7 +135,7 @@ else
print $file->md5sum; print $file->md5sum;
print '</tt></td>'; print '</tt></td>';
print '<td>'; print '<td>';
print anchor ("file/get/{$project->id}/{$hexname}", $this->lang->line('Download')); print anchor ("file/get/{$project->id}/{$hexname}", $download_anchor_text);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -6,6 +6,7 @@
<script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/codepot.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/common.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/file.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/file.css')?>" />
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/font-awesome.min.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/creole.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/creole.js')?>"></script>
@ -103,7 +104,10 @@ $this->load->view (
<div class="title"><?php print htmlspecialchars($file->name)?></div> <div class="title"><?php print htmlspecialchars($file->name)?></div>
<div class="infostrip" id="wiki_show_mainarea_infostrip"> <div class="infostrip" id="wiki_show_mainarea_infostrip">
<?php print anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $this->lang->line('Download')) ?> <?php
$download_anchor_text = '<i class="fa fa-download"></i> ' . $this->lang->line('Download');
print anchor ("file/get/{$project->id}/". $this->converter->AsciiToHex($file->name), $download_anchor_text);
?>
| <a id="file_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a> | <a id="file_show_mainarea_metadata_button" href='#'><?php print $this->lang->line('Metadata')?></a>
</div> </div>