From 83f1fa989a7512b72cf026902963015f72c8c90b Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 9 Apr 2015 09:14:01 +0000 Subject: [PATCH] enhanced the folder view to display README or similar files --- codepot/src/codepot/controllers/code.php | 34 +++++++++++++++++++++ codepot/src/codepot/views/code_folder.php | 37 ++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/codepot/src/codepot/controllers/code.php b/codepot/src/codepot/controllers/code.php index aa978552..e5fe3f40 100644 --- a/codepot/src/codepot/controllers/code.php +++ b/codepot/src/codepot/controllers/code.php @@ -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); } } diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index be0da14e..9262d6ef 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -8,6 +8,15 @@ + + + + + + + + + @@ -183,6 +192,23 @@ $(function () { //$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide(); }); + +function renderReadme() +{ + 0 && substr_compare($readme_file, '.wiki', -5) === 0): + ?> + creole_render_wiki ( + "code_folder_mainarea_result_readme_text", + "code_folder_mainarea_result_readme", + "/wiki/show/id?>/", + "/wiki/attachment0/id?>/" + ); + prettyPrint(); + + +} <?php @@ -193,7 +219,7 @@ $(function () { ?> - +
@@ -408,6 +434,15 @@ $this->load->view ( } print ''; + if (strlen($readme_text) > 0) + { + print '
'; + print '
';
+			print htmlspecialchars($readme_text);	
+			print '
'; + print '
'; + } + print '
'; print '
';