added a wildcard pattern input to the code search using X-editable

This commit is contained in:
hyung-hwan 2015-04-26 16:16:29 +00:00
parent 390f154215
commit 12bee69139
18 changed files with 301 additions and 7 deletions

View File

@ -224,6 +224,7 @@ LICENSE
JavaScript Creole 1.0 Wiki Markup Parser See src/js/creole.js JavaScript Creole 1.0 Wiki Markup Parser See src/js/creole.js
jQuery JavaScript Library v1.11.2 MIT See http://jquery.org/license jQuery JavaScript Library v1.11.2 MIT See http://jquery.org/license
jQuery UI 1.9.2 MIT See http://jquery.org/license jQuery UI 1.9.2 MIT See http://jquery.org/license
X-editable 1.5.1 MIT
PHPGraphLib MIT PHPGraphLib MIT
CLOC 1.62 GPL CLOC 1.62 GPL
Flot https://github.com/flot/flot/blob/master/LICENSE.txt Flot https://github.com/flot/flot/blob/master/LICENSE.txt

View File

@ -135,6 +135,8 @@ class Code extends Controller
} }
} }
} }
$data['wildcard_pattern'] = '*';
$this->load->view ($this->VIEW_FOLDER, $data); $this->load->view ($this->VIEW_FOLDER, $data);
} }
} }
@ -767,6 +769,7 @@ class Code extends Controller
$recursively = $this->input->post('search_recursively'); $recursively = $this->input->post('search_recursively');
$in_name = $this->input->post('search_in_name'); $in_name = $this->input->post('search_in_name');
$is_regex = $this->input->post('search_is_regex'); $is_regex = $this->input->post('search_is_regex');
$wildcard_pattern = $this->input->post('search_wildcard_pattern');
$file = $this->subversion->getFile ($project->id, $path, $rev); $file = $this->subversion->getFile ($project->id, $path, $rev);
if ($file === FALSE) if ($file === FALSE)
@ -786,6 +789,7 @@ class Code extends Controller
$data['recursively'] = $recursively; $data['recursively'] = $recursively;
$data['in_name'] = $in_name; $data['in_name'] = $in_name;
$data['is_regex'] = $is_regex; $data['is_regex'] = $is_regex;
$data['wildcard_pattern'] = $wildcard_pattern;
$data['file'] = $file; $data['file'] = $file;
$data['revision'] = $rev; $data['revision'] = $rev;

View File

@ -13,4 +13,5 @@ $lang['CODE_SEARCH_CASE_INSENSITIVELY'] = 'Search case-insensitively';
$lang['CODE_SEARCH_RECURSIVELY'] = 'Search recursively to sub-directories'; $lang['CODE_SEARCH_RECURSIVELY'] = 'Search recursively to sub-directories';
$lang['CODE_SEARCH_IN_NAME'] = 'Search in file names'; $lang['CODE_SEARCH_IN_NAME'] = 'Search in file names';
$lang['CODE_SEARCH_IS_REGEX'] = 'Search string is a regular expression'; $lang['CODE_SEARCH_IS_REGEX'] = 'Search string is a regular expression';
$lang['CODE_SEARCH_WILDCARD'] = 'Enter a wildcard pattern';
?> ?>

View File

@ -13,4 +13,5 @@ $lang['CODE_SEARCH_CASE_INSENSITIVELY'] = '대소문자 구분없이 검색합
$lang['CODE_SEARCH_RECURSIVELY'] = '서브디렉토리를 포함하여 검색합니다'; $lang['CODE_SEARCH_RECURSIVELY'] = '서브디렉토리를 포함하여 검색합니다';
$lang['CODE_SEARCH_IN_NAME'] = '파일이름을 검색합니다'; $lang['CODE_SEARCH_IN_NAME'] = '파일이름을 검색합니다';
$lang['CODE_SEARCH_IS_REGEX'] = '검색어가 정규식입니다'; $lang['CODE_SEARCH_IS_REGEX'] = '검색어가 정규식입니다';
$lang['CODE_SEARCH_WILDCARD'] = '와일드카드 패턴을 입력하세요';
?> ?>

View File

