From fdb7d3519868bfed3f20275082de846a522b1446 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 21 Apr 2015 14:34:19 +0000 Subject: [PATCH] # changed the code search result to be shown with line numbers in the new style. # added an anchor to revision shown on the code search view. # added the search-in-progress effect to the search string box --- .../src/codepot/models/subversionmodel.php | 16 +++++-- codepot/src/codepot/views/code_folder.php | 20 ++++---- codepot/src/codepot/views/code_search.php | 47 +++++++++++++------ codepot/src/css/code.css | 34 +++----------- 4 files changed, 62 insertions(+), 55 deletions(-) diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 689096e5..2f5c33e9 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -18,7 +18,7 @@ class SubversionModel extends Model return $canonical; } - function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD) + function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD, $no_file_content = FALSE) { //$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; $orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); @@ -55,8 +55,15 @@ class SubversionModel extends Model if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE; $fileinfo = $lsinfo[$info0['path']]; - $str = @svn_cat ($workurl, $rev); - if ($str === FALSE) return FALSE; + if ($no_file_content) + { + $str = ''; + } + else + { + $str = @svn_cat ($workurl, $rev); + if ($str === FALSE) return FALSE; + } $log = @svn_log ($workurl, $fileinfo['created_rev'], @@ -73,8 +80,7 @@ class SubversionModel extends Model } else $fileinfo['properties'] = NULL; - $fileinfo['fullpath'] = substr ( - $info0['url'], strlen($info0['repos'])); + $fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos'])); $fileinfo['content'] = $str; $fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: ''; diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index 36e17716..7804c0ab 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -211,15 +211,17 @@ $(function () { //$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide(); - $('#code_folder_search_submit').button().click (function (e) { - if ($.trim($("#code_folder_search_string").val()) != "") + $('#code_search_submit').button().click (function () { + if ($.trim($("#code_search_string").val()) != "") { - $('#code_folder_search_form').submit (); + $('#code_search_submit').button ('disable'); + $('#code_search_string').addClass("search-in-progress"); + $('#code_search_form').submit (); } }); /* - $('#code_folder_search_form').submit (function(e) { - if ($.trim($("#code_folder_search_string").val()) === "") + $('#code_search_form').submit (function(e) { + if ($.trim($("#code_search_string").val()) === "") { // prevent submission when the search string is empty. e.preventDefault(); @@ -310,7 +312,7 @@ $this->load->view (
id}/", 'id="code_folder_search_form"'); + print form_open("code/search/{$project->id}/", 'id="code_search_form"'); if (CODEPOT_SIGNIN_FOR_CODE_SEARCH === FALSE || (isset($login['id']) && $login['id'] != '')) { @@ -319,7 +321,7 @@ $this->load->view ( print form_input(array( 'name' => 'search_string', 'value' => set_value('search_string', ''), - 'id' =>'code_folder_search_string', + 'id' =>'code_search_string', 'placeholder' => $this->lang->line('CODE_SEARCH_STRING') )); @@ -386,8 +388,8 @@ $this->load->view ( ); print ' '; - //print form_submit('search_submit', $this->lang->line('Search'), 'id="code_folder_search_submit"'); - printf ('%s', $this->lang->line('Search')); + //print form_submit('search_submit', $this->lang->line('Search'), 'id="code_search_submit"'); + printf ('%s', $this->lang->line('Search')); print ' | '; } diff --git a/codepot/src/codepot/views/code_search.php b/codepot/src/codepot/views/code_search.php index e63faf92..50f3ddbb 100644 --- a/codepot/src/codepot/views/code_search.php +++ b/codepot/src/codepot/views/code_search.php @@ -22,16 +22,18 @@