# 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;
|
||||
}
|
||||
|
||||
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']];
|
||||
|
||||
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']: '';
|
||||
|
||||
|
@ -211,15 +211,17 @@ $(function () {
|
||||
//$("#code_folder_mainarea_result_info_loc_progress" ).progressbar().hide();
|
||||
<?php endif; ?>
|
||||
|
||||
$('#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 (
|
||||
<div class="infostrip" id="code_folder_mainarea_infostrip">
|
||||
|
||||
<?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'] != ''))
|
||||
{
|
||||
@ -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 ('<a id="code_folder_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
||||
//print form_submit('search_submit', $this->lang->line('Search'), 'id="code_search_submit"');
|
||||
printf ('<a id="code_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
||||
print ' | ';
|
||||
}
|
||||
|
||||
|
@ -22,16 +22,18 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#code_search_search_submit').button().click (function (e) {
|
||||
if ($.trim($("#code_search_search_string").val()) != "")
|
||||
$('#code_search_submit').button().click (function (e) {
|
||||
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) {
|
||||
if ($.trim($("#code_search_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();
|
||||
@ -135,13 +137,13 @@ $this->load->view (
|
||||
|
||||
<div class="infostrip" id="code_search_mainarea_infostrip">
|
||||
<?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_revision', set_value('search_revision', $revision), 'id="code_search_search_revision"');
|
||||
print form_input(array(
|
||||
'name' => 'search_string',
|
||||
'value' => set_value('search_string', ''),
|
||||
'id' =>'code_search_search_string',
|
||||
'id' =>'code_search_string',
|
||||
'placeholder' => $this->lang->line('CODE_SEARCH_STRING')
|
||||
));
|
||||
|
||||
@ -206,10 +208,14 @@ $this->load->view (
|
||||
);
|
||||
|
||||
print ' ';
|
||||
printf ('<a id="code_search_search_submit" href="#">%s</a>', $this->lang->line('Search'));
|
||||
//print form_submit ('search_submit', $this->lang->line('Search'), 'id="code_search_search_submit"');
|
||||
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_submit"');
|
||||
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();
|
||||
?>
|
||||
</div>
|
||||
@ -236,7 +242,7 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
|
||||
foreach ($file_list as $f)
|
||||
{
|
||||
$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['type'] == 'file')
|
||||
@ -283,21 +289,34 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
|
||||
htmlspecialchars($fullpath));
|
||||
print '</div>';
|
||||
|
||||
print '<pre class="prettyprint">';
|
||||
if ($in_name)
|
||||
{
|
||||
print '<pre class="prettyprint">';
|
||||
print htmlspecialchars($file2['name']);
|
||||
print '</pre>';
|
||||
}
|
||||
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)
|
||||
{
|
||||
printf ('% 6d: ', $linenum);
|
||||
print htmlspecialchars($line);
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print '</code>';
|
||||
print '<span class="line-number-clear"></span>';
|
||||
print '</pre>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
@ -350,36 +350,16 @@
|
||||
* project source search view (including folder view)
|
||||
*-----------------------------------------------*/
|
||||
|
||||
|
||||
#code_search_invertedly_label .ui-button-text {
|
||||
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_string.search-in-progress {
|
||||
background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
|
||||
}
|
||||
|
||||
#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 {
|
||||
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
width: 1em;
|
||||
|
Loading…
Reference in New Issue
Block a user