@ -23,6 +23,9 @@
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jqueryui-editable.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jqueryui-editable.css')?>" />
<!--[if lte IE 8]><script type="text/javascript" src="<?php print base_url_make('/js/excanvas.min.js')?>"></script><![endif]--> <!--[if lte IE 8]><script type="text/javascript" src="<?php print base_url_make('/js/excanvas.min.js')?>"></script><![endif]-->
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.min.js')?>"></script>
<script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.time.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery.flot.time.min.js')?>"></script>
@ -256,6 +259,19 @@ $(function () {
$('#code_search_is_regex').button(); $('#code_search_is_regex').button();
$('.code_search_option').tooltip(); $('.code_search_option').tooltip();
//$('#code_search_wildcard').text($('#code_search_wildcard_pattern').val());
$('#code_search_wildcard').text($('input[name=search_wildcard_pattern]').val());
$('#code_search_wildcard').editable({
type: 'text',
title: '<?php print $this->lang->line('CODE_SEARCH_WILDCARD') ?>',
placement: 'bottom',
success: function(response, newValue) {
//$('#code_search_wildcard_pattern').val(newValue);
$('input[name=search_wildcard_pattern]').val(newValue);
}
});
render_readme (); render_readme ();
}); });
@ -409,6 +425,9 @@ $this->load->view (
array('class'=>'code_search_option', 'id'=>'code_search_is_regex_label') array('class'=>'code_search_option', 'id'=>'code_search_is_regex_label')
); );
printf ('<a id="code_search_wildcard" href="#"></a>');
print form_hidden('search_wildcard_pattern', set_value('search_wildcard_pattern', $wildcard_pattern), 'id="code_search_wildcard_pattern"');
print ' '; print ' ';
//print form_submit('search_submit', $this->lang->line('Search'), 'id="code_search_submit"'); //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')); printf ('<a id="code_search_submit" href="#">%s</a>', $this->lang->line('Search'));

View File

