# 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
This commit is contained in:
parent
1ffe44458e
commit
fdb7d35198
@ -18,7 +18,7 @@ class SubversionModel extends Model
|
|||||||
return $canonical;
|
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}";
|
//$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}";
|
||||||
$orgurl = 'file://'.$this->_canonical_path(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;
|
if (array_key_exists ($info0['path'], $lsinfo) === FALSE) return FALSE;
|
||||||
$fileinfo = $lsinfo[$info0['path']];
|
$fileinfo = $lsinfo[$info0['path']];
|
||||||
|
|
||||||
$str = @svn_cat ($workurl, $rev);
|
if ($no_file_content)
|
||||||
if ($str === FALSE) return FALSE;
|
{
|
||||||
|
$str = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$str = @svn_cat ($workurl, $rev);
|
||||||
|
if ($str === FALSE) return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
$log = @svn_log ($workurl,
|
$log = @svn_log ($workurl,
|
||||||
$fileinfo['created_rev'],
|
$fileinfo['created_rev'],
|
||||||
@ -73,8 +80,7 @@ class SubversionModel extends Model
|
|||||||
}
|
}
|
||||||
else $fileinfo['properties'] = NULL;
|
else $fileinfo['properties'] = NULL;
|
||||||
|
|
||||||
$fileinfo['fullpath'] = substr (
|
$fileinfo['fullpath'] = substr ($info0['url'], strlen($info0['repos']));
|
||||||
$info0['url'], strlen($info0['repos']));
|
|
||||||
$fileinfo['content'] = $str;
|
$fileinfo['content'] = $str;
|
||||||
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
$fileinfo['logmsg'] = (count($log) > 0)? $log[0]['msg']: '';
|
||||||
|
|
||||||
|
@ -211,15 +211,17 @@ $(function () {
|
|||||||
//$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide();
|
//$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide();
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
$('#code_folder_search_submit').button().click (function (e) {
|
$('#code_search_submit').button().click (function () {
|
||||||
if ($.trim($("#code_folder_search_string").val()) != "")
|
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) {
|
$('#code_search_form').submit (function(e) {
|
||||||
if ($.trim($("#code_folder_search_string").val()) === "")
|
if ($.trim($("#code_search_string").val()) === "")
|
||||||
{
|
{
|
||||||
// prevent submission when the search string is empty.
|
// prevent submission when the search string is empty.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -310,7 +312,7 @@ $this->load->view (
|
|||||||
<div class="infostrip" id="code_folder_mainarea_infostrip">
|
<div class="infostrip" id="code_folder_mainarea_infostrip">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
print form_open("code/search/{$project->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'] != ''))
|
if (CODEPOT_SIGNIN_FOR_CODE_SEARCH === FALSE || (isset($login['id']) && $login['id'] != ''))
|
||||||
{
|
{
|
||||||
@ -319,7 +321,7 @@ $this->load->view (
|
|||||||
print form_input(array(
|
print form_input(array(
|
||||||
'name' => 'search_string',
|
'name' => 'search_string',
|
||||||
'value' => set_value('search_string', ''),
|
'value' => set_value('search_string', ''),
|
||||||
'id' =>'code_folder_search_string',
|
'id' =>'code_search_string',
|
||||||
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
|
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -386,8 +388,8 @@ $this->load->view (
|
|||||||
);
|
);
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
//print form_submit('search_submit', $this->lang->line('Search'), 'id="code_folder_search_submit"');
|
//print form_submit('search_submit', $this->lang->line('Search'), 'id="code_search_submit"');
|
||||||
printf ('<a id="code_folder_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
printf ('<a id="code_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
||||||
print ' | ';
|
print ' | ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,16 +22,18 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$('#code_search_search_submit').button().click (function (e) {
|
$('#code_search_submit').button().click (function (e) {
|
||||||
if ($.trim($("#code_search_search_string").val()) != "")
|
if ($.trim($("#code_search_string").val()) != "")
|
||||||
{
|
{
|
||||||
$('#code_search_search_form').submit ();
|
$('#code_search_submit').button ('disable');
|
||||||
|
$('#code_search_string').addClass ('search-in-progress');
|
||||||
|
$('#code_search_form').submit ();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$('#code_search_search_form').submit (function(e) {
|
$('#code_search_form').submit (function(e) {
|
||||||
if ($.trim($("#code_search_search_string").val()) === "")
|
if ($.trim($("#code_search_string").val()) === "")
|
||||||
{
|
{
|
||||||
// prevent submission when the search string is empty.
|
// prevent submission when the search string is empty.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -135,13 +137,13 @@ $this->load->view (
|
|||||||
|
|
||||||
<div class="infostrip" id="code_search_mainarea_infostrip">
|
<div class="infostrip" id="code_search_mainarea_infostrip">
|
||||||
<?php
|
<?php
|
||||||
print form_open("code/search/{$project->id}/", 'id="code_search_search_form"');
|
print form_open("code/search/{$project->id}/", 'id="code_search_form"');
|
||||||
print form_hidden ('search_folder', set_value('search_folder', $file['fullpath']), 'id="code_search_search_folder"');
|
print form_hidden ('search_folder', set_value('search_folder', $file['fullpath']), 'id="code_search_search_folder"');
|
||||||
print form_hidden ('search_revision', set_value('search_revision', $revision), 'id="code_search_search_revision"');
|
print form_hidden ('search_revision', set_value('search_revision', $revision), 'id="code_search_search_revision"');
|
||||||
print form_input(array(
|
print form_input(array(
|
||||||
'name' => 'search_string',
|
'name' => 'search_string',
|
||||||
'value' => set_value('search_string', ''),
|
'value' => set_value('search_string', ''),
|
||||||
'id' =>'code_search_search_string',
|
'id' =>'code_search_string',
|
||||||
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
|
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -206,10 +208,14 @@ $this->load->view (
|
|||||||
);
|
);
|
||||||
|
|
||||||
print ' ';
|
print ' ';
|
||||||
printf ('<a id="code_search_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
printf ('<a id="code_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
||||||
//print form_submit ('search_submit', $this->lang->line('Search'), 'id="code_search_search_submit"');
|
//print form_submit ('search_submit', $this->lang->line('Search'), 'id="code_search_submit"');
|
||||||
print ' | ';
|
print ' | ';
|
||||||
printf ('%s: %s', $this->lang->line('Revision'), $file['created_rev']);
|
print anchor (
|
||||||
|
"code/revision/{$project->id}/!/{$file['created_rev']}",
|
||||||
|
sprintf("%s %s", $this->lang->line('Revision'), $file['created_rev'])
|
||||||
|
);
|
||||||
|
|
||||||
print form_close();
|
print form_close();
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -236,7 +242,7 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
|
|||||||
foreach ($file_list as $f)
|
foreach ($file_list as $f)
|
||||||
{
|
{
|
||||||
$fullpath = $file['fullpath'] . '/' . $f['name'];
|
$fullpath = $file['fullpath'] . '/' . $f['name'];
|
||||||
$file2 = $controller->subversion->getFile ($project->id, $fullpath, $revision);
|
$file2 = $controller->subversion->getFile ($project->id, $fullpath, $revision, $in_name);
|
||||||
if ($file2 !== FALSE)
|
if ($file2 !== FALSE)
|
||||||
{
|
{
|
||||||
if ($file2['type'] == 'file')
|
if ($file2['type'] == 'file')
|
||||||
@ -283,21 +289,34 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
|
|||||||
htmlspecialchars($fullpath));
|
htmlspecialchars($fullpath));
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<pre class="prettyprint">';
|
|
||||||
if ($in_name)
|
if ($in_name)
|
||||||
{
|
{
|
||||||
|
print '<pre class="prettyprint">';
|
||||||
print htmlspecialchars($file2['name']);
|
print htmlspecialchars($file2['name']);
|
||||||
|
print '</pre>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$fileext = substr(strrchr($file2['name'], '.'), 1);
|
||||||
|
if ($fileext == "") $fileext = "html";
|
||||||
|
|
||||||
|
print '<pre class="line-numbered">';
|
||||||
|
print '<span class="line-number-block">';
|
||||||
|
foreach ($matchlines as $linenum => $line)
|
||||||
|
{
|
||||||
|
print "<span>{$linenum}</span>";
|
||||||
|
}
|
||||||
|
print '</span>';
|
||||||
|
print "<code class='line-numbered-code prettyprint lang-{$fileext}'>";
|
||||||
foreach ($matchlines as $linenum => $line)
|
foreach ($matchlines as $linenum => $line)
|
||||||
{
|
{
|
||||||
printf ('% 6d: ', $linenum);
|
|
||||||
print htmlspecialchars($line);
|
print htmlspecialchars($line);
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
print '</code>';
|
||||||
|
print '<span class="line-number-clear"></span>';
|
||||||
|
print '</pre>';
|
||||||
}
|
}
|
||||||
print '</pre>';
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
@ -350,36 +350,16 @@
|
|||||||
* project source search view (including folder view)
|
* project source search view (including folder view)
|
||||||
*-----------------------------------------------*/
|
*-----------------------------------------------*/
|
||||||
|
|
||||||
|
#code_search_string.search-in-progress {
|
||||||
#code_search_invertedly_label .ui-button-text {
|
background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 0.5em;
|
|
||||||
width: 1em;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#code_search_case_insensitively_label .ui-button-text {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 0.5em;
|
|
||||||
width: 1em;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#code_search_recursively_label .ui-button-text {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 0.5em;
|
|
||||||
width: 1em;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#code_search_in_name_label .ui-button-text {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-right: 0.5em;
|
|
||||||
width: 1em;
|
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#code_search_invertedly_label .ui-button-text,
|
||||||
|
#code_search_case_insensitively_label .ui-button-text,
|
||||||
|
#code_search_recursively_label .ui-button-text,
|
||||||
|
#code_search_in_name_label .ui-button-text,
|
||||||
#code_search_is_regex_label .ui-button-text {
|
#code_search_is_regex_label .ui-button-text {
|
||||||
|
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
padding-right: 0.5em;
|
padding-right: 0.5em;
|
||||||
width: 1em;
|
width: 1em;
|
||||||
|
Loading…
Reference in New Issue
Block a user