enhanced the folder view to display README or similar files
This commit is contained in:
parent
59c6044680
commit
83f1fa989a
@ -108,6 +108,17 @@ class Code extends Controller
|
||||
$data['next_revision'] =
|
||||
$this->subversion->getNextRev ($projectid, $path, $rev);
|
||||
|
||||
$data['readme_text'] = '';
|
||||
$data['readme_file'] = '';
|
||||
foreach (array('README.wiki', 'README.txt', 'README') as $rf)
|
||||
{
|
||||
$readme = $this->subversion->getFile ($projectid, $path . '/' . $rf, $rev);
|
||||
if ($readme !== FALSE)
|
||||
{
|
||||
$data['readme_text'] = $readme['content'];
|
||||
$data['readme_file'] = $rf;
|
||||
}
|
||||
}
|
||||
$this->load->view ($this->VIEW_FOLDER, $data);
|
||||
}
|
||||
}
|
||||
@ -563,6 +574,17 @@ class Code extends Controller
|
||||
$data['next_revision'] =
|
||||
$this->subversion->getNextRev ($projectid, $path, $rev);
|
||||
|
||||
$data['readme_text'] = '';
|
||||
$data['readme_file'] = '';
|
||||
foreach (array('README.wiki', 'README.txt', 'README') as $rf)
|
||||
{
|
||||
$readme = $this->subversion->getFile ($projectid, $path . '/' . $rf, $rev);
|
||||
if ($readme !== FALSE)
|
||||
{
|
||||
$data['readme_text'] = $readme['content'];
|
||||
$data['readme_file'] = $rf;
|
||||
}
|
||||
}
|
||||
$this->load->view ($this->VIEW_FOLDER, $data);
|
||||
}
|
||||
}
|
||||
@ -623,6 +645,18 @@ class Code extends Controller
|
||||
$this->subversion->getPrevRev ($project->id, $path, $rev);
|
||||
$data['next_revision'] =
|
||||
$this->subversion->getNextRev ($project->id, $path, $rev);
|
||||
|
||||
$data['readme_text'] = '';
|
||||
$data['readme_file'] = '';
|
||||
foreach (array('README.wiki', 'README.txt', 'README') as $rf)
|
||||
{
|
||||
$readme = $this->subversion->getFile ($projectid, $path . '/' . $rf, $rev);
|
||||
if ($readme !== FALSE)
|
||||
{
|
||||
$data['readme_text'] = $readme['content'];
|
||||
$data['readme_file'] = $rf;
|
||||
}
|
||||
}
|
||||
$this->load->view ($this->VIEW_FOLDER, $data);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,15 @@
|
||||
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/common.css')?>" />
|
||||
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/code.css')?>" />
|
||||
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/creole.js')?>"></script>
|
||||
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/prettify.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-css.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lisp.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-lua.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-sql.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-vb.js')?>"></script>
|
||||
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
|
||||
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
|
||||
<link type="text/css" rel="stylesheet" href="<?=base_url_make('/css/jquery-ui.css')?>" />
|
||||
@ -183,6 +192,23 @@ $(function () {
|
||||
//$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide();
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
function renderReadme()
|
||||
{
|
||||
<?php
|
||||
// if the readme file name ends with '.wiki', perform pretty printing
|
||||
if (strlen($readme_text) > 0 && substr_compare($readme_file, '.wiki', -5) === 0):
|
||||
?>
|
||||
creole_render_wiki (
|
||||
"code_folder_mainarea_result_readme_text",
|
||||
"code_folder_mainarea_result_readme",
|
||||
"<?=site_url()?>/wiki/show/<?=$project->id?>/",
|
||||
"<?=site_url()?>/wiki/attachment0/<?=$project->id?>/"
|
||||
);
|
||||
prettyPrint();
|
||||
<?php endif; ?>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<title><?php
|
||||
@ -193,7 +219,7 @@ $(function () {
|
||||
?></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body onload="renderReadme()">
|
||||
|
||||
<div class="content" id="code_folder_content">
|
||||
|
||||
@ -408,6 +434,15 @@ $this->load->view (
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
if (strlen($readme_text) > 0)
|
||||
{
|
||||
print '<div id="code_folder_mainarea_result_readme">';
|
||||
print '<pre id="code_folder_mainarea_result_readme_text">';
|
||||
print htmlspecialchars($readme_text);
|
||||
print '</pre>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<div id="code_folder_mainarea_result_info">';
|
||||
|
||||
print '<div class="title">';
|
||||
|
Loading…
x
Reference in New Issue
Block a user