@ -21,6 +21,9 @@
<script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script> <script type="text/javascript" src="<?php print base_url_make('/js/jquery-ui.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" /> <link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jquery-ui.css')?>" />
<script type="text/javascript" src="<?php print base_url_make('/js/jqueryui-editable.min.js')?>"></script>
<link type="text/css" rel="stylesheet" href="<?php print base_url_make('/css/jqueryui-editable.css')?>" />
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('#code_search_submit').button().click (function (e) { $('#code_search_submit').button().click (function (e) {
@ -48,6 +51,19 @@ $(function() {
$('#code_search_is_regex').button(); $('#code_search_is_regex').button();
$('.code_search_option').tooltip(); $('.code_search_option').tooltip();
//$('#code_search_wildcard').text($('#code_search_wildcard_pattern').text());
$('#code_search_wildcard').text($('input[name=search_wildcard_pattern]').val());
$('#code_search_wildcard').editable({
type: 'text',
title: '<?php print $this->lang->line('CODE_SEARCH_WILDCARD') ?>',
placement: 'bottom',
success: function(response, newValue) {
//$('#code_search_wildcard_pattern').val(newValue);
$('input[name=search_wildcard_pattern]').val(newValue);
}
});
prettyPrint(); prettyPrint();
}); });
</script> </script>
@ -211,6 +227,9 @@ $this->load->view (
array('class'=>'code_search_option', 'id'=>'code_search_is_regex_label') array('class'=>'code_search_option', 'id'=>'code_search_is_regex_label')
); );
printf ('<a id="code_search_wildcard" href="#"></a>');
print form_hidden('search_wildcard_pattern', set_value('search_wildcard_pattern', $wildcard_pattern), 'id="code_search_wildcard_pattern"');
print ' '; print ' ';
printf ('<a id="code_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_submit"'); //print form_submit ('search_submit', $this->lang->line('Search'), 'id="code_search_submit"');
@ -228,7 +247,7 @@ $this->load->view (
<?php <?php
// this searching part should have been placed in SubversionModel. // this searching part should have been placed in SubversionModel.
function search_and_show ($controller, $project, $path, $revision, $pattern, $invertedly, $case_insensitively, $is_regex, $recurse, $in_name) function search_and_show ($controller, $project, $path, $revision, $pattern, $invertedly, $case_insensitively, $is_regex, $recurse, $in_name, $wildcard)
{ {
//$file = $controller->subversion->getFile ($project->id, $path, $revision); //$file = $controller->subversion->getFile ($project->id, $path, $revision);
//if ($file['type'] == 'file') return; //if ($file['type'] == 'file') return;
@ -251,6 +270,9 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
{ {
if ($file2['type'] == 'file') if ($file2['type'] == 'file')
{ {
if (!empty($wildcard) &&
fnmatch($wildcard, $file2['name'], FNM_PATHNAME | FNM_PERIOD) === FALSE) continue;
if ($in_name) if ($in_name)
{ {
$lines = array ($file2['name']); $lines = array ($file2['name']);
@ -343,7 +365,7 @@ function search_and_show ($controller, $project, $path, $revision, $pattern, $in
if (CODEPOT_ALLOW_SET_TIME_LIMIT) set_time_limit (0); if (CODEPOT_ALLOW_SET_TIME_LIMIT) set_time_limit (0);
// TODO: prevent recursion to subdirectories depending on input // TODO: prevent recursion to subdirectories depending on input
search_and_show ($this, $project, $file['fullpath'], $revision, $pattern, $invertedly, $case_insensitively, $is_regex, $recursively, $in_name); search_and_show ($this, $project, $file['fullpath'], $revision, $pattern, $invertedly, $case_insensitively, $is_regex, $recursively, $in_name, $wildcard_pattern);
?> ?>
</div> <!-- code_search_mainarea_result --> </div> <!-- code_search_mainarea_result -->

View File

@ -230,16 +230,14 @@ $this->load->view (
array_key_exists($issue->priority, $issue_priority_array)? array_key_exists($issue->priority, $issue_priority_array)?
$issue_priority_array[$issue->priority]: $issue->priority $issue_priority_array[$issue->priority]: $issue->priority
); );
print ' | ';
if ($issue->owner != '') if ($issue->owner != '')
{ {
print ' | ';
print $this->lang->line('Owner'); print $this->lang->line('Owner');
print ': '; print ': ';
print htmlspecialchars($issue->owner); print htmlspecialchars($issue->owner);
print ' | ';
} }
?> ?>
<a id="issue_show_mainarea_change_form_open" href="#"><?php print $this->lang->line('Change')?></a>
</div> </div>
<div id="issue_show_mainarea_description"> <div id="issue_show_mainarea_description">
@ -260,6 +258,14 @@ $this->load->view (
print '<span class="title">'; print '<span class="title">';
print $this->lang->line('Change log'); print $this->lang->line('Change log');
print '</span>'; print '</span>';
print '<a id="issue_show_mainarea_change_form_open" href="#">';
print $this->lang->line('Change');
print '</a>';
print ' ';
print '<a id="issue_show_mainarea_undo_change" href="#">'; print '<a id="issue_show_mainarea_undo_change" href="#">';
print $this->lang->line('Undo'); print $this->lang->line('Undo');
print '</a>'; print '</a>';

View File

@ -8,6 +8,7 @@ www_DATA = \
font-awesome.min.css \ font-awesome.min.css \
issue.css \ issue.css \
jquery-ui.css \ jquery-ui.css \
jqueryui-editable.css \
log.css \ log.css \
project.css \ project.css \
site.css \ site.css \

View File

@ -246,6 +246,7 @@ www_DATA = \
font-awesome.min.css \ font-awesome.min.css \
issue.css \ issue.css \
jquery-ui.css \ jquery-ui.css \
jqueryui-editable.css \
log.css \ log.css \
project.css \ project.css \
site.css \ site.css \

View File

@ -388,3 +388,16 @@
width: 1em; width: 1em;
margin: 0; margin: 0;
} }
#code_search_wildcard {
line-height: 1.4;
padding: 0.4em;
border: 1px solid #EB8F00;
color: #EB8F00;
background-color: #F6F6F6;
font-weight: bold;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}

View File

@ -66,7 +66,9 @@ www_DATA = \
ui-icons_222222_256x240.png \ ui-icons_222222_256x240.png \
ui-anim_basic_16x16.gif \ ui-anim_basic_16x16.gif \
up.png \ up.png \
username.png username.png \
jqueryui-editable-loading.gif \
jqueryui-editable-clear.png
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)

View File

@ -265,7 +265,9 @@ www_DATA = \
ui-icons_222222_256x240.png \ ui-icons_222222_256x240.png \
ui-anim_basic_16x16.gif \ ui-anim_basic_16x16.gif \
up.png \ up.png \
username.png username.png \
jqueryui-editable-loading.gif \
jqueryui-editable-clear.png
EXTRA_DIST = $(www_DATA) EXTRA_DIST = $(www_DATA)
all: all-am all: all-am

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,213 @@
/*! X-editable - v1.5.1
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
.editableform {
margin-bottom: 0; /* overwrites bootstrap margin */
}
.editableform .control-group {
margin-bottom: 0; /* overwrites bootstrap margin */
white-space: nowrap; /* prevent wrapping buttons on new line */
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
}
/*
BS3 width:1005 for inputs breaks editable form in popup
See: https://github.com/vitalets/x-editable/issues/393
*/
.editableform .form-control {
width: auto;
}
.editable-buttons {
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
vertical-align: top;
margin-left: 7px;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons.editable-buttons-bottom {
display: block;
margin-top: 7px;
margin-left: 0;
}
.editable-input {
vertical-align: top;
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
white-space: normal; /* reset white-space decalred in parent*/
/* display-inline emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-buttons .editable-cancel {
margin-left: 7px;
}
/*for jquery-ui buttons need set height to look more pretty*/
.editable-buttons button.ui-button-icon-only {
height: 24px;
width: 30px;
}
.editableform-loading {
background: url('images/jqueryui-editable-loading.gif') center center no-repeat;
height: 25px;
width: auto;
min-width: 25px;
}
.editable-inline .editableform-loading {
background-position: left 5px;
}
.editable-error-block {
max-width: 300px;
margin: 5px 0 0 0;
width: auto;
white-space: normal;
}
/*add padding for jquery ui*/
.editable-error-block.ui-state-error {
padding: 3px;
}
.editable-error {
color: red;
}
/* ---- For specific types ---- */
.editableform .editable-date {
padding: 0;
margin: 0;
float: left;
}
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
.editable-inline .add-on .icon-th {
margin-top: 3px;
margin-left: 1px;
}
/* checklist vertical alignment */
.editable-checklist label input[type="checkbox"],
.editable-checklist label span {
vertical-align: middle;
margin: 0;
}
.editable-checklist label {
white-space: nowrap;
}
/* set exact width of textarea to fit buttons toolbar */
.editable-wysihtml5 {
width: 566px;
height: 250px;
}
/* clear button shown as link in date inputs */
.editable-clear {
clear: both;
font-size: 0.9em;
text-decoration: none;
text-align: right;
}
/* IOS-style clear button for text inputs */
.editable-clear-x {
background: url('images/jqueryui-editable-clear.png') center center no-repeat;
display: block;
width: 13px;
height: 13px;
position: absolute;
opacity: 0.6;
z-index: 100;
top: 50%;
right: 6px;
margin-top: -6px;
}
.editable-clear-x:hover {
opacity: 1;
}
.editable-pre-wrapped {
white-space: pre-wrap;
}
.editable-container.editable-popup {
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
}
.editable-container.popover {
width: auto; /* without this rule popover does not stretch */
}
.editable-container.editable-inline {
display: inline-block;
vertical-align: middle;
width: auto;
/* inline-block emulation for IE7*/
zoom: 1;
*display: inline;
}
.editable-container.ui-widget {
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
}
.editable-click,
a.editable-click,
a.editable-click:hover {
text-decoration: none;
border-bottom: dashed 1px #0088cc;
}
.editable-click.editable-disabled,
a.editable-click.editable-disabled,
a.editable-click.editable-disabled:hover {
color: #585858;
cursor: default;
border-bottom: none;
}
.editable-empty, .editable-empty:hover, .editable-empty:focus{
font-style: italic;
color: #DD1144;
/* border-bottom: none; */
text-decoration: none;
}
.editable-unsaved {
font-weight: bold;
}
.editable-unsaved:after {
/* content: '*'*/
}
.editable-bg-transition {
-webkit-transition: background-color 1400ms ease-out;
-moz-transition: background-color 1400ms ease-out;
-o-transition: background-color 1400ms ease-out;
-ms-transition: background-color 1400ms ease-out;
transition: background-color 1400ms ease-out;
}
/*see https://github.com/vitalets/x-editable/issues/139 */
.form-horizontal .editable
{
padding-top: 5px;
display:inline-block;
}

View File

@ -23,6 +23,7 @@ www_DATA = \
jquery.flot.time.min.js \ jquery.flot.time.min.js \
excanvas.min.js \ excanvas.min.js \
jquery.flot.tickrotor.js \ jquery.flot.tickrotor.js \
jqueryui-editable.min.js \
d3.min.js \ d3.min.js \
CodeFlower.js CodeFlower.js

View File

@ -261,6 +261,7 @@ www_DATA = \
jquery.flot.time.min.js \ jquery.flot.time.min.js \
excanvas.min.js \ excanvas.min.js \
jquery.flot.tickrotor.js \ jquery.flot.tickrotor.js \
jqueryui-editable.min.js \
d3.min.js \ d3.min.js \
CodeFlower.js CodeFlower.js

File diff suppressed because one or more lines are too long