summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-06-27 01:35:56 +0200
committerlpsolit%gmail.com <>2007-06-27 01:35:56 +0200
commitf32106f83ffc2dda1420123744881f0e740aa715 (patch)
treefad10fadb4cb4bea8fe05432bd092cdc5828a58d
parent8699690c76360c62e748f5557831243322655bfd (diff)
downloadbugzilla-f32106f83ffc2dda1420123744881f0e740aa715.tar.gz
bugzilla-f32106f83ffc2dda1420123744881f0e740aa715.tar.xz
Bug 385910: Add parameter to allow "find a specific bug" to accept an empty search - Patch by Brad Johnson <fk7q01p02@sneakemail.com> r/a=LpSolit
-rw-r--r--Bugzilla/Config/Query.pm10
-rwxr-xr-xbuglist.cgi9
-rw-r--r--template/en/default/admin/params/query.html.tmpl4
-rw-r--r--template/en/default/search/search-specific.html.tmpl9
4 files changed, 25 insertions, 7 deletions
diff --git a/Bugzilla/Config/Query.pm b/Bugzilla/Config/Query.pm
index e3996a0ee..afd330898 100644
--- a/Bugzilla/Config/Query.pm
+++ b/Bugzilla/Config/Query.pm
@@ -72,7 +72,15 @@ sub get_param_list {
type => 't',
default => '4',
checker => \&check_numeric
- } );
+ },
+
+ {
+ name => 'quicksearch_allow_empty_words',
+ type => 'b',
+ default => 0
+ }
+
+ );
return @param_list;
}
diff --git a/buglist.cgi b/buglist.cgi
index 6c7f9a451..0f5c55691 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -74,9 +74,12 @@ if (defined($searchstring)) {
# as if this had been a normal query from the beginning.
}
-# Reject empty searches from the simple search form, including
-# words being a single or several consecutive whitespaces only.
-if (defined($cgi->param('content')) && $cgi->param('content') =~ /^\s*$/) {
+# If configured to not allow empty words, reject empty searches from the
+# simple search form, including words being a single or several consecutive
+# whitespaces only.
+if (!Bugzilla->params->{'quicksearch_allow_empty_words'}
+ && defined($cgi->param('content')) && $cgi->param('content') =~ /^\s*$/)
+{
ThrowUserError("buglist_parameters_required");
}
diff --git a/template/en/default/admin/params/query.html.tmpl b/template/en/default/admin/params/query.html.tmpl
index ca4280f62..b3f0b0f66 100644
--- a/template/en/default/admin/params/query.html.tmpl
+++ b/template/en/default/admin/params/query.html.tmpl
@@ -54,5 +54,7 @@
quicksearch_comment_cutoff => "The maximum number of search terms for a QuickSearch " _
"to search comments. If the QuickSearch query contains " _
- "more terms than this value, QuickSearch will not search comments." }
+ "more terms than this value, QuickSearch will not search comments.",
+
+ quicksearch_allow_empty_words => "Whether to allow a QuickSearch with empty Words." }
%]
diff --git a/template/en/default/search/search-specific.html.tmpl b/template/en/default/search/search-specific.html.tmpl
index d93abd883..af633ddf7 100644
--- a/template/en/default/search/search-specific.html.tmpl
+++ b/template/en/default/search/search-specific.html.tmpl
@@ -109,12 +109,17 @@ for "crash secure SSL flash".
<tr>
<td></td>
<td>
- <input type="submit" id="search" value="Search"
+
+ [% IF Param('quicksearch_allow_empty_words') %]
+ <input type="submit" id="search" value="Search">
+ [% ELSE %]
+ <input type="submit" id="search" value="Search"
onclick="if (this.form.content.value == '')
{alert('The Words field cannot be empty. You have to ' +
'enter at least one word in your search criteria.');
return false;} return true;">
- </td>
+ [% END %]
+ </td>
</tr>
</table>
</form>