summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-02-27 16:58:37 +0000
committerOlivier Lamy <olamy@apache.org>2012-02-27 16:58:37 +0000
commit68cd673255b8eb169123d25ba479d0343b280c6b (patch)
treee03f64ef48650344fdf538ae5599f76acf017d7e
parenta89c5eec8268c29d6ef4c0ceba86211eb57ad101 (diff)
downloadarchiva-68cd673255b8eb169123d25ba479d0343b280c6b.tar.gz
archiva-68cd673255b8eb169123d25ba479d0343b280c6b.zip
validate query terms are not empty
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1294225 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties3
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js16
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html2
3 files changed, 17 insertions, 4 deletions
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
index b2bbef78f..f0c7bd8a4 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
+++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
@@ -215,4 +215,5 @@ search.artifact.search.form.query.className=Class Name
search.artifact.search.form.query.repositories=Repositories
search.artifact.search.form.advanced=Advanced Parameters
search.artifact.search.form.query.artifactId=Artifact ID
-
+search.artifact.search.form.repositories.all=All
+search.artifact.search.form.terms.empty=You must enter some search terms.
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
index 5a5dd3f54..eb1328567 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
@@ -551,8 +551,20 @@ $(function() {
this.selectedRepoIds=[];
basicSearch=function(){
- $.log("query:"+this.searchParameters().basicQueryString());
- $.log("repoIds:"+this.selectedRepoIds);
+ //$.log("query:"+this.searchParameters().basicQueryString());
+ //$.log("repoIds:"+this.selectedRepoIds);
+ var queryTerm=this.searchParameters().basicQueryString();
+ if (!queryTerm || $.trim(queryTerm).length<1){
+ $.log("empty");
+ var errorList=[{
+ message: $.i18n.prop("search.artifact.search.form.terms.empty"),
+ element: $("#main-content #search-basic-form #search-terms" ).get(0)
+ }];
+ customShowError("#main-content #search-basic-form", null, null, errorList);
+ } else {
+ // cleanup previours error message
+ customShowError("#main-content #search-basic-form", null, null, []);
+ }
}
advancedSearch=function(){
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
index 55bdbc638..c98c62b8b 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
@@ -187,7 +187,7 @@
<select data-placeholder="${$.i18n.prop('search.artifact.search.form.query.repositories')}"
id="search-basic-repostories-select" class="chzn-select"
multiple style="width:350px;" tabindex="4">
- <option value="">All</option>
+ <option value="all">${$.i18n.prop('search.artifact.search.form.repositories.all')}</option>
{{each(i,repoId) observableRepoIds}}
<option value="${repoId}">${repoId}</option>
{{/each}}