make advanced search navigable

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-23 16:11:42 +00:00
parent ffb5c2ff0e
commit 50f63a49ab
2 changed files with 55 additions and 10 deletions

View File

@ -178,7 +178,7 @@ function($,sammy,tmpl,ui) {
this.activeMenuId = ko.observable(); this.activeMenuId = ko.observable();
window.sammyArchivaApplication = Sammy(function () { window.sammyArchivaApplication = Sammy(function () {
var self = this;
this.get('#quicksearch~:artifactId',function(){ this.get('#quicksearch~:artifactId',function(){
$("#main-content" ).html(mediumSpinnerImg()); $("#main-content" ).html(mediumSpinnerImg());
var artifactId= this.params.artifactId; var artifactId= this.params.artifactId;
@ -267,20 +267,20 @@ function($,sammy,tmpl,ui) {
searchRequest.classifier(classifier); searchRequest.classifier(classifier);
searchRequest.packaging(packaging); searchRequest.packaging(packaging);
searchRequest.className(className); searchRequest.className(className);
//searchRequest.repositories=repos;
searchRequest.selectedRepoIds=repositoryIds; //searchRequest.selectedRepoIds=repos;
searchViewModel.searchRequest(searchRequest); searchViewModel.searchRequest(searchRequest);
displaySearch(function(){ displaySearch(function(){
searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repositoryIds); searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repos);//,repositoryIds);
},searchViewModel); },searchViewModel);
} }
self.get("#advancedsearch/:queryterms",function(){ this.get("#advancedsearch/:queryterms",function(){
advancedSearchRoute(this.params); advancedSearchRoute(this.params);
}); });
self.get("#advancedsearch~:repositoryIds/:queryterms",function(){ this.get("#advancedsearch~:repositoryIds/:queryterms",function(){
advancedSearchRoute(this.params); advancedSearchRoute(this.params);
}); });

View File

@ -1567,14 +1567,11 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
}); });
} }
location+="/"+queryTerm; location+="/"+queryTerm;
$.log("basicsearch location:"+location);
window.sammyArchivaApplication.setLocation(location); window.sammyArchivaApplication.setLocation(location);
//self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
} }
this.externalBasicSearch=function(){ this.externalBasicSearch=function(){
var queryTerm=this.searchRequest().queryTerms(); var queryTerm=this.searchRequest().queryTerms();
$.log("externalBasicSearch#queryTerm:"+queryTerm);
self.search("restServices/archivaServices/searchService/quickSearchWithRepositories",this.searchRequest().repositories); self.search("restServices/archivaServices/searchService/quickSearchWithRepositories",this.searchRequest().repositories);
} }
@ -1585,7 +1582,55 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
this.search("restServices/archivaServices/searchService/searchArtifacts"); this.search("restServices/archivaServices/searchService/searchArtifacts");
} }
advancedSearch=function(){ advancedSearch=function(){
self.search("restServices/archivaServices/searchService/searchArtifacts"); var location="#advancedsearch";
self.selectedRepoIds=[];
mainContent.find("#search-basic-repositories" )
.find(".chzn-choices li span").each(function(i,span){
self.selectedRepoIds.push($(span).html());
}
);
if (self.selectedRepoIds.length>0){
$.log("selectedRepoIds:"+self.selectedRepoIds.length);
$(self.selectedRepoIds).each(function(index, Element){
location+="~"+self.selectedRepoIds[index];
});
}
location+="/";
if(self.searchRequest().groupId()){
location+=self.searchRequest().groupId();
}/*else{
location+='~';
}*/
if(self.searchRequest().artifactId()){
location+='~'+self.searchRequest().artifactId();
}else{
location+='~';
}
if(self.searchRequest().version()){
location+='~'+self.searchRequest().version();
}else{
location+='~';
}
if(self.searchRequest().classifier()){
location+='~'+self.searchRequest().classifier();
}else{
location+='~';
}
if(self.searchRequest().packaging()){
location+='~'+self.searchRequest().packaging();
}else{
location+='~';
}
if(self.searchRequest().className()){
location+='~'+self.searchRequest().className();
}else{
location+='~';
}
$.log("location:"+location);
window.sammyArchivaApplication.setLocation(location);
} }
removeFilter=function(){ removeFilter=function(){
$.log("removeFilter:"+self.resultViewModel.originalArtifacts.length); $.log("removeFilter:"+self.resultViewModel.originalArtifacts.length);