enhanced the code folder view to show an executable file differently

This commit is contained in:
hyung-hwan 2015-08-26 09:49:37 +00:00
parent d790696448
commit 05ef3af213
4 changed files with 48 additions and 1 deletions

View File

@ -157,6 +157,28 @@ class Code extends Controller
$file['created_tag'] = $this->subversion->getRevProp ($projectid, $file['created_rev'], CODEPOT_SVN_TAG_PROPERTY); $file['created_tag'] = $this->subversion->getRevProp ($projectid, $file['created_rev'], CODEPOT_SVN_TAG_PROPERTY);
if ($file['created_tag'] === FALSE) $file['created_tag'] = ''; if ($file['created_tag'] === FALSE) $file['created_tag'] = '';
foreach ($file['content'] as &$f)
{
$exe = $this->subversion->getProp (
$projectid, $path . '/' . $f['name'],
$file['created_rev'], 'svn:executable');
if ($exe !== FALSE && is_array($exe))
{
// the answer is like this
// Array ( [file:///var/lib/codepot/svnrepo/sg/trunk/drbdfix/drbdfix.sh] => Array ( [svn:executable] => * ) )
foreach ($exe as &$ex)
{
if (array_key_exists('svn:executable', $ex))
{
$f['executable'] = $ex['svn:executable'];
break;
}
}
}
}
$data['project'] = $project; $data['project'] = $project;
$data['headpath'] = $path; $data['headpath'] = $path;
$data['file'] = $file; $data['file'] = $file;

View File

@ -1137,6 +1137,26 @@ class SubversionModel extends Model
return @svn_proplist ($workurl, 0, $rev); return @svn_proplist ($workurl, 0, $rev);
} }
function getProp ($projectid, $path, $rev, $prop)
{
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
$workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention
$info = @svn_info ($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
{
if ($rev == SVN_REVISION_HEAD || $path == '') return FALSE;
// rebuild the URL with a peg revision and retry it.
$workurl = "{$orgurl}@{$rev}";
$info = @svn_info ($workurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE;
}
return @svn_propget ($workurl, $prop, FALSE, $rev);
}
function _cloc_revision_by_lang ($projectid, $path, $rev) function _cloc_revision_by_lang ($projectid, $path, $rev)
{ {
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");

View File

@ -713,7 +713,8 @@ $this->load->view (
{ {
// file // file
$hexpath = $this->converter->AsciiToHex($fullpath); $hexpath = $this->converter->AsciiToHex($fullpath);
print "<tr class='{$rowclass}'>"; $executable_class = array_key_exists('executable', $f)? 'executable': '';
print "<tr class='{$rowclass} {$executable_class}'>";
print '<td>'; print '<td>';
$fa_type = codepot_get_fa_file_type ($f['name']); $fa_type = codepot_get_fa_file_type ($f['name']);
print "<i class='fa fa-{$fa_type}-o'></i> "; print "<i class='fa fa-{$fa_type}-o'></i> ";

View File

@ -10,6 +10,10 @@
vertical-align: middle; vertical-align: middle;
} }
#code_folder_mainarea_result_table tr.executable {
background-color: #F0FAF0;
}
#code_folder_mainarea_result_readme { #code_folder_mainarea_result_readme {
padding: 0.2em 0.2em 0.2em 0.2em; padding: 0.2em 0.2em 0.2em 0.2em;
} }