this.activeMenuId = ko.observable();
window.sammyArchivaApplication = Sammy(function () {
- var self = this;
+
this.get('#quicksearch~:artifactId',function(){
$("#main-content" ).html(mediumSpinnerImg());
var artifactId= this.params.artifactId;
searchRequest.classifier(classifier);
searchRequest.packaging(packaging);
searchRequest.className(className);
-
- searchRequest.selectedRepoIds=repositoryIds;
+ //searchRequest.repositories=repos;
+ //searchRequest.selectedRepoIds=repos;
searchViewModel.searchRequest(searchRequest);
displaySearch(function(){
- searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repositoryIds);
+ searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repos);//,repositoryIds);
},searchViewModel);
}
- self.get("#advancedsearch/:queryterms",function(){
+ this.get("#advancedsearch/:queryterms",function(){
advancedSearchRoute(this.params);
});
- self.get("#advancedsearch~:repositoryIds/:queryterms",function(){
+ this.get("#advancedsearch~:repositoryIds/:queryterms",function(){
advancedSearchRoute(this.params);
});
});
}
location+="/"+queryTerm;
- $.log("basicsearch location:"+location);
window.sammyArchivaApplication.setLocation(location);
- //self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
}
this.externalBasicSearch=function(){
var queryTerm=this.searchRequest().queryTerms();
- $.log("externalBasicSearch#queryTerm:"+queryTerm);
self.search("restServices/archivaServices/searchService/quickSearchWithRepositories",this.searchRequest().repositories);
}
this.search("restServices/archivaServices/searchService/searchArtifacts");
}
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(){
$.log("removeFilter:"+self.resultViewModel.originalArtifacts.